From fe6b634a29f2f47dc34dca3cf464f9e643c06de5 Mon Sep 17 00:00:00 2001 From: Zephyriony <142790847+zephyriony@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:18:04 +0100 Subject: [PATCH] Update facture.class.php --- htdocs/compta/facture/class/facture.class.php | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 469f846470ed1..34a53a224dc62 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -532,7 +532,7 @@ public function create(User $user, $notrigger = 0, $forceduedate = 0) return -3; } $soc = new Societe($this->db); - $result = $soc->fetch($this->socid); + $result = $soc->fetch($this->fk_soc); if ($result < 0) { $this->error = "Failed to fetch company: ".$soc->error; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); @@ -574,7 +574,7 @@ public function create(User $user, $notrigger = 0, $forceduedate = 0) } if (!empty($_facrec->frequency)) { // Invoice are created on same thirdparty than template when there is a recurrence, but not necessarily when there is no recurrence. - $this->socid = $_facrec->socid; + $this->fk_soc = $_facrec->socid; } $this->entity = $_facrec->entity; // Invoice created in same entity than template @@ -688,7 +688,7 @@ public function create(User $user, $notrigger = 0, $forceduedate = 0) } // Insert into database - $socid = $this->socid; + $socid = $this->fk_soc; $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture ("; $sql .= " ref"; @@ -1188,7 +1188,7 @@ public function createFromCurrent(User $user, $invertdetail = 0) $facture->fk_facture_source = $this->fk_facture_source; $facture->type = $this->type; $facture->subtype = $this->subtype; - $facture->socid = $this->socid; + $facture->fk_soc = $this->fk_soc; $facture->date = $this->date; $facture->date_pointoftax = $this->date_pointoftax; $facture->note_public = $this->note_public; @@ -1233,7 +1233,7 @@ public function createFromCurrent(User $user, $invertdetail = 0) } } - dol_syslog(get_class($this)."::createFromCurrent invertdetail=".$invertdetail." socid=".$this->socid." nboflines=".count($facture->lines)); + dol_syslog(get_class($this)."::createFromCurrent invertdetail=".$invertdetail." socid=".$this->fk_soc." nboflines=".count($facture->lines)); $facid = $facture->create($user); if ($facid <= 0) { @@ -1278,11 +1278,11 @@ public function createFromClone(User $user, $fromid = 0) $objFrom = clone $object; // Change socid if needed - if (!empty($this->socid) && $this->socid != $object->socid) { + if (!empty($this->fk_soc) && $this->fk_soc != $object->fk_soc) { $objsoc = new Societe($this->db); - if ($objsoc->fetch($this->socid) > 0) { - $object->socid = $objsoc->id; + if ($objsoc->fetch($this->fk_soc) > 0) { + $object->fk_soc = $objsoc->id; $object->cond_reglement_id = (!empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0); $object->mode_reglement_id = (!empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0); $object->fk_project = 0; @@ -1362,7 +1362,7 @@ public function createFromClone(User $user, $fromid = 0) $error++; $this->error = $object->error; $this->errors = $object->errors; - } elseif ($object->socid == $objFrom->socid) { + } elseif ($object->fk_soc == $objFrom->fk_soc) { // copy external contacts if same company if ($object->copy_linked_contact($objFrom, 'external') < 0) { $error++; @@ -1466,7 +1466,7 @@ public function createFromOrder($object, User $user) $this->lines[$i] = $line; } - $this->socid = $object->socid; + $this->fk_soc = $object->fk_soc; $this->fk_project = $object->fk_project; $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; @@ -1601,7 +1601,7 @@ public function createFromContract($object, User $user, $lines = array()) $this->lines[$i] = $line; } - $this->socid = $object->socid; + $this->fk_soc = $object->fk_soc; $this->fk_project = $object->fk_project; $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; @@ -1713,7 +1713,7 @@ public static function createDepositFromOrigin(CommonObject $origin, $date, $pay } $deposit = new self($origin->db); - $deposit->socid = $origin->socid; + $deposit->fk_soc = $origin->fk_soc; $deposit->type = self::TYPE_DEPOSIT; $deposit->fk_project = $origin->fk_project; $deposit->ref_client = $origin->ref_client; @@ -2558,7 +2558,7 @@ public function update(User $user, $notrigger = 0) $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 .= " increment=".(isset($this->increment) ? "'".$this->db->escape($this->increment)."'" : "null").","; - $sql .= " fk_soc=".(isset($this->socid) ? $this->db->escape($this->socid) : "null").","; + $sql .= " fk_soc=".(isset($this->fk_soc) ? $this->db->escape($this->fk_soc) : "null").","; $sql .= " datec=".(strval($this->date_creation) != '' ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; $sql .= " datef=".(strval($this->date) != '' ? "'".$this->db->idate($this->date)."'" : 'null').","; $sql .= " date_pointoftax=".(strval($this->date_pointoftax) != '' ? "'".$this->db->idate($this->date_pointoftax)."'" : 'null').",";