Merge pull request #20890 from Hystepik/develop#1

Fix : php 8.0 warnings
This commit is contained in:
Laurent Destailleur 2022-05-20 19:41:20 +02:00 committed by GitHub
commit 168d1d4334
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 27 additions and 21 deletions

View File

@ -248,8 +248,8 @@ if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && !empty(
$arraychoices['bankviainvoice'] = $langs->trans("MoreActionBankViaInvoice");
}
print '<td>';
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, $conf->global->ADHERENT_BANK_USE, 0);
if ($conf->global->ADHERENT_BANK_USE == 'bankdirect' || $conf->global->ADHERENT_BANK_USE == 'bankviainvoice') {
print $form->selectarray('ADHERENT_BANK_USE', $arraychoices, getDolGlobalString('ADHERENT_BANK_USE'), 0);
if (getDolGlobalString('ADHERENT_BANK_USE') == 'bankdirect' || getDolGlobalString('ADHERENT_BANK_USE') == 'bankviainvoice') {
print '<br><div style="padding-top: 5px;"><span class="opacitymedium">'.$langs->trans("ABankAccountMustBeDefinedOnPaymentModeSetup").'</span></div>';
}
print '</td>';
@ -378,16 +378,16 @@ foreach ($dirmodels as $reldir) {
print '</td>';
} else {
print '<td class="center">'."\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set_default&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
print "</td>";
}
// Defaut
print '<td class="center">';
if ($conf->global->MEMBER_ADDON_PDF == $name) {
if (getDolGlobalString('MEMBER_ADDON_PDF') == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.$name.'&scandir='.(!empty($module->scandir) ? $module->scandir : '').'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
}
print '</td>';
@ -398,8 +398,8 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
}
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn(!empty($module->option_logo) ? $module->option_logo : 0, 1, 1);
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn(!empty($module->option_multilang) ? $module->option_multilang : 0, 1, 1);
print '<td class="center">';

View File

@ -40,6 +40,7 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha');
$socid = GETPOST('socid', 'int');
if (GETPOST('actioncode', 'array')) {
$actioncode = GETPOST('actioncode', 'array', 3);
@ -79,7 +80,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
// Security check - Protection if external user

View File

@ -104,6 +104,7 @@ $form = new Form($db);
$title = $langs->trans("BillOfMaterials").' - '.$langs->trans("Files");
$help_url = 'EN:Module_BOM';
$morehtmlref = "";
llxHeader('', $title, $help_url);

View File

@ -34,6 +34,7 @@ $langs->loadLangs(array("mrp", "other", "stocks"));
// Get parameters
$id = GETPOST('id', 'int');
$lineid = GETPOST('lineid', 'int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');

View File

@ -54,7 +54,7 @@ $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
if ($id > 0 || !empty($ref)) {
$upload_dir = $conf->bom->multidir_output[$object->entity]."/".$object->id;
$upload_dir = (!empty($conf->bom->multidir_output[$object->entity]) ? $conf->bom->multidir_output[$object->entity] : $conf->bom->dir_output)."/".$object->id;
}
$permissionnote = $user->rights->bom->write; // Used by the include of actions_setnotes.inc.php

View File

@ -916,27 +916,27 @@ class BOM extends CommonObject
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
if (!empty($obj->fk_user_author)) {
$cuser = new User($this->db);
$cuser->fetch($obj->fk_user_author);
$this->user_creation = $cuser;
}
if ($obj->fk_user_valid) {
if (!empty($obj->fk_user_valid)) {
$vuser = new User($this->db);
$vuser->fetch($obj->fk_user_valid);
$this->user_validation = $vuser;
}
if ($obj->fk_user_cloture) {
if (!empty($obj->fk_user_cloture)) {
$cluser = new User($this->db);
$cluser->fetch($obj->fk_user_cloture);
$this->user_cloture = $cluser;
}
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
$this->date_validation = $this->db->jdate($obj->datev);
$this->date_modification = !empty($obj->datem) ? $this->db->jdate($obj->datem) : "";
$this->date_validation = !empty($obj->datev) ? $this->db->jdate($obj->datev) : "";
}
$this->db->free($result);
@ -1134,6 +1134,9 @@ class BOM extends CommonObject
if (! empty($line->childBom)) {
foreach ($line->childBom as $childBom) $childBom->getNetNeeds($TNetNeeds, $line->qty*$qty);
} else {
if (empty($TNetNeeds[$line->fk_product])) {
$TNetNeeds[$line->fk_product] = 0;
}
$TNetNeeds[$line->fk_product] += $line->qty*$qty;
}
}

View File

@ -101,10 +101,10 @@ if ($action == 'add' && !empty($permissiontoadd)) {
//var_dump($key.' '.$value.' '.$object->fields[$key]['type']);
$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && !is_null($val['default']) && $val['default'] == '(PROV)') {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') {
$object->$key = '(PROV)';
}
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && !isset($val['default'])) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}

View File

@ -4889,7 +4889,7 @@ abstract class CommonObject
$product_static->fetch($line->fk_product);
$product_static->ref = $line->ref; //can change ref in hook
$product_static->label = $line->label; //can change label in hook
$product_static->label = !empty($line->label) ? $line->label : ""; //can change label in hook
$text = $product_static->getNomUrl(1);
@ -4925,7 +4925,7 @@ abstract class CommonObject
$description .= (!empty($conf->global->PRODUIT_DESC_IN_FORM) ? '' : dol_htmlentitiesbr($line->description)); // Description is what to show on popup. We shown nothing if already into desc.
}
$line->pu_ttc = price2num($line->subprice * (1 + ($line->tva_tx / 100)), 'MU');
$line->pu_ttc = price2num((!empty($line->subprice) ? $line->subprice : 0) * (1 + ((!empty($line->tva_tx) ? $line->tva_tx : 0) / 100)), 'MU');
// Output template part (modules that overwrite templates must declare this into descriptor)
// Use global variables + $dateSelector + $seller and $buyer
@ -6847,7 +6847,7 @@ abstract class CommonObject
if ((string) $key == '') {
continue;
}
list($val, $parent) = explode('|', $val);
if (strpos($val, "|") !== false) list($val, $parent) = explode('|', $val);
$out .= '<option value="'.$key.'"';
$out .= (((string) $value == (string) $key) ? ' selected' : '');
$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');

View File

@ -85,7 +85,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
$tooltip .= $langs->trans("GenericMaskCodes5");
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_MASK.'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskholiday" value="'.getDolGlobalString('HOLIDAY_IMMACULATE_MASK').'">', $tooltip, 1, 1).'</td>';
$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" name="Button"value="'.$langs->trans("Modify").'"></td>';
$texte .= '</tr>';
$texte .= '</table>';
@ -127,7 +127,7 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$mask = $conf->global->HOLIDAY_IMMACULATE_MASK;
$mask = getDolGlobalString('HOLIDAY_IMMACULATE_MASK');
if (!$mask) {
$this->error = 'NotConfigured';