diff --git a/include/class_acc_account.php b/include/class_acc_account.php
index db3e8457e..387daafc4 100644
--- a/include/class_acc_account.php
+++ b/include/class_acc_account.php
@@ -63,7 +63,7 @@ class Acc_Account
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
+ throw new Exception (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
}
function set_parameter($p_string,$p_value)
@@ -74,7 +74,7 @@ class Acc_Account
if ($this->check($idx,$p_value) == true ) $this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
+ throw new Exception (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
}
diff --git a/include/class_acc_account_ledger.php b/include/class_acc_account_ledger.php
index 1f758ca27..230f86bdc 100644
--- a/include/class_acc_account_ledger.php
+++ b/include/class_acc_account_ledger.php
@@ -464,7 +464,6 @@ class Acc_Account_Ledger
break;
default:
throw new Exception(" Fonction HtmlTableHeader argument actiontarget invalid");
- exit;
}
$hid=new IHidden();
diff --git a/include/class_acc_bilan.php b/include/class_acc_bilan.php
index 4fb816930..a54dce267 100644
--- a/include/class_acc_bilan.php
+++ b/include/class_acc_bilan.php
@@ -262,7 +262,7 @@ class Acc_Bilan
catch(Exception $Ex)
{
echo $Ex->getMessage();
- exit();
+ throw $Ex;
}
}
/*!\brief open the file of the form */
@@ -273,7 +273,7 @@ class Acc_Bilan
if ( $form == false)
{
echo 'Cannot Open';
- exit();
+ throw new Exception(_('Echec ouverture fichier '.$this->b_file_form));
}
return $form;
}
@@ -285,7 +285,7 @@ class Acc_Bilan
if ( $templ == false)
{
echo 'Cannot Open';
- exit();
+ throw new Exception(_('Echec ouverture fichier '.$this->b_file_template));
}
return $templ;
@@ -346,7 +346,7 @@ class Acc_Bilan
if ( copy ($file_base,$work_file) == false )
{
echo _("erreur Ouverture fichier");
- exit();
+ throw new Exception(_('Echec ouverture fichier '.$file_base));
}
ob_start();
/* unzip the document */
@@ -367,8 +367,7 @@ class Acc_Bilan
if ( $p_file == false)
{
- echo 'Cannot Open';
- exit();
+ throw new Exception(_('Echec ouverture fichier '.$p_file));
}
$r="";
@@ -632,8 +631,7 @@ class Acc_Bilan
$work_file=basename($file_base);
if ( copy ($file_base,$work_file) == false )
{
- echo _("Ouverture fichier impossible");
- exit();
+ throw new Exception ( _("Ouverture fichier impossible"));
}
/*
* unzip the document
@@ -658,22 +656,20 @@ class Acc_Bilan
$p_file=fopen($dirname.DIRECTORY_SEPARATOR.'content.xml','wb');
if ( $p_file == false )
{
- exit ( _("erreur Ouverture fichier").' content.xml');
+ throw new Exception ( _("erreur Ouverture fichier").' content.xml');
}
$a=fwrite($p_file,$p_result);
if ( $a==false)
{
- echo _("erreur écriture fichier").' content.xml';
- exit();
+ throw new Exception ( _("erreur écriture fichier").' content.xml');
}
// repack
$zip = new Zip_Extended;
$res = $zip->open($this->b_name.".".$this->b_type, ZipArchive::CREATE);
if($res !== TRUE)
{
- echo __FILE__.":".__LINE__."cannot recreate zip";
- exit;
+ throw new Exception (__FILE__.":".__LINE__."cannot recreate zip");
}
$zip->add_recurse_folder($dirname.DIRECTORY_SEPARATOR);
$zip->close();
@@ -683,7 +679,7 @@ class Acc_Bilan
$fdoc=fopen($dirname.DIRECTORY_SEPARATOR.$this->b_name.'.'.$this->b_type,'r');
if ( $fdoc == false )
{
- exit (_("erreur Ouverture fichier"));
+ throw new Exception (_("erreur Ouverture fichier"));
}
$buffer=fread ($fdoc,filesize($dirname.DIRECTORY_SEPARATOR.$this->b_name.'.'.$this->b_type));
echo $buffer;
diff --git a/include/class_acc_compute.php b/include/class_acc_compute.php
index 5424a5094..a2282a2a9 100644
--- a/include/class_acc_compute.php
+++ b/include/class_acc_compute.php
@@ -91,7 +91,7 @@ class Acc_Compute
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
+ throw new Exception (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
}
public function set_parameter($p_string,$p_value)
{
@@ -101,7 +101,7 @@ class Acc_Compute
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
+ throw new Exception (__FILE__.":".__LINE__._('Erreur attribut inexistant'));
}
diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php
index 2e9cd3be0..17c276f81 100644
--- a/include/class_acc_ledger.php
+++ b/include/class_acc_ledger.php
@@ -1559,7 +1559,7 @@ class Acc_Ledger extends jrn_def_sql
* @brief Show the form to encode your operation
* @param$p_array if you correct or use a predef operation (default = null)
* @param$p_readonly 1 for readonly 0 for writable (default 0)
- *
+ *@exception if ledger not found
* \return a string containing the form
*/
@@ -1595,7 +1595,7 @@ class Acc_Ledger extends jrn_def_sql
}
$wLedger = $this->select_ledger('ODS', 2);
if ($wLedger == null)
- exit(_('Pas de journal disponible'));
+ throw new Exception(_('Pas de journal disponible'));
$wLedger->javascript = "onChange='update_name();update_predef(\"ods\",\"t\",\"".$_REQUEST['ac']."\");$add_js'";
$label = " Journal " . HtmlInput::infobulle(2);
@@ -2208,7 +2208,7 @@ class Acc_Ledger extends jrn_def_sql
function update_internal_code($p_internal)
{
if (!isset($this->grpt_id))
- exit('ERREUR ' . __FILE__ . ":" . __LINE__);
+ throw new Exception(('ERREUR ' . __FILE__ . ":" . __LINE__));
$Res = $this->db->exec_sql("update jrn set jr_internal='" . $p_internal . "' where " .
" jr_grpt_id = " . $this->grpt_id);
}
@@ -2363,7 +2363,7 @@ class Acc_Ledger extends jrn_def_sql
return true;
if ($g_parameter->MY_STRICT == 'N')
return false;
- exit("Valeur invalid " . __FILE__ . ':' . __LINE__);
+ throw Exception("Valeur invalid " . __FILE__ . ':' . __LINE__);
}
/**
@@ -2379,7 +2379,7 @@ class Acc_Ledger extends jrn_def_sql
return true;
if ($g_parameter->MY_CHECK_PERIODE == 'N')
return false;
- exit("Valeur invalid " . __FILE__ . ':' . __LINE__);
+ throw Exception("Valeur invalid " . __FILE__ . ':' . __LINE__);
}
/**
@@ -3214,7 +3214,7 @@ class Acc_Ledger extends jrn_def_sql
echo $op->show_button();
}
echo '';
- exit();
+ exit('test_me');
}
if (isset($_POST['post_id']))
@@ -3225,7 +3225,7 @@ class Acc_Ledger extends jrn_def_sql
echo HtmlInput::button('add', 'Ajout d\'une ligne', 'onClick="quick_writing_add_row()"');
echo HtmlInput::submit('save_it', "Sauver");
echo '';
- exit();
+ exit('test_me');
}
if (isset($_POST['save_it']))
{
@@ -3245,7 +3245,7 @@ class Acc_Ledger extends jrn_def_sql
echo HtmlInput::submit('post_id', 'Try me');
echo '';
}
- exit();
+ return;
}
// The GET at the end because automatically repost when you don't
// specify the url in the METHOD field
@@ -3262,7 +3262,7 @@ class Acc_Ledger extends jrn_def_sql
echo $a->show_form($p_post);
echo HtmlInput::submit('post_id', 'Use predefined operation');
echo '';
- exit();
+ return;
}
}// if case = ''
///////////////////////////////////////////////////////////////////////////
diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php
index fdbc2a662..284e354b6 100644
--- a/include/class_acc_ledger_fin.php
+++ b/include/class_acc_ledger_fin.php
@@ -292,8 +292,8 @@ class Acc_Ledger_Fin extends Acc_Ledger
{
if ($e->getCode() == 1)
{
- echo "Aucune période ouverte";
- exit();
+ throw Exception(_("Aucune période ouverte"));
+
}
}
$label = HtmlInput::infobulle(3);
@@ -312,7 +312,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$add_js = 'onchange="'.$onchange.'"';
$wLedger = $this->select_ledger('FIN', 2);
if ($wLedger == null)
- exit('Pas de journal disponible');
+ throw Exception(_('Pas de journal disponible'));
$wLedger->javascript = $add_js;
@@ -960,12 +960,12 @@ class Acc_Ledger_Fin extends Acc_Ledger
}
catch (Exception $e)
{
- echo '' .
+ $r = '' .
'Erreur dans l\'enregistrement ' .
__FILE__ . ':' . __LINE__ . ' ' .
$e->getMessage();
$this->db->rollback();
- exit();
+ throw Exception($r);
}
$this->db->commit();
$r = "";
@@ -1010,7 +1010,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$wLedger = $this->select_ledger('fin', 3);
if ($wLedger == null)
- exit(_('Pas de journal disponible'));
+ throw Exception(_('Pas de journal disponible'));
if (count($wLedger->value) > 1)
{
diff --git a/include/class_acc_ledger_info.php b/include/class_acc_ledger_info.php
index 3ad73eee3..5ac20d6a4 100644
--- a/include/class_acc_ledger_info.php
+++ b/include/class_acc_ledger_info.php
@@ -51,7 +51,7 @@ class Acc_Ledger_Info
{
echo 'Appel incorrecte '.__FILE__.__LINE__;
var_dump($this);
- exit();
+ throw Exception(_('appel incorrect'));
}
try
{
@@ -75,7 +75,7 @@ class Acc_Ledger_Info
{
echo 'Appel incorrecte '.__FILE__.__LINE__;
var_dump($this);
- exit();
+ throw Exception('appel incorrect');
}
try
{
@@ -136,7 +136,7 @@ class Acc_Ledger_Info
if ( ! isset ($this->jr_id) )
{
echo "jr_id is not set ".__FILE__.__LINE__;
- exit();
+ throw Exception('Error : jr_id not set');
}
$sql="select ji_id from jrn_info where jr_id=".$this->jr_id;
diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php
index 1aabec5ee..b01cce77f 100644
--- a/include/class_acc_ledger_purchase.php
+++ b/include/class_acc_ledger_purchase.php
@@ -908,7 +908,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$e->getMessage().$e->getTraceAsString();
$this->db->rollback();
- exit();
+ throw new Exception($e);
}
$this->db->commit();
return $internal;
@@ -1014,8 +1014,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
{
if ($e->getCode() == 1 )
{
- echo _("Aucune période ouverte");
- exit();
+ throw Exception( _("Aucune période ouverte"));
}
}
@@ -1040,7 +1039,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
$add_js.='update_row("sold_item");';
$wLedger=$this->select_ledger('ACH',2);
- if ($wLedger == null) exit (_('Pas de journal disponible'));
+ if ($wLedger == null) throw Exception(_('Pas de journal disponible'));
$wLedger->javascript="onChange='update_predef(\"ach\",\"f\",\"".$_REQUEST['ac']."\");$add_js'";
$wLedger->table=1;
$f_jrn=$wLedger->input();
diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php
index bbd46d3d7..7242caf41 100644
--- a/include/class_acc_ledger_sold.php
+++ b/include/class_acc_ledger_sold.php
@@ -582,7 +582,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
echo $e->getTrace();
$this->db->rollback();
- exit();
+ throw new Exception ($e);
}
$this->db->commit();
@@ -1044,8 +1044,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$l_form_per = $period->input();
} catch (Exception $e) {
if ($e->getCode() == 1) {
- echo _("Aucune période ouverte");
- exit();
+ throw Exception( _("Aucune période ouverte") );
}
}
$label = HtmlInput::infobulle(3);
@@ -1065,7 +1064,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
$wLedger = $this->select_ledger('VEN', 2);
if ($wLedger == null)
- exit(_('Pas de journal disponible'));
+ throw Exception(_('Pas de journal disponible'));
$wLedger->table = 1;
$wLedger->javascript = "onChange='update_predef(\"ven\",\"f\",\"".$_REQUEST['ac']."\");$add_js'";
$wLedger->label = " Journal " . HtmlInput::infobulle(2);
diff --git a/include/class_acc_payment.php b/include/class_acc_payment.php
index 71c1f8aa0..0d4dbb4de 100644
--- a/include/class_acc_payment.php
+++ b/include/class_acc_payment.php
@@ -70,7 +70,6 @@ class Acc_Payment
else
{
throw new Exception("Attribut inexistant $p_string");
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
}
}
public function set_parameter($p_string,$p_value)
@@ -81,7 +80,7 @@ class Acc_Payment
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_acc_reconciliation.php b/include/class_acc_reconciliation.php
index ef8b6a738..5a35d4399 100644
--- a/include/class_acc_reconciliation.php
+++ b/include/class_acc_reconciliation.php
@@ -517,7 +517,7 @@ j1.j_poste as poste
break;
default:
echo "Choix invalid";
- exit();
+ throw new Exception("invalide");
}
return $array;
}
diff --git a/include/class_acc_report_row.php b/include/class_acc_report_row.php
index 8ea31b585..1f4a377e0 100644
--- a/include/class_acc_report_row.php
+++ b/include/class_acc_report_row.php
@@ -49,7 +49,7 @@ class Acc_Report_Row
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function set_parameter($p_string,$p_value)
{
@@ -59,7 +59,7 @@ class Acc_Report_Row
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__."$p_string ".'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_acc_tva.php b/include/class_acc_tva.php
index 583589ca9..b88ce9759 100644
--- a/include/class_acc_tva.php
+++ b/include/class_acc_tva.php
@@ -69,7 +69,7 @@ class Acc_Tva
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_anc_acc_list.php b/include/class_anc_acc_list.php
index 473704806..b782b802e 100644
--- a/include/class_anc_acc_list.php
+++ b/include/class_anc_acc_list.php
@@ -427,7 +427,7 @@ END) <> 0::numeric order by name,po_name",array($this->pa_id));
function export_csv()
{
bcscale(2);
- if ( $this->check () != 0 ) {echo "DATE INVALIDE";exit();}
+ if ( $this->check () != 0 ) {throw new Exception (_("date invalide"));}
//---------------------------------------------------------------------------
// Card - Acc
//---------------------------------------------------------------------------
diff --git a/include/class_anc_group_operation.php b/include/class_anc_group_operation.php
index 1e950c647..bd3c859a0 100644
--- a/include/class_anc_group_operation.php
+++ b/include/class_anc_group_operation.php
@@ -76,7 +76,7 @@ class Anc_Group_Operation
{
echo $e->getTrace();
$this->db->rollback();
- exit();
+ throw new Exception($e);
}
$this->db->commit();
}
@@ -244,7 +244,7 @@ class Anc_Group_Operation
__FILE__.':'.__LINE__.' '.
$ex->getMessage();
$p_cn->rollback();
- exit();
+ throw new Exception("Erreur ".$ex->getMessage());
}
$this->db->commit();
@@ -263,7 +263,7 @@ class Anc_Group_Operation
{
$b=new Anc_Group_Operation($cn);
$b->get_from_array($_POST);
- exit();
+ return;
}
$a=new Anc_Group_Operation($cn);
diff --git a/include/class_anc_print.php b/include/class_anc_print.php
index 7596d561a..2a51b08a4 100644
--- a/include/class_anc_print.php
+++ b/include/class_anc_print.php
@@ -93,7 +93,7 @@ class Anc_Print
echo ''._('Aucun plan défini').'
';
echo '
";
echo '