Debug v18

This commit is contained in:
Laurent Destailleur 2023-04-01 14:38:07 +02:00
parent fd65d4b420
commit 7525aea76c
8 changed files with 41 additions and 20 deletions

View File

@ -53,7 +53,7 @@ if (GETPOSTISSET('option')) {
// Load object according to $element // Load object according to $element
$object = fetchObjectByElement($id, $objecttype); $object = fetchObjectByElement($id, $objecttype);
if (empty($object->element)) { 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; $module = $object->module;

View File

@ -735,6 +735,7 @@ abstract class CommonObject
$datas = $this->getTooltipContentArray($params); $datas = $this->getTooltipContentArray($params);
// Add extrafields
if (!empty($extrafields->attributes[$this->table_element]['label'])) { if (!empty($extrafields->attributes[$this->table_element]['label'])) {
if (count($extrafields->attributes[$this->table_element]['label']) < $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) { if (count($extrafields->attributes[$this->table_element]['label']) < $MAX_EXTRAFIELDS_TO_SHOW_IN_TOOLTIP) {
foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) {

View File

@ -11350,6 +11350,13 @@ function getElementProperties($element_type)
} elseif ($element_type == 'salary') { } elseif ($element_type == 'salary') {
$classpath = 'salaries/class'; $classpath = 'salaries/class';
$module = 'salaries'; $module = 'salaries';
} elseif ($element_type == 'productlot') {
$module = 'productbatch';
$classpath = 'product/stock/class';
$classfile = 'productlot';
$classname = 'Productlot';
$element = 'productlot';
$subelement = '';
} }
if (empty($classfile)) { if (empty($classfile)) {

View File

@ -399,6 +399,9 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
if ($features == 'product') { if ($features == 'product') {
$features = 'produit'; $features = 'produit';
} }
if ($features == 'productbatch') {
$features = 'produit';
}
if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur' if ($features == 'fournisseur') { // When vendor invoice and pruchase order are into module 'fournisseur'
$features = 'fournisseur'; $features = 'fournisseur';
$feature2 = ''; $feature2 = '';

View File

@ -19,7 +19,8 @@
/** /**
* \file product/class/productbatch.class.php * \file product/class/productbatch.class.php
* \ingroup productbatch * \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"; require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";

View File

@ -696,14 +696,17 @@ class Entrepot extends CommonObject
/** /**
* getTooltipContentArray * getTooltipContentArray
* @param array $params params to construct tooltip data *
* @param array $params Params to construct tooltip data
* @since v18 * @since v18
* @return array * @return array
*/ */
public function getTooltipContentArray($params) public function getTooltipContentArray($params)
{ {
global $conf, $langs, $user; global $conf, $langs, $user;
$langs->load('stocks'); $langs->load('stocks');
$datas = []; $datas = [];
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
return ['optimize' => $langs->trans("Warehouse")]; return ['optimize' => $langs->trans("Warehouse")];

View File

@ -877,7 +877,8 @@ class Productlot extends CommonObject
/** /**
* getTooltipContentArray * getTooltipContentArray
* @param array $params params to construct tooltip data *
* @param array $params Params to construct tooltip data
* @since v18 * @since v18
* @return array * @return array
*/ */
@ -887,18 +888,19 @@ class Productlot extends CommonObject
$langs->loadLangs(['stocks', 'productbatch']); $langs->loadLangs(['stocks', 'productbatch']);
$datas = [];
$option = $params['option'] ?? ''; $option = $params['option'] ?? '';
$datas['picto'] = img_picto('', $this->picto).' <u>'.$langs->trans("Batch").'</u>';
$datas['divopen'] = '<div width="100%">'; $datas = [];
$datas['batch'] = '<b>'.$langs->trans('Batch').':</b> '.$this->batch; $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Batch").'</u>';
//$datas['divopen'] = '<div width="100%">';
$datas['batch'] = '<br><b>'.$langs->trans('Batch').':</b> '.$this->batch;
if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) { if ($this->eatby && empty($conf->global->PRODUCT_DISABLE_EATBY)) {
$datas['eatby'] = '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day'); $datas['eatby'] = '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day');
} }
if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) { if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
$datas['sellby'] = '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day'); $datas['sellby'] = '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day');
} }
$datas['divclose'] = '</div>'; //$datas['divclose'] = '</div>';
return $datas; return $datas;
} }

View File

@ -1655,7 +1655,7 @@ if ($action == 'create') {
<input type="hidden" name="mode" value=""> <input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id.'">'; <input type="hidden" name="id" value="' . $object->id.'">';
} }
print '<br>'; print '<br><br>';
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table id="tablelines" class="noborder centpercent">'; print '<table id="tablelines" class="noborder centpercent">';
@ -1888,8 +1888,8 @@ if ($action == 'create') {
} }
} }
} }
}
print '</td>'; print '</td>';
}
if ($action == 'editline' && $lines[$i]->id == $line_id) { if ($action == 'editline' && $lines[$i]->id == $line_id) {
// edit mode // edit mode
@ -1904,7 +1904,7 @@ if ($action == 'create') {
print '<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>'; print '<td>'.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).'</td>';
// Batch number managment // Batch number managment
if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) { if ($conf->productbatch->enabled && !empty($lines[$i]->product->status_batch)) {
print '<td class="nowraponall"><input name="batch'.$line_id.'" id="batch'.$line_id.'" type="text" value="'.$lines[$i]->batch.'"><br>'; print '<td class="nowraponall left"><input name="batch'.$line_id.'" id="batch'.$line_id.'" type="text" value="'.$lines[$i]->batch.'"><br>';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print $langs->trans('SellByDate').' : '; print $langs->trans('SellByDate').' : ';
print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, '', '', 1, "").'</br>'; print $form->selectDate($lines[$i]->sellby, 'dlc'.$line_id, '', '', 1, "").'</br>';
@ -1998,9 +1998,10 @@ if ($action == 'create') {
if ($action == 'editline' && $lines[$i]->id == $line_id) { if ($action == 'editline' && $lines[$i]->id == $line_id) {
print '<td class="center" colspan="2" valign="middle">'; print '<td class="center valignmiddle" colspan="2">';
print '<input type="submit" class="button button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'"><br>'; print '<input type="submit" class="button small button-save" id="savelinebutton marginbottomonly" name="save" value="'.$langs->trans("Save").'"><br>';
print '<input type="submit" class="button button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"><br>'; print '<input type="submit" class="button small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"><br>';
print '</td>';
} elseif ($object->statut == Reception::STATUS_DRAFT) { } elseif ($object->statut == Reception::STATUS_DRAFT) {
// edit-delete buttons // edit-delete buttons
print '<td class="linecoledit center">'; print '<td class="linecoledit center">';
@ -2024,7 +2025,10 @@ if ($action == 'create') {
// Display lines extrafields // Display lines extrafields
$extralabelslines = $extrafields->attributes[$lines[$i]->table_element]; $extralabelslines = $extrafields->attributes[$lines[$i]->table_element];
if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) { 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 = new CommandeFournisseurDispatch($db);
$line->id = $lines[$i]->id; $line->id = $lines[$i]->id;
$line->fetch_optionals(); $line->fetch_optionals();