From 89692fb79e8d4d733dd764a196ed3140fce26292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a?= Date: Wed, 29 Aug 2012 08:37:12 +0200 Subject: [PATCH] =?UTF-8?q?Uniformized=20sql=20error=20management=20Eldy?= =?UTF-8?q?=20told=20me=20that=20this=20is=20the=20correct=20way=20to=20ha?= =?UTF-8?q?ndle=20SQL=20errors=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/boxes/box_bookmarks.php | 4 +++- htdocs/core/boxes/box_comptes.php | 4 +++- htdocs/core/boxes/box_contracts.php | 4 +++- htdocs/core/boxes/box_factures_fourn.php | 4 +++- htdocs/core/boxes/box_fournisseurs.php | 4 +++- htdocs/core/boxes/box_osc_client.php | 4 +++- htdocs/core/boxes/box_propales.php | 4 +++- htdocs/core/boxes/box_services_expired.php | 4 +++- htdocs/core/boxes/box_supplier_orders.php | 4 +++- 9 files changed, 27 insertions(+), 9 deletions(-) diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index 291c7f52596..a341b9d5b76 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -116,7 +116,9 @@ class box_bookmarks extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 09f84afca78..bb92403da0f 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -141,7 +141,9 @@ class box_comptes extends ModeleBoxes } } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 9f0448f0534..bd0b4d5e605 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -138,7 +138,9 @@ class box_contracts extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index a8f66935a48..2b2f85fef37 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -139,7 +139,9 @@ class box_factures_fourn extends ModeleBoxes if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoModifiedSupplierBills")); } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 38ffa7dbe7b..292c82abcb5 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -114,7 +114,9 @@ class box_fournisseurs extends ModeleBoxes if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedSuppliers")); } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_osc_client.php b/htdocs/core/boxes/box_osc_client.php index dab5d325d76..aaaf232dfe9 100644 --- a/htdocs/core/boxes/box_osc_client.php +++ b/htdocs/core/boxes/box_osc_client.php @@ -92,7 +92,9 @@ class box_osc_clients extends ModeleBoxes } } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else { diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index f36205a9616..e09fe652e53 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -134,7 +134,9 @@ class box_propales extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 86b50c45951..80c3a63c259 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -134,7 +134,9 @@ class box_services_expired extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 355d5319855..ab34eb7eaa4 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -129,7 +129,9 @@ class box_supplier_orders extends ModeleBoxes } else { - dol_print_error($db); + $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + 'maxlength'=>500, + 'text' => ($db->error().' sql='.$sql)); } } else