diff --git a/ChangeLog b/ChangeLog index 0b0e8695a7b..a5096950ea5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,13 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 17.0.0 compared to 16.0.0 ***** + +For developers or integrators: +------------------------------ + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* The signature of method getNomUrl() of class ProductFournisseur has been modified to match the signature of method Product ***** ChangeLog for 16.0.0 compared to 15.0.0 ***** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index b33c2f79931..c16594b94e5 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7625,7 +7625,20 @@ abstract class CommonObject $result = $object->fetch($value); } if ($result > 0) { - $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2); + if ($object->element === 'product') { + $getnomurlparam3 = (!isset($InfoFieldList[5]) ? 0 : $InfoFieldList[5]); + $getnomurlparam4 = (!isset($InfoFieldList[6]) ? -1 : $InfoFieldList[6]); + $getnomurlparam5 = (!isset($InfoFieldList[7]) ? 0 : $InfoFieldList[7]); + $getnomurlparam6 = (!isset($InfoFieldList[8]) ? '' : $InfoFieldList[8]); + $getnomurlparam7 = (!isset($InfoFieldList[9]) ? 0 : $InfoFieldList[9]); + + /** + * @var Product $object + */ + $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2, $getnomurlparam3, $getnomurlparam4, $getnomurlparam5, $getnomurlparam6, $getnomurlparam7); + } else { + $value = $object->getNomUrl($getnomurlparam, $getnomurlparam2); + } } else { $value = ''; } diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 690558fc9ad..d4130d1b220 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1121,12 +1121,15 @@ class ProductFournisseur extends Product * * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link + * @param int $maxlength Maxlength of ref * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip No tooltip + * @param string $morecss ''=Add more css on link + * @param int $add_label 0=Default, 1=Add label into string, >1=Add first chars into string + * @param string $sep ' - '=Separator between ref and label if option 'add_label' is set * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $save_lastsearch_value = -1, $notooltip = 0, $morecss = '', $add_label = 0, $sep = ' - ') { global $db, $conf, $langs, $hookmanager; @@ -1137,6 +1140,11 @@ class ProductFournisseur extends Product $result = ''; $label = ''; + $newref = $this->ref; + if ($maxlength) { + $newref = dol_trunc($newref, $maxlength, 'middle'); + } + if (!empty($this->entity)) { $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80); if ($this->nbphoto > 0) { @@ -1258,10 +1266,12 @@ class ProductFournisseur extends Product $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= $this->ref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : ''); + $result .= $newref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : ''); } $result .= $linkend; - //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + if ($withpicto != 2) { + $result .= (($add_label && $this->label) ? $sep.dol_trunc($this->label, ($add_label > 1 ? $add_label : 0)) : ''); + } global $action; $hookmanager->initHooks(array($this->element . 'dao')); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 01d401e384d..b257c49a723 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4882,14 +4882,17 @@ class Product extends CommonObject /** * Return clicable link of object (with eventually picto) * - * @param int $withpicto Add picto into link - * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '') - * @param int $maxlength Maxlength of ref - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @param int $notooltip No tooltip - * @return string String with URL + * @param int $withpicto Add picto into link + * @param string $option Where point the link ('stock', 'composition', 'category', 'supplier', '') + * @param int $maxlength Maxlength of ref + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @param int $notooltip No tooltip + * @param string $morecss ''=Add more css on link + * @param int $add_label 0=Default, 1=Add label into string, >1=Add first chars into string + * @param string $sep ' - '=Separator between ref and label if option 'add_label' is set + * @return string String with URL */ - public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $save_lastsearch_value = -1, $notooltip = 0) + public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $save_lastsearch_value = -1, $notooltip = 0, $morecss = '', $add_label = 0, $sep = ' - ') { global $conf, $langs, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; @@ -4997,9 +5000,9 @@ class Product extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; - $linkclose .= ' class="nowraponall classfortooltip"'; + $linkclose .= ' class="nowraponall classfortooltip'.($morecss ? ' '.$morecss : '').'"'; } else { - $linkclose = ' class="nowraponall"'; + $linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"'; } if ($option == 'supplier' || $option == 'category') { @@ -5038,6 +5041,9 @@ class Product extends CommonObject } $result .= $newref; $result .= $linkend; + if ($withpicto != 2) { + $result .= (($add_label && $this->label) ? $sep.dol_trunc($this->label, ($add_label > 1 ? $add_label : 0)) : ''); + } global $action; $hookmanager->initHooks(array('productdao')); diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index e0e2f9c59da..7229b14ea28 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -101,7 +101,7 @@ class Inventory extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), 'title' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>25, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax200'), 'fk_warehouse' => array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Warehouse', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'index'=>1, 'help'=>'InventoryForASpecificWarehouse', 'picto'=>'stock', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), - 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), + 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php::::0:-1:0::1', 'label'=>'Product', 'visible'=>1, 'enabled'=>1, 'position'=>32, 'index'=>1, 'help'=>'InventoryForASpecificProduct', 'picto'=>'product', 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'csslist'=>'tdoverflowmax200'), 'date_inventory' => array('type'=>'date', 'label'=>'DateValue', 'visible'=>1, 'enabled'=>'$conf->global->STOCK_INVENTORY_ADD_A_VALUE_DATE', 'position'=>35), // This date is not used so disabled by default. 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),