fix php8.0 errors

This commit is contained in:
lmarcouiller 2021-12-01 16:24:57 +01:00
parent 171ecaa81d
commit ed7bfb333b
4 changed files with 20 additions and 19 deletions

View File

@ -4481,14 +4481,14 @@ abstract class CommonObject
$qty = $line->qty ? $line->qty : 0;
}
$weight = $line->weight ? $line->weight : 0;
$weight = !empty($line->weight) ? $line->weight : 0;
($weight == 0 && !empty($line->product->weight)) ? $weight = $line->product->weight : 0;
$volume = $line->volume ? $line->volume : 0;
$volume = !empty($line->volume) ? $line->volume : 0;
($volume == 0 && !empty($line->product->volume)) ? $volume = $line->product->volume : 0;
$weight_units = $line->weight_units;
$weight_units = !empty($line->weight_units) ? $line->weight_units : 0;
($weight_units == 0 && !empty($line->product->weight_units)) ? $weight_units = $line->product->weight_units : 0;
$volume_units = $line->volume_units;
$volume_units = !empty($line->volume_units) ? $line->volume_units : 0;
($volume_units == 0 && !empty($line->product->volume_units)) ? $volume_units = $line->product->volume_units : 0;
$weightUnit = 0;

View File

@ -2103,7 +2103,7 @@ if ($action == 'create') {
// Loop on each product to send/sent
for ($i = 0; $i < $num_prod; $i++) {
$parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => $editColspan, 'outputlangs' => $outputlangs);
$parameters = array('i' => $i, 'line' => $lines[$i], 'line_id' => $line_id, 'num' => $num_prod, 'alreadysent' => $alreadysent, 'editColspan' => !empty($editColspan) ? $editColspan : 0, 'outputlangs' => !empty($outputlangs) ? $outputlangs: '');
$reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
if ($reshook < 0) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -2143,10 +2143,10 @@ if ($action == 'create') {
$product_static->weight_units = $lines[$i]->weight_units;
$product_static->length = $lines[$i]->length;
$product_static->length_units = $lines[$i]->length_units;
$product_static->width = $lines[$i]->width;
$product_static->width_units = $lines[$i]->width_units;
$product_static->height = $lines[$i]->height;
$product_static->height_units = $lines[$i]->height_units;
$product_static->width = !empty($lines[$i]->width) ? $lines[$i]->width : 0;
$product_static->width_units = !empty($lines[$i]->width_units) ? $lines[$i]->width_units : 0;
$product_static->height = !empty($lines[$i]->height) ? $lines[$i]->height : 0;
$product_static->height_units = !empty($lines[$i]->height_units) ? $lines[$i]->height_units : 0;
$product_static->surface = $lines[$i]->surface;
$product_static->surface_units = $lines[$i]->surface_units;
$product_static->volume = $lines[$i]->volume;
@ -2156,7 +2156,7 @@ if ($action == 'create') {
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : '', !empty($lines[$i]->date_end) ? $lines[$i]->date_end : '');
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
print (!empty($lines[$i]->description) && $lines[$i]->description != $lines[$i]->product) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
}
@ -2181,7 +2181,7 @@ if ($action == 'create') {
}
$unit_order = '';
if ($conf->global->PRODUCT_USE_UNITS) {
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$unit_order = measuringUnitString($lines[$i]->fk_unit);
}
@ -2412,9 +2412,9 @@ if ($action == 'create') {
// TODO Show all in same line by setting $display_type = 'line'
if ($action == 'editline' && $line->id == $line_id) {
print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked, '', 0, 'card');
print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card');
} else {
print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked, '', 0, 'card');
print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), !empty($indiceAsked) ? $indiceAsked : '', '', 0, 'card');
}
}
}

View File

@ -1751,7 +1751,7 @@ if ($action == 'create') {
// Loop on each product to send/sent
for ($i = 0; $i < $num_prod; $i++) {
print '<!-- origin line id = '.$lines[$i]->origin_line_id.' -->'; // id of order line
print '<!-- origin line id = '.(!empty($lines[$i]->origin_line_id) ? $lines[$i]->origin_line_id : 0).' -->'; // id of order line
print '<tr class="oddeven">';
// #
@ -1776,7 +1776,7 @@ if ($action == 'create') {
$text .= ' - '.$label;
$description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($lines[$i]->product->description));
print $form->textwithtooltip($text, $description, 3, '', '', $i);
print_date_range($lines[$i]->date_start, $lines[$i]->date_end);
print_date_range(!empty($lines[$i]->date_start) ? $lines[$i]->date_start : 0, !empty($lines[$i]->date_end) ? $lines[$i]->date_end : 0);
if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '<br>'.dol_htmlentitiesbr($lines[$i]->description) : '';
}
@ -1925,7 +1925,7 @@ if ($action == 'create') {
// Weight
print '<td class="center">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
if (!empty($lines[$i]->fk_product_type) && $lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
print $lines[$i]->product->weight * $lines[$i]->qty.' '.measuringUnitString(0, "weight", $lines[$i]->product->weight_units);
} else {
print '&nbsp;';
@ -1934,7 +1934,7 @@ if ($action == 'create') {
// Volume
print '<td class="center">';
if ($lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
if (!empty($lines[$i]->fk_product_type) && $lines[$i]->fk_product_type == Product::TYPE_PRODUCT) {
print $lines[$i]->product->volume * $lines[$i]->qty.' '.measuringUnitString(0, "volume", $lines[$i]->product->volume_units);
} else {
print '&nbsp;';
@ -1965,7 +1965,7 @@ if ($action == 'create') {
print "</tr>";
// Display lines extrafields
if (is_array($extralabelslines) && count($extralabelslines) > 0) {
if (!empty($extralabelslines) && is_array($extralabelslines) && count($extralabelslines) > 0) {
$colspan = empty($conf->productbatch->enabled) ? 8 : 9;
$line = new CommandeFournisseurDispatch($db);
$line->id = $lines[$i]->id;

View File

@ -59,7 +59,7 @@ llxHeader();
print load_fiche_titre($langs->trans("StatisticsOfReceptions"), '', 'dollyrevert');
$dir = (!empty($conf->reception->multidir_temp[$conf->entity]) ? $conf->reception->multidir_temp[$conf->entity] : $conf->service->multidir_temp[$conf->entity]);
dol_mkdir($dir);
$stats = new ReceptionStats($db, $socid, '', ($userid > 0 ? $userid : 0));
@ -78,6 +78,7 @@ if (empty($user->rights->societe->client->voir) || $user->socid) {
$px1 = new DolGraph();
$mesg = $px1->isGraphKo();
$fileurlnb = '';
if (!$mesg) {
$px1->SetData($data);
$i = $startyear; $legend = array();