From 6ea1cc1a0439e24d5ac024ceabb663c1f0b10643 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 24 Dec 2007 15:27:30 +0000 Subject: [PATCH] Add Documentation + cosmetics --- html/budget.php | 1 + include/class_acc_bilan.php | 4 +- include/class_acexception.php | 2 +- include/class_anc_balance_double.php | 2 +- include/class_anc_plan.php | 6 +- include/class_anc_print.php | 4 +- include/class_bud_card.php | 2 + include/class_bud_data.php | 84 +++++++++++++++++++++++++--- include/class_bud_detail.php | 28 +++++++--- include/class_bud_detail_periode.php | 14 +++-- include/class_bud_hypo.php | 3 + include/class_document_type.php | 52 ----------------- include/class_dossier.php | 4 +- include/class_gestion_table.php | 4 +- include/class_pre_operation.php | 9 ++- 15 files changed, 132 insertions(+), 87 deletions(-) delete mode 100644 include/class_document_type.php diff --git a/html/budget.php b/html/budget.php index f186e93fd..6c7423961 100644 --- a/html/budget.php +++ b/html/budget.php @@ -91,6 +91,7 @@ echo ShowItem(array( // echo ''; +echo ''; $cn=DbConnect($gDossier); /*! \todo module budget add the security diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php index 0d945ae7a..f3268d625 100644 --- a/include/class_acc_bilan.php +++ b/include/class_acc_bilan.php @@ -20,10 +20,10 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file */ -/* \brief this class handle the different bilan, from the table bilan +/*! \brief this class handle the different bilan, from the table bilan * */ require_once ('postgres.php'); diff --git a/include/class_acexception.php b/include/class_acexception.php index 9efca367f..f91a53afc 100644 --- a/include/class_acexception.php +++ b/include/class_acexception.php @@ -23,7 +23,7 @@ /*!\file */ -/* \brief acException extends Exception +/*! \brief acException extends Exception * */ class AcException extends Exception { diff --git a/include/class_anc_balance_double.php b/include/class_anc_balance_double.php index 429555c60..13b59dae9 100644 --- a/include/class_anc_balance_double.php +++ b/include/class_anc_balance_double.php @@ -25,7 +25,7 @@ * Print the crossed balance between 2 plan */ -/* \brief +/*! \brief * Print the crossed balance between 2 plan * */ diff --git a/include/class_anc_plan.php b/include/class_anc_plan.php index 35ff2c3fb..8e4b3b778 100644 --- a/include/class_anc_plan.php +++ b/include/class_anc_plan.php @@ -20,11 +20,11 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file */ -/* \brief - * Concerns the Analytic class +/*! \brief + * Concerns the Analytic plan (table plan_analytique) */ require_once("constant.php"); require_once("postgres.php"); diff --git a/include/class_anc_print.php b/include/class_anc_print.php index 67ae9869f..b65c85948 100644 --- a/include/class_anc_print.php +++ b/include/class_anc_print.php @@ -20,10 +20,10 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file */ -/* \brief this class is the mother class for the CA printing +/*! \brief this class is the mother class for the CA printing * * */ diff --git a/include/class_bud_card.php b/include/class_bud_card.php index e91742102..c984d6f12 100644 --- a/include/class_bud_card.php +++ b/include/class_bud_card.php @@ -21,6 +21,8 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /*! \file + */ +/*! * \brief class to manage the table bud_detail * */ diff --git a/include/class_bud_data.php b/include/class_bud_data.php index 9d22128f5..d2485379e 100644 --- a/include/class_bud_data.php +++ b/include/class_bud_data.php @@ -21,7 +21,9 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /*!\file - * \brief it is a object including the class bud_detail bud_card,and + */ + +/*! \brief it is a object including the class bud_detail bud_card,and * bud_detail_periode, * the purpose is to insert or save into bud_detail_periode */ @@ -41,7 +43,8 @@ class Bud_Data { var $bd_id; var $pcm_val; - var $amount; + var $amount; /*!< array of amount, the key is the + p_id and the content is the amount */ var $cn; var $bud_detail_periode; @@ -54,6 +57,10 @@ class Bud_Data { } + /*!\brief Load Data from Database + * + * \return an array of Bud_Data objects + */ function load() { if ( $this->po_id == -1) $sql_po_id="po_id is null"; @@ -88,6 +95,7 @@ class Bud_Data { echo_debug(__FILE__,__LINE__," load "); echo_debug(__FILE__,__LINE__,$obj); try { + // get the the bud_detail_periode for this bud_detail $arg=array($obj->bd_id); $res2=ExecSqlParam($this->cn,$sql_periode,$arg); $per=pg_fetch_all($res2); @@ -104,14 +112,18 @@ class Bud_Data { $p_id=$row2['p_id']; $obj->amount[$p_id]=$row2['bdp_amount']; } + $ret[]=clone $obj; } - $ret[]=clone $obj; } echo_debug(__FILE__.':'.__LINE__,'Return load',$ret); return $ret; } + /*!\brief create a empty row (subform) + * + * \return a Bud_Data object + */ - function create_empty_row() { + private function create_empty_row() { $ret=new Bud_Data($this->cn,$this->bh_id,$this->po_id); $ret->bd_id=0; $ret->pcm_lib=""; @@ -124,12 +136,22 @@ class Bud_Data { } return $ret; } + /*!\brief convert the array loaded from the database into data member + * \param array + * + */ private function load_from_array($p_array) { foreach (array('bd_id','bh_id','bc_id','pcm_val','pcm_lib','bh_name','bc_code') as $key) { $this->{$key}=$p_array[$key]; } } + /*!\brief create all the row of the form, MAX_BUD_DETAIL is the + * maximum of sub form the form may contains (defined in constant.php) + * + * \return string with html code + */ + function form() { $r=""; $array=$this->load(); @@ -154,6 +176,10 @@ class Bud_Data { return $r; } + /*!\brief Create one form + * \param the style + * \return string + */ private function create_row($p_style="odd") { static $p_number=0; @@ -206,10 +232,6 @@ class Bud_Data { $button_change->javascript='bud_form_enable('.$p_number.')'; $r.=$button_change->IOValue('button_change'.$p_number); - $button_escape=new widget('button','Echapper'); - $button_escape->javascript='bud_form_disable('.$p_number.')'; - $button_escape->extra='style="display:none"'; - $r.=$button_escape->IOValue('button_escape'.$p_number); $button_save=new widget('button','Sauve'); $button_save->javascript='bud_form_save('.$p_number.')'; @@ -220,10 +242,20 @@ class Bud_Data { $button_delete->javascript='bud_form_delete('.$p_number.')'; $button_delete->extra='style="display:none"'; $r.=$button_delete->IOValue('button_delete'.$p_number); + + $button_escape=new widget('button','Echapper'); + $button_escape->javascript='bud_form_disable('.$p_number.')'; + $button_escape->extra='style="display:none"'; + $r.=$button_escape->IOValue('button_escape'.$p_number); + $r.=''; $r.="
"; return $r; } + /*!\brief Load all the card of a Hypothese + * + * \return double array [0][bc_id, bc_code] + */ private function load_bud_card() { if ( !isset ($this->array_bud_card) ) @@ -233,6 +265,11 @@ class Bud_Data { return $this->array_bud_card; } + /*!\brief create the heading line for the table ( of a form) + * + * \return String + */ + private function header_table() { if ( ! isset ($this->header ) ){ $r=''; @@ -246,6 +283,12 @@ class Bud_Data { } return $this->header; } + /*!\brief convert an array into an object Bud_Detail_Periode the + * array must contains the keys bd_id, po_id,bc_id,pcm_val, bh_id + * and amount_xx where xx stands for the p_id (pk of parm_periode) + * \param array + * + */ function get_from_array($p_array) { foreach (array('bd_id','po_id','bc_id','pcm_val','bh_id') as $attr) { @@ -257,6 +300,11 @@ class Bud_Data { $this->get_form_detail_periode($p_array); echo_debug(__FILE__.':'.__LINE__.'- get_from_array','',$this); } + + /*!\brief Add in the table Bud_Detail and Bud_Detail_Periode + * + */ + function add() { $r=$this->extract_bud_detail(); $r->add(); @@ -268,6 +316,9 @@ class Bud_Data { } } + /*!\brief create an object Bud_Detail thanks the attr. of an object Bud_Data + * \return an object Bud_Detail + */ function extract_bud_detail() { foreach ( array('bd_id','po_id','bc_id','pcm_val','bh_id') as $r1) { @@ -278,8 +329,12 @@ class Bud_Data { $r->get_from_array($a); return $r; } + /*!\brief update the table bud_detail and bud_detail_periode + * + */ function update() { + $r=$this->extract_bud_detail(); $r->update(); ExecSql($this->cn,"delete from bud_detail_periode where bd_id =".$this->bd_id); @@ -289,9 +344,18 @@ class Bud_Data { } } + /*!\brief delete in bud_detail + */ + function delete_by_bd_id() { ExecSql($this->cn,'delete from bud_detail where bd_id='.$this->bd_id); } + /*!\brief transform an array containing the word amount_xx where xx + * stand for the p_id ( parm_periode primary key) into the data + * member this->bud_detail_periode + * \param the array + */ + private function get_form_detail_periode($p_array){ echo_debug(__FILE__.':'.__LINE__.'- get_form_detail_periode arg:','',$p_array); extract ($p_array); @@ -310,6 +374,10 @@ class Bud_Data { } } + + /*!\brief Test the class in debug mode + */ + static function test_me() { echo JS_PROTOTYPE_JS; echo JS_BUD_SCRIPT; diff --git a/include/class_bud_detail.php b/include/class_bud_detail.php index 27c182fbc..96cceda2f 100644 --- a/include/class_bud_detail.php +++ b/include/class_bud_detail.php @@ -47,6 +47,10 @@ class Bud_Detail { $this->po_id=null;$this->bc_id=null;$this->pcm_val=null; $this->bh_id=null; } + /*!\brief insert into the database and set the this->bd_id of the + * inserted row + * \return the bd_id + */ function add () { $array=array($this->po_id, $this->bc_id, @@ -58,7 +62,9 @@ class Bud_Detail { $a=ExecSqlParam($this->db,$sql,$array); $this->bd_id=pg_fetch_result($a,0,0); } - + /*!\brief update thanks the bd_id if bd_id == 0 returns directly + * + */ function update() { if ( $this->bd_id == 0) return; $sql="update bud_detail set po_id=$1,". @@ -74,10 +80,14 @@ class Bud_Detail { ExecSqlParam($this->db,$sql,$array); } - + /*!\brief delete in bud_detail + */ function delete() { ExecSql($this->db,"delete from bud_detail where bd_id=".$this->bd_id); } + /*!\brief load one row from the table Bud_Detail and makes an + object of it + */ function load() { if ( $this->bd_id == 0 ) return ; @@ -96,17 +106,19 @@ class Bud_Detail { } - static function get_list($p_cn,$p_bh_id,$pa_id=0) { - $pa_filter=($pa_id)?" and pa_id = $pa_id ":""; - $sql="select * from bud_detail join bud_detail_periode using(bd_id) ". - " right join parm_periode using (p_id) ". - " where bh_id= $bh_id $pa_filter "; - } + /*!\brief convert an array into in data member + * + * + */ function get_from_array($p_array) { foreach (array('bd_id','po_id','bc_id','pcm_val','bh_id') as $attr) if ( isset ( $p_array[$attr] )) $this->$attr=$p_array[$attr]; } + + /*!\brief test the object for developper + * + */ static function test_me() { $cn=DbConnect(dossier::id()); $a=new Bud_Detail($cn); diff --git a/include/class_bud_detail_periode.php b/include/class_bud_detail_periode.php index 971265d0e..e18d439c1 100644 --- a/include/class_bud_detail_periode.php +++ b/include/class_bud_detail_periode.php @@ -23,7 +23,7 @@ /*!\file */ -/*! \brief +/*! \brief manage the table bud_detail_periode * */ @@ -43,12 +43,16 @@ class Bud_Detail_Periode{ $this->p_id=0; $this->bdp_amount=0; } - + /*!\brief delete + */ function delete () { $sql="delete from bud_detail_periode where bdp_id=".$this->bdp_id; ExecSql($this->cn,$sql); } - + /*!\brief add a row in the table bud_detail_periode and set the + this->bdp_id with the value in the row + * + */ function add(){ $sql="insert into bud_detail_periode(bdp_amount,p_id,bd_id) values ($1,$2,$3)". " returning bdp_id"; @@ -60,7 +64,9 @@ class Bud_Detail_Periode{ echo "Erreur : ".$e->getMessage(); } } - + /*!\brief for developper + * + */ static function test_me() { $cn=DbConnect(dossier::id()); diff --git a/include/class_bud_hypo.php b/include/class_bud_hypo.php index d8628ed4a..411951815 100644 --- a/include/class_bud_hypo.php +++ b/include/class_bud_hypo.php @@ -21,6 +21,9 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr /*!\file + */ + +/*! * \brief manage the database bud_hypo concerning the hypothese for * different hyp. * diff --git a/include/class_document_type.php b/include/class_document_type.php deleted file mode 100644 index 9adc3a9b1..000000000 --- a/include/class_document_type.php +++ /dev/null @@ -1,52 +0,0 @@ -db=$p_cn; - $this->dt_id=-1; - } -/*! - * \brief Get all the data for this dt_id - */ - function get() - { - $sql="select * from document_type where dt_id=".$this->dt_id; - $R=ExecSql($this->db,$sql); - $r=pg_fetch_array($R,0); - $this->dt_id=$r['dt_id']; - $this->dt_value=$r['dt_value']; - } - -} \ No newline at end of file diff --git a/include/class_dossier.php b/include/class_dossier.php index 10840e783..cd32a3894 100644 --- a/include/class_dossier.php +++ b/include/class_dossier.php @@ -20,13 +20,13 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file * \brief the class for the dossier, everywhere we need to know to * which folder we are connected, because we can't use $_SESSION, we * need to pass the dossier_id via a _GET or a POST variable */ -/* \brief manage the current dossier, everywhere we need to know to +/*! \brief manage the current dossier, everywhere we need to know to * which folder we are connected, because we can't use $_SESSION, we * need to pass the dossier_id via a _GET or a POST variable * diff --git a/include/class_gestion_table.php b/include/class_gestion_table.php index 9435dfa98..02cd3d679 100644 --- a/include/class_gestion_table.php +++ b/include/class_gestion_table.php @@ -20,10 +20,10 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file */ -/* \brief +/*! \brief mother class for gestion * */ class gestion_table diff --git a/include/class_pre_operation.php b/include/class_pre_operation.php index 549c98299..eaff9ecd8 100644 --- a/include/class_pre_operation.php +++ b/include/class_pre_operation.php @@ -20,10 +20,10 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr -/* !\file +/*!\file */ -/* \brief manage the predefined operation, link to the table op_def +/*! \brief manage the predefined operation, link to the table op_def * and op_def_detail * */ @@ -150,6 +150,11 @@ class Pre_operation $this->p_jrn=$p_jrn; } } + +/*!\brief mother of the pre_op_XXX, it contains only one data : an + * object Pre_Operation. The child class contains an array of + * Pre_Operation object + */ class Pre_operation_detail { var $operation; function __construct($p_cn) {