Skip to content
Snippets Groups Projects
Commit 435737da authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Ajout de logs

parent 9b32220d
Branches
Tags
No related merge requests found
......@@ -326,7 +326,7 @@ else
$param="&id=".$remisecheque->id;
print '<tr class="liste_titre">';
'<td>'.$langs->trans("Num").'</td>';
print '<td>&nbsp;</td>';
print '<td>'.$langs->trans("Position").'</td>';
print_liste_field_titre($langs->trans("Num"),$_SERVER["PHP_SELF"],"b.num_chq", "",$param,'align="center"',$sortfield);
print_liste_field_titre($langs->trans("CheckTransmitter"),$_SERVER["PHP_SELF"],"b.emetteur", "",$param,"",$sortfield);
print_liste_field_titre($langs->trans("Bank"),$_SERVER["PHP_SELF"],"b.banque", "",$param,"",$sortfield);
......
......@@ -56,8 +56,8 @@ class RemiseCheque
}
/**
\brief Lecture
\param id identifiant de ligne
\brief Load record
\param id Identifiant de ligne
*/
function Fetch($id)
{
......@@ -68,8 +68,8 @@ class RemiseCheque
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON bc.fk_bank_account = ba.rowid";
$sql.= " WHERE bc.rowid = $id;";
dolibarr_syslog("RemiseCheque::fetch sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
if ($obj = $this->db->fetch_object($resql) )
......@@ -101,8 +101,6 @@ class RemiseCheque
{
return -1;
}
}
/**
......@@ -121,41 +119,43 @@ class RemiseCheque
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (datec, date_bordereau,fk_user_author,fk_bank_account)";
$sql .= " VALUES (now(),now(),".$user->id.",".$account_id.")";
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ( $resql )
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bordereau_cheque");
if ($this->id == 0)
{
$this->errno = -1024;
dolibarr_syslog("Remisecheque::Create Erreur Lecture ID ($this->errno)");
dolibarr_syslog("Remisecheque::Create Erreur Lecture ID ($this->errno)", LOG_ERR);
}
if ($this->id > 0 && $this->errno === 0)
if ($this->id > 0 && $this->errno == 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET number='(PROV".$this->id.")'";
$sql.= " WHERE rowid='".$this->id."';";
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql)
{
$this->errno = -1025;
dolibarr_syslog("RemiseCheque::Create ERREUR UPDATE ($this->errno)");
dolibarr_syslog("RemiseCheque::Create ERREUR UPDATE ($this->errno)", LOG_ERR);
}
}
if ($this->id > 0 && $this->errno === 0)
if ($this->id > 0 && $this->errno == 0)
{
$lines = array();
$sql = "SELECT b.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."bank as b";
$sql.= " WHERE b.fk_type = 'CHQ' AND b.amount > 0";
$sql.= " AND b.fk_bordereau = 0 AND b.fk_account='$account_id'";
$sql.= " LIMIT 40;"; // On limite a 40 pour ne gnrer des PDF que d'une page
$sql.= " AND b.fk_bordereau = 0 AND b.fk_account='".$account_id."'";
$sql.= " LIMIT 40"; // On limite a 40 pour ne gnrer des PDF que d'une page
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
while ($row = $this->db->fetch_row($resql) )
......@@ -167,28 +167,29 @@ class RemiseCheque
else
{
$this->errno = -1026;
dolibarr_syslog("RemiseCheque::Create ERREUR SELECT ($this->errno)");
dolibarr_syslog("RemiseCheque::Create Error ($this->errno)", LOG_ERR);
}
}
if ($this->id > 0 && $this->errno === 0)
if ($this->id > 0 && $this->errno == 0)
{
foreach ($lines as $lineid)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."bank as b";
$sql.= " SET fk_bordereau = ".$this->id;
$sql.= " WHERE b.rowid = $lineid;";
$sql.= " WHERE b.rowid = ".$lineid;
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
if (!$resql)
{
$this->errno = -18;
dolibarr_syslog("RemiseCheque::Create ERREUR UPDATE ($this->errno)");
dolibarr_syslog("RemiseCheque::Create Error update bank ($this->errno)", LOG_ERR);
}
}
}
if ($this->id > 0 && $this->errno === 0)
if ($this->id > 0 && $this->errno == 0)
{
if ($this->UpdateAmount() <> 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment