diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 22f86df95a8..95d57a2f3fc 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -87,15 +87,18 @@ $fieldstosearchall = array( // Definition of fields for list $arrayfields = array( - 'stockqty'=>array('type'=>'float', 'label'=>'PhysicalStock', 'enabled'=>1, 'visible'=>-2, 'position'=>70), - 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71), - 'sellvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72), + 'e.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'e.lieu'=>array('label'=>$langs->trans("LocationSummary"), 'checked'=>1), + 'e.description'=>array('label'=>$langs->trans("Description"), 'checked'=>0), + 'e.address'=>array('label'=>$langs->trans("Address"), 'checked'=>0), + 'e.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>0), + 'e.town'=>array('label'=>$langs->trans("Town"), 'checked'=>0), + 'stockqty'=>array('type'=>'float', 'label'=>$langs->trans("PhysicalStock"), 'enabled'=>1, 'visible'=>-2, 'position'=>70), + 'estimatedvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValue"), 'enabled'=>1, 'visible'=>-2, 'position'=>71), + 'sellvalue'=>array('type'=>'float', 'label'=>$langs->trans("EstimatedStockValueSell"), 'enabled'=>1, 'visible'=>-2, 'position'=>72), + 'e.statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>100), ); -foreach ($object->fields as $key => $val) -{ - // If $val['visible']==0, then we never show the field - if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); -} + // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { @@ -337,17 +340,46 @@ print '
| '; -print ''; -print ' | '; - -print ''; -print ''; -print ' | '; - -print ''; -print ' | '; -print ' | '; +if (!empty($arrayfields['e.ref']['checked'])) +{ + print ' | '; + print ''; + print ' | '; +} +if (!empty($arrayfields['e.lieu']['checked'])) +{ + print ''; + print ''; + print ' | '; +} +if (!empty($arrayfields['e.description']['checked'])) +{ + print ''; +} +if (!empty($arrayfields['e.address']['checked'])) +{ + print ' | '; +} +if (!empty($arrayfields['e.zip']['checked'])) +{ + print ' | '; +} +if (!empty($arrayfields['e.town']['checked'])) +{ + print ' | '; +} +if (!empty($arrayfields['stockqty']['checked'])) +{ + print ' | '; +} +if (!empty($arrayfields['estimatedvalue']['checked'])) +{ + print ' | '; +} +if (!empty($arrayfields['sellvalue']['checked'])) +{ + print ' | '; +} // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; @@ -357,9 +389,12 @@ $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $obje print $hookmanager->resPrint; // Status -print ' | '; -print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); -print ' | '; +if (!empty($arrayfields['e.statut']['checked'])) +{ + print ''; + print $form->selectarray('search_status', $warehouse->statuts, $search_status, 1, 0, 0, '', 1); + print ' | '; +} // Action column print ''; @@ -371,18 +406,56 @@ print ''."\n"; // Fields title label // -------------------------------------------------------------------- print ' |
| '.$warehouse->getNomUrl(1).' | '; - if (!$i) $totalarray['nbfield']++; + + //print_r($arrayfields[]); + + // Label (ref) + if (!empty($arrayfields['e.ref']['checked'])) + { + print ''.$warehouse->getNomUrl(1).' | '; + } + // Location - print ''.$obj->lieu.' | '; - if (!$i) $totalarray['nbfield']++; + if (!empty($arrayfields['e.lieu']['checked'])) + { + print ''.$obj->lieu.' | '; + } + + // Description + if (!empty($arrayfields['e.description']['checked'])) + { + print ''.$obj->description.' | '; + } + + // Address + if (!empty($arrayfields['e.address']['checked'])) + { + print ''.$obj->address.' | '; + } + + // Zip + if (!empty($arrayfields['e.zip']['checked'])) + { + print ''.$obj->zip.' | '; + } + + if (!empty($arrayfields['e.town']['checked'])) + { + print ''.$obj->town.' | '; + } // Stock qty - print ''.price2num($obj->stockqty, 5).' | '; - if (!$i) $totalarray['nbfield']++; + if (!empty($arrayfields['stockqty']['checked'])) + { + print ''.price2num($obj->stockqty, 5).' | '; + } // PMP value - print ''; - if (price2num($obj->estimatedvalue, 'MT')) print price(price2num($obj->estimatedvalue, 'MT'), 1); - else print ''; - print ' | '; - if (!$i) $totalarray['nbfield']++; + if (!empty($arrayfields['estimatedvalue']['checked'])) + { + print ''; + + if (price2num($obj->estimatedvalue, 'MT')) + { + print price(price2num($obj->estimatedvalue, 'MT'), 1); + } + else + { + print ''; + } + + print ' | '; + } // Selling value - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($obj->sellvalue, 'MT'), 1); - else + if (!empty($arrayfields['sellvalue']['checked'])) { - $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + print ' | '; + + if (empty($conf->global->PRODUIT_MULTIPRICES)) + { + print price(price2num($obj->sellvalue, 'MT'), 1); + } + else + { + $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + + print ' | '; } - print ''; - if (!$i) $totalarray['nbfield']++; // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; @@ -446,8 +570,10 @@ if ($num) print $hookmanager->resPrint; // Status - print ''.$warehouse->LibStatut($obj->statut, 5).' | '; - if (!$i) $totalarray['nbfield']++; + if (!empty($arrayfields['e.statut']['checked'])) + { + print ''.$warehouse->LibStatut($obj->statut, 5).' | '; + } // Action column print ''; @@ -469,18 +595,67 @@ if ($num) if ($totalnboflines - $offset <= $limit) { print ' |
| '.$langs->trans("Total").' | '; - print ''.price2num($totalStock, 5).' | '; - print ''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).' | '; - print ''; - if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); - else + + $emptyColumn = -1; + + if (!empty($arrayfields['e.ref']['checked'])) { - $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); - print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + $emptyColumn++; } - print ' | '; - print ''; + if (!empty($arrayfields['e.lieu']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.description']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.address']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.zip']['checked'])) + { + $emptyColumn++; + } + if (!empty($arrayfields['e.town']['checked'])) + { + $emptyColumn++; + } + + for ($i=0; $i < $emptyColumn; $i++) + { + print ' | '; + } + + print ' | '.$langs->trans("Total").' | '; + + if (!empty($arrayfields['stockqty']['checked'])) + { + print ''.price2num($totalStock, 5).' | '; + } + if (!empty($arrayfields['estimatedvalue']['checked'])) + { + print ''.price(price2num($total, 'MT'), 1, $langs, 0, 0, -1, $conf->currency).' | '; + } + + if (!empty($arrayfields['sellvalue']['checked'])) + { + print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) print price(price2num($totalsell, 'MT'), 1, $langs, 0, 0, -1, $conf->currency); + else + { + $htmltext = $langs->trans("OptionMULTIPRICESIsOn"); + print $form->textwithtooltip($langs->trans("Variable"), $htmltext); + } + print ' | '; + } + + if (!empty($arrayfields['e.statut']['checked'])) + { + print ''; + } + print ' | '; print " | |||||