diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 3d1e640f34b..433db55a515 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -124,7 +124,7 @@ class box_services_contracts extends ModeleBoxes $contractlinestatic->label = $objp->label; $contractlinestatic->description = $objp->description; $contractlinestatic->type = $objp->type; - $contractlinestatic->product_id = $objp->product_id; + $contractlinestatic->fk_product = $objp->product_id; $contractlinestatic->product_ref = $objp->product_ref; $contractlinestatic->product_type = $objp->product_type; $contractlinestatic->statut = $objp->contractline_status; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index feb27715da2..cb984736b66 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1942,7 +1942,7 @@ class ExtraFields * Return HTML string to print separator extrafield * * @param string $key Key of attribute - * @param string $object Object + * @param object $object Object * @param int $colspan Value of colspan to use (it must includes the first column with title) * @param string $display_type "card" for form display, "line" for document line display (extrafields on propal line, order line, etc...) * @param string $mode Show output ('view') or input ('create' or 'edit') for extrafield diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 13c99dea052..4a11fb1b0d5 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -3679,7 +3679,11 @@ class Form $sql .= " AND p.tobuy = 1"; $sql .= " AND s.fournisseur = 1"; $sql .= " AND p.rowid = ".((int) $productid); - $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; + if (empty($conf->global->PRODUCT_BEST_SUPPLIER_PRICE_PRESELECTED)) { + $sql .= " ORDER BY s.nom, pfp.ref_fourn DESC"; + } else { + $sql .= " ORDER BY pfp.unitprice ASC"; + } dol_syslog(get_class($this)."::select_product_fourn_price", LOG_DEBUG); $result = $this->db->query($sql); @@ -3701,7 +3705,7 @@ class Form $opt = '