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
$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;

View File

@ -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) {

View File

@ -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)) {

View File

@ -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 = '';

View File

@ -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";

View File

@ -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")];

View File

@ -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).' <u>'.$langs->trans("Batch").'</u>';
$datas['divopen'] = '<div width="100%">';
$datas['batch'] = '<b>'.$langs->trans('Batch').':</b> '.$this->batch;
$datas = [];
$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)) {
$datas['eatby'] = '<br><b>'.$langs->trans('EatByDate').':</b> '.dol_print_date($this->eatby, 'day');
}
if ($this->sellby && empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
$datas['sellby'] = '<br><b>'.$langs->trans('SellByDate').':</b> '.dol_print_date($this->sellby, 'day');
}
$datas['divclose'] = '</div>';
//$datas['divclose'] = '</div>';
return $datas;
}

View File

@ -1655,7 +1655,7 @@ if ($action == 'create') {
<input type="hidden" name="mode" value="">
<input type="hidden" name="id" value="' . $object->id.'">';
}
print '<br>';
print '<br><br>';
print '<div class="div-table-responsive-no-min">';
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) {
// 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>';
// Batch number managment
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)) {
print $langs->trans('SellByDate').' : ';
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) {
print '<td class="center" colspan="2" valign="middle">';
print '<input type="submit" class="button 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 '<td class="center valignmiddle" colspan="2">';
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 small button-cancel" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'"><br>';
print '</td>';
} elseif ($object->statut == Reception::STATUS_DRAFT) {
// edit-delete buttons
print '<td class="linecoledit center">';
@ -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();