Correction erreur lorsque pas de compte bancaires dfinit

This commit is contained in:
Rodolphe Quiedeville 2003-08-04 18:06:12 +00:00
parent ebbace6389
commit f736c3bff0

View File

@ -51,43 +51,45 @@ class Account
Function addline($date, $oper, $label, $amount, $num_chq="") Function addline($date, $oper, $label, $amount, $num_chq="")
{ {
switch ($oper) if ($this->rowid)
{ {
case 1: switch ($oper)
$oper = 'TIP'; {
break; case 1:
case 2: $oper = 'TIP';
$oper = 'VIR'; break;
break; case 2:
case 3: $oper = 'VIR';
$oper = 'PRE'; break;
break; case 3:
case 4: $oper = 'PRE';
$oper = 'LIQ'; break;
break; case 4:
case 5: $oper = 'LIQ';
$oper = 'WWW'; break;
break; case 5:
case 6: $oper = 'WWW';
$oper = 'CB'; break;
break; case 6:
case 7: $oper = 'CB';
$oper = 'CHQ'; break;
break; case 7:
} $oper = 'CHQ';
break;
}
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)";
$sql .= " VALUES (now(), $date, '$label', $amount,'$author','$num_chq', $this->rowid, '$oper')";
if ($this->db->query($sql))
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)"; {
$sql .= " VALUES (now(), $date, '$label', $amount,'$author','$num_chq', $this->rowid, '$oper')"; return 1;
}
if ($this->db->query($sql)) else
{ {
return 1; print $this->db->error();
} print "<br>$sql";
else }
{
print $this->db->error();
print "<br>$sql";
} }
} }