Fix code for v14
This commit is contained in:
parent
8d3b156d47
commit
594f7c8e9e
@ -93,27 +93,24 @@ foreach ($object->fields as $key => $val) {
|
||||
}
|
||||
}
|
||||
|
||||
// Definition of fields for list
|
||||
// Definition of array of fields for columns
|
||||
$arrayfields = array();
|
||||
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']);
|
||||
$visible = (int) dol_eval($val['visible'], 1);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=>$val['help']
|
||||
);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
@ -155,7 +152,7 @@ if (empty($reshook)) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
@ -279,11 +276,8 @@ $form = new Form($db);
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_BOM';
|
||||
|
||||
$title = $langs->trans('ListOfBOMs');
|
||||
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
|
||||
// Build and execute select
|
||||
// --------------------------------------------------------------------
|
||||
@ -345,7 +339,9 @@ foreach($object->fields as $key => $val)
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
@ -395,7 +391,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
// llxHeader('', $title, $help_url);
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||
|
||||
@ -508,9 +504,9 @@ foreach ($object->fields as $key => $val) {
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth150', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
|
||||
//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class for BOM
|
||||
*/
|
||||
@ -786,7 +787,7 @@ class BOM extends CommonObject
|
||||
$label .= '<br>';
|
||||
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
|
||||
|
||||
$url = dol_buildpath('/bom/bom_card.php', 1).'?id='.$this->id;
|
||||
$url = DOL_URL_ROOT.'/bom/bom_card.php?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
|
||||
@ -226,7 +226,7 @@ if (empty($reshook)) {
|
||||
$search[$key.'_dtend'] = '';
|
||||
}
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
@ -517,7 +517,7 @@ foreach ($object->fields as $key => $val) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:')=== 0)) {
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
|
||||
|
||||
@ -104,22 +104,18 @@ $arrayfields = array();
|
||||
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']);
|
||||
$arrayfields['t.'.$key] = array(
|
||||
'label'=>$val['label'],
|
||||
'checked'=>(($visible < 0) ? 0 : 1),
|
||||
'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)),
|
||||
'position'=>$val['position'],
|
||||
'help'=>$val['help']
|
||||
);
|
||||
}
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||
$arrayfields["ef.".$key] = array(
|
||||
'label'=>$extrafields->attributes[$object->table_element]['label'][$key],
|
||||
'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1),
|
||||
'position'=>$extrafields->attributes[$object->table_element]['pos'][$key],
|
||||
'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
@ -161,7 +157,7 @@ if (empty($reshook)) {
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$search[$key] = '';
|
||||
}
|
||||
$toselect = '';
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|
||||
@ -690,13 +690,15 @@ class Entrepot extends CommonObject
|
||||
/**
|
||||
* Return clickable name (possibility with the pictogram)
|
||||
*
|
||||
* @param int $withpicto with pictogram
|
||||
* @param string $option Where the link point to
|
||||
* @param int $showfullpath 0=Show ref only. 1=Show full path instead of Ref (this->fk_parent must be defined)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @return string String with URL
|
||||
* @param int $withpicto with pictogram
|
||||
* @param string $option Where the link point to
|
||||
* @param int $showfullpath 0=Show ref only. 1=Show full path instead of Ref (this->fk_parent must be defined)
|
||||
* @param int $notooltip 1=Disable tooltip
|
||||
* @param string $morecss Add more css on link
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
public function getNomUrl($withpicto = 0, $option = '', $showfullpath = 0, $notooltip = 0)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $showfullpath = 0, $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $conf, $langs, $hookmanager;
|
||||
$langs->load("stocks");
|
||||
@ -722,6 +724,17 @@ class Entrepot extends CommonObject
|
||||
|
||||
$url = DOL_URL_ROOT.'/product/stock/card.php?id='.$this->id;
|
||||
|
||||
if ($option != 'nolink') {
|
||||
// Add param to save lastsearch_values or not
|
||||
$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
|
||||
if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
|
||||
$add_save_lastsearch_values = 1;
|
||||
}
|
||||
if ($add_save_lastsearch_values) {
|
||||
$url .= '&save_lastsearch_values=1';
|
||||
}
|
||||
}
|
||||
|
||||
$linkclose = '';
|
||||
if (empty($notooltip)) {
|
||||
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
|
||||
@ -75,9 +75,6 @@ if (!$sortorder) {
|
||||
$sortorder = "ASC";
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'stock');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$object = new Entrepot($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -136,6 +133,9 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
|
||||
$object->fields = dol_sort_array($object->fields, 'position');
|
||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'stock');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -165,6 +165,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
$toselect = array();
|
||||
$search_array_options = array();
|
||||
$search_category_list = array();
|
||||
}
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||
|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
|
||||
@ -189,7 +190,6 @@ if (empty($reshook)) {
|
||||
$form = new Form($db);
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
$totalarray = array();
|
||||
$now = dol_now();
|
||||
|
||||
$help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks';
|
||||
@ -246,7 +246,7 @@ if (!empty($conf->categorie->enabled)) {
|
||||
foreach ($search as $key => $val) {
|
||||
$class_key = $key;
|
||||
if ($class_key == 'status') {
|
||||
$class_key = 'statut'; // remove this after refactor entrepot.class property statut to status
|
||||
$class_key = 'statut'; // remove this after refactoring entrepot.class property statut to status
|
||||
}
|
||||
if (($key == 'status' && $search[$key] == -1) || $key == 'entity') {
|
||||
continue;
|
||||
@ -317,10 +317,12 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
|
||||
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) {
|
||||
$num = $nbtotalofrecords;
|
||||
} else {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
if ($limit) {
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
}
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) {
|
||||
@ -332,7 +334,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) {
|
||||
}
|
||||
|
||||
// Direct jump if only one record found
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) {
|
||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".DOL_URL_ROOT.'/product/stock/card.php?id='.$id);
|
||||
@ -442,7 +444,7 @@ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
||||
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
|
||||
|
||||
print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
|
||||
print '<div class="div-table-responsive">';
|
||||
print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
||||
|
||||
// Fields title search
|
||||
@ -453,22 +455,22 @@ foreach ($object->fields as $key => $val) {
|
||||
if ($key == 'statut') {
|
||||
continue;
|
||||
}
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
|
||||
} elseif (strpos($val['type'], 'integer:') === 0 || strpos($val['type'], 'sellist:') === 0) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
||||
} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
|
||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth125', 1);
|
||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
||||
}
|
||||
@ -518,14 +520,14 @@ foreach ($object->fields as $key => $val) {
|
||||
if ($key == 'statut') {
|
||||
continue;
|
||||
}
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') {
|
||||
} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
@ -564,168 +566,176 @@ print '</tr>'."\n";
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i = 0;
|
||||
if ($num) {
|
||||
$warehouse = new Entrepot($db);
|
||||
$totalarray = array();
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
$warehouse = new Entrepot($db);
|
||||
|
||||
while ($i < min($num, $limit)) {
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) {
|
||||
break; // Should not happen
|
||||
}
|
||||
|
||||
// Store properties in $object
|
||||
$warehouse->setVarsFromFetchObj($obj);
|
||||
|
||||
$warehouse->label = $warehouse->ref;
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
foreach ($warehouse->fields as $key => $val) {
|
||||
if ($key == 'statut') {
|
||||
continue;
|
||||
}
|
||||
$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
}
|
||||
|
||||
$warehouse->id = $obj->rowid;
|
||||
$warehouse->ref = $obj->ref;
|
||||
$warehouse->label = $obj->ref;
|
||||
$warehouse->lieu = $obj->lieu;
|
||||
$warehouse->fk_parent = $obj->fk_parent;
|
||||
$warehouse->statut = $obj->statut;
|
||||
|
||||
foreach ($object->fields as $key => $val) {
|
||||
$warehouse->{$key} = $obj->{$key};
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
}
|
||||
|
||||
// Show here line of result
|
||||
print '<tr class="oddeven">';
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status' && empty($val['arrayofkeyval'])) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) {
|
||||
$cssforfield = 'tdoverflowmax100';
|
||||
}
|
||||
|
||||
foreach ($warehouse->fields as $key => $val) {
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'statut') {
|
||||
continue;
|
||||
print $warehouse->getLibStatut(5);
|
||||
}
|
||||
$cssforfield = (empty($val['css']) ? '' : $val['css']);
|
||||
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
} elseif ($key == 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'center';
|
||||
if ($key == 'phone') {
|
||||
print dol_print_phone($obj->phone, '', 0, $obj->rowid, 'AC_TEL');
|
||||
} elseif ($key == 'fax') {
|
||||
print dol_print_phone($obj->fax, '', 0, $obj->rowid, 'AC_FAX');
|
||||
} else {
|
||||
print $warehouse->showOutputField($val, $key, $warehouse->$key, '');
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
} elseif ($key == 'ref') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') {
|
||||
$cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||
}
|
||||
|
||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
if ($key == 'statut') {
|
||||
print $warehouse->getLibStatut(5);
|
||||
}
|
||||
if ($key == 'phone') {
|
||||
print dol_print_phone($obj->phone, '', 0, $obj->rowid, 'AC_TEL');
|
||||
} elseif ($key == 'fax') {
|
||||
print dol_print_phone($obj->fax, '', 0, $obj->rowid, 'AC_FAX');
|
||||
} else {
|
||||
print $warehouse->showOutputField($val, $key, $warehouse->$key, '');
|
||||
}
|
||||
print '</td>';
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
if (!empty($val['isameasure'])) {
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
|
||||
}
|
||||
if (!isset($totalarray['val'])) {
|
||||
$totalarray['val'] = array();
|
||||
}
|
||||
if (!isset($totalarray['val']['t.'.$key])) {
|
||||
$totalarray['val']['t.'.$key] = 0;
|
||||
}
|
||||
$totalarray['val']['t.'.$key] += $warehouse->$key;
|
||||
if (!isset($totalarray['val'])) {
|
||||
$totalarray['val'] = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Stock qty
|
||||
if (!empty($arrayfields["stockqty"]['checked'])) {
|
||||
print '<td class="right">'.price2num($obj->stockqty, 5).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'stockqty';
|
||||
}
|
||||
}
|
||||
|
||||
// PMP value
|
||||
if (!empty($arrayfields["estimatedvalue"]['checked'])) {
|
||||
print '<td class="right">';
|
||||
if (price2num($obj->estimatedvalue, 'MT')) {
|
||||
print '<span class="amount">'.price(price2num($obj->estimatedvalue, 'MT'), 1).'</span>';
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'estimatedvalue';
|
||||
}
|
||||
}
|
||||
|
||||
// Selling value
|
||||
if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
if ($obj->sellvalue) {
|
||||
print '<span class="amount">'.price(price2num($obj->sellvalue, 'MT'), 1).'</span>';
|
||||
if (!isset($totalarray['val']['t.'.$key])) {
|
||||
$totalarray['val']['t.'.$key] = 0;
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("OptionMULTIPRICESIsOn");
|
||||
print $form->textwithtooltip($langs->trans("Variable"), $htmltext);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'estimatedstockvaluesell';
|
||||
$totalarray['val']['t.'.$key] += $warehouse->$key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
if (!empty($arrayfields['t.statut']['checked'])) {
|
||||
print '<td class="center">'.$warehouse->LibStatut($obj->statut, 5).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
// Stock qty
|
||||
if (!empty($arrayfields["stockqty"]['checked'])) {
|
||||
print '<td class="right">'.price2num($obj->stockqty, 5).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'stockqty';
|
||||
}
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
// PMP value
|
||||
if (!empty($arrayfields["estimatedvalue"]['checked'])) {
|
||||
print '<td class="right">';
|
||||
if (price2num($obj->estimatedvalue, 'MT')) {
|
||||
print '<span class="amount">'.price(price2num($obj->estimatedvalue, 'MT'), 1).'</span>';
|
||||
} else {
|
||||
print '';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$i++;
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'estimatedvalue';
|
||||
}
|
||||
}
|
||||
|
||||
if ($totalnboflines - $offset <= $limit) {
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
// Selling value
|
||||
if (!empty($arrayfields["estimatedstockvaluesell"]['checked'])) {
|
||||
print '<td class="right">';
|
||||
if (empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||
if ($obj->sellvalue) {
|
||||
print '<span class="amount">'.price(price2num($obj->sellvalue, 'MT'), 1).'</span>';
|
||||
}
|
||||
} else {
|
||||
$htmltext = $langs->trans("OptionMULTIPRICESIsOn");
|
||||
print $form->textwithtooltip($langs->trans("Variable"), $htmltext);
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
if (!$i) {
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'estimatedstockvaluesell';
|
||||
}
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
|
||||
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Status
|
||||
if (!empty($arrayfields['t.statut']['checked'])) {
|
||||
print '<td class="center">'.$warehouse->LibStatut($obj->statut, 5).'</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
$selected = 0;
|
||||
if (in_array($obj->rowid, $arrayofselected)) {
|
||||
$selected = 1;
|
||||
}
|
||||
print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
|
||||
}
|
||||
print '</td>';
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($totalnboflines - $offset <= $limit) {
|
||||
// Show total line
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
||||
}
|
||||
|
||||
// If no record found
|
||||
if ($num == 0) {
|
||||
$colspan = 1;
|
||||
foreach ($arrayfields as $key => $val) {
|
||||
if (!empty($val['checked'])) {
|
||||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user