2
0
forked from Wavyzz/dolibarr

Fix : PHP 8.1 warnings

This commit is contained in:
lmarcouiller
2022-07-20 16:35:51 +02:00
committed by Laurent Destailleur
parent 983d809549
commit bac8efd4c8
13 changed files with 31 additions and 18 deletions

View File

@@ -1510,7 +1510,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$outputlangs->loadLangs(array("main", "members", "companies", "install", "other")); $outputlangs->loadLangs(array("main", "members", "companies", "install", "other"));
// Get email content from template // Get email content from template
$arraydefaultmessage = null; $arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; $labeltouse = getDolGlobalString("ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION");
if (!empty($labeltouse)) { if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);

View File

@@ -914,8 +914,10 @@ if ($object->id > 0) {
* Latest orders * Latest orders
*/ */
if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
$param ="";
$sql = "SELECT s.nom, s.rowid"; $sql = "SELECT s.nom, s.rowid";
$sql .= ", c.rowid as cid, c.total_ht"; $sql .= ", c.rowid as cid, c.entity, c.total_ht";
$sql .= ", c.total_tva"; $sql .= ", c.total_tva";
$sql .= ", c.total_ttc"; $sql .= ", c.total_ttc";
$sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture"; $sql .= ", c.ref, c.ref_client, c.fk_statut, c.facture";
@@ -1024,7 +1026,7 @@ if ($object->id > 0) {
*/ */
if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire) { if (!empty($conf->expedition->enabled) && $user->rights->expedition->lire) {
$sql = 'SELECT e.rowid as id'; $sql = 'SELECT e.rowid as id';
$sql .= ', e.ref'; $sql .= ', e.ref, e.entity';
$sql .= ', e.date_creation'; $sql .= ', e.date_creation';
$sql .= ', e.fk_statut as statut'; $sql .= ', e.fk_statut as statut';
$sql .= ', s.nom'; $sql .= ', s.nom';

View File

@@ -1197,6 +1197,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
$arrayselected = array();
print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td>'; print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, null, null, null, 1); $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, null, null, null, 1);

View File

@@ -167,7 +167,7 @@ if ($object->thirdparty->client) {
} }
} }
if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) { if (!empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire) {
$elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions'); $elementTypeArray['fichinter'] = $langs->transnoentitiesnoconv('Interventions');
} }

View File

@@ -341,6 +341,9 @@ $formother = new FormOther($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$morejs=array();
$morecss = array();
if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) {
$contactstatic->loadCacheOfProspStatus(); $contactstatic->loadCacheOfProspStatus();
} }

View File

@@ -7447,8 +7447,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__MEMBER_PHONEMOBILE__'] = (isset($object->phone_mobile) ? dol_print_phone($object->phone_mobile) : ''); $substitutionarray['__MEMBER_PHONEMOBILE__'] = (isset($object->phone_mobile) ? dol_print_phone($object->phone_mobile) : '');
$substitutionarray['__MEMBER_TYPE__'] = (isset($object->type) ? $object->type : ''); $substitutionarray['__MEMBER_TYPE__'] = (isset($object->type) ? $object->type : '');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc'); $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE__'] = dol_print_date($object->first_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->first_subscription_date_start, 'dayrfc'); $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_START__'] = (isset($object->first_subscription_date_start) ? dol_print_date($object->first_subscription_date_start, 'dayrfc') : '');
$substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->first_subscription_date_end, 'dayrfc'); $substitutionarray['__MEMBER_FIRST_SUBSCRIPTION_DATE_END__'] = (isset($object->first_subscription_date_end) ? dol_print_date($object->first_subscription_date_end, 'dayrfc') : '');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'dayrfc'); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE__'] = dol_print_date($object->last_subscription_date, 'dayrfc');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'dayrfc'); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_START__'] = dol_print_date($object->last_subscription_date_start, 'dayrfc');
$substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc'); $substitutionarray['__MEMBER_LAST_SUBSCRIPTION_DATE_END__'] = dol_print_date($object->last_subscription_date_end, 'dayrfc');

View File

@@ -173,7 +173,7 @@ class pdf_standard extends CommonStickerGenerator
$widthtouse = $maxwidthtouse; $widthtouse = $maxwidthtouse;
$heighttouse = 0; // old value for image $heighttouse = 0; // old value for image
$tmp = dol_getImageSize($photo, false); $tmp = dol_getImageSize($photo, false);
if ($tmp['height']) { if (isset($tmp['height'])) {
$imgratio = $tmp['width'] / $tmp['height']; $imgratio = $tmp['width'] / $tmp['height'];
if ($imgratio >= $defaultratio) { if ($imgratio >= $defaultratio) {
$widthtouse = $maxwidthtouse; $widthtouse = $maxwidthtouse;
@@ -314,10 +314,10 @@ class pdf_standard extends CommonStickerGenerator
complete_substitutions_array($substitutionarray, $langs); complete_substitutions_array($substitutionarray, $langs);
// For business cards // For business cards
$textleft = make_substitutions($conf->global->ADHERENT_CARD_TEXT, $substitutionarray); $textleft = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT"), $substitutionarray);
$textheader = make_substitutions($conf->global->ADHERENT_CARD_HEADER_TEXT, $substitutionarray); $textheader = make_substitutions(getDolGlobalString("ADHERENT_CARD_HEADER_TEXT"), $substitutionarray);
$textfooter = make_substitutions($conf->global->ADHERENT_CARD_FOOTER_TEXT, $substitutionarray); $textfooter = make_substitutions(getDolGlobalString("ADHERENT_CARD_FOOTER_TEXT"), $substitutionarray);
$textright = make_substitutions($conf->global->ADHERENT_CARD_TEXT_RIGHT, $substitutionarray); $textright = make_substitutions(getDolGlobalString("ADHERENT_CARD_TEXT_RIGHT"), $substitutionarray);
$nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY']; $nb = $_Avery_Labels[$this->code]['NX'] * $_Avery_Labels[$this->code]['NY'];
if ($nb <= 0) { if ($nb <= 0) {
@@ -330,8 +330,8 @@ class pdf_standard extends CommonStickerGenerator
'textheader'=>$textheader, 'textheader'=>$textheader,
'textfooter'=>$textfooter, 'textfooter'=>$textfooter,
'textright'=>$textright, 'textright'=>$textright,
'id'=>$object->rowid, 'id'=>(isset($object->rowid) ? $object->rowid : ""),
'photo'=>$object->photo 'photo'=>(isset($object->photo) ? $object->photo : "")
); );
} }

View File

@@ -68,6 +68,9 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
$totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield']; $totalarray['totalizable'][$key]['pos'] = $totalarray['nbfield'];
} }
if (is_numeric($obj->$tmpkey)) { if (is_numeric($obj->$tmpkey)) {
if (!isset($totalarray['totalizable'][$key]['total'])) {
$totalarray['totalizable'][$key]['total'] = 0;
}
$totalarray['totalizable'][$key]['total'] += $obj->$tmpkey; $totalarray['totalizable'][$key]['total'] += $obj->$tmpkey;
} }
} }

View File

@@ -715,7 +715,9 @@ if ($action == 'create') {
$productstatic->type = $objp->type; $productstatic->type = $objp->type;
$productstatic->entity = $objp->entity; $productstatic->entity = $objp->entity;
$productstatic->status_batch = $objp->tobatch; $productstatic->status_batch = $objp->tobatch;
$productstatic->fk_unit = $objp->fk_unit; if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$productstatic->fk_unit = $objp->fk_unit;
}
$productstatic->status = $objp->tosell; $productstatic->status = $objp->tosell;
$productstatic->status_buy = $objp->tobuy; $productstatic->status_buy = $objp->tobuy;
$productstatic->barcode = $objp->barcode; $productstatic->barcode = $objp->barcode;

View File

@@ -35,7 +35,7 @@ $ref = GETPOST('ref', 'alpha');
// Security check // Security check
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock'); //$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
$result = restrictedArea($user, 'stock'); $result = restrictedArea($user, 'stock');
$usercancreate = $user->rights->stock->creer;
/* /*
* View * View
@@ -75,7 +75,7 @@ if (!empty($conf->project->enabled)) {
$morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">'; $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
$morehtmlref .= '</form>'; $morehtmlref .= '</form>';
} else { } else {
$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, (!empty($object->socid) ? $object->socid : 0), $object->fk_project, 'none', 0, 0, 0, 1);
} }
} else { } else {
if (!empty($object->fk_project)) { if (!empty($object->fk_project)) {

View File

@@ -59,6 +59,7 @@ $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist'; $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'movementlist';
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
$backtopage = GETPOST("backtopage", "alpha");
$idproduct = GETPOST('idproduct', 'int'); $idproduct = GETPOST('idproduct', 'int');
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));

View File

@@ -42,6 +42,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $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 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productlotlist'; // To manage different context of search
$optioncss = GETPOST('optioncss', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha');
$mode = GETPOST('mode', 'alpha');
$search_entity = GETPOST('search_entity', 'int'); $search_entity = GETPOST('search_entity', 'int');
$search_product = GETPOST('search_product', 'alpha'); $search_product = GETPOST('search_product', 'alpha');

View File

@@ -112,12 +112,12 @@ if (!empty($conf->productbatch->enabled) &&
print '<tr>'; print '<tr>';
if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) { if (empty($conf->global->PRODUCT_DISABLE_SELLBY)) {
print '<td>'.$langs->trans("SellByDate").'</td><td>'; print '<td>'.$langs->trans("SellByDate").'</td><td>';
print $form->selectDate(($d_sellby ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print $form->selectDate((!empty($d_sellby) ? $d_sellby : $pdluo->sellby), 'sellby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>'; print '</td>';
} }
if (empty($conf->global->PRODUCT_DISABLE_EATBY)) { if (empty($conf->global->PRODUCT_DISABLE_EATBY)) {
print '<td>'.$langs->trans("EatByDate").'</td><td>'; print '<td>'.$langs->trans("EatByDate").'</td><td>';
print $form->selectDate(($d_eatby ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled print $form->selectDate((!empty($d_eatby) ? $d_eatby : $pdluo->eatby), 'eatby', '', '', 1, "", 1, 0, ($pdluoid > 0 ? 1 : 0)); // If form was opened for a specific pdluoid, field is disabled
print '</td>'; print '</td>';
} }
print '</tr>'; print '</tr>';