fix: facture.class.php ref_customer deserve same management as deprecated ref_client

This commit is contained in:
Florian HENRY 2024-12-05 09:34:26 +01:00
parent 9543d00d35
commit 94baef5d1d

View file

@ -449,7 +449,8 @@ class Facture extends CommonInvoice
$this->type = self::TYPE_STANDARD;
}
$this->ref_client = trim($this->ref_client);
$this->ref_client = trim($this->ref_client); // deprecated
$this->ref_customer = trim($this->ref_customer);
$this->note_private = (isset($this->note_private) ? trim($this->note_private) : '');
$this->note = (isset($this->note) ? trim($this->note) : $this->note_private); // deprecated
@ -2455,9 +2456,13 @@ class Facture extends CommonInvoice
if (isset($this->ref_ext)) {
$this->ref_ext = trim($this->ref_ext);
}
// deprecated
if (isset($this->ref_client)) {
$this->ref_client = trim($this->ref_client);
}
if (isset($this->ref_customer)) {
$this->ref_customer = trim($this->ref_customer);
}
if (isset($this->increment)) {
$this->increment = trim($this->increment);
}
@ -2496,7 +2501,7 @@ class Facture extends CommonInvoice
$sql .= " ref_ext=".(isset($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").",";
$sql .= " type=".(isset($this->type) ? $this->db->escape($this->type) : "null").",";
$sql .= " subtype=".(isset($this->subtype) ? $this->db->escape($this->subtype) : "null").",";
$sql .= " ref_client=".(isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null").",";
$sql .= " ref_client=".(isset($this->ref_customer) ? "'".$this->db->escape($this->ref_customer)."'" : (isset($this->ref_client) ? "'".$this->db->escape($this->ref_client)."'" : "null")).",";
$sql .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").",";
$sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").",";
$sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
@ -2701,7 +2706,8 @@ class Facture extends CommonInvoice
}
if (!$error) {
$this->ref_client = $ref_client;
$this->ref_client = $ref_client; //deprecated
$this->ref_customer = $ref_client;
}
if (!$notrigger && empty($error)) {
@ -2714,7 +2720,8 @@ class Facture extends CommonInvoice
}
if (!$error) {
$this->ref_client = $ref_client;
$this->ref_client = $ref_client; //deprecated
$this->ref_customer = $ref_client;
$this->db->commit();
return 1;