forked from Wavyzz/dolibarr
PHP 8.2
This commit is contained in:
@@ -134,8 +134,11 @@ function getMultidirOutput($object, $module = '')
|
|||||||
if ($module == 'fichinter') {
|
if ($module == 'fichinter') {
|
||||||
$module = 'ficheinter';
|
$module = 'ficheinter';
|
||||||
}
|
}
|
||||||
|
if (isset($conf->$module)) {
|
||||||
return $conf->$module->multidir_output[(!empty($object->entity) ? $object->entity : $conf->entity)];
|
return $conf->$module->multidir_output[(!empty($object->entity) ? $object->entity : $conf->entity)];
|
||||||
|
} else {
|
||||||
|
return 'error-diroutput-not-defined-ffor-this-object='.$module;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ $pagenext = $page + 1;
|
|||||||
// Initialize technical objects
|
// Initialize technical objects
|
||||||
$object = new StockTransfer($db);
|
$object = new StockTransfer($db);
|
||||||
$extrafields = new ExtraFields($db);
|
$extrafields = new ExtraFields($db);
|
||||||
$diroutputmassaction = $conf->stocktransfer->dir_output.'/temp/massgeneration/'.$user->id;
|
$diroutputmassaction = getMultidirOutput($object).'/temp/massgeneration/'.$user->id;
|
||||||
$hookmanager->initHooks(array('stocktransferlist')); // Note that conf->hooks_modules contains array
|
$hookmanager->initHooks(array('stocktransferlist')); // Note that conf->hooks_modules contains array
|
||||||
|
|
||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
@@ -82,7 +82,9 @@ foreach ($object->fields as $key => $val) {
|
|||||||
// List of fields to search into when doing a "search in all"
|
// List of fields to search into when doing a "search in all"
|
||||||
$fieldstosearchall = array();
|
$fieldstosearchall = array();
|
||||||
foreach ($object->fields as $key => $val) {
|
foreach ($object->fields as $key => $val) {
|
||||||
if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
|
if (!empty($val['searchall'])) {
|
||||||
|
$fieldstosearchall['t.'.$key] = $val['label'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Definition of fields for list
|
// Definition of fields for list
|
||||||
@@ -93,7 +95,7 @@ foreach ($object->fields as $key => $val) {
|
|||||||
}
|
}
|
||||||
//var_dump($object->fields);
|
//var_dump($object->fields);
|
||||||
// Extra fields
|
// Extra fields
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
if (!empty($extrafields->attributes[$object->table_element]['label']) && 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) {
|
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||||
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) {
|
||||||
$arrayfields["ef.".$key] = array(
|
$arrayfields["ef.".$key] = array(
|
||||||
@@ -109,9 +111,9 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count
|
|||||||
$object->fields = dol_sort_array($object->fields, 'position');
|
$object->fields = dol_sort_array($object->fields, 'position');
|
||||||
$arrayfields = dol_sort_array($arrayfields, 'position');
|
$arrayfields = dol_sort_array($arrayfields, 'position');
|
||||||
|
|
||||||
$permissiontoread = $user->rights->stocktransfer->stocktransfer->read;
|
$permissiontoread = $user->hasRight('stocktransfer', 'stocktransfer', 'read');
|
||||||
$permissiontoadd = $user->rights->stocktransfer->stocktransfer->write;
|
$permissiontoadd = $user->hasRight('stocktransfer', 'stocktransfer', 'write');
|
||||||
$permissiontodelete = $user->rights->stocktransfer->stocktransfer->delete;
|
$permissiontodelete = $user->hasRight('stocktransfer', 'stocktransfer', 'delete');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
|
if (empty($conf->stocktransfer->enabled)) accessforbidden('Module not enabled');
|
||||||
@@ -191,7 +193,9 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
|
|||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
|
||||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
|
||||||
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
|
||||||
|
}
|
||||||
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
if ($object->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
|
||||||
else $sql .= " WHERE 1 = 1";
|
else $sql .= " WHERE 1 = 1";
|
||||||
foreach ($search as $key => $val) {
|
foreach ($search as $key => $val) {
|
||||||
@@ -370,10 +374,13 @@ foreach ($object->fields as $key => $val) {
|
|||||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID') $cssforfield .= ($cssforfield ? ' ' : '').'right';
|
||||||
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
if (!empty($arrayfields['t.'.$key]['checked'])) {
|
||||||
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
|
||||||
if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
|
||||||
elseif (strpos($val['type'], 'integer:') === 0) {
|
print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (empty($search[$key]) ? '' : $search['$key']), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75');
|
||||||
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
|
} elseif (strpos($val['type'], 'integer:') === 0) {
|
||||||
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
|
print $object->showInputField($val, $key, (empty($search[$key]) ? '' : $search['$key']), '', '', 'search_', 'maxwidth150', 1);
|
||||||
|
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
|
||||||
|
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(empty($search[$key]) ? '' : $search['$key']).'">';
|
||||||
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -499,7 +506,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|||||||
if ($num == 0) {
|
if ($num == 0) {
|
||||||
$colspan = 1;
|
$colspan = 1;
|
||||||
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
|
||||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user