From 5c46627e34171cca2081e09b55d5cf436b809360 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 4 Jul 2010 02:11:11 +0000 Subject: [PATCH] Start with add attribute --- .../create-file/create_phpclass.py | 8 +- dev/manage-code/create-file/example | 2 +- html/parametre.php | 15 ++- include/card_attr.inc.php | 105 ++++++++++++++++++ sql/upgrade.sql | 8 +- 5 files changed, 130 insertions(+), 8 deletions(-) create mode 100644 include/card_attr.inc.php diff --git a/dev/manage-code/create-file/create_phpclass.py b/dev/manage-code/create-file/create_phpclass.py index a16c114af..8c9ed3afc 100755 --- a/dev/manage-code/create-file/create_phpclass.py +++ b/dev/manage-code/create-file/create_phpclass.py @@ -67,7 +67,7 @@ class @class_name@ @mother_class@ $this->cn=$p_cn; if ( $p_id == 0 ) { /* Initialize an empty object */ - foreach ($this->variable as $key=>$value) $this->$key=''; + foreach ($this->variable as $key=>$value) $this->$value=''; } else { /* load it */ $this->@id@=$p_id; @@ -75,8 +75,8 @@ class @class_name@ @mother_class@ } } public function get_parameter($p_string) { - if ( array_key_exists($p_string,$this->$variable) ) { - $idx=$this->$variable[$p_string]; + if ( array_key_exists($p_string,$this->variable) ) { + $idx=$this->variable[$p_string]; return $this->$idx; } else @@ -90,7 +90,7 @@ class @class_name@ @mother_class@ else throw new Exception (__FILE__.":".__LINE__.$p_string.'Erreur attribut inexistant'); } - public function get_info() { return var_export(self::$variable,true); } + public function get_info() { return var_export($this,true); } public function verify() { // Verify that the elt we want to add is correct /* verify only the datatype */ diff --git a/dev/manage-code/create-file/example b/dev/manage-code/create-file/example index ef6b9011a..8269dcba2 100644 --- a/dev/manage-code/create-file/example +++ b/dev/manage-code/create-file/example @@ -2,5 +2,5 @@ Fiche_Attr attr_def ad_id | integer ad_text | text - ad_type | text + ad_type | numeric diff --git a/html/parametre.php b/html/parametre.php index ab09f7712..b52a972bb 100644 --- a/html/parametre.php +++ b/html/parametre.php @@ -135,7 +135,8 @@ if ( $p_action == 'divers') { array('parametre.php?p_action=divers&sa=tva&'.$s,_('Tva'),_('Taux et poste comptable tva'),4), array('parametre.php?p_action=divers&sa=poste&'.$s,_('Poste Comptable'),_('Poste comptable constant'),7), array('parametre.php?p_action=divers&sa=fiche&'.$s,_('Catégorie de fiche'),_('Modifie les classe de base, les attribut,...'),5), - array('parametre.php?p_action=divers&sa=cdoc&'.$s,_('Catégorie de documents'),_('Ajoute des catégories de documents,...'),6) + array('parametre.php?p_action=divers&sa=cdoc&'.$s,_('Catégorie de documents'),_('Ajoute des catégories de documents,...'),6), + array('parametre.php?p_action=divers&sa=fat&'.$s,_('Attribut de fiche'),_('Modifie les attributs des catégories de fiches'),10) ); $sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:''; $sb=(isset($_REQUEST['sb']))?$_REQUEST['sb']:''; @@ -156,6 +157,9 @@ if ( $p_action == 'divers') { case 'cdoc': $def=6; break; + case 'fat': + $def=10; + break; } echo '