From 06f8291e0763776329979a3838a3d7185d0691ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Apr 2023 18:09:18 +0200 Subject: [PATCH] Dolibarrize v18 --- .../modulebuilder/template/myobject_list.php | 1 + htdocs/product/reassortlot.php | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index f604a9b9185..e16fe9647ea 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -717,6 +717,7 @@ while ($i < $imaxinloop) { // Show here line of result $j = 0; print ''; + // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index d9506b390a5..da2c45c6766 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -137,6 +137,23 @@ if ($user->socid) { } $result = restrictedArea($user, 'produit|service', 0, 'product&product'); +// Definition of array of fields for columns +$arrayfields = array( + array('type'=>'varchar', 'label'=>'Ref', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'varchar', 'label'=>'Label', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'int', 'label'=>'Warehouse', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'varchar', 'label'=>'Lot', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'varchar', 'label'=>'DLC', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'varchar', 'label'=>'DLUO', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'int', 'label'=>'Stock', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'int', 'label'=>'StatusSell', 'checked'=>1, 'enabled'=>1, 'position'=>1), + array('type'=>'int', 'label'=>'StatusBuy', 'checked'=>1, 'enabled'=>1, 'position'=>1), +); + +//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right'); +$arrayfields = dol_sort_array($arrayfields, 'position'); + + /* * Actions @@ -734,6 +751,9 @@ while ($i < $imaxinloop) { // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } // Ref @@ -741,9 +761,15 @@ while ($i < $imaxinloop) { print $product_static->getNomUrl(1, '', 16); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); print ''; + if (!$i) { + $totalarray['nbfield']++; + } // Label print ''.$objp->label.''; + if (!$i) { + $totalarray['nbfield']++; + } if (isModEnabled("service") && $type == 1) { print ''; @@ -757,6 +783,9 @@ while ($i < $imaxinloop) { } else { print $objp->duration; } + if (!$i) { + $totalarray['nbfield']++; + } print ''; } //print ''.$objp->stock_theorique.''; @@ -768,6 +797,9 @@ while ($i < $imaxinloop) { if ($objp->fk_entrepot > 0) { print $warehousetmp->getNomUrl(1); } + if (!$i) { + $totalarray['nbfield']++; + } print ''; // Lot @@ -775,14 +807,23 @@ while ($i < $imaxinloop) { if ($product_lot_static->batch) { print $product_lot_static->getNomUrl(1); } + if (!$i) { + $totalarray['nbfield']++; + } print ''; if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { print ''.dol_print_date($db->jdate($objp->sellby), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } } if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { print ''.dol_print_date($db->jdate($objp->eatby), 'day').''; + if (!$i) { + $totalarray['nbfield']++; + } } print ''; @@ -801,15 +842,27 @@ while ($i < $imaxinloop) { } } print ''; + if (!$i) { + $totalarray['nbfield']++; + } print ''; print img_picto($langs->trans("StockMovement"), 'movement', 'class="pictofixedwidth"'); print ''.$langs->trans("Movements").''; print ''; + if (!$i) { + $totalarray['nbfield']++; + } print ''.$product_static->LibStatut($objp->statut, 5, 0).''; + if (!$i) { + $totalarray['nbfield']++; + } print ''.$product_static->LibStatut($objp->tobuy, 5, 1).''; + if (!$i) { + $totalarray['nbfield']++; + } // Fields values from hook $parameters = array('obj'=>$objp); @@ -819,12 +872,27 @@ while ($i < $imaxinloop) { // Action column if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } print "\n"; $i++; } +// If no record found +if ($num == 0) { + $colspan = 2; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''.$langs->trans("NoRecordFound").''; +} + + $db->free($resql); print ''."\n";