Merge pull request #19535 from Hystepik/develop#4

Fix : php 8.0 warnings
This commit is contained in:
Laurent Destailleur 2021-12-08 18:44:16 +01:00 committed by GitHub
commit ea45fdce5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 21 deletions

View File

@ -4488,14 +4488,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

@ -85,6 +85,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');
//Select mail models is same action as presend
@ -1750,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">';
// #
@ -1775,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) : '';
}
@ -1924,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;';
@ -1933,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;';
@ -1964,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

@ -1120,7 +1120,7 @@ class Reception extends CommonObject
$result = '';
$label = img_picto('', $this->picto).' <u>'.$langs->trans("Reception").'</u>';
$label .= '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref;
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.($this->ref_supplier ? $this->ref_supplier : $this->ref_client);
$label .= '<br><b>'.$langs->trans('RefSupplier').':</b> '.($this->ref_supplier ? $this->ref_supplier : '');
$url = DOL_URL_ROOT.'/reception/card.php?id='.$this->id;

View File

@ -39,6 +39,7 @@ $langs->loadLangs(array("orders", "receptions"));
$reception = new Reception($db);
// Security check
$socid = '';
if ($user->socid) {
$socid = $user->socid;
}

View File

@ -479,7 +479,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."reception 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']) && 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 (e.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
@ -878,6 +878,7 @@ print "</tr>\n";
$i = 0;
$totalarray = array();
$totalarray['nbfield'] = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql);

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();