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

@ -361,20 +361,20 @@ class BookKeeping extends CommonObject
$sql .= ", '".$this->db->escape($this->doc_ref)."'"; $sql .= ", '".$this->db->escape($this->doc_ref)."'";
$sql .= ", ".$this->fk_doc; $sql .= ", ".$this->fk_doc;
$sql .= ", ".$this->fk_docdet; $sql .= ", ".$this->fk_docdet;
$sql .= ",'".$this->db->escape($this->thirdparty_code)."'"; $sql .= ", ".(!empty($this->thirdparty_code)?("'".$this->db->escape($this->thirdparty_code)."'"):"NULL");
$sql .= ",'".$this->db->escape($this->subledger_account)."'"; $sql .= ", ".(!empty($this->subledger_account)?("'".$this->db->escape($this->subledger_account)."'"):"NULL");
$sql .= ",'".$this->db->escape($this->subledger_label)."'"; $sql .= ", ".(!empty($this->subledger_label)?("'".$this->db->escape($this->subledger_label)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->numero_compte)."'"; $sql .= ", '".$this->db->escape($this->numero_compte)."'";
$sql .= ",'".$this->db->escape($this->label_compte)."'"; $sql .= ", ".(!empty($this->label_operation)?("'".$this->db->escape($this->label_operation)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->label_operation)."'"; $sql .= ", '".$this->db->escape($this->label_operation)."'";
$sql .= ", ".$this->debit; $sql .= ", ".$this->debit;
$sql .= ", ".$this->credit; $sql .= ", ".$this->credit;
$sql .= ", ".$this->montant; $sql .= ", ".$this->montant;
$sql .= ",'".$this->db->escape($this->sens)."'"; $sql .= ", ".(!empty($this->sens)?("'".$this->db->escape($this->sens)."'"):"NULL");
$sql .= ", '".$this->db->escape($this->fk_user_author)."'"; $sql .= ", '".$this->db->escape($this->fk_user_author)."'";
$sql .= ", '".$this->db->idate($now)."'"; $sql .= ", '".$this->db->idate($now)."'";
$sql .= ", '".$this->db->escape($this->code_journal)."'"; $sql .= ", '".$this->db->escape($this->code_journal)."'";
$sql .= ",'".$this->db->escape($this->journal_label)."'"; $sql .= ", ".(!empty($this->journal_label)?("'".$this->db->escape($this->journal_label)."'"):"NULL");
$sql .= ", ".$this->db->escape($this->piece_num); $sql .= ", ".$this->db->escape($this->piece_num);
$sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity); $sql .= ", ".(!isset($this->entity) ? $conf->entity : $this->entity);
$sql .= ")"; $sql .= ")";