From 051f6ca7170ce0886570740b8486934a5445777d Mon Sep 17 00:00:00 2001 From: Lucas Marcouiller Date: Sat, 23 Oct 2021 23:12:42 +0200 Subject: [PATCH 1/3] Fix: php 8.0 warning commercial part --- htdocs/comm/propal/card.php | 9 +++++---- htdocs/comm/propal/index.php | 2 +- htdocs/comm/propal/list.php | 2 +- htdocs/commande/card.php | 2 +- htdocs/commande/list.php | 2 +- htdocs/contrat/list.php | 3 ++- htdocs/contrat/services_list.php | 3 ++- htdocs/fourn/commande/list.php | 2 +- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 222f6ab8a87..7aa4ac02e00 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1442,7 +1442,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = $conf->propal->multidir_output[$object->entity]; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -1584,6 +1584,7 @@ if ($action == 'create') { // Third party print ''; print ''.$langs->trans('Customer').''; + $shipping_method_id = 0; if ($socid > 0) { print ''; print $soc->getNomUrl(1); @@ -1700,7 +1701,7 @@ if ($action == 'create') { // Delivery date (or manufacturing) print ''.$langs->trans("DeliveryDate").''; print ''; - if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") { + if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte); @@ -1737,7 +1738,7 @@ if ($action == 'create') { print ''; print img_picto('', 'pdf').' '; $liste = ModelePDFPropales::liste_modeles($db); - $preselected = ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF); + $preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF")); print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); print ""; @@ -1754,7 +1755,7 @@ if ($action == 'create') { print ''; print ''.$langs->trans('NotePublic').''; print ''; - $note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null)); + $note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null)); $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%'); print $doleditor->Create(1); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index e170f873961..9f020bc1613 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -100,8 +100,8 @@ if (!empty($conf->propal->enabled)) { $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num); + $total = 0; if ($num) { - $total = 0; $i = 0; while ($i < $nbofloop) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 3535ae0cde1..347954cc711 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -534,7 +534,7 @@ if (!empty($search_categ_cus) && $search_categ_cus != '-1') { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'propal as p'; -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 (p.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cb62cf0094f..23a32e5796e 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1355,7 +1355,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = $conf->commande->multidir_output[$object->entity]; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 503c125b59c..6c14b57ef35 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -452,7 +452,7 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ } $sql .= ', '.MAIN_DB_PREFIX.'commande as c'; -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."commande_extrafields as ef on (c.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index cee0faf95aa..08c85bc620a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -229,6 +229,7 @@ $formother = new FormOther($db); $socstatic = new Societe($db); $formcompany = new FormCompany($db); $contracttmp = new Contrat($db); +$title = ""; $sql = 'SELECT'; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; @@ -259,7 +260,7 @@ if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; -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 (c.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 5bd98ded8c4..07cad07d2dd 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -37,6 +37,7 @@ $langs->loadLangs(array('products', 'contracts', 'companies')); $optioncss = GETPOST('optioncss', 'aZ09'); +$massaction = GETPOST('massaction', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); @@ -248,7 +249,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; } $sql .= " ".MAIN_DB_PREFIX."contratdet as cd"; -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 (cd.rowid = ef.fk_object)"; } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid"; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 419e75b55aa..c96de8c2aec 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -765,7 +765,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; -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 (cf.rowid = ef.fk_object)"; } if ($sall || $search_product_category > 0) { From 3bcafb548a4379ce56a2872eeea22d2b682fe008 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Fri, 19 Nov 2021 14:01:37 +0100 Subject: [PATCH 2/3] fix errors --- htdocs/comm/propal/card.php | 2 +- htdocs/commande/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7aa4ac02e00..36ebc1e1246 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1442,7 +1442,7 @@ if (empty($reshook)) { } // Actions to build doc - $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 23a32e5796e..89e671c7784 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1355,7 +1355,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to build doc - $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?:$conf->propal->dir_output; + $upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output; $permissiontoadd = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; From 31393802ff1170a2cd44c86fcb5e85122d9e7006 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Nov 2021 15:29:19 +0100 Subject: [PATCH 3/3] Update card.php --- htdocs/comm/propal/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b43a53714bb..2d8887c7929 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1701,7 +1701,7 @@ if ($action == 'create') { // Delivery date (or manufacturing) print ''.$langs->trans("DeliveryDate").''; print ''; - if (!empty($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { + if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) { $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60); $syear = date("Y", $tmpdte); $smonth = date("m", $tmpdte);