fix php8.0 warning

This commit is contained in:
Lucas Marcouiller 2021-11-30 16:35:46 +01:00
parent 4189229b84
commit 1c4a7a00cb
8 changed files with 35 additions and 12 deletions

View File

@ -81,6 +81,7 @@ if (empty($origin_id)) {
}
$ref = GETPOST('ref', 'alpha');
$line_id = GETPOST('lineid', 'int') ?GETPOST('lineid', 'int') : '';
$facid = GETPOST('facid', 'int');
$action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
$hookmanager = new HookManager($db);
$socid = GETPOST('socid', 'int');
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('sendingindex'));

View File

@ -253,7 +253,7 @@ $parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && sis_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 (e.rowid = ef.fk_object)";
}
if ($sall || $search_product_category > 0) {

View File

@ -276,7 +276,7 @@ if ($result || !($id > 0)) {
print '<br>';
// Generation of graphs
$dir = (!empty($conf->product->multidir_temp[$object->entity]) ? $conf->product->multidir_temp[$object->entity] : $conf->service->multidir_temp[$object->entity]);
$dir = (!empty($conf->product->multidir_temp[$conf->entity]) ? $conf->product->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]);
if ($object->id > 0) { // We are on statistics for a dedicated product
if (!file_exists($dir.'/'.$object->id)) {
if (dol_mkdir($dir.'/'.$object->id) < 0) {

View File

@ -78,7 +78,7 @@ if (!$sortorder) {
// 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);
$diroutputmassaction = $conf->inventory->dir_output.'/temp/massgeneration/'.$user->id;
$diroutputmassaction = $conf->stock->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('stocklist'));
// Fetch optionals attributes and labels
@ -228,7 +228,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
if (!empty($conf->categorie->enabled)) {
$sql .= Categorie::getFilterJoinQuery(Categorie::TYPE_WAREHOUSE, "t.rowid");
}
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
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)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps ON t.rowid = ps.fk_entrepot";
@ -473,7 +473,7 @@ foreach ($object->fields as $key => $val) {
} 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]).'">';
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(!empty($search[$key])?$search[$key]:'').'">';
}
print '</td>';
}
@ -622,6 +622,9 @@ while ($i < min($num, $limit)) {
}
print '</td>';
if (!$i) {
if (!isset($totalarray['nbfield'])) {
$totalarray['nbfield'] = 0;
}
$totalarray['nbfield']++;
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {

View File

@ -486,28 +486,36 @@ if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
$max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
$maxphp = @ini_get('upload_max_filesize'); // In unknown
if (preg_match('/k$/i', $maxphp)) {
$maxphp = preg_replace('/k$/i', '', $maxphp);
$maxphp = $maxphp * 1;
}
if (preg_match('/m$/i', $maxphp)) {
$maxphp = preg_replace('/m$/i', '', $maxphp);
$maxphp = $maxphp * 1024;
}
if (preg_match('/g$/i', $maxphp)) {
$maxphp = preg_replace('/g$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp)) {
$maxphp = preg_replace('/t$/i', '', $maxphp);
$maxphp = $maxphp * 1024 * 1024 * 1024;
}
$maxphp2 = @ini_get('post_max_size'); // In unknown
if (preg_match('/k$/i', $maxphp2)) {
$maxphp2 = preg_replace('/k$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1;
}
if (preg_match('/m$/i', $maxphp2)) {
$maxphp2 = preg_replace('/m$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024;
}
if (preg_match('/g$/i', $maxphp2)) {
$maxphp2 = preg_replace('/g$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024;
}
if (preg_match('/t$/i', $maxphp2)) {
$maxphp2 = preg_replace('/t$/i', '', $maxphp2);
$maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
}
// Now $max and $maxphp and $maxphp2 are in Kb

View File

@ -68,6 +68,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$result = restrictedArea($user, 'stock');
$idproduct = GETPOST('idproduct', 'int');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_date_startday = GETPOST('search_date_startday', 'int');
$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
$search_date_startyear = GETPOST('search_date_startyear', 'int');
@ -87,6 +88,8 @@ $search_batch = trim(GETPOST("search_batch"));
$search_qty = trim(GETPOST("search_qty"));
$search_type_mouvement = GETPOST('search_type_mouvement', 'int');
$search_fk_projet=GETPOST("search_fk_projet", 'int');
$optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST("type", "int");
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@ -498,7 +501,7 @@ $sql .= $hookmanager->resPrint;
$sql .= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
$sql .= " ".MAIN_DB_PREFIX."product as p,";
$sql .= " ".MAIN_DB_PREFIX."stock_mouvement as m";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
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 (m.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON m.fk_user_author = u.rowid";
@ -1298,6 +1301,9 @@ while ($i < min($num, $limit)) {
}
print '</td>';
if (!$i) {
if (!isset($totalarray['nbfield'])) {
$totalarray['nbfield'] = 0;
}
$totalarray['nbfield']++;
}

View File

@ -37,6 +37,7 @@ $langs->loadLangs(array('stocks', 'productbatch', 'other', 'users'));
// Get parameters
$id = GETPOST('id', 'int');
$action = GETPOST('action', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productlotlist'; // To manage different context of search
@ -64,7 +65,7 @@ $pagenext = $page + 1;
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$object = new Productlot($db);
$extrafields = new ExtraFields($db);
$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id;
$diroutputmassaction = $conf->productbatch->dir_output.'/temp/massgeneration/'.$user->id;
$hookmanager->initHooks(array('product_lotlist'));
// Fetch optionals attributes and labels
@ -215,7 +216,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql);
$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'])) {
if ( !empty($extrafields->attributes[$object->table_element]['label']) && ($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) {
@ -340,7 +341,7 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
);
if ($permissiontodelete) {
if (!empty($permissiontodelete)) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
@ -424,9 +425,9 @@ foreach ($object->fields as $key => $val) {
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) {
print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1);
print $object->showInputField($val, $key, !empty($search[$key])?$search[$key]:0, '', '', 'search_', 'maxwidth150', 1);
} elseif (!preg_match('/^(date|timestamp)/', $val['type'])) {
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'">';
print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(!empty($search[$key])?$search[$key]:'').'">';
}
print '</td>';
}
@ -477,7 +478,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line
$needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object
@ -535,6 +536,9 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
}
print '</td>';
if (!$i) {
if (!isset($totalarray['nbfield'])) {
$totalarray['nbfield'] = 0;
}
$totalarray['nbfield']++;
}
if (!empty($val['isameasure']) && $val['isameasure'] == 1) {