From 4b84ba4879a318788113cadb72f491000df268f4 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Mon, 6 Oct 2025 16:38:30 +0200 Subject: [PATCH] remove dead code , improve code --- include/XMLDocument/xmlinvoice_reader.class.php | 1 - include/compta_ach.inc.php | 5 +++++ include/lib/database_core.class.php | 4 ++-- include/lib/html_input.class.php | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/XMLDocument/xmlinvoice_reader.class.php b/include/XMLDocument/xmlinvoice_reader.class.php index 6e62822e7..decc2fa03 100644 --- a/include/XMLDocument/xmlinvoice_reader.class.php +++ b/include/XMLDocument/xmlinvoice_reader.class.php @@ -242,7 +242,6 @@ class XMLInvoice_Reader { $row = []; $xml = simplexml_import_dom($node->item($e)); - //var_dump($xml->asXML()); $row ['quantity'] = $this->get_node_value("//cbc:InvoicedQuantity", $e); $row ['amount'] = $this->get_node_value("//cbc:LineExtensionAmount", $e); $row ['description'] = $this->get_node_value("//cac:Item/cbc:Description", $e); diff --git a/include/compta_ach.inc.php b/include/compta_ach.inc.php index e09319a97..6d5ade61e 100644 --- a/include/compta_ach.inc.php +++ b/include/compta_ach.inc.php @@ -110,9 +110,14 @@ if (isset($_POST['record'])) $internal = $Ledger->insert($_POST); } catch (\Exception $e) { if ( $e->getCode()==EXC_BALANCE) + { + \record_log($e); echo_warning(_("enregistrement annulé: balance , voyer le fichier log")); + } else + { echo_warning($e->getMessage()); + } return; } diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php index c6311d29d..7fa5e057b 100644 --- a/include/lib/database_core.class.php +++ b/include/lib/database_core.class.php @@ -239,7 +239,7 @@ class DatabaseCore record_log($p_array); $this->rollback(); - throw ($a); + throw new \Exception("exec_sql fails",242,$a); } return $this->ret; @@ -732,7 +732,7 @@ class DatabaseCore function upload($p_name,$only_oid = false) { - + //var $a : 0 we're in a transaction, 1 we are not in a transaction $a=0; if ( $this->status() !== PGSQL_TRANSACTION_INTRANS ) { diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 843fda894..316660b33 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -1152,7 +1152,7 @@ class HtmlInput */ static function show_receipt_document($p_jr_id, $p_name="") { - global $cn; + $cn=\Dossier::connect(); $image=$p_name; // Check the jr_id has a receipt document