From 2c7d8723202d988cd984d019525f950ea513fed4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 16 Dec 2020 11:07:34 +0100 Subject: [PATCH] Fix warning --- htdocs/compta/facture/class/facture-rec.class.php | 10 +++++----- htdocs/core/lib/functions.lib.php | 2 +- htdocs/fourn/class/fournisseur.facture.class.php | 14 ++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 48e2ad574ed..c9157f7b43d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -215,7 +215,7 @@ class FactureRec extends CommonInvoice $now = dol_now(); // Clean parameters - $this->titre = trim($this->titre); // deprecated + $this->titre = trim(isset($this->titre) ? $this->titre : $this->title); // deprecated $this->title = trim($this->title); $this->usenewprice = empty($this->usenewprice) ? 0 : $this->usenewprice; if (empty($this->suspended)) $this->suspended = 0; @@ -366,7 +366,7 @@ class FactureRec extends CommonInvoice } // Add object linked - if (!$error && $this->id && is_array($this->linked_objects) && !empty($this->linked_objects)) + if (!$error && $this->id && !empty($this->linked_objects) && is_array($this->linked_objects)) { foreach ($this->linked_objects as $origin => $tmp_origin_id) { @@ -702,7 +702,7 @@ class FactureRec extends CommonInvoice $line->total_ht = $objp->total_ht; $line->total_tva = $objp->total_tva; $line->total_ttc = $objp->total_ttc; - $line->code_ventilation = $objp->fk_code_ventilation; + //$line->code_ventilation = $objp->fk_code_ventilation; $line->fk_fournprice = $objp->fk_fournprice; $marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht); $line->pa_ht = $marginInfos[0]; @@ -1996,7 +1996,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->localtax1_type = $objp->localtax1_type; $this->localtax2_type = $objp->localtax2_type; $this->remise_percent = $objp->remise_percent; - $this->fk_remise_except = $objp->fk_remise_except; + //$this->fk_remise_except = $objp->fk_remise_except; $this->fk_product = $objp->fk_product; $this->date_start_fill = $objp->date_start_fill; $this->date_end_fill = $objp->date_end_fill; @@ -2004,7 +2004,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->total_ht = $objp->total_ht; $this->total_tva = $objp->total_tva; $this->total_ttc = $objp->total_ttc; - $this->code_ventilation = $objp->fk_code_ventilation; + //$this->code_ventilation = $objp->fk_code_ventilation; $this->rang = $objp->rang; $this->special_code = $objp->special_code; $this->fk_unit = $objp->fk_unit; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 4fd44ee6ba3..998cddea0f9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5191,7 +5191,7 @@ function getLocalTaxesFromRate($vatrate, $local, $buyer, $seller, $firstparamisi $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; if ($mysoc->country_code == 'ES') $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // local tax in spain use the buyer country ?? - else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'"; + else $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape(empty($seller->country_code) ? $mysoc->country_code : $seller->country_code)."'"; $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; if ($vatratecode) $sql .= " AND t.code = '".$db->escape($vatratecode)."'"; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 43075ba6760..40ffb9024c5 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1856,6 +1856,7 @@ class FactureFournisseur extends CommonInvoice public function updateline($id, $desc, $pu, $vatrate, $txlocaltax1 = 0, $txlocaltax2 = 0, $qty = 1, $idproduct = 0, $price_base_type = 'HT', $info_bits = 0, $type = 0, $remise_percent = 0, $notrigger = false, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $ref_supplier = '') { global $mysoc, $langs; + dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent,$notrigger,$date_start,$date_end,$fk_unit,$pu_ht_devise,$ref_supplier", LOG_DEBUG); include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -2809,6 +2810,7 @@ class SupplierInvoiceLine extends CommonObjectLine /** * This field may contains label of line (when invoice create from order) * @var string + * @deprecated */ public $label; @@ -3010,17 +3012,17 @@ class SupplierInvoiceLine extends CommonObjectLine $this->date_end = $obj->date_end; $this->product_ref = $obj->product_ref; $this->ref_supplier = $obj->ref_supplier; - $this->libelle = $obj->label; - $this->label = $obj->label; $this->product_desc = $obj->product_desc; - $this->subprice = $obj->pu_ht; - $this->pu_ht = $obj->pu_ht; + + $this->subprice = $obj->pu_ht; + $this->pu_ht = $obj->pu_ht; $this->pu_ttc = $obj->pu_ttc; $this->tva_tx = $obj->tva_tx; $this->localtax1_tx = $obj->localtax1_tx; $this->localtax2_tx = $obj->localtax2_tx; - $this->localtax1_type = $obj->localtax1_type; - $this->localtax2_type = $obj->localtax2_type; + $this->localtax1_type = $obj->localtax1_type; + $this->localtax2_type = $obj->localtax2_type; + $this->qty = $obj->qty; $this->remise_percent = $obj->remise_percent; $this->tva = $obj->total_tva; // deprecated