diff --git a/htdocs/fourn/class/fournisseur.facture-rec.class.php b/htdocs/fourn/class/fournisseur.facture-rec.class.php index 8f219648c51..4b216d5e323 100644 --- a/htdocs/fourn/class/fournisseur.facture-rec.class.php +++ b/htdocs/fourn/class/fournisseur.facture-rec.class.php @@ -380,7 +380,7 @@ class FactureFournisseurRec extends CommonInvoice $facfourn_src->lines[$i]->fk_product, $facfourn_src->lines[$i]->ref_supplier, $facfourn_src->lines[$i]->label, - $facfourn_src->lines[$i]->description, + $facfourn_src->lines[$i]->desc ? $facfourn_src->lines[$i]->desc : $facfourn_src->lines[$i]->description, $facfourn_src->lines[$i]->pu_ht, $facfourn_src->lines[$i]->pu_ttc, $facfourn_src->lines[$i]->qty, @@ -718,7 +718,7 @@ class FactureFournisseurRec extends CommonInvoice */ $sql = 'SELECT l.rowid,'; - $sql .= ' l.fk_facture_fourn, l.fk_parent_line, l.fk_product, l.ref, l.label, l.description,'; + $sql .= ' l.fk_facture_fourn, l.fk_parent_line, l.fk_product, l.ref, l.label, l.description as desc,'; $sql .= ' l.pu_ht, l.pu_ttc, l.qty, l.remise_percent, l.fk_remise_except, l.vat_src_code, l.tva_tx,'; $sql .= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type,'; $sql .= ' l.total_ht, l.total_tva, l.total_ttc, total_localtax1, total_localtax2,'; @@ -749,7 +749,8 @@ class FactureFournisseurRec extends CommonInvoice $line->fk_product = $objp->fk_product; $line->ref_supplier = $objp->ref; $line->label = $objp->label; - $line->description = $objp->description; + $line->description = $objp->desc; + $line->desc = $objp->desc; $line->pu_ht = $objp->pu_ht; $line->pu_ttc = $objp->pu_ttc; $line->qty = $objp->qty; @@ -2003,6 +2004,9 @@ class FactureFournisseurLigneRec extends CommonObjectLine public $fk_product; public $ref_supplier; public $label; + /** + * @deprecated Use desc + */ public $description; public $pu_ht; public $pu_ttc; @@ -2088,7 +2092,7 @@ class FactureFournisseurLigneRec extends CommonObjectLine { $sql = 'SELECT l.rowid,'; $sql .= ' l.fk_facture_fourn, l.fk_parent_line, l.fk_product,'; - $sql .= ' l.ref as ref_supplier, l.label, l.description, l.pu_ht, l.pu_ttc, l.qty, l.remise_percent, l.fk_remise_except,'; + $sql .= ' l.ref as ref_supplier, l.label, l.description as desc, l.pu_ht, l.pu_ttc, l.qty, l.remise_percent, l.fk_remise_except,'; $sql .= ' l.vat_src_code, l.tva_tx, l.localtax1_tx, l.localtax1_type, l.localtax2_tx, l.localtax2_type,'; $sql .= ' l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc,'; $sql .= ' l.product_type, l.date_start, l.date_end,'; @@ -2112,7 +2116,8 @@ class FactureFournisseurLigneRec extends CommonObjectLine $this->fk_product = $objp->fk_product; $this->ref_supplier = $objp->ref_supplier; $this->label = $objp->label; - $this->description = $objp->description; + $this->description = $objp->desc; + $this->desc = $objp->desc; $this->pu_ht = $objp->pu_ht; $this->pu_ttc = $objp->pu_ttc; $this->qty = $objp->qty; @@ -2176,7 +2181,7 @@ class FactureFournisseurLigneRec extends CommonObjectLine $sql .= ', fk_product = ' . (int) $this->fk_product; $sql .= ', ref = ' . (!empty($this->ref) ? "'" . $this->db->escape($this->ref) . "'" : 'NULL'); $sql .= ", label = " . (!empty($this->label) ? "'" . $this->db->escape($this->label) . "'" : 'NULL'); - $sql .= ", description = '" . $this->db->escape($this->description) . "'"; + $sql .= ", description = '" . $this->db->escape($this->desc ? $this->desc : $this->description) . "'"; $sql .= ', pu_ht = ' . price2num($this->pu_ht); $sql .= ', pu_ttc = ' . price2num($this->pu_ttc); $sql .= ', qty = ' . price2num($this->qty); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 811d5cb6b6c..9f1e9965aca 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -633,7 +633,7 @@ class FactureFournisseur extends CommonInvoice $res = $this->updateline( $idligne, - $this->lines[$i]->description, + $this->lines[$i]->desc ? $this->lines[$i]->desc : $this->lines[$i]->description, $this->lines[$i]->subprice, $this->lines[$i]->tva_tx.($this->lines[$i]->vat_src_code ? ' ('.$this->lines[$i]->vat_src_code.')' : ''), $this->lines[$i]->localtax1_tx, @@ -678,7 +678,7 @@ class FactureFournisseur extends CommonInvoice $this->updateline( $idligne, - $line->description, + $line->desc ? $line->desc : $line->description, $line->pu_ht, $line->tva_tx, $line->localtax1_tx, @@ -757,7 +757,7 @@ class FactureFournisseur extends CommonInvoice } $result_insert = $this->addline( - $_facrec->lines[$i]->description, + $_facrec->lines[$i]->desc ? $_facrec->lines[$i]->desc : $_facrec->lines[$i]->description, $_facrec->lines[$i]->pu_ht, $tva_tx, $localtax1_tx, @@ -1021,7 +1021,7 @@ class FactureFournisseur extends CommonInvoice // phpcs:enable $this->lines = array(); - $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; + $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description as desc, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; $sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn, f.fk_remise_except'; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.barcode as product_barcode, p.description as product_desc'; @@ -1045,7 +1045,8 @@ class FactureFournisseur extends CommonInvoice $line->id = $obj->rowid; $line->rowid = $obj->rowid; - $line->description = $obj->description; + $line->description = $obj->desc; + $line->desc = $obj->desc; $line->date_start = $obj->date_start; $line->date_end = $obj->date_end; $line->product_ref = $obj->product_ref; @@ -2420,6 +2421,7 @@ class FactureFournisseur extends CommonInvoice $line->context = $this->context; $line->description = $desc; + $line->desc = $desc; $line->qty = ($this->type == self::TYPE_CREDIT_NOTE ? abs($qty) : $qty); // For credit note, quantity is always positive and unit price negative $line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ? -abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise @@ -3207,7 +3209,7 @@ class FactureFournisseur extends CommonInvoice */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf, $user, $langs; + global $langs; $langs->load("suppliers"); $outputlangs->load("products"); @@ -3470,6 +3472,7 @@ class SupplierInvoiceLine extends CommonObjectLine /** * Description of the line * @var string + * @deprecated Use $desc */ public $description; @@ -3634,7 +3637,7 @@ class SupplierInvoiceLine extends CommonObjectLine */ public function fetch($rowid) { - $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; + $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description as desc, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; $sql .= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2, f.fk_remise_except'; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc'; @@ -3660,7 +3663,8 @@ class SupplierInvoiceLine extends CommonObjectLine $this->id = $obj->rowid; $this->rowid = $obj->rowid; $this->fk_facture_fourn = $obj->fk_facture_fourn; - $this->description = $obj->description; + $this->description = $obj->desc; + $this->desc = $obj->desc; $this->date_start = $obj->date_start; $this->date_end = $obj->date_end; $this->product_ref = $obj->product_ref; @@ -3816,7 +3820,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det SET"; - $sql .= " description = '".$this->db->escape($this->description)."'"; + $sql .= " description = '".$this->db->escape(empty($this->description) ? $this->desc : $this->description)."'"; $sql .= ", ref = '".$this->db->escape($this->ref_supplier ? $this->ref_supplier : $this->ref)."'"; $sql .= ", date_start = ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : "null"); $sql .= ", date_end = ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : "null");