diff --git a/html/search_ca.php b/html/search_ca.php index f6cc8d73d..9a506d5d6 100644 --- a/html/search_ca.php +++ b/html/search_ca.php @@ -34,7 +34,7 @@ require_once ('class_widget.php'); require_once ("ac_common.php"); require_once ('class_dossier.php'); require_once ('class_anc_account.php'); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); /*!\todo add security here : check user and access to CA */ @@ -57,7 +57,7 @@ echo ''; //------------- FORM ---------------------------------- if ( isset($_REQUEST['go'])) { $cn=DbConnect(dossier::id()); - $plan=new PlanAnalytic($cn,$_REQUEST['c2']); + $plan=new Anc_Plan($cn,$_REQUEST['c2']); $plan->pa_id=$_REQUEST['c2']; if ( $plan->exist()==false) exit("Ce plan n'existe pas"); diff --git a/include/ca_imp.inc.php b/include/ca_imp.inc.php index 90774e9e6..3e81f8896 100644 --- a/include/ca_imp.inc.php +++ b/include/ca_imp.inc.php @@ -28,7 +28,7 @@ * */ require_once('class_anc_operation.php'); -require_once('class_plananalytic.php'); +require_once('class_anc_plan.php'); require_once('ac_common.php'); require_once('class_widget.php'); diff --git a/include/ca_od.inc.php b/include/ca_od.inc.php index 27a16e874..9006afc6b 100644 --- a/include/ca_od.inc.php +++ b/include/ca_od.inc.php @@ -29,10 +29,11 @@ require_once("class_anc_account.php"); require_once ("class_widget.php"); require_once ("class_anc_operation.php"); +require_once ("class_anc_plan.php"); require_once ("class_groupop.php"); -$pa=new PlanAnalytic($cn); +$pa=new Anc_Plan($cn); $m=$pa->get_list(); if ( ! $m ) { echo '

Aucun plan analytique défini

';exit();} echo '
'; diff --git a/include/ca_pa.inc.php b/include/ca_pa.inc.php index 3f6c065cd..7887caa5d 100644 --- a/include/ca_pa.inc.php +++ b/include/ca_pa.inc.php @@ -26,7 +26,7 @@ /* \brief Plan Analytique * */ -require_once("class_plananalytic.php"); +require_once("class_anc_plan.php"); require_once("class_anc_account.php"); $ret=""; //--------------------------------------------------------------------------- @@ -41,7 +41,7 @@ if ( isset($_REQUEST['sa'])) if ( $sa == "add_pa") { $wAction=new widget("hidden","","p_action","ca_pa"); - $new=new PlanAnalytic($cn); + $new=new Anc_Plan($cn); if ( $new->isAppend() == true) { $ret.= '
'; @@ -68,7 +68,7 @@ if ( isset($_REQUEST['sa'])) // Add if ( $sa == "pa_write") { - $new=new PlanAnalytic($cn); + $new=new Anc_Plan($cn); if ( $new->isAppend() == false) @@ -79,7 +79,7 @@ if ( isset($_REQUEST['sa'])) } else { - $new=new PlanAnalytic($cn); + $new=new Anc_Plan($cn); $new->name=$_POST['pa_name']; $new->description=$_POST['pa_description']; $new->add(); @@ -88,7 +88,7 @@ if ( isset($_REQUEST['sa'])) // show the detail if ( $sa == "pa_detail" ) { - $new=new PlanAnalytic($cn,$_GET['pa_id']); + $new=new Anc_Plan($cn,$_GET['pa_id']); $wAction=new widget("hidden","","p_action","ca_pa"); $wSa=new widget("HIDDEN","","sa","pa_update"); @@ -114,7 +114,7 @@ if ( isset($_REQUEST['sa'])) // Update the PA if ( $sa == "pa_update" ) { - $new=new PlanAnalytic($cn,$_GET['pa_id']); + $new=new Anc_Plan($cn,$_GET['pa_id']); $new->name=$_POST['pa_name']; $new->description=$_POST['pa_description']; $new->update(); @@ -149,7 +149,7 @@ if ( isset($_REQUEST['sa'])) /* delete pa */ if ( $sa == "pa_delete") { - $delete=new PlanAnalytic($cn,$_GET['pa_id']); + $delete=new Anc_Plan($cn,$_GET['pa_id']); $delete->delete(); } /* po detail @@ -194,7 +194,7 @@ if ( isset($_REQUEST['sa'])) { $count=0; - $new=new PlanAnalytic($cn,$_REQUEST['pa_id']); + $new=new Anc_Plan($cn,$_REQUEST['pa_id']); $new->get(); $array=$new->get_poste_analytique(); $ret.='
'; @@ -245,7 +245,7 @@ if ( isset($_REQUEST['sa'])) // Show lmenu // //--------------------------------------------------------------------------- -$obj=new PlanAnalytic($cn); +$obj=new Anc_Plan($cn); $list=$obj->get_list(); diff --git a/include/class_anc_account.php b/include/class_anc_account.php index 53310317b..65d6cb33d 100644 --- a/include/class_anc_account.php +++ b/include/class_anc_account.php @@ -28,7 +28,7 @@ */ require_once("class_widget.php"); require_once("postgres.php"); -require_once("class_plananalytic.php"); +require_once("class_anc_plan.php"); class Anc_Account { @@ -223,7 +223,7 @@ class Anc_Account $wGa_id->value=make_array($this->db,"select ga_id,ga_id from groupe_analytique",1); $wGa_id->selected=$this->ga_id; $wGa_id->table=1; - $pa=new PlanAnalytic($this->db,$this->pa_id); + $pa=new Anc_Plan($this->db,$this->pa_id); $pa->get(); $wPaName=new widget("text","Plan A.","",$pa->name); $wPaName->table=1; diff --git a/include/class_anc_balance_double.php b/include/class_anc_balance_double.php index 3f002aef2..3271bb43b 100644 --- a/include/class_anc_balance_double.php +++ b/include/class_anc_balance_double.php @@ -30,7 +30,7 @@ * */ require_once ('class_anc_print.php'); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); class Anc_Balance_Double extends Anc_Print { @@ -141,9 +141,9 @@ class Anc_Balance_Double extends Anc_Print $count=ceil(count($array)/$pagesize); $pdf= new Cezpdf("A4"); $pdf->selectFont('./addon/fonts/Helvetica.afm'); - $pa=new PlanAnalytic($this->db,$this->pa_id); + $pa=new Anc_Plan($this->db,$this->pa_id); $pa->get(); - $pb=new PlanAnalytic($this->db,$this->pa_id2); + $pb=new Anc_Plan($this->db,$this->pa_id2); $pb->get(); $titre=sprintf("Balance croise plan %s %s ", @@ -262,7 +262,7 @@ class Anc_Balance_Double extends Anc_Print $r=parent::display_form($p_string); // show the second plan $r.=''; - $plan=new PlanAnalytic($this->db); + $plan=new Anc_Plan($this->db); $plan_id=new widget("select","","pa_id2"); $plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name"); $plan_id->selected=$this->pa_id2; diff --git a/include/class_anc_balance_simple.php b/include/class_anc_balance_simple.php index 8d34b4dea..312325dac 100644 --- a/include/class_anc_balance_simple.php +++ b/include/class_anc_balance_simple.php @@ -25,7 +25,7 @@ */ require_once ('class_anc_print.php'); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('ac_common.php'); include_once("class.ezpdf.php"); require_once ('header_print.php'); diff --git a/include/class_anc_listing.php b/include/class_anc_listing.php index 6086daba7..0e36fa829 100644 --- a/include/class_anc_listing.php +++ b/include/class_anc_listing.php @@ -26,7 +26,7 @@ /*! \brief * */ -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('class_anc_print.php'); require_once ('class_anc_operation.php'); /*! diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php index 3dce4ab24..add337092 100644 --- a/include/class_anc_operation.php +++ b/include/class_anc_operation.php @@ -22,7 +22,7 @@ /* !\file */ -require_once("class_plananalytic.php"); +require_once("class_anc_plan.php"); require_once("class_widget.php"); require_once ("user_common.php"); @@ -376,7 +376,7 @@ function get_balance($p_from,$p_to,$p_plan_id) if ( $p_array != null) extract ($p_array); $result=""; - $plan=new PlanAnalytic($this->db); + $plan=new Anc_Plan($this->db); $a_plan=$plan->get_list(); if ( empty ($a_plan) ) return ""; $table_id="t".$p_seq; @@ -481,7 +481,7 @@ function get_balance($p_from,$p_to,$p_plan_id) $max=${"nb_t".$p_item}; echo_debug(__FILE__.':'.__LINE__.'- ', "max of row for CA = ".$max); // get all the PA - $plan=new PlanAnalytic($this->db); + $plan=new Anc_Plan($this->db); $cplan=$plan->count(); echo_debug(__FILE__.':'.__LINE__," nb of PA $cplan"); // foreach row diff --git a/include/class_plananalytic.php b/include/class_anc_plan.php similarity index 98% rename from include/class_plananalytic.php rename to include/class_anc_plan.php index 8808b889c..baf48bbb3 100644 --- a/include/class_plananalytic.php +++ b/include/class_anc_plan.php @@ -32,14 +32,14 @@ require_once("class_widget.php"); require_once("class_anc_account.php"); require_once ('class_dossier.php'); -class PlanAnalytic +class Anc_Plan { var $db; /*!db=$p_cn; $this->id=$p_id; @@ -185,7 +185,7 @@ class PlanAnalytic echo "clean"; ExecSql($cn,"delete from plan_analytique"); - $p=new PlanAnalytic($cn); + $p=new Anc_Plan($cn); echo "

Add

"; $p->name="Nouveau 1"; $p->description="C'est un test"; diff --git a/include/class_anc_print.php b/include/class_anc_print.php index 210f553b5..67ae9869f 100644 --- a/include/class_anc_print.php +++ b/include/class_anc_print.php @@ -32,7 +32,7 @@ require_once('debug.php'); require_once('constant.php'); require_once ('class_widget.php'); require_once('class_dossier.php'); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); class Anc_Print { var $db; /*!< $db database connection */ @@ -79,7 +79,7 @@ class Anc_Print { */ function display_form($p_hidden="") { /* if there is no analytic plan return */ - $pa=new PlanAnalytic($this->db); + $pa=new Anc_Plan($this->db); if ( $pa->count() == 0 ) { echo '

Aucun plan défini

'; exit(); @@ -110,7 +110,7 @@ class Anc_Print { $r.=$p_hidden; $r.=''; - $plan=new PlanAnalytic($this->db); + $plan=new Anc_Plan($this->db); $plan_id=new widget("select","","pa_id"); $plan_id->value=make_array($this->db,"select pa_id, pa_name from plan_analytique order by pa_name"); $plan_id->selected=$this->pa_id; diff --git a/include/class_bud_hypo.php b/include/class_bud_hypo.php index 63557139e..0b1717035 100644 --- a/include/class_bud_hypo.php +++ b/include/class_bud_hypo.php @@ -35,7 +35,7 @@ class Bud_Hypo { var $bh_id; /*!< Primary key bud_hypo */ var $bh_saldo; /*!< saldo */ var $bh_description; /*!< Description */ - var $pa_id; /*!< Foreign key to PlanAnalytic */ + var $pa_id; /*!< Foreign key to Anc_Plan */ function __construct($p_cn,$p_id=0) diff --git a/include/class_groupop.php b/include/class_groupop.php index ed2ef7fe5..5b55b6bc4 100644 --- a/include/class_groupop.php +++ b/include/class_groupop.php @@ -29,7 +29,7 @@ require_once ("class_anc_operation.php"); require_once ("postgres.php"); require_once ("class_widget.php"); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('class_dossier.php'); class groupop @@ -90,7 +90,7 @@ class groupop $ret.='Description'. ''. $wDescription->IOValue().""; - $Plan=new PlanAnalytic($this->db); + $Plan=new Anc_Plan($this->db); $aPlan=$Plan->get_list(); $ret.=''; /* show 10 rows */ @@ -162,7 +162,7 @@ class groupop * */ function from_POST() { - $Plan=new PlanAnalytic($this->db); + $Plan=new Anc_Plan($this->db); $aPlan=$Plan->get_list(); diff --git a/include/class_poste_analytic.php b/include/class_poste_analytic.php deleted file mode 100644 index f25d89ad0..000000000 --- a/include/class_poste_analytic.php +++ /dev/null @@ -1,318 +0,0 @@ -db=$p_db; - $this->id=$p_id; - $this->ga_id=null; - } - /*! \brief retrieve data from the database and - * fill the object - * \param $p_where the where clause - */ - private function fetch_from_db($p_where) - { - $sql="select po_id, - po_name , - pa_id, - po_amount, - po_description, - ga_id - from poste_analytique - where ". - $p_where; - - $ret=ExecSql($this->db,$sql); - if ( pg_NumRows($ret) == 0 )return null; - $line=pg_fetch_array($ret); - - $this->id=$line['po_id']; - $this->name=$line['po_name']; - $this->pa_id=$line['pa_id']; - $this->amount=$line['po_amount']; - $this->description=$line['po_description']; - $this->ga_id=$line['ga_id']; - - - } - function get_by_id() - { - $this->fetch_from_db("po_id=".$this->id); - } - /*! - * \brief retrieve data thanks the name - * \param $p_name name of the analytic account - * - */ - function get_by_name($p_name) - { - $p_name=FormatString($p_name); - if ( $p_name == null ) - $p_name=$this->name; - - $this->fetch_from_db("po_name='".$p_name."'"); - echo "id = ".$this->id; - } - function add() - { - $this->format_data(); - if ( strlen($this->name) == 0) - return; - if ( $this->ga_id == null || strlen(trim($this->ga_id)) == 0 ) - $ga_id="NULL"; - else - $ga_id="'".$this->ga_id."'"; - $sql="insert into poste_analytique ( - po_name , - pa_id, - po_amount, - po_description, - ga_id - ) values (". - "'".$this->name."',". - $this->pa_id.",". - $this->amount.",". - "'".$this->description."',". - $ga_id.")"; - try { - ExecSql($this->db,$sql); - - } catch (Exception $e) { - echo_debug(__FILE__,__LINE__,$e); - if ( DEBUG ) print_r($e); - echo "

Doublon : l'enregistrement n'est pas sauve

"; - } - - } - function update() - { - $this->format_data(); - if ( strlen($this->name) == 0) - return; - $sql="update poste_analytique ". - " set po_name='".$this->name."',". - " pa_id=".$this->pa_id.",". - " po_amount=".$this->amount.",". - " po_description='".$this->description."',". - " ga_id='".$this->ga_id."'". - " where po_id=".$this->id; - try { - ExecSql($this->db,$sql); - } catch (Exception $e) { - echo_debug(__FILE__,__LINE__,$e); - echo "

Doublon : l'enregistrement n'est pas sauve

"; - } - - } - private function format_data() - { - $this->name=FormatString($this->name); - $this->pa_id=FormatString($this->pa_id); - $this->amount=FormatString($this->amount); - if (strlen($this->amount) == 0 ) - $this->amount=0.0; - - $this->description=FormatString($this->description); - } - function delete() - { - $sql="delete from poste_analytique where po_id=".$this->id; - ExecSql($this->db,$sql); - } - /*! \brief return an array of object Poste_Analytique - * - */ - function get_list() - { - $sql="select po_id, - po_name , - pa_id, - po_amount, - po_description, - ga_id - from poste_analytique ". - " order by po_name"; - - $ex=ExecSql($this->db,$sql); - $ret=pg_fetch_all($ex); - if ( $ret == null ) - return null; - - $array=array(); - foreach ($ret as $line) - { - $objet=new Poste_Analytique($this->db); - - $object->id=$line['po_id']; - $object->name=$line['po_name']; - $object->pa_id=$line['pa_id']; - $object->amount=$line['po_amount']; - $object->description=$line['po_description']; - $object->ga_id=$line['ga_id']; - $array[]=clone $object; - } - - return $array; - } - function display_list() - { - $array=$this->get_list(); - if ( empty($array) ) { echo "Vide"; return;} - foreach ($array as $line) - { - echo $line->id." / ".$line->name." / ".$line->description."/". - $line->amount." / ".$line->pa_id."/".$line->ga_id."
"; - } - } - function debug() - { - echo "id ".$this->id."
"; - echo "name ".$this->name."
"; - echo "pa_id ".$this->pa_id."
"; - echo "amount ".$this->amount."
"; - echo "description ".$this->description."
"; - echo "ga_id ".$this->ga_id."
"; - } - function form() - { - $wId=new widget("hidden","po_id","po_id",$this->id); - $wName=new widget("text","Nom","po_name",$this->name); - $wPa_id=new widget("hidden","pa_id","pa_id",$this->pa_id); - $wAmount=new widget("text","Montant","po_amount",$this->amount); - $wDescription=new widget("text","Description","po_description",$this->description); - $wGa_id=new widget("select","Groupe","ga_id"); - $wGa_id->value=make_array($this->db,"select ga_id,ga_id from groupe_analytique",1); - $wGa_id->selected=$this->ga_id; - $wGa_id->table=1; - $pa=new PlanAnalytic($this->db,$this->pa_id); - $pa->get(); - $wPaName=new widget("text","Plan A.","",$pa->name); - $wPaName->table=1; - $wPaName->readonly=true; - - $wName->table=1; - $wPa_id->table=1; - $wAmount->table=1; - $wDescription->table=1; - - $r=$wId->IOValue(); - $r.=$wPa_id->IOValue(); - - $r.="
"; - - $r.=""; - $r.=$wName->IOValue(); - $r.=""; - - $r.=""; - $r.=$wAmount->IOValue(); - $r.=""; - - - $r.=""; - $r.=$wDescription->IOValue(); - $r.=""; - - $r.=""; - $r.=$wPaName->IOValue(); - $r.=""; - - $r.=""; - $r.=$wGa_id->IOValue(); - $r.=""; - - $r.="
"; - return $r; - - } - function fill_from_POST() - { - $this->name=$_POST['po_name']; - $this->description=$_POST['po_description']; - $this->pa_id=$_POST['pa_id']; - $this->amount=$_POST['po_amount']; - $this->id=$_POST['po_id']; - $this->ga_id=($_POST['ga_id'] == "-1" )?"":$_POST['ga_id']; - } - static function testme() { - $cn=DbConnect(dossier::id()); - $pa_id=getDBValue($cn,"select max(pa_id) from plan_analytique"); - $o=new Poste_Analytique($cn); - echo "

Poste_Analytique

"; - echo "

get_list

"; - $ee=$o->get_list(); - print_r($ee); - //var_dump($ee); - - echo "

Add some

"; - $o->pa_id=$pa_id; - $o->name="test1"; - $o->add(); - - - $o->name="test2"; - $o->add(); - - $o->name="test3"; - $o->add(); - - $o->name="test4"; - $o->add(); - - $o->name="test5"; - $o->add(); - - echo "

remove test1

"; - $o->get_by_name("test1"); - $o->delete(); - $o->display_list(); - - $o->get_by_name("test4"); - echo "
".$o->id."
"; - $o->name="Test Four"; - $o->update(); - $o->display_list(); - $o->delete(); - $o->display_list(); - } -} -?> diff --git a/include/jrn.php b/include/jrn.php index 678939575..df513bfb3 100644 --- a/include/jrn.php +++ b/include/jrn.php @@ -26,7 +26,7 @@ require_once('class_fiche.php'); require_once ('class_gestion_sold.php'); require_once ('class_gestion_purchase.php'); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('class_anc_operation.php'); require_once ('class_acc_ledger.php'); require_once ('class_acc_operation.php'); diff --git a/include/user_form_ach.php b/include/user_form_ach.php index 6173cc9de..475218878 100644 --- a/include/user_form_ach.php +++ b/include/user_form_ach.php @@ -28,7 +28,7 @@ require_once("preference.php"); require_once("fiche_inc.php"); require_once("user_common.php"); require_once("class_parm_code.php"); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('class_own.php'); require_once ('class_anc_operation.php'); require_once ('class_pre_op_ach.php'); diff --git a/include/user_form_ods.php b/include/user_form_ods.php index 87ed56a76..55cbaa8f3 100644 --- a/include/user_form_ods.php +++ b/include/user_form_ods.php @@ -25,7 +25,7 @@ require_once("class_widget.php"); require_once("preference.php"); require_once("fiche_inc.php"); require_once("user_common.php"); -require_once ('class_plananalytic.php'); +require_once ('class_anc_plan.php'); require_once ('class_own.php'); require_once ('class_anc_operation.php'); require_once ('class_pre_op_ods.php'); diff --git a/include/user_form_ven.php b/include/user_form_ven.php index a809a3a72..914494462 100644 --- a/include/user_form_ven.php +++ b/include/user_form_ven.php @@ -27,7 +27,7 @@ require_once("preference.php"); require_once("fiche_inc.php"); require_once("user_common.php"); require_once ("class_own.php"); -require_once ("class_plananalytic.php"); +require_once ("class_anc_plan.php"); require_once ('class_anc_operation.php'); require_once ('class_pre_op_ven.php'); require_once ('class_own.php');