FIX #yogosha5879

This commit is contained in:
Laurent Destailleur 2021-04-24 21:15:09 +02:00
parent ac68599fab
commit 42938ffe31
7 changed files with 26 additions and 22 deletions

View File

@ -371,8 +371,8 @@ class BookKeeping extends CommonObject
$sql .= ", ".(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'"); $sql .= ", ".(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
$sql .= ", '".$this->db->escape($this->doc_type)."'"; $sql .= ", '".$this->db->escape($this->doc_type)."'";
$sql .= ", '".$this->db->escape($this->doc_ref)."'"; $sql .= ", '".$this->db->escape($this->doc_ref)."'";
$sql .= ", ".$this->fk_doc; $sql .= ", ".((int) $this->fk_doc);
$sql .= ", ".$this->fk_docdet; $sql .= ", ".((int) $this->fk_docdet);
$sql .= ", ".(!empty($this->thirdparty_code) ? ("'".$this->db->escape($this->thirdparty_code)."'") : "NULL"); $sql .= ", ".(!empty($this->thirdparty_code) ? ("'".$this->db->escape($this->thirdparty_code)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_account) ? ("'".$this->db->escape($this->subledger_account)."'") : "NULL");
$sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL"); $sql .= ", ".(!empty($this->subledger_label) ? ("'".$this->db->escape($this->subledger_label)."'") : "NULL");
@ -632,8 +632,8 @@ class BookKeeping extends CommonObject
$sql .= ' '.(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'").','; $sql .= ' '.(!isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'").',';
$sql .= ' '.(!isset($this->doc_type) ? 'NULL' : "'".$this->db->escape($this->doc_type)."'").','; $sql .= ' '.(!isset($this->doc_type) ? 'NULL' : "'".$this->db->escape($this->doc_type)."'").',';
$sql .= ' '.(!isset($this->doc_ref) ? 'NULL' : "'".$this->db->escape($this->doc_ref)."'").','; $sql .= ' '.(!isset($this->doc_ref) ? 'NULL' : "'".$this->db->escape($this->doc_ref)."'").',';
$sql .= ' '.(empty($this->fk_doc) ? '0' : $this->fk_doc).','; $sql .= ' '.(empty($this->fk_doc) ? '0' : (int) $this->fk_doc).',';
$sql .= ' '.(empty($this->fk_docdet) ? '0' : $this->fk_docdet).','; $sql .= ' '.(empty($this->fk_docdet) ? '0' : (int) $this->fk_docdet).',';
$sql .= ' '.(!isset($this->thirdparty_code) ? 'NULL' : "'".$this->db->escape($this->thirdparty_code)."'").','; $sql .= ' '.(!isset($this->thirdparty_code) ? 'NULL' : "'".$this->db->escape($this->thirdparty_code)."'").',';
$sql .= ' '.(!isset($this->subledger_account) ? 'NULL' : "'".$this->db->escape($this->subledger_account)."'").','; $sql .= ' '.(!isset($this->subledger_account) ? 'NULL' : "'".$this->db->escape($this->subledger_account)."'").',';
$sql .= ' '.(!isset($this->subledger_label) ? 'NULL' : "'".$this->db->escape($this->subledger_label)."'").','; $sql .= ' '.(!isset($this->subledger_label) ? 'NULL' : "'".$this->db->escape($this->subledger_label)."'").',';

View File

@ -165,7 +165,7 @@ class Subscription extends CommonObject
} else { } else {
$type = $this->fk_type; $type = $this->fk_type;
} }
$sql .= " VALUES (".$this->fk_adherent.", '".$this->db->escape($type)."', '".$this->db->idate($now)."',"; $sql .= " VALUES (".((int) $this->fk_adherent).", '".$this->db->escape($type)."', '".$this->db->idate($now)."',";
$sql .= " '".$this->db->idate($this->dateh)."',"; $sql .= " '".$this->db->idate($this->dateh)."',";
$sql .= " '".$this->db->idate($this->datef)."',"; $sql .= " '".$this->db->idate($this->datef)."',";
$sql .= " ".$this->amount.","; $sql .= " ".$this->amount.",";

View File

@ -114,8 +114,8 @@ if ($action == 'add') {
if (empty($arrayofexistingboxid[$boxid['value']])) { if (empty($arrayofexistingboxid[$boxid['value']])) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (";
$sql .= "box_id, position, box_order, fk_user, entity"; $sql .= "box_id, position, box_order, fk_user, entity";
$sql .= ") values ("; $sql .= ") VALUES (";
$sql .= $boxid['value'].", ".$pos.", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity; $sql .= $boxid['value'].", ".((int) $pos).", '".(($nbboxonleft > $nbboxonright) ? 'B01' : 'A01')."', ".$fk_user.", ".$conf->entity;
$sql .= ")"; $sql .= ")";
dol_syslog("boxes.php activate box", LOG_DEBUG); dol_syslog("boxes.php activate box", LOG_DEBUG);

View File

@ -508,6 +508,10 @@ class Account extends CommonObject
dol_syslog(__METHOD__.": using numeric operations is deprecated", LOG_WARNING); dol_syslog(__METHOD__.": using numeric operations is deprecated", LOG_WARNING);
} }
if (empty($this->id) && !empty($this->rowid)) { // For backward compatibility
$this->id = $this->rowid;
}
// Clean parameters // Clean parameters
$emetteur = trim($emetteur); $emetteur = trim($emetteur);
$banque = trim($banque); $banque = trim($banque);
@ -534,8 +538,8 @@ class Account extends CommonObject
$this->error = "oper not defined"; $this->error = "oper not defined";
return -1; return -1;
} }
if (!$this->rowid) { if (!$this->id) {
$this->error = "this->rowid not defined"; $this->error = "this->id not defined";
return -2; return -2;
} }
if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ') { if ($this->courant == Account::TYPE_CASH && $oper != 'LIQ') {
@ -556,7 +560,7 @@ class Account extends CommonObject
$accline->label = $label; $accline->label = $label;
$accline->amount = $amount; $accline->amount = $amount;
$accline->fk_user_author = $user->id; $accline->fk_user_author = $user->id;
$accline->fk_account = $this->rowid; $accline->fk_account = $this->id;
$accline->fk_type = $oper; $accline->fk_type = $oper;
$accline->numero_compte = $accountancycode; $accline->numero_compte = $accountancycode;
$accline->num_releve = $num_releve; $accline->num_releve = $num_releve;
@ -575,10 +579,10 @@ class Account extends CommonObject
if ($accline->insert() > 0) { if ($accline->insert() > 0) {
if ($categorie > 0) { if ($categorie > 0) {
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class(";
$sql .= "lineid, fk_categ"; $sql .= "lineid, fk_categ";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= $accline->id.", ".$categorie; $sql .= ((int) $accline->id).", '".$this->db->escape($categorie)."'";
$sql .= ")"; $sql .= ")";
$result = $this->db->query($sql); $result = $this->db->query($sql);
@ -611,7 +615,7 @@ class Account extends CommonObject
*/ */
public function create(User $user, $notrigger = 0) public function create(User $user, $notrigger = 0)
{ {
global $langs, $conf, $hookmanager; global $langs, $conf;
$error = 0; $error = 0;
@ -770,7 +774,7 @@ class Account extends CommonObject
*/ */
public function update(User $user, $notrigger = 0) public function update(User $user, $notrigger = 0)
{ {
global $langs, $conf, $hookmanager; global $langs, $conf;
$error = 0; $error = 0;
@ -796,9 +800,9 @@ class Account extends CommonObject
$sql .= " ref = '".$this->db->escape($this->ref)."'"; $sql .= " ref = '".$this->db->escape($this->ref)."'";
$sql .= ",label = '".$this->db->escape($this->label)."'"; $sql .= ",label = '".$this->db->escape($this->label)."'";
$sql .= ",courant = ".$this->courant; $sql .= ",courant = ".((int) $this->courant);
$sql .= ",clos = ".$this->clos; $sql .= ",clos = ".((int) $this->clos);
$sql .= ",rappro = ".$this->rappro; $sql .= ",rappro = ".((int) $this->rappro);
$sql .= ",url = ".($this->url ? "'".$this->db->escape($this->url)."'" : "null"); $sql .= ",url = ".($this->url ? "'".$this->db->escape($this->url)."'" : "null");
$sql .= ",account_number = '".$this->db->escape($this->account_number)."'"; $sql .= ",account_number = '".$this->db->escape($this->account_number)."'";
$sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null"); $sql .= ",fk_accountancy_journal = ".($this->fk_accountancy_journal > 0 ? $this->db->escape($this->fk_accountancy_journal) : "null");
@ -824,7 +828,7 @@ class Account extends CommonObject
$sql .= ",ics = '".$this->db->escape($this->ics)."'"; $sql .= ",ics = '".$this->db->escape($this->ics)."'";
$sql .= ",ics_transfer = '".$this->db->escape($this->ics_transfer)."'"; $sql .= ",ics_transfer = '".$this->db->escape($this->ics_transfer)."'";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".((int) $this->id);
dol_syslog(get_class($this)."::update", LOG_DEBUG); dol_syslog(get_class($this)."::update", LOG_DEBUG);
$result = $this->db->query($sql); $result = $this->db->query($sql);

View File

@ -171,7 +171,7 @@ class RemiseCheque extends CommonObject
$sql .= "'".$this->db->idate($now)."'"; $sql .= "'".$this->db->idate($now)."'";
$sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($now)."'";
$sql .= ", ".$user->id; $sql .= ", ".$user->id;
$sql .= ", ".$account_id; $sql .= ", ".((int) $account_id);
$sql .= ", 0"; $sql .= ", 0";
$sql .= ", 0"; $sql .= ", 0";
$sql .= ", 0"; $sql .= ", 0";

View File

@ -229,9 +229,9 @@ class BonPrelevement extends CommonObject
$sql .= ", cle_rib"; $sql .= ", cle_rib";
$sql .= ") VALUES ("; $sql .= ") VALUES (";
$sql .= $this->id; $sql .= $this->id;
$sql .= ", ".$client_id; $sql .= ", ".((int) $client_id);
$sql .= ", '".$this->db->escape($client_nom)."'"; $sql .= ", '".$this->db->escape($client_nom)."'";
$sql .= ", '".price2num($amount)."'"; $sql .= ", ".((float) price2num($amount));
$sql .= ", '".$this->db->escape($code_banque)."'"; $sql .= ", '".$this->db->escape($code_banque)."'";
$sql .= ", '".$this->db->escape($code_guichet)."'"; $sql .= ", '".$this->db->escape($code_guichet)."'";
$sql .= ", '".$this->db->escape($number)."'"; $sql .= ", '".$this->db->escape($number)."'";

View File

@ -585,7 +585,7 @@ class Tva extends CommonObject
$sql .= " '".$this->db->idate($this->datec)."'"; $sql .= " '".$this->db->idate($this->datec)."'";
$sql .= ", '".$this->db->idate($this->datep)."'"; $sql .= ", '".$this->db->idate($this->datep)."'";
$sql .= ", '".$this->db->idate($this->datev)."'"; $sql .= ", '".$this->db->idate($this->datev)."'";
$sql .= ", ".$this->amount; $sql .= ", ".((float) $this->amount);
$sql .= ", '".$this->db->escape($this->type_payment)."'"; $sql .= ", '".$this->db->escape($this->type_payment)."'";
$sql .= ", '".$this->db->escape($this->num_payment)."'"; $sql .= ", '".$this->db->escape($this->num_payment)."'";
if ($this->note) { if ($this->note) {