Fix: Support strict mode

This commit is contained in:
Laurent Destailleur 2008-05-19 19:18:18 +00:00
parent cc407f6216
commit 67fe67e0b1
3 changed files with 18 additions and 17 deletions

View File

@ -36,7 +36,7 @@ $langs->load('companies');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'banque', '','');
$result = restrictedArea($user, 'cheque', '','');
$mesg='';
@ -54,18 +54,18 @@ $offset = $limit * $page ;
* Actions
*/
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque)
if ($_GET['action'] == 'create' && $_GET["accountid"] > 0 && $user->rights->banque->cheque)
{
$remisecheque = new RemiseCheque($db);
$result = $remisecheque->Create($user, $_GET["accountid"]);
if ($result >= 0)
$remisecheque = new RemiseCheque($db);
$result = $remisecheque->Create($user, $_GET["accountid"]);
if ($result > 0)
{
Header("Location: fiche.php?id=".$remisecheque->id);
exit;
Header("Location: fiche.php?id=".$remisecheque->id);
exit;
}
else
else
{
$mesg='<div class="error">'.$remisecheque->error.'</div>';
$mesg='<div class="error">'.$remisecheque->error.'</div>';
}
}
@ -268,7 +268,7 @@ if ($_GET['action'] == 'new')
print "</table>";
print '<div class="tabsAction">';
if ($user->rights->banque->modifier)
if ($user->rights->banque->cheque)
{
print '<a class="butAction" href="fiche.php?action=create&amp;accountid='.$bid.'">'.$langs->trans('NewCheckDepositOn',$account_label).'</a>';
}

View File

@ -112,10 +112,10 @@ class RemiseCheque extends CommonObject
}
/**
\brief Crée bordereau en base
\brief Create a receipt to send cheques
\param user Utilisateur qui effectue l'operation
\param account_id Compte bancaire concerne
\return int <0 if KO, >0 if OK
\return int <0 if KO, >0 if OK
*/
function Create($user, $account_id)
{
@ -124,8 +124,8 @@ class RemiseCheque extends CommonObject
$this->db->begin();
$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.")";
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bordereau_cheque (datec, date_bordereau, fk_user_author, fk_bank_account, amount, number, nbcheque)";
$sql.= " VALUES (now(),now(),".$user->id.",".$account_id.",0,0,0)";
dolibarr_syslog("RemiseCheque::Create sql=".$sql, LOG_DEBUG);
$resql = $this->db->query($sql);
@ -209,6 +209,7 @@ class RemiseCheque extends CommonObject
else
{
$result = -1;
$this->error=$this->db->lasterror();
dolibarr_syslog("RemiseCheque::Create Erreur $result INSERT Mysql");
}
@ -459,8 +460,8 @@ class RemiseCheque extends CommonObject
$this->db->free($resql);
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
$sql.= " SET amount='".ereg_replace(",",".",$total)."'";
$sql.= " ,nbcheque=$nb";
$sql.= " SET amount='".price2num($total)."'";
$sql.= " ,nbcheque=".$nb;
$sql.= " WHERE rowid='".$this->id."';";
$resql = $this->db->query($sql);
if (!$resql)

View File

@ -273,7 +273,7 @@ if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
}
}
if ($user->societe_id == 0 && $allow_delete && $paiement->statut == 0 && $_GET['action'] == '')
if ($user->societe_id == 0 && $allow_delete && $_GET['action'] == '')
{
if ($user->rights->facture->paiement)
{