From 2295ffe63e780ca66359d81f3fb8b0cd3e87f243 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 20 Jul 2014 12:50:12 +0200 Subject: [PATCH] =?UTF-8?q?task=20#1013=20Comptabilit=C3=A9=20analytique?= =?UTF-8?q?=20:=20am=C3=A9lioration=20quand=20aucune=20donn=C3=A9e=20Task?= =?UTF-8?q?=20#1013=20-=20Comptabilit=C3=A9=20analytique=20:=20am=C3=A9lio?= =?UTF-8?q?ration=20quand=20aucune=20donn=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/anc_balance_double.inc.php | 15 ++++++++++-- include/anc_balance_simple.inc.php | 14 +++++++++-- include/anc_great_ledger.inc.php | 35 ++++++++++++++++++---------- include/anc_history.inc.php | 14 +++++++++-- include/class_anc_balance_double.php | 2 +- include/class_anc_balance_simple.php | 5 +++- include/class_anc_grandlivre.php | 12 +++------- include/class_anc_listing.php | 19 ++++++++------- include/class_anc_operation.php | 2 +- include/class_anc_print.php | 1 + 10 files changed, 80 insertions(+), 39 deletions(-) diff --git a/include/anc_balance_double.inc.php b/include/anc_balance_double.inc.php index 6c20904ed..21af8eae8 100644 --- a/include/anc_balance_double.inc.php +++ b/include/anc_balance_double.inc.php @@ -11,7 +11,18 @@ echo $bc->display_form(); echo ''; if (isset($_GET['result'])) { - echo $bc->show_button(); - echo $bc->display_html(); + $result=$bc->display_html(); + if ($bc->has_data > 0) + { + echo $bc->show_button(); + echo $result; + } + else + { + echo '

'; + echo _('Aucune donnée trouvée'); + echo '

'; + } + } ?> diff --git a/include/anc_balance_simple.inc.php b/include/anc_balance_simple.inc.php index 91e3b0ca6..de82efa31 100644 --- a/include/anc_balance_simple.inc.php +++ b/include/anc_balance_simple.inc.php @@ -11,7 +11,17 @@ echo $bs->display_form(); echo ''; if (isset($_GET['result'])) { - echo $bs->show_button(); - echo $bs->display_html(); + $result= $bs->display_html(); + if ( $bs->has_data > 0) + { + echo $bs->show_button(); + echo $result; + } + else + { + echo '

'; + echo _('Aucune donnée trouvée'); + echo '

'; + } } ?> diff --git a/include/anc_great_ledger.inc.php b/include/anc_great_ledger.inc.php index 1430384ce..4c8e23383 100644 --- a/include/anc_great_ledger.inc.php +++ b/include/anc_great_ledger.inc.php @@ -24,18 +24,29 @@ $result=HtmlInput::default_value_request('result',null); if ($result != null) { - echo ''; - echo _('Tout sélectionner')." ".ICheckBox::toggle_checkbox('export_pdf_bt1','export_anc_receipt_pdf'); - echo ''; - echo $grandLivre->show_button(); - echo '
'; - - echo $grandLivre->button_export_pdf(); - echo $grandLivre->display_html(); - echo $grandLivre->button_export_pdf(); - echo HtmlInput::get_to_hidden(array('ac','gDossier','sa')); - echo '
'; - echo $grandLivre->show_button(); + $result=$grandLivre->display_html(); + if ($grandLivre->has_data != 0 ) + { + echo ''; + echo _('Tout sélectionner')." ".ICheckBox::toggle_checkbox('export_pdf_bt1','export_anc_receipt_pdf'); + echo ''; + echo $grandLivre->show_button(); + echo '
'; + + echo $grandLivre->button_export_pdf(); + echo $grandLivre->display_html(); + echo $grandLivre->button_export_pdf(); + echo HtmlInput::get_to_hidden(array('ac','gDossier','sa')); + echo '
'; + echo $grandLivre->show_button(); + } + else + { + echo '

'; + echo _('Aucune donnée trouvée'); + echo '

'; + } + } echo ''; ?> diff --git a/include/anc_history.inc.php b/include/anc_history.inc.php index ca712c368..e57ab44bb 100644 --- a/include/anc_history.inc.php +++ b/include/anc_history.inc.php @@ -18,8 +18,18 @@ if (isset($_GET['result'])) //-------------------------------- // export Buttons //--------------------------------- - echo $list->show_button(); - echo $list->display_html(); + $result=$list->display_html(); + if ( $list->has_data > 0) + { + echo $list->show_button(); + echo $result; + } + else + { + echo '

'; + echo _('Aucune donnée trouvée'); + echo '

'; + } echo ''; } echo ''; diff --git a/include/class_anc_balance_double.php b/include/class_anc_balance_double.php index da7d9e563..bbb8e2ab3 100644 --- a/include/class_anc_balance_double.php +++ b/include/class_anc_balance_double.php @@ -463,7 +463,7 @@ class Anc_Balance_Double extends Anc_Print $res=$this->db->exec_sql($sql); - + $this->has_data=Database::num_row($res); if ( Database::num_row($res) == 0 ) return null; $a=array(); diff --git a/include/class_anc_balance_simple.php b/include/class_anc_balance_simple.php index 9318ec085..d963d32c9 100644 --- a/include/class_anc_balance_simple.php +++ b/include/class_anc_balance_simple.php @@ -59,8 +59,10 @@ class Anc_Balance_Simple extends Anc_Print $sql.=" order by po_id"; $res=$this->db->exec_sql($sql); - if ( Database::num_row($res) == 0 ) + if ( Database::num_row($res) == 0 ) { + $this->has_data=0; return null; + } $a=array(); $count=0; $array=Database::fetch_all($res); @@ -74,6 +76,7 @@ class Anc_Balance_Simple extends Anc_Print $a[$count]['debit']=($row['sum_deb']>$row['sum_cred'])?"debit":"credit"; $count++; } + $this->has_data=$count; return $a; diff --git a/include/class_anc_grandlivre.php b/include/class_anc_grandlivre.php index d7a59e113..e37525d06 100644 --- a/include/class_anc_grandlivre.php +++ b/include/class_anc_grandlivre.php @@ -81,7 +81,7 @@ class Anc_GrandLivre extends Anc_Print left join jrn on (j_grpt=jr_grpt_id) where $pa_id_cond oa_amount <> 0.0 $cond_poste $filter_date order by po_name,oa_date::date,qcode,j_poste"); - + $this->has_data=count($array); return $array; } @@ -159,15 +159,9 @@ class Anc_GrandLivre extends Anc_Print $r = ""; //---Html $array = $this->load(); - if (is_array($array) == false) + if (is_array($array) == false || empty($array)) { - return $array; - } - - if (empty($array)) - { - $r.= _("aucune donnée"); - return $r; + return 0; } $r.= ''; $ix = 0; diff --git a/include/class_anc_listing.php b/include/class_anc_listing.php index 6f49a019a..276c70419 100644 --- a/include/class_anc_listing.php +++ b/include/class_anc_listing.php @@ -66,16 +66,9 @@ class Anc_Listing extends Anc_Print $r=""; //---Html $array=$this->load(); - if ( is_array($array) == false ) + if ( is_array($array) == false || empty($array) ) { - return $array; - - } - - if ( empty($array) ) - { - $r.= _("aucune donnée"); - return $r; + return 0; } $r.= '
'; $r.= ''. @@ -123,6 +116,14 @@ class Anc_Listing extends Anc_Print $op=new Anc_Operation ($this->db); $op->pa_id=$this->pa_id; $array=$op->get_list($this->from,$this->to,$this->from_poste,$this->to_poste); + if (! $array ) + { + $this->has_data=0; + } + else + { + $this->has_data=count($array); + } return $array; } /*! diff --git a/include/class_anc_operation.php b/include/class_anc_operation.php index 6c0fd8ed2..24896b9f6 100644 --- a/include/class_anc_operation.php +++ b/include/class_anc_operation.php @@ -69,6 +69,7 @@ class Anc_Operation $this->id=$p_id; $this->oa_jrnx_id_source=null; $this->oa_positive='Y'; + $this->has_data=0; } /*!\brief add a row to the table operation_analytique * \note if $this->oa_group if 0 then a sequence id will be computed for @@ -179,7 +180,6 @@ class Anc_Operation order by jr_date,oa_group,oa_debit desc,oa_id"; $RetSql=$this->db->exec_sql($sql); - $array=Database::fetch_all($RetSql); return $array; } diff --git a/include/class_anc_print.php b/include/class_anc_print.php index 56fc8c41c..7596d561a 100644 --- a/include/class_anc_print.php +++ b/include/class_anc_print.php @@ -52,6 +52,7 @@ class Anc_Print $this->to=""; $this->from_poste=""; $this->to_poste=""; + $this->has_data=0; } /*!