diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 9a4d42ce5bb..33cdfb4831f 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -53,7 +53,7 @@ if (GETPOSTISSET('option')) { // Load object according to $element $object = fetchObjectByElement($id, $objecttype); if (empty($object->element)) { - httponly_accessforbidden('Failed to get object from objecttype='.$objecttype.' id='.$id); + httponly_accessforbidden('Failed to get object with fetchObjectByElement(id='.$id.', objectype='.$objecttype.')'); } $module = $object->module; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c0fc7805bec..44e2b280391 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -735,6 +735,7 @@ abstract class CommonObject $datas = $this->getTooltipContentArray($params); + // Add extrafields if (!empty($extrafields->attributes[$this->table_element]['label'])) { if (count($extrafields->attributes[$this->table_element]['label']) < $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) { foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f6b39d1784a..a16cc34fd10 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11350,6 +11350,13 @@ function getElementProperties($element_type) } elseif ($element_type == 'salary') { $classpath = 'salaries/class'; $module = 'salaries'; + } elseif ($element_type == 'productlot') { + $module = 'productbatch'; + $classpath = 'product/stock/class'; + $classfile = 'productlot'; + $classname = 'Productlot'; + $element = 'productlot'; + $subelement = ''; } if (empty($classfile)) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 4fdd85f3f24..2fe9460e822 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -399,6 +399,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '', if ($features == 'product') { $features = 'produit'; } + if ($features == 'productbatch') { + $features = 'produit'; + } if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur' $features = 'fournisseur'; $feature2 = ''; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 750e5d5bd7c..46c6c219f7f 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -19,7 +19,8 @@ /** * \file product/class/productbatch.class.php * \ingroup productbatch - * \brief Manage record and specific data for batch number management + * \brief Manage record and specific data for batch number management. + * Manage table llx_product_batch (should have been named product_stock_batch) */ require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8ecbce06cde..ff239307f02 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -696,14 +696,17 @@ class Entrepot extends CommonObject /** * getTooltipContentArray - * @param array $params params to construct tooltip data - * @since v18 - * @return array + * + * @param array $params Params to construct tooltip data + * @since v18 + * @return array */ public function getTooltipContentArray($params) { global $conf, $langs, $user; + $langs->load('stocks'); + $datas = []; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { return ['optimize' => $langs->trans("Warehouse")]; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index da2f412af17..6818c5b8335 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -877,9 +877,10 @@ class Productlot extends CommonObject /** * getTooltipContentArray - * @param array $params params to construct tooltip data - * @since v18 - * @return array + * + * @param array $params Params to construct tooltip data + * @since v18 + * @return array */ public function getTooltipContentArray($params) { @@ -887,18 +888,19 @@ class Productlot extends CommonObject $langs->loadLangs(['stocks', 'productbatch']); - $datas = []; $option = $params['option'] ?? ''; - $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").''; - $datas['divopen'] = '
'; - $datas['batch'] = ''.$langs->trans('Batch').': '.$this->batch; + + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Batch").''; + //$datas['divopen'] = '
'; + $datas['batch'] = '
'.$langs->trans('Batch').': '.$this->batch; if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { $datas['eatby'] = '
'.$langs->trans('EatByDate').': '.dol_print_date($this->eatby, 'day'); } if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { $datas['sellby'] = '
'.$langs->trans('SellByDate').': '.dol_print_date($this->sellby, 'day'); } - $datas['divclose'] = '
'; + //$datas['divclose'] = '
'; return $datas; } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 4c911d64560..3059bac5f4e 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1655,7 +1655,7 @@ if ($action == 'create') { '; } - print '
'; + print '

'; print '
'; print ''; @@ -1888,8 +1888,8 @@ if ($action == 'create') { } } } + print ''; } - print ''; if ($action == 'editline' && $lines[$i]->id == $line_id) { // edit mode @@ -1904,7 +1904,7 @@ if ($action == 'create') { print ''; // Batch number managment if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) { - print ''; } elseif ($object->statut == Reception::STATUS_DRAFT) { // edit-delete buttons print '
'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'
'; + print '

'; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print $langs->trans('SellByDate').' : '; print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, '', '', 1, "").'
'; @@ -1998,9 +1998,10 @@ if ($action == 'create') { if ($action == 'editline' && $lines[$i]->id == $line_id) { - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; + print '
'; @@ -2024,7 +2025,10 @@ if ($action == 'create') { // Display lines extrafields $extralabelslines = $extrafields->attributes[$lines[$i]->table_element]; if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) { - $colspan = empty($conf->productbatch->enabled) ? 8 : 9; + $colspan = 8; + if (isModEnabled('stock')) { $colspan++; } + if (isModEnabled('productbatch')) { $colspan++; } + $line = new CommandeFournisseurDispatch($db); $line->id = $lines[$i]->id; $line->fetch_optionals();