fix php 8 warning

This commit is contained in:
Florian HENRY 2021-10-22 23:38:35 +02:00
parent 3d8a5d745a
commit 1f1e01aa88
4 changed files with 37 additions and 30 deletions

View File

@ -2207,7 +2207,7 @@ if ($id > 0) {
$delallowed = $user->rights->agenda->myactions->create;
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $object->default_lang);
print $formfile->showdocuments('actions', $object->id, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 0, 0, '', '', '', $langs->getDefaultLang());
print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -1019,6 +1019,7 @@ print "</tr>\n";
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

View File

@ -2175,8 +2175,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<tr><td>'.$langs->trans("ManageLotSerial").'</td><td>';
print $object->getLibStatut(0, 2);
print '</td></tr>';
if ((($object->status_batch == '1' && $conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && $conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS))) {
if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && $conf->global->PRODUCTBATCH_LOT_ADDON == 'mod_lot_advanced')
|| ($object->status_batch == '2' && $conf->global->PRODUCTBATCH_SN_ADDON == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) {
print '<tr><td>'.$langs->trans("ManageLotMask").'</td><td>';
print $object->batch_mask;
print '</td></tr>';
@ -2686,7 +2686,6 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
// Documents
$objectref = dol_sanitizeFileName($object->ref);
$relativepath = $comref.'/'.$objectref.'.pdf';
if (!empty($conf->product->multidir_output[$object->entity])) {
$filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities
} else {
@ -2696,7 +2695,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') {
$genallowed = $usercanread;
$delallowed = $usercancreate;
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object);
print $formfile->showdocuments($modulepart, $object->ref, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $langs->getDefaultLang(), '', $object);
$somethingshown = $formfile->numoffiles;
print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -931,7 +931,7 @@ END;
'pfp.fk_availability'=>array('label'=>$langs->trans("Availability"), 'enabled' => !empty($conf->global->FOURN_PRODUCT_AVAILABILITY), 'checked'=>0, 'position'=>4),
'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5),
'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9),
'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => $conf->multicurrency->enabled, 'checked'=>0, 'position'=>10),
'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($conf->multicurrency->enabled)), 'checked'=>0, 'position'=>10),
'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13),
'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14),
'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => $conf->barcode->enabled, 'checked'=>0, 'position'=>15),
@ -942,14 +942,19 @@ END;
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) {
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
$extratitle = $langs->trans($value);
$arrayfields['ef.'.$key] = array('label'=>$extratitle, 'checked'=>0, 'position'=>(end($arrayfields)['position'] + 1), 'langfile'=>$extrafields->attributes["product_fournisseur_price"]['langfile'][$key], 'help'=>$extrafields->attributes["product_fournisseur_price"]['help'][$key]);
if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
$extratitle = $langs->trans($value);
$arrayfields['ef.' . $key] = array('label' => $extratitle, 'checked' => 0,
'position' => (end($arrayfields)['position'] + 1),
'langfile' => $extrafields->attributes["product_fournisseur_price"]['langfile'][$key],
'help' => $extrafields->attributes["product_fournisseur_price"]['help'][$key]);
}
}
}
}
@ -1023,29 +1028,31 @@ END;
// fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label("product_fournisseur_price");
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if ($extrafields->attributes["product_fournisseur_price"] && array_key_exists('label', $extrafields->attributes["product_fournisseur_price"])) {
$extralabels = $extrafields->attributes["product_fournisseur_price"]['label'];
if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) {
$langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
}
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) {
$extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
} else {
$extratitle = $langs->trans($value);
}
if (!empty($arrayfields['ef.'.$key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.'.$key, '', $param, '', $sortfield, $sortorder, 'right ');
if (!empty($extralabels)) {
foreach ($extralabels as $key => $value) {
// Show field if not hidden
if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) {
if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) {
$langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]);
}
if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) {
$extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key]));
} else {
$extratitle = $langs->trans($value);
}
if (!empty($arrayfields['ef.' . $key]['checked'])) {
print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], 'ef.' . $key, '', $param, '', $sortfield, $sortorder, 'right ');
}
}
}
}
}
if (is_object($hookmanager)) {
$parameters = array('id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
$parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
}
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
@ -1213,7 +1220,7 @@ END;
}
if (is_object($hookmanager)) {
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>$id_fourn, 'prod_id'=>$object->id);
$parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id);
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action);
}