amélioration des requêtes et transformation des virgules en point pour les montants

This commit is contained in:
erics 2004-01-18 20:29:34 +00:00
parent 01133206cc
commit 4e586f5d67
3 changed files with 8 additions and 6 deletions

View File

@ -68,7 +68,7 @@ class Account
Function add_url_line($line_id, $url_id, $url, $label) Function add_url_line($line_id, $url_id, $url, $label)
{ {
$sql = "INSERT INTO llx_bank_url (fk_bank, url_id, url, label)"; $sql = "INSERT INTO llx_bank_url (fk_bank, url_id, url, label)";
$sql .= " VALUES ($line_id, $url_id, '$url', '$label')"; $sql .= " VALUES ('$line_id', '$url_id', '$url', '$label')";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
@ -141,14 +141,15 @@ class Account
} }
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)"; $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')"; $sql .= " VALUES (now(), '$date', '$label', '" . ereg_replace(",",".",$amount) . "','$author','$num_chq', '$this->rowid', '$oper')";
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$rowid = $this->db->last_insert_id(); $rowid = $this->db->last_insert_id();
if ($categorie) if ($categorie)
{ {
$sql = "INSERT INTO llx_bank_class (lineid, fk_categ) VALUES ($rowid, $categorie)"; $sql = "INSERT INTO llx_bank_class (lineid, fk_categ) VALUES ('$rowid', '$categorie')";
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result){ if ($result){
return $rowid; return $rowid;
@ -181,7 +182,7 @@ class Account
if ( $this->update() ) if ( $this->update() )
{ {
$sql = "INSERT INTO llx_bank (datec, label, amount, fk_account,datev,dateo,fk_type,rappro) "; $sql = "INSERT INTO llx_bank (datec, label, amount, fk_account,datev,dateo,fk_type,rappro) ";
$sql .= " VALUES (now(),'Solde',$this->solde,$this->id,'".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);"; $sql .= " VALUES (now(),'Solde','" . ereg_replace(",",".",$this->solde) . "','$this->id','".$this->db->idate($this->date_solde)."','".$this->db->idate($this->date_solde)."','SOLD',1);";
$this->db->query($sql); $this->db->query($sql);
} }

View File

@ -54,12 +54,12 @@ if ($HTTP_POST_VARS["action"] == 'add' && $_GET["account"])
if ($num_chq) if ($num_chq)
{ {
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)"; $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)";
$sql .= " VALUES (now(), $dateop, '$label', $amount,'$author',$num_chq,$account,'$operation')"; $sql .= " VALUES (now(), '$dateop', '$label', '$amount','$author','$num_chq','$account','$operation')";
} }
else else
{ {
$sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account,fk_type)"; $sql = "INSERT INTO llx_bank (datec, dateo, label, amount, author,fk_account,fk_type)";
$sql .= " VALUES (now(), $dateop, '$label', $amount,'$author',$account,'$operation')"; $sql .= " VALUES (now(), '$dateop', '$label', '$amount','$author','$account','$operation')";
} }
$result = $db->query($sql); $result = $db->query($sql);

View File

@ -28,6 +28,7 @@ require("./pre.inc.php");
if (!$user->rights->banque->lire) if (!$user->rights->banque->lire)
accessforbidden(); accessforbidden();
llxHeader(); llxHeader();
if (! strlen($_GET["num"])) if (! strlen($_GET["num"]))