Task #1044 - Implementation de Test

Replace in class exit by throw new Exception
This commit is contained in:
Dany De Bontridder 2014-11-14 23:11:56 +01:00
parent 518a9090d6
commit 54b6037ede
37 changed files with 95 additions and 104 deletions

View file

@ -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'));
}

View file

@ -464,7 +464,6 @@ class Acc_Account_Ledger
break;
default:
throw new Exception(" Fonction HtmlTableHeader argument actiontarget invalid");
exit;
}
$hid=new IHidden();

View file

@ -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;

View file

@ -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'));
}

View file

@ -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 '</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 = ''
///////////////////////////////////////////////////////////////////////////

View file

@ -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)
{

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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");
}

View file

@ -517,7 +517,7 @@ j1.j_poste as poste
break;
default:
echo "Choix invalid";
exit();
throw new Exception("invalide");
}
return $array;
}

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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
//---------------------------------------------------------------------------

View file

@ -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);

View file

@ -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');

View file

@ -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')
{

View file

@ -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");
}

View file

@ -99,7 +99,7 @@ class Database
echo "Utilisateur : $noalyss_user <br>";
echo '</p>';
exit("Connection impossible : v&eacute;rifiez vos param&egrave;tres de base
die("Connection impossible : v&eacute;rifiez vos param&egrave;tres de base
de donn&eacute;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;
}

View file

@ -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')

View file

@ -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;
}

View file

@ -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__);
}
}
}

View file

@ -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");
}

View file

@ -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();
}

View file

@ -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

View file

@ -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">';

View file

@ -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"),

View file

@ -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");
}

View file

@ -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()
{

View file

@ -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");
}

View file

@ -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");
}

View file

@ -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,

View file

@ -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,

View file

@ -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;

View file

@ -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 ) {

View file

@ -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");
}

View file

@ -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);