Task #1420: Fonction error_log manquante

Generalisation de la fonction
This commit is contained in:
Dany De Bontridder 2017-03-24 23:53:47 +01:00
parent 9e7e7f51e9
commit 379a24e5f2
38 changed files with 71 additions and 19 deletions

View file

@ -255,7 +255,7 @@ if (isset($_REQUEST['ac']))
}
else {
alert($e->getMessage());
error_log($e->getTraceAsString());
record_log($e->getTraceAsString());
}
}
}
@ -285,7 +285,7 @@ else
catch (Exception $exc)
{
echo $exc->getMessage();
error_log($exc->getTraceAsString());
record_log($exc->getTraceAsString());
}
}

View file

@ -150,6 +150,7 @@ if ($sub_action == "update")
$act->get();
$act->fromArray($_POST);
$error_id=$e->getCode();
record_log($e->getTraceAsString());
}
}
//----------------------------------------------------------------------
@ -289,6 +290,7 @@ if ($sub_action == "save_action_st2")
echo '</span>';
$sub_action="add_action";
$error_id=$e->getCode();
record_log($e->getTraceAsString());
}
}
//--------------------------------------------------------------------------------

View file

@ -77,6 +77,7 @@ if ($action=="update" &&$acc_delete==0)
$message=_("Valeurs invalides, pas de changement")." \n ".
$e->getMessage();
$ctl='nok';
record_log($e->getTraceAsString());
}
if (strlen($p_val)!=0&&strlen($p_lib)!=0&&strlen($old_line)!=0)
{
@ -108,6 +109,7 @@ if ($action=="update" &&$acc_delete==0)
{
$message=$e->getMessage();
$ctl='nok';
record_log($e->getTraceAsString());
}
}
}

View file

@ -83,6 +83,7 @@ if ($op=='action_save')
}
catch (Exception $ex)
{
record_log($ex->getTraceAsString());
header('Content-type: text/xml; charset=UTF-8');
$dom=new DOMDocument('1.0', 'UTF-8');
$xml_content=$dom->createElement('content', $ex->getMessage());
@ -115,6 +116,7 @@ if ($op=='action_save')
$gestion->save_short();
} catch (Exception $ex)
{
record_log($ex->getTraceAsString());
$content=$ex->getMessage();
$status='NOK';
}

View file

@ -156,6 +156,7 @@ case 'rmop':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$e->getMessage();
$cn->rollback();
}
@ -201,6 +202,7 @@ case 'de':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo HtmlInput::anchor_close($div);
echo '<h2 class="error">'._("Désolé il y a une erreur").'</h2>';
}
@ -504,6 +506,7 @@ case 'save':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
if ( DEBUG ) echo $e->getMessage();
alert(_( "Changement impossible: on ne peut pas changer la date dans une période fermée"));
}
@ -556,6 +559,7 @@ case 'reverseop':
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$e->getMessage();
$cn->rollback();
}

View file

@ -90,6 +90,7 @@ switch ($op)
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$html = alert($e->getTrace(), true);
}
}

View file

@ -57,6 +57,7 @@ switch ($op)
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo span($e->getMessage(),' class="notice"');
}
}

View file

@ -56,6 +56,7 @@ if ( isset($_POST['save']))
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert($e->getMessage());
$cn->rollback();
}

View file

@ -54,6 +54,7 @@ if ( $action_frm == 'update')
$show_menu=1;
} catch (Exception $e)
{
record_log($e->getTraceAsString());
alert($e->getMessage());
}
}
@ -77,6 +78,7 @@ if ($action_frm == 'delete' )
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert ($e->getMessage());
}
@ -97,6 +99,7 @@ if (isset($_POST['add']))
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert($e->getMessage());
}
}
@ -130,6 +133,7 @@ switch ($sa)
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert($e->getMessage());
}
break;

View file

@ -82,6 +82,7 @@ if ( isset ($_POST['save_plugin'])){
}
catch (Exception $exc)
{
record_log($exc->getTraceAsString());
$profile_name=$cn->get_value('select profile.p_name from profile where p_id=$1'
,array($profile));
echo '<p class="notice">';

View file

@ -278,6 +278,7 @@ class Acc_Bilan
}
catch(Exception $Ex)
{
record_log($e->getTraceAsString());
echo $Ex->getMessage();
throw $Ex;
}

View file

@ -334,6 +334,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->db->rollback();
throw $e;
}
@ -1651,6 +1652,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
if ($e->getCode() == 1)
{
echo _("Aucune période ouverte");
@ -2150,12 +2152,10 @@ class Acc_Ledger extends jrn_def_sql
}
}
catch (Exception $a)
{
throw $a;
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->db->rollback();
echo _('OPERATION ANNULEE ');
echo '<hr>';
@ -3366,7 +3366,7 @@ class Acc_Ledger extends jrn_def_sql
catch (Exception $e)
{
$cn->rollback();
var_dump($e);
record_log($e->getTraceAsString());
}
$cn->commit();
}
@ -3585,6 +3585,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
throw $e;
}
}
@ -3816,6 +3817,7 @@ class Acc_Ledger extends jrn_def_sql
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
throw $e;
}
}

View file

@ -901,6 +901,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$oppaid->set_id($rRapt);
$oppaid->set_paid();
} catch (Exception $ex) {
record_log($ex->getTraceAsString());
echo _('Attention , erreur Acc_Ledger_Fin::insert , coche paiement');
}
}
@ -921,6 +922,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
$oppaid->set_paid();
}
} catch (Exception $ex) {
record_log($ex->getTraceAsString());
echo _('Attention , erreur Acc_Ledger_Fin::insert , coche paiement');
}
}
@ -986,6 +988,7 @@ class Acc_Ledger_Fin extends Acc_Ledger
__FILE__ . ':' . __LINE__ . ' ' .
$e->getMessage();
$this->db->rollback();
record_log($e->getTraceAsString());
throw new Exception($r);
}
$this->db->commit();

View file

@ -63,6 +63,7 @@ class Acc_Ledger_Info
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo "Echec sauvegarde info additionnelles";
throw $e;
}
@ -85,6 +86,7 @@ class Acc_Ledger_Info
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->cn->rollback();
echo "Echec sauvegarde info additionnelles";
throw $e;

View file

@ -914,11 +914,12 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}//end try
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo '<span class="error">'.
'Erreur dans l\'enregistrement '.
__FILE__.':'.__LINE__.' '.
$e->getMessage().$e->getMessage();
error_log($e->getMessage());
record_log($e->getMessage());
$this->db->rollback();
throw new Exception($e);
}
@ -1024,6 +1025,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
if ($e->getCode() == 1 )
{
throw new Exception( _("Aucune période ouverte"));

View file

@ -582,6 +582,7 @@ class Acc_Ledger_Sold extends Acc_Ledger {
}
}
} catch (Exception $e) {
record_log($e->getTraceAsString());
echo '<span class="error">' .
'Erreur dans l\'enregistrement ' .
__FILE__ . ':' . __LINE__ . ' ' .

View file

@ -216,6 +216,7 @@ class Acc_Report
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->db->rollback();
echo $e->getMessage();
}
@ -257,6 +258,7 @@ class Acc_Report
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->db->rollback();
echo $e->getMessage();
}

View file

@ -119,6 +119,7 @@ class Anc_Account
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
if ( DEBUG ) print_r($e);
echo "<p class=\"notice\">Doublon : l'enregistrement n'est pas sauve</p>";
}
@ -150,6 +151,7 @@ class Anc_Account
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo "<p class=\"notice\">Doublon : l'enregistrement n'est pas sauve</p>";
}

View file

@ -74,6 +74,7 @@ class Anc_Group_Operation
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo $e->getTrace();
$this->db->rollback();
throw new Exception($e);
@ -239,6 +240,7 @@ class Anc_Group_Operation
}
catch (Exception $ex)
{
record_log($e->getTraceAsString());
echo '<span class="error">'.
'Erreur dans l\'enregistrement '.
__FILE__.':'.__LINE__.' '.

View file

@ -265,8 +265,9 @@ class Anc_Key
}
catch (Exception $e)
{
if ( DEBUG ) { echo $e->getTraceAsString(); } else { echo _('erreur').$e->getMessage();}
error_log($e->getTraceAsString());
record_log($e->getTraceAsString());
$cn->rollback();
}
}

View file

@ -492,7 +492,7 @@ class Anc_Operation
}
catch (Exception $e)
{
var_dump($e);
record_log($e->getTraceAsString());
}
}
/*!\brief display the form for PA

View file

@ -106,7 +106,7 @@ class Default_Menu
}
} catch (Exception $e)
{
error_log($e->getTraceAsString());
record_log($e->getTraceAsString());
echo $e->getMessage();
throw $e;
}

View file

@ -191,6 +191,7 @@ class Document_modele
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
rollback($this->cn);
return ;
}
@ -356,6 +357,7 @@ class Document_modele
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
rollback($this->cn);
return ;
}

View file

@ -103,6 +103,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert(j(_("Impossible d'ajouter [$p_value] ") . $e->getMessage()));
}
}
@ -119,6 +120,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert(" Erreur " . $e->getMessage());
}
}
@ -131,6 +133,7 @@ class Document_type
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
alert("Erreur " . $e->getMessage());
}
}

View file

@ -327,8 +327,9 @@ class Dossier
}
catch (Exception $e)
{
echo_warning($e->getMessage());
error_log($e->getTraceAsString());
record_log($e->getTraceAsString());
$cn->rollback();
}
}

View file

@ -99,6 +99,7 @@ class Fiche_Attr
$this->cn->exec_sql($this->ad_extra);
}catch (Exception $e)
{
record_log($e->getTraceAsString());
throw new Exception ("La requête SQL ".h($this->ad_extra)." est invalide ");
}
}
@ -160,6 +161,7 @@ class Fiche_Attr
);
} catch (Exception $e)
{
record_log($e->getTraceAsString());
throw $e;
}
@ -183,6 +185,7 @@ class Fiche_Attr
);
}catch (Exception $e)
{
record_log($e->getTraceAsString());
throw $e;
}

View file

@ -125,7 +125,7 @@ class Follow_Up
{
$sql=" ( ag_dest in (select p_granted from user_sec_action_profile where p_id=$profile and ua_right='W' ) )";
} else {
error_log(_('Securité'));
record_log(_('Securité'));
throw new Exception(_('Securité'));
}
return $sql;

View file

@ -424,6 +424,7 @@ class Periode
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->cn->rollback();
return 1;
}
@ -570,6 +571,7 @@ class Periode
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
$this->cn->rollback();
}
}

View file

@ -103,6 +103,7 @@ class Pre_op_ach extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -99,6 +99,7 @@ class Pre_Op_Advanced extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -86,6 +86,7 @@ class Pre_op_fin extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -78,6 +78,7 @@ class Pre_op_ods extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -102,6 +102,7 @@ class Pre_op_ven extends Pre_operation_detail
}
catch (Exception $e)
{
record_log($e->getTraceAsString());
echo ($e->getMessage());
$this->db->rollback();
}

View file

@ -165,7 +165,7 @@ class Stock_Goods extends Stock_Goods_Sql
}
catch (Exception $exc)
{
error_log( $exc->getTraceAsString());
record_log( $exc->getTraceAsString());
echo $exc->getMessage();
throw $exc;
}

View file

@ -200,7 +200,7 @@ class Database
echo $a->getTraceAsString();
echo pg_last_error($this->db);
}
error_log($a->getTraceAsString());
record_log($a->getTraceAsString());
$this->rollback();
throw ($a);

View file

@ -46,7 +46,7 @@ class Noalyss_Csv
private function correct_name()
{
if (trim(strlen($this->filename))==0) {
error_log('CSV->correct_name filename is empty');
record_log('CSV->correct_name filename is empty');
throw new Exception('CSV-CORRECT_NAME');
}
$this->filename.="-".date("ymd-Hi");

View file

@ -183,7 +183,7 @@ if ( isset($_POST['ok']))
catch (Exception $e)
{
echo_warning ($e->getMessage());
error_log($e->getTraceAsString());
record_log($e->getTraceAsString());
$cn->rollback();
}

View file

@ -58,7 +58,7 @@ if (isset($_POST['change_profile']))
catch (Exception $exc)
{
echo $exc->getMessage();
error_log( $exc->getTraceAsString());
record_log( $exc->getTraceAsString());
throw $exc;
}
}
@ -97,7 +97,7 @@ if (isset($_POST['change_stock']))
catch (Exception $exc)
{
echo $exc->getMessage();
error_log($exc->getTraceAsString());
record_log($exc->getTraceAsString());
throw $exc;
}
}