[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/03: Task #1044 - Implementation de Test Re
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/03: Task #1044 - Implementation de Test Replace in class exit by throw new Exception |
Date: |
Fri, 14 Nov 2014 22:12:45 +0000 |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 54b6037edefdecb39287bbc114ce27291a5ed60b
Author: Dany De Bontridder <address@hidden>
Date: Fri Nov 14 23:11:56 2014 +0100
Task #1044 - Implementation de Test
Replace in class exit by throw new Exception
---
include/class_acc_account.php | 4 ++--
include/class_acc_account_ledger.php | 1 -
include/class_acc_bilan.php | 24 ++++++++++--------------
include/class_acc_compute.php | 4 ++--
include/class_acc_ledger.php | 18 +++++++++---------
include/class_acc_ledger_fin.php | 12 ++++++------
include/class_acc_ledger_info.php | 6 +++---
include/class_acc_ledger_purchase.php | 7 +++----
include/class_acc_ledger_sold.php | 7 +++----
include/class_acc_payment.php | 3 +--
include/class_acc_reconciliation.php | 2 +-
include/class_acc_report_row.php | 4 ++--
include/class_acc_tva.php | 2 +-
include/class_anc_acc_list.php | 2 +-
include/class_anc_group_operation.php | 6 +++---
include/class_anc_print.php | 2 +-
include/class_anc_table.php | 2 +-
include/class_anticipation.php | 4 ++--
include/class_database.php | 9 ++++-----
include/class_document.php | 15 ++++++++-------
include/class_document_export.php | 2 +-
include/class_document_modele.php | 4 ++--
include/class_dossier.php | 4 ++--
include/class_extension.php | 2 +-
include/class_fiche.php | 7 +++----
include/class_fiche_def.php | 2 +-
include/class_follow_up.php | 4 ++--
include/class_follow_up_detail.php | 4 ++--
include/class_forecast.php | 4 ++--
include/class_forecast_cat.php | 4 ++--
include/class_forecast_item.php | 4 ++--
include/class_gestion_purchase.php | 2 +-
include/class_gestion_sold.php | 2 +-
include/class_pre_operation.php | 8 ++++----
include/class_stock_goods.php | 2 +-
include/class_todo_list.php | 4 ++--
include/class_user.php | 6 +++---
37 files changed, 95 insertions(+), 104 deletions(-)
diff --git a/include/class_acc_account.php b/include/class_acc_account.php
index db3e845..387daaf 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 1f758ca..230f86b 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 4fb8169..a54dce2 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 5424a50..a2282a2 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 2e9cd3b..17c276f 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)
- *
+ address@hidden 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 '</form>';
- 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 '</form>';
- 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 '</form>';
}
- 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 '</form>';
- exit();
+ return;
}
}// if case = ''
///////////////////////////////////////////////////////////////////////////
diff --git a/include/class_acc_ledger_fin.php b/include/class_acc_ledger_fin.php
index fdbc2a6..284e354 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 '<span class="error">' .
+ $r = '<span class="error">' .
'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 3ad73ee..5ac20d6 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 1aabec5..b01cce7 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 bbd46d3..7242caf 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 71c1f8a..0d4dbb4 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 ef8b6a7..5a35d43 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 8ea31b5..1f4a377 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 583589c..b88ce97 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 4737048..b782b80 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 1e950c6..bd3c859 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 7596d56..2a51b08 100644
--- a/include/class_anc_print.php
+++ b/include/class_anc_print.php
@@ -93,7 +93,7 @@ class Anc_Print
echo '<div class="content">';
echo '<h2 class="error">'._('Aucun plan défini').'</h2>';
echo '</div>';
- exit();
+ return;
}
$from=new IDate('from','from');
diff --git a/include/class_anc_table.php b/include/class_anc_table.php
index 7ca3c86..5c2669f 100644
--- a/include/class_anc_table.php
+++ b/include/class_anc_table.php
@@ -239,7 +239,7 @@ class Anc_Table extends Anc_Acc_Link
function export_csv()
{
bcscale(2);
- if ( $this->check () != 0 ) {echo "DATE INVALIDE";exit();}
+ if ( $this->check () != 0 ) {throw new Exception ( "DATE INVALIDE");}
if ( $this->card_poste=='1')
{
diff --git a/include/class_anticipation.php b/include/class_anticipation.php
index 3d9bd68..7d65f20 100644
--- a/include/class_anticipation.php
+++ b/include/class_anticipation.php
@@ -61,7 +61,7 @@ class Anticipation
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__."[$p_string]".'Erreur attribut
inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function set_parameter($p_string,$p_value)
{
@@ -71,7 +71,7 @@ class Anticipation
$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_database.php b/include/class_database.php
index 0c4c9b6..e7cfe93 100644
--- a/include/class_database.php
+++ b/include/class_database.php
@@ -99,7 +99,7 @@ class Database
echo "Utilisateur : $noalyss_user <br>";
echo '</p>';
- exit("Connection impossible : vérifiez vos
paramètres de base
+ die("Connection impossible : vérifiez vos
paramètres de base
de données");
}
else
@@ -264,8 +264,7 @@ class Database
$hf=fopen($script, 'r');
if ($hf==false)
{
- echo 'Ne peut ouvrir '.$script;
- exit();
+ throw new Exception ( 'Ne peut ouvrir '.$script);
}
$sql="";
$flag_function=false;
@@ -327,7 +326,7 @@ class Database
if (!DEBUG)
ob_end_clean();
print "ERROR : $sql";
- exit();
+ throw new Exception("ERROR : $sql");
}
$sql="";
$flag_function=false;
@@ -619,7 +618,7 @@ class Database
break;
default:
echo_error(__FILE__." format_name invalid type ".$p_type,
__LINE__);
- exit();
+ throw new Exception(__FILE__." format_name invalid type
".$p_type. __LINE__);
}
return $sys_name;
}
diff --git a/include/class_document.php b/include/class_document.php
index dd4942c..9f4684a 100644
--- a/include/class_document.php
+++ b/include/class_document.php
@@ -146,8 +146,7 @@ class Document
$res = $zip->open($filename, 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();
@@ -197,8 +196,8 @@ class Document
{
if ( mkdir($temp_dir) == false )
{
- echo "Ne peut pas créer le répertoire ".$temp_dir;
- exit();
+ $msg=_("Ne peut pas créer le répertoire ".$temp_dir);
+ throw new Exception($msg);
}
}
// Compute output_name
@@ -208,12 +207,14 @@ class Document
if ( $h === false )
{
echo __FILE__.":".__LINE__."cannot open $p_dir $p_file ";
- exit();
+ $msg=_("Ne peut pas ouvrir $p_dir $p_file");
+ throw new Exception($msg);
}
if ( $output_file == false)
{
- echo "ne peut pas ouvrir le fichier de sortie";
- exit();
+ $msg=_("Ne peut pas ouvrir $p_dir $p_file");
+ echo $msg;
+ throw new Exception($msg);
}
// compute the regex
if ( $p_type=='OOo')
diff --git a/include/class_document_export.php
b/include/class_document_export.php
index 38a561b..8de4af2 100644
--- a/include/class_document_export.php
+++ b/include/class_document_export.php
@@ -71,7 +71,7 @@ class Document_Export
catch (Exception $exc)
{
$cnt_feedback=count($this->feedback);
- $this->feedback[$cnt_feedback]['file']='result.pdf';
+ $this->feedback[$cnt_feedback]['file']=' ';
$this->feedback[$cnt_feedback]['message']=$exc->getMessage();
$this->feedback[$cnt_feedback]['error']=0;
}
diff --git a/include/class_document_modele.php
b/include/class_document_modele.php
index aafa406..51acd03 100644
--- a/include/class_document_modele.php
+++ b/include/class_document_modele.php
@@ -183,7 +183,7 @@ class Document_modele
{
echo "<H1>Error</H1>";
$this->cn->rollback();
- exit;
+ throw new Exception("Erreur".__FILE__.__LINE__);
}
}
}
@@ -348,7 +348,7 @@ class Document_modele
{
echo "<H1>Error</H1>";
$this->cn->rollback();
- exit;
+ throw new Exception("Erreur".__FILE__.__LINE__);
}
}
}
diff --git a/include/class_dossier.php b/include/class_dossier.php
index 1a13590..4cf4ab1 100644
--- a/include/class_dossier.php
+++ b/include/class_dossier.php
@@ -181,7 +181,7 @@ class Dossier
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)
{
@@ -191,7 +191,7 @@ class Dossier
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_extension.php b/include/class_extension.php
index fcbcaf9..6188e66 100644
--- a/include/class_extension.php
+++ b/include/class_extension.php
@@ -92,7 +92,7 @@ class Extension extends Menu_Ref_sql
{
alert('Cette extension ne fonctionne pas sur cette version de
NOALYSS'.
' Veuillez mettre votre programme a jour. Version minimum
'.$i);
- exit();
+ return;
}
Extension::check_plugin_version();
}
diff --git a/include/class_fiche.php b/include/class_fiche.php
index ed94d65..3bc3e23 100644
--- a/include/class_fiche.php
+++ b/include/class_fiche.php
@@ -1464,7 +1464,7 @@ class Fiche
*/
function get_bk_balance($p_cond="")
{
- if ( $this->id == 0 ) exit('fiche->id est nul');
+ if ( $this->id == 0 ) throw new Exception('fiche->id est nul');
$qcode=$this->strAttribut(ATTR_DEF_QUICKCODE);
if ( $p_cond != "") $p_cond=" and ".$p_cond;
@@ -1642,7 +1642,7 @@ class Fiche
*/
function get_categorie()
{
- if ( $this->id == 0 ) exit('class_fiche : f_id = 0 ');
+ if ( $this->id == 0 ) throw new Exception('class_fiche : f_id = 0 ');
$sql='select fd_id from fiche where f_id='.$this->id;
$R=$this->cn->get_value($sql);
if ( $R == "" )
@@ -1671,8 +1671,7 @@ class Fiche
if (($this->quick_code==null || $this->quick_code == "" )
&& $this->id == 0 )
{
- echo 'erreur ni quick_code ni f_id ne sont donnes';
- exit();
+ throw new Exception( 'erreur ni quick_code ni f_id ne sont
donnes');
}
//retrieve the quick_code
diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php
index 27a2de4..719fed5 100644
--- a/include/class_fiche_def.php
+++ b/include/class_fiche_def.php
@@ -764,7 +764,7 @@ $order
$this->get();
$this->GetAttribut();
$r.= '<H2 class="info">' . $this->id . " " . h($this->label) .
'</H2>';
- $r.='<fieldset><legend>'_('Données générales').'</legend>';
+ $r.='<fieldset><legend>'._('Données générales').'</legend>';
/* show the values label class_base and create account */
$r.='<form method="post">';
diff --git a/include/class_follow_up.php b/include/class_follow_up.php
index e10b34a..5de133a 100644
--- a/include/class_follow_up.php
+++ b/include/class_follow_up.php
@@ -158,7 +158,7 @@ class Follow_Up
}
else
{
- exit('class_action' . __LINE__ . 'Follow_Up::Display
error unknown parameter' . $p_view);
+ throw new Exception('class_action' . __LINE__ .
'Follow_Up::Display error unknown parameter' . $p_view);
}
// Compute the widget
// Date
@@ -1448,7 +1448,7 @@ class Follow_Up
where true $p_search order by ag.ag_timestamp,ag.ag_id";
$ret=$this->db->exec_sql($sql);
- if ( Database::num_row($ret)==0)exit();
+ if ( Database::num_row($ret)==0) return;
$this->db->query_to_csv($ret,array(
array("title"=>"doc id","type"=>"string"),
array("title"=>"date","type"=>"date"),
diff --git a/include/class_follow_up_detail.php
b/include/class_follow_up_detail.php
index 237723d..2bcef10 100644
--- a/include/class_follow_up_detail.php
+++ b/include/class_follow_up_detail.php
@@ -64,7 +64,7 @@ class Follow_Up_Detail
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)
{
@@ -74,7 +74,7 @@ class Follow_Up_Detail
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_forecast.php b/include/class_forecast.php
index 82b6835..8bc0cb6 100644
--- a/include/class_forecast.php
+++ b/include/class_forecast.php
@@ -46,7 +46,7 @@ class Forecast
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__."[$p_string]".'Erreur attribut
inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function set_parameter($p_string,$p_value)
{
@@ -56,7 +56,7 @@ class Forecast
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__."[$p_string]".'Erreur attribut
inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function get_info()
{
diff --git a/include/class_forecast_cat.php b/include/class_forecast_cat.php
index db407b3..2b7188e 100644
--- a/include/class_forecast_cat.php
+++ b/include/class_forecast_cat.php
@@ -52,7 +52,7 @@ class Forecast_Cat
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__."[$p_string]".'Erreur attribut
inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function set_parameter($p_string,$p_value)
{
@@ -62,7 +62,7 @@ class Forecast_Cat
$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_forecast_item.php b/include/class_forecast_item.php
index 9da6f6d..0081532 100644
--- a/include/class_forecast_item.php
+++ b/include/class_forecast_item.php
@@ -54,7 +54,7 @@ class Forecast_Item
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__."[$p_string]".'Erreur attribut
inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function set_parameter($p_string,$p_value)
{
@@ -64,7 +64,7 @@ class Forecast_Item
$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_gestion_purchase.php
b/include/class_gestion_purchase.php
index cd530fb..d36c92f 100644
--- a/include/class_gestion_purchase.php
+++ b/include/class_gestion_purchase.php
@@ -52,7 +52,7 @@ class gestion_purchase extends gestion_table
function get_list()
{
if ($this->qp_internal=="")
- exit (__FILE__.__LINE__." qs_internal est vide");
+ throw new Exception(__FILE__.__LINE__." qs_internal est vide");
$sql="select qp_id,
qp_internal,
qp_fiche,
diff --git a/include/class_gestion_sold.php b/include/class_gestion_sold.php
index aceeb20..fb0705c 100644
--- a/include/class_gestion_sold.php
+++ b/include/class_gestion_sold.php
@@ -48,7 +48,7 @@ class gestion_sold extends gestion_table
function get_list()
{
if ($this->qs_internal=="")
- exit (__FILE__.__LINE__." qs_internal est vide");
+ throw new Exception(__FILE__.__LINE__." qs_internal est vide");
$sql="select qs_id,
qs_internal,
qs_fiche,
diff --git a/include/class_pre_operation.php b/include/class_pre_operation.php
index 1be1a27..fd2bf21 100644
--- a/include/class_pre_operation.php
+++ b/include/class_pre_operation.php
@@ -305,8 +305,8 @@ class Pre_operation_detail
{
if ( ! isset ($this->valid[$p_param] ) )
{
- echo(" le parametre $p_param n'existe pas ".__FILE__.':'.__LINE__);
- exit();
+ $msg=_(" le parametre $p_param n'existe pas
".__FILE__.':'.__LINE__);
+ throw new Exception($msg);
}
$attr=$this->valid[$p_param];
$this->$attr=$value;
@@ -316,8 +316,8 @@ class Pre_operation_detail
if ( ! isset ($this->valid[$p_param] ) )
{
- echo(" le parametre $p_param n'existe pas ".__FILE__.':'.__LINE__);
- exit();
+ $msg=_(" le parametre $p_param n'existe pas
".__FILE__.':'.__LINE__);
+ throw new Exception($msg);
}
$attr=$this->valid[$p_param];
return $this->$attr;
diff --git a/include/class_stock_goods.php b/include/class_stock_goods.php
index dc0bd18..bf7f932 100644
--- a/include/class_stock_goods.php
+++ b/include/class_stock_goods.php
@@ -71,7 +71,7 @@ class Stock_Goods extends Stock_Goods_Sql
if (count($idepo->value) == 0)
{
NoAccess();
- exit();
+ die();
}
$idepo->selected = $p_depot;
if ($p_readonly ) {
diff --git a/include/class_todo_list.php b/include/class_todo_list.php
index e956556..391c33d 100644
--- a/include/class_todo_list.php
+++ b/include/class_todo_list.php
@@ -67,7 +67,7 @@ class Todo_List
return $this->$idx;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
public function check($p_idx,&$p_value)
{
@@ -99,7 +99,7 @@ class Todo_List
if ($this->check($idx,$p_value) == true )
$this->$idx=$p_value;
}
else
- exit (__FILE__.":".__LINE__.'Erreur attribut inexistant');
+ throw new Exception("Attribut inexistant $p_string");
}
diff --git a/include/class_user.php b/include/class_user.php
index 7c44048..8e64086 100644
--- a/include/class_user.php
+++ b/include/class_user.php
@@ -354,6 +354,7 @@ class User
function Admin()
{
+ $this->admin = 0;
if ($this->login != 'phpcompta')
{
$pass5 = md5($this->pass);
@@ -363,7 +364,7 @@ class User
$cn = new Database();
$res = $cn->exec_sql($sql, array($this->login));
if (Database::num_row($res) == 0)
- exit(__FILE__ . " " . __LINE__ . " aucun
resultat");
+ throw new Exception(__FILE__ . " " . __LINE__
. " aucun resultat");
$this->admin = Database::fetch_result($res, 0);
}
else
@@ -402,8 +403,7 @@ class User
$pid = Database::fetch_result($Res2, 0, 0);
if ($pid == null)
{
- echo _("Aucune période trouvéee !!!");
- exit(1);
+ throw new Exception( _("Aucune période
trouvéee !!!"));
}
$pid = Database::fetch_result($Res2, 0, 0);