Merge pull request #12778 from aspangaro/9.0_p4

Fix Accountancy - Set NULL when data is empty
This commit is contained in:
Laurent Destailleur 2019-12-31 16:40:05 +01:00 committed by GitHub
commit 5dbf7869d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -357,25 +357,25 @@ class BookKeeping extends CommonObject
$sql .= ") VALUES (";
$sql .= "'".$this->db->idate($this->doc_date)."'";
$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_ref)."'";
$sql .= ",".$this->fk_doc;
$sql .= ",".$this->fk_docdet;
$sql .= ",'".$this->db->escape($this->thirdparty_code)."'";
$sql .= ",'".$this->db->escape($this->subledger_account)."'";
$sql .= ",'".$this->db->escape($this->subledger_label)."'";
$sql .= ",'".$this->db->escape($this->numero_compte)."'";
$sql .= ",'".$this->db->escape($this->label_compte)."'";
$sql .= ",'".$this->db->escape($this->label_operation)."'";
$sql .= ",".$this->debit;
$sql .= ",".$this->credit;
$sql .= ",".$this->montant;
$sql .= ",'".$this->db->escape($this->sens)."'";
$sql .= ",'".$this->db->escape($this->fk_user_author)."'";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",'".$this->db->escape($this->code_journal)."'";
$sql .= ",'".$this->db->escape($this->journal_label)."'";
$sql .= ",".$this->db->escape($this->piece_num);
$sql .= ", '".$this->db->escape($this->doc_type)."'";
$sql .= ", '".$this->db->escape($this->doc_ref)."'";
$sql .= ", ".$this->fk_doc;
$sql .= ", ".$this->fk_docdet;
$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_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit;
$sql .= ", ".$this->credit;
$sql .= ", ".$this->montant;
$sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->fk_user_author)."'";
$sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->code_journal)."'";
$sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL");
$sql .= ", ".$this->db->escape($this->piece_num);
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")";