diff --git a/ChangeLog b/ChangeLog index 4ae175c119f..95ca60762e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ For users: ---------- NEW: Compatibility with PHP 8.2 NEW: Module for Advanced stock transfert is now stable (#26594) +NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable NEW: Add a confirmation popup when deleting extrafields NEW: Add type 'icon' type for extrafields NEW: Close #20930 Use ajax for state loading after country change @@ -238,6 +239,7 @@ The following changes may create regressions for some external modules, but were * The property ->user_validation to store ID of user validating has been renamed into ->user_validation_id. * The property ->user_creation to store ID of user of creation has been renamed into ->user_creation_id. * The property ->user_modification to store ID of user of modification has been renamed into ->user_modification_id. +* The private array ->status_short, ->statuts and ->status_long are now array ->labelStatusShort and ->labelStatus everywhere. * The duplicate property ->user_creat, ->date_creat, ->date_valid has been removed (use instead user_creation, date_creation, date_validation). * The method get_substitutionarray_shipment_lines() has been removed. Use the generic get_substitutionarray_lines() instead. * The method ProductcustomerPrice->fetch_all_log() has been renamed into camel case ->fetchAllLog() diff --git a/build/patch/README b/build/patch/README index 400fbc4f8d1..ec769bd3d71 100644 --- a/build/patch/README +++ b/build/patch/README @@ -3,9 +3,7 @@ README (English) Building a Patch file ################################################## -This directory contains tools to build a patch -after a developer has made changes on files in its -Dolibarr tree. -The output patch file can then be submited on Dolibarr -dev mailing-list, with explanation on its goal, for -inclusion in main branch. +This directory contains tools to build a patch after a developer has made changes on files in its Dolibarr tree. +The output patch file can then be submited on Dolibarr dev mailing-list, with explanation on its goal, for inclusion in main branch. + +Using this tool is now deprecated. You must use git pull requests to submit contributions. diff --git a/dev/initdata/README b/dev/initdata/README index 97f5f0d3cd7..05a0a164791 100644 --- a/dev/initdata/README +++ b/dev/initdata/README @@ -1,5 +1,7 @@ README ------ -Scripts in this directory can be used to load or purge data of a database instance. +Scripts in this directory can be used to load massive data or purge data of a database instance. WARNING: Some of this script may delete definitely data. + +To init data for a demo, use instead the tool into dev/initdemo diff --git a/dev/skeletons/README.md b/dev/skeletons/README.md index f7346350ac0..13e70f5f5da 100644 --- a/dev/skeletons/README.md +++ b/dev/skeletons/README.md @@ -1 +1 @@ -Files and tools were moved into htdocs/modulebuilder/template \ No newline at end of file +Files and tools of a skeleton to build a module were moved into htdocs/modulebuilder/template \ No newline at end of file diff --git a/dev/tools/rector/.gitignore b/dev/tools/rector/.gitignore index de589999216..a7b82d32838 100644 --- a/dev/tools/rector/.gitignore +++ b/dev/tools/rector/.gitignore @@ -1 +1,2 @@ /test.php +/vendor \ No newline at end of file diff --git a/dev/tools/rector/README.md b/dev/tools/rector/README.md index 2ffa502f383..859f4bf03c0 100644 --- a/dev/tools/rector/README.md +++ b/dev/tools/rector/README.md @@ -3,12 +3,17 @@ #### Installation -run in this folder +Run in this folder +```shell +cd dev/tools/rector +``` +Install rector with composer ```shell composer install ``` - #### Usage + +#### Usage ##### To make changes (Add --dry-run for test mode only) ```shell diff --git a/dev/tools/rector/rector.php b/dev/tools/rector/rector.php index 1597b9bb27f..6b13c2fbf0b 100644 --- a/dev/tools/rector/rector.php +++ b/dev/tools/rector/rector.php @@ -9,6 +9,15 @@ use Rector\Set\ValueObject\LevelSetList; return static function (RectorConfig $rectorConfig): void { $rectorConfig->phpVersion(PhpVersion::PHP_71); //$rectorConfig->indent(' ', 4); + + // Traits seems not supported correctly by rector without declaring them as bootstrapFiles + $arrayoftraitfiles = array( + __DIR__ . '/../../../htdocs/core/class/commonincoterm.class.php', + __DIR__ . '/../../../htdocs/core/class/commonpeople.class.php', + __DIR__ . '/../../../htdocs/core/class/commonsocialnetworks.class.php' + ); + $rectorConfig->bootstrapFiles($arrayoftraitfiles); + $rectorConfig->paths([ __DIR__ . '/../../../htdocs/', __DIR__ . '/../../../scripts/', @@ -33,8 +42,8 @@ return static function (RectorConfig $rectorConfig): void { //$rectorConfig->rule(ReplaceEachAssignmentWithKeyCurrentRector::class); //$rectorConfig->rule(Rector\Php72\Rector\FuncCall\StringifyDefineRector::class); - //$rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class); - //$rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class); + $rectorConfig->rule(Dolibarr\Rector\Renaming\GlobalToFunction::class); + $rectorConfig->rule(Dolibarr\Rector\Renaming\UserRightsToFunction::class); $rectorConfig->rule(Dolibarr\Rector\Renaming\EmptyGlobalToFunction::class); // Add all predefined rules to migrate to up to php 71 diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 7b87db12c32..12bbde95acc 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -684,6 +684,7 @@ if (empty($reshook)) { $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly')); } + $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 9c50f4fec45..242cf6d8752 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -619,7 +619,7 @@ class AccountingJournal extends CommonObject $disposal_amount = $pre_data_info['disposal']['amount']; $disposal_subject_to_vat = $pre_data_info['disposal']['subject_to_vat']; $disposal_date_formatted = dol_print_date($disposal_date, 'day'); - $disposal_vat = $conf->global->ASSET_DISPOSAL_VAT > 0 ? $conf->global->ASSET_DISPOSAL_VAT : 20; + $disposal_vat = getDolGlobalInt('ASSET_DISPOSAL_VAT') > 0 ? $conf->global->ASSET_DISPOSAL_VAT : 20; // Get accountancy codes //--------------------------- diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index cf1d558e3a5..1154f72d91a 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -79,7 +79,7 @@ if (!$sortfield) { $sortfield = "f.datef, f.ref, fd.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7f76f640101..ff6fb6ed315 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -94,7 +94,7 @@ if (!$sortfield) { $sortfield = "f.datef, f.ref, l.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index cf4db1e9d96..386de679504 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -73,7 +73,7 @@ if (!$sortfield) { $sortfield = "erd.date, erd.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 6ba6244e037..11831d7e1ba 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -87,7 +87,7 @@ if (!$sortfield) { $sortfield = "erd.date, erd.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 6b3a833f2d1..0c5be4b49c4 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2019 Alexandre Spangaro + * Copyright (C) 2016-2023 Alexandre Spangaro * Copyright (C) 2019-2021 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -92,7 +92,7 @@ if (isModEnabled('accounting')) { $showtutorial = ''; if (!$helpisexpanded) { - $showtutorial = '
'; + $showtutorial = ''; @@ -146,6 +146,14 @@ if (isModEnabled('accounting')) { print "
\n"; print "
\n"; + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + $step++; + $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}'); + $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'', $s); + print $s; + print "
\n"; + } + $step++; $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}'); $s = str_replace('{s}', ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $s); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index eb109210423..eeeb28d5179 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -5,7 +5,7 @@ * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2022 Open-DSI - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2023 Frédéric France @@ -1065,14 +1065,33 @@ if (empty($action) || $action == 'view') { $desc = ''; - // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
'; + } + } else { + dol_print_error($db); + } + } + + // Bank test $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."bank_account WHERE entity = ".((int) $conf->entity)." AND fk_accountancy_journal IS NULL AND clos=0"; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj->nb > 0) { print '
'.img_warning().' '.$langs->trans("TheJournalCodeIsNotDefinedOnSomeBankAccount"); - $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 9, '{link}'); + $desc = ' : '.$langs->trans("AccountancyAreaDescBank", 6, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("BankAccounts").'', $desc); print $desc; print '
'; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index df1c8bb7e90..39fa8d8e050 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -564,6 +564,25 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
'; + } + } else { + dol_print_error($db); + } + } + // Button to write into Ledger if (!getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print '
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 14f3966902b..214b548949b 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -937,6 +937,25 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
'; + } + } else { + dol_print_error($db); + } + } + // Button to write into Ledger $acctSupplierNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER'), ['','-1']); if ($acctSupplierNotConfigured) { diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index f27d5a8c1bc..9a4e5561f46 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2023 Alexandre Spangaro + * Copyright (C) 2013-2023 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud @@ -994,6 +994,25 @@ if (empty($action) || $action == 'view') { journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); + if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
'; + } + } else { + dol_print_error($db); + } + } + // Button to write into Ledger $acctCustomerNotConfigured = in_array(getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER'), ['','-1']); if ($acctCustomerNotConfigured) { diff --git a/htdocs/accountancy/journal/variousjournal.php b/htdocs/accountancy/journal/variousjournal.php index da5e096be59..f7d1831ee87 100644 --- a/htdocs/accountancy/journal/variousjournal.php +++ b/htdocs/accountancy/journal/variousjournal.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2021-2023 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -214,6 +214,25 @@ $varlink = 'id_journal=' . $id_journal; journalHead($nom, $nomlink, $period, $periodlink, $description, $builddate, $exportlink, array('action' => ''), '', $varlink); +if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') { + // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) + // Fiscal period test + $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."accounting_fiscalyear WHERE entity = ".((int) $conf->entity); + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + if ($obj->nb == 0) { + print '
'.img_warning().' '.$langs->trans("TheFiscalPeriodIsNotDefined"); + $desc = ' : '.$langs->trans("AccountancyAreaDescFiscalPeriod", 4, '{link}'); + $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("FiscalPeriod").'', $desc); + print $desc; + print '
'; + } + } else { + dol_print_error($db); + } +} + if ($object->nature == 4) { // Bank journal // Test that setup is complete (we are in accounting, so test on entity is always on $conf->entity only, no sharing allowed) $sql = "SELECT COUNT(rowid) as nb"; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ab010f11bf8..677e7e23660 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -81,7 +81,7 @@ if (!$sortfield) { $sortfield = "f.datef, f.ref, l.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_DONE') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 616b39e7608..d3f44d69fd9 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -91,7 +91,7 @@ if (!$sortfield) { $sortfield = "f.datef, f.ref, l.rowid"; } if (!$sortorder) { - if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) { + if (getDolGlobalInt('ACCOUNTING_LIST_SORT_VENTILATION_TODO') > 0) { $sortorder = "DESC"; } else { $sortorder = "ASC"; diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 2993006bd91..0ec4a3afdbf 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -271,10 +271,10 @@ foreach ($dirModMember as $dirroot) { } $modCodeMember = new $file; // Show modules according to features level - if ($modCodeMember->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($modCodeMember->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($modCodeMember->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($modCodeMember->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -509,10 +509,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 9c3adf8f75a..fdf566f156b 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -220,7 +220,7 @@ if ($resql) { dol_print_error($db); } -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print load_fiche_titre($langs->trans("AgendaModelModule"), '', ''); print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 4cfb06232ef..dc4c7aa82a8 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -233,6 +233,9 @@ if (!isModEnabled('cron')) { } else { print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } + } else { + $langs->load("cron"); + print ''.$langs->trans("JobNotFound", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } } } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index bf05c79c335..8446510b65b 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -324,10 +324,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index ee65a3d2e89..47e79ab9cc6 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -173,10 +173,10 @@ foreach ($dirbarcode as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index e76e2ad2b85..c0b0e100aea 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -210,10 +210,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -345,10 +345,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index b41ed441a17..15ce18dcd26 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -153,10 +153,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 4bc7c5a2fbc..b0713455ba2 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -294,10 +294,10 @@ foreach ($dirmodels as $reldir) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -428,10 +428,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 5b4de0c787d..02f426575eb 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -51,6 +51,13 @@ if (!$user->admin) { $error = 0; +$tmparraysize = getDefaultImageSizes(); +$maxwidthsmall = $tmparraysize['maxwidthsmall']; +$maxheightsmall = $tmparraysize['maxheightsmall']; +$maxwidthmini = $tmparraysize['maxwidthmini']; +$maxheightmini = $tmparraysize['maxheightmini']; +$quality = $tmparraysize['quality']; + // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('admincompany', 'globaladmin')); @@ -143,6 +150,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) // Create thumbs //$object->addThumbs($newfile); // We can't use addThumbs here yet because we need name of generated thumbs to add them into constants. TODO Check if need such constants. We should be able to retrieve value with get... + // Create small thumb, Used on logon for example $imgThumbSmall = vignette($dirforimage.$original_file, $maxwidthsmall, $maxheightsmall, '_small', $quality); if (image_format_supported($imgThumbSmall) >= 0 && preg_match('/([^\\/:]+)$/i', $imgThumbSmall, $reg)) { diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index ad7b3f5516a..b6f4b698191 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -245,10 +245,10 @@ foreach ($dirmodels as $reldir) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -377,10 +377,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index b53b2f32ac4..91605d3bc58 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -258,10 +258,10 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -387,10 +387,10 @@ if (getDolGlobalString('MAIN_SUBMODULE_DELIVERY')) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 93aa4e89620..2d5a39c1056 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -531,7 +531,7 @@ $tabcond[39] = (isModEnabled("societe") && !getDolGlobalString('SOCIETE_DISABLE_ $tabcond[40] = (isModEnabled("societe") && getDolGlobalString('THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES')); $tabcond[41] = isModEnabled('intracommreport'); $tabcond[42] = isModEnabled("product"); -$tabcond[43] = isModEnabled("product") && isModEnabled('productbatch') && $conf->global->MAIN_FEATURES_LEVEL >= 2; +$tabcond[43] = isModEnabled("product") && isModEnabled('productbatch') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2; $tabcond[44] = isModEnabled('asset'); // List of help for fields (no more used, help is defined into tabcomplete) @@ -662,7 +662,7 @@ if ($id == 11) { 'order_supplier' => img_picto('', 'supplier_order', 'class="pictofixedwidth"').$langs->trans('SupplierOrder'), 'invoice_supplier' => img_picto('', 'supplier_invoice', 'class="pictofixedwidth"').$langs->trans('SupplierBill'), ); - if (getDolGlobalString('MAIN_FEATURES_LEVEL') && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + if (getDolGlobalString('MAIN_FEATURES_LEVEL') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $elementList['conferenceorbooth'] = img_picto('', 'eventorganization', 'class="pictofixedwidth"').$langs->trans('ConferenceOrBooth'); } diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index f0d9ee852bb..70af0940211 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -403,7 +403,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($object->acces_type == 1) { // Mode OAUth2 with PHP-IMAP - require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // define $supportedoauth2array + require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; + + $supportedoauth2array = getSupportedOauth2Array(); + $keyforsupportedoauth2array = $object->oauth_service; if (preg_match('/^.*-/', $keyforsupportedoauth2array)) { $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 4c407e87287..825d175f3ac 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -203,10 +203,10 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -335,10 +335,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 49c40e0a20f..6519299ca69 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -223,10 +223,10 @@ foreach ($dirmodels as $reldir) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -351,10 +351,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 2179da4b6f1..fe3efa95ca4 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -330,10 +330,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -521,10 +521,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 77d1f8a2b60..46fdf1c2eee 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -294,10 +294,10 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -427,10 +427,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 6c95864e027..5c80471846d 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -204,10 +204,10 @@ foreach ($dirmodels as $reldir) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -281,7 +281,7 @@ print '
'; * Documents models for Holidays */ -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print load_fiche_titre($langs->trans("TemplatePDFHolidays"), '', ''); // Defined model definition table @@ -341,10 +341,10 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } @@ -525,7 +525,7 @@ if ($conf->use_javascript_ajax) { print ""; print ""; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $substitutionarray = pdf_getSubstitutionArray($langs, array('objectamount'), null, 2); $substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation"); $htmltext = ''.$langs->trans("AvailableVariables").':
'; diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 057fb8e4633..bac017c43b0 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -248,10 +248,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -386,10 +386,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 3cccf92a781..a9a6afa7952 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -374,10 +374,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -511,10 +511,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 30c2d663119..2ca03d168cb 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -190,7 +190,7 @@ print '
'; print ''; -if (!empty($conf->use_javascript_ajax) && $conf->global->MAIN_FEATURES_LEVEL >= 1) { +if (!empty($conf->use_javascript_ajax) && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { print ''; // Host server - print ''; + print ''; if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') { print ''; // Port - print ''; } + // TLS - print ''; // STARTTLS - print ''; // SMTP_ALLOW_SELF_SIGNED - print ''; // From - $help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); - print ''; + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; print ''; @@ -701,7 +705,7 @@ if ($action == 'edit') { // Host server if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { - print ''; + //print ''; } else { print ''; } @@ -709,7 +713,7 @@ if ($action == 'edit') { // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { - print ''; + //print ''; } else { print ''; } @@ -741,44 +745,55 @@ if ($action == 'edit') { } // TLS - print ''; } - print ''; // STARTTLS - print ''; } - print ''; // SMTP_ALLOW_SELF_SIGNED - print ''; } - print ''; - if (getDolGlobalString('MAIN_MAIL_SENDMODE') == 'swiftmailer') { // DKIM @@ -830,8 +845,11 @@ if ($action == 'edit') { print ''; // From - $help = img_help(1, $langs->trans("EMailHelpMsgSPFDKIM")); - print ''; + $help = $form->textwithpicto('', $langs->trans("EMailHelpMsgSPFDKIM")); + print ''; print ''; // STARTTLS - print ''; // SMTP_ALLOW_SELF_SIGNED_EMAILING - print ''; + //print ''; } else { print ''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { - print ''; + //print ''; } else { print ''; } @@ -575,45 +574,56 @@ if ($action == 'edit') { print ''; } - // TLS - print ''; } - print ''; // STARTTLS - print ''; } - print ''; // SMTP_ALLOW_SELF_SIGNED_EMAILING - print ''; } - print ''; } print '
'; print $langs->trans("MailAdvTargetRecipients").''; print ajax_constantonoff('EMAILING_USE_ADVANCED_SELECTOR'); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 198c5a6ccbb..04a3e63e150 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -397,7 +397,7 @@ if ($action == 'edit') { print '
'; print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -431,7 +431,7 @@ if ($action == 'edit') { print '
'; + print '
'; if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print ''; @@ -529,8 +529,9 @@ if ($action == 'edit') { } print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_TLS', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS') ? $conf->global->MAIN_MAIL_EMAIL_TLS : 0), 1); @@ -543,7 +544,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS : 0), 1); @@ -556,7 +557,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; if (!empty($conf->use_javascript_ajax) || (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED : 0), 1); @@ -604,8 +605,11 @@ if ($action == 'edit') { print '
'.$langs->trans("OtherOptions").'
'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER') ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT') ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_TLS); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_TLS); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + //print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; + if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail'), array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("OtherOptions").'
'.$langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")).' '.$help.'
'; + print $langs->trans("MAIN_MAIL_EMAIL_FROM", ini_get('sendmail_from') ?ini_get('sendmail_from') : $langs->transnoentities("Undefined")); + print ' '.$help; + print '' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); if (!getDolGlobalString('MAIN_MAIL_EMAIL_FROM')) { print img_warning($langs->trans("Mandatory")); @@ -991,7 +1009,7 @@ if ($action == 'edit') { } $companyemail = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); $dnsinfo = false; - if (!empty($companyemail) && function_exists('dns_get_record') && empty($conf->global->MAIN_DISABLE_DNS_GET_RECORD)) { + if (!empty($companyemail) && function_exists('dns_get_record') && !getDolGlobalString('MAIN_DISABLE_DNS_GET_RECORD')) { $arrayofemailparts = explode('@', $companyemail); if (count($arrayofemailparts) == 2) { $domain = $arrayofemailparts[1]; diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 1616019be11..498c5cc6173 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -49,7 +49,6 @@ $substitutionarrayfortest = array( '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails '__ID__' => 'RecipientIdRecord', //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails - '__LOGIN__' => $user->login, '__LASTNAME__' => 'RecipientLastname', '__FIRSTNAME__' => 'RecipientFirstname', '__ADDRESS__'=> 'RecipientAddress', @@ -368,7 +367,7 @@ if ($action == 'edit') { // Port - print '
'; + print '
'; if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print ''; @@ -398,7 +397,7 @@ if ($action == 'edit') { // AUTH method if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { - print '
'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; + print '
'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case) print ' '; @@ -479,7 +478,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1); @@ -492,7 +491,7 @@ if ($action == 'edit') { print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1); @@ -537,14 +536,14 @@ if ($action == 'edit') { if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { // Host server if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'mail')) { - print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_EMAILING') ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'
'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING").''.$text.'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING')); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING')); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'; diff --git a/htdocs/admin/mails_ticket.php b/htdocs/admin/mails_ticket.php index 9df2ea2f37b..a40d1e9e7a3 100644 --- a/htdocs/admin/mails_ticket.php +++ b/htdocs/admin/mails_ticket.php @@ -43,19 +43,29 @@ if ($action == 'test' || $action == 'send') { $substitutionarrayfortest = array( '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT, '__ID__' => 'TESTIdRecord', - '__EMAIL__' => 'TESTEMail', - '__LOGIN__' => $user->login, - '__LASTNAME__' => 'TESTLastname', - '__FIRSTNAME__' => 'TESTFirstname', + '__USER_LOGIN__' => $user->login, + '__USER_EMAIL__' => $user->email, + '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails + '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails + '__LASTNAME__' => 'RecipientLastname', + '__FIRSTNAME__' => 'RecipientFirstname', '__ADDRESS__'=> 'RecipientAddress', '__ZIP__'=> 'RecipientZip', '__TOWN_'=> 'RecipientTown', - '__COUNTRY__'=> 'RecipientCountry', - '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), - '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails + '__COUNTRY__'=> 'RecipientCountry' ); complete_substitutions_array($substitutionarrayfortest, $langs); +// List of sending methods +$listofmethods = array(); +$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup'); +$listofmethods['mail'] = 'PHP mail function'; +//$listofmethods['simplemail']='Simplemail class'; +$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; +if (version_compare(phpversion(), '7.0', '>=')) { + $listofmethods['swiftmailer'] = 'Swift Mailer socket library'; +} + // Security check if (!$user->admin) { accessforbidden(); @@ -142,16 +152,6 @@ print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup'); $head = email_admin_prepare_head(); -// List of sending methods -$listofmethods = array(); -$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup'); -$listofmethods['mail'] = 'PHP mail function'; -//$listofmethods['simplemail']='Simplemail class'; -$listofmethods['smtps'] = 'SMTP/SMTPS socket library'; -if (version_compare(phpversion(), '7.0', '>=')) { - $listofmethods['swiftmailer'] = 'Swift Mailer socket library'; -} - // List of oauth services $oauthservices = array(); @@ -306,7 +306,7 @@ if ($action == 'edit') { print ''.$langs->trans("MAIN_MAIL_SENDMODE").''; // SuperAdministrator access only - if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { + if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_TICKET); } else { $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')]; @@ -343,6 +343,7 @@ if ($action == 'edit') { print ''; print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; + print ' ' . $langs->trans("SeeLinkToOnlineDocumentation") . ''; } else { $text = !empty($mainserver) ? $mainserver : $smtpserver; $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -355,7 +356,7 @@ if ($action == 'edit') { // Port - print ''; + print ''; if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') { print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); print ''; @@ -385,7 +386,7 @@ if ($action == 'edit') { // AUTH method if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { - print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; + print ''.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").''; if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) { // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case) print ' '; @@ -466,7 +467,7 @@ if ($action == 'edit') { // STARTTLS - print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + print ''.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) { if (function_exists('openssl_open')) { print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET : 0), 1); @@ -491,6 +492,7 @@ if ($action == 'edit') { print ''.$langs->trans("EMailsDesc")."
\n"; print "

\n"; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; @@ -510,14 +512,14 @@ if ($action == 'edit') { if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && $conf->global->MAIN_MAIL_SENDMODE_TICKET != 'default') { // Host server if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { - print ''; + //print ''; } else { print ''; } // Port if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) { - print ''; + //print ''; } else { print ''; } @@ -549,33 +551,42 @@ if ($action == 'edit') { } // TLS - print ''; } - print ''; // STARTTLS - print ''; } - print ''; } print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').'
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_TLS_TICKET); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_TLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_TLS_TICKET); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; - if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { - if (function_exists('openssl_open')) { - print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET); - } else { - print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; - } + if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) { + // Nothing } else { - print yn(0).' ('.$langs->trans("NotSupported").')'; + print '
'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").''; + if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) { + if (function_exists('openssl_open')) { + print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET); + } else { + print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')'; + } + } else { + print ''.yn(0).' ('.$langs->trans("NotSupported").')'; + } + print '
'; + print '
'; print dol_get_fiche_end(); @@ -663,6 +674,8 @@ if ($action == 'edit') { $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM); $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test"); + $formmail->fromid = $user->id; + $formmail->fromalsorobot = 1; $formmail->withfromreadonly = 0; $formmail->withsubstit = 0; $formmail->withfrom = 1; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 168e6367fcc..40692a4e25a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -615,10 +615,10 @@ if ($mode == 'common' || $mode == 'commonkanban') { if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) { $array_version['deprecated'] = $langs->trans("Deprecated"); } - if ($conf->global->MAIN_FEATURES_LEVEL > 0) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) { $array_version['experimental'] = $langs->trans("Experimental"); } - if ($conf->global->MAIN_FEATURES_LEVEL > 1) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 1) { $array_version['development'] = $langs->trans("Development"); } $moreforfilter .= '
'; @@ -1106,7 +1106,7 @@ if ($mode == 'marketplace') { print '
'; - if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && $conf->global->MAIN_FEATURES_LEVEL >= 1) { + if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { // $options is array with filter criterias //var_dump($options); $dolistore->getRemoteCategories(); diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 29cb7215301..d46cd0de1a5 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -209,10 +209,10 @@ foreach ($dirmodels as $reldir) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -341,10 +341,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 8c10988bcff..e7b7dac592a 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -29,7 +29,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; -// $supportedoauth2array is defined into oauth.lib.php +$supportedoauth2array = getSupportedOauth2Array(); // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -234,6 +234,8 @@ print ''.$langs->trans("ListOfSupportedOauthProvider print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 413b57c9694..98f7b8d2a9e 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -26,10 +26,13 @@ // Load Dolibarr environment require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // This define $list and $supportedoauth2array +require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + use OAuth\Common\Storage\DoliStorage; +$supportedoauth2array = getSupportedOauth2Array(); + // Load translation files required by the page $langs->loadLangs(array('admin', 'printing', 'oauth')); diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 368fa77ea54..c3be4407da3 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -156,10 +156,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index d999b91d32f..30950eae177 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -543,7 +543,7 @@ if (isModEnabled('barcode')) { if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE'); } else { - print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE', (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE)) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE : 0, 1); + print $form->selectyesno('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE', (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE')) ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_PRODUCT_BARCODE : 0, 1); } print ''; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 8b2bb5ec69a..b12c287fcd5 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -283,10 +283,10 @@ foreach ($dirmodels as $reldir) { $module = new $file; // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -415,10 +415,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 6dbe620f6e5..91a99e08bd5 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -209,10 +209,10 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -345,10 +345,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if (isset($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if (isset($module->version) && $module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if (isset($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if (isset($module->version) && $module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 584df5c3f1e..23f7a6d0aca 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -225,10 +225,10 @@ $tabConf = explode(";", getDolGlobalString('USER_PASSWORD_PATTERN')); foreach ($arrayhandler as $key => $module) { // Show modules according to features level - if (!empty($module->version) && $module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if (!empty($module->version) && $module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if (!empty($module->version) && $module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if (!empty($module->version) && $module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index ed467db1b97..3ceb0ecafa3 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -583,10 +583,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php index 11a5cc37b9e..48ab469f31c 100644 --- a/htdocs/admin/stocktransfer.php +++ b/htdocs/admin/stocktransfer.php @@ -265,8 +265,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue; + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue; if ($module->isEnabled()) { dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php'); @@ -393,8 +393,8 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified = 0; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified = 0; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) $modulequalified = 0; + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) $modulequalified = 0; if ($modulequalified) { print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 4f53b8f9e4f..2ff0d97100e 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -237,10 +237,10 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index e8b8fed3aba..19a73554538 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -253,10 +253,10 @@ foreach ($dirmodels as $reldir) { if ($module->isEnabled()) { // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 436513ab31d..4b0fb00fbd0 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -229,10 +229,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 732a7672a92..78eade98348 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -262,10 +262,10 @@ foreach ($dirmodels as $reldir) { $module = new $file; // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -393,10 +393,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 8fd733e3046..8b30f279e67 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -64,10 +64,10 @@ foreach ($dirsyslogs as $reldir) { $module = new $file; // Show modules according to features level - if ($module->getVersion() == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->getVersion() == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->getVersion() == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->getVersion() == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index d4ba12b3f43..e78d85ec6f5 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -209,7 +209,7 @@ if (empty($mysoc->tva_assuj)) { print ' '.$langs->trans('OptionVATDebitOption').''; print ''.nl2br($langs->trans('OptionVatDebitOptionDesc'))."\n"; // On payment for both products and services - if ($conf->global->MAIN_FEATURES_LEVEL >= 1) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) { print ' '.$langs->trans('OptionPaymentForProductAndServices').''; print ''.nl2br($langs->trans('OptionPaymentForProductAndServicesDesc'))."\n"; } diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 7dd93c2f49f..2fa535258c1 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -87,7 +87,7 @@ if ($action == 'updateMask') { } elseif (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $value = GETPOSTISSET($code) ? GETPOST($code, 'int') : 1; - if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && $conf->global->MAIN_FEATURES_LEVEL >= 2) { + if ($code == 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS' && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -219,7 +219,7 @@ if ($action == 'updateMask') { } // For compatibility when javascript is not enabled - if ($conf->global->MAIN_FEATURES_LEVEL >= 2 && empty($conf->use_javascript_ajax)) { + if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 && empty($conf->use_javascript_ajax)) { $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); if (!($res > 0)) { @@ -291,11 +291,11 @@ foreach ($dirmodels as $reldir) { $module = new $file; // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -424,10 +424,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } @@ -674,7 +674,7 @@ print ''; print ''; // Also send to TICKET_NOTIFICATION_EMAIL_TO for responses (not only creation) -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) { print ''.$langs->trans("TicketsEmailAlsoSendToMainAddress").''; print ''; if ($conf->use_javascript_ajax) { diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 8bd502a84d1..0de6eafd429 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -247,10 +247,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index ff2a1a180fe..079eda47aa2 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -170,10 +170,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 8e978a30621..6051bc6b8da 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -416,10 +416,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -553,10 +553,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index c9c1a8db983..0d24cd0d598 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -261,10 +261,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -399,10 +399,10 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index fbd57d7afc3..868b03304e5 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -179,11 +179,6 @@ class DolibarrApi unset($object->alreadypaid); unset($object->openid); - unset($object->statuts); - unset($object->statuts_short); - unset($object->statuts_logo); - unset($object->statuts_long); - //unset($object->labelStatus); //unset($object->labelStatusShort); diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index 9c45d29cf79..414ec11fb5a 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -48,7 +48,7 @@ $thirdpartytmp = new Societe($db); $modBarCodeProduct = ''; $modBarCodeThirdparty = ''; -$maxperinit = empty($conf->global->BARCODE_INIT_MAX) ? 1000 : $conf->global->BARCODE_INIT_MAX; +$maxperinit = !getDolGlobalString('BARCODE_INIT_MAX') ? 1000 : $conf->global->BARCODE_INIT_MAX; // Security check (enable the most restrictive one) //if ($user->socid > 0) accessforbidden(); @@ -67,7 +67,7 @@ if (empty($user->admin)) { */ // Define barcode template for third-party -if (!empty($conf->global->BARCODE_THIRDPARTY_ADDON_NUM)) { +if (getDolGlobalString('BARCODE_THIRDPARTY_ADDON_NUM')) { $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); foreach ($dirbarcodenum as $dirroot) { @@ -167,7 +167,7 @@ if ($action == 'initbarcodethirdparties') { } // Define barcode template for products -if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { +if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { $dirbarcodenum = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); foreach ($dirbarcodenum as $dirroot) { diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index f257c26196c..ca8be4d2ed5 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -83,7 +83,7 @@ if (GETPOST('submitproduct') && GETPOST('submitproduct')) { $forbarcode = $producttmp->barcode; $fk_barcode_type = $producttmp->barcode_type; - if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } @@ -99,7 +99,7 @@ if (GETPOST('submitthirdparty') && GETPOST('submitthirdparty')) { $forbarcode = $thirdpartytmp->barcode; $fk_barcode_type = $thirdpartytmp->barcode_type_code; - if (empty($fk_barcode_type) && !empty($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY)) { + if (empty($fk_barcode_type) && getDolGlobalString('GENBARCODE_BARCODETYPE_THIRDPARTY')) { $fk_barcode_type = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; } @@ -213,12 +213,12 @@ if ($action == 'builddoc') { // For labels if ($mode == 'label') { $txtforsticker = "%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator - $textleft = make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT) ? $txtforsticker : $conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray); - $textheader = make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT) ? '' : $conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray); - $textfooter = make_substitutions((empty($conf->global->BARCODE_LABEL_FOOTER_TEXT) ? '' : $conf->global->BARCODE_LABEL_FOOTER_TEXT), $substitutionarray); - $textright = make_substitutions((empty($conf->global->BARCODE_LABEL_RIGHT_TEXT) ? '' : $conf->global->BARCODE_LABEL_RIGHT_TEXT), $substitutionarray); - $forceimgscalewidth = (empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH); - $forceimgscaleheight = (empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT) ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT); + $textleft = make_substitutions((!getDolGlobalString('BARCODE_LABEL_LEFT_TEXT') ? $txtforsticker : $conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray); + $textheader = make_substitutions((!getDolGlobalString('BARCODE_LABEL_HEADER_TEXT') ? '' : $conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray); + $textfooter = make_substitutions((!getDolGlobalString('BARCODE_LABEL_FOOTER_TEXT') ? '' : $conf->global->BARCODE_LABEL_FOOTER_TEXT), $substitutionarray); + $textright = make_substitutions((!getDolGlobalString('BARCODE_LABEL_RIGHT_TEXT') ? '' : $conf->global->BARCODE_LABEL_RIGHT_TEXT), $substitutionarray); + $forceimgscalewidth = (!getDolGlobalString('BARCODE_FORCEIMGSCALEWIDTH') ? 1 : $conf->global->BARCODE_FORCEIMGSCALEWIDTH); + $forceimgscaleheight = (!getDolGlobalString('BARCODE_FORCEIMGSCALEHEIGHT') ? 1 : $conf->global->BARCODE_FORCEIMGSCALEHEIGHT); $MAXSTICKERS = 1000; if ($numberofsticker <= $MAXSTICKERS) { diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 54737ff96af..4976d63ff01 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -117,7 +117,7 @@ print $langs->trans("CompanyInitialKey").''; print $block_static->getSignature(); print ''; -if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) { +if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY')) { // Example with a yes / no select print ''; print ''.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).''; @@ -155,7 +155,7 @@ if ($resql) { } } -$seledted = empty($conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY) ? array() : explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY); +$seledted = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', $conf->global->BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY); print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $seledted); print ''; diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index d19019ae99f..cc13b072507 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -104,7 +104,7 @@ $block_static->loadTrackedEvents(); $result = restrictedArea($user, 'blockedlog', 0, ''); // Execution Time -$max_execution_time_for_importexport = (empty($conf->global->EXPORT_MAX_EXECUTION_TIME) ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined +$max_execution_time_for_importexport = (!getDolGlobalString('EXPORT_MAX_EXECUTION_TIME') ? 300 : $conf->global->EXPORT_MAX_EXECUTION_TIME); // 5mn if not defined $max_time = @ini_get("max_execution_time"); if ($max_time && $max_time < $max_execution_time_for_importexport) { dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_importexport=".$max_execution_time_for_importexport.". We try to increase it dynamically."); @@ -394,7 +394,7 @@ print $retstring; print ''; print ''; print ''; -if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) { +if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY')) { print ' | '.$langs->trans('DownloadBlockChain').''; } print '

'; @@ -506,7 +506,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { } print ''; -if (!empty($conf->global->BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR)) { +if (getDolGlobalString('BLOCKEDLOG_SCAN_ALL_FOR_LOWERIDINERROR')) { // This is version that is faster but require more memory and report errors that are outside the filter range // TODO Make a full scan of table in reverse order of id of $block, so we can use the parameter $previoushash into checkSignature to save requests @@ -625,7 +625,7 @@ if (is_array($blocks)) { } } - if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { + if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { print ' '.($block->certified ? img_picto($langs->trans('AddedByAuthority'), 'info') : img_picto($langs->trans('NotAddedByAuthorityYet'), 'info_black')); } print ''; @@ -682,7 +682,7 @@ jQuery(document).ready(function () { '."\n"; -if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY) && !empty($conf->global->BLOCKEDLOG_AUTHORITY_URL)) { +if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY') && getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL')) { ?> '."\n"; } @@ -1800,7 +1806,7 @@ if ($id > 0) { if ($backtopage) { print ''; } - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && ! preg_match('/^TICKET_MSG_PRIVATE/', $object->code)) { print ''; } @@ -1812,7 +1818,7 @@ if ($id > 0) { print ''.$langs->trans("Ref").''.$object->id.''; // Type of event - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $object->elementtype != "ticket") { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && $object->elementtype != "ticket") { print ''.$langs->trans("Type").''; if ($object->type_code != 'AC_OTH_AUTO') { print img_picto($langs->trans("ActionType"), 'square', 'class="fawidth30 inline-block" style="color: #ddd;"'); @@ -1833,7 +1839,7 @@ if ($id > 0) { } // Title - print 'global->AGENDA_USE_EVENT_TYPE) ? ' class="fieldrequired titlefieldcreate"' : '').'>'.$langs->trans("Title").''; + print ''.$langs->trans("Title").''; // Full day event print ''.$langs->trans("Date").'fulldayevent ? ' checked' : '').'>'; @@ -1970,14 +1976,14 @@ if ($id > 0) { print ''; // Realised by - if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) { + if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { print ''.$langs->trans("ActionDoneBy").''; print $form->select_dolusers($object->userdoneid > 0 ? $object->userdoneid : -1, 'doneby', 1); print ''; } // Location - if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { + if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''.$langs->trans("Location").''; } @@ -2025,7 +2031,7 @@ if ($id > 0) { // related contact print ''.$langs->trans("ActionOnContact").''; print '
'; - print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(empty($conf->global->MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT) ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'minwidth300 widthcentpercentminusx', false, 0, 0, array(), 'multiple', 'contactid'); + print img_picto('', 'contact', 'class="paddingrightonly"').$form->selectcontacts(!getDolGlobalString('MAIN_ACTIONCOM_CAN_ADD_ANY_CONTACT') ? $object->socid : 0, array_keys($object->socpeopleassigned), 'socpeopleassigned[]', 1, '', '', 1, 'minwidth300 widthcentpercentminusx', false, 0, 0, array(), 'multiple', 'contactid'); print '
'; print ''; print ''; @@ -2045,7 +2051,7 @@ if ($id > 0) { } // Priority - if (!empty($conf->global->AGENDA_SUPPORT_PRIORITY_IN_EVENTS)) { + if (getDolGlobalString('AGENDA_SUPPORT_PRIORITY_IN_EVENTS')) { print ''.$langs->trans("Priority").''; print ''; print ''; @@ -2295,7 +2301,7 @@ if ($id > 0) { print ''; // Type - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { print ''; // Location - if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { + if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; } @@ -2395,7 +2401,7 @@ if ($id > 0) { print ' '; // Done by - if (!empty($conf->global->AGENDA_ENABLE_DONEBY)) { + if (getDolGlobalString('AGENDA_ENABLE_DONEBY')) { print '
'.$langs->trans("Type").''; print $object->getTypePicto(); print $langs->trans("Action".$object->type_code); @@ -2311,7 +2317,7 @@ if ($id > 0) { } $rowspan = 4; - if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { + if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { $rowspan++; } @@ -2347,7 +2353,7 @@ if ($id > 0) { print '
'.$langs->trans("Location").''.$object->location.'
'.$langs->trans("ActionDoneBy").''; if ($object->userdoneid > 0) { $tmpuser = new User($db); @@ -2504,7 +2510,7 @@ if ($id > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Reminders - if (!empty($conf->global->AGENDA_REMINDER_EMAIL) || !empty($conf->global->AGENDA_REMINDER_BROWSER)) { + if (getDolGlobalString('AGENDA_REMINDER_EMAIL') || getDolGlobalString('AGENDA_REMINDER_BROWSER')) { $filteruserid = $user->id; if ($user->hasRight('agenda', 'allactions', 'read')) { $filteruserid = 0; @@ -2584,7 +2590,7 @@ if ($id > 0) { print ''; if ($action != 'edit') { - if (empty($conf->global->AGENDA_DISABLE_BUILDDOC)) { + if (!getDolGlobalString('AGENDA_DISABLE_BUILDDOC')) { print '
'; print ''; // ancre diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index f2eaaa62881..8ff62337508 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -291,7 +291,7 @@ class ActionComm extends CommonObject public $fk_element; // Id of record /** - * @var int Id of record alternative for API + * @var int Id of linked object, alternative for API or other */ public $elementid; @@ -435,7 +435,7 @@ class ActionComm extends CommonObject // Check parameters if (!isset($this->userownerid) || (string) $this->userownerid === '') { // $this->userownerid may be 0 (anonymous event) or > 0 - dol_syslog("You tried to create an event but mandatory property ownerid was not defined", LOG_WARNING); + dol_syslog("You tried to create an event but mandatory property userownerid was empty (you can define it to 0 for anonymous event)", LOG_WARNING); $this->errors[] = 'ErrorActionCommPropertyUserowneridNotDefined'; return -1; } @@ -481,6 +481,9 @@ class ActionComm extends CommonObject if ($this->elementtype == 'contrat') { $this->elementtype = 'contract'; } + if (empty($this->fk_element) && !empty($this->elementid)) { + $this->fk_element = $this->elementid; + } if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead of an array $tmpid = (int) $this->userassigned; @@ -1597,7 +1600,7 @@ class ActionComm extends CommonObject $langs->load("commercial"); $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code) ? $langs->transnoentities("Action".$this->type_code) : $this->type_label; } - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($this->type_code != 'AC_OTH_AUTO') { $labeltype = $langs->trans('ActionAC_MANUAL'); } @@ -1701,7 +1704,7 @@ class ActionComm extends CommonObject $langs->load("commercial"); $labeltype = ($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code) ? $langs->transnoentities("Action".$this->type_code) : $this->type_label; } - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($this->type_code != 'AC_OTH_AUTO') { $labeltype = $langs->trans('ActionAC_MANUAL'); } @@ -1762,7 +1765,7 @@ class ActionComm extends CommonObject //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) // $linkclose = ' style="background-color:#'.$this->type_color.'"'; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowAction"); $linkclose .= ' alt="'.dol_escape_htmltag($tooltip, 1).'"'; } @@ -1802,12 +1805,12 @@ class ActionComm extends CommonObject } if ($withpicto == 2) { - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { $label = $labeltype; } $labelshort = ''; } else { - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($label)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($label)) { $label = $labeltype; } if ($maxlength < 0) { @@ -1818,7 +1821,7 @@ class ActionComm extends CommonObject } if ($withpicto) { - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { // Add code into () + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { // Add code into () if ($labeltype) { $label .= (preg_match('/'.preg_quote($labeltype, '/').'/', $label) ? '' : ' ('.$langs->transnoentities("Action".$this->type_code).')'); } @@ -1857,7 +1860,7 @@ class ActionComm extends CommonObject global $conf; $imgpicto = ''; - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { $color = ''; if ($this->type_color) { $color = 'style="color: #'.$this->type_color.' !important;"'; @@ -2122,11 +2125,11 @@ class ActionComm extends CommonObject $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type'] = $type; - $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $datestart = $this->db->jdate($obj->datep) - (!getDolGlobalString('AGENDA_EXPORT_FIX_TZ') ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered if (is_numeric($this->db->jdate($obj->datep2))) { - $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $dateend = $this->db->jdate($obj->datep2) - (!getDolGlobalString('AGENDA_EXPORT_FIX_TZ') ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); } else { // use start date as fall-back to avoid pb with empty end date on ICS readers $dateend = $datestart; @@ -2152,8 +2155,8 @@ class ActionComm extends CommonObject //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current $url = $urlwithroot.'/comm/action/card.php?id='.$obj->id; $event['url'] = $url; - $event['created'] = $this->db->jdate($obj->datec) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); - $event['modified'] = $this->db->jdate($obj->datem) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $event['created'] = $this->db->jdate($obj->datec) - (!getDolGlobalString('AGENDA_EXPORT_FIX_TZ') ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $event['modified'] = $this->db->jdate($obj->datem) - (!getDolGlobalString('AGENDA_EXPORT_FIX_TZ') ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); $event['num_vote'] = $this->num_vote; $event['event_paid'] = $this->event_paid; $event['status'] = $this->status; @@ -2225,7 +2228,7 @@ class ActionComm extends CommonObject $timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0); } - if (!empty($conf->global->AGENDA_EXPORT_FIX_TZ)) { + if (getDolGlobalString('AGENDA_EXPORT_FIX_TZ')) { $timestampStart = $timestampStart - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600); $timestampEnd = $timestampEnd - ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600); } @@ -2440,10 +2443,10 @@ class ActionComm extends CommonObject if ($fk_user > 0) { $sql .= " AND fk_user = ".((int) $fk_user); } - if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { + if (!getDolGlobalString('AGENDA_REMINDER_EMAIL')) { $sql .= " AND typeremind != 'email'"; } - if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { + if (!getDolGlobalString('AGENDA_REMINDER_BROWSER')) { $sql .= " AND typeremind != 'browser'"; } @@ -2493,7 +2496,7 @@ class ActionComm extends CommonObject $this->output = $langs->trans('ModuleNotEnabled', $langs->transnoentitiesnoconv("Agenda")); return 0; } - if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { + if (!getDolGlobalString('AGENDA_REMINDER_EMAIL')) { $langs->load("agenda"); $this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda")); return 0; @@ -2502,7 +2505,7 @@ class ActionComm extends CommonObject $now = dol_now(); $actionCommReminder = new ActionCommReminder($this->db); - dol_syslog(__METHOD__, LOG_DEBUG); + dol_syslog(__METHOD__." start", LOG_INFO); $this->db->begin(); @@ -2632,10 +2635,16 @@ class ActionComm extends CommonObject if (!$error) { $this->output = 'Nb of emails sent : '.$nbMailSend; $this->db->commit(); + + dol_syslog(__METHOD__." end - ".$this->output, LOG_INFO); + return 0; } else { $this->db->commit(); // We commit also on error, to have the error message recorded. $this->error = 'Nb of emails sent : '.$nbMailSend.', '.(!empty($errorsMsg)) ? join(', ', $errorsMsg) : $error; + + dol_syslog(__METHOD__." end - ".$this->error, LOG_INFO); + return $error; } } diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 909a7586025..92011190b69 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -154,7 +154,7 @@ class ActionCommReminder extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany')) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index cf668fb1077..a371566875b 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -180,7 +180,7 @@ class CActionComm } // If AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST is defined, we use position as main sort criterion // otherwise we use type as main sort criterion - if (!empty($conf->global->AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST)) { + if (getDolGlobalString('AGENDA_SORT_EVENT_TYPE_BY_POSITION_FIRST')) { $sql .= " ORDER BY position, type, module"; } else { $sql .= " ORDER BY type, position, module"; @@ -219,10 +219,10 @@ class CActionComm if ($obj->module == 'propal' && isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $qualified = 1; } - if ($obj->module == 'invoice_supplier' && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire')))) { + if ($obj->module == 'invoice_supplier' && ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'facture', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire')))) { $qualified = 1; } - if ($obj->module == 'order_supplier' && ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight('fournisseur', 'commande', 'lire')) || (!isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')))) { + if ($obj->module == 'order_supplier' && ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight('fournisseur', 'commande', 'lire')) || (!isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')))) { $qualified = 1; } if ($obj->module == 'shipping' && isModEnabled("expedition") && $user->hasRight('expedition', 'lire')) { @@ -278,7 +278,7 @@ class CActionComm $transcode = $langs->trans($keyfortrans); } $label = (($transcode != $keyfortrans) ? $transcode : $langs->trans($obj->label)); - if (($onlyautoornot == -1 || $onlyautoornot == -2) && !empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (($onlyautoornot == -1 || $onlyautoornot == -2) && getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($typecalendar == 'system') { $label = '   '.$label; $repid[-99] = $langs->trans("ActionAC_MANUAL"); diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 95387ec4cb0..661467ea80f 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -205,7 +205,7 @@ if ($object->id > 0) { print ''; // Type of event - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { print ''; // Location - if (empty($conf->global->AGENDA_DISABLE_LOCATION)) { + if (!getDolGlobalString('AGENDA_DISABLE_LOCATION')) { print ''; } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 99b0b21d20a..081794f7b1b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -45,7 +45,7 @@ if (!isset($conf->global->AGENDA_MAX_EVENTS_DAY_VIEW)) { $conf->global->AGENDA_MAX_EVENTS_DAY_VIEW = 3; } -if (empty($conf->global->AGENDA_EXT_NB)) { +if (!getDolGlobalString('AGENDA_EXT_NB')) { $conf->global->AGENDA_EXT_NB = 5; } $MAXAGENDA = $conf->global->AGENDA_EXT_NB; @@ -60,7 +60,7 @@ $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", $showbirthday = empty($conf->use_javascript_ajax) ? GETPOST("showbirthday", "int") : 1; // If not choice done on calendar owner (like on left menu link "Agenda"), we filter on user. -if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { +if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) { $filtert = $user->id; } @@ -132,14 +132,14 @@ if (GETPOST('search_actioncode', 'array:aZ09')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($status == '' && !GETPOSTISSET('search_status')) { - $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } -$defaultview = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); +$defaultview = (!getDolGlobalString('AGENDA_DEFAULT_VIEW') ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); $defaultview = (empty($user->conf->AGENDA_DEFAULT_VIEW) ? $defaultview : $user->conf->AGENDA_DEFAULT_VIEW); if (empty($mode) && !GETPOSTISSET('mode')) { $mode = $defaultview; @@ -265,7 +265,7 @@ $nowday = $nowarray['mday']; $listofextcals = array(); // Define list of external calendars (global admin setup) -if (empty($conf->global->AGENDA_DISABLE_EXT)) { +if (!getDolGlobalString('AGENDA_DISABLE_EXT')) { $i = 0; while ($i < $MAXAGENDA) { $i++; @@ -716,7 +716,7 @@ $sql .= ' a.datep2,'; $sql .= ' a.percent,'; $sql .= ' a.fk_user_author,a.fk_user_action,'; $sql .= ' a.transparency, a.priority, a.fulldayevent, a.location,'; -$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_availability,'; +$sql .= ' a.fk_soc, a.fk_contact, a.fk_project, a.fk_bookcal_calendar,'; $sql .= ' a.fk_element, a.elementtype,'; $sql .= ' ca.code as type_code, ca.libelle as type_label, ca.color as type_color, ca.type as type_type, ca.picto as type_picto'; $sql .= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; @@ -738,7 +738,7 @@ $sql .= ' WHERE a.fk_action = ca.id'; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode if (!empty($actioncode)) { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($actioncode == 'AC_NON_AUTO') { $sql .= " AND ca.type != 'systemauto'"; } elseif ($actioncode == 'AC_ALL_AUTO') { @@ -854,7 +854,7 @@ if ($resql) { $obj = $db->fetch_object($resql); // Discard auto action if option is on - if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') { + if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code == 'AC_OTH_AUTO') { $i++; continue; } @@ -905,8 +905,8 @@ if ($resql) { $event->socid = $obj->fk_soc; $event->contact_id = $obj->fk_contact; - $event->fk_bookcal_availability = $obj->fk_bookcal_availability; - if (!empty($event->fk_bookcal_availability)) { + $event->fk_bookcal_calendar = $obj->fk_bookcal_calendar; + if (!empty($event->fk_bookcal_calendar)) { $event->type = "bookcal_calendar"; } @@ -1829,7 +1829,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($day == $jour && $month == $mois && $year == $annee) { foreach ($eventarray[$daykey] as $index => $event) { - if ($i < $maxprint || $maxprint == 0 || !empty($conf->global->MAIN_JS_SWITCH_AGENDA)) { + if ($i < $maxprint || $maxprint == 0 || getDolGlobalString('MAIN_JS_SWITCH_AGENDA')) { $keysofuserassigned = array_keys($event->userassigned); $ponct = ($event->date_start_in_calendar == $event->date_end_in_calendar); @@ -1868,7 +1868,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } elseif ($event->type == 'bookcal_calendar') { $numbirthday++; $colorindex = 3; - $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink"]) ? $bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability] : ""); + $cssclass = 'family_bookcal_calendar_'.(!empty($bookcalcalendarsarray["availabilitieslink"]) ? $bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar] : ""); $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; @@ -1957,7 +1957,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type == 'holiday' && !GETPOST('check_holiday')) { $morecss = 'hidden'; } - if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_availability])) { + if ($event->type == 'bookcal_calendar' && !GETPOST('check_bookcal_calendar_'.$bookcalcalendarsarray["availabilitieslink"][$event->fk_bookcal_calendar])) { $morecss = 'hidden'; } if ($morecss != 'hidden') { @@ -1968,7 +1968,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa } //var_dump($event->type.' - '.$morecss.' - '.$cssclass.' - '.$i.' - '.$ireallyshown.' - '.$itoshow); if (isModEnabled("bookcal") && $event->type == 'bookcal_calendar') { - print '
fk_bookcal_availability].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; + print '
fk_bookcal_calendar].' '.$cssclass.($morecss ? ' '.$morecss : '').'"'; } else { print '
'.img_picto("All", "angle-double-down", 'class="warning"').' +'.($itoshow - $ireallyshown).'
'; //print ' +'.(count($eventarray[$daykey])-$maxprint); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index dab3a55354e..0300bde4420 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -71,7 +71,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } // Search Fields @@ -86,10 +86,10 @@ $datestart_dtend = dol_mktime(23, 59, 59, GETPOST('datestart_dtendmonth', 'int') $dateend_dtstart = dol_mktime(0, 0, 0, GETPOST('dateend_dtstartmonth', 'int'), GETPOST('dateend_dtstartday', 'int'), GETPOST('dateend_dtstartyear', 'int'), 'tzuserrel'); $dateend_dtend = dol_mktime(23, 59, 59, GETPOST('dateend_dtendmonth', 'int'), GETPOST('dateend_dtendday', 'int'), GETPOST('dateend_dtendyear', 'int'), 'tzuserrel'); if ($search_status == '' && !GETPOSTISSET('search_status')) { - $search_status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $search_status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } if (empty($mode) && !GETPOSTISSET('mode')) { - $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); + $mode = (!getDolGlobalString('AGENDA_DEFAULT_VIEW') ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); } $filter = GETPOST("search_filter", 'alpha', 3) ?GETPOST("search_filter", 'alpha', 3) : GETPOST("filter", 'alpha', 3); @@ -108,7 +108,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // If not choice done on calendar owner, we filter on user. -if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { +if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) { $filtert = $user->id; } @@ -165,7 +165,7 @@ $arrayfields = array( 'a.datep2'=>array('label'=>"DateEnd", 'checked'=>1), 's.nom'=>array('label'=>"ThirdParty", 'checked'=>1), 'a.fk_contact'=>array('label'=>"Contact", 'checked'=>0), - 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(!empty($conf->global->AGENDA_SHOW_LINKED_OBJECT))), + 'a.fk_element'=>array('label'=>"LinkedObject", 'checked'=>1, 'enabled'=>(getDolGlobalString('AGENDA_SHOW_LINKED_OBJECT'))), 'a.datec'=>array('label'=>'DateCreation', 'checked'=>0, 'position'=>510), 'a.tms'=>array('label'=>'DateModification', 'checked'=>0, 'position'=>520), 'a.percent'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000) @@ -459,7 +459,7 @@ $sql .= " WHERE c.id = a.fk_action"; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode if (!empty($actioncode)) { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($actioncode == 'AC_NON_AUTO') { $sql .= " AND c.type != 'systemauto'"; } elseif ($actioncode == 'AC_ALL_AUTO') { @@ -802,13 +802,13 @@ if (!empty($arrayfields['a.tms']['checked'])) { print '
'; } if (!empty($arrayfields['a.percent']['checked'])) { - print ''; } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -823,6 +823,7 @@ $totalarray['nbfield'] = 0; print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + $totalarray['nbfield']++; } if (!empty($arrayfields['a.id']['checked'])) { print_liste_field_titre($arrayfields['a.id']['label'], $_SERVER["PHP_SELF"], "a.id", $param, "", "", $sortfield, $sortorder); @@ -846,11 +847,11 @@ if (!empty($arrayfields['a.note']['checked'])) { } //if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (!empty($arrayfields['a.datep']['checked'])) { - print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datep']['label'], $_SERVER["PHP_SELF"], "a.datep,a.id", $param, '', '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['a.datep2']['checked'])) { - print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datep2']['label'], $_SERVER["PHP_SELF"], "a.datep2", $param, '', '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['s.nom']['checked'])) { @@ -873,22 +874,22 @@ $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // No print $hookmanager->resPrint; if (!empty($arrayfields['a.datec']['checked'])) { - print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.datec']['label'], $_SERVER["PHP_SELF"], "a.datec,a.id", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!empty($arrayfields['a.tms']['checked'])) { - print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre($arrayfields['a.tms']['label'], $_SERVER["PHP_SELF"], "a.tms,a.id", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } - +// Status if (!empty($arrayfields['a.percent']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "a.percent", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; } if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch '); + print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); + $totalarray['nbfield']++; } -$totalarray['nbfield']++; print "\n"; $now = dol_now(); @@ -897,7 +898,7 @@ $today_start_time = dol_mktime(0, 0, 0, date('m', $now), date('d', $now), date(' require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php'; $caction = new CActionComm($db); -$arraylist = $caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : 0), '', 1); +$arraylist = $caction->liste_array(1, 'code', '', (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') ? 1 : 0), '', 1); $contactListCache = array(); // Loop on record @@ -917,7 +918,7 @@ while ($i < $imaxinloop) { $object->setVarsFromFetchObj($obj); // Discard auto action if option is on - if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO') { + if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO') && $obj->type_code == 'AC_OTH_AUTO') { $i++; continue; } @@ -1035,7 +1036,7 @@ while ($i < $imaxinloop) { print ''; // Prefix - if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field + if (getDolGlobalString('SOCIETE_USEPREFIX')) { // Old not used prefix field print ''; @@ -505,14 +505,14 @@ if ($object->id > 0) { print ''; print ''; } if ($object->client) { - if (isModEnabled('commande') && !empty($conf->global->ORDER_MANAGE_MIN_AMOUNT)) { + if (isModEnabled('commande') && getDolGlobalString('ORDER_MANAGE_MIN_AMOUNT')) { print ''."\n"; print ''; print '
'.$langs->trans("Type").''; print $object->getTypePicto(); print $langs->trans("Action".$object->type_code); @@ -243,7 +243,7 @@ if ($object->id > 0) { print '
'.$langs->trans("Location").''.$object->location.'
'; + print ''; $formactions->form_select_status_action('formaction', $search_status, 1, 'search_status', 1, 2, 'search_status width100 onrightofpage'); print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; print $actionstatic->getTypePicto(); $labeltype = $obj->type_code; - if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE') && empty($arraylist[$labeltype])) { $labeltype = 'AC_OTH'; } if (preg_match('/^TICKET_MSG/', $actionstatic->code)) { diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 39c57d45e28..39b4ade3ceb 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -57,7 +57,7 @@ $usergroup = GETPOST("search_usergroup", "int", 3) ? GETPOST("search_usergroup", $showbirthday = 0; // will be hidden here // If not choice done on calendar owner, we filter on user. -if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) { +if (empty($filtert) && !getDolGlobalString('AGENDA_ALL_CALENDARS')) { $filtert = $user->id; } @@ -118,7 +118,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int')); @@ -129,7 +129,7 @@ if ($dateselect > 0) { } // working hours -$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; +$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); $begin_h = GETPOST('begin_h', 'int') != '' ?GETPOST('begin_h', 'int') : ($tmparray[0] != '' ? $tmparray[0] : 9); @@ -145,17 +145,17 @@ if ($end_h <= $begin_h) { } // working days -$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; +$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); $begin_d = 1; $end_d = 53; if ($status == '' && !GETPOSTISSET('search_status')) { - $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } if (empty($mode) && !GETPOSTISSET('mode')) { - $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); + $mode = (!getDolGlobalString('AGENDA_DEFAULT_VIEW') ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); } // View by month @@ -546,7 +546,7 @@ $sql .= ' WHERE a.fk_action = ca.id'; $sql .= ' AND a.entity IN ('.getEntity('agenda').')'; // Condition on actioncode if (!empty($actioncode)) { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($actioncode == 'AC_NON_AUTO') { $sql .= " AND ca.type != 'systemauto'"; } elseif ($actioncode == 'AC_ALL_AUTO') { @@ -657,7 +657,7 @@ if ($resql) { $obj = $db->fetch_object($resql); // Discard auto action if option is on - if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') { + if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO') && $obj->code == 'AC_OTH_AUTO') { $i++; continue; } @@ -881,7 +881,7 @@ echo "
"; echo ''; -if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { +if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { $langs->load("commercial"); print '
'.$langs->trans("Legend").':
'; foreach ($colorsbytype as $code => $color) { @@ -1018,7 +1018,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $color = -1; $cssclass = ''; $colorindex = -1; if (in_array($user->id, $keysofuserassigned)) { $nummytasks++; $cssclass = 'family_mytasks'; - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { $color = $event->type_color; } } elseif ($event->type_code == 'ICALEVENT') { @@ -1036,7 +1036,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $numbirthday++; $colorindex = 2; $cssclass = 'family_birthday unsortable'; $color = sprintf("%02x%02x%02x", $theme_datacolor[$colorindex][0], $theme_datacolor[$colorindex][1], $theme_datacolor[$colorindex][2]); } else { $numother++; $cssclass = 'family_other'; - if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { $color = $event->type_color; } } @@ -1191,7 +1191,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title1 .= count($cases1[$h]).' '.(count($cases1[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string1 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style1 = 'peruser_notbusy'; } else { $style1 = 'peruser_busy'; @@ -1208,7 +1208,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title2 .= count($cases2[$h]).' '.(count($cases2[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string2 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style2 = 'peruser_notbusy'; } else { $style2 = 'peruser_busy'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index a80f787e0ac..c9913b89093 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -114,7 +114,7 @@ if (GETPOST('search_actioncode', 'array:aZ09')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); + $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } $dateselect = dol_mktime(0, 0, 0, GETPOST('dateselectmonth', 'int'), GETPOST('dateselectday', 'int'), GETPOST('dateselectyear', 'int')); @@ -124,7 +124,7 @@ if ($dateselect > 0) { $year = GETPOST('dateselectyear', 'int'); } -$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; +$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS') ? '9-18' : $conf->global->MAIN_DEFAULT_WORKING_HOURS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); $begin_h = GETPOST('begin_h', 'int') != '' ? GETPOST('begin_h', 'int') : ($tmparray[0] != '' ? $tmparray[0] : 9); @@ -139,7 +139,7 @@ if ($end_h <= $begin_h) { $end_h = $begin_h + 1; } -$tmp = empty($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; +$tmp = !getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS') ? '1-5' : $conf->global->MAIN_DEFAULT_WORKING_DAYS; $tmp = str_replace(' ', '', $tmp); // FIX 7533 $tmparray = explode('-', $tmp); $begin_d = GETPOST('begin_d', 'int') ?GETPOST('begin_d', 'int') : ($tmparray[0] != '' ? $tmparray[0] : 1); @@ -155,11 +155,11 @@ if ($end_d < $begin_d) { } if ($status == '' && !GETPOSTISSET('search_status')) { - $status = ((empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS) || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); + $status = ((!getDolGlobalString('AGENDA_DEFAULT_FILTER_STATUS') || $disabledefaultvalues) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_STATUS); } if (empty($mode) && !GETPOSTISSET('mode')) { - $mode = (empty($conf->global->AGENDA_DEFAULT_VIEW) ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); + $mode = (!getDolGlobalString('AGENDA_DEFAULT_VIEW') ? 'show_month' : $conf->global->AGENDA_DEFAULT_VIEW); } if (GETPOST('viewcal', 'alpha') && $mode != 'show_day' && $mode != 'show_week' && $mode != 'show_peruser') { @@ -353,7 +353,7 @@ $next_day = $next['day']; // Define firstdaytoshow and lastdaytoshow. Warning: lastdaytoshow is last second to show + 1 // $firstdaytoshow and lastdaytoshow become a gmt dates to use to search/compare because first_xxx are in tz idea and we used tzuserrel $firstdaytoshow = dol_mktime(0, 0, 0, $first_month, $first_day, $first_year, 'tzuserrel'); -$nb_weeks_to_show = (!empty($conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER)) ? ((int) $conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7; +$nb_weeks_to_show = (getDolGlobalString('AGENDA_NB_WEEKS_IN_VIEW_PER_USER')) ? ((int) $conf->global->AGENDA_NB_WEEKS_IN_VIEW_PER_USER * 7) : 7; $lastdaytoshow = dol_time_plus_duree($firstdaytoshow, $nb_weeks_to_show, 'd'); //print $firstday.'-'.$first_month.'-'.$first_year; //print dol_print_date($firstdaytoshow, 'dayhour', 'gmt'); @@ -564,7 +564,7 @@ $sql .= " WHERE a.fk_action = ca.id"; $sql .= " AND a.entity IN (".getEntity('agenda').")"; // Condition on actioncode if (!empty($actioncode)) { - if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { + if (!getDolGlobalString('AGENDA_USE_EVENT_TYPE')) { if ($actioncode == 'AC_NON_AUTO') { $sql .= " AND ca.type != 'systemauto'"; } elseif ($actioncode == 'AC_ALL_AUTO') { @@ -663,7 +663,7 @@ if ($resql) { //print $obj->fk_user_action.' '.$obj->id."
"; // Discard auto action if option is on - if (!empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO') { + if (getDolGlobalString('AGENDA_ALWAYS_HIDE_AUTO') && $obj->code == 'AC_OTH_AUTO') { $i++; continue; } @@ -885,7 +885,7 @@ while ($currentdaytoshow < $lastdaytoshow) { $usernames = array(); //init $usernamesid = array(); /* Use this to have list of users only if users have events */ - if (!empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW)) { + if (getDolGlobalString('AGENDA_SHOWOWNERONLY_ONPERUSERVIEW')) { foreach ($eventarray as $daykey => $notused) { // Get all assigned users for each event foreach ($eventarray[$daykey] as $index => $event) { @@ -1017,7 +1017,7 @@ while ($currentdaytoshow < $lastdaytoshow) { echo ''; -if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && !empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) { +if (getDolGlobalString('AGENDA_USE_EVENT_TYPE') && getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) { $langs->load("commercial"); print '
'.$langs->trans("Legend").':
'; foreach ($colorsbytype as $code => $color) { @@ -1177,7 +1177,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = $cacheusers[$event->userownerid]->color; } - if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) { $color = $event->type_color; } } elseif ($event->type_code == 'ICALEVENT') { @@ -1210,7 +1210,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color = $cacheusers[$event->userownerid]->color; } - if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) { + if (getDolGlobalString('AGENDA_USE_COLOR_PER_EVENT_TYPE')) { $color = $event->type_color; } } @@ -1460,7 +1460,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title1 .= count($cases1[$h]).' '.(count($cases1[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string1 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style1 = 'peruser_notbusy'; } else { $style1 = 'peruser_busy'; @@ -1477,7 +1477,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title2 .= count($cases2[$h]).' '.(count($cases2[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string2 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style2 = 'peruser_notbusy'; } else { $style2 = 'peruser_busy'; @@ -1494,7 +1494,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title3 .= count($cases3[$h]).' '.(count($cases3[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string3 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style3 = 'peruser_notbusy'; } else { $style3 = 'peruser_busy'; @@ -1511,7 +1511,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title4 .= count($cases4[$h]).' '.(count($cases4[$h]) == 1 ? $langs->trans("Event") : $langs->trans("Events")); } $string4 = ' '; - if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { + if (!getDolGlobalString('AGENDA_NO_TRANSPARENT_ON_NOT_BUSY')) { $style4 = 'peruser_notbusy'; } else { $style4 = 'peruser_busy'; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 5037d685de5..997907d9a8c 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -312,7 +312,7 @@ $form = new Form($db); $formcompany = new FormCompany($db); $title = $langs->trans("ThirdParty")." - ".$langs->trans('Customer'); -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$langs->trans('Customer'); } @@ -341,7 +341,7 @@ if ($object->id > 0) { print '
'.$langs->trans("Prefix").''; print ($object->prefix_comm ? $object->prefix_comm : ' '); print '
'; print $form->editfieldkey("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer')); print ''; - $limit_field_type = (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; + $limit_field_type = (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE')) ? 'numeric' : 'amount'; print $form->editfieldval("OutstandingBill", 'outstanding_limit', $object->outstanding_limit, $object, $user->hasRight('societe', 'creer'), $limit_field_type, ($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); print '
'; @@ -526,7 +526,7 @@ if ($object->id > 0) { // Multiprice level - if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { print '
'; print ''."\n"; print ''."\n"; - if (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) { + if (getDolGlobalString('PRODUCT_CODEPRODUCT_ADDON') && $conf->global->PRODUCT_CODEPRODUCT_ADDON == $file) { print '\n"; @@ -427,10 +427,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } @@ -567,16 +567,16 @@ if (!isModEnabled('multicompany')) { } print ''; // multiprix nombre de prix a proposer -if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { +if (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { print ''; print ''; print ''; @@ -658,7 +658,7 @@ if (empty($conf->use_javascript_ajax)) { } print ''; -if (empty($conf->global->PRODUIT_USE_SEARCH_TO_SELECT)) { +if (!getDolGlobalString('PRODUIT_USE_SEARCH_TO_SELECT')) { print ''; print ''; print ''; @@ -673,7 +673,7 @@ print ''; print $form->selectarray( "activate_FillProductDescAuto", array(0=>'DoNotAutofillButAutoConcat', 1=>'AutoFillFormFieldBeforeSubmit', 2=>'DoNotUseDescriptionOfProdut'), - empty($conf->global->PRODUIT_AUTOFILL_DESC) ? 0 : $conf->global->PRODUIT_AUTOFILL_DESC, + !getDolGlobalString('PRODUIT_AUTOFILL_DESC') ? 0 : $conf->global->PRODUIT_AUTOFILL_DESC, 0, 0, 0, @@ -724,13 +724,13 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) { print ''; print ''; print ''; print ''; } -if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) { +if (getDolGlobalString('PRODUCT_CANVAS_ABILITY')) { // Add canvas feature $dir = DOL_DOCUMENT_ROOT."/product/canvas/"; diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 32b7394ce4f..8520f471196 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -209,8 +209,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue; + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue; if ($module->isEnabled()) { print '
'; print $langs->trans("PriceLevel"); @@ -546,7 +546,7 @@ if ($object->id > 0) { } // Warehouse - if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) { + if (isModEnabled('stock') && getDolGlobalString('SOCIETE_ASK_FOR_WAREHOUSE')) { $langs->load('stocks'); require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); @@ -567,7 +567,7 @@ if ($object->id > 0) { } // Preferred shipping Method - if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { + if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD')) { print '
'; print ''; - if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES)) { + if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) { print ''; @@ -1512,7 +1512,7 @@ if ($object->id > 0) { print price($objp->total_ht); print ''; - if (!empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES)) { + if (getDolGlobalString('MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES')) { print ''; @@ -1617,7 +1617,7 @@ if ($object->id > 0) { } // Add action - if (isModEnabled('agenda') && !empty($conf->global->MAIN_REPEATTASKONEACHTAB) && $object->status == 1) { + if (isModEnabled('agenda') && getDolGlobalString('MAIN_REPEATTASKONEACHTAB') && $object->status == 1) { if ($user->hasRight('agenda', 'myactions', 'create')) { print ''; } else { @@ -1628,12 +1628,12 @@ if ($object->id > 0) { print ''; - if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD)) { + if (getDolGlobalString('MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD')) { // List of contacts show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); } - if (!empty($conf->global->MAIN_REPEATTASKONEACHTAB)) { + if (getDolGlobalString('MAIN_REPEATTASKONEACHTAB')) { print load_fiche_titre($langs->trans("ActionsOnCompany"), '', ''); // List of todo actions diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index dc5f55df5be..31eb7e6eb90 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -129,7 +129,7 @@ if ($resql) { $param = "&type=".$type; - $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); + $title = (getDolGlobalString('SOCIETE_ADDRESSES_MANAGEMENT') ? $langs->trans("ListOfContacts") : $langs->trans("ListOfContactsAddresses")); print_barre_liste($title.($label ? " (".$label.")" : ""), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num); print ''; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index a7149749aec..27ac6154296 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -65,7 +65,7 @@ if (isset($user->socid) && $user->socid > 0) { $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT; -$maxofloop = (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); +$maxofloop = (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD); $now = dol_now(); //restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'rowid', 0); @@ -167,7 +167,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { if ($i >= $max) { $othernb++; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); continue; } @@ -196,11 +196,11 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); } if ($othernb) { @@ -265,7 +265,7 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l if ($i >= $max) { $othernb += 1; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); continue; } @@ -293,11 +293,11 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); } if ($othernb) { @@ -362,7 +362,7 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { if ($i >= $max) { $othernb += 1; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); continue; } @@ -391,11 +391,11 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); } if ($othernb) { @@ -421,7 +421,7 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { * Draft purchase orders */ -if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) { +if ((isModEnabled("fournisseur") && !getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) { $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -460,7 +460,7 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO if ($i >= $max) { $othernb += 1; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); continue; } @@ -489,11 +489,11 @@ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMO print ''; print ''; print ''; - print ''; + print ''; print ''; $i++; - $total += (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc); + $total += (getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc); } if ($othernb) { @@ -630,9 +630,9 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) { $resql = $db->query($sql); if ($resql) { - if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + if (!getDolGlobalString('SOCIETE_DISABLE_PROSPECTS') && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { $header = "BoxTitleLastCustomersOrProspects"; - } elseif (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + } elseif (getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { $header = "BoxTitleLastModifiedProspects"; } else { $header = "BoxTitleLastModifiedCustomers"; @@ -668,10 +668,10 @@ if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) { $obj = $companystatic; $s = ''; - if (($obj->client == 2 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) { + if (($obj->client == 2 || $obj->client == 3) && !getDolGlobalString('SOCIETE_DISABLE_PROSPECTS')) { $s .= ''.dol_substr($langs->trans("Prospect"), 0, 1).''; } - if (($obj->client == 1 || $obj->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) { + if (($obj->client == 1 || $obj->client == 3) && !getDolGlobalString('SOCIETE_DISABLE_CUSTOMERS')) { $s .= ''.dol_substr($langs->trans("Customer"), 0, 1).''; } /* @@ -922,7 +922,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { if ($resql) { $total = $total_ttc = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); startSimpleTable("ProposalsOpened", "comm/propal/list.php", "search_status=1", 4, $num); if ($num > 0) { @@ -982,7 +982,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { print ''; - print ''; + print ''; print ''; print ''; @@ -1001,7 +1001,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { } } - addSummaryTableLine(5, $num, $nbofloop, empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $total_ttc : $total, "NoProposal", true); + addSummaryTableLine(5, $num, $nbofloop, !getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $total_ttc : $total, "NoProposal", true); finishSimpleTable(true); $db->free($resql); @@ -1041,7 +1041,7 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { if ($resql) { $total = $total_ttc = 0; $num = $db->num_rows($resql); - $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); + $nbofloop = min($num, (!getDolGlobalString('MAIN_MAXLIST_OVERLOAD') ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); startSimpleTable("OrdersOpened", "commande/list.php", "search_status=".Commande::STATUS_VALIDATED, 4, $num); if ($num > 0) { @@ -1103,7 +1103,7 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { print dol_print_date($datem, 'day', 'tzserver'); print ''; - print ''; + print ''; print ''; print ''; @@ -1122,7 +1122,7 @@ if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { } } - addSummaryTableLine(5, $num, $nbofloop, empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $total_ttc : $total, "None", true); + addSummaryTableLine(5, $num, $nbofloop, !getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $total_ttc : $total, "None", true); finishSimpleTable(true); $db->free($resql); diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index ea7f1a4c698..9d87c65492b 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -96,7 +96,7 @@ if ($result < 0) { } // Security check -if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } //$result = restrictedArea($user, 'mailing'); @@ -446,7 +446,7 @@ if ($object->fetch($id) >= 0) { print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD) && !empty($soc->shipping_method_id)) { + if (getDolGlobalString('SOCIETE_ASK_FOR_SHIPPING_METHOD') && !empty($soc->shipping_method_id)) { $shipping_method_id = $soc->shipping_method_id; } //$warehouse_id = $soc->warehouse_id; @@ -1886,7 +1886,7 @@ if ($action == 'create') { $filter = '((s.client:IN:1,2,3) AND (s.status:=:1))'; print img_picto('', 'company', 'class="pictofixedwidth"').$form->select_company('', 'socid', $filter, 'SelectThirdParty', 1, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx'); // reload page to retrieve customer informations - if (empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED)) { + if (!getDolGlobalString('RELOAD_PAGE_ON_CUSTOMER_CHANGE_DISABLED')) { print ''."\n"; } // jQuery jnotify - if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { + if (!getDolGlobalString('MAIN_DISABLE_JQUERY_JNOTIFY') && !defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; } // Table drag and drop lines @@ -1912,12 +1912,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; } // Chart - if (empty($disableforlogin) && (empty($conf->global->MAIN_JS_GRAPH) || getDolGlobalString('MAIN_JS_GRAPH') == 'chart') && !defined('DISABLE_JS_GRAPH')) { + if (empty($disableforlogin) && (!getDolGlobalString('MAIN_JS_GRAPH') || getDolGlobalString('MAIN_JS_GRAPH') == 'chart') && !defined('DISABLE_JS_GRAPH')) { print ''."\n"; } // jQuery jeditable for Edit In Place features - if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) { + if (getDolGlobalString('MAIN_USE_JQUERY_JEDITABLE') && !defined('DISABLE_JQUERY_JEDITABLE')) { print ''."\n"; print ''."\n"; print ''."\n"; @@ -1936,13 +1936,13 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; } // jQuery Timepicker - if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { + if (getDolGlobalString('MAIN_USE_JQUERY_TIMEPICKER') || defined('REQUIRE_JQUERY_TIMEPICKER')) { print ''."\n"; print ''."\n"; } - if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { + if (!defined('DISABLE_SELECT2') && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { // jQuery plugin "mutiselect", "multiple-select", "select2", ... - $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; + $tmpplugin = !getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; print ''."\n"; // We include full because we need the support of containerCssClass } if (!defined('DISABLE_MULTISELECT')) { // jQuery plugin "mutiselect" to select with checkboxes. Can be removed once we have an enhanced search tool @@ -1952,7 +1952,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (!$disablejs && !empty($conf->use_javascript_ajax)) { // CKEditor - if (empty($disableforlogin) && (isModEnabled('fckeditor') && (empty($conf->global->FCKEDITOR_EDITORNAME) || getDolGlobalString('FCKEDITOR_EDITORNAME') == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) { + if (empty($disableforlogin) && (isModEnabled('fckeditor') && (!getDolGlobalString('FCKEDITOR_EDITORNAME') || getDolGlobalString('FCKEDITOR_EDITORNAME') == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) { print ''."\n"; $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; $jsckeditor = 'ckeditor.js'; @@ -1980,7 +1980,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr // Browser notifications (if NOREQUIREMENU is on, it is mostly a page for popup, so we do not enable notif too. We hide also for public pages). if (!defined('NOBROWSERNOTIF') && !defined('NOREQUIREMENU') && !defined('NOLOGIN')) { $enablebrowsernotif = false; - if (isModEnabled('agenda') && !empty($conf->global->AGENDA_REMINDER_BROWSER)) { + if (isModEnabled('agenda') && getDolGlobalString('AGENDA_REMINDER_BROWSER')) { $enablebrowsernotif = true; } if ($conf->browser->layout == 'phone') { @@ -2027,7 +2027,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } //If you want to load custom javascript file from your selected theme directory - if (!empty($conf->global->ALLOW_THEME_JS)) { + if (getDolGlobalString('ALLOW_THEME_JS')) { $theme_js = dol_buildpath('/theme/'.$conf->theme.'/'.$conf->theme.'.js', 0); if (file_exists($theme_js)) { print ''."\n"; @@ -2037,8 +2037,8 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (!empty($head)) { print $head."\n"; } - if (!empty($conf->global->MAIN_HTML_HEADER)) { - print $conf->global->MAIN_HTML_HEADER."\n"; + if (getDolGlobalString('MAIN_HTML_HEADER')) { + print getDolGlobalString('MAIN_HTML_HEADER') . "\n"; } $parameters = array(); @@ -2070,7 +2070,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr */ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '', $morequerystring = '', $helppagename = '') { - global $user, $conf, $langs, $db; + global $user, $conf, $langs, $db, $form; global $dolibarr_main_authentication, $dolibarr_main_demo; global $hookmanager, $menumanager; @@ -2102,14 +2102,14 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead print '
'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. // Show menu entries - print '
'."\n"; + print '
'."\n"; $menumanager->atarget = $target; $menumanager->showmenu('top', array('searchform'=>$searchform)); // This contains a \n print "
\n"; // Define link to login card $appli = constant('DOL_APPLICATION_TITLE'); - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { + if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { $appli = $conf->global->MAIN_APPLICATION_TITLE; if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) { @@ -2128,7 +2128,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $logouttext = ''; $logouthtmltext = ''; - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { //$logouthtmltext=$appli.'
'; $stringforfirstkey = $langs->trans("KeyboardShortcut"); if ($conf->browser->name == 'chrome') { @@ -2176,7 +2176,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } // Link to print main content area - if (empty($conf->global->MAIN_PRINT_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_PRINT_DISABLELINK') && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $qs = dol_escape_htmltag($_SERVER["QUERY_STRING"]); if (isset($_POST) && is_array($_POST)) { @@ -2195,7 +2195,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } // Link to Dolibarr wiki pages - if (empty($conf->global->MAIN_HELP_DISABLELINK) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_HELP_DISABLELINK') && !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $langs->load("help"); $helpbaseurl = ''; @@ -2241,13 +2241,13 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead } // Version - if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { + if (getDolGlobalString('MAIN_SHOWDATABASENAMEINHELPPAGESLINK')) { $langs->load('admin'); $appli .= '
'.$langs->trans("Database").': '.$db->database_name; } } - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $text = ''.DOL_VERSION.''; $toprightmenu .= $form->textwithtooltip('', $appli, 2, 1, $text, 'login_block_elem', 2); } @@ -2265,12 +2265,12 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $mode = -1; $toprightmenu .= '
'; } else { @@ -1728,7 +1728,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Warehouse print ''; } else { print ''; diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index c50d9b4b8e1..a91ab717365 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -533,7 +533,7 @@ class MultiCurrency extends CommonObject $sql1 .= " WHERE m.code = '".$dbs->escape($code)."'"; $sql1 .= " AND m.entity IN (".getEntity('multicurrency').")"; $sql2 = ''; - if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE) && !empty($date_document)) { // Use last known rate compared to document date + if (getDolGlobalString('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE') && !empty($date_document)) { // Use last known rate compared to document date $tmparray = dol_getdate($date_document); $sql2 .= " AND mc.date_sync <= '".$dbs->idate(dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year'], true))."'"; } @@ -545,7 +545,7 @@ class MultiCurrency extends CommonObject if ($resql && $obj = $dbs->fetch_object($resql)) { return array($obj->rowid, $obj->rate); } else { - if (!empty($conf->global->MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE)) { + if (getDolGlobalString('MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE')) { $resql = $dbs->query($sql1.$sql3); if ($resql && $obj = $dbs->fetch_object($resql)) { return array($obj->rowid, $obj->rate); @@ -663,7 +663,7 @@ class MultiCurrency extends CommonObject include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; $urlendpoint = 'http://api.currencylayer.com/live?access_key='.$key; - $urlendpoint .= '&source=' . (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? 'USD' : $conf->global->MULTICURRENCY_APP_SOURCE); + $urlendpoint .= '&source=' . (!getDolGlobalString('MULTICURRENCY_APP_SOURCE') ? 'USD' : $conf->global->MULTICURRENCY_APP_SOURCE); dol_syslog("Call url endpoint ".$urlendpoint); diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 63baa14dea4..96f4502f414 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -100,7 +100,7 @@ $fieldstosearchall = array( $arrayfields = array( 'cr.date_sync'=>array('label'=>'Date', 'checked'=>1), 'cr.rate'=>array('label'=>'Rate', 'checked'=>1), - 'cr.rate_indirect'=>array('label'=>'RateIndirect', 'checked'=>0, 'enabled'=>(empty($conf->global->MULTICURRENCY_USE_RATE_INDIRECT) ? 0 : 1)), + 'cr.rate_indirect'=>array('label'=>'RateIndirect', 'checked'=>0, 'enabled'=>(!getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT') ? 0 : 1)), 'm.code'=>array('label'=>'Code', 'checked'=>1), ); @@ -286,7 +286,7 @@ if (!in_array($action, array("updateRate", "deleteRate"))) { print ' '; print ' '; - if (!empty($conf->global->MULTICURRENCY_USE_RATE_INDIRECT)) { + if (getDolGlobalString('MULTICURRENCY_USE_RATE_INDIRECT')) { print ' '; print ' '; // LRR Calculate Rate Direct diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 4b2a0ebeac4..9f144037b5c 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -519,7 +519,7 @@ class Opensurveysondage extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } diff --git a/htdocs/opensurvey/lib/opensurvey.lib.php b/htdocs/opensurvey/lib/opensurvey.lib.php index 5e64531aea8..638b15e04cf 100644 --- a/htdocs/opensurvey/lib/opensurvey.lib.php +++ b/htdocs/opensurvey/lib/opensurvey.lib.php @@ -114,13 +114,13 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''; print ''; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { print ''; } print ''; } - if (!empty($conf->global->OPENSURVEY_IMAGE_PUBLIC_INTERFACE)) { + if (getDolGlobalString('OPENSURVEY_IMAGE_PUBLIC_INTERFACE')) { print '
'; print ''; print '
'; diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 6ac74f8bb83..d7421bde63a 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -223,7 +223,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { } // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/opensurvey/card.php', 1).'?id='.$id); @@ -245,7 +245,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } -$fieldtosortuser = empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 'firstname' : 'lastname'; +$fieldtosortuser = !getDolGlobalString('MAIN_FIRSTNAME_NAME_POSITION') ? 'firstname' : 'lastname'; if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -281,7 +281,7 @@ print ''; print ''; $newcardbutton = ''; -$newcardbutton .= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->rights->opensurvey->write); +$newcardbutton .= dolGetButtonTitle($langs->trans('NewSurvey'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/opensurvey/wizard/index.php', '', $user->hasRight('opensurvey', 'write')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'poll', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/partnership/admin/setup.php b/htdocs/partnership/admin/setup.php index 3f8ac2adaae..81c88ff72f7 100644 --- a/htdocs/partnership/admin/setup.php +++ b/htdocs/partnership/admin/setup.php @@ -136,7 +136,7 @@ print ''; print ''; print ''; print ''; @@ -165,7 +165,7 @@ print ''; print ''; print ''; print ''; diff --git a/htdocs/partnership/admin/website.php b/htdocs/partnership/admin/website.php index 498c7e245aa..90e997091b3 100644 --- a/htdocs/partnership/admin/website.php +++ b/htdocs/partnership/admin/website.php @@ -138,7 +138,7 @@ print ''.$langs->trans("PublicFormRegistrationPartne $param = ''; $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' '; -if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) { +if (!getDolGlobalString('PARTNERSHIP_ENABLE_PUBLIC')) { // Button off, click to enable $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); @@ -150,7 +150,7 @@ if (empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) { $enabledisablehtml .= ''; } print $enabledisablehtml; -print ''; +print ''; print '
'; @@ -210,7 +210,7 @@ print dol_get_fiche_end(); print ''; -if (!empty($conf->global->PARTNERSHIP_ENABLE_PUBLIC)) { +if (getDolGlobalString('PARTNERSHIP_ENABLE_PUBLIC')) { print '
'; //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').'
'; diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 9547b887a13..d8be947d4d5 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -170,7 +170,7 @@ class Partnership extends CommonObject $this->fields['fk_soc'] = array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'1', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'company', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax150'); } - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; } @@ -983,7 +983,7 @@ class Partnership extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowPartnership"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -1181,11 +1181,11 @@ class Partnership extends CommonObject global $langs, $conf; $langs->load("partnership"); - if (empty($conf->global->PARTNERSHIP_ADDON)) { + if (!getDolGlobalString('PARTNERSHIP_ADDON')) { $conf->global->PARTNERSHIP_ADDON = 'mod_partnership_standard'; } - if (!empty($conf->global->PARTNERSHIP_ADDON)) { + if (getDolGlobalString('PARTNERSHIP_ADDON')) { $mybool = false; $file = getDolGlobalString('PARTNERSHIP_ADDON') . ".php"; @@ -1251,7 +1251,7 @@ class Partnership extends CommonObject if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->PARTNERSHIP_ADDON_PDF)) { + } elseif (getDolGlobalString('PARTNERSHIP_ADDON_PDF')) { $modele = $conf->global->PARTNERSHIP_ADDON_PDF; } } diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index 9cdae65786e..e267fa90396 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -89,7 +89,7 @@ class PartnershipType extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) { + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany') && isset($this->fields['entity'])) { @@ -295,7 +295,7 @@ class PartnershipType extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowMyObject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 2ae61731095..8ebc4555362 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -72,7 +72,7 @@ class PartnershipUtils } $partnership = new Partnership($this->db); - $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call + $MAXPERCALL = (!getDolGlobalString('PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL') ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call $langs->loadLangs(array("partnership", "member")); @@ -201,7 +201,7 @@ class PartnershipUtils $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...); - if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) { + if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $object->actionmsg2 = $subject; // Short text } @@ -415,7 +415,7 @@ class PartnershipUtils $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...); - if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) { + if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $object->actionmsg2 = $subject; // Short text } @@ -523,7 +523,7 @@ class PartnershipUtils } } - if ($webcontent && !empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) && preg_match('/' . getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK').'/', $webcontent)) { + if ($webcontent && getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK') && preg_match('/' . getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK').'/', $webcontent)) { $found = 1; } diff --git a/htdocs/partnership/lib/partnership.lib.php b/htdocs/partnership/lib/partnership.lib.php index 5c30be6ffd1..ec8f7b80987 100644 --- a/htdocs/partnership/lib/partnership.lib.php +++ b/htdocs/partnership/lib/partnership.lib.php @@ -104,7 +104,7 @@ function partnershipPrepareHead($object) $head[$h][0] = dol_buildpath('/partnership/partnership_note.php', 1).'?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { - $head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? ''.$nbNote.'' : ''); + $head[$h][1] .= (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? ''.$nbNote.'' : ''); } $head[$h][2] = 'note'; $h++; diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index d1fb24eb493..7bc83306115 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -135,7 +135,7 @@ if (empty($reshook)) { $result = $object->validate($user); if ($result >= 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; @@ -167,7 +167,7 @@ if (empty($reshook)) { $result = $object->approve($user); if ($result >= 0) { // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { if (method_exists($object, 'generateDocument')) { $outputlangs = $langs; $newlang = ''; diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index bdfec47074c..250d5adca31 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -458,7 +458,7 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$id); @@ -499,7 +499,7 @@ if ($managedfor == "member") { print '
'; print $langs->trans('SendingMethod'); @@ -1387,7 +1387,7 @@ if ($object->id > 0) { print price($objp->total_ht); print ''; print price($objp->total_ttc); print ''; print price($objp->total_ttc); print '
'.$propalstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').''.price((!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc)).''.price((getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc)).'
'.$supplierproposalstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'supplier').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).'
'.$orderstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'customer').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).'
'.$supplierorderstatic->getNomUrl(1).''.$companystatic->getNomUrl(1, 'supplier').''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).'
'; print dol_print_date($datem, 'day', 'tzserver'); print ''.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).''.$propalstatic->LibStatut($obj->fk_statut, 3).'
'.price(!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT) ? $obj->total_ht : $obj->total_ttc).''.price(getDolGlobalString('MAIN_DASHBOARD_USE_TOTAL_HT') ? $obj->total_ht : $obj->total_ttc).''.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).'
'; $nbemail = ($object->nbemail ? $object->nbemail : '0'); - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { + if (getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) { $text = $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); print $form->textwithpicto($nbemail, $text, 1, 'warning'); } else { diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 6ba1f8fc0f8..a995e399446 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -66,7 +66,7 @@ $object->substitutionarray = FormMail::getAvailableSubstitKey('emailing'); // Set $object->substitutionarrayfortest -$signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); +$signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : ''); $targetobject = null; // Not defined with mass emailing @@ -86,7 +86,7 @@ if (version_compare(phpversion(), '7.0', '>=')) { } // Security check -if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } if (empty($action) && empty($object->id)) { @@ -152,13 +152,13 @@ if (empty($reshook)) { // Action send emailing for everybody if ($action == 'sendallconfirmed' && $confirm == 'yes') { - if (empty($conf->global->MAILING_LIMIT_SENDBYWEB)) { + if (!getDolGlobalString('MAILING_LIMIT_SENDBYWEB')) { // As security measure, we don't allow send from the GUI setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); setEventMessages('', null, 'warnings'); setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action = ''; - } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { + } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < 0) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; } else { @@ -230,7 +230,7 @@ if (empty($reshook)) { $tmpfield = explode('=', $other[3], 2); $other4 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]); $tmpfield = explode('=', $other[4], 2); $other5 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]); - $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); + $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : ''); $parameters = array('mode'=>'emailing'); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object @@ -271,7 +271,7 @@ if (empty($reshook)) { if (isModEnabled('stripe')) { $onlinepaymentenabled++; } - if ($onlinepaymentenabled && !empty($conf->global->PAYMENT_SECURITY_TOKEN)) { + if ($onlinepaymentenabled && getDolGlobalString('PAYMENT_SECURITY_TOKEN')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; $substitutionarray['__ONLINEPAYMENTLINK_MEMBER__'] = getHtmlOnlinePaymentLink('member', $obj->source_id); $substitutionarray['__ONLINEPAYMENTLINK_DONATION__'] = getHtmlOnlinePaymentLink('donation', $obj->source_id); @@ -280,7 +280,7 @@ if (empty($reshook)) { $substitutionarray['__ONLINEPAYMENTLINK_CONTRACTLINE__'] = getHtmlOnlinePaymentLink('contractline', $obj->source_id); $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); - if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { + if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) { $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_DONATION__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); @@ -294,32 +294,32 @@ if (empty($reshook)) { $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2); } } - if (!empty($conf->global->MEMBER_ENABLE_PUBLIC)) { + if (getDolGlobalString('MEMBER_ENABLE_PUBLIC')) { $substitutionarray['__PUBLICLINK_NEWMEMBERFORM__'] = ''.$langs->trans('BlankSubscriptionForm'). ''; } /* For backward compatibility, deprecated */ - if (isModEnabled('paypal') && !empty($conf->global->PAYPAL_SECURITY_TOKEN)) { + if (isModEnabled('paypal') && getDolGlobalString('PAYPAL_SECURITY_TOKEN')) { $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) { + if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) { $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); } else { $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, 2); } - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) { + if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) { $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); } else { $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order'.$obj->source_id, 2); } - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) { + if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) { $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); } else { $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice'.$obj->source_id, 2); } - if (empty($conf->global->PAYPAL_SECURITY_TOKEN_UNIQUE)) { + if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) { $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash($conf->global->PAYPAL_SECURITY_TOKEN, 2); } else { $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2); @@ -403,7 +403,7 @@ if (empty($reshook)) { } } - if (!empty($conf->global->MAILING_DELAY)) { + if (getDolGlobalString('MAILING_DELAY')) { dol_syslog("Wait a delay of MAILING_DELAY=".((float) $conf->global->MAILING_DELAY)); usleep((float) $conf->global->MAILING_DELAY * 1000000); } @@ -481,7 +481,7 @@ if (empty($reshook)) { $msgishtml = 1; } - $signature = ((!empty($user->signature) && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $user->signature : ''); + $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : ''); $parameters = array('mode'=>'emailing'); $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $targetobject); // Note: On mass emailing, this is null because be don't know object @@ -859,7 +859,7 @@ if ($action == 'create') { // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit). // MAILING_LIMIT_SENDBYDAY may be defined ot not (0 or undefined=no limit). - if (!empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { + if (getDolGlobalString('MAILING_NO_USING_PHPMAIL') && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. $linktoadminemailbefore = ''; @@ -872,15 +872,15 @@ if ($action == 'create') { $messagetoshow = str_replace('{s4}', $listofmethods['smtps'], $messagetoshow); setEventMessages($messagetoshow, null, 'warnings'); - if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) { + if (getDolGlobalString('MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS')) { setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); } $_GET["action"] = ''; - } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { - if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') { + } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < 0) { + if (getDolGlobalString('MAILING_LIMIT_WARNING_PHPMAIL') && $sendingmode == 'mail') { setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); } - if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') { + if (getDolGlobalString('MAILING_LIMIT_WARNING_NOPHPMAIL') && $sendingmode != 'mail') { setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); } @@ -892,23 +892,23 @@ if ($action == 'create') { } $_GET["action"] = ''; } else { - if (!empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') { + if (getDolGlobalString('MAILING_LIMIT_WARNING_PHPMAIL') && $sendingmode == 'mail') { setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); } - if (!empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') { + if (getDolGlobalString('MAILING_LIMIT_WARNING_NOPHPMAIL') && $sendingmode != 'mail') { setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); } $text = ''; - if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && $conf->global->MAILING_LIMIT_SENDBYDAY >= 0) { + if (isset($conf->global->MAILING_LIMIT_SENDBYDAY) && getDolGlobalInt('MAILING_LIMIT_SENDBYDAY') >= 0) { $text .= $langs->trans('WarningLimitSendByDay', $conf->global->MAILING_LIMIT_SENDBYDAY); $text .= '

'; } $text .= $langs->trans('ConfirmSendingEmailing').'
'; $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || $conf->global->MAILING_LIMIT_SENDBYCLI >= 0) { + if (!isset($conf->global->MAILING_LIMIT_SENDBYCLI) || getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') >= 0) { $text .= '

'; $text .= $langs->trans("MailingNeedCommand"); $text .= '
'; @@ -992,8 +992,8 @@ if ($action == 'create') { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { + if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); @@ -1063,7 +1063,7 @@ if ($action == 'create') { } if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->hasRight('mailing', 'creer')) { - if (isModEnabled('fckeditor') && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { + if (isModEnabled('fckeditor') && getDolGlobalString('FCKEDITOR_ENABLE_MAILING')) { print '
'.$langs->trans("EditWithEditor").''; } else { print ''.$langs->trans("EditWithTextEditor").''; @@ -1076,7 +1076,7 @@ if ($action == 'create') { //print ''.$langs->trans("PreviewMailing").''; - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('mailing', 'mailing_advance', 'send')) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) { print ''.$langs->trans("TestMailing").''; } else { print ''.$langs->trans("TestMailing").''; @@ -1093,9 +1093,9 @@ if ($action == 'create') { } if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->hasRight('mailing', 'valider')) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { + if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') < 0) { print ''.$langs->trans("SendMailing").''; - } elseif (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('mailing', 'mailing_advance', 'send')) { + } elseif (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) { print ''.$langs->trans("SendMailing").''; } else { print ''.$langs->trans("SendMailing").''; @@ -1107,7 +1107,7 @@ if ($action == 'create') { } if (($object->statut == 2 || $object->statut == 3) && $user->hasRight('mailing', 'valider')) { - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('mailing', 'mailing_advance', 'send')) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'send')) { print ''.$langs->trans("ResetMailing").''; } else { print ''.$langs->trans("ResetMailing").''; @@ -1115,7 +1115,7 @@ if ($action == 'create') { } if (($object->statut <= 1 && $user->hasRight('mailing', 'creer')) || $user->hasRight('mailing', 'supprimer')) { - if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('mailing', 'mailing_advance', 'delete'))) { + if ($object->statut > 0 && (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('mailing', 'mailing_advance', 'delete'))) { print ''.$langs->trans("DeleteMailing").''; } else { print ''.$langs->trans("DeleteMailing").''; @@ -1210,7 +1210,7 @@ if ($action == 'create') { $readonly = 1; // wysiwyg editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly); + $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, !getDolGlobalString('FCKEDITOR_ENABLE_MAILING') ? 0 : 1, 20, '90%', $readonly); $doleditor->Create(); } else { print dol_htmlentitiesbr($object->body); @@ -1282,8 +1282,8 @@ if ($action == 'create') { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) { + if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e05e40da81d..cc147a8c320 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -86,7 +86,7 @@ if (version_compare(phpversion(), '7.0', '>=')) { } // Security check -if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } //$result = restrictedArea($user, 'mailing'); @@ -346,8 +346,8 @@ if ($object->fetch($id) >= 0) { $nbemail = ($object->nbemail ? $object->nbemail : 0); if (is_numeric($nbemail)) { $text = ''; - if ((!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { + if ((getDolGlobalString('MAILING_LIMIT_SENDBYWEB') && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { + if (getDolGlobalInt('MAILING_LIMIT_SENDBYWEB') > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index e22fa89e6fc..9561770eb33 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -601,7 +601,7 @@ class AdvanceTargetingMailing extends CommonObject } //Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $socstatic = new Societe($this->db); $elementtype = $socstatic->table_element; @@ -739,7 +739,7 @@ class AdvanceTargetingMailing extends CommonObject } //Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $contactstatic = new Contact($this->db); $elementtype = $contactstatic->table_element; @@ -842,7 +842,7 @@ class AdvanceTargetingMailing extends CommonObject } //Standard Extrafield feature - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (!getDolGlobalString('MAIN_EXTRAFIELDS_DISABLED')) { $socstatic = new Societe($this->db); $elementtype = $socstatic->table_element; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 50169438baa..136fedc33a5 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -168,7 +168,7 @@ class FormAdvTargetEmailing extends Form $sql_usr .= " WHERE u2.entity IN (0,".$conf->entity.")"; $sql_usr .= " AND u2.rowid = sc.fk_user "; - if (!empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) { + if (getDolGlobalString('USER_HIDE_INACTIVE_IN_COMBOBOX')) { $sql_usr .= " AND u2.statut<>0 "; } $sql_usr .= " ORDER BY name ASC"; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index f8d51b74787..84132f05218 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -188,9 +188,9 @@ class Mailing extends CommonObject public $statut_dest = array(); /** - * @var array statuts + * @var array labelStatus */ - public $statuts = array(); + public $labelStatus = array(); /** * @var array substitutionarray @@ -220,10 +220,10 @@ class Mailing extends CommonObject $this->db = $db; // List of language codes for status - $this->statuts[0] = 'MailingStatusDraft'; - $this->statuts[1] = 'MailingStatusValidated'; - $this->statuts[2] = 'MailingStatusSentPartialy'; - $this->statuts[3] = 'MailingStatusSentCompletely'; + $this->labelStatus[0] = 'MailingStatusDraft'; + $this->labelStatus[1] = 'MailingStatusValidated'; + $this->labelStatus[2] = 'MailingStatusSentPartialy'; + $this->labelStatus[3] = 'MailingStatusSentCompletely'; $this->statut_dest[0] = 'MailingStatusNotSent'; $this->statut_dest[1] = 'MailingStatusSent'; @@ -401,7 +401,7 @@ class Mailing extends CommonObject $this->title = $obj->title; $this->sujet = $obj->sujet; - if (!empty($conf->global->FCKEDITOR_ENABLE_MAILING) && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) { + if (getDolGlobalString('FCKEDITOR_ENABLE_MAILING') && dol_textishtml(dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5))) { $this->body = dol_html_entity_decode($obj->body, ENT_COMPAT | ENT_HTML5); } else { $this->body = $obj->body; @@ -831,7 +831,7 @@ class Mailing extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowEMailing"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -893,8 +893,8 @@ class Mailing extends CommonObject global $langs; $langs->load("mailing"); - $labelStatus = $langs->transnoentitiesnoconv($this->statuts[$status]); - $labelStatusShort = $langs->transnoentitiesnoconv($this->statuts[$status]); + $labelStatus = $langs->transnoentitiesnoconv($this->labelStatus[$status]); + $labelStatusShort = $langs->transnoentitiesnoconv($this->labelStatus[$status]); $statusType = 'status'.$status; if ($status == 2) { diff --git a/htdocs/comm/mailing/info.php b/htdocs/comm/mailing/info.php index a8deafea7aa..dccea76c39b 100644 --- a/htdocs/comm/mailing/info.php +++ b/htdocs/comm/mailing/info.php @@ -34,7 +34,7 @@ $id = GETPOST('id', 'int'); $langs->load("mails"); // Security check -if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } //$result = restrictedArea($user, 'mailing'); diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 83e6e359683..66f9585efb9 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -87,7 +87,7 @@ $permissiontoadd = $user->hasRight('mailing', 'creer'); $permissiontodelete = $user->hasRight('mailing', 'delete'); // Security check -if (!$user->hasRight('mailing', 'lire') || (empty($conf->global->EXTERNAL_USERS_ARE_AUTHORIZED) && $user->socid > 0)) { +if (!$user->hasRight('mailing', 'lire') || (!getDolGlobalString('EXTERNAL_USERS_ARE_AUTHORIZED') && $user->socid > 0)) { accessforbidden(); } //$result = restrictedArea($user, 'mailing'); @@ -243,7 +243,7 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; header("Location: ".dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$id); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index f43d38ef5ce..39bde8ae350 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -86,9 +86,9 @@ $projectid = GETPOST('projectid', 'int'); $rank = (GETPOST('rank', 'int') > 0) ? GETPOST('rank', 'int') : -1; // PDF -$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); +$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS') ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_DESC') ? 1 : 0)); +$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (getDolGlobalString('MAIN_GENERATE_DOCUMENTS_HIDE_REF') ? 1 : 0)); $object = new Propal($db); $extrafields = new ExtraFields($db); @@ -118,11 +118,11 @@ $usercanread = $user->hasRight("propal", "lire"); $usercancreate = $user->hasRight("propal", "creer"); $usercandelete = $user->hasRight("propal", "supprimer"); -$usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); -$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); -$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); +$usercanclose = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->close))); +$usercanvalidate = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $usercancreate) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->validate))); +$usercansend = (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !empty($user->rights->propal->propal_advance->send))); -$usermustrespectpricemin = ((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS)); +$usermustrespectpricemin = ((getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && empty($user->rights->produit->ignore_price_min_advance)) || !getDolGlobalString('MAIN_USE_ADVANCED_PERMS')); $usercancreateorder = $user->hasRight('commande', 'creer'); $usercancreateinvoice = $user->hasRight('facture', 'creer'); $usercancreatecontract = $user->hasRight('contrat', 'creer'); @@ -186,7 +186,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { if ($object->id > 0) { - if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) { + if (getDolGlobalString('PROPAL_CLONE_DATE_DELIVERY')) { //Get difference between old and new delivery date and change lines according to difference $date_delivery = dol_mktime( 12, @@ -256,7 +256,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -277,11 +277,11 @@ if (empty($reshook)) { // Validation $idwarehouse = GETPOST('idwarehouse', 'int'); $result = $object->valid($user); - if ( $result > 0 && ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) ) { + if ( $result > 0 && getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') ) { $result = $object->closeProposal($user, $object::STATUS_SIGNED); } if ($result >= 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { @@ -326,7 +326,7 @@ if (empty($reshook)) { } if ($result < 0) { dol_print_error($db, $object->error); - } elseif (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + } elseif (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); @@ -347,7 +347,7 @@ if (empty($reshook)) { } elseif ($action == 'setecheance' && $usercancreate) { $result = $object->set_echeance($user, dol_mktime(12, 0, 0, GETPOST('echmonth', 'int'), GETPOST('echday', 'int'), GETPOST('echyear', 'int'))); if ($result >= 0) { - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); @@ -634,7 +634,7 @@ if (empty($reshook)) { } } - if (!empty($conf->global->PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT)) { + if (getDolGlobalString('PROPOSAL_AUTO_ADD_AUTHOR_AS_CONTACT')) { $result = $object->add_contact($user->id, 'SALESREPFOLL', 'internal'); if ($result < 0) { $error++; @@ -646,7 +646,7 @@ if (empty($reshook)) { $db->commit(); // Define output language - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $outputlangs = $langs; $newlang = ''; if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { @@ -704,7 +704,7 @@ if (empty($reshook)) { } elseif (GETPOST('statut', 'int') == $object::STATUS_SIGNED || GETPOST('statut', 'int') == $object::STATUS_NOTSIGNED) { $locationTarget = ''; // prevent browser refresh from closing proposal several times - if ($object->statut == $object::STATUS_VALIDATED || ( ! empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE) && $object->statut == $object::STATUS_DRAFT)) { + if ($object->statut == $object::STATUS_VALIDATED || ( getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE') && $object->statut == $object::STATUS_DRAFT)) { $db->begin(); $result = $object->closeProposal($user, GETPOST('statut', 'int'), GETPOST('note_private', 'restricthtml')); @@ -747,7 +747,7 @@ if (empty($reshook)) { if (!$error) { $db->commit(); - if ($deposit && empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if ($deposit && !getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { $ret = $deposit->fetch($deposit->id); // Reload to get new records $outputlangs = $langs; @@ -780,7 +780,7 @@ if (empty($reshook)) { if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); - $result = $object->reopen($user, empty($conf->global->PROPAL_SKIP_ACCEPT_REFUSE)); + $result = $object->reopen($user, !getDolGlobalString('PROPAL_SKIP_ACCEPT_REFUSE')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -882,7 +882,7 @@ if (empty($reshook)) { if ($action == 'modif' && $usercancreate) { $object->setDraft($user); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -983,7 +983,7 @@ if (empty($reshook)) { } else { $idprod = GETPOST('idprod', 'int'); - if (!empty($conf->global->MAIN_DISABLE_FREE_LINES) && $idprod <= 0) { + if (getDolGlobalString('MAIN_DISABLE_FREE_LINES') && $idprod <= 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ProductOrService")), null, 'errors'); $error++; } @@ -1036,7 +1036,7 @@ if (empty($reshook)) { } } - $propal_qty_requirement = (!empty($conf->global->PROPAL_ENABLE_NEGATIVE_QTY) ? ($qty >= 0 || $qty <= 0) : $qty >= 0); + $propal_qty_requirement = (getDolGlobalString('PROPAL_ENABLE_NEGATIVE_QTY') ? ($qty >= 0 || $qty <= 0) : $qty >= 0); if (!$error && $propal_qty_requirement && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { $pu_ht = 0; $pu_ttc = 0; @@ -1075,13 +1075,13 @@ if (empty($reshook)) { $price_base_type = $prod->price_base_type; // If price per segment - if (!empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && $object->thirdparty->price_level) { $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_min_ttc = $prod->multiprices_min_ttc[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) { $tva_tx = $prod->multiprices_tva_tx[$object->thirdparty->price_level]; } @@ -1089,7 +1089,7 @@ if (empty($reshook)) { $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { // If price per customer require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; @@ -1116,7 +1116,7 @@ if (empty($reshook)) { }*/ } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY')) { // If price per quantity if ($prod->prices_by_qty[0]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. @@ -1137,7 +1137,7 @@ if (empty($reshook)) { break; } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { // If price per quantity and customer if ($prod->prices_by_qty[$object->thirdparty->price_level]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. @@ -1182,7 +1182,7 @@ if (empty($reshook)) { $desc = ''; // Define output language - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { $outputlangs = $langs; $newlang = ''; if (empty($newlang) && GETPOST('lang_id', 'aZ09')) { @@ -1202,21 +1202,21 @@ if (empty($reshook)) { } //If text set in desc is the same as product description (as now it's preloaded) whe add it only one time - if ($product_desc==$desc && !empty($conf->global->PRODUIT_AUTOFILL_DESC)) { + if ($product_desc==$desc && getDolGlobalString('PRODUIT_AUTOFILL_DESC')) { $product_desc=''; } - if (!empty($product_desc) && !empty($conf->global->MAIN_NO_CONCAT_DESCRIPTION)) { + if (!empty($product_desc) && getDolGlobalString('MAIN_NO_CONCAT_DESCRIPTION')) { $desc = $product_desc; } else { - $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); + $desc = dol_concatdesc($desc, $product_desc, '', getDolGlobalString('MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION')); } // Add custom code and origin country into description - if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (!empty($prod->customcode) || !empty($prod->country_code))) { + if (!getDolGlobalString('MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE') && (!empty($prod->customcode) || !empty($prod->country_code))) { $tmptxt = '('; // Define output language - if (getDolGlobalInt('MAIN_MULTILANGS') && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { + if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) { $outputlangs = $langs; $newlang = ''; if (empty($newlang) && GETPOST('lang_id', 'alpha')) { @@ -1340,7 +1340,7 @@ if (empty($reshook)) { if ($result > 0) { $db->commit(); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -1482,11 +1482,11 @@ if (empty($reshook)) { $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); $price_min = $product->price_min; - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($object->thirdparty->price_level)) { $price_min = $product->multiprices_min[$object->thirdparty->price_level]; } $price_min_ttc = $product->price_min_ttc; - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($object->thirdparty->price_level)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($object->thirdparty->price_level)) { $price_min_ttc = $product->multiprices_min_ttc[$object->thirdparty->price_level]; } @@ -1545,7 +1545,7 @@ if (empty($reshook)) { if ($result >= 0) { $db->commit(); - if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + if (!getDolGlobalString('MAIN_DISABLE_PDF_AUTOUPDATE')) { // Define output language $outputlangs = $langs; if (getDolGlobalInt('MAIN_MULTILANGS')) { @@ -1649,7 +1649,7 @@ if (empty($reshook)) { } } - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate) { + if (getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB') && $usercancreate) { if ($action == 'addcontact') { if ($object->id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); @@ -1791,7 +1791,7 @@ if ($action == 'create') { if (!empty($objectsrc->multicurrency_code)) { $currency_code = $objectsrc->multicurrency_code; } - if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) { + if (getDolGlobalString('MULTICURRENCY_USE_ORIGIN_TX') && !empty($objectsrc->multicurrency_tx)) { $currency_tx = $objectsrc->multicurrency_tx; } } @@ -1830,11 +1830,11 @@ if ($action == 'create') { if ($soc->fk_warehouse > 0) { $warehouse_id = $soc->fk_warehouse; } - if (isModEnabled('stock') && empty($warehouse_id) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { + if (isModEnabled('stock') && empty($warehouse_id) && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) { + if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) { $warehouse_id = $conf->global->MAIN_DEFAULT_WAREHOUSE; } - if (empty($object->warehouse_id) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + if (empty($object->warehouse_id) && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER')) { $warehouse_id = $user->fk_warehouse; } } @@ -1877,7 +1877,7 @@ if ($action == 'create') { print $soc->getNomUrl(1, 'customer'); print ''; print '
'; - if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($tmpproduct->type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { $preselected = (GETPOSTISSET('idwarehousetoproduce-'.$line->id.'-'.$i) ? GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) : ($object->fk_warehouse > 0 ? $object->fk_warehouse : 'ifone')); print $formproduct->selectWarehouses($preselected, 'idwarehousetoproduce-'.$line->id.'-'.$i, '', 1, 0, $line->fk_product, '', 1, 0, null, 'maxwidth200 csswarehouse_'.$line->id.'_'.$i); } else { diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 4ffee87dd0b..a3e60862ed4 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -52,7 +52,7 @@ if ($res) { print ' ' . $langs->trans("or") . ' '; print $tmpbom->getNomUrl(1); print ' '; - print (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT) ? img_picto('', 'folder') : img_picto('', 'folder-open')); + print (!getDolGlobalString('BOM_SHOW_ALL_BOM_BY_DEFAULT') ? img_picto('', 'folder') : img_picto('', 'folder-open')); } print ''; } else { @@ -115,7 +115,7 @@ if ($resql) { $sub_bom_line->fetch($obj->rowid); //If hidden conf is set, we show directly all the sub-BOM lines - if (empty($conf->global->BOM_SHOW_ALL_BOM_BY_DEFAULT)) { + if (!getDolGlobalString('BOM_SHOW_ALL_BOM_BY_DEFAULT')) { print '
'.$langs->trans('Rate').' / '.$langs->getCurrencySymbol($conf->currency).''.$langs->trans('RateIndirect').' / '.$langs->getCurrencySymbol($conf->currency).'
'.$langs->trans("PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL").''; $dnbdays = '30'; -$backlinks = (!empty($conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL)) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; +$backlinks = (getDolGlobalString('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL')) ? $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL : $dnbdays; print ''; print ''.$dnbdays.'
'.$langs->trans("PARTNERSHIP_BACKLINKS_TO_CHECK").''; -$backlinks = (empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK); +$backlinks = (!getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK') ? '' : $conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK); print ''; print 'dolibarr.org|dolibarr.fr|dolibarr.es
'; // Login - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { + if (!getDolGlobalString('ADHERENT_LOGIN_NOT_REQUIRED')) { print ''; } diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index acfd87504c9..d07ef173071 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -121,15 +121,15 @@ if ($action == 'setvalue' && $user->admin) { */ $IBS_SITE = "1999888"; // Site test -if (empty($conf->global->PAYBOX_IBS_SITE)) { +if (!getDolGlobalString('PAYBOX_IBS_SITE')) { $conf->global->PAYBOX_IBS_SITE = $IBS_SITE; } $IBS_RANG = "99"; // Rang test -if (empty($conf->global->PAYBOX_IBS_RANG)) { +if (!getDolGlobalString('PAYBOX_IBS_RANG')) { $conf->global->PAYBOX_IBS_RANG = $IBS_RANG; } $IBS_DEVISE = "978"; // Euro -if (empty($conf->global->PAYBOX_IBS_DEVISE)) { +if (!getDolGlobalString('PAYBOX_IBS_DEVISE')) { $conf->global->PAYBOX_IBS_DEVISE = $IBS_DEVISE; } @@ -279,7 +279,7 @@ print ''; print ''; print '
'.$langs->trans("Login").' / '.$langs->trans("Id").''.$object->login.' 
'; print $langs->trans("SecurityTokenIsUnique").''; -print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE", (empty($conf->global->PAYMENT_SECURITY_TOKEN) ? 0 : $conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE), 1); +print $form->selectyesno("PAYMENT_SECURITY_TOKEN_UNIQUE", (!getDolGlobalString('PAYMENT_SECURITY_TOKEN') ? 0 : $conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE), 1); print '
'; diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 0133493dcef..767a4864981 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -44,15 +44,15 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) // Clean parameters $PBX_IDENTIFIANT = "2"; // Identifiant pour v2 test - if (!empty($conf->global->PAYBOX_PBX_IDENTIFIANT)) { + if (getDolGlobalString('PAYBOX_PBX_IDENTIFIANT')) { $PBX_IDENTIFIANT = $conf->global->PAYBOX_PBX_IDENTIFIANT; } $IBS_SITE = "1999888"; // Site test - if (!empty($conf->global->PAYBOX_IBS_SITE)) { + if (getDolGlobalString('PAYBOX_IBS_SITE')) { $IBS_SITE = $conf->global->PAYBOX_IBS_SITE; } $IBS_RANG = "99"; // Rang test - if (!empty($conf->global->PAYBOX_IBS_RANG)) { + if (getDolGlobalString('PAYBOX_IBS_RANG')) { $IBS_RANG = $conf->global->PAYBOX_IBS_RANG; } $IBS_DEVISE = "840"; // Currency (Dollar US by default) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index dae50bd07e2..ec786f6ce6b 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -82,7 +82,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, //' //'------------------------------------------------- - if (empty($conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY)) { + if (!getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY')) { $conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY = 'integral'; } @@ -213,17 +213,17 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, //$nvpstr = $nvpstr . "&VERSION=".$API_version; // Already added by hash_call $nvpstr = $nvpstr."&RETURNURL=".urlencode($returnURL); $nvpstr = $nvpstr."&CANCELURL=".urlencode($cancelURL); - if (!empty($conf->global->PAYPAL_ALLOW_NOTES)) { + if (getDolGlobalString('PAYPAL_ALLOW_NOTES')) { $nvpstr = $nvpstr."&ALLOWNOTE=0"; } - if (empty($conf->global->PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS)) { + if (!getDolGlobalString('PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS')) { $nvpstr = $nvpstr."&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted } else { $nvpstr = $nvpstr."&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory) } $nvpstr = $nvpstr."&SOLUTIONTYPE=".urlencode($solutionType); $nvpstr = $nvpstr."&LANDINGPAGE=".urlencode($landingPage); - if (!empty($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER)) { + if (getDolGlobalString('PAYPAL_CUSTOMER_SERVICE_NUMBER')) { $nvpstr = $nvpstr."&CUSTOMERSERVICENUMBER=".urlencode($conf->global->PAYPAL_CUSTOMER_SERVICE_NUMBER); // Hotline phone number } @@ -261,7 +261,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $nvpstr = $nvpstr."&".$paypalprefix."DESC=".urlencode($desc); // DESC deprecated by paypal -> PAYMENTREQUEST_n_DESC } - if (!empty($conf->global->PAYPAL_LOGOIMG) && $mysoc->logo) { + if (getDolGlobalString('PAYPAL_LOGOIMG') && $mysoc->logo) { global $dolibarr_main_url_root; // Define $urlwithroot @@ -272,10 +272,10 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, $urllogo = $urlwithroot."/viewimage.php?modulepart=mycompany&file=".urlencode('logos/'.$mysoc->logo); $nvpstr = $nvpstr."&LOGOIMG=".urlencode($urllogo); } - if (!empty($conf->global->PAYPAL_BRANDNAME)) { + if (getDolGlobalString('PAYPAL_BRANDNAME')) { $nvpstr = $nvpstr."&BRANDNAME=".urlencode($conf->global->PAYPAL_BRANDNAME); // BRANDNAME } - if (!empty($conf->global->PAYPAL_NOTETOBUYER)) { + if (getDolGlobalString('PAYPAL_NOTETOBUYER')) { $nvpstr = $nvpstr."&NOTETOBUYER=".urlencode($conf->global->PAYPAL_NOTETOBUYER); // PAYPAL_NOTETOBUYER } @@ -457,7 +457,7 @@ function hash_call($methodName, $nvpStr) // TODO problem with triggers $API_version = "98.0"; - if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) { // We can force sand box with param 'forcesandbox' + if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha')) { // We can force sand box with param 'forcesandbox' $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; } else { @@ -467,19 +467,19 @@ function hash_call($methodName, $nvpStr) // Clean parameters $PAYPAL_API_USER = ""; - if (!empty($conf->global->PAYPAL_API_USER)) { + if (getDolGlobalString('PAYPAL_API_USER')) { $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER; } $PAYPAL_API_PASSWORD = ""; - if (!empty($conf->global->PAYPAL_API_PASSWORD)) { + if (getDolGlobalString('PAYPAL_API_PASSWORD')) { $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD; } $PAYPAL_API_SIGNATURE = ""; - if (!empty($conf->global->PAYPAL_API_SIGNATURE)) { + if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE; } $PAYPAL_API_SANDBOX = ""; - if (!empty($conf->global->PAYPAL_API_SANDBOX)) { + if (getDolGlobalString('PAYPAL_API_SANDBOX')) { $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX; } // TODO END problem with triggers @@ -496,7 +496,7 @@ function hash_call($methodName, $nvpStr) curl_setopt($ch, CURLOPT_URL, $API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); // TLSv1 by default or change to TLSv1.2 in module configuration - curl_setopt($ch, CURLOPT_SSLVERSION, (empty($conf->global->PAYPAL_SSLVERSION) ? 1 : $conf->global->PAYPAL_SSLVERSION)); + curl_setopt($ch, CURLOPT_SSLVERSION, (!getDolGlobalString('PAYPAL_SSLVERSION') ? 1 : $conf->global->PAYPAL_SSLVERSION)); $ssl_verifypeer = -1; @@ -505,7 +505,7 @@ function hash_call($methodName, $nvpStr) global $dolibarr_main_prod; $ssl_verifypeer = ($dolibarr_main_prod ? true : false); } - if (!empty($conf->global->MAIN_CURL_DISABLE_VERIFYPEER)) { + if (getDolGlobalString('MAIN_CURL_DISABLE_VERIFYPEER')) { $ssl_verifypeer = 0; } @@ -513,8 +513,8 @@ function hash_call($methodName, $nvpStr) curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false)); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false)); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, empty($conf->global->MAIN_USE_CONNECT_TIMEOUT) ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); - curl_setopt($ch, CURLOPT_TIMEOUT, empty($conf->global->MAIN_USE_RESPONSE_TIMEOUT) ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT); + curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index 713c304323b..dce0b0908b5 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -47,7 +47,7 @@ $API_version = "56"; ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token= ' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token= */ -if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha')) { // We can force sand box with param 'forcesandbox' +if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha')) { // We can force sand box with param 'forcesandbox' $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; } else { @@ -57,19 +57,19 @@ if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha' // Clean parameters $PAYPAL_API_USER = ""; -if (!empty($conf->global->PAYPAL_API_USER)) { +if (getDolGlobalString('PAYPAL_API_USER')) { $PAYPAL_API_USER = $conf->global->PAYPAL_API_USER; } $PAYPAL_API_PASSWORD = ""; -if (!empty($conf->global->PAYPAL_API_PASSWORD)) { +if (getDolGlobalString('PAYPAL_API_PASSWORD')) { $PAYPAL_API_PASSWORD = $conf->global->PAYPAL_API_PASSWORD; } $PAYPAL_API_SIGNATURE = ""; -if (!empty($conf->global->PAYPAL_API_SIGNATURE)) { +if (getDolGlobalString('PAYPAL_API_SIGNATURE')) { $PAYPAL_API_SIGNATURE = $conf->global->PAYPAL_API_SIGNATURE; } $PAYPAL_API_SANDBOX = ""; -if (!empty($conf->global->PAYPAL_API_SANDBOX)) { +if (getDolGlobalString('PAYPAL_API_SANDBOX')) { $PAYPAL_API_SANDBOX = $conf->global->PAYPAL_API_SANDBOX; } @@ -78,4 +78,4 @@ $PROXY_HOST = $conf->global->MAIN_PROXY_HOST; $PROXY_PORT = $conf->global->MAIN_PROXY_PORT; $PROXY_USER = $conf->global->MAIN_PROXY_USER; $PROXY_PASS = $conf->global->MAIN_PROXY_PASS; -$USE_PROXY = empty($conf->global->MAIN_PROXY_USE) ?false:true; +$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ?false:true; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 23caab3af53..ace7a095e95 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -60,16 +60,16 @@ $select_pricing_rules = array( 'PRODUIT_CUSTOMER_PRICES'=>$langs->trans('PriceByCustomer'), // Different price for each customer ); $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || !empty($conf->global->$keyforparam)) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1 || !empty($conf->global->$keyforparam)) { $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY'] = $langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice } $keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2 || !empty($conf->global->$keyforparam)) { +if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2 || !empty($conf->global->$keyforparam)) { $select_pricing_rules['PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'] = $langs->trans('MultiPricesAbility').'+'.$langs->trans('PriceByQuantity').' ('.$langs->trans("VersionExperimental").')'; } // Clean param -if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($conf->global->PRODUIT_MULTIPRICES_LIMIT)) { +if (getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_MULTIPRICES_LIMIT')) { dolibarr_set_const($db, 'PRODUIT_MULTIPRICES_LIMIT', 5, 'chaine', 0, '', $conf->entity); } @@ -324,10 +324,10 @@ foreach ($dirproduct as $dirroot) { $modCodeProduct = new $file; // Show modules according to features level - if ($modCodeProduct->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($modCodeProduct->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { continue; } - if ($modCodeProduct->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($modCodeProduct->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { continue; } @@ -336,7 +336,7 @@ foreach ($dirproduct as $dirroot) { print '
'.$modCodeProduct->info($langs).''.$modCodeProduct->getExample($langs).''."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; $current_rule = 'PRODUCT_PRICE_UNIQ'; -if (!empty($conf->global->PRODUIT_MULTIPRICES)) { +if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $current_rule = 'PRODUIT_MULTIPRICES'; } -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { +if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY')) { $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY'; } -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { +if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { $current_rule = 'PRODUIT_CUSTOMER_PRICES'; } -if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { +if (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { $current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'; } print $form->selectarray("princingrule", $select_pricing_rules, $current_rule, 0, 0, 0, '', 1, 0, 0, '', 'maxwidth400', 1); @@ -585,7 +585,7 @@ print '
'.$langs->trans("MultiPricesNumPrices").'
'.$langs->trans("NumberOfProductShowInSelect").'
'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").''; - print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (!empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE) ? $conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE : 0), 1); + print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage", (getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE') ? $conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE : 0), 1); print '
'.$module->name."\n"; @@ -301,8 +301,8 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue; + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue; if ($module->isEnabled()) { print '
'.$module->name."\n"; @@ -419,10 +419,10 @@ foreach ($dirmodels as $reldir) { $module = new $classname($db); $modulequalified = 1; - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $modulequalified = 0; } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { $modulequalified = 0; } diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index ed5d456b3a5..b7b5470a35c 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -141,7 +141,7 @@ if ($id > 0 || $ref) { $help_url = 'EN:Module_Agenda_En|FR:Module_Agenda|DE:Modul_Terminplanung'; - if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { + if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/productnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->name." - ".$title; } llxHeader('', $title, $help_url); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 65ba3593630..cb4c4e50afb 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -134,7 +134,7 @@ if ($action == 'fetch' && !empty($id)) { } // Price by qty - if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { // If we need a particular price related to qty + if (!empty($price_by_qty_rowid) && $price_by_qty_rowid >= 1 && (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { // If we need a particular price related to qty $sql = "SELECT price, unitprice, quantity, remise_percent"; $sql .= " FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql .= " WHERE rowid = ".((int) $price_by_qty_rowid); @@ -159,7 +159,7 @@ if ($action == 'fetch' && !empty($id)) { } // Multiprice (1 price per level) - if (!$found && isset($price_level) && $price_level >= 1 && (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))) { // If we need a particular price level (from 1 to 6) + if (!$found && isset($price_level) && $price_level >= 1 && (getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES'))) { // If we need a particular price level (from 1 to 6) $sql = "SELECT price, price_ttc, price_base_type,"; $sql .= " tva_tx, default_vat_code"; // Vat rate and code will be used if PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL is on. $sql .= " FROM ".MAIN_DB_PREFIX."product_price "; @@ -177,7 +177,7 @@ if ($action == 'fetch' && !empty($id)) { $outprice_ht = price($objp->price); // formated for langage user because is inserted into input field $outprice_ttc = price($objp->price_ttc); // formated for langage user because is inserted into input field $outpricebasetype = $objp->price_base_type; - if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { $outtva_tx_formated = price($objp->tva_tx); // formated for langage user because is inserted into input field $outtva_tx = price2num($objp->tva_tx); // international numeric $outdefault_vat_code = $objp->default_vat_code; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 6f7eea81049..dd3bd624543 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -96,7 +96,7 @@ $refalreadyexists = 0; // Get parameters $id = GETPOST('id', 'int'); -if (!empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS)) { +if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) { $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'nohtml') : null); } else { $ref = (GETPOSTISSET('ref') ? GETPOST('ref', 'alpha') : null); @@ -120,10 +120,10 @@ $accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); $checkmandatory = GETPOST('accountancy_code_buy_export', 'alpha'); // by default 'alphanohtml' (better security); hidden conf MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML allows basic html -if (!empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS)) { +if (getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_REF_LABELS')) { $label_security_check = 'nohtml'; } else { - $label_security_check = empty($conf->global->MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML) ? 'alphanohtml' : 'restricthtml'; + $label_security_check = !getDolGlobalString('MAIN_SECURITY_ALLOW_UNSECURED_LABELS_WITH_HTML') ? 'alphanohtml' : 'restricthtml'; } if (!empty($user->socid)) { @@ -131,7 +131,7 @@ if (!empty($user->socid)) { } // Load object modCodeProduct -$module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); +$module = (getDolGlobalString('PRODUCT_CODEPRODUCT_ADDON') ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } @@ -212,7 +212,7 @@ if ($cancel) { } $createbarcode = isModEnabled('barcode'); -if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'creer_advance')) { +if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'creer_advance')) { $createbarcode = 0; } @@ -492,7 +492,7 @@ if (empty($reshook)) { $error++; } if (empty($ref)) { - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors'); $action = "create"; $error++; @@ -664,7 +664,7 @@ if (empty($reshook)) { } // MultiPrix - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { for ($i = 2; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { if (GETPOSTISSET("price_".$i)) { $object->multiprices["$i"] = price2num(GETPOST("price_".$i), 'MU'); @@ -681,7 +681,7 @@ if (empty($reshook)) { $error++; } - if (!$ref && !empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + if (!$ref && getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { // Generate ref... $ref = $modCodeProduct->getNextValue($object, $type); } @@ -741,7 +741,7 @@ if (empty($reshook)) { //Need dol_clone methode 1 (same object class) because update product use hasbatch() method on oldcopy $object->oldcopy = dol_clone($object, 1); - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { $object->ref = $ref; } $object->label = GETPOST('label', $label_security_check); @@ -750,7 +750,7 @@ if (empty($reshook)) { $object->description = $desc; $object->url = GETPOST('url'); - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { $object->note_private = dol_htmlcleanlastbr(GETPOST('note_private', 'restricthtml')); $object->note = $object->note_private; } @@ -1069,7 +1069,7 @@ if (empty($reshook)) { $pu_ht = $object->multiprices[$soc->price_level]; $pu_ttc = $object->multiprices_ttc[$soc->price_level]; $price_base_type = $object->multiprices_base_type[$soc->price_level]; - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new ProductCustomerPrice($db); @@ -1273,7 +1273,7 @@ llxHeader('', $title, $help_url); // Load object modBarCodeProduct $res = 0; -if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { +if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { $module = strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); $dirbarcode = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); foreach ($dirbarcode as $dirroot) { @@ -1318,7 +1318,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Load object modCodeProduct - $module = (!empty($conf->global->PRODUCT_CODEPRODUCT_ADDON) ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); + $module = (getDolGlobalString('PRODUCT_CODEPRODUCT_ADDON') ? $conf->global->PRODUCT_CODEPRODUCT_ADDON : 'mod_codeproduct_leopard'); if (substr($module, 0, 16) == 'mod_codeproduct_' && substr($module, -3) == 'php') { $module = substr($module, 0, dol_strlen($module) - 4); } @@ -1368,7 +1368,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (empty($reshook)) { print ''; - if (empty($conf->global->PRODUCT_GENERATE_REF_AFTER_FORM)) { + if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { print ''; $tmpcode = ''; if (!empty($modCodeProduct->code_auto)) { @@ -1453,7 +1453,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } $showbarcode = isModEnabled('barcode'); - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'lire_advance')) { $showbarcode = 0; } @@ -1462,7 +1462,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (GETPOSTISSET('fk_barcode_type')) { $fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0; } else { - if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); } else { $fk_barcode_type=0; @@ -1489,7 +1489,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $doleditor->Create(); print ""; - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + if (!getDolGlobalString('PRODUCT_DISABLE_PUBLIC_URL')) { // Public URL print ''; print ''; - if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { + if (!getDolGlobalString('PRODUCT_DISABLE_STOCK_LEVELS')) { // Stock min level print ''; } } else { - if (empty($conf->global->PRODUCT_DISABLE_STOCK_LEVELS)) { + if (!getDolGlobalString('PRODUCT_DISABLE_STOCK_LEVELS')) { print ''; print ''; } @@ -1554,7 +1554,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } if ($type != 1) { // Nature, Weight and volume only applies to products and not to services - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) { // Nature print ''; } // Brut Length - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SIZE')) { print ''; } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) { // Brut Surface print ''; } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) { // Brut Volume print ''; } - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + if (getDolGlobalString('PRODUCT_ADD_NET_MEASURE')) { // Net Measure print ''; } } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { print ''; print ''; // Origin country @@ -1629,9 +1629,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; // State - if (empty($conf->global->PRODUCT_DISABLE_STATE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_STATE')) { print ''; - if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + if (getDolGlobalString('MAIN_SHOW_REGION_IN_STATE_SELECT') && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { print ''; print ''; } @@ -1681,8 +1681,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'; - if (empty($conf->global->PRODUCT_DISABLE_PRICES)) { - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!getDolGlobalString('PRODUCT_DISABLE_PRICES')) { + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { // We do no show price array on create when multiprices enabled. // We must set them on prices tab. print '
'.$langs->trans("PublicUrl").''; print img_picto('', 'globe', 'class="pictofixedwidth"'); @@ -1508,7 +1508,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; print ''; @@ -1521,7 +1521,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; print $formproduct->selectProductNature('finished', $object->finished); @@ -1563,17 +1563,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } if ($type != 1) { - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + if (!getDolGlobalString('PRODUCT_DISABLE_WEIGHT')) { // Brut Weight print '
'.$langs->trans("Weight").''; print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); + print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; print img_picto('', 'fa-ruler', 'class="pictofixedwidth"'); print ' x '; @@ -1582,14 +1582,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2); print '
'.$langs->trans("Surface").''; print ''; print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2); print '
'.$langs->trans("Volume").''; print ''; @@ -1597,17 +1597,17 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$langs->trans("NetMeasure").''; print ''; - print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (empty($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); + print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); print '
'.$langs->trans('DefaultUnitToShow').''; print $form->selectUnits(empty($line->fk_unit) ? $conf->global->PRODUCT_USE_UNITS : $line->fk_unit, 'units'); @@ -1615,7 +1615,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Custom code - if (empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO) && empty($type)) { + if (!getDolGlobalString('PRODUCT_DISABLE_CUSTOM_INFO') && empty($type)) { print '
'.$langs->trans("CustomCode").'
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; @@ -1644,7 +1644,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Quality control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + if (getDolGlobalString('PRODUCT_LOT_ENABLE_QUALITY_CONTROL')) { print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'; @@ -1725,7 +1725,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''."\n"; print '
'; - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + if (!getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING')) { if (isModEnabled('accounting')) { // Accountancy_code_sell print ''; @@ -1914,7 +1914,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$langs->trans("ProductAccountancySellCode").'
'; // Ref - if (empty($conf->global->MAIN_PRODUCT_REF_NOT_EDITABLE)) { + if (!getDolGlobalString('MAIN_PRODUCT_REF_NOT_EDITABLE')) { print ''; } else { print ''; @@ -1951,7 +1951,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Batch number managment if (isModEnabled('productbatch')) { - if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($object->isProduct() || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { print ''; } else { - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) { // Nature print ''; } - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SIZE')) { // Brut Length print ''; } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) { // Brut Surface print ''; } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) { // Brut Volume print ''; } - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + if (getDolGlobalString('PRODUCT_ADD_NET_MEASURE')) { // Net Measure print ''; print ''; // Origin country print ''; @@ -2236,9 +2236,9 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; // State - if (empty($conf->global->PRODUCT_DISABLE_STATE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_STATE')) { print ''; - if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { + if (getDolGlobalString('MAIN_SHOW_REGION_IN_STATE_SELECT') && (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) { print ''; print ''; } @@ -2287,7 +2287,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Note private - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'.$langs->trans("ManageLotSerial").''; $statutarray = array('0' => $langs->trans("ProductStatusNotOnBatch"), '1' => $langs->trans("ProductStatusOnBatch"), '2' => $langs->trans("ProductStatusOnSerial")); @@ -2062,7 +2062,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Barcode $showbarcode = isModEnabled('barcode'); - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'lire_advance')) { $showbarcode = 0; } @@ -2072,7 +2072,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $fk_barcode_type = GETPOST('fk_barcode_type'); } else { $fk_barcode_type = $object->barcode_type; - if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) { + if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } } @@ -2100,7 +2100,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print "\n"; // Public Url - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + if (!getDolGlobalString('PRODUCT_DISABLE_PUBLIC_URL')) { print '
'.$langs->trans("PublicUrl").''; print img_picto('', 'globe', 'class="pictofixedwidth"'); print ''; @@ -2158,7 +2158,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; print $formproduct->selectProductNature('finished', (GETPOSTISSET('finished') ? GETPOST('finished') : $object->finished)); @@ -2174,7 +2174,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } if (!$object->isService()) { - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + if (!getDolGlobalString('PRODUCT_DISABLE_WEIGHT')) { // Brut Weight print '
'.$langs->trans("Weight").''; print ' '; @@ -2182,7 +2182,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; print 'x'; @@ -2191,14 +2191,14 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units') : $object->length_units, 0, 2); print '
'.$langs->trans("Surface").''; print ' '; print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units') : $object->surface_units, 0, 2); print '
'.$langs->trans("Volume").''; print ' '; @@ -2206,7 +2206,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$langs->trans("NetMeasure").''; print ' '; @@ -2215,7 +2215,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { print '
'.$langs->trans('DefaultUnitToShow').''; print $form->selectUnits($object->fk_unit, 'units'); @@ -2223,7 +2223,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Custom code - if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { + if (!$object->isService() && !getDolGlobalString('PRODUCT_DISABLE_CUSTOM_INFO')) { print '
'.$langs->trans("CustomCode").'
'.$langs->trans("CountryOrigin").'
'.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; @@ -2252,7 +2252,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Quality control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + if (getDolGlobalString('PRODUCT_LOT_ENABLE_QUALITY_CONTROL')) { print '
'.$langs->trans("LifeTime").'
'.$langs->trans("QCFrequency").'
'.$langs->trans("NoteNotVisibleOnBill").''; $doleditor = new DolEditor('note_private', $object->note_private, '', 140, 'dolibarr_notes', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_4, '90%'); @@ -2302,7 +2302,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + if (!getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING')) { if (isModEnabled('accounting')) { // Accountancy_code_sell print ''; @@ -2392,7 +2392,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Fiche en mode visu $showbarcode = isModEnabled('barcode'); - if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) { + if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && !$user->hasRight('barcode', 'lire_advance')) { $showbarcode = 0; } @@ -2427,7 +2427,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (isModEnabled("product") && isModEnabled("service")) { $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); print ''; @@ -2491,12 +2491,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Batch number management (to batch) if (isModEnabled('productbatch')) { - if ($object->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($object->isProduct() || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { print ''; - if ((($object->status_batch == '1' && !empty($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') - || ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced' && !empty($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS)))) { + if ((($object->status_batch == '1' && getDolGlobalString('PRODUCTBATCH_LOT_USE_PRODUCT_MASKS') && getDolGlobalString('PRODUCTBATCH_LOT_ADDON') == 'mod_lot_advanced') + || ($object->status_batch == '2' && getDolGlobalString('PRODUCTBATCH_SN_ADDON') == 'mod_sn_advanced' && getDolGlobalString('PRODUCTBATCH_SN_USE_PRODUCT_MASKS')))) { print ''; @@ -2504,7 +2504,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } } - if (empty($conf->global->PRODUCT_DISABLE_ACCOUNTING)) { + if (!getDolGlobalString('PRODUCT_DISABLE_ACCOUNTING')) { // Accountancy sell code print ''; // Public URL - if (empty($conf->global->PRODUCT_DISABLE_PUBLIC_URL)) { + if (!getDolGlobalString('PRODUCT_DISABLE_PUBLIC_URL')) { print ''; @@ -2678,7 +2678,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''; } else { - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) { // Nature print '\n"; } - if (empty($conf->global->PRODUCT_DISABLE_SIZE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SIZE')) { // Brut Length print '\n"; } - if (empty($conf->global->PRODUCT_DISABLE_SURFACE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) { // Brut Surface print '\n"; } - if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) { + if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) { // Brut Volume print '\n"; } - if (!empty($conf->global->PRODUCT_ADD_NET_MEASURE)) { + if (getDolGlobalString('PRODUCT_ADD_NET_MEASURE')) { // Net Measure print ''; // Origin country code @@ -2782,7 +2782,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Quality Control - if (!empty($conf->global->PRODUCT_LOT_ENABLE_QUALITY_CONTROL)) { + if (getDolGlobalString('PRODUCT_LOT_ENABLE_QUALITY_CONTROL')) { print ''; print ''; } @@ -2799,7 +2799,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Note private - if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) { + if (getDolGlobalString('MAIN_DISABLE_NOTES_TAB')) { print ' '."\n"; print ''."\n"; print ' '."\n"; @@ -2853,10 +2853,10 @@ if (($action == 'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->d array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneContentProduct"), 'value' => 1), array('type' => 'checkbox', 'name' => 'clone_categories', 'label' => $langs->trans("CloneCategoriesProduct"), 'value' => 1), ); - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $formquestionclone[] = array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("CustomerPrices").')', 'value' => 0); } - if (!empty($conf->global->PRODUIT_SOUSPRODUITS)) { + if (getDolGlobalString('PRODUIT_SOUSPRODUITS')) { $formquestionclone[] = array('type' => 'checkbox', 'name' => 'clone_composition', 'label' => $langs->trans('CloneCompositionProduct'), 'value' => 1); } @@ -2928,7 +2928,7 @@ if ($action != 'create' && $action != 'edit') { * All the "Add to" areas if PRODUCT_ADD_FORM_ADD_TO is set */ -if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == '' || $action == 'view') && $object->status) { +if (getDolGlobalString('PRODUCT_ADD_FORM_ADD_TO') && $object->id && ($action == '' || $action == 'view') && $object->status) { //Variable used to check if any text is going to be printed $html = ''; //print '
'; diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 69e3d5f92c6..862d50f6721 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -373,7 +373,7 @@ class Products extends DolibarrApi $result = $this->product->update($id, DolibarrApiAccess::$user, 1, 'update', $updatetype); // If price mode is 1 price per product - if ($result > 0 && !empty($conf->global->PRODUCT_PRICE_UNIQ)) { + if ($result > 0 && getDolGlobalString('PRODUCT_PRICE_UNIQ')) { // We update price only if it was changed $pricemodified = false; if ($this->product->price_base_type != $oldproduct->price_base_type) { @@ -617,7 +617,7 @@ class Products extends DolibarrApi throw new RestException(401); } - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } @@ -659,7 +659,7 @@ class Products extends DolibarrApi throw new RestException(401); } - if (empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } @@ -708,7 +708,7 @@ class Products extends DolibarrApi throw new RestException(401); } - if (empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + if (!getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY')) { throw new RestException(400, 'API not available: this mode of pricing is not enabled by setup'); } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index ff7f691b31e..79f54094138 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -290,7 +290,7 @@ class FormProduct dol_syslog(get_class($this)."::selectWarehouses $selected, $htmlname, $filterstatus, $empty, $disabled, $fk_product, $empty_label, $showstock, $forcecombo, $morecss", LOG_DEBUG); $out = ''; - if (empty($conf->global->ENTREPOT_EXTRA_STATUS)) { + if (!getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { $filterstatus = ''; } if (!empty($fk_product) && $fk_product > 0) { @@ -308,11 +308,11 @@ class FormProduct if (strpos($htmlname, 'search_') !== 0) { if (empty($user->fk_warehouse) || $user->fk_warehouse == -1) { - if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE')) { $selected = $conf->global->MAIN_DEFAULT_WAREHOUSE; } } else { - if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) { + if (is_scalar($selected) && ($selected == '-2' || $selected == 'ifone') && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER')) { $selected = $user->fk_warehouse; } } @@ -430,11 +430,11 @@ class FormProduct if (strpos($htmlname, 'search_') !== 0) { if (empty($user->fk_workstation) || $user->fk_workstation == -1) { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WORKSTATION)) { + if (($selected == '-2' || $selected == 'ifone') && getDolGlobalString('MAIN_DEFAULT_WORKSTATION')) { $selected = $conf->global->MAIN_DEFAULT_WORKSTATION; } } else { - if (($selected == '-2' || $selected == 'ifone') && !empty($conf->global->MAIN_DEFAULT_WORKSTATION)) { + if (($selected == '-2' || $selected == 'ifone') && getDolGlobalString('MAIN_DEFAULT_WORKSTATION')) { $selected = $user->fk_workstation; } } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 10936d9d1fc..35db1cbaf12 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -803,7 +803,7 @@ class Product extends CommonObject $sql .= ", price_base_type"; $sql .= ", tobuy"; $sql .= ", tosell"; - if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= ", accountancy_code_buy"; $sql .= ", accountancy_code_buy_intra"; $sql .= ", accountancy_code_buy_export"; @@ -832,7 +832,7 @@ class Product extends CommonObject $sql .= ", '".$this->db->escape($this->price_base_type)."'"; $sql .= ", ".((int) $this->status); $sql .= ", ".((int) $this->status_buy); - if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_buy_intra)."'"; $sql .= ", '".$this->db->escape($this->accountancy_code_buy_export)."'"; @@ -871,7 +871,7 @@ class Product extends CommonObject } // update accountancy for this entity - if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " .((int) $this->id) . " AND entity = " . ((int) $conf->entity)); $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; @@ -1005,7 +1005,7 @@ class Product extends CommonObject { // phpcs:enable global $conf; - if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { + if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { $module = strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM); $dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); @@ -1156,7 +1156,7 @@ class Product extends CommonObject if ($this->hasbatch() && !$this->oldcopy->hasbatch()) { //$valueforundefinedlot = 'Undefined'; // In previous version, 39 and lower $valueforundefinedlot = '000000'; - if (!empty($conf->global->STOCK_DEFAULT_BATCH)) { + if (getDolGlobalString('STOCK_DEFAULT_BATCH')) { $valueforundefinedlot = $conf->global->STOCK_DEFAULT_BATCH; } @@ -1267,7 +1267,7 @@ class Product extends CommonObject $sql .= ", note = ".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : 'null'); $sql .= ", note_public = ".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : 'null'); $sql .= ", duration = '".$this->db->escape($this->duration_value.$this->duration_unit)."'"; - if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= ", accountancy_code_buy = '" . $this->db->escape($this->accountancy_code_buy) . "'"; $sql .= ", accountancy_code_buy_intra = '" . $this->db->escape($this->accountancy_code_buy_intra) . "'"; $sql .= ", accountancy_code_buy_export = '" . $this->db->escape($this->accountancy_code_buy_export) . "'"; @@ -1302,7 +1302,7 @@ class Product extends CommonObject $action = 'update'; // update accountancy for this entity - if (!$error && !empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!$error && getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $this->db->query("DELETE FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = " . ((int) $this->id) . " AND entity = " . ((int) $conf->entity)); $sql = "INSERT INTO " . $this->db->prefix() . "product_perentity ("; @@ -1633,19 +1633,19 @@ class Product extends CommonObject $sql2 .= " SET "; $sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", note='".$this->db->escape($this->other)."'"; } $sql2 .= " WHERE fk_product = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".$this->db->prefix()."product_lang (fk_product, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", note"; } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',"; $sql2 .= " '".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", '".$this->db->escape($this->other)."'"; } $sql2 .= ")"; @@ -1673,19 +1673,19 @@ class Product extends CommonObject $sql2 .= " SET "; $sql2 .= " label = '".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description = '".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", note = '".$this->db->escape($this->multilangs["$key"]["other"])."'"; } $sql2 .= " WHERE fk_product = ".((int) $this->id)." AND lang = '".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".$this->db->prefix()."product_lang (fk_product, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", note"; } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { + if (getDolGlobalString('PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION')) { $sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'"; } $sql2 .= ")"; @@ -1982,12 +1982,12 @@ class Product extends CommonObject $price_base_type = $this->price_base_type; // If price per segment - if (!empty($conf->global->PRODUIT_MULTIPRICES) && !empty($thirdparty_buyer->price_level)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES') && !empty($thirdparty_buyer->price_level)) { $pu_ht = $this->multiprices[$thirdparty_buyer->price_level]; $pu_ttc = $this->multiprices_ttc[$thirdparty_buyer->price_level]; $price_min = $this->multiprices_min[$thirdparty_buyer->price_level]; $price_base_type = $this->multiprices_base_type[$thirdparty_buyer->price_level]; - if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) { // using this option is a bug. kept for backward compatibility + if (getDolGlobalString('PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL')) { // using this option is a bug. kept for backward compatibility if (isset($this->multiprices_tva_tx[$thirdparty_buyer->price_level])) { $tva_tx = $this->multiprices_tva_tx[$thirdparty_buyer->price_level]; } @@ -1998,7 +1998,7 @@ class Product extends CommonObject $tva_npr = 0; } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) { // If price per customer require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; @@ -2023,7 +2023,7 @@ class Product extends CommonObject } } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY')) { // If price per quantity if ($this->prices_by_qty[0]) { // yes, this product has some prices per quantity @@ -2041,7 +2041,7 @@ class Product extends CommonObject break; } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) { // If price per quantity and customer if ($this->prices_by_qty[$thirdparty_buyer->price_level]) { // yes, this product has some prices per quantity @@ -2132,7 +2132,7 @@ class Product extends CommonObject $this->fourn_multicurrency_tx = $obj->multicurrency_tx; $this->fourn_multicurrency_id = $obj->fk_multicurrency; $this->fourn_multicurrency_code = $obj->multicurrency_code; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { + if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) { $this->packaging = $obj->packaging; } $result = $obj->fk_product; @@ -2197,7 +2197,7 @@ class Product extends CommonObject $this->fourn_multicurrency_tx = $obj->multicurrency_tx; $this->fourn_multicurrency_id = $obj->fk_multicurrency; $this->fourn_multicurrency_code = $obj->multicurrency_code; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { + if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) { $this->packaging = $obj->packaging; } $result = $obj->fk_product; @@ -2265,7 +2265,7 @@ class Product extends CommonObject // If multiprices are enabled, then we check if the current product is subject to price autogeneration // Price will be modified ONLY when the first one is the one that is being modified - if ((!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && !$ignore_autogen && $this->price_autogen && ($level == 1)) { + if ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES')) && !$ignore_autogen && $this->price_autogen && ($level == 1)) { return $this->generateMultiprices($user, $newprice, $newpricebase, $newvat, $newnpr, $newpbq); } @@ -2396,7 +2396,7 @@ class Product extends CommonObject // check if price have really change before log $newPriceData = $this->getArrayForPriceCompare($level); - if (!empty(array_diff_assoc($newPriceData, $lastPriceData)) || empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!empty(array_diff_assoc($newPriceData, $lastPriceData)) || !getDolGlobalString('PRODUIT_MULTIPRICES')) { $this->_log_price($user, $level); // Save price for level into table product_price } @@ -2471,7 +2471,7 @@ class Product extends CommonObject $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,"; $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,"; - if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; @@ -2482,8 +2482,8 @@ class Product extends CommonObject $separatedEntityPMP = false; // Set to true to get the AWP from table llx_product_perentity instead of field 'pmp' into llx_product. $separatedStock = false; // Set to true will count stock from subtable llx_product_stock. It is slower than using denormalized field 'stock', but it is required when using multientity and shared warehouses. $visibleWarehousesEntities = $conf->entity; - if (!empty($conf->global->MULTICOMPANY_PRODUCT_SHARING_ENABLED)) { - if (!empty($conf->global->MULTICOMPANY_PMP_PER_ENTITY_ENABLED)) { + if (getDolGlobalString('MULTICOMPANY_PRODUCT_SHARING_ENABLED')) { + if (getDolGlobalString('MULTICOMPANY_PMP_PER_ENTITY_ENABLED')) { $checkPMPPerEntity = $this->db->query("SELECT pmp FROM " . $this->db->prefix() . "product_perentity WHERE fk_product = ".((int) $id)." AND entity = ".(int) $conf->entity); if ($this->db->num_rows($checkPMPPerEntity)>0) { $separatedEntityPMP = true; @@ -2508,7 +2508,7 @@ class Product extends CommonObject $sql .= " p.stock"; } $sql .= " FROM ".$this->db->prefix()."product as p"; - if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED) || $separatedEntityPMP) { + if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED') || $separatedEntityPMP) { $sql .= " LEFT JOIN " . $this->db->prefix() . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); } if ($separatedStock) { @@ -2533,7 +2533,7 @@ class Product extends CommonObject $sql .= " p.tobuy, p.fk_product_type, p.duration, p.fk_default_warehouse, p.fk_default_workstation, p.seuil_stock_alerte, p.canvas, p.net_measure, p.net_measure_units, p.weight, p.weight_units,"; $sql .= " p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,"; $sql .= " p.surface, p.surface_units, p.volume, p.volume_units, p.barcode, p.fk_barcode_type, p.finished, p.fk_default_bom, p.mandatory_period,"; - if (empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (!getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sql .= " p.accountancy_code_buy, p.accountancy_code_buy_intra, p.accountancy_code_buy_export, p.accountancy_code_sell, p.accountancy_code_sell_intra, p.accountancy_code_sell_export,"; } else { $sql .= " ppe.accountancy_code_buy, ppe.accountancy_code_buy_intra, ppe.accountancy_code_buy_export, ppe.accountancy_code_sell, ppe.accountancy_code_sell_intra, ppe.accountancy_code_sell_export,"; @@ -2658,7 +2658,7 @@ class Product extends CommonObject } // Load multiprices array - if (!empty($conf->global->PRODUIT_MULTIPRICES) && empty($ignore_price_load)) { // prices per segment + if (getDolGlobalString('PRODUIT_MULTIPRICES') && empty($ignore_price_load)) { // prices per segment for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; @@ -2721,9 +2721,9 @@ class Product extends CommonObject return -1; } } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && empty($ignore_price_load)) { // prices per customers + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES') && empty($ignore_price_load)) { // prices per customers // Nothing loaded by default. List may be very long. - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) && empty($ignore_price_load)) { // prices per quantity + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY') && empty($ignore_price_load)) { // prices per quantity $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid"; $sql .= " FROM ".$this->db->prefix()."product_price"; @@ -2768,7 +2768,7 @@ class Product extends CommonObject $this->error = $this->db->lasterror; return -1; } - } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES) && empty($ignore_price_load)) { // prices per customer and quantity + } elseif (getDolGlobalString('PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES') && empty($ignore_price_load)) { // prices per customer and quantity for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid, recuperableonly"; @@ -3024,7 +3024,7 @@ class Product extends CommonObject $this->stats_propale['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in proposal by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -3136,7 +3136,7 @@ class Product extends CommonObject } $sql .= " WHERE c.rowid = cd.fk_commande"; $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'commande').")"; + $sql .= " AND c.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'commande').")"; $sql .= " AND cd.fk_product = ".((int) $this->id); if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) { $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); @@ -3157,7 +3157,7 @@ class Product extends CommonObject $this->stats_commande['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in order by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -3179,8 +3179,8 @@ class Product extends CommonObject // If stock decrease is on invoice validation, the theorical stock continue to // count the orders to ship in theorical stock when some are already removed by invoice validation. - if ($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_ON_BILL)) { - if (!empty($conf->global->DECREASE_ONLY_UNINVOICEDPRODUCTS)) { + if ($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) { + if (getDolGlobalString('DECREASE_ONLY_UNINVOICEDPRODUCTS')) { // If option DECREASE_ONLY_UNINVOICEDPRODUCTS is on, we make a compensation but only if order not yet invoice. $adeduire = 0; $sql = "SELECT SUM(".$this->db->ifsql('f.type=2', -1, 1)." * fd.qty) as count FROM ".$this->db->prefix()."facturedet as fd "; @@ -3244,7 +3244,7 @@ class Product extends CommonObject * Charge tableau des stats commande fournisseur pour le produit/service * * @param int $socid Id societe pour filtrer sur une societe - * @param string $filtrestatut Id des statuts pour filtrer sur des statuts + * @param string $filtrestatut Id of status to filter on status * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @param int $dateofvirtualstock Date of virtual stock * @return int Array of stats in $this->stats_commande_fournisseur, <0 if ko or >0 if ok @@ -3264,7 +3264,7 @@ class Product extends CommonObject } $sql .= " WHERE c.rowid = cd.fk_commande"; $sql .= " AND c.fk_soc = s.rowid"; - $sql .= " AND c.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'supplier_order').")"; + $sql .= " AND c.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sql .= " AND cd.fk_product = ".((int) $this->id); if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) { $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); @@ -3328,7 +3328,7 @@ class Product extends CommonObject $sql .= " WHERE e.rowid = ed.fk_expedition"; $sql .= " AND c.rowid = cd.fk_commande"; $sql .= " AND e.fk_soc = s.rowid"; - $sql .= " AND e.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'expedition').")"; + $sql .= " AND e.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'expedition').")"; $sql .= " AND ed.fk_origin_line = cd.rowid"; $sql .= " AND cd.fk_product = ".((int) $this->id); if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) { @@ -3353,7 +3353,7 @@ class Product extends CommonObject $this->stats_expedition['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in sending by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -3411,7 +3411,7 @@ class Product extends CommonObject } $sql .= " WHERE cf.rowid = fd.fk_commande"; $sql .= " AND cf.fk_soc = s.rowid"; - $sql .= " AND cf.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'supplier_order').")"; + $sql .= " AND cf.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'supplier_order').")"; $sql .= " AND fd.fk_product = ".((int) $this->id); if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) { $sql .= " AND cf.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); @@ -3471,7 +3471,7 @@ class Product extends CommonObject $sql .= ", ".$this->db->prefix()."societe_commerciaux as sc"; } $sql .= " WHERE m.rowid = mp.fk_mo"; - $sql .= " AND m.entity IN (".getEntity($forVirtualStock && !empty($conf->global->STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE) ? 'stock' : 'mrp').")"; + $sql .= " AND m.entity IN (".getEntity($forVirtualStock && getDolGlobalString('STOCK_CALCULATE_VIRTUAL_STOCK_TRANSVERSE_MODE') ? 'stock' : 'mrp').")"; $sql .= " AND mp.fk_product = ".((int) $this->id); if (!$user->hasRight('societe', 'client', 'voir') && !$socid && !$forVirtualStock) { $sql .= " AND m.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); @@ -3587,7 +3587,7 @@ class Product extends CommonObject $this->stats_contrat['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in contract by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -3661,7 +3661,7 @@ class Product extends CommonObject $this->stats_facture['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in invoice by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -3736,7 +3736,7 @@ class Product extends CommonObject $this->stats_facturerec['qty'] = $obj->qty ? $obj->qty : 0; // if it's a virtual product, maybe it is in invoice by extension - if (!empty($conf->global->PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC)) { + if (getDolGlobalString('PRODUCT_STATS_WITH_PARENT_PROD_IF_INCDEC')) { $TFather = $this->getFather(); if (is_array($TFather) && !empty($TFather)) { foreach ($TFather as &$fatherData) { @@ -4879,7 +4879,7 @@ class Product extends CommonObject } $tmpproduct->fetch($id); // Load product to get ->ref - if (empty($ignore_stock_load) && ($tmpproduct->isProduct() || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { + if (empty($ignore_stock_load) && ($tmpproduct->isProduct() || getDolGlobalString('STOCK_SUPPORTS_SERVICES'))) { $tmpproduct->load_stock('nobatch,novirtual'); // Load stock to get true ->stock_reel } @@ -5166,7 +5166,7 @@ class Product extends CommonObject $datas = array(); $nofetch = !empty($params['nofetch']); - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { return ['optimize' => $langs->trans("ShowProduct")]; } @@ -5195,7 +5195,7 @@ class Product extends CommonObject if (!empty($this->description)) { $datas['description']= '
'.$langs->trans('ProductDescription').': '.dolGetFirstLineofText($this->description, 5); } - if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if ($this->type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { if (isModEnabled('productbatch')) { $langs->load("productbatch"); $datas['batchstatus']= "
".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2); @@ -5311,7 +5311,7 @@ class Product extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowProduct"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"'; } @@ -5686,7 +5686,7 @@ class Product extends CommonObject $warehouseStatus[Entrepot::STATUS_OPEN_ALL] = Entrepot::STATUS_OPEN_ALL; } if (preg_match('/warehouseinternal/', $option)) { - if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { + if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { $warehouseStatus[Entrepot::STATUS_OPEN_INTERNAL] = Entrepot::STATUS_OPEN_INTERNAL; } else { $warehouseStatus[Entrepot::STATUS_OPEN_ALL] = Entrepot::STATUS_OPEN_ALL; @@ -5703,7 +5703,7 @@ class Product extends CommonObject $sql .= " AND w.statut IN (".$this->db->sanitize(implode(',', $warehouseStatus)).")"; } - $sql .= " ORDER BY ps.reel ".(!empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; + $sql .= " ORDER BY ps.reel ".(getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'DESC':'ASC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation; dol_syslog(get_class($this)."::load_stock", LOG_DEBUG); $result = $this->db->query($sql); @@ -5770,9 +5770,9 @@ class Product extends CommonObject if (isModEnabled("expedition")) { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; $filterShipmentStatus = ''; - if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)) { + if (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT')) { $filterShipmentStatus = Expedition::STATUS_VALIDATED.','.Expedition::STATUS_CLOSED; - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { $filterShipmentStatus = Expedition::STATUS_CLOSED; } $result = $this->load_stats_sending(0, '1,2', 1, $filterShipmentStatus); @@ -5782,7 +5782,7 @@ class Product extends CommonObject $stock_sending_client = $this->stats_expedition['qty']; } if (isModEnabled("supplier_order")) { - $filterStatus = empty($conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK) ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; + $filterStatus = !getDolGlobalString('SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK') ? '3,4' : $conf->global->SUPPLIER_ORDER_STATUS_FOR_VIRTUAL_STOCK; if (isset($includedraftpoforvirtual)) { $filterStatus = '0,1,2,'.$filterStatus; // 1,2 may have already been inside $filterStatus but it is better to have twice than missing $filterStatus does not include them } @@ -5827,21 +5827,21 @@ class Product extends CommonObject $this->stock_theorique = $this->stock_reel + $stock_inproduction; // Stock decrease mode - if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { + if (getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT') || getDolGlobalString('STOCK_CALCULATE_ON_SHIPMENT_CLOSE')) { $this->stock_theorique -= ($stock_commande_client - $stock_sending_client); - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_VALIDATE_ORDER')) { $this->stock_theorique += 0; - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_BILL')) { $this->stock_theorique -= $stock_commande_client; } // Stock Increase mode - if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { + if (getDolGlobalString('STOCK_CALCULATE_ON_RECEPTION') || getDolGlobalString('STOCK_CALCULATE_ON_RECEPTION_CLOSE')) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER')) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER')) { $this->stock_theorique -= $stock_reception_fournisseur; - } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { + } elseif (getDolGlobalString('STOCK_CALCULATE_ON_SUPPLIER_BILL')) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); } @@ -6177,7 +6177,7 @@ class Product extends CommonObject global $conf; $result = ''; - if (!empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { + if (getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) { $dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']); foreach ($dirsociete as $dirroot) { $res = dol_include_once($dirroot . getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM').'.php'); @@ -6302,7 +6302,7 @@ class Product extends CommonObject $maxpricesupplier = 0; - if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE)) { + if (getDolGlobalString('PRODUCT_MINIMUM_RECOMMENDED_PRICE')) { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $product_fourn = new ProductFournisseur($this->db); $product_fourn_list = $product_fourn->list_product_fournisseur_price($this->id, '', ''); diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 0584c673bd4..e0c5bd345e0 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -459,7 +459,7 @@ class Productbatch extends CommonObject $sql .= " t.eatby as oldeatby,"; // deprecated but may not be migrated into new table $sql .= " t.batch,"; $sql .= " t.qty,"; - if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) $sql .= " MAX(sm.datem) as date_entree,"; + if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) $sql .= " MAX(sm.datem) as date_entree,"; $sql .= " t.import_key"; if ($fk_product > 0) { $sql .= ", pl.rowid as lotid, pl.eatby as eatby, pl.sellby as sellby"; @@ -470,7 +470,7 @@ class Productbatch extends CommonObject $sql .= " LEFT JOIN ".$dbs->prefix()."product_lot as pl ON pl.fk_product = ".((int) $fk_product)." AND pl.batch = t.batch"; // TODO May add extrafields to ? } - if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) { + if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock AS ps ON (ps.rowid = fk_product_stock)'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'stock_mouvement AS sm ON (sm.batch = t.batch AND ps.fk_entrepot=sm.fk_entrepot)'; } @@ -478,7 +478,7 @@ class Productbatch extends CommonObject if ($with_qty) { $sql .= " AND t.qty <> 0"; } - if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) { + if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) { $sql .= ' AND sm.type_mouvement IN (0,3)'; $sql .= ' GROUP BY t.rowid, t.tms, t.fk_product_stock,t.sellby,t.eatby , t.batch,t.qty,t.import_key'; if ($fk_product > 0) { @@ -487,12 +487,12 @@ class Productbatch extends CommonObject } $sql .= " ORDER BY "; // TODO : use product lifo and fifo when product will implement it - if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) { + if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) { $sql .= 'date_entree ASC,t.batch ASC,'; } if ($fk_product > 0) { $sql .= "pl.eatby ASC, pl.sellby ASC, "; } $sql .= "t.eatby ASC, t.sellby ASC "; - $sql .= ", t.qty ".(empty($conf->global->DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE)?'ASC':'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation + $sql .= ", t.qty ".(!getDolGlobalString('DO_NOT_TRY_TO_DEFRAGMENT_STOCKS_WAREHOUSE')?'ASC':'DESC'); // Note : qty ASC is important for expedition card, to avoid stock fragmentation $sql .= ", t.batch ASC"; dol_syslog("productbatch::findAll", LOG_DEBUG); @@ -512,7 +512,7 @@ class Productbatch extends CommonObject $tmp->qty = $obj->qty; $tmp->import_key = $obj->import_key; - if (!empty($conf->global->SHIPPING_DISPLAY_STOCK_ENTRY_DATE)) { + if (getDolGlobalString('SHIPPING_DISPLAY_STOCK_ENTRY_DATE')) { $tmp->context['stock_date_entry'] = $obj->date_entree; } diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 6015c074520..107979f76d6 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -819,7 +819,7 @@ class ProductCustomerPrice extends CommonObject { global $conf; - if (!empty($conf->global->PRODUCT_DISABLE_PROPAGATE_CUSTOMER_PRICES_ON_CHILD_COMPANIES)) { + if (getDolGlobalString('PRODUCT_DISABLE_PROPAGATE_CUSTOMER_PRICES_ON_CHILD_COMPANIES')) { return 0; } diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index b24db354a39..900d2fd6c5b 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -177,7 +177,7 @@ class ProductFournisseurPrice extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; if (!isModEnabled('multicompany') && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; // Unset fields that are disabled @@ -607,7 +607,7 @@ class ProductFournisseurPrice extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowProductFournisseurPrice"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -756,11 +756,11 @@ class ProductFournisseurPrice extends CommonObject global $langs, $conf; $langs->load("buypricehistory@buypricehistory"); - if (empty($conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON)) { + if (!getDolGlobalString('BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON')) { $conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON = 'mod_productfournisseurprice_standard'; } - if (!empty($conf->global->BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON)) { + if (getDolGlobalString('BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON')) { $mybool = false; $file = getDolGlobalString('BUYPRICEHISTORY_PRODUCTFOURNISSEURPRICE_ADDON') . ".php"; @@ -826,7 +826,7 @@ class ProductFournisseurPrice extends CommonObject if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->PRODUCTFOURNISSEURPRICE_ADDON_PDF)) { + } elseif (getDolGlobalString('PRODUCTFOURNISSEURPRICE_ADDON_PDF')) { $modele = $conf->global->PRODUCTFOURNISSEURPRICE_ADDON_PDF; } } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index ebc540792af..f01cf8678d6 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -241,7 +241,7 @@ if ($id > 0 || !empty($ref)) { dol_banner_tab($object, 'ref', $linkback, $shownav, 'ref', ''); - if ($object->type != Product::TYPE_SERVICE || !empty($conf->global->STOCK_SUPPORTS_SERVICES) || empty($conf->global->PRODUIT_MULTIPRICES)) { + if ($object->type != Product::TYPE_SERVICE || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || !getDolGlobalString('PRODUIT_MULTIPRICES')) { print '
'; print '
'; print '
'; @@ -252,7 +252,7 @@ if ($id > 0 || !empty($ref)) { if (isModEnabled("product") && isModEnabled("service")) { $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); print '
'; @@ -267,7 +267,7 @@ if ($id > 0 || !empty($ref)) { // Nature if ($object->type != Product::TYPE_SERVICE) { - if (empty($conf->global->PRODUCT_DISABLE_NATURE)) { + if (!getDolGlobalString('PRODUCT_DISABLE_NATURE')) { print ''."\n"; } else { $hide = ''; - if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) { + if (!getDolGlobalString('PRODUCT_SHOW_SUB_SUB_PRODUCTS')) { $hide = ' hideobject'; // By default, we do not show this. It makes screen very difficult to understand } diff --git a/htdocs/product/document.php b/htdocs/product/document.php index f7753432043..9e46a04d0d0 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; -if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { +if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) { require_once DOL_DOCUMENT_ROOT.'/product/class/propalmergepdfproduct.class.php'; } @@ -128,7 +128,7 @@ if ($reshook < 0) { if (empty($reshook)) { // Delete line if product propal merge is linked to a file - if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { + if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) { if ($action == 'confirm_deletefile' && $confirm == 'yes' && $permissiontoadd) { //extract file name $urlfile = GETPOST('urlfile', 'alpha'); @@ -268,7 +268,7 @@ if ($object->id) { // Merge propal PDF document PDF files - if (!empty($conf->global->PRODUIT_PDF_MERGE_PROPAL)) { + if (getDolGlobalString('PRODUIT_PDF_MERGE_PROPAL')) { $filetomerge = new Propalmergepdfproduct($db); if (getDolGlobalInt('MAIN_MULTILANGS')) { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 2ab55df752b..b1a0ba2aeee 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -410,7 +410,7 @@ if ($id > 0 || $ref) { if (isModEnabled("product") && isModEnabled("service")) { $typeformat = 'select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); print ''; @@ -428,7 +428,7 @@ if ($id > 0 || $ref) { // PMP $usercaneditpmp = 0; - if (!empty($conf->global->PRODUCT_CAN_EDIT_WAP)) { + if (getDolGlobalString('PRODUCT_CAN_EDIT_WAP')) { $usercaneditpmp = $usercancreate; } print ''; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { + if (getDolGlobalString('PRODUCT_USE_SUPPLIER_PACKAGING')) { // Packaging/Conditionnement print ''; @@ -606,7 +606,7 @@ if ($id > 0 || $ref) { print ''; // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { $unit = $object->getLabelOfUnit(); if ($unit !== '') { print '  '.$langs->trans($unit); @@ -816,7 +816,7 @@ END; } // Product description of the supplier - if (!empty($conf->global->PRODUIT_FOURN_TEXTS)) { + if (getDolGlobalString('PRODUIT_FOURN_TEXTS')) { //WYSIWYG Editor require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -952,7 +952,7 @@ END; 'pfp.quantity'=>array('label'=>$langs->trans("QtyMin"), 'checked'=>1, 'position'=>5), 'pfp.unitprice'=>array('label'=>$langs->trans("UnitPriceHT"), 'checked'=>1, 'position'=>9), 'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => isModEnabled('multicurrency'), 'checked'=>0, 'position'=>10), - 'pfp.charges'=>array('label'=>$langs->trans("Charges"), 'enabled' => !empty($conf->global->PRODUCT_CHARGES), 'checked'=>0, 'position'=>11), + 'pfp.charges'=>array('label'=>$langs->trans("Charges"), 'enabled' => getDolGlobalString('PRODUCT_CHARGES'), 'checked'=>0, 'position'=>11), 'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>-1, 'position'=>13), 'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>-1, 'position'=>14), 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>15), @@ -1143,7 +1143,7 @@ END; print '
'.$langs->trans("ProductAccountancySellCode").'
'; - print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); print ''; print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); print '
'.$langs->trans("ManageLotSerial").''; print $object->getLibStatut(0, 2); print '
'.$langs->trans("ManageLotMask").''; print $object->batch_mask; print '
'; print $langs->trans("ProductAccountancySellCode"); @@ -2610,7 +2610,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print '
'.$langs->trans("Description").''.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'
'.$langs->trans("PublicUrl").''; print dol_print_url($object->url, '_blank', 128); print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; print $object->getLibFinished(); @@ -2698,7 +2698,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (!$object->isService()) { // Brut Weight - if (empty($conf->global->PRODUCT_DISABLE_WEIGHT)) { + if (!getDolGlobalString('PRODUCT_DISABLE_WEIGHT')) { print '
'.$langs->trans("Weight").''; if ($object->weight != '') { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); @@ -2708,7 +2708,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print "
'.$langs->trans("Length").' x '.$langs->trans("Width").' x '.$langs->trans("Height").''; if ($object->length != '' || $object->width != '' || $object->height != '') { @@ -2725,7 +2725,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } print "
'.$langs->trans("Surface").''; if ($object->surface != '') { @@ -2735,7 +2735,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } print "
'.$langs->trans("Volume").''; if ($object->volume != '') { @@ -2746,7 +2746,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print "
'.$langs->trans("NetMeasure").''; if ($object->net_measure != '') { @@ -2759,7 +2759,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Unit - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { $unit = $object->getLabelOfUnit(); print '
'.$langs->trans('DefaultUnitToShow').''; @@ -2770,7 +2770,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } // Custom code - if (!$object->isService() && empty($conf->global->PRODUCT_DISABLE_CUSTOM_INFO)) { + if (!$object->isService() && !getDolGlobalString('PRODUCT_DISABLE_CUSTOM_INFO')) { print '
'.$langs->trans("CustomCode").''.$object->customcode.'
'.$langs->trans("LifeTime").''.$object->lifetime.'
'.$langs->trans("QCFrequency").''.$object->qc_frequency.'
'.$langs->trans("NotePrivate").''.(dol_textishtml($object->note_private) ? $object->note_private : dol_nl2br($object->note_private, 1, true)).'
'; - print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); + print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat) : $langs->trans('Type'); print ''; print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, $usercancreate, $typeformat); print '
'.$form->textwithpicto($langs->trans("NatureOfProductShort"), $langs->trans("NatureOfProductDesc")).''; print $object->getLibFinished(); //print $formproduct->selectProductNature('finished', $object->finished); @@ -275,7 +275,7 @@ if ($id > 0 || !empty($ref)) { } } - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { // Price print '
'.$langs->trans("SellingPrice").''; if ($object->price_base_type == 'TTC') { @@ -445,7 +445,7 @@ if ($id > 0 || !empty($ref)) { // Best selling price $pricesell = $productstatic->price; - if (!empty($conf->global->PRODUIT_MULTIPRICES)) { + if (getDolGlobalString('PRODUIT_MULTIPRICES')) { $pricesell = 'Variable'; } else { $totallinesell = price2num($value['nb'] * ($pricesell), 'MT'); @@ -480,7 +480,7 @@ if ($id > 0 || !empty($ref)) { print '
'; - print (empty($conf->global->PRODUCT_DENY_CHANGE_PRODUCT_TYPE)) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); + print (!getDolGlobalString('PRODUCT_DENY_CHANGE_PRODUCT_TYPE')) ? $form->editfieldkey("Type", 'fk_product_type', $object->type, $object, 0, $typeformat) : $langs->trans('Type'); print ''; print $form->editfieldval("Type", 'fk_product_type', $object->type, $object, 0, $typeformat); print '
'; @@ -588,7 +588,7 @@ if ($id > 0 || $ref) { print ''; } // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { $unit = $object->getLabelOfUnit(); if ($unit !== '') { print '  '.$langs->trans($unit); @@ -596,7 +596,7 @@ if ($id > 0 || $ref) { } print '
'; print $productfourn->fourn_qty; // Units - if (!empty($conf->global->PRODUCT_USE_UNITS)) { + if (getDolGlobalString('PRODUCT_USE_UNITS')) { $unit = $object->getLabelOfUnit(); if ($unit !== '') { print '  '.$langs->trans($unit); diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 46f993f6373..2d1553c198e 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -91,7 +91,7 @@ print load_fiche_titre($transAreaType, $linkback, 'product'); print '
'; -if (!empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) { // This may be useless due to the global search combo +if (getDolGlobalString('MAIN_SEARCH_FORM_ON_HOME_AREAS')) { // This may be useless due to the global search combo // Search contract if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) { $listofsearchfields['search_product'] = array('text'=>'ProductOrService'); @@ -215,7 +215,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr } -if (isModEnabled('categorie') && !empty($conf->global->CATEGORY_GRAPHSTATS_ON_PRODUCTS)) { +if (isModEnabled('categorie') && getDolGlobalString('CATEGORY_GRAPHSTATS_ON_PRODUCTS')) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; print '
'; print '
'; @@ -321,7 +321,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr print ''; $colnb = 2; - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { $colnb++; } @@ -372,7 +372,7 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr print dol_print_date($db->jdate($objp->datem), 'day', 'tzuserrel'); print ""; // Sell price - if (empty($conf->global->PRODUIT_MULTIPRICES)) { + if (!getDolGlobalString('PRODUIT_MULTIPRICES')) { if (isModEnabled('dynamicprices') && !empty($objp->fk_price_expression)) { $product = new Product($db); $product->fetch($objp->rowid); diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 4827f170cbe..63c1f537df5 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -42,7 +42,7 @@ $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inv $backtopage = GETPOST('backtopage', 'alpha'); $include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('include_sub_warehouse') : 0; -if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { +if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $result = restrictedArea($user, 'stock', $id); } else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); @@ -83,7 +83,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'mymodule', $id); -if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { +if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $permissiontoread = $user->rights->stock->lire; $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 56c2e3bb0d7..f4849232a01 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -230,7 +230,7 @@ class Inventory extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } if (!isModEnabled('multicompany')) { @@ -286,7 +286,7 @@ class Inventory extends CommonObject $sql .= " ".$this->db->prefix()."product as p, ".$this->db->prefix()."entrepot as e"; $sql .= " WHERE p.entity IN (".getEntity('product').")"; $sql .= " AND ps.fk_product = p.rowid AND ps.fk_entrepot = e.rowid"; - if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + if (!getDolGlobalString('STOCK_SUPPORTS_SERVICES')) { $sql .= " AND p.fk_product_type = 0"; } if ($this->fk_product > 0) { @@ -593,7 +593,7 @@ class Inventory extends CommonObject $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowInventory"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index bbc9e020834..f1d4cd2358f 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -58,7 +58,7 @@ $lineid = GETPOST('lineid', 'int'); $batch = GETPOST('batch', 'alphanohtml'); $totalExpectedValuation = 0; $totalRealValuation = 0; -if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { +if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $result = restrictedArea($user, 'stock', $id); } else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); @@ -103,7 +103,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } -if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { +if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; } else { @@ -197,7 +197,7 @@ if (empty($reshook)) { //$inventorycode = 'INV'.$object->id; $inventorycode = 'INV-'.$object->ref; $price = 0; - if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) $price = $line->pmp_real; + if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) $price = $line->pmp_real; $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); if ($idstockmove < 0) { @@ -221,7 +221,7 @@ if (empty($reshook)) { } } - if (!empty($line->pmp_real) && !empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product SET pmp = '.((float) $line->pmp_real).' WHERE rowid = '.((int) $line->fk_product); $resqlpmp = $db->query($sqlpmp); if (! $resqlpmp) { @@ -229,7 +229,7 @@ if (empty($reshook)) { setEventMessages($db->lasterror(), null, 'errors'); break; } - if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { + if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { $sqlpmp = 'UPDATE '.MAIN_DB_PREFIX.'product_perentity SET pmp = '.((float) $line->pmp_real).' WHERE fk_product = '.((int) $line->fk_product).' AND entity='.$conf->entity; $resqlpmp = $db->query($sqlpmp); if (! $resqlpmp) { @@ -925,7 +925,7 @@ if (isModEnabled('productbatch')) { print ''; } print ''; -if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { +if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { print ''; print ''; print ''; @@ -963,7 +963,7 @@ if ($object->status == $object::STATUS_DRAFT || $object->status == $object::STAT print ''; } print ''; - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { print ''; print ''; } else { - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { //PMP Expected if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; else $pmp_expected = $product_static->pmp; @@ -1182,7 +1182,7 @@ if ($resql) { } else { dol_print_error($db); } -if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { +if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { print ''; print ''; print ''; @@ -1258,7 +1258,7 @@ print ''; -if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { +if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { ?> '; print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print ' '; $htmltext = $langs->trans("ProjectFollowTasks"); print ''; @@ -666,7 +666,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print ''; print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print ' '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print ''; @@ -718,16 +718,16 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Thirdparty if (isModEnabled('societe')) { print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Opportunity status print ''; print ''; print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $classfortr = ($object->usage_opportunity ? '' : ' hideobject'); // Opportunity status print ''; @@ -1290,24 +1290,24 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print '
'.$langs->trans("ExpectedQty").''.$langs->trans('PMPExpected').''.$langs->trans('ExpectedValuation').''.$form->textwithpicto($langs->trans("RealQty"), $langs->trans("InventoryRealQtyHelp")).''; print ''; @@ -1081,7 +1081,7 @@ if ($resql) { $hasinput = true; } - if (!empty($conf->global->INVENTORY_MANAGE_REAL_PMP)) { + if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { //PMP Expected if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; else $pmp_expected = $product_static->pmp; @@ -1132,7 +1132,7 @@ if ($resql) { print ''; print '
'.$langs->trans("Total").''.price($totalExpectedValuation).'
'; - print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : ''); + print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : ''); print $langs->trans("ThirdParty"); - print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : ''); + print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : ''); print ''; $filter = ''; - if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { + if (getDolGlobalString('PROJECT_FILTER_FOR_THIRDPARTY_LIST')) { $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; } $text = img_picto('', 'company').$form->select_company(GETPOST('socid', 'int'), 'socid', $filter, 'SelectThirdParty', 1, 0, array(), 0, 'minwidth300 widthcentpercentminusxx maxwidth500'); - if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { + if (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1); } else { @@ -758,10 +758,10 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Visibility print '
'.$langs->trans("Visibility").''; $array = array(); - if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) { + if (!getDolGlobalString('PROJECT_DISABLE_PRIVATE_PROJECT')) { $array[0] = $langs->trans("PrivateProject"); } - if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) { + if (!getDolGlobalString('PROJECT_DISABLE_PUBLIC_PROJECT')) { $array[1] = $langs->trans("SharedProject"); } @@ -780,7 +780,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } print '
'.$langs->trans("OpportunityStatus").''; @@ -974,7 +974,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Status print '
'.$langs->trans("Status").''; print ''; @@ -990,12 +990,12 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print ''; @@ -1021,7 +1021,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print ''; print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')) . '> '; $htmltext = $langs->trans("ProjectFollowTasks"); print ''; @@ -1047,7 +1047,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { print ''; print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')) . '> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print ''; @@ -1105,17 +1105,17 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Thirdparty if (isModEnabled('societe')) { print '
'; - print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : ''); + print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : ''); print $langs->trans("ThirdParty"); - print (empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) ? '' : ''); + print (!getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') ? '' : ''); print ''; $filter = ''; - if (!empty($conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST)) { + if (getDolGlobalString('PROJECT_FILTER_FOR_THIRDPARTY_LIST')) { $filter = $conf->global->PROJECT_FILTER_FOR_THIRDPARTY_LIST; } $text = img_picto('', 'company', 'class="pictofixedwidth"'); $text .= $form->select_company($object->thirdparty->id, 'socid', $filter, 'None', 1, 0, array(), 0, 'minwidth300'); - if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile)) { + if (!getDolGlobalString('PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') && empty($conf->dol_use_jmobile)) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); } else { @@ -1127,10 +1127,10 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { // Visibility print '
'.$langs->trans("Visibility").''; $array = array(); - if (empty($conf->global->PROJECT_DISABLE_PRIVATE_PROJECT)) { + if (!getDolGlobalString('PROJECT_DISABLE_PRIVATE_PROJECT')) { $array[0] = $langs->trans("PrivateProject"); } - if (empty($conf->global->PROJECT_DISABLE_PUBLIC_PROJECT)) { + if (!getDolGlobalString('PROJECT_DISABLE_PUBLIC_PROJECT')) { $array[1] = $langs->trans("SharedProject"); } @@ -1149,7 +1149,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } print '
'.$langs->trans("OpportunityStatus").'
'; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -1333,7 +1333,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); @@ -1443,10 +1443,10 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { '; // Change probability from status - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!empty($conf->use_javascript_ajax) && getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Default value to close or not when we set opp to 'WON'. $defaultcheckedwhenoppclose = 1; - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { $defaultcheckedwhenoppclose = 0; } @@ -1596,7 +1596,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { } // Buttons Create - if (empty($conf->global->PROJECT_HIDE_CREATE_OBJECT_BUTTON)) { + if (!getDolGlobalString('PROJECT_HIDE_CREATE_OBJECT_BUTTON')) { $arrayforbutaction = array( 10 => array('lang'=>'propal', 'enabled'=>isModEnabled("propal"), 'perm'=>$user->hasRight('propal', 'creer'), 'label' => 'AddProp', 'url'=>'/comm/propal/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), 20 => array('lang'=>'orders', 'enabled'=>isModEnabled("commande"), 'perm'=>$user->hasRight('commande', 'creer'), 'label' => 'CreateOrder', 'url'=>'/commande/card.php?action=create&projectid='.$object->id.'&socid='.$object->socid), @@ -1612,7 +1612,7 @@ if ($action == 'create' && $user->hasRight('projet', 'creer')) { $params = array('backtopage' => $_SERVER["PHP_SELF"].'?id='.$object->id); - print dolGetButtonAction($langs->trans("Create"), '', 'default', $arrayforbutaction, '', 1, $params); + print dolGetButtonAction('', $langs->trans("Create"), 'default', $arrayforbutaction, '', 1, $params); } // Clone diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 38abd37a7ed..827238e1745 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -35,7 +35,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; */ class Project extends CommonObject { - /** * @var string ID to identify managed object */ @@ -203,8 +202,8 @@ class Project extends CommonObject */ public $max_attendees; - public $statuts_short; - public $statuts_long; + public $labelStatusShort; + public $labelStatus; public $statut; // 0=draft, 1=opened, 2=closed @@ -364,23 +363,23 @@ class Project extends CommonObject $this->db = $db; - $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); - $this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + $this->labelStatusShort = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + $this->labelStatus = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); global $conf; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $this->fields['fk_opp_status']['enabled'] = 0; $this->fields['opp_percent']['enabled'] = 0; $this->fields['opp_amount']['enabled'] = 0; $this->fields['usage_opportunity']['enabled'] = 0; } - if (!empty($conf->global->PROJECT_HIDE_TASKS)) { + if (getDolGlobalString('PROJECT_HIDE_TASKS')) { $this->fields['usage_bill_time']['visible'] = 0; $this->fields['usage_task']['visible'] = 0; } @@ -421,7 +420,7 @@ class Project extends CommonObject dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR); return -1; } - if (!empty($conf->global->PROJECT_THIRDPARTY_REQUIRED) && !($this->socid > 0)) { + if (getDolGlobalString('PROJECT_THIRDPARTY_REQUIRED') && !($this->socid > 0)) { $this->error = 'ErrorFieldsRequired'; dol_syslog(get_class($this)."::create error -1 thirdparty not defined and option PROJECT_THIRDPARTY_REQUIRED is set", LOG_ERR); return -1; @@ -1237,7 +1236,7 @@ class Project extends CommonObject $sql .= " WHERE rowid = ".((int) $this->id); $sql .= " AND fk_statut = ".self::STATUS_VALIDATED; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // TODO What to do if fk_opp_status is not code 'WON' or 'LOST' } @@ -1310,7 +1309,7 @@ class Project extends CommonObject $statusClass = $statustrans[$status]; } - return dolGetStatus($langs->transnoentitiesnoconv($this->statuts_long[$status]), $langs->transnoentitiesnoconv($this->statuts_short[$status]), '', $statusClass, $mode); + return dolGetStatus($langs->transnoentitiesnoconv($this->labelStatus[$status]), $langs->transnoentitiesnoconv($this->labelStatusShort[$status]), '', $statusClass, $mode); } /** @@ -1380,7 +1379,7 @@ class Project extends CommonObject } $result = ''; - if (!empty($conf->global->PROJECT_OPEN_ALWAYS_ON_TAB)) { + if (getDolGlobalString('PROJECT_OPEN_ALWAYS_ON_TAB')) { $option = $conf->global->PROJECT_OPEN_ALWAYS_ON_TAB; } $params = [ @@ -1428,7 +1427,7 @@ class Project extends CommonObject $linkclose = ''; if (empty($notooltip) && $user->hasRight('projet', 'lire')) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowProject"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -1732,7 +1731,7 @@ class Project extends CommonObject //Generate next ref $defaultref = ''; - $obj = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; + $obj = !getDolGlobalString('PROJECT_ADDON') ? 'mod_project_simple' : $conf->global->PROJECT_ADDON; // Search template files $file = ''; $classname = ''; $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); @@ -2056,7 +2055,7 @@ class Project extends CommonObject if ($this->model_pdf) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->PROJECT_ADDON_PDF)) { + } elseif (getDolGlobalString('PROJECT_ADDON_PDF')) { $modele = $conf->global->PROJECT_ADDON_PDF; } } @@ -2505,20 +2504,22 @@ class Project extends CommonObject $return .= '
'.$langs->trans("Author").''; $return .= ' : '.$user->getNomUrl(1).''; }*/ + $return .= '
'; // start div line status if ($this->usage_opportunity && $this->opp_status_code) { //$return .= '
'.$langs->trans("OpportunityStatusShort").''; - $return .= '
'.$langs->trans("OppStatus".$this->opp_status_code).''; - $return .= ' ('.round($this->opp_percent).'%)'; - $return .= '
'.price($this->opp_amount).''; - } else { - $return .= '
'; + //$return .= '
'.dol_trunc($langs->trans("OppStatus".$this->opp_status_code), 5).'
'; + $return .= '
opp_status_code)).'">'.round($this->opp_percent).'%
'; + $return .= '
'.price($this->opp_amount).'
'; } if (method_exists($this, 'getLibStatut')) { - $return .= '
'.$this->getLibStatut(3).'
'; + $return .= '
'.$this->getLibStatut(3).'
'; } + $return .= '
'; // end div line status + $return .= ''; $return .= ''; $return .= ''; + return $return; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index e6d10c194f0..7999b38f7d5 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -138,12 +138,12 @@ class Task extends CommonObjectLine /** * @var array */ - public $statuts; + public $labelStatus; /** * @var array */ - public $statuts_short; + public $labelStatusShort; // Properties calculated from sum of llx_element_time linked to task public $tobill; @@ -481,7 +481,7 @@ class Task extends CommonObjectLine } } - if (!$error && !empty($conf->global->PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE)) { + if (!$error && getDolGlobalString('PROJECT_CLASSIFY_CLOSED_WHEN_ALL_TASKS_DONE')) { // Close the parent project if it is open (validated) and its tasks are 100% completed $project = new Project($this->db); if ($project->fetch($this->fk_project) > 0) { @@ -814,7 +814,7 @@ class Task extends CommonObjectLine $linkclose = ''; if (empty($notooltip)) { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { + if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { $label = $langs->trans("ShowTask"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } @@ -1302,7 +1302,7 @@ class Task extends CommonObjectLine $this->timespent_datehour = $this->timespent_date; } - if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + if (getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); @@ -1746,7 +1746,7 @@ class Task extends CommonObjectLine $this->timespent_note = trim($this->timespent_note); } - if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + if (getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); @@ -1792,7 +1792,7 @@ class Task extends CommonObjectLine $ret = -1; } - if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || !empty($conf->global->TIMESPENT_ALWAYS_UPDATE_THM))) { + if ($ret == 1 && (($this->timespent_old_duration != $this->timespent_duration) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM'))) { if ($this->timespent_old_duration != $this->timespent_duration) { // Recalculate amount of time spent for task and update denormalized field $sql = "UPDATE " . MAIN_DB_PREFIX . "projet_task"; @@ -1812,7 +1812,7 @@ class Task extends CommonObjectLine // Update hourly rate of this time spent entry, but only if it was not set initialy $res_update = 1; - if (empty($timespent->thm) || !empty($conf->global->TIMESPENT_ALWAYS_UPDATE_THM)) { + if (empty($timespent->thm) || getDolGlobalString('TIMESPENT_ALWAYS_UPDATE_THM')) { $resql_thm_user = $this->db->query("SELECT thm FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . ((int) $timespent->fk_user)); if (!empty($resql_thm_user)) { $obj_thm_user = $this->db->fetch_object($resql_thm_user); @@ -1847,7 +1847,7 @@ class Task extends CommonObjectLine $error = 0; - if (!empty($conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS)) { + if (getDolGlobalString('PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $restrictBefore = dol_time_plus_duree(dol_now(), - $conf->global->PROJECT_TIMESHEET_PREVENT_AFTER_MONTHS, 'm'); @@ -1948,8 +1948,8 @@ class Task extends CommonObjectLine $origin_task->fetch($fromid); $defaultref = ''; - $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; - if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { + $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; $modTask = new $obj; $defaultref = $modTask->getNextValue(0, $clone_task); @@ -2133,80 +2133,80 @@ class Task extends CommonObjectLine global $langs; // list of Statut of the task - $this->statuts[0] = 'Draft'; - $this->statuts[1] = 'ToDo'; - $this->statuts[2] = 'Running'; - $this->statuts[3] = 'Finish'; - $this->statuts[4] = 'Transfered'; - $this->statuts_short[0] = 'Draft'; - $this->statuts_short[1] = 'ToDo'; - $this->statuts_short[2] = 'Running'; - $this->statuts_short[3] = 'Completed'; - $this->statuts_short[4] = 'Transfered'; + $this->labelStatus[0] = 'Draft'; + $this->labelStatus[1] = 'ToDo'; + $this->labelStatus[2] = 'Running'; + $this->labelStatus[3] = 'Finish'; + $this->labelStatus[4] = 'Transfered'; + $this->labelStatusShort[0] = 'Draft'; + $this->labelStatusShort[1] = 'ToDo'; + $this->labelStatusShort[2] = 'Running'; + $this->labelStatusShort[3] = 'Completed'; + $this->labelStatusShort[4] = 'Transfered'; if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + return $langs->trans($this->labelStatus[$status]); } elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); + return $langs->trans($this->labelStatusShort[$status]); } elseif ($mode == 2) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatusShort[$status]); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5').' '.$langs->trans($this->labelStatusShort[$status]); } } elseif ($mode == 3) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0'); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1'); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3'); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6'); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6'); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5'); } } elseif ($mode == 4) { if ($status == 0) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut0').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 1) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut1').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 2) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut3').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 3) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 4) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut6').' '.$langs->trans($this->labelStatus[$status]); } elseif ($status == 5) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); + return img_picto($langs->trans($this->labelStatusShort[$status]), 'statut5').' '.$langs->trans($this->labelStatus[$status]); } } elseif ($mode == 5) { - /*if ($status==0) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); - elseif ($status==1) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); - elseif ($status==2) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); - elseif ($status==3) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==4) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==5) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + /*if ($status==0) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->labelStatusShort[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; } elseif ($mode == 6) { - /*if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); - elseif ($status==1) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); - elseif ($status==2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut3'); - elseif ($status==3) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==4) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut6'); - elseif ($status==5) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); + /*if ($status==0) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut0'); + elseif ($status==1) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut1'); + elseif ($status==2) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut3'); + elseif ($status==3) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==4) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut6'); + elseif ($status==5) return $langs->trans($this->labelStatus[$status]).' '.img_picto($langs->trans($this->labelStatusShort[$status]),'statut5'); */ //else return $this->progress.' %'; return ' '; @@ -2235,7 +2235,7 @@ class Task extends CommonObjectLine if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->PROJECT_TASK_ADDON_PDF)) { + } elseif (getDolGlobalString('PROJECT_TASK_ADDON_PDF')) { $modele = $conf->global->PROJECT_TASK_ADDON_PDF; } } diff --git a/htdocs/projet/comment.php b/htdocs/projet/comment.php index de406733ba5..596ddda994e 100644 --- a/htdocs/projet/comment.php +++ b/htdocs/projet/comment.php @@ -67,7 +67,7 @@ if ($id > 0 || !empty($ref)) { $ret = $object->fetch($id, $ref); // If we create project, ref may be defined into POST but record does not yet exists into database if ($ret > 0) { $object->fetch_thirdparty(); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $id = $object->id; diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index da78c29af2c..e93779ba3f5 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -53,7 +53,7 @@ $mine = GETPOST('mode') == 'mine' ? 1 : 0; $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -93,7 +93,7 @@ if (empty($reshook)) { $affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect); $url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source; - if ($personToAffect > 0 && (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0)) { + if ($personToAffect > 0 && (!getDolGlobalString('PROJECT_HIDE_TASKS') || $nbTasks > 0)) { $text = $langs->trans('AddPersonToTask'); $textbody = $text.' ('.$langs->trans("SelectAll").')'; $formquestion = array('text' => $textbody); @@ -252,7 +252,7 @@ $contactstatic = new Contact($db); $userstatic = new User($db); $title = $langs->trans('ProjectContact').' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectContact'); } @@ -266,7 +266,7 @@ if ($id > 0 || !empty($ref)) { /* * View */ - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } // To verify role of users @@ -328,24 +328,24 @@ if ($id > 0 || !empty($ref)) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -370,7 +370,7 @@ if ($id > 0 || !empty($ref)) { } print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 4245720099e..3f2ca8c9d9f 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -45,7 +45,7 @@ $mine = (GETPOST('mode', 'alpha') == 'mine' ? 1 : 0); $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -65,10 +65,10 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) { +if (getDolGlobalString('MAIN_DOC_SORT_FIELD')) { $sortfield = $conf->global->MAIN_DOC_SORT_FIELD; } -if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) { +if (getDolGlobalString('MAIN_DOC_SORT_ORDER')) { $sortorder = $conf->global->MAIN_DOC_SORT_ORDER; } @@ -99,7 +99,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; */ $title = $langs->trans('Documents').' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('Document'); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 027ab7a0fd4..56f5a9987a7 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -160,7 +160,7 @@ if (empty($dates) && !empty($datesrfc)) { if (empty($datee) && !empty($dateerfc)) { $datee = dol_stringtotime($dateerfc); } -if (!GETPOSTISSET('datesrfc') && !GETPOSTISSET('datesday') && !empty($conf->global->PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR)) { +if (!GETPOSTISSET('datesrfc') && !GETPOSTISSET('datesday') && getDolGlobalString('PROJECT_LINKED_ELEMENT_DEFAULT_FILTER_YEAR')) { $new = dol_now(); $tmp = dol_getdate($new); //$datee=$now @@ -179,7 +179,7 @@ $mine = GETPOST('mode') == 'mine' ? 1 : 0; $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -196,7 +196,7 @@ $hookmanager->initHooks(array('projectOverview')); */ $title = $langs->trans('ProjectReferers').' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans('ProjectReferers'); } @@ -252,24 +252,24 @@ print '
'; print ''; // Usage -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''; -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Opportunity status print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -294,7 +294,7 @@ if ($object->public) { } print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $object->opp_status, 'c_lead_status', 'rowid', 'code'); @@ -391,7 +391,7 @@ $listofreferent = array( 'buttonnew'=>'AddWarehouse', 'project_field'=>'fk_project', 'testnew'=>$user->hasRight('stock', 'creer'), - 'test'=>isModEnabled('stock') && $user->hasRight('stock', 'lire') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT) + 'test'=>isModEnabled('stock') && $user->hasRight('stock', 'lire') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_PROJECT') ), 'propal'=>array( 'name'=>"Proposals", @@ -612,7 +612,7 @@ $listofreferent = array( 'urlnew'=>DOL_URL_ROOT.'/projet/tasks/time.php?withproject=1&action=createtime&projectid='.$id.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$id), 'buttonnew'=>'AddTimeSpent', 'testnew'=>$user->hasRight('project', 'creer'), - 'test'=>isModEnabled('project') && $user->hasRight('projet', 'lire') && empty($conf->global->PROJECT_HIDE_TASKS) + 'test'=>isModEnabled('project') && $user->hasRight('projet', 'lire') && !getDolGlobalString('PROJECT_HIDE_TASKS') ), 'stock_mouvement'=>array( 'name'=>"MouvementStockAssociated", @@ -623,7 +623,7 @@ $listofreferent = array( 'margin'=>'minus', 'project_field'=>'fk_project', 'disableamount'=>0, - 'test'=>isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'lire') && !empty($conf->global->STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW) + 'test'=>isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'lire') && getDolGlobalString('STOCK_MOVEMENT_INTO_PROJECT_OVERVIEW') ), 'salaries'=>array( 'name'=>"Salaries", @@ -651,7 +651,7 @@ $listofreferent = array( 'lang'=>'banks', 'buttonnew'=>'AddVariousPayment', 'testnew'=>$user->hasRight('banque', 'modifier'), - 'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT) + 'test'=>isModEnabled("banque") && $user->hasRight('banque', 'lire') && !getDolGlobalString('BANK_USE_OLD_VARIOUS_PAYMENT') ), /* No need for this, available on dedicated tab "Agenda/Events" 'agenda'=>array( @@ -670,7 +670,7 @@ $listofreferent = array( ); // Change rules for profit/benefit calculation -if (!empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { +if (getDolGlobalString('PROJECT_ELEMENTS_FOR_PLUS_MARGIN')) { foreach ($listofreferent as $key => $element) { if ($listofreferent[$key]['margin'] == 'add') { unset($listofreferent[$key]['margin']); @@ -681,7 +681,7 @@ if (!empty($conf->global->PROJECT_ELEMENTS_FOR_PLUS_MARGIN)) { $listofreferent[trim($value)]['margin'] = 'add'; } } -if (!empty($conf->global->PROJECT_ELEMENTS_FOR_MINUS_MARGIN)) { +if (getDolGlobalString('PROJECT_ELEMENTS_FOR_MINUS_MARGIN')) { foreach ($listofreferent as $key => $element) { if ($listofreferent[$key]['margin'] == 'minus') { unset($listofreferent[$key]['margin']); @@ -846,7 +846,7 @@ foreach ($listofreferent as $key => $value) { if (!empty($element->close_code) && $element->close_code == 'replaced') { $qualifiedfortotal = false; // Replacement invoice, do not include into total } - if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $element->type == Facture::TYPE_DEPOSIT) { + if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS') && $element->type == Facture::TYPE_DEPOSIT) { $qualifiedfortotal = false; // If hidden option to use deposits as payment (deprecated, not recommended to use this), deposits are not included } } @@ -1048,7 +1048,7 @@ foreach ($listofreferent as $key => $value) { $array_of_element_linkable_with_different_thirdparty = array('facture_fourn', 'commande_fournisseur'); if (!in_array($tablename, $array_of_element_linkable_with_different_thirdparty)) { $idtofilterthirdparty = empty($object->thirdparty->id) ? 0 : $object->thirdparty->id; - if (!empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) { + if (getDolGlobalString('PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS')) { $idtofilterthirdparty .= ',' . getDolGlobalString('PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS'); } } @@ -1056,7 +1056,7 @@ foreach ($listofreferent as $key => $value) { $elementarray = $object->get_element_list($key, $tablename, $datefieldname, $dates, $datee, !empty($project_field) ? $project_field : 'fk_projet'); - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) { + if (!getDolGlobalString('PROJECT_LINK_ON_OVERWIEW_DISABLED') && $idtofilterthirdparty && !in_array($tablename, $exclude_select_element)) { $selectList = $formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300 minwidth75imp', -2, empty($project_field) ? 'fk_projet' : $project_field, $langs->trans("SelectElement")); if ($selectList < 0) { setEventMessages($formproject->error, $formproject->errors, 'errors'); @@ -1078,11 +1078,11 @@ foreach ($listofreferent as $key => $value) { $addform .= ''; } } - if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew) { + if (!getDolGlobalString('PROJECT_CREATE_ON_OVERVIEW_DISABLED') && $urlnew) { $addform .= '
'; if ($testnew) { $addform .= ''; - } elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { + } elseif (!getDolGlobalString('MAIN_BUTTON_HIDE_UNAUTHORIZED')) { $addform .= ''; } $addform .= '
'; @@ -1248,7 +1248,7 @@ foreach ($listofreferent as $key => $value) { // Remove link print '
'; if ($tablename != 'projet_task' && $tablename != 'stock_mouvement') { - if (empty($conf->global->PROJECT_DISABLE_UNLINK_FROM_OVERVIEW) || $user->admin) { // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true + if (!getDolGlobalString('PROJECT_DISABLE_UNLINK_FROM_OVERVIEW') || $user->admin) { // PROJECT_DISABLE_UNLINK_FROM_OVERVIEW is empty by defaut, so this test true print 'id.($project_field ? '&projectfield='.$project_field : '').'" class="reposition">'; print img_picto($langs->trans('Unlink'), 'unlink'); print ''; @@ -1650,7 +1650,7 @@ function canApplySubtotalOn($tablename) { global $conf; - if (empty($conf->global->PROJECT_ADD_SUBTOTAL_LINES)) { + if (!getDolGlobalString('PROJECT_ADD_SUBTOTAL_LINES')) { return false; } return in_array($tablename, array('facture_fourn', 'commande_fournisseur')); diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 3d657d636d0..15fa6821e24 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -43,7 +43,7 @@ $mine = ($mode == 'mine' ? 1 : 0); $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -85,7 +85,7 @@ if (!empty($conf->use_javascript_ajax)) { //$title=$langs->trans("Gantt").($object->ref?' - '.$object->ref.' '.$object->name:''); $title = $langs->trans("Gantt"); -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = ($object->ref ? $object->ref.' '.$object->name.' - ' : '').$langs->trans("Gantt"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; @@ -143,24 +143,24 @@ if (($id > 0 && is_numeric($id)) || !empty($ref)) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 2cc11191f90..2edc9ed8129 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -17,7 +17,7 @@ // variable $listofopplabel and $listofoppstatus should be defined -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $sql = "SELECT p.fk_opp_status as opp_status, cls.code, COUNT(p.rowid) as nb, SUM(p.opp_amount) as opp_amount, SUM(p.opp_amount * p.opp_percent) as ponderated_opp_amount"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls ON p.fk_opp_status = cls.rowid"; // If lead status has been removed, we must show it in stats as unknown $sql .= " WHERE p.entity IN (".getEntity('project').")"; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index c915aa02e8f..f6cb13863e5 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -119,7 +119,7 @@ $search_import_key = GETPOST('search_import_key', 'alpha'); $searchCategoryCustomerOperator = 0; if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int'); -} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { +} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) { $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); @@ -242,7 +242,7 @@ $arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1 $arrayfields['s.name_alias'] = array('label'=>"AliasNameShort", 'checked'=>0, 'position'=>22); $arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'position'=>23); $arrayfields['c.assigned'] = array('label'=>$langs->trans("AssignedTo"), 'checked'=>1, 'position'=>120); -$arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106); +$arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>(!getDolGlobalString('PROJECT_USE_OPPORTUNITIES') ? 0 : 1), 'position'=>106); $arrayfields['u.login'] = array('label'=>"Author", 'checked'=>-1, 'position'=>165); // Force some fields according to search_usage filter... if (GETPOST('search_usage_opportunity')) { @@ -427,7 +427,7 @@ $userstatic = new User($db); $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; $title = $langs->trans("LeadsOrProjects"); -if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (!getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { $title = $langs->trans("Projects"); } if (getDolGlobalInt('PROJECT_USE_OPPORTUNITIES') == 2) { // 2 = leads only @@ -781,7 +781,7 @@ if (!$resql) { $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$obj->id); exit; @@ -1125,7 +1125,7 @@ if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PROJECT, $search_category_array, 'minwidth300imp minwidth300 widthcentpercentminusx'); } // Filter on customer categories -if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST) && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { +if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_PROJECT_LIST') && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); @@ -1163,7 +1163,7 @@ print ''; // Action column -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; } // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'opp_weighted_amount'; } } @@ -1862,8 +1860,6 @@ while ($i < $imaxinloop) { print ''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'p.budget_amount'; } } diff --git a/htdocs/projet/messaging.php b/htdocs/projet/messaging.php index 113889bdcc5..937d95b1be3 100644 --- a/htdocs/projet/messaging.php +++ b/htdocs/projet/messaging.php @@ -107,14 +107,14 @@ $object = new Project($db); if ($id > 0 || !empty($ref)) { $object->fetch($id, $ref); $object->fetch_thirdparty(); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $object->info($object->id); } $agenda = (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) ? '/'.$langs->trans("Agenda") : ''; $title = $langs->trans('Events').$agenda.' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Info"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/note.php b/htdocs/projet/note.php index ae7092b05a3..d60d526c403 100644 --- a/htdocs/projet/note.php +++ b/htdocs/projet/note.php @@ -40,7 +40,7 @@ $mine = (isset($_REQUEST['mode']) && $_REQUEST['mode'] == 'mine') ? 1 : 0; $object = new Project($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -72,7 +72,7 @@ if (empty($reshook)) { */ $title = $langs->trans("Notes").' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Note"); } $help_url = "EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 7d2dafaa74a..a83246f3c4a 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -43,7 +43,7 @@ if ($user->socid > 0) { } $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear; -$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; // Load translation files required by the page @@ -86,7 +86,7 @@ if (!empty($year)) { $stats_project->year = $year; } -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { if ($search_opp_status) { $stats_project->opp_status = $search_opp_status; } @@ -124,7 +124,7 @@ if (!$mesg) { } -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Build graphic amount of object $data = $stats_project->getAmountByMonthWithPrevYear($endyear, $startyear); //var_dump($data); @@ -159,7 +159,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { } } -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { // Build graphic with transformation rate $data = $stats_project->getWeightedAmountByMonthWithPrevYear($endyear, $startyear, 0, 0); //var_dump($data); @@ -235,7 +235,7 @@ print img_picto('', 'company', 'class="pictofixedwidth"'); print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', ''); print ''; // Opportunity status -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print ''; @@ -268,7 +268,7 @@ print '
'; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; @@ -1369,7 +1369,7 @@ if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; @@ -1843,8 +1843,6 @@ while ($i < $imaxinloop) { print '
'.$langs->trans("OpportunityStatusShort").''; print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth300', 1, 1); print '
'; print ''; print ''; print ''; -if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { +if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print ''; print ''; print ''; @@ -284,7 +284,7 @@ foreach ($data_all_year as $val) { print ''; print ''; print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print ''; print ''; print ''; @@ -295,7 +295,7 @@ foreach ($data_all_year as $val) { print ''; print ''; print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print ''; print ''; print ''; @@ -315,7 +315,7 @@ if ($mesg) { } else { $stringtoshow .= $px1->show(); $stringtoshow .= "
\n"; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { //$stringtoshow .= $px->show(); //$stringtoshow .= "
\n"; $stringtoshow .= $px2->show(); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index d75664983ed..4251088eb78 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -111,7 +111,7 @@ $taskstatic = new Task($db); $extrafields = new ExtraFields($db); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($object, 'fetchComments') && empty($object->comments)) { +if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } @@ -411,7 +411,7 @@ $taskstatic = new Task($db); $userstatic = new User($db); $title = $langs->trans("Tasks").' - '.$object->ref.' '.$object->name; -if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { +if (getDolGlobalString('MAIN_HTML_TITLE') && preg_match('/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) { $title = $object->ref.' '.$object->name.' - '.$langs->trans("Tasks"); } if ($action == 'create') { @@ -599,24 +599,24 @@ if ($id > 0 || !empty($ref)) { print '
'.$langs->trans("Year").''.$langs->trans("NbOfProjects").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityAmountAverageShort").''.$langs->trans("OpportunityAmountWeigthedShort").'
0 ? '&userid='.$userid : '').'">'.$oldyear.'0000
0 ? '&userid='.$userid : '').'">'.$year.''.$val['nb'].''.($val['total'] ? price(price2num($val['total'], 'MT'), 1) : '0').''.($val['avg'] ? price(price2num($val['avg'], 'MT'), 1) : '0').''.(isset($val['weighted']) ? price(price2num($val['weighted'], 'MT'), 1) : '0').'
'; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -734,8 +734,8 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- print ''; $defaultref = ''; - $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; - if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { + $obj = !getDolGlobalString('PROJECT_TASK_ADDON') ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (getDolGlobalString('PROJECT_TASK_ADDON') && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').".php")) { require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/" . getDolGlobalString('PROJECT_TASK_ADDON').'.php'; $modTask = new $obj; $defaultref = $modTask->getNextValue($object->thirdparty, null); @@ -816,9 +816,9 @@ if ($action == 'create' && $user->hasRight('projet', 'creer') && (empty($object- // WYSIWYG editor include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); + $cked_enabled = (getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE') ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); $nbrows = 0; - if (!empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) { + if (getDolGlobalString('MAIN_INPUT_DESC_HEIGHT')) { $nbrows = $conf->global->MAIN_INPUT_DESC_HEIGHT; } $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows, '90%'); diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index e35313a37af..5e02e205e4b 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -107,7 +107,7 @@ if ($id > 0 || !empty($ref)) { if (!empty($projectstatic->socid)) { $projectstatic->fetch_thirdparty(); } - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } @@ -151,24 +151,24 @@ if ($id > 0 || !empty($ref)) { print '
'; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''; // Opportunities - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) && !empty($object->usage_opportunity)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') && !empty($object->usage_opportunity)) { // Opportunity status print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -194,7 +194,7 @@ if ($id > 0 || !empty($ref)) { print '
'.$langs->trans("OpportunityStatus").''; $code = dol_getIdFromCode($db, $projectstatic->opp_status, 'c_lead_status', 'rowid', 'code'); diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 146e176704e..20afe4937a4 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -163,12 +163,12 @@ llxHeader('', $title, $help_url); if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $id = $object->id; // So when doing a search from ref, id is also set correctly. - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } if (!empty($projectstatic->socid)) { @@ -215,24 +215,24 @@ if ($id > 0 || !empty($ref)) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 6162e0b901c..095407b7725 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -97,11 +97,11 @@ if (!empty($project_ref) && !empty($withproject)) { } if ($id > 0 || !empty($ref)) { - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $projectstatic->fetch($object->fk_project); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } @@ -172,24 +172,24 @@ if ($object->id > 0) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''."\n"; $plannedworkloadoutputformat = 'allhourmin'; $timespentoutputformat = 'allhourmin'; -if (!empty($conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT)) { +if (getDolGlobalString('PROJECT_PLANNED_WORKLOAD_FORMAT')) { $plannedworkloadoutputformat = $conf->global->PROJECT_PLANNED_WORKLOAD_FORMAT; } -if (!empty($conf->global->PROJECT_TIMES_SPENT_FORMAT)) { +if (getDolGlobalString('PROJECT_TIMES_SPENT_FORMAT')) { $timespentoutputformat = $conf->global->PROJECT_TIME_SPENT_FORMAT; } diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 886784ac60c..3c965080ede 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -53,11 +53,11 @@ $projectstatic = new Project($db); if ($id > 0 || !empty($ref)) { if ($object->fetch($id, $ref) > 0) { - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $projectstatic->fetch($object->fk_project); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } if (!empty($projectstatic->socid)) { @@ -162,24 +162,24 @@ if ($object->id > 0) { print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 05223813b11..bf2021c1eac 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -74,7 +74,7 @@ $search_opp_status = GETPOST("search_opp_status", 'alpha'); $searchCategoryCustomerOperator = 0; if (GETPOSTISSET('formfilteraction')) { $searchCategoryCustomerOperator = GETPOST('search_category_customer_operator', 'int'); -} elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) { +} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) { $searchCategoryCustomerOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT; } $searchCategoryCustomerList = GETPOST('search_category_customer_list', 'array'); @@ -584,7 +584,7 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all) { +if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) { $obj = $db->fetch_object($resql); $id = $obj->id; // in select, task id has been aliases into 'id' header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withproject=1'); @@ -808,7 +808,7 @@ $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form- $moreforfilter .= ''; // Filter on customer categories -if (!empty($conf->global->MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST) && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { +if (getDolGlobalString('MAIN_SEARCH_CATEGORY_CUSTOMER_ON_TASK_LIST') && isModEnabled("categorie") && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $tmptitle = $langs->transnoentities('CustomersProspectsCategoriesShort'); $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"'); @@ -914,7 +914,7 @@ if (!empty($arrayfields['s.name_alias']['checked'])) { if (!empty($arrayfields['p.fk_statut']['checked'])) { print '
'; $arrayofstatus = array(); - foreach ($projectstatic->statuts_short as $key => $val) { + foreach ($projectstatic->labelStatusShort as $key => $val) { $arrayofstatus[$key] = $langs->trans($val); } $arrayofstatus['99'] = $langs->trans("NotClosed").' ('.$langs->trans('Draft').'+'.$langs->trans('Opened').')'; @@ -1109,10 +1109,10 @@ print '
'; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index 5ff00cc1309..ad0378f80e2 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -46,7 +46,7 @@ if ($user->socid > 0) { } $nowyear = dol_print_date(dol_now('gmt'), "%Y", 'gmt'); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; -$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); +$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS))); $endyear = $year; // Load translation files required by the page diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index a4b23c7c222..0e91dd188a9 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -101,7 +101,7 @@ if ($action == 'update' && !GETPOST("cancel") && $user->hasRight('projet', 'cree $object->ref = $taskref ? $taskref : GETPOST("ref", 'alpha', 2); $object->label = GETPOST("label", "alphanohtml"); - if (empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) { + if (!getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE')) { $object->description = GETPOST('description', "alphanohtml"); } else { $object->description = GETPOST('description', "restricthtml"); @@ -235,12 +235,12 @@ llxHeader('', $title, $help_url); if ($id > 0 || !empty($ref)) { $res = $object->fetch_optionals(); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } if (!empty($projectstatic->socid)) { @@ -287,24 +287,24 @@ if ($id > 0 || !empty($ref)) { print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -497,7 +497,7 @@ if ($id > 0 || !empty($ref)) { // WYSIWYG editor include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $cked_enabled = (!empty($conf->global->FCKEDITOR_ENABLE_SOCIETE) ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); + $cked_enabled = (getDolGlobalString('FCKEDITOR_ENABLE_SOCIETE') ? $conf->global->FCKEDITOR_ENABLE_SOCIETE : 0); $nbrows = getDolGlobalInt('MAIN_INPUT_DESC_HEIGHT', 0); $doleditor = new DolEditor('description', $object->description, '', 80, 'dolibarr_details', '', false, true, $cked_enabled, $nbrows); print $doleditor->Create(); diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2bd89809c95..bccb0de616b 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -759,7 +759,7 @@ if ($action == 'confirm_generateinvoice') { // If a product is defined, we msut use the $prodDurationHours and $pu_ht of product (already set previously). $pu_ht_for_task = $pu_htline; // If we want to reuse the value of timespent (so use same price than cost price) - if (!empty($conf->global->PROJECT_TIME_SPENT_INTO_INVOICE_USE_VALUE)) { + if (getDolGlobalString('PROJECT_TIME_SPENT_INTO_INVOICE_USE_VALUE')) { $pu_ht_for_task = price2num($timespent_data['totalvaluetodivideby3600'] / $timespent_data['timespent'], 'MU') * $prodDurationHours; } $pa_ht = price2num($timespent_data['totalvaluetodivideby3600'] / $timespent_data['timespent'], 'MU') * $prodDurationHours; @@ -767,7 +767,7 @@ if ($action == 'confirm_generateinvoice') { // If not product used, we use the hour unit for duration and unit price. $pu_ht_for_task = 0; // If we want to reuse the value of timespent (so use same price than cost price) - if (!empty($conf->global->PROJECT_TIME_SPENT_INTO_INVOICE_USE_VALUE)) { + if (getDolGlobalString('PROJECT_TIME_SPENT_INTO_INVOICE_USE_VALUE')) { $pu_ht_for_task = price2num($timespent_data['totalvaluetodivideby3600'] / $timespent_data['timespent'], 'MU'); } $pa_ht = price2num($timespent_data['totalvaluetodivideby3600'] / $timespent_data['timespent'], 'MU'); @@ -923,11 +923,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } $res = $projectstatic->fetch_optionals(); } elseif ($object->fetch($id, $ref) >= 0) { - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_TASK') && method_exists($object, 'fetchComments') && empty($object->comments)) { $object->fetchComments(); } $result = $projectstatic->fetch($object->fk_project); - if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_PROJECT) && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { + if (getDolGlobalString('PROJECT_ALLOW_COMMENT_ON_PROJECT') && method_exists($projectstatic, 'fetchComments') && empty($projectstatic->comments)) { $projectstatic->fetchComments(); } if (!empty($projectstatic->socid)) { @@ -992,24 +992,24 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; // Usage - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES) || empty($conf->global->PROJECT_HIDE_TASKS) || isModEnabled('eventorganization')) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES') || !getDolGlobalString('PROJECT_HIDE_TASKS') || isModEnabled('eventorganization')) { print ''; print ''; print ''; print ''; - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print ''; if (isModEnabled("service") && !empty($projectstatic->thirdparty) && $projectstatic->thirdparty->id > 0 && $projectstatic->usage_bill_time) { @@ -1827,7 +1827,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print ''; // Invoiced - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print ''; @@ -2390,7 +2390,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser // Invoiced if (!empty($arrayfields['valuebilled']['checked'])) { print ''; } - } elseif ($totalarray['totaldurationfield'] == $i) { + } elseif (isset($totalarray['totaldurationfield']) && $totalarray['totaldurationfield'] == $i) { print ''; - } elseif ($totalarray['totalvaluefield'] == $i) { + } elseif (isset($totalarray['totalvaluefield']) && $totalarray['totalvaluefield'] == $i) { print ''; //} elseif ($totalarray['totalvaluebilledfield'] == $i) { print ''; } else { diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index 82e903300b1..244ef767836 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -151,7 +151,7 @@ if (!isModEnabled('agenda')) { */ // Check config -if (empty($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY)) { +if (!getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY')) { $user->getrights(); llxHeaderVierge(); @@ -246,7 +246,7 @@ if ($shortfilename == 'dolibarrcalendar') { $agenda = new ActionComm($db); $cachedelay = 0; -if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)) { +if (getDolGlobalString('MAIN_AGENDA_EXPORT_CACHE')) { $cachedelay = $conf->global->MAIN_AGENDA_EXPORT_CACHE; } diff --git a/htdocs/public/bookcal/bookcalAjax.php b/htdocs/public/bookcal/bookcalAjax.php index 7ba08e409d8..8fddaaece37 100644 --- a/htdocs/public/bookcal/bookcalAjax.php +++ b/htdocs/public/bookcal/bookcalAjax.php @@ -104,10 +104,18 @@ if ($action == 'verifyavailability') { if ($offsetmin == 0) { $offsetmin = 60; } + $startHourstring = $obj->startHour; + $endHourstring = $obj->endHour; + if ($startHourstring <= 0) { + $startHourstring = 0; + } + if ($endHourstring >= 24) { + $endHourstring = 24; + } $offsethour = round($obj->duration / 60); // Creation of array of availabilties range - if ($datetocheckbooking >= $starttime && $datetocheckbooking < $endtime) { - for ($hour=$obj->startHour; $hour < $obj->endHour; $hour+= $offsethour) { + if ($datetocheckbooking >= $starttime && $datetocheckbooking <= $endtime) { + for ($hour=$startHourstring; $hour < $endHourstring; $hour+= $offsethour) { for ($min=0; $min < 60; $min += $offsetmin) { $hourstring = $hour; $minstring = $min; @@ -123,50 +131,47 @@ if ($action == 'verifyavailability') { } $i++; } - $response["code"] = "SUCCESS"; - } - - // TODO Select also all not available ranges - // Build the list of hours available (key = hour, value = duration) - } - - // Now get ranges already reserved - // TODO Remove this - /*if (!$error) { - $datetocheckbooking_end = dol_time_plus_duree($datetocheckbooking, 1, 'd'); - - $sql = "SELECT b.datep, b.id"; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as b"; - $sql .= " WHERE b.datep >= '".$db->idate($datetocheckbooking)."'"; - $sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'"; - $sql .= " AND fk_bookcal_availability IN (SELECT rowid FROM ".MAIN_DB_PREFIX."bookcal_availabilities WHERE fk_bookcal_calendar = ".((int) $id).")"; - //$sql .= " AND b.transparency" - $resql = $db->query($sql); - if ($resql) { - $num = $db->num_rows($resql); - $i = 0; - $response = array(); - $response["content"] = array(); - while ($i < $num) { - $obj = $db->fetch_object($resql); - $dateobject = $obj->datep; - $dateobject = explode(" ", $dateobject)[1]; - $dateobject = explode(":", $dateobject); - - $dateobjectstring = $dateobject[0].$dateobject[1]; - - $response["content"][] = $dateobjectstring; - $i++; - } - if ($i == 0) { - $response["code"] = "NO_DATA_FOUND"; - } else { + if ($i == $num) { $response["code"] = "SUCCESS"; + } else { + $response["code"] = "ERROR"; + $error ++; } - } else { - dol_print_error($db); } - }*/ + + // Select also all not available ranges + if (!$error) { + $datetocheckbooking_end = dol_time_plus_duree($datetocheckbooking, 1, 'd'); + + $sql = "SELECT b.datep, b.id"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as b"; + $sql .= " WHERE b.datep >= '".$db->idate($datetocheckbooking)."'"; + $sql .= " AND b.datep < '".$db->idate($datetocheckbooking_end)."'"; + $sql .= " AND b.code = 'AC_RDV'"; + $sql .= " AND b.status = 0"; + $sql .= " AND b.fk_bookcal_calendar = ".((int) $id); + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $db->fetch_object($resql); + $datebooking = $db->jdate($obj->datep); + $datebookingarray = dol_getdate($datebooking); + $hourstring = $datebookingarray["hours"]; + $minstring = $datebookingarray["minutes"]; + if ($hourstring < 10) { + $hourstring = "0".$hourstring; + } + if ($minstring < 10) { + $minstring = "0".$minstring; + } + $response["availability"][$hourstring.":".$minstring] *= -1; + $i++; + } + } + } + } $result = $response; } diff --git a/htdocs/public/bookcal/index.php b/htdocs/public/bookcal/index.php index 0aba257d73d..f6fec0ceb2e 100644 --- a/htdocs/public/bookcal/index.php +++ b/htdocs/public/bookcal/index.php @@ -233,14 +233,14 @@ if ($action == 'add') { if (!$error) { $dateend = dol_time_plus_duree(GETPOST("datetimebooking", 'int'), GETPOST("durationbooking"), 'i'); - $actioncomm->label = "test"; + $actioncomm->label = $langs->trans("BookcalBookingTitle"); $actioncomm->type = 'AC_RDV'; $actioncomm->type_id = 5; $actioncomm->datep = GETPOST("datetimebooking", 'int'); $actioncomm->datef = $dateend; $actioncomm->note_private = GETPOST("description"); $actioncomm->percentage = -1; - $actioncomm->fk_bookcal_availability = GETPOST("id_availability", 'int'); + $actioncomm->fk_bookcal_calendar = $id; $actioncomm->userownerid = $calendar->visibility; $actioncomm->contact_id = $contact->id; $actioncomm->socpeopleassigned = $contact->id; @@ -521,13 +521,18 @@ if ($action == 'afteradd') { for(index in timearray){ let hour = new Date("2000-01-01T" + index + ":00"); duration = timearray[index]; + isalreadybooked = false; + if (duration < 0) { + duration *= -1; + isalreadybooked = true; + } hour.setMinutes(hour.getMinutes() + duration); let hours = hour.getHours().toString().padStart(2, "0"); // Formater pour obtenir deux chiffres let mins = hour.getMinutes().toString().padStart(2, "0"); // Formater pour obtenir deux chiffres timerange = index + " - " + `${hours}:${mins}`; - str += "
"; + str += "
"; } $("#buttonlistbooking").html(str); $(".btnsubmitbooking").on("click", function(){ @@ -558,6 +563,7 @@ if ($action == 'afteradd') { timearray = data["availability"]; console.log(timearray); generateBookingButtons(timearray, datestring); + $(".btnbookcalbooked").prop("disabled", true); } else { if(data["code"] == "NO_DATA_FOUND"){ console.log("No booking to hide"); diff --git a/htdocs/public/company/new.php b/htdocs/public/company/new.php index 0c4b3a8f881..6d55065767d 100644 --- a/htdocs/public/company/new.php +++ b/htdocs/public/company/new.php @@ -133,13 +133,13 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; print ''; print '
'; - if (empty($conf->global->MAIN_HIDE_POWERED_BY)) { + if (!getDolGlobalString('MAIN_HIDE_POWERED_BY')) { print ''; } print ''; } - if (!empty($conf->global->MEMBER_IMAGE_PUBLIC_REGISTRATION)) { + if (getDolGlobalString('MEMBER_IMAGE_PUBLIC_REGISTRATION')) { print '
'; print ''; print '
'; @@ -200,7 +200,7 @@ if (empty($reshook) && $action == 'add') { } // Check Captcha code if is enabled - if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { + if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { $sessionkey = 'dol_antispam_value'; $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); if (!$ok) { @@ -242,7 +242,7 @@ if (empty($reshook) && $action == 'add') { if (!empty($backtopage)) { $urlback = $backtopage; - } elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) { + } elseif (getDolGlobalString('MEMBER_URL_REDIRECT_SUBSCRIPTION')) { $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION; // TODO Make replacement of __AMOUNT__, etc... } else { @@ -306,7 +306,7 @@ print '
'; print '
'; print '
'; -if (!empty($conf->global->COMPANY_NEWFORM_TEXT)) { +if (getDolGlobalString('COMPANY_NEWFORM_TEXT')) { print $langs->trans($conf->global->COMPANY_NEWFORM_TEXT) . "
\n"; } else { print $langs->trans("ContactUsDesc", getDolGlobalString("MAIN_INFO_SOCIETE_MAIL")) . "
\n"; @@ -411,9 +411,9 @@ print '
'; // Email / Web -print ''; +print ''; print ''; -if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { +if (isModEnabled('mailing') && getDolGlobalString('THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION')) { if ($conf->browser->layout == 'phone') { print ''; } @@ -436,7 +436,7 @@ print '' . "\n"; // Display Captcha code if is enabled -if (!empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { +if (getDolGlobalString('MAIN_SECURITY_ENABLECAPTCHA')) { require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; print '
'; print $langs->trans("Usage"); print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (getDolGlobalString('PROJECT_USE_OPPORTUNITIES')) { print 'usage_opportunity ? ' checked="checked"' : '')) . '"> '; $htmltext = $langs->trans("ProjectFollowOpportunity"); print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS')) { print 'usage_task ? ' checked="checked"' : '')) . '"> '; $htmltext = $langs->trans("ProjectFollowTasks"); print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); print '
'; } - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { print 'usage_bill_time ? ' checked="checked"' : '')) . '"> '; $htmltext = $langs->trans("ProjectBillTimeDescription"); print $form->textwithpicto($langs->trans("BillTime"), $htmltext); @@ -1749,7 +1749,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser print '
' . $langs->trans("Note") . '' . $langs->trans("NewTimeSpent") . '' . $langs->trans("ProgressDeclared") . ''; print ''; // invoice_id and invoice_line_id - if (empty($conf->global->PROJECT_HIDE_TASKS) && !empty($conf->global->PROJECT_BILL_TIME_SPENT)) { + if (!getDolGlobalString('PROJECT_HIDE_TASKS') && getDolGlobalString('PROJECT_BILL_TIME_SPENT')) { if ($projectstatic->usage_bill_time) { if ($task_time->invoice_id) { $result = $tmpinvoice->fetch($task_time->invoice_id); @@ -2808,9 +2808,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser } else { print ''.$form->textwithpicto($langs->trans("Total"), $langs->trans("Totalforthispage")).'' . convertSecondToTime($totalarray['totalduration'], 'allhourmin') . '' . price($totalarray['totalvalue']) . ''.price($totalarray['totalvaluebilled']).'' . img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"') . print '
' . $form->editfieldkey('EMail', 'email', '', $objectsoc, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY) . '
' . $form->editfieldkey('EMail', 'email', '', $objectsoc, 0, 'string', '', !getDolGlobalString('SOCIETE_EMAIL_MANDATORY') ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY) . '' . img_picto('', 'object_email', 'class="pictofixedwidth"') . '
'; print ''; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 947df34b35f..e1eec2d81ac 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -432,7 +432,7 @@ print '
'; // TODO Replace this with a hook // Google Adsense (need Google module) -if (isModEnabled('google') && !empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) { +if (isModEnabled('google') && getDolGlobalString('MAIN_GOOGLE_AD_CLIENT') && getDolGlobalString('MAIN_GOOGLE_AD_SLOT')) { if (empty($conf->dol_use_jmobile)) { print '
'."\n"; print '