From 1710281c3d09189bbcb7331e29c5cc7bf846720f Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 25 Oct 2019 16:07:53 +0200 Subject: [PATCH] [PATCH 3/3] fixup! Printtva , under some circumstance --- include/class/acc_ledger.class.php | 2 +- include/class/tax_summary.class.php | 4 ++-- include/export/export_printtva_csv.php | 11 ++++++++++- include/tax_summary.inc.php | 9 ++++++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index e1942a88e..4e4750565 100644 --- a/include/class/acc_ledger.class.php +++ b/include/class/acc_ledger.class.php @@ -80,7 +80,7 @@ class Acc_Ledger extends jrn_def_sql $this->db=$p_cn; $this->row=null; $this->nb=MAX_ARTICLE; - parent::__construct($p_cn, $p_id); + parent::__construct($p_cn, $p_id); } function get_last_pj() diff --git a/include/class/tax_summary.class.php b/include/class/tax_summary.class.php index ce950707c..933751621 100644 --- a/include/class/tax_summary.class.php +++ b/include/class/tax_summary.class.php @@ -115,7 +115,7 @@ class Tax_Summary "; $cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]); if ($cnt == 0) { - throw new Exception(_("Données manquantes")); + throw new Exception(_("Données manquantes"),100); } /*-------------Purchase ---------------------------------*/ $sql="select count(*) @@ -131,7 +131,7 @@ class Tax_Summary "; $cnt=$this->db->get_value($sql,[$this->date_start,$this->date_end]); if ($cnt > 0) { - throw new Exception(_("Données manquantes")); + throw new Exception(_("Données manquantes"),100); } } diff --git a/include/export/export_printtva_csv.php b/include/export/export_printtva_csv.php index c84ffe267..ebe8ddde4 100644 --- a/include/export/export_printtva_csv.php +++ b/include/export/export_printtva_csv.php @@ -30,7 +30,16 @@ require_once NOALYSS_INCLUDE."/class/tax_summary.class.php"; require_once NOALYSS_INCLUDE."/lib/noalyss_csv.class.php"; $http=new HttpInput(); $tax_summary = new Tax_Summary($cn,$http->get("date_start"),$http->get("date_end")); -$tax_summary->check(); +try { + $tax_summary->check(); +}catch (Exception $e) +{ + if ($e->getCode() <> 100) { + echo $e->getMessage(); + return; + } +} + $csv=new Noalyss_Csv("summary_tva"); $csv->send_header(); diff --git a/include/tax_summary.inc.php b/include/tax_summary.inc.php index 70d9c5d49..7da2ad2d5 100644 --- a/include/tax_summary.inc.php +++ b/include/tax_summary.inc.php @@ -47,7 +47,14 @@ if ( $http->get("do","string","no") == "display") { $tax_summary=new Tax_Summary($cn,$start_periode->value,$end_periode->value); try { - $tax_summary->check(); + try { + $tax_summary->check(); + }catch (Exception $e) + { + echo ''; + echo $e->getMessage(); + echo ''; + } echo '