From 1e53f87d518070479e71b0236d65e5d21320b7f9 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Wed, 8 Feb 2023 12:18:46 +0100 Subject: [PATCH] FIX: various PHP8 compatibility fixes --- htdocs/admin/agenda.php | 2 +- htdocs/admin/agenda_extsites.php | 2 +- htdocs/admin/agenda_other.php | 4 +-- htdocs/admin/agenda_xcal.php | 33 ++++++++++++++----- htdocs/admin/dav.php | 6 +++- htdocs/admin/facture.php | 8 +++-- htdocs/admin/payment.php | 6 ++-- .../core/class/commondocgenerator.class.php | 10 ++++++ .../modules/facture/mod_facture_mercure.php | 23 ++++++------- .../core/modules/payment/mod_payment_ant.php | 6 ++-- .../doc/doc_generic_proposal_odt.modules.php | 19 ++++++----- ..._generic_supplier_proposal_odt.modules.php | 19 ++++++----- .../mod_supplier_proposal_saphir.php | 8 +++-- .../user/doc/doc_generic_user_odt.modules.php | 17 ++++++---- .../doc/doc_generic_usergroup_odt.modules.php | 17 ++++++---- htdocs/dav/dav.lib.php | 2 +- htdocs/includes/tcpdi/tcpdi_parser.php | 4 +-- htdocs/main.inc.php | 2 ++ 18 files changed, 117 insertions(+), 71 deletions(-) diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index 730983ad090..bd1bae40d19 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -197,7 +197,7 @@ if (!empty($triggers)) { print ''.$trigger['label'].''; print ''; $key = 'MAIN_AGENDA_ACTIONAUTO_'.$trigger['code']; - $value = $conf->global->$key; + $value = getDolGlobalInt($key); print ''; print ''."\n"; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 5567e741272..d6cb112810a 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -202,7 +202,7 @@ print ''.$langs->trans("AgendaExtSitesDesc")."\n"; -$selectedvalue=$conf->global->AGENDA_DISABLE_EXT; +$selectedvalue = getDolGlobalInt('AGENDA_DISABLE_EXT'); if ($selectedvalue==1) $selectedvalue=0; else $selectedvalue=1; print ""; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 8e50380e2ae..7a49d2def53 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -325,7 +325,7 @@ print ''."\n"; print ''."\n"; // Manual or automatic @@ -387,7 +387,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; print '
'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltex print ' '."\n"; $tmplist = array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); -print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); +print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, getDolGlobalString('AGENDA_DEFAULT_VIEW')); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; -$formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); +$formactions->form_select_status_action('agenda', getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS'), 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'; diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index ce36d97d06a..fc75042146f 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -38,6 +38,23 @@ $langs->loadLangs(array("admin", "other", "agenda")); $def = array(); $actionsave = GETPOST('save', 'alpha'); +$MAIN_AGENDA_XCAL_EXPORTKEY = getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY'); +$MAIN_AGENDA_EXPORT_PAST_DELAY = getDolGlobalInt('MAIN_AGENDA_EXPORT_PAST_DELAY'); +$MAIN_AGENDA_EXPORT_CACHE = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE'); +$AGENDA_EXPORT_FIX_TZ = getDolGlobalString('AGENDA_EXPORT_FIX_TZ'); + +if (GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) { + $MAIN_AGENDA_XCAL_EXPORTKEY = trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) { + $MAIN_AGENDA_EXPORT_PAST_DELAY = intval(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'int')); +} +if (GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) { + $MAIN_AGENDA_EXPORT_CACHE = intval(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'int')); +} +if (GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) { + $AGENDA_EXPORT_FIX_TZ = trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')); +} // Sauvegardes parametres if ($actionsave) { @@ -45,10 +62,10 @@ if ($actionsave) { $db->begin(); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', trim(GETPOST('MAIN_AGENDA_XCAL_EXPORTKEY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', trim(GETPOST('MAIN_AGENDA_EXPORT_PAST_DELAY', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', trim(GETPOST('MAIN_AGENDA_EXPORT_CACHE', 'alpha')), 'chaine', 0, '', $conf->entity); - $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', trim(GETPOST('AGENDA_EXPORT_FIX_TZ', 'alpha')), 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_XCAL_EXPORTKEY', $MAIN_AGENDA_XCAL_EXPORTKEY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_PAST_DELAY', $MAIN_AGENDA_EXPORT_PAST_DELAY, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'MAIN_AGENDA_EXPORT_CACHE', $MAIN_AGENDA_EXPORT_CACHE, 'chaine', 0, '', $conf->entity); + $i += dolibarr_set_const($db, 'AGENDA_EXPORT_FIX_TZ', $AGENDA_EXPORT_FIX_TZ, 'chaine', 0, '', $conf->entity); if ($i >= 4) { $db->commit(); @@ -97,7 +114,7 @@ print ""; print ''; print ''.$langs->trans("PasswordTogetVCalExport").""; -print ''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } @@ -107,13 +124,13 @@ print ""; print ''; print "".$langs->trans("PastDelayVCalExport").""; -print "global->MAIN_AGENDA_EXPORT_PAST_DELAY)."\" size=\"10\"> ".$langs->trans("days").""; +print " ".$langs->trans("days").""; print " "; print ""; print ''; print "".$langs->trans("UseACacheDelay").""; -print "global->MAIN_AGENDA_EXPORT_CACHE)."\" size=\"10\">"; +print ""; print " "; print ""; @@ -130,7 +147,7 @@ print ""; print ''; print ''.$langs->trans("FixTZ").""; print ""; -print ''; +print ''; print '   '.$langs->trans("FillThisOnlyIfRequired"); print ""; print ""; diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index e12848e3de1..a19ffa17b49 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -42,7 +42,7 @@ $arrayofparameters = array( 'DAV_RESTICT_ON_IP'=>array('css'=>'minwidth200', 'enabled'=>1), 'DAV_ALLOW_PRIVATE_DIR'=>array('css'=>'minwidth200', 'enabled'=>2), 'DAV_ALLOW_PUBLIC_DIR'=>array('css'=>'minwidth200', 'enabled'=>1), - 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>$conf->ecm->enabled) + 'DAV_ALLOW_ECM_DIR'=>array('css'=>'minwidth200', 'enabled'=>! empty($conf->ecm->enabled)) ); // To fix when dire does not exists @@ -123,6 +123,10 @@ if ($action == 'edit') { print ''.$langs->trans("Parameter").''.$langs->trans("Value").''; foreach ($arrayofparameters as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) { + continue; + } + print ''; $tooltiphelp = (($langs->trans($key.'Tooltip') != $key.'Tooltip') ? $langs->trans($key.'Tooltip') : ''); $label = $langs->trans($key); diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index ae269492ddf..756484289aa 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -323,7 +323,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -661,12 +661,14 @@ if (!empty($conf->banque->enabled)) { } print ""; +$FACTURE_CHQ_NUMBER = getDolGlobalInt('FACTURE_CHQ_NUMBER'); + print ''; print "".$langs->trans("SuggestPaymentByChequeToAddress").""; print ""; print '', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -84,17 +84,17 @@ class mod_facture_mercure extends ModeleNumRefFactures // Prefix setting of replacement invoices $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceReplacement").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of credit note $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; // Prefix setting of deposit $texte .= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= ''; $texte .= ''; @@ -136,23 +136,20 @@ class mod_facture_mercure extends ModeleNumRefFactures */ public function getNextValue($objsoc, $invoice, $mode = 'next') { - global $db, $conf; + global $db; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Get Mask value $mask = ''; if (is_object($invoice) && $invoice->type == 1) { - $mask = $conf->global->FACTURE_MERCURE_MASK_REPLACEMENT; - if (!$mask) { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; - } + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_REPLACEMENT', getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE')); } elseif (is_object($invoice) && $invoice->type == 2) { - $mask = $conf->global->FACTURE_MERCURE_MASK_CREDIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_CREDIT'); } elseif (is_object($invoice) && $invoice->type == 3) { - $mask = $conf->global->FACTURE_MERCURE_MASK_DEPOSIT; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_DEPOSIT'); } else { - $mask = $conf->global->FACTURE_MERCURE_MASK_INVOICE; + $mask = getDolGlobalString('FACTURE_MERCURE_MASK_INVOICE'); } if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 958074202fe..d59d7c47f6f 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -61,7 +61,7 @@ class mod_payment_ant extends ModeleNumRefPayments */ public function info() { - global $db, $conf, $langs; + global $db, $langs; $langs->load("bills"); @@ -82,7 +82,7 @@ class mod_payment_ant extends ModeleNumRefPayments // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -128,7 +128,7 @@ class mod_payment_ant extends ModeleNumRefPayments require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // We get cursor rule - $mask = $conf->global->PAYMENT_ANT_MASK; + $mask = getDolGlobalString('PAYMENT_ANT_MASK'); if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 66e2f3c8312..ab03b04b86e 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -117,13 +117,16 @@ class doc_generic_proposal_odt extends ModelePDFPropales $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('PROPALE_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= '
'; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -133,7 +136,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->PROPALE_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -159,7 +162,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,7 +170,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->PROPALE_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -184,26 +187,26 @@ class doc_generic_proposal_odt extends ModelePDFPropales $texte .= '
'; // Set default template for different status of proposal - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFPropales::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->PROPALE_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->PROPALE_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('PROPALE_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 04f6ed49012..0cfcd91a350 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -118,13 +118,16 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -168,7 +171,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal // Scan directories $nbofiles = count($listoffiles); - if (!empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_PATH)) { + if (!empty($odtPath)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '; //$texte.=$nbofiles?'':''; $texte .= count($listoffiles); @@ -184,26 +187,26 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } $texte .= '
'; - if ($conf->global->MAIN_SUPPLIER_PROPOSAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFSupplierProposal::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelSupplierProposalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelSupplierProposalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index e7db54062cb..99a05e12e4d 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -64,7 +64,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal */ public function info() { - global $conf, $langs, $db; + global $langs, $db; $langs->load("bills"); @@ -83,9 +83,11 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal $tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("CommRequest"), $langs->transnoentities("CommRequest")); $tooltip .= $langs->trans("GenericMaskCodes5"); + $mask = dolGetGlobalString('SUPPLIER_PROPOSAL_SAPHIR_MASK'); + // Parametrage du prefix $texte .= ''.$langs->trans("Mask").':'; - $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; + $texte .= ''.$form->textwithpicto('', $tooltip, 1, 1).''; $texte .= '  '; @@ -131,7 +133,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // On defini critere recherche compteur - $mask = $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; + $mask = empty($conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK) ? '' : $conf->global->SUPPLIER_PROPOSAL_SAPHIR_MASK; if (!$mask) { $this->error = 'NotConfigured'; diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 656eb88ecaa..aa068a162e2 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -115,13 +115,16 @@ class doc_generic_user_odt extends ModelePDFUser $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USER_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -131,7 +134,7 @@ class doc_generic_user_odt extends ModelePDFUser // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USER_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -157,7 +160,7 @@ class doc_generic_user_odt extends ModelePDFUser $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -167,26 +170,26 @@ class doc_generic_user_odt extends ModelePDFUser if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if (!empty($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT)) { + if ($odtChosen) { // Model for creation $list = ModelePDFUser::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USER_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USER_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USER_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USER_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USER_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USER_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index e1c83023df9..e1e5238cb89 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -118,13 +118,16 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $form = new Form($this->db); + $odtChosen = getDolGlobalInt('MAIN_PROPAL_CHOOSE_ODT_DOCUMENT') > 0; + $odtPath = trim(getDolGlobalString('USERGROUP_ADDON_PDF_ODT_PATH')); + $texte = $this->description.".
\n"; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; $texte .= ''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { $texte .= ''; $texte .= ''; $texte .= ''; @@ -134,7 +137,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup // List of directories area $texte .= ''; $texttitle = $langs->trans("ListOfDirectories"); - $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', trim($conf->global->USERGROUP_ADDON_PDF_ODT_PATH))); + $listofdir = explode(',', preg_replace('/[\r\n]+/', ',', $odtPath)); $listoffiles = array(); foreach ($listofdir as $key => $tmpdir) { $tmpdir = trim($tmpdir); @@ -160,7 +163,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $texte .= $form->textwithpicto($texttitle, $texthelp, 1, 'help', '', 1); $texte .= '
'; $texte .= ''; $texte .= '
'; $texte .= ''; @@ -170,26 +173,26 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if (count($listofdir)) { $texte .= $langs->trans("NumberOfModelFilesFound").': '.count($listoffiles).''; - if ($conf->global->MAIN_PROPAL_CHOOSE_ODT_DOCUMENT > 0) { + if ($odtChosen) { // Model for creation $list = ModelePDFUserGroup::liste_modeles($this->db); $texte .= ''; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= ''; $texte .= ''; $texte .= '"; $texte .= '
'.$langs->trans("DefaultModelPropalCreate").''; - $texte .= $form->selectarray('value2', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_DEFAULT); + $texte .= $form->selectarray('value2', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_DEFAULT')); $texte .= "
'.$langs->trans("DefaultModelPropalToBill").''; - $texte .= $form->selectarray('value3', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_TOBILL); + $texte .= $form->selectarray('value3', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_TOBILL')); $texte .= "
'.$langs->trans("DefaultModelPropalClosed").''; - $texte .= $form->selectarray('value4', $list, $conf->global->USERGROUP_ADDON_PDF_ODT_CLOSED); + $texte .= $form->selectarray('value4', $list, getDolGlobalString('USERGROUP_ADDON_PDF_ODT_CLOSED')); $texte .= "
'; } diff --git a/htdocs/dav/dav.lib.php b/htdocs/dav/dav.lib.php index 2861b8744bf..9babbabbe83 100644 --- a/htdocs/dav/dav.lib.php +++ b/htdocs/dav/dav.lib.php @@ -54,7 +54,7 @@ function dav_admin_prepare_head() $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php?id='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/admin/dav.php'; $head[$h][1] = $langs->trans("WebDAV"); $head[$h][2] = 'webdav'; $h++; diff --git a/htdocs/includes/tcpdi/tcpdi_parser.php b/htdocs/includes/tcpdi/tcpdi_parser.php index 13e9839f2b4..174c496d4f4 100644 --- a/htdocs/includes/tcpdi/tcpdi_parser.php +++ b/htdocs/includes/tcpdi/tcpdi_parser.php @@ -1365,7 +1365,7 @@ class tcpdi_parser { $obj = $this->getObjectVal($obj); if (isset ($obj[1][1]['/Rotate'])) { $res = $this->getObjectVal($obj[1][1]['/Rotate']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } else { @@ -1373,7 +1373,7 @@ class tcpdi_parser { return false; } else { $res = $this->_getPageRotation($obj[1][1]['/Parent']); - if ($res[0] == PDF_TYPE_OBJECT) + if (isset($res[0]) && $res[0] == PDF_TYPE_OBJECT) return $res[1]; return $res; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b97312859b9..d541f3abce5 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -754,6 +754,8 @@ if (!defined('NOLOGIN')) { $login = ''; } + $dol_authmode = ''; + if ($login) { $dol_authmode = $conf->authmode; // This properties is defined only when logged, to say what mode was successfully used $dol_tz = $_POST["tz"];