From cb4b0dbd5457941cc39e2a5de9e07313fb14988c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 09:53:10 +0200 Subject: [PATCH 01/13] FIX php8 compatibility --- htdocs/accountancy/admin/defaultaccounts.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 1e2272732bc..bfc1fd29316 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -313,7 +313,7 @@ print $formaccounting->select_account(getDolGlobalString('ACCOUNTING_ACCOUNT_SUP print ''; print ''; -if (!empty($conf->societe->enabled) && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') { +if (isModEnabled('societe') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') && getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER_DEPOSIT') != '-1') { print ''; print '' . img_picto('', 'supplier_invoice', 'class="pictofixedwidth"') . $langs->trans("UseAuxiliaryAccountOnSupplierDeposit") . ''; if (getDolGlobalInt('ACCOUNTING_ACCOUNT_SUPPLIER_USE_AUXILIARY_ON_DEPOSIT')) { From d3a4ad16da222f53a309c61a198967abe320293b Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 09:54:38 +0200 Subject: [PATCH 02/13] FIX php8 compatibility --- htdocs/adherents/partnership.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/partnership.php b/htdocs/adherents/partnership.php index bc21d4b6333..805a3137226 100644 --- a/htdocs/adherents/partnership.php +++ b/htdocs/adherents/partnership.php @@ -151,7 +151,7 @@ if ($id > 0) { $object = new Adherent($db); $result = $object->fetch($id); - if (!empty($conf->notification->enabled)) { + if (isModEnabled('notification')) { $langs->load("mails"); } From f7d23c01685eda97defcce2d18e4dcc0539cf167 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:04:07 +0200 Subject: [PATCH 03/13] FIX php8 compatibility --- htdocs/adherents/subscription.php | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index cf0ad445c92..5779fe036d9 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -271,7 +271,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $action = 'addsubscription'; } else { // If an amount has been provided, we check also fields that becomes mandatory when amount is not null. - if (!empty($conf->banque->enabled) && GETPOST("paymentsave") != 'none') { + if (isModEnabled('banque') && GETPOST("paymentsave") != 'none') { if (GETPOST("subscription")) { if (!GETPOST("label")) { $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")); @@ -475,7 +475,7 @@ if ($rowid > 0) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { $rowspan++; } - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { $rowspan++; } @@ -571,7 +571,7 @@ if ($rowid > 0) { print ''; // Tags / Categories - if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { print ''; print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); @@ -589,7 +589,7 @@ if ($rowid > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Third party Dolibarr - if (!empty($conf->societe->enabled)) { + if (isModEnabled('societe')) { print '
'; print '\n"; @@ -753,7 +753,7 @@ if ($rowid > 0) { print '\n"; print '\n"; print ''; - if (!empty($conf->banque->enabled)) { + if (isModEnabled('banque')) { print ''; @@ -797,7 +797,7 @@ if ($rowid > 0) { if (($action != 'addsubscription' && $action != 'create_thirdparty')) { // Shon online payment link - $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); + $useonlinepayment = (isModEnabled('paypal') || isModEnabled('stripe') || isModEnabled('paybox')); if ($useonlinepayment) { print '
'; @@ -831,11 +831,11 @@ if ($rowid > 0) { $bankviainvoice = 1; } } else { - if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { + if (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { $bankviainvoice = 1; - } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && !empty($conf->banque->enabled)) { + } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && isModEnabled('banque')) { $bankdirect = 1; - } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && !empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { + } elseif (!empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { $invoiceonly = 1; } } @@ -982,7 +982,7 @@ if ($rowid > 0) { print '">'; // Complementary action - if ((!empty($conf->banque->enabled) || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { + if ((isModEnabled('banque') || isModEnabled('facture')) && empty($conf->global->ADHERENT_SUBSCRIPTION_HIDECOMPLEMENTARYACTIONS)) { $company = new Societe($db); if ($object->fk_soc) { $result = $company->fetch($object->fk_soc); @@ -998,12 +998,12 @@ if ($rowid > 0) { print ''; print '
'; // Add entry into bank accoun - if (!empty($conf->banque->enabled)) { + if (isModEnabled('banque')) { print '
'; } // Add invoice with no payments - if (!empty($conf->societe->enabled) && isModEnabled('facture')) { + if (isModEnabled('societe') && isModEnabled('facture')) { print 'fk_soc)) print ' disabled'; print '>
'; } // Add invoice with payments - if (!empty($conf->banque->enabled) && !empty($conf->societe->enabled) && isModEnabled('facture')) { + if (isModEnabled('banque') && isModEnabled('societe') && isModEnabled('facture')) { print 'fk_soc)) print ' disabled'; print '>'; print ""; print "\n"; print ''; -if (!empty($conf->banque->enabled)) { +if (isModEnabled('banque')) { print ''; -if (!empty($conf->loghandlers['mod_syslog_file']) && !empty($conf->cron->enabled)) { +if (!empty($conf->loghandlers['mod_syslog_file']) && isModEnabled('cron')) { print ''; print ''; From 28b60d9003b1d6f89617e14d61b92d5d62ba8a39 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:13:14 +0200 Subject: [PATCH 12/13] FIX php8 compatibility --- htdocs/admin/ticket.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 99d1b34749f..f1fbba03840 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -539,7 +539,7 @@ print $formcategory->textwithpicto('', $langs->trans("TicketsAutoNotifyCloseHelp print ''; print ''; -if (! empty($conf->product->enabled)) { +if (isModEnabled('product')) { print ''; print '
'; print $langs->trans("LinkedToDolibarrThirdParty"); @@ -718,7 +718,7 @@ if ($rowid > 0) { print_liste_field_titre('DateStart', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('DateEnd', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); - if (!empty($conf->banque->enabled)) { + if (isModEnabled('banque')) { print_liste_field_titre('Account', $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); } print "
'.dol_print_date($db->jdate($objp->dateh), 'day')."'.dol_print_date($db->jdate($objp->datef), 'day')."'.price($objp->subscription).''; if ($objp->bid) { $accountstatic->label = $objp->label; @@ -762,7 +762,7 @@ if ($rowid > 0) { $accountstatic->account_number = $objp->account_number; $accountstatic->currency_code = $objp->currency_code; - if (!empty($conf->accounting->enabled) && $objp->fk_accountancy_journal > 0) { + if (isModEnabled('accounting') && $objp->fk_accountancy_journal > 0) { $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objp->fk_accountancy_journal); @@ -782,7 +782,7 @@ if ($rowid > 0) { if (empty($num)) { $colspan = 6; - if (!empty($conf->banque->enabled)) { + if (isModEnabled('banque')) { $colspan++; } print '
'.$langs->trans("None").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; -if (!empty($conf->banque->enabled)) { +if (isModEnabled('banque')) { $sql = "SELECT rowid, label"; $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; $sql .= " WHERE clos = 0"; From 66b3a926ce431a8442d8f2ce3ea6d3bbdb2ce127 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:08:34 +0200 Subject: [PATCH 07/13] FIX php8 compatibility --- htdocs/admin/multicurrency.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index d6487093e41..1cf838c08cb 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; $langs->loadLangs(array('admin', 'multicurrency')); // Access control -if (!$user->admin || empty($conf->multicurrency->enabled)) { +if (!$user->admin || !isModEnabled('multicurrency')) { accessforbidden(); } From 00a855bc5eaef3dc0df4c5c76dcc409e6c62ee79 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:09:31 +0200 Subject: [PATCH 08/13] FIX php8 compatibility --- htdocs/admin/pdf_other.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/pdf_other.php b/htdocs/admin/pdf_other.php index b064cbb8cd8..979edb47de4 100644 --- a/htdocs/admin/pdf_other.php +++ b/htdocs/admin/pdf_other.php @@ -102,7 +102,7 @@ print '
'; print ''; print ''; -if (!empty($conf->propal->enabled)) { +if (isModEnabled('propal')) { print load_fiche_titre($langs->trans("Proposal"), '', ''); print '
'; From 9df948db5a7e1d32f2153143330dda0b726f2c48 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:10:41 +0200 Subject: [PATCH 09/13] FIX php8 compatibility --- htdocs/admin/reception_setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 5479b43f6ca..a06760b9da4 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -47,7 +47,7 @@ $type = 'reception'; * Actions */ -if (!empty($conf->reception->enabled) && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { +if (isModEnabled('reception') && empty($conf->global->MAIN_SUBMODULE_RECEPTION)) { // This option should always be set to on when module is on. dolibarr_set_const($db, "MAIN_SUBMODULE_RECEPTION", "1", 'chaine', 0, '', $conf->entity); } From 5fdd5e759721088515c80bbc3d6530c14120459a Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:11:59 +0200 Subject: [PATCH 10/13] FIX php8 compatibility --- htdocs/admin/supplier_proposal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 76a881f9415..593ad13ff82 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -498,7 +498,7 @@ print '
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; if (!empty($conf->use_javascript_ajax)) { From 1a92621bd7f57de47c98b68a3c684627d8014481 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:12:34 +0200 Subject: [PATCH 11/13] FIX php8 compatibility --- htdocs/admin/syslog.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 8e80a13673e..875d024fd65 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -293,7 +293,7 @@ print '
'.$langs->trans("SyslogFileNumberOfSaves").''; print ' ('.$langs->trans('ConfigureCleaningCronjobToSetFrequencyOfSaves').')
'.$langs->trans("TicketChooseProductCategory").''; $formcategory->selectProductCategory($conf->global->TICKET_PRODUCT_CATEGORY, 'product_category_id'); From 117aed6a10587ee4132e0105f171feb078d1ecab Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 23 Aug 2022 10:14:07 +0200 Subject: [PATCH 13/13] FIX php8 compatibility --- htdocs/admin/website.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 5f51bccb240..80e806b6595 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -109,7 +109,7 @@ $tabrowid[1] = ""; // Condition to show dictionary in setup page $tabcond = array(); -$tabcond[1] = (!empty($conf->website->enabled)); +$tabcond[1] = (isModEnabled('website')); // List of help for fields $tabhelp = array();