diff --git a/dev/tools/rector/src/Renaming/GlobalToFunction.php b/dev/tools/rector/src/Renaming/GlobalToFunction.php index f81f2ee34c1..0c0cd9c7cc8 100644 --- a/dev/tools/rector/src/Renaming/GlobalToFunction.php +++ b/dev/tools/rector/src/Renaming/GlobalToFunction.php @@ -103,7 +103,7 @@ class GlobalToFunction extends AbstractRector if ($node instanceof FuncCall) { $tmpfunctionname = $this->getName($node); - // If function is ok(we must avoid a lot of cases like isset, empty) + // If function is ok. We must avoid a lot of cases like isset(), empty() if (in_array($tmpfunctionname, array('dol_escape_htmltag', 'make_substitutions', 'min', 'max', 'explode'))) { $args = $node->getArgs(); $nbofparam = count($args); diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index b6f21694a4f..0d4b02386e1 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -134,7 +134,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4efa16fcbde..7a10c5d96d6 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -129,7 +129,7 @@ $search_lettering_code = GETPOST('search_lettering_code', 'alpha'); $search_not_reconciled = GETPOST('search_not_reconciled', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 8143cee2434..51b37ce6651 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -104,7 +104,7 @@ if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_ } // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $optioncss = GETPOST('optioncss', 'alpha'); diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 7573dbee9f4..e372ab9c206 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -103,7 +103,7 @@ class AccountancyExport $this->db = $db; $this->separator = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; - $this->end_line = !getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? "\n" : (getDolGlobalInt('ACCOUNTING_EXPORT_ENDLINE') == 1 ? "\n" : "\r\n"); + $this->end_line = getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? (getDolGlobalInt('ACCOUNTING_EXPORT_ENDLINE') == 1 ? "\n" : "\r\n") : "\n"; $hookmanager->initHooks(array('accountancyexport')); } @@ -201,9 +201,9 @@ class AccountancyExport 'param' => array( self::$EXPORT_TYPE_CONFIGURABLE => array( 'label' => $langs->trans('Modelcsv_configurable'), - 'ACCOUNTING_EXPORT_FORMAT' => !getDolGlobalString('ACCOUNTING_EXPORT_FORMAT') ? 'txt' : $conf->global->ACCOUNTING_EXPORT_FORMAT, - 'ACCOUNTING_EXPORT_SEPARATORCSV' => !getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV') ? ',' : $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV, - 'ACCOUNTING_EXPORT_ENDLINE' => !getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE') ? 1 : $conf->global->ACCOUNTING_EXPORT_ENDLINE, + 'ACCOUNTING_EXPORT_FORMAT' => getDolGlobalString('ACCOUNTING_EXPORT_FORMAT', 'txt'), + 'ACCOUNTING_EXPORT_SEPARATORCSV' => getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV', ','), + 'ACCOUNTING_EXPORT_ENDLINE' => getDolGlobalString('ACCOUNTING_EXPORT_ENDLINE', 1), 'ACCOUNTING_EXPORT_DATE' => getDolGlobalString('ACCOUNTING_EXPORT_DATE', '%Y-%m-%d'), ), self::$EXPORT_TYPE_CEGID => array( @@ -839,8 +839,6 @@ class AccountancyExport $end_line = "\r\n"; // We should use dol_now function not time however this is wrong date to transfert in accounting - // $date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy - // $date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy foreach ($objectLines as $line) { // Clean some data $line->doc_ref = dol_string_unaccent($line->doc_ref); @@ -938,7 +936,6 @@ class AccountancyExport // Force date format : %d%m%y if (!empty($line->date_lim_reglement)) { - //$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE); $tab['date_echeance'] = dol_print_date($line->date_lim_reglement, '%d%m%y'); // Format must be ddmmyy } else { $tab['date_echeance'] = '000000'; @@ -1061,10 +1058,6 @@ class AccountancyExport $end_line = "\r\n"; $index = 1; - //We should use dol_now function not time however this is wrong date to transfert in accounting - //$date_ecriture = dol_print_date(dol_now(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy - //$date_ecriture = dol_print_date(time(), $conf->global->ACCOUNTING_EXPORT_DATE); // format must be ddmmyy - // Warning ! When truncation is necessary, no dot because 3 dots = three characters. The columns are shifted foreach ($objectLines as $line) { @@ -1109,7 +1102,6 @@ class AccountancyExport $tab['code_stat'] = str_repeat(' ', 4); if (!empty($line->date_lim_reglement)) { - //$tab['date_echeance'] = dol_print_date($line->date_lim_reglement, $conf->global->ACCOUNTING_EXPORT_DATE); $tab['date_echeance'] = dol_print_date($line->date_lim_reglement, '%d%m%Y'); } else { $tab['date_echeance'] = dol_print_date($line->doc_date, '%d%m%Y'); @@ -1276,7 +1268,7 @@ class AccountancyExport $separator = $this->separator; foreach ($objectLines as $line) { - $date_document = dol_print_date($line->doc_date, $conf->global->ACCOUNTING_EXPORT_DATE); + $date_document = dol_print_date($line->doc_date, getDolGlobalString('ACCOUNTING_EXPORT_DATE')); $tab = array(); // export configurable diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 1d475b67527..0e3dc913917 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -470,7 +470,7 @@ class AccountingJournal extends CommonObject } // Define begin binding date if (getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'"; + $sql .= " AND ad.depreciation_date >= '" . $this->db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) . "'"; } $sql .= " ORDER BY ad.depreciation_date"; @@ -616,12 +616,12 @@ class AccountingJournal extends CommonObject $disposal_date = $pre_data_info['disposal']['date']; if ((!($date_start && $date_end) || ($date_start <= $disposal_date && $disposal_date <= $date_end)) && - (!getDolGlobalString('ACCOUNTING_DATE_START_BINDING') || $conf->global->ACCOUNTING_DATE_START_BINDING <= $disposal_date) + (!getDolGlobalString('ACCOUNTING_DATE_START_BINDING') || getDolGlobalInt('ACCOUNTING_DATE_START_BINDING') <= $disposal_date) ) { $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 = getDolGlobalInt('ASSET_DISPOSAL_VAT') > 0 ? $conf->global->ASSET_DISPOSAL_VAT : 20; + $disposal_vat = getDolGlobalInt('ASSET_DISPOSAL_VAT') > 0 ? getDolGlobalInt('ASSET_DISPOSAL_VAT') : 20; // Get accountancy codes //--------------------------- diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 0551a3fe95a..5bfa1435df6 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -329,7 +329,7 @@ print ''; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -337,7 +337,7 @@ for ($i = 1; $i <= 12; $i++) { if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -405,27 +405,27 @@ if ($resql) { print ''; print ''; for ($i = 2; $i <= 13; $i++) { - $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + $cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2); if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '
'.$langs->trans("Account").''.$langs->trans("Label").''; @@ -357,7 +357,7 @@ print ''.$langs->trans("Total").'
'; if ($row[0] == 'tobind') { - $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if ($startmonth > 12) { $startmonth -= 12; } - $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; - $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + $startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; + $endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11; if ($endmonth > 12) { $endmonth -= 12; } - $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/customer/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } print ''; @@ -466,7 +466,7 @@ print ''; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -474,7 +474,7 @@ for ($i = 1; $i <= 12; $i++) { if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -551,11 +551,11 @@ if ($resql) { print ''; for ($i = 2; $i <= 13; $i++) { - $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + $cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2); if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '
'.$langs->trans("Account").''.$langs->trans("Label").''; @@ -494,7 +494,7 @@ print ''.$langs->trans("Total").'
'; @@ -590,7 +590,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -600,7 +600,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql = "SELECT '".$db->escape($langs->trans("TotalVente"))."' AS total,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -650,7 +650,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print '
'.$langs->trans("TotalVente").'
'; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -662,7 +662,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa // With old situation invoice setup $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -684,7 +684,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa } else { $sql = "SELECT '".$db->escape($langs->trans("Vide"))."' AS marge,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index aad7c00f46c..4929b45ac67 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -65,7 +65,7 @@ $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -506,7 +506,7 @@ if ($result) { print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3e312a220ef..26d3c32b512 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -80,7 +80,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI } // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -660,7 +660,7 @@ if ($result) { // Description of line print ''; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 1382eaf5ac6..5c2ca5d52bf 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -204,7 +204,7 @@ print '
'.$langs->trans("TotalMarge").''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($facture_static_det->desc, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $facture_static_det->desc); print '
'; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -212,7 +212,7 @@ for ($i = 1; $i <= 12; $i++) { if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -271,27 +271,27 @@ if ($resql) { print ''; print ''; for ($i = 2; $i <= 13; $i++) { - $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + $cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2); if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '
'.$langs->trans("Account").''.$langs->trans("Label").''; @@ -233,7 +233,7 @@ print ''.$langs->trans("Total").'
'; if ($row[0] == 'tobind') { - $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if ($startmonth > 12) { $startmonth -= 12; } - $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; - $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + $startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; + $endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11; if ($endmonth > 12) { $endmonth -= 12; } - $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/expensereport/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } print ''; @@ -333,7 +333,7 @@ print ''; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -344,7 +344,7 @@ print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -421,7 +421,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print '
'.$langs->trans("Account").''.$langs->trans("Label").''.$langs->trans("Total").'
'; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -431,7 +431,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql = "SELECT '".$db->escape($langs->trans("TotalExpenseReport"))."' AS label,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 2f9c4e70e8e..998992dc3cd 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -59,7 +59,7 @@ $search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_s $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -414,7 +414,7 @@ if ($result) { // Fees description -- Can be null print ''; diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index a1d405f5725..e22581aebde 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -73,7 +73,7 @@ if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDI } // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -489,7 +489,7 @@ if ($result) { // Fees description -- Can be null print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 5d80232d51d..11c00917743 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1305,7 +1305,7 @@ if (empty($action) || $action == 'view') { if (!getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') || getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE') == '-1') { $accounttoshow = ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; } else { - $accounttoshow = ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account + $accounttoshow = ''.$langs->trans('UnknownAccountForThirdparty', length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE'))).''; // We will use a waiting account } } else { // We will refuse writing @@ -1396,7 +1396,8 @@ if (empty($action) || $action == 'view') { { print ''.$langs->trans("WaitAccountNotDefined").''; } - else */ print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); + else */ + print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); print ""; // Subledger account print ""; - print ""; + print ""; print '"; print '"; print '"; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index fb86cdc3505..e553be8e1bb 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -162,8 +162,8 @@ if ($result) { $num = $db->num_rows($result); // Variables - $account_salary = (getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'; - $account_vat = (getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT')) ? $conf->global->ACCOUNTING_VAT_BUY_ACCOUNT : 'NotDefined'; + $account_salary = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); + $account_vat = getDolGlobalString('ACCOUNTING_VAT_BUY_ACCOUNT', 'NotDefined'); $i = 0; while ($i < $num) { @@ -247,7 +247,7 @@ if ($action == 'writebookkeeping' && !$error) { $error = 0; $accountingaccountexpense = new AccountingAccount($db); - $accountingaccountexpense->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); + $accountingaccountexpense->fetch(null, getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'), true); foreach ($taber as $key => $val) { // Loop on each expense report $errorforline = 0; @@ -279,7 +279,7 @@ if ($action == 'writebookkeeping' && !$error) { $bookkeeping->subledger_account = $tabuser[$key]['user_accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; - $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; + $bookkeeping->numero_compte = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT'); $bookkeeping->label_compte = $accountingaccountexpense->label; $bookkeeping->label_operation = $tabuser[$key]['name']; @@ -726,7 +726,7 @@ if (empty($action) || $action == 'view') { print ""; // Account print "
'.$langs->trans("Total").''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->comments, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->comments); print '"; @@ -1407,7 +1408,7 @@ if (empty($action) || $action == 'view') { else print length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE); */ print "".$reflabel."".dol_escape_htmltag($reflabel)."'.$val["type_payment"]."'.($mt < 0 ? price(-$mt) : '')."'.($mt >= 0 ? price($mt) : '')."".$expensereportstatic->getNomUrl(1).""; - $accountoshow = length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT); + $accountoshow = length_accountg(getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT')); if (($accountoshow == "") || $accountoshow == 'NotDefined') { print ''.$langs->trans("MainAccountForUsersNotDefined").''; } else { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index a8181885c3a..6c91aa09a95 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -322,7 +322,7 @@ print ''; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -330,7 +330,7 @@ for ($i = 1; $i <= 12; $i++) { if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -393,27 +393,27 @@ if ($resql) { print ''; print ''; for ($i = 2; $i <= 13; $i++) { - $cursormonth = (($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + $i - 2); + $cursormonth = (getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + $i - 2); if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print ''; // Other attributes - //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'.$langs->trans("Account").''.$langs->trans("Label").''; @@ -350,7 +350,7 @@ print ''.$langs->trans("Total").'
'; if ($row[0] == 'tobind') { - $startmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1); + $startmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1); if ($startmonth > 12) { $startmonth -= 12; } - $startyear = ($startmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; - $endmonth = ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) + 11; + $startyear = ($startmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; + $endmonth = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) + 11; if ($endmonth > 12) { $endmonth -= 12; } - $endyear = ($endmonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $endyear = ($endmonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; print $langs->trans("UseMenuToSetBindindManualy", DOL_URL_ROOT.'/accountancy/supplier/list.php?search_date_startday=1&search_date_startmonth='.((int) $startmonth).'&search_date_startyear='.((int) $startyear).'&search_date_endday=&search_date_endmonth='.((int) $endmonth).'&search_date_endyear='.((int) $endyear), $langs->transnoentitiesnoconv("ToBind")); } else { print $row[1]; } print ''; @@ -454,7 +454,7 @@ print ''; print ''; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -462,7 +462,7 @@ for ($i = 1; $i <= 12; $i++) { if ($cursormonth > 12) { $cursormonth -= 12; } - $cursoryear = ($cursormonth < ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1)) ? $y + 1 : $y; + $cursoryear = ($cursormonth < getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1)) ? $y + 1 : $y; $tmp = dol_getdate(dol_get_last_day($cursoryear, $cursormonth, 'gmt'), false, 'gmt'); print '' $sql = "SELECT ".$db->ifsql('aa.account_number IS NULL', "'tobind'", 'aa.account_number')." AS codecomptable,"; $sql .= " ".$db->ifsql('aa.label IS NULL', "'tobind'", 'aa.label')." AS intitule,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -566,7 +566,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa print '
'.$langs->trans("Account").''.$langs->trans("Label").''; @@ -482,7 +482,7 @@ print ''.$langs->trans("Total").'
'; print ''; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } @@ -576,7 +576,7 @@ if (getDolGlobalString('SHOW_TOTAL_OF_PREVIOUS_LISTS_IN_LIN_PAGE')) { // This pa $sql = "SELECT '".$db->escape($langs->trans("CAHTF"))."' AS label,"; for ($i = 1; $i <= 12; $i++) { - $j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START ? $conf->global->SOCIETE_FISCAL_MONTH_START : 1) - 1; + $j = $i + getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1) - 1; if ($j > 12) { $j -= 12; } diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index ac35e048744..480c18f1c25 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -67,7 +67,7 @@ $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -536,7 +536,7 @@ if ($result) { print ''; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 6573f18503f..17f87eec351 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -77,7 +77,7 @@ $search_country = GETPOST('search_country', 'alpha'); $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : (!getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION') ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION); +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit); $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -119,7 +119,7 @@ if (!$user->hasRight('accounting', 'mouvements', 'lire')) { // Define begin binding date if (empty($search_date_start) && getDolGlobalString('ACCOUNTING_DATE_START_BINDING')) { - $search_date_start = $db->idate($conf->global->ACCOUNTING_DATE_START_BINDING); + $search_date_start = $db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING')); } @@ -687,7 +687,7 @@ if ($result) { // Description of line print ''; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index c9991c07a38..7e1b74e336e 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -154,7 +154,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } @@ -279,7 +279,7 @@ if ($action == 'edit') { print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); } elseif ($val['type'] == 'product') { if (isModEnabled("product") || isModEnabled("service")) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); $form->select_produits($selected, $constname, '', 0); } } else { diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index fef00036cc2..afdeca4b7b2 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -122,7 +122,7 @@ foreach ($eventstolog as $key => $arr) { print ''; print ''."\n"; } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 83e8c3f8dbf..7dd152fa3d1 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -247,7 +247,7 @@ if ($resql) { //print "x".$idrss; $rssparser = new RssParser($db); - $result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp); + $result = $rssparser->parser(getDolGlobalString($keyrssurl), 5, 300, $conf->externalrss->dir_temp); print "
"; print ''."\n"; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 64dc930e5e9..92a235fc178 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -173,7 +173,7 @@ if (empty($conf->use_javascript_ajax)) { } print ''; print ''; } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 88d590ffc35..a3d5871840b 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -232,8 +232,8 @@ foreach ($syslogModules as $moduleName) { if (!empty($tmpoption)) { if (GETPOSTISSET($tmpoption)) { $value = GETPOST($tmpoption); - } elseif (!empty($conf->global->$tmpoption)) { - $value = $conf->global->$tmpoption; + } elseif (getDolGlobalString($tmpoption)) { + $value = getDolGlobalString($tmpoption); } } else { $value = (isset($option['default']) ? $option['default'] : ''); diff --git a/htdocs/admin/webhook.php b/htdocs/admin/webhook.php index 155606bc698..cc7527579aa 100644 --- a/htdocs/admin/webhook.php +++ b/htdocs/admin/webhook.php @@ -142,7 +142,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } @@ -270,7 +270,7 @@ if ($action == 'edit') { print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); } elseif ($val['type'] == 'product') { if (isModEnabled("product") || isModEnabled("service")) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); $form->select_produits($selected, $constname, '', 0); } } else { @@ -447,7 +447,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { print ''; } diff --git a/htdocs/bookcal/admin/setup.php b/htdocs/bookcal/admin/setup.php index 5ddcffd25a7..7117deee8e1 100644 --- a/htdocs/bookcal/admin/setup.php +++ b/htdocs/bookcal/admin/setup.php @@ -188,7 +188,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 8493ba2abc9..1f46ee6df1b 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -148,31 +148,45 @@ if ($object->id > 0) { print dol_get_fiche_head($head, 'documents', $langs->trans("Action"), -1, 'action'); - $linkback = img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="hideonsmartphone pictoactionview"'); - $linkback .= ''.$langs->trans("BackToList").''; - // Link to other agenda views - $out = ''; - $out .= '
  • '.img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewPerUser").''; - $out .= '
  • '.img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewCal").''; - $out .= '
  • '.img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewWeek").''; - $out .= '
  • '.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewDay").''; + $linkback .= ''; + $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("BackToList").''; + $linkback .= ''; + $linkback .= '
  • '; + $linkback .= '
  • '; + $linkback .= ''; + $linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("ViewCal").''; + $linkback .= ''; + $linkback .= '
  • '; + $linkback .= '
  • '; + $linkback .= ''; + $linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("ViewWeek").''; + $linkback .= ''; + $linkback .= '
  • '; + $linkback .= '
  • '; + $linkback .= ''; + $linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("ViewDay").''; + $linkback .= ''; + $linkback .= '
  • '; + $linkback .= '
  • '; + $linkback .= ''; + $linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("ViewPerUser").''; + $linkback .= ''; // Add more views from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); if (empty($reshook)) { - $out .= $hookmanager->resPrint; + $linkback .= $hookmanager->resPrint; } elseif ($reshook > 1) { - $out = $hookmanager->resPrint; + $linkback = $hookmanager->resPrint; } - $linkback .= $out; - $morehtmlref = '
    '; // Thirdparty //$morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 9d9baff3c3e..2301e3e329c 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -72,31 +72,45 @@ $object->info($object->id); $head = actions_prepare_head($object); print dol_get_fiche_head($head, 'info', $langs->trans("Action"), -1, 'action'); -$linkback = img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="hideonsmartphone pictoactionview"'); -$linkback .= ''.$langs->trans("BackToList").''; - // Link to other agenda views -$out = ''; -$out .= '
  • '.img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="hideonsmartphone pictoactionview"'); -$out .= ''.$langs->trans("ViewPerUser").''; -$out .= '
  • '.img_picto($langs->trans("ViewCal"), 'object_calendarmonth', 'class="hideonsmartphone pictoactionview"'); -$out .= ''.$langs->trans("ViewCal").''; -$out .= '
  • '.img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone pictoactionview"'); -$out .= ''.$langs->trans("ViewWeek").''; -$out .= '
  • '.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); -$out .= ''.$langs->trans("ViewDay").''; +$linkback .= ''; +$linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); +$linkback .= ''.$langs->trans("BackToList").''; +$linkback .= ''; +$linkback .= '
  • '; +$linkback .= '
  • '; +$linkback .= ''; +$linkback .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictoactionview pictofixedwidth"'); +$linkback .= ''.$langs->trans("ViewCal").''; +$linkback .= ''; +$linkback .= '
  • '; +$linkback .= '
  • '; +$linkback .= ''; +$linkback .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictoactionview pictofixedwidth"'); +$linkback .= ''.$langs->trans("ViewWeek").''; +$linkback .= ''; +$linkback .= '
  • '; +$linkback .= '
  • '; +$linkback .= ''; +$linkback .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictoactionview pictofixedwidth"'); +$linkback .= ''.$langs->trans("ViewDay").''; +$linkback .= ''; +$linkback .= '
  • '; +$linkback .= '
  • '; +$linkback .= ''; +$linkback .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictoactionview pictofixedwidth"'); +$linkback .= ''.$langs->trans("ViewPerUser").''; +$linkback .= ''; // Add more views from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('addCalendarView', $parameters, $object, $action); if (empty($reshook)) { - $out .= $hookmanager->resPrint; + $linkback .= $hookmanager->resPrint; } elseif ($reshook > 1) { - $out = $hookmanager->resPrint; + $linkback = $hookmanager->resPrint; } -$linkback .= $out; - $morehtmlref = '
    '; // Project if (isModEnabled('project')) { diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 4737ff0d9d4..c3b53faccae 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -538,8 +538,8 @@ if ($object->id > 0) { print '
  • "; print ''; diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index fe6c733713b..d2729885b96 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -110,8 +110,8 @@ if ($_socid > 0) { } print '>'.$i; $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$i; - if (!empty($conf->global->$keyforlabel)) { - print ' - '.$langs->trans($conf->global->$keyforlabel); + if (getDolGlobalString($keyforlabel)) { + print ' - '.$langs->trans(getDolGlobalString($keyforlabel)); } print ''; } diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index e702e05ea2c..b8a062c0111 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -281,10 +281,10 @@ if ($resql) { } $transactionspertype[$objp->code] += 1; } else { - if ($conf->global->$var1 == $bankaccount->id) { + if (getDolGlobalString($var1) == $bankaccount->id) { $cash += $objp->amount; - // } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount; - //elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount; + // } elseif (getDolGlobalString($var2) == $bankaccount->id) $bank+=$objp->amount; + //elseif (getDolGlobalString($var3) == $bankaccount->id) $cheque+=$objp->amount; if (empty($transactionspertype['CASH'])) { $transactionspertype['CASH'] = 0; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index b819569d041..ba3707fd1bf 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3925,9 +3925,9 @@ if ($action == 'create') { if (getDolGlobalString('INVOICE_USE_DEFAULT_DOCUMENT')) { // Hidden conf $paramkey = 'FACTURE_ADDON_PDF_'.$object->type; - $preselected = !empty($conf->global->$paramkey) ? $conf->global->$paramkey : $conf->global->FACTURE_ADDON_PDF; + $preselected = getDolGlobalString($paramkey, getDolGlobalString('FACTURE_ADDON_PDF')); } else { - $preselected = $conf->global->FACTURE_ADDON_PDF; + $preselected = getDolGlobalString('FACTURE_ADDON_PDF'); } print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1); print ""; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dad469a8eea..de73c07b98a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1689,10 +1689,10 @@ class Facture extends CommonInvoice $modelByTypeConfName = 'FACTURE_ADDON_PDF_' . $deposit->type; - if (!empty($conf->global->$modelByTypeConfName)) { - $deposit->model_pdf = $conf->global->$modelByTypeConfName; + if (getDolGlobalString($modelByTypeConfName)) { + $deposit->model_pdf = getDolGlobalString($modelByTypeConfName); } elseif (getDolGlobalString('FACTURE_ADDON_PDF')) { - $deposit->model_pdf = $conf->global->FACTURE_ADDON_PDF; + $deposit->model_pdf = getDolGlobalString('FACTURE_ADDON_PDF'); } if (!getDolGlobalString('MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN')) { @@ -3270,7 +3270,7 @@ class Facture extends CommonInvoice // Check for mandatory $keymandatory = 'INVOICE_'.$key.'_MANDATORY_FOR_VALIDATION'; - if (!$vallabel && !empty($conf->global->$keymandatory)) { + if (!$vallabel && getDolGlobalString($keymandatory)) { $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val)), null, 'errors'); @@ -5219,8 +5219,8 @@ class Facture extends CommonInvoice if (!empty($this->model_pdf)) { $modele = $this->model_pdf; - } elseif (!empty($conf->global->$thisTypeConfName)) { - $modele = $conf->global->$thisTypeConfName; + } elseif (getDolGlobalString($thisTypeConfName)) { + $modele = getDolGlobalString($thisTypeConfName); } elseif (getDolGlobalString('FACTURE_ADDON_PDF')) { $modele = $conf->global->FACTURE_ADDON_PDF; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 6e06696b6a1..f9cbe577064 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -111,7 +111,7 @@ if (empty($reshook)) { */ if ($action == 'create' && $permissiontocreate) { $default_account = ($type == 'bank-transfer' ? 'PAYMENTBYBANKTRANSFER_ID_BANKACCOUNT' : 'PRELEVEMENT_ID_BANKACCOUNT'); - //var_dump($default_account);var_dump($conf->global->$default_account);var_dump($id_bankaccount);exit; + //var_dump($default_account);var_dump(getDolGlobalString($default_account));var_dump($id_bankaccount);exit; if ($id_bankaccount != getDolGlobalInt($default_account)) { $res = dolibarr_set_const($db, $default_account, $id_bankaccount, 'chaine', 0, '', $conf->entity); // Set as default diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 8adc3d1f886..754e3eceda3 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -95,7 +95,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { } elseif ($object->fields[$key]['type'] == 'datetime') { $value = dol_mktime(GETPOST($key.'hour', 'int'), GETPOST($key.'min', 'int'), GETPOST($key.'sec', 'int'), GETPOST($key.'month', 'int'), GETPOST($key.'day', 'int'), GETPOST($key.'year', 'int'), 'tzuserrel'); } elseif ($object->fields[$key]['type'] == 'duration') { - $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int'); + $value = 60 * 60 * GETPOSTINT($key.'hour') + 60 * GETPOSTINT($key.'min'); } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'alphanohtml')); // To fix decimal separator according to lang setup } elseif ($object->fields[$key]['type'] == 'boolean') { diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index 2e4c87c8e2b..f8b7e424a0d 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -89,7 +89,7 @@ class box_external_rss extends ModeleBoxes $keyforparamtitle = "EXTERNAL_RSS_TITLE_".$site; // Get RSS feed - $url = $conf->global->$keyforparamurl; + $url = getDolGlobalString($keyforparamurl); $rssparser = new RssParser($this->db); $result = $rssparser->parser($url, $this->max, $cachedelay, $conf->externalrss->dir_temp); @@ -98,7 +98,7 @@ class box_external_rss extends ModeleBoxes $description = $rssparser->getDescription(); $link = $rssparser->getLink(); - $title = $langs->trans("BoxTitleLastRssInfos", $max, $conf->global->$keyforparamtitle); + $title = $langs->trans("BoxTitleLastRssInfos", $max, getDolGlobalString($keyforparamtitle)); if ($result < 0 || !empty($rssparser->error)) { // Show warning $errormessage = $langs->trans("FailedToRefreshDataInfoNotUpToDate", ($rssparser->getLastFetchDate() ? dol_print_date($rssparser->getLastFetchDate(), "dayhourtext") : $langs->trans("Unknown"))); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 5f053ae6e18..f09fb48493d 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -780,12 +780,12 @@ class CMailFile } // Force parameters - //dol_syslog("CMailFile::sendfile conf->global->".$keyforsmtpserver."=".$conf->global->$keyforsmtpserver." cpnf->global->".$keyforsmtpport."=".$conf->global->$keyforsmtpport, LOG_DEBUG); - if (!empty($conf->global->$keyforsmtpserver)) { - ini_set('SMTP', $conf->global->$keyforsmtpserver); + //dol_syslog("CMailFile::sendfile conf->global->".$keyforsmtpserver."=".getDolGlobalString($keyforsmtpserver)." cpnf->global->".$keyforsmtpport."=".$conf->global->$keyforsmtpport, LOG_DEBUG); + if (getDolGlobalString($keyforsmtpserver)) { + ini_set('SMTP', getDolGlobalString($keyforsmtpserver)); } - if (!empty($conf->global->$keyforsmtpport)) { - ini_set('smtp_port', $conf->global->$keyforsmtpport); + if (getDolGlobalString($keyforsmtpport)) { + ini_set('smtp_port', getDolGlobalString($keyforsmtpport)); } $res = true; @@ -869,10 +869,10 @@ class CMailFile } // Restore parameters - if (!empty($conf->global->$keyforsmtpserver)) { + if (getDolGlobalString($keyforsmtpserver)) { ini_restore('SMTP'); } - if (!empty($conf->global->$keyforsmtpport)) { + if (getDolGlobalString($keyforsmtpport)) { ini_restore('smtp_port'); } } elseif ($this->sendmode == 'smtps') { @@ -1059,7 +1059,7 @@ class CMailFile } // If we use SSL/TLS - $server = $conf->global->$keyforsmtpserver; + $server = getDolGlobalString($keyforsmtpserver); $secure = ''; if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) { $secure = 'ssl'; @@ -1068,7 +1068,7 @@ class CMailFile $secure = 'tls'; } - $this->transport = new Swift_SmtpTransport($server, $conf->global->$keyforsmtpport, $secure); + $this->transport = new Swift_SmtpTransport($server, getDolGlobalString($keyforsmtpport), $secure); if (!empty($conf->global->$keyforsmtpid)) { $this->transport->setUsername($conf->global->$keyforsmtpid); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c5914413282..575b3ab2da2 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3659,7 +3659,7 @@ abstract class CommonObject } if (!empty($MODULE)) { - if (!empty($conf->global->$MODULE)) { + if (getDolGlobalString($MODULE)) { $modsactivated = explode(',', getDolGlobalString($MODULE)); foreach ($modsactivated as $mod) { if (isModEnabled($mod)) { @@ -5661,8 +5661,8 @@ abstract class CommonObject // If generator is ODT, we must have srctemplatepath defined, if not we set it. if ($obj->type == 'odt' && empty($srctemplatepath)) { $varfortemplatedir = $obj->scandir; - if ($varfortemplatedir && !empty($conf->global->$varfortemplatedir)) { - $dirtoscan = $conf->global->$varfortemplatedir; + if ($varfortemplatedir && getDolGlobalString($varfortemplatedir)) { + $dirtoscan = getDolGlobalString($varfortemplatedir); $listoffiles = array(); @@ -5970,8 +5970,8 @@ abstract class CommonObject $keyforfieldname = strtoupper($newelement.'_DEFAULT_'.$fieldname); //var_dump($keyforfieldname); - if (isset($conf->global->$keyforfieldname)) { - return $conf->global->$keyforfieldname; + if (getDolGlobalString($keyforfieldname)) { + return getDolGlobalString($keyforfieldname); } // TODO Ad here a scan into table llx_overwrite_default with a filter on $this->element and $fieldname diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index cef35c3ed27..00e4b72d721 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -195,6 +195,7 @@ class DolEditor /* property:xxx is same than CKEDITOR.config.property = xxx */ customConfig: ckeditorConfig, removePlugins: \''.dol_escape_js($pluginstodisable).'\', + versionCheck: false, readOnly: '.($this->readonly ? 'true' : 'false').', htmlEncodeOutput: '.dol_escape_js($htmlencode_force).', allowedContent: '.($disallowAnyContent ? 'false' : 'true').', /* Advanced Content Filter (ACF) is own when allowedContent is false */ diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 92483d49a6b..d0659dc3036 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -185,7 +185,7 @@ class ExtraFields * This is a private method. For public method, use addExtraField. * * @param string $attrname code of attribute - * @param int $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...) + * @param string $type Type of attribute ('boolean', 'int', 'varchar', 'text', 'html', 'date', 'datehour','price','pricecy','phone','mail','password','url','select','checkbox', ...) * @param string $length Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @param int $unique Is field unique or not @@ -199,7 +199,7 @@ class ExtraFields * @param array $moreparams More parameters. Example: array('css'=>, 'csslist'=>, 'cssview'=>...) * @return int Return integer <=0 if KO, >0 if OK */ - private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array()) + private function create($attrname, $type = 'varchar', $length = '255', $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = array(), $perms = '', $list = '0', $computed = '', $help = '', $moreparams = array()) { if ($elementtype == 'thirdparty') { $elementtype = 'societe'; @@ -281,7 +281,7 @@ class ExtraFields * * @param string $attrname code of attribute * @param string $label label of attribute - * @param int $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') + * @param string $type Type of attribute ('int', 'varchar', 'text', 'html', 'date', 'datehour', 'float') * @param int $pos Position of attribute * @param string $size Size/length of attribute ('5', '24,8', ...) * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) @@ -303,7 +303,7 @@ class ExtraFields * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ - private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) + private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = '', $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) { // phpcs:enable global $conf, $user; @@ -551,7 +551,7 @@ class ExtraFields * @return int >0 if OK, <=0 if KO * @throws Exception */ - public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) + public function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) { global $action, $hookmanager; @@ -676,7 +676,7 @@ class ExtraFields * @return int Return integer <=0 if KO, >0 if OK * @throws Exception */ - private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) + private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = array(), $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0, $moreparams = array()) { // phpcs:enable global $conf, $user; @@ -934,7 +934,7 @@ class ExtraFields * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) * @param int $objectid Current object id * @param string $extrafieldsobjectkey The key to use to store retreived data (commonly $object->table_element) - * @param string $mode 1=Used for search filters + * @param int $mode 1=Used for search filters * @return string */ public function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '', $mode = 0) diff --git a/htdocs/core/class/extralanguages.class.php b/htdocs/core/class/extralanguages.class.php index e5a07aa6ac0..b5e05ca04e2 100644 --- a/htdocs/core/class/extralanguages.class.php +++ b/htdocs/core/class/extralanguages.class.php @@ -134,7 +134,7 @@ class ExtraLanguages * @param string $keyprefix Suffix string to add before name and id of field (can be used to avoid duplicate names) * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) * @param int $objectid Current object id - * @param string $mode 1=Used for search filters + * @param int $mode 1=Used for search filters * @return string */ public function showInputField($key, $value, $extrafieldsobjectkey, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $mode = 0) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index caa62050b48..0162ee7de95 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -463,9 +463,9 @@ class Fiscalyear extends CommonObject /** * Return the number of entries by fiscal year * - * @param int $datestart Date start to scan - * @param int $dateend Date end to scan - * @return string Number of entries + * @param int|string $datestart Date start to scan + * @param int|string $dateend Date end to scan + * @return string Number of entries */ public function getAccountancyEntriesByFiscalYear($datestart = '', $dateend = '') { @@ -497,8 +497,8 @@ class Fiscalyear extends CommonObject /** * Return the number of movements by fiscal year * - * @param int $datestart Date start to scan - * @param int $dateend Date end to scan + * @param int|string $datestart Date start to scan + * @param int|string $dateend Date end to scan * @return string Number of movements */ public function getAccountancyMovementsByFiscalYear($datestart = '', $dateend = '') diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index b3e71f4d543..6fd2fbd8249 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -153,7 +153,7 @@ class HookManager * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller. * $this->error or this->errors are also defined by class called by this function if error. */ - public function executeHooks($method, $parameters = array(), &$object = '', &$action = '') + public function executeHooks($method, $parameters = array(), &$object = null, &$action = '') { if (!is_array($this->hooks) || empty($this->hooks)) { return 0; // No hook available, do nothing. diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 6d1a43c7908..cb7d98b04ab 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -49,7 +49,7 @@ class DoliDBMysqli extends DoliDB * Constructor. * This create an opened connexion to a database server and eventually to a database * - * @param string $type Type of database (mysql, pgsql...) + * @param string $type Type of database (mysql, pgsql...). Not used. * @param string $host Address of database server * @param string $user Name of database user * @param string $pass Password of database user diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 12e29d949c3..566cccf332a 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -69,7 +69,7 @@ class DoliDBPgsql extends DoliDB * Constructor. * This create an opened connexion to a database server and eventually to a database * - * @param string $type Type of database (mysql, pgsql...) + * @param string $type Type of database (mysql, pgsql...). Not used. * @param string $host Address of database server * @param string $user Nom de l'utilisateur autorise * @param string $pass Mot de passe diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 41c1c021525..c6eeb736325 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -53,7 +53,7 @@ class DoliDBSqlite3 extends DoliDB * Constructor. * This create an opened connexion to a database server and eventually to a database * - * @param string $type Type of database (mysql, pgsql...) + * @param string $type Type of database (mysql, pgsql...). Not used. * @param string $host Address of database server * @param string $user Nom de l'utilisateur autorise * @param string $pass Mot de passe diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6d8fb1a4b7a..f0c62c0bd5c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -151,7 +151,6 @@ function getMultidirOutput($object, $module = '') function getDolGlobalString($key, $default = '') { global $conf; - // return $conf->global->$key ?? $default; return (string) (isset($conf->global->$key) ? $conf->global->$key : $default); } @@ -166,7 +165,6 @@ function getDolGlobalString($key, $default = '') function getDolGlobalInt($key, $default = 0) { global $conf; - // return $conf->global->$key ?? $default; return (int) (isset($conf->global->$key) ? $conf->global->$key : $default); } @@ -185,7 +183,6 @@ function getDolUserString($key, $default = '', $tmpuser = null) $tmpuser = $user; } - // return $conf->global->$key ?? $default; return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } @@ -204,7 +201,6 @@ function getDolUserInt($key, $default = 0, $tmpuser = null) $tmpuser = $user; } - // return $conf->global->$key ?? $default; return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); } diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 3ff44d56866..906a658b445 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1893,8 +1893,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $const = $obj->description; - //irtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const)); - $dirtoscan = preg_replace('/[\r\n]+/', ',', trim($conf->global->$const)); + $dirtoscan = preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($const))); $listoffiles = array(); diff --git a/htdocs/langs/en_US/mrp.lang b/htdocs/langs/en_US/mrp.lang index 935995ea3ae..948bff00757 100644 --- a/htdocs/langs/en_US/mrp.lang +++ b/htdocs/langs/en_US/mrp.lang @@ -65,6 +65,8 @@ ToProduce=To produce ToObtain=To obtain QtyAlreadyConsumed=Qty already consumed QtyAlreadyProduced=Qty already produced +QtyAlreadyConsumedShort=Qty consumed +QtyAlreadyProducedShort=Qty produced QtyRequiredIfNoLoss=Qty required to produce the quantity defined into the BOM if there is no loss (if the manufacturing efficiency is 100%%) ConsumeOrProduce=Consume or Produce ConsumeAndProduceAll=Consume and Produce All diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 3f62a4006e9..8695b9a9100 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -560,6 +560,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } /* + // Disable / Enable if ($permissiontoadd) { if ($object->status == $object::STATUS_ENABLED) { print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 476abd4ede8..d1d7523acd9 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -1757,19 +1757,18 @@ class Mo extends CommonObject */ public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl', $selectedLines = array()) { - global $langs, $conf; + $productstatic = new Product($this->db); $this->tpl['id'] = $line->id; $this->tpl['label'] = ''; - if (!empty($line->fk_product)) { - $productstatic = new Product($this->db); + if (!empty($line->fk_product) && $line->fk_product > 0) { $productstatic->fetch($line->fk_product); $productstatic->load_virtual_stock(); $this->tpl['label'] .= $productstatic->getNomUrl(1); //$this->tpl['label'].= ' - '.$productstatic->label; } else { - // If origin MRP line is not a product, but another MRP + // If origin MO line is not a product, but another MO // TODO } @@ -1787,8 +1786,8 @@ class Mo extends CommonObject $this->tpl['disable_stock_change'] = $line->disable_stock_change; $this->tpl['efficiency'] = $line->efficiency; - $tpl = DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; - $res = include $tpl; + global $conf; // used into template + $res = include DOL_DOCUMENT_ROOT.'/mrp/tpl/originproductline.tpl.php'; } /** diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 7dcfec9e805..441e0d79bf7 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -428,6 +428,7 @@ if ($action == 'create') { if ($objectbom->id > 0) { print load_fiche_titre($titlelist); + print ''."\n"; print '
    '; print '
    '.$langs->trans("Total").''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($objp->description, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $objp->description); print ''; $text = dolGetFirstLineOfText(dol_string_nohtmltag($facturefourn_static_det->desc, 1)); - $trunclength = !getDolGlobalString('ACCOUNTING_LENGTH_DESCRIPTION') ? 32 : $conf->global->ACCOUNTING_LENGTH_DESCRIPTION; + $trunclength = getDolGlobalInt('ACCOUNTING_LENGTH_DESCRIPTION', 32); print $form->textwithtooltip(dol_trunc($text, $trunclength), $facturefourn_static_det->desc); print ''.$arr['id'].''; $key = 'MAIN_LOGEVENTS_'.$arr['id']; - $value = empty($conf->global->$key) ? '' : $conf->global->$key; + $value = getDolGlobalString($key); print ''; print '
    '; - $value = (isset($conf->global->$constante) ? $conf->global->$constante : 0); + $value = getDolGlobalInt($constante, 0); if ($value == 0) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } elseif ($value == 1) { diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 423b78bc071..6b75e92bfca 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -159,7 +159,7 @@ if ($action == 'update') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } @@ -549,7 +549,7 @@ if ($action == 'edit') { print dolJSToSetRandomPassword($constname, 'generate_token' . $constname); } elseif ($val['type'] == 'product') { if (isModEnabled('product') || isModEnabled('service')) { - $selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); + $selected = getDolGlobalString($constname); $form->select_produits($selected, $constname, '', 0); } } else { diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index ed99e058328..40e92d8270a 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -137,7 +137,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 5e5fd8fb9c0..374685624ba 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -102,7 +102,7 @@ if ($action == 'setvalue' && $user->admin) { $valkey = ''; $key = GETPOST("key"); if ($key) { - $valkey = $conf->global->$key; + $valkey = getDolGlobalString($key); } if (!dolibarr_set_const($db, 'LDAP_KEY_CONTACTS', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 878a6c6029a..36ef3b7ad7c 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -79,7 +79,7 @@ if ($action == 'setvalue' && $user->admin) { $valkey = ''; $key = GETPOST("key"); if ($key) { - $valkey = $conf->global->$key; + $valkey = getDolGlobalString($key); } if (!dolibarr_set_const($db, 'LDAP_KEY_GROUPS', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index f7a4af5d2fd..2047cb983ca 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -147,7 +147,7 @@ if ($action == 'setvalue' && $user->admin) { $valkey = ''; $key = GETPOST("key"); if ($key) { - $valkey = $conf->global->$key; + $valkey = getDolGlobalString($key); } if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 9c7a517bb1f..26af5ba9191 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -73,7 +73,7 @@ if ($action == 'setvalue' && $user->admin) { $valkey = ''; $key = GETPOST("key"); if ($key) { - $valkey = $conf->global->$key; + $valkey = getDolGlobalString($key); } if (!dolibarr_set_const($db, 'LDAP_KEY_MEMBERS_TYPES', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index d2c287aef78..54863009e0d 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -135,7 +135,7 @@ if ($action == 'setvalue' && $user->admin) { $valkey = ''; $key = GETPOST("key"); if ($key) { - $valkey = $conf->global->$key; + $valkey = getDolGlobalString($key); } if (!dolibarr_set_const($db, 'LDAP_KEY_USERS', $valkey, 'chaine', 0, '', $conf->entity)) { $error++; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 78fed9249ea..eb3938ac088 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -851,7 +851,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } // Activate/Disable and Setup (2 columns) - if (!empty($conf->global->$const_name)) { // If module is already activated + if (getDolGlobalString($const_name)) { // If module is already activated // Set $codeenabledisable $disableSetup = 0; if (!empty($arrayofwarnings[$modName])) { diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 78765aae04e..2a401df047e 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -453,7 +453,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { } $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'].'_THRESHOLD_HIGHER_'.$reg[1]; - $value = GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key') ? GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key', 'alpha') : $conf->global->$param; + $value = GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key') ? GETPOST('NOTIF_'.$notifiedevent['code'].'_old_'.$reg[1].'_key', 'alpha') : getDolGlobalString($param); $s = ''; // Do not use type="email" here, we must be able to enter a list of email with , separator. $arrayemail = explode(',', $value); @@ -464,7 +464,7 @@ foreach ($listofnotifiedevents as $notifiedevent) { $showwarning++; } } - if ((!empty($conf->global->$param)) && $showwarning) { + if (getDolGlobalString($param) && $showwarning) { $s .= ' '.img_warning($langs->trans("ErrorBadEMail")); } print $form->textwithpicto($s, $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients").'
    '.$langs->trans("YouCanAlsoUseSupervisorKeyword"), 1, 'help', '', 0, 2); diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 30950eae177..26ee5a374f5 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -367,7 +367,7 @@ for ($i = 1; $i <= 6; $i++) { if ($conf->use_javascript_ajax) { print ajax_constantonoff($keyforconstant); } else { - print $form->selectyesno($keyforconstant, isset($conf->global->$keyforconstant) ? $conf->global->$keyforconstant : 0, 1, $noCountryCode); + print $form->selectyesno($keyforconstant, getDolGlobalString($keyforconstant, 0), 1, $noCountryCode); } print '
    '; $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if ($conf->global->$constforvar == $file) { + if (getDolGlobalString($constforvar) == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { print ''; @@ -589,7 +589,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Default print ''; $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; - if ($conf->global->$constforvar == $name) { + if (getDolGlobalString($constforvar) == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index f5ff8ecea9a..4d7d3965a90 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -315,7 +315,7 @@ foreach ($workflowcodes as $key => $params) { if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff($key); } else { - if (!empty($conf->global->$key)) { + if (getDolGlobalString($key)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index e1a73810eb1..de2e7de2e74 100644 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -120,7 +120,7 @@ if ($action == 'updateMask') { $ret = delDocumentModel($value, $type); if ($ret > 0) { $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 292add085d2..09837376096 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -2037,8 +2037,8 @@ class Setup extends DolibarrApi $xmlremote = $conf->global->MAIN_FILECHECK_URL; } $param = 'MAIN_FILECHECK_URL_'.DOL_VERSION; - if (empty($xmlremote) && !empty($conf->global->$param)) { - $xmlremote = $conf->global->$param; + if (empty($xmlremote) && getDolGlobalString($param)) { + $xmlremote = getDolGlobalString($param); } if (empty($xmlremote)) { $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml'; @@ -2098,7 +2098,7 @@ class Setup extends DolibarrApi // Value found $value = ''; if ($constname && getDolGlobalString($constname) != '') { - $value = $conf->global->$constname; + $value = getDolGlobalString($constname); } $valueforchecksum = (empty($value) ? '0' : $value); diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index a184f667b8e..4232e60e481 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -139,7 +139,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 816ad0190a8..f375004b4a4 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -590,7 +590,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMProductsList'), '', 'product'); - print ' + print ' @@ -642,7 +642,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ($res == 0 && $object->status >= $object::STATUS_VALIDATED) ? '' : load_fiche_titre($langs->trans('BOMServicesList'), '', 'service'); - print ' + print ' diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 035cc7784ed..65e2954c0e3 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -175,7 +175,7 @@ if ($filtertype != 1) { print ''; $coldisplay++; if ($res > 0) { - echo $workstation->getNomUrl(); + echo $workstation->getNomUrl(1); } print ''; print $object->price_level; $keyforlabel = 'PRODUIT_MULTIPRICES_LABEL'.$object->price_level; - if (!empty($conf->global->$keyforlabel)) { - print ' - '.$langs->trans($conf->global->$keyforlabel); + if (getDolGlobalString($keyforlabel)) { + print ' - '.$langs->trans(getDolGlobalString($keyforlabel)); } print "
    '; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 0f2bbd9bce4..9fb66eb916d 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -25,20 +25,20 @@ // Load Dolibarr environment require '../main.inc.php'; - +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; +require_once DOL_DOCUMENT_ROOT.'/mrp/lib/mrp_mo.lib.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; +require_once DOL_DOCUMENT_ROOT.'/workstation/class/workstation.class.php'; -dol_include_once('/bom/class/bom.class.php'); -dol_include_once('/mrp/class/mo.class.php'); -dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page $langs->loadLangs(array("mrp", "stocks", "other", "product", "productbatch")); @@ -848,12 +848,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } // Qty already consumed - print ''; + print ''; // Warehouse print ''; // Unit if ($conf->global->PRODUCT_USE_UNITS) { @@ -1041,24 +1043,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Stock print ''; - // Batch - print ''; + // Batch + /* + print ''; + */ + // Action delete line - print ''; // Action delete line if ($permissiontodelete) { - print ''; + print ''; } print ''; print ''; @@ -1140,11 +1147,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print ' ' . price2num($alreadyconsumed, 'MS'); print ''; - // Warehouse + // Warehouse and/or workstation print ''; // Stock if (isModEnabled('stock')) { @@ -1402,6 +1414,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea });'; } + // Lines to produce print ''; @@ -1448,7 +1461,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } // Already produced - print ''; + print ''; // Warehouse print ''; print ''; // Unit print ''; -print ''; -print ''; print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 87fd2ce60ae..22e4294eead 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -765,7 +765,7 @@ if (getDolGlobalString('PRODUCT_CANVAS_ABILITY')) { $const = "PRODUCT_SPECIAL_".strtoupper($file); - if ($conf->global->$const) { + if (getDolGlobalString($const)) { print img_picto($langs->trans("Active"), 'tick'); print ''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ac36d79fc05..bf930472395 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -6140,7 +6140,7 @@ class Product extends CommonObject } /** - * Return if object is a product + * Return if object is a product. * * @return boolean True if it's a product */ @@ -6159,6 +6159,15 @@ class Product extends CommonObject return ($this->type == Product::TYPE_SERVICE ? true : false); } + /** + * Return if object need to have its stock managed + * + * @return boolean True if it's a service + */ + public function isStockManaged() + { + return ($this->isProduct() || getDolGlobalString('STOCK_SUPPORTS_SERVICES')); + } /** * Return if object have a constraint on mandatory_period @@ -6169,6 +6178,18 @@ class Product extends CommonObject { return ($this->mandatory_period == 1 ? true : false); } + + /** + * Return if object has a sell-by date or eat-by date + * + * @return boolean True if it's has + */ + public function hasbatch() + { + return ($this->status_batch > 0 ? true : false); + } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Get a barcode from the module to generate barcode values. @@ -6211,8 +6232,6 @@ class Product extends CommonObject */ public function initAsSpecimen() { - global $user, $langs, $conf, $mysoc; - $now = dol_now(); // Initialize parameters @@ -6285,17 +6304,6 @@ class Product extends CommonObject } } - /** - * Return if object has a sell-by date or eat-by date - * - * @return boolean True if it's has - */ - public function hasbatch() - { - return ($this->status_batch > 0 ? true : false); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return minimum product recommended price diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index d65d937722f..b458378d1c8 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -402,10 +402,10 @@ if (!getDolUserInt('USER_PUBLIC_HIDE_COMPANY', 0, $object)) { $logosmall = $mysoc->logo_squarred_small ? $mysoc->logo_squarred_small : $mysoc->logo_small; $logo = $mysoc->logo_squarred ? $mysoc->logo_squarred : $mysoc->logo; $paramlogo = 'ONLINE_USER_LOGO_'.$suffix; - if (!empty($conf->global->$paramlogo)) { - $logosmall = $conf->global->$paramlogo; + if (getDolGlobalString($paramlogo)) { + $logosmall = getDolGlobalString($paramlogo); } elseif (getDolGlobalString('ONLINE_USER_LOGO')) { - $logosmall = $conf->global->ONLINE_USER_LOGO; + $logosmall = getDolGlobalString('ONLINE_USER_LOGO'); } //print ''."\n"; // Define urllogo diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index d3f56a73092..02c9ceeb336 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -153,7 +153,7 @@ if ($action == 'updateMask') { $tmpobjectkey = GETPOST('object'); if (!empty($tmpobjectkey)) { $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 9d8e60e44c0..487f39dad84 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -153,7 +153,7 @@ if ($action == 'updateMask') { $ret = delDocumentModel($value, $type); if ($ret > 0) { $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; - if ($conf->global->$constforval == "$value") { + if (getDolGlobalString($constforval) == "$value") { dolibarr_del_const($db, $constforval, $conf->entity); } } diff --git a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php index bc833ed6a7e..133720a1b8c 100644 --- a/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php +++ b/htdocs/recruitment/core/modules/recruitment/doc/doc_generic_recruitmentjobposition_odt.modules.php @@ -341,7 +341,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi // Line of free text $newfreetext = ''; $paramfreetext = 'ORDER_FREE_TEXT'; - if (!empty($conf->global->$paramfreetext)) { + if (getDolGlobalString($paramfreetext)) { $newfreetext = make_substitutions(getDolGlobalString($paramfreetext), $substitutionarray); } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 7018a867e97..75cf03d1bb8 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -333,19 +333,33 @@ if (!$ret) { print dol_get_fiche_head($head, 'resources', $langs->trans("Action"), -1, 'action'); - $linkback = img_picto($langs->trans("BackToList"), 'object_list', 'class="hideonsmartphone pictoactionview"'); - $linkback .= ''.$langs->trans("BackToList").''; + $linkback .= ''; + $linkback .= img_picto($langs->trans("BackToList"), 'object_calendarlist', 'class="pictoactionview pictofixedwidth"'); + $linkback .= ''.$langs->trans("BackToList").''; + $linkback .= ''; // Link to other agenda views $out = ''; - $out .= '
  • '.img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewPerUser").''; - $out .= '
  • '.img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewCal").''; - $out .= '
  • '.img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewWeek").''; - $out .= '
  • '.img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="hideonsmartphone pictoactionview"'); - $out .= ''.$langs->trans("ViewDay").''; + $out .= '
  • '; + $out .= ''; + $out .= img_picto($langs->trans("ViewCal"), 'object_calendar', 'class="pictofixedwidth pictoactionview"'); + $out .= ''.$langs->trans("ViewCal").''; + $out .= ''; + $out .= '
  • '; + $out .= ''; + $out .= img_picto($langs->trans("ViewWeek"), 'object_calendarweek', 'class="pictofixedwidth pictoactionview"'); + $out .= ''.$langs->trans("ViewWeek").''; + $out .= ''; + $out .= '
  • '; + $out .= ''; + $out .= img_picto($langs->trans("ViewDay"), 'object_calendarday', 'class="pictofixedwidth pictoactionview"'); + $out .= ''.$langs->trans("ViewDay").''; + $out .= ''; + $out .= '
  • '; + $out .= ''; + $out .= img_picto($langs->trans("ViewPerUser"), 'object_calendarperuser', 'class="pictofixedwidth pictoactionview"'); + $out .= ''.$langs->trans("ViewPerUser").''; + $out .= ''; // Add more views from hooks $parameters = array(); diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 1934c0358a0..7acf9a45117 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -250,7 +250,7 @@ if (isModEnabled("banque")) { $name = "CASHDESK_ID_BANKACCOUNT_".$modep->code.$terminaltouse; print '
  • '; print ''; // Other attributes - //include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print '
    '.$langs->trans("UnitCost").''.$langs->trans("QtyAlreadyConsumed").''.$form->textwithpicto($langs->trans("QtyAlreadyConsumedShort"), $langs->trans("QtyAlreadyConsumed")).''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { print $langs->trans("Warehouse"); - + if (isModEnabled('workstation')) { + print ' '.$langs->trans("or").' '.$langs->trans("Workstation"); + } // Select warehouse to force it everywhere if (in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { $listwarehouses = $tmpwarehouse->list_array(1); @@ -1024,7 +1026,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; - print ''; + print ''; print ''; - if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { - print img_warning($langs->trans('StockTooLow')).' '; + if ($tmpproduct->isStockManaged()) { + if ($tmpproduct->stock_reel < ($line->qty - $alreadyconsumed)) { + print img_warning($langs->trans('StockTooLow')).' '; + } + print ''. $tmpproduct->stock_reel .' '; } - print ''. $tmpproduct->stock_reel .' '; - print ''; print ''; + print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print '
    '; if (getDolGlobalString('STOCK_CONSUMPTION_FROM_MANUFACTURING_WAREHOUSE') && $tmpwarehouse->id > 0) { print img_picto('', $tmpwarehouse->picto) . " " . $tmpwarehouse->label; } + if (isModEnabled('workstation') && $line->fk_default_workstation > 0) { + $tmpworkstation = new Workstation($db); + $tmpworkstation->fetch($line->fk_default_workstation); + print $tmpworkstation->getNomUrl(1); + } print ''.$langs->trans("QtyAlreadyProduced").''.$form->textwithpicto($langs->trans("QtyAlreadyProducedShort"), $langs->trans("QtyAlreadyProduced")).''; if ($collapse || in_array($action, array('consumeorproduce', 'consumeandproduceall'))) { diff --git a/htdocs/mrp/tpl/originproductline.tpl.php b/htdocs/mrp/tpl/originproductline.tpl.php index 3a9c031a1ae..50eba62dba6 100644 --- a/htdocs/mrp/tpl/originproductline.tpl.php +++ b/htdocs/mrp/tpl/originproductline.tpl.php @@ -22,7 +22,7 @@ if (empty($conf) || !is_object($conf)) { exit; } -global $db; +global $db, $langs; if (!empty($form) && !is_object($form)) { $form = new Form($db); @@ -35,9 +35,13 @@ $qtytoconsumeforline = $this->tpl['qty'] / (!empty($this->tpl['efficiency']) ? $ $qtytoconsumeforline = price2num($qtytoconsumeforline, 'MS'); $tmpproduct = new Product($db); -$tmpproduct->fetch($line->fk_product); +if ($line->fk_product > 0) { + $tmpproduct->fetch($line->fk_product); +} $tmpbom = new BOM($db); -$res = $tmpbom->fetch($line->fk_bom_child); +if ($line->fk_bom_child > 0) { + $res = $tmpbom->fetch($line->fk_bom_child); +} ?> @@ -63,14 +67,20 @@ print ''.$this->tpl['qty'].(($this->tpl['efficiency'] > 0 && $this->tpl['efficiency'] < 1) ? ' / '.$form->textwithpicto($this->tpl['efficiency'], $langs->trans("ValueOfMeansLoss")).' = '.$qtytoconsumeforline : '').''.measuringUnitString($this->tpl['fk_unit'], '', '', 1).''.(empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS')); -if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) { - print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte'])); +print ''; +if ($tmpproduct->isStockManaged()) { + print (empty($this->tpl['stock']) ? 0 : price2num($this->tpl['stock'], 'MS')); + if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['stock'] < $this->tpl['seuil_stock_alerte'])) { + print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte'])); + } } print ''.((empty($this->tpl['virtual_stock']) ? 0 : price2num($this->tpl['virtual_stock'], 'MS'))); -if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['virtual_stock'] < $this->tpl['seuil_stock_alerte'])) { - print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte'])); +print ''; +if ($tmpproduct->isStockManaged()) { + print ((empty($this->tpl['virtual_stock']) ? 0 : price2num($this->tpl['virtual_stock'], 'MS'))); + if ($this->tpl['seuil_stock_alerte'] != '' && ($this->tpl['virtual_stock'] < $this->tpl['seuil_stock_alerte'])) { + print ' '.img_warning($langs->trans("StockLowerThanLimit", $this->tpl['seuil_stock_alerte'])); + } } print ''.($this->tpl['qty_frozen'] ? yn($this->tpl['qty_frozen']) : '').''; print ''.$langs->trans("Disable").''; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 0783ed88269..c25993cac5d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2106,7 +2106,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if (!getDolGlobalString('PRODUCT_DISABLE_PUBLIC_URL')) { print '
    '.$langs->trans("PublicUrl").''; print img_picto('', 'globe', 'class="pictofixedwidth"'); - print ''; + print ''; print '
    '.$langs->trans("CashDeskBankAccountFor").' '.$langs->trans($modep->label).''; - if (!empty($conf->global->$name)) { + if (getDolGlobalString($name)) { $atleastonefound++; } $cour = preg_match('/^LIQ.*/', $modep->code) ? 2 : 1; diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index b3abbe70756..1380c032c86 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -1223,7 +1223,7 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) { $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey)); - if (!empty($conf->global->$constantforkey) && getDolGlobalInt($constantforkey) > 0) { + if (getDolGlobalInt($constantforkey) > 0) { array_push($paiementsModes, $obj); } } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 094c65fdf84..f76069a7d23 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -323,11 +323,11 @@ if (empty($reshook)) { $prod_batch->find(0, '', '', $line->batch, $line->fk_warehouse); $mouvP = new MouvementStock($db); $mouvP->origin = $invoice; - $mouvP->livraison($user, $line->fk_product, $conf->global->$constantforkey, $line->qty, $line->price, 'TakePOS', '', '', '', $prod_batch->batch, $line->batch); + $mouvP->livraison($user, $line->fk_product, getDolGlobalString($constantforkey), $line->qty, $line->price, 'TakePOS', '', '', '', $prod_batch->batch, $line->batch); } else { $mouvP = new MouvementStock($db); $mouvP->origin = $invoice; - $mouvP->livraison($user, $line->fk_product, $conf->global->$constantforkey, $line->qty, $line->price, 'TakePOS', '', '', ''); + $mouvP->livraison($user, $line->fk_product, getDolGlobalString($constantforkey), $line->qty, $line->price, 'TakePOS', '', '', ''); } } } @@ -534,6 +534,7 @@ if (empty($reshook)) { if (!empty($batch)) { $action="setbatch"; } else { + $nbofsuggested = 0; $prod->load_stock('warehouseopen'); $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; if ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch!="") { @@ -561,7 +562,7 @@ if (empty($reshook)) { print ''; $staticwarehouse = new Entrepot($db); if ($warehouse_id > 0) { - $staticwarehouse->fetch($conf->global->$constantforkey); + $staticwarehouse->fetch(getDolGlobalString($constantforkey)); } $detail = ''; $detail .= $langs->trans("LotSerial").': '.$dbatch->batch; diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 5410c6ce42f..c6873a66ec2 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1638,9 +1638,10 @@ maxscreenheightless200 { .clearboth { clear:both; } .hideobject { display: none; } -.minwidth25 { min-width: 25px; } -.minwidth50 { min-width: 50px; } -.minwidth75 { min-width: 75px; } +.minwidth25 { min-width: 25px; } +.minwidth50 { min-width: 50px; } +.minwidth75 { min-width: 75px; } +.nominwidth { min-width: fit-content !important; } /* rule for not too small screen only */ @media only screen and (min-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */ { @@ -3619,7 +3620,7 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { .tabactive, a.tab#active { color: var(--colortextbacktab) !important; - background: var(--colorbacktabcard1) !important; + /* background: var(--colorbacktabcard1) !important; */ margin: 0 0.2em 0 0.2em !important; border-right: 1px solid transparent; diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php index 7ec2e7e4b22..2cae631d25b 100644 --- a/htdocs/theme/eldy/manifest.json.php +++ b/htdocs/theme/eldy/manifest.json.php @@ -73,14 +73,14 @@ $manifest->manifest_version = 3; $manifest->name = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $manifest->name = $conf->global->MAIN_APPLICATION_TITLE; + $manifest->name = getDolGlobalString('MAIN_APPLICATION_TITLE'); } $manifest->short_name = $manifest->name; -$manifest->theme_color = !getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR') ? getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40') : $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR; -$manifest->background_color = !getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR') ? "#ffffff" : $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR; -$manifest->display = "standalone"; +$manifest->theme_color = getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR', getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40')); +$manifest->background_color = getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR', "#ffffff"); +$manifest->display = getDolGlobalString('MAIN_MANIFEST_DISPLAY', "minimal-ui"); $manifest->splash_pages = null; $manifest->icons = array(); $manifest->start_url = constant('DOL_MAIN_URL_ROOT'); diff --git a/htdocs/theme/md/manifest.json.php b/htdocs/theme/md/manifest.json.php index cef3eac9236..dc327ddf9dc 100644 --- a/htdocs/theme/md/manifest.json.php +++ b/htdocs/theme/md/manifest.json.php @@ -72,13 +72,13 @@ $manifest->manifest_version = 3; $manifest->name = constant('DOL_APPLICATION_TITLE'); if (getDolGlobalString('MAIN_APPLICATION_TITLE')) { - $manifest->name = $conf->global->MAIN_APPLICATION_TITLE; + $manifest->name = getDolGlobalString('MAIN_APPLICATION_TITLE'); } $manifest->short_name = $manifest->name; -$manifest->theme_color = !getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR') ? getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40') : $conf->global->MAIN_MANIFEST_APPLI_THEME_COLOR; -$manifest->background_color = !getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR') ? "#ffffff" : $conf->global->MAIN_MANIFEST_APPLI_BG_COLOR; -$manifest->display = "standalone"; +$manifest->theme_color = getDolGlobalString('MAIN_MANIFEST_APPLI_THEME_COLOR', getDolGlobalString('THEME_ELDY_TOPMENU_BACK1', '#F05F40')); +$manifest->background_color = getDolGlobalString('MAIN_MANIFEST_APPLI_BG_COLOR', "#ffffff"); +$manifest->display = getDolGlobalString('MAIN_MANIFEST_DISPLAY', "minimal-ui"); $manifest->splash_pages = null; $manifest->icons = array(); $manifest->start_url = constant('DOL_MAIN_URL_ROOT'); @@ -86,8 +86,8 @@ $manifest->id = constant('DOL_MAIN_URL_ROOT'); if (getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL')) { $icon = new stdClass(); - $icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL; - if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) { + $icon->src = getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL'); + if (getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE')) { $icon->sizes = getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE') . "x" . getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE'); } else { $icon->sizes = "512x512"; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 866343ddee6..19dec5d2392 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1875,6 +1875,7 @@ tr.nobottom td { .minwidth25 { min-width: 25px; } .minwidth50 { min-width: 50px; } .minwidth75 { min-width: 75px; } +.nominwidth { min-width: fit-content !important; } /* rule for not too small screen only */ @media only screen and (min-width: global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) { @@ -4053,7 +4054,7 @@ table.liste, table.noborder, table.formdoc, div.noborder { border-bottom-color: #BBB; border-bottom-style: solid; - margin: 0px 0px 15px 0px; + margin: 0px 0px 20px 0px; -webkit-border-radius: 0.1em; border-radius: 0.1em; diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index a4339f27372..543ded86b6c 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -100,7 +100,7 @@ class Workstation extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'position'=>5, 'notnull'=>1, 'default'=>'1', 'index'=>1), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object", 'csslist'=>'nowraponall'), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'showoncombobox'=>'2',), 'type' => array('type'=>'varchar(8)', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,), @@ -110,9 +110,9 @@ class Workstation extends CommonObject 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>512, 'notnull'=>-1, 'visible'=>-2,), - 'nb_operators_required' => array('type'=>'integer', 'label'=>'NbOperatorsRequired', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1,), - 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right'), - 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right'), + 'nb_operators_required' => array('type'=>'integer', 'label'=>'NbOperatorsRequired', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'), + 'thm_operator_estimated' => array('type'=>'double', 'help'=>'THMOperatorEstimatedHelp','label'=>'THMOperatorEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'), + 'thm_machine_estimated' => array('type'=>'double', 'help'=>'THMMachineEstimatedHelp', 'label'=>'THMMachineEstimated', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>1, 'css'=>'right', 'csslist'=>'maxwidth75imp'), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Disabled', '1'=>'Enabled'),), ); public $rowid; @@ -698,6 +698,49 @@ class Workstation extends CommonObject return $result; } + /** + * Return a thumb for kanban views + * + * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link) + * @param array $arraydata Array of data + * @return string HTML Code for Kanban thumb. + */ + public function getKanbanView($option = '', $arraydata = null) + { + global $conf, $langs; + + $selected = (empty($arraydata['selected']) ? 0 : $arraydata['selected']); + + $return = '
    '; + $return .= '
    '; + $return .= ''; + $return .= img_picto('', $this->picto); + $return .= ''; + $return .= '
    '; + $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; + if ($selected >= 0) { + $return .= ''; + } + if (property_exists($this, 'label')) { + $return .= '
    '.$this->label.'
    '; + } + if (property_exists($this, 'thirdparty') && is_object($this->thirdparty)) { + $return .= '
    '.$this->thirdparty->getNomUrl(1).'
    '; + } + if (property_exists($this, 'amount')) { + $return .= '
    '; + $return .= ''.price($this->amount, 0, $langs, 1, -1, -1, $conf->currency).''; + } + if (method_exists($this, 'getLibStatut')) { + $return .= '
    '.$this->getLibStatut(3).'
    '; + } + $return .= '
    '; + $return .= '
    '; + $return .= '
    '; + + return $return; + } + /** * Return the label of the status * diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 1dc7d42e72a..7d8f2d63eba 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -43,9 +43,16 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'workstationcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); +$backtopagejsfields = GETPOST('backtopagejsfields', 'alpha'); +$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09'); + +if (!empty($backtopagejsfields)) { + $tmpbacktopagejsfields = explode(':', $backtopagejsfields); + $dol_openinpopup = $tmpbacktopagejsfields[0]; +} $groups = GETPOST('groups', 'array:int'); $resources = GETPOST('resources', 'array:int'); @@ -56,7 +63,7 @@ $object = new Workstation($db); //$extrafields = new ExtraFields($db); $diroutputmassaction = $conf->workstation->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('workstationcard', 'globalcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($object->element.'card', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -64,7 +71,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all = GETPOST("search_all", 'alpha'); +$search_all = trim(GETPOST("search_all", 'alpha')); $search = array(); foreach ($object->fields as $key => $val) { if (GETPOST('search_'.$key, 'alpha')) { @@ -156,7 +163,10 @@ $form = new Form($db); $formfile = new FormFile($db); $formresource = new FormResource($db); -$title = $langs->trans("Workstation"); +$title = $langs->trans("Workstation")." - ".$langs->trans('Card'); +if ($action == 'create') { + $title = $langs->trans("NewObject", $langs->transnoentitiesnoconv("Workstation")); +} $help_url = 'EN:Module_Workstation'; llxHeader('', $title, $help_url); @@ -190,10 +200,14 @@ llxHeader('', $title, $help_url); // Part to create if ($action == 'create') { + if (empty($permissiontoadd)) { + accessforbidden('NotEnoughPermissions', 0, 1); + } + // Set default value of the property ref $object->fields['ref']['default'] = $object->getNextNumRef(); - print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Workstation")), '', 'object_'.$object->picto); + print load_fiche_titre($title, '', 'object_'.$object->picto); print ''; print ''; @@ -230,7 +244,7 @@ if ($action == 'create') { print '
    '."\n"; @@ -283,7 +297,7 @@ if (($id || $ref) && $action == 'edit') { print '
    '; @@ -296,16 +310,15 @@ if (($id || $ref) && $action == 'edit') { // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - $res = $object->fetch_optionals(); - $head = workstationPrepareHead($object); + print dol_get_fiche_head($head, 'card', $langs->trans("Workstation"), -1, $object->picto); $formconfirm = ''; - // Confirmation to delete - if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteWorkstation'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); + // Confirmation to delete (using preloaded confirm popup) + if ($action == 'delete' || ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile))) { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteWorkstation'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 'action-delete'); } // Clone confirmation if ($action == 'clone') { @@ -341,38 +354,33 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtmlref = '
    '; /* // Ref customer - $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); - $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); // Thirdparty - $morehtmlref.='
    '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); - // Project - if (isModEnabled('project')) { - $langs->load("projects"); - $morehtmlref .= '
    '.$langs->trans('Project') . ' '; - if ($permissiontoadd) { - //if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' '; - $morehtmlref .= ' : '; - if ($action == 'classify') { - //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 0, 1, '', 'maxwidth300'); - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref .= ''; - $morehtmlref .= ''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1, '', 'maxwidth300'); + $morehtmlref .= '
    '.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
    '; + if ($permissiontoadd) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } } - } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= ': '.$proj->getNomUrl(); - } else { - $morehtmlref .= ''; - } - } - }*/ + */ $morehtmlref .= '
    '; @@ -392,6 +400,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $object->fields['nb_operators_required']['visible'] = 0; } + // Common attributes + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Groups @@ -446,28 +458,31 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($reshook)) { // Modify - if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; - } else { - print ''.$langs->trans('Modify').''."\n"; - } + print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); // Clone if ($permissiontoadd) { - print dolGetButtonAction($langs->trans("ToClone"), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&socid='.$object->socid.'&action=clone&object=workstation', 'clone', $permissiontoadd); + print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd); } // Disable / Enable if ($permissiontoadd) { if ($object->status == $object::STATUS_ENABLED) { - print ''.$langs->trans("Disable").''."\n"; + print dolGetButtonAction('', $langs->trans('Disable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd); } else { - print ''.$langs->trans("Enable").''."\n"; + print dolGetButtonAction('', $langs->trans('Enable'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd); } } - // Delete - print dolGetButtonAction($langs->trans("Delete"), '', 'delete', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(), 'delete', $permissiontodelete); + // Delete (with preloaded confirm popup) + $deleteUrl = $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=delete&token='.newToken(); + $buttonId = 'action-delete-no-ajax'; + if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can use preloaded confirm if not jmobile + $deleteUrl = ''; + $buttonId = 'action-delete'; + } + $params = array(); + print dolGetButtonAction('', $langs->trans("Delete"), 'delete', $deleteUrl, $buttonId, $permissiontodelete, $params); } print ''."\n"; } diff --git a/htdocs/workstation/workstation_list.php b/htdocs/workstation/workstation_list.php index c2339e59c7e..4667af3ac8c 100644 --- a/htdocs/workstation/workstation_list.php +++ b/htdocs/workstation/workstation_list.php @@ -36,18 +36,19 @@ global $conf, $db, $hookmanager, $langs, $user; // Load translation files required by the page $langs->loadLangs(array('mrp', 'other')); -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list -$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'workstationlist'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -84,7 +85,7 @@ if (!$sortorder) { } // Initialize array of search criterias -$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); +$search_all = trim(GETPOST('search_all', 'alphanohtml')); $search = array(); foreach ($object->fields as $key => $val) { @@ -129,7 +130,8 @@ $arrayfields['wug.fk_usergroup'] = array( 'checked'=>(($visible < 0) ? 0 : 1), 'enabled'=>($visible != 3 && dol_eval($val['enabled'], 1)), 'position'=>1000, - 'help' => empty($val['help']) ? '' : $val['help'] + 'help' => empty($val['help']) ? '' : $val['help'], + 'csslist' => 'minwidth100' ); /* disabled because adding resources to workstation seems not yet available in GUI @@ -214,8 +216,8 @@ $formresource = new FormResource($db); $now = dol_now(); -$help_url = 'EN:Module_Workstation'; $title = $langs->trans("Workstations"); +$help_url = 'EN:Module_Workstation'; $morejs = array(); $morecss = array(); @@ -232,9 +234,12 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql = preg_replace('/,\s*$/', '', $sql); + +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)"; @@ -247,10 +252,10 @@ if (!empty($resources)) { } // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; if ($object->ismultientitymanaged == 1) { - $sql .= " WHERE t.entity IN (".getEntity($object->element).")"; + $sql .= " WHERE t.entity IN (".getEntity($object->element, (GETPOST('search_current_entity', 'int') ? 0 : 1)).")"; } else { $sql .= " WHERE 1 = 1"; } @@ -302,7 +307,7 @@ if (!empty($resources)) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql.= " GROUP BY "; @@ -315,7 +320,7 @@ if (! empty($extrafields->attributes[$object->table_element]['label'])) { $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } } -// Add where from hooks +// Add groupby from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; @@ -324,11 +329,19 @@ $sql = preg_replace('/,\s*$/', '', $sql); // Count total nb of records $nbtotalofrecords = ''; if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) { - /* This old and fast method to get and count full list returns all record so use a high amount of memory. */ - $resql = $db->query($sql); - $nbtotalofrecords = $db->num_rows($resql); + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); - if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0 + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -351,10 +364,10 @@ $num = $db->num_rows($resql); // Direct jump if only one record found -if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { +if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; - header("Location: ".DOL_URL_ROOT.'/workstation/workstation_card.php?id='.$id); + header("Location: ".DOL_URL_ROOT.'/workstation/workstation_card.php?id='.((int) $id)); exit; } @@ -376,25 +389,29 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.((int) $limit); } +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} foreach ($search as $key => $val) { - if (is_array($search[$key]) && count($search[$key])) { + if (is_array($search[$key])) { foreach ($search[$key] as $skey) { if ($skey != '') { $param .= '&search_'.$key.'[]='.urlencode($skey); } } + } elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) { + $param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int')); + $param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int')); + $param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int')); } elseif ($search[$key] != '') { $param .= '&search_'.$key.'='.urlencode($search[$key]); } } -if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); -} // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -404,7 +421,7 @@ $arrayofmassactions = array( //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), ); -if ($permissiontodelete) { +if (!empty($permissiontodelete)) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { @@ -423,9 +440,13 @@ print ''; print ''; print ''; print ''; +print ''; print ''; $newcardbutton = ''; +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); +$newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/workstation/workstation_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -438,9 +459,12 @@ $trackid = 'xxxx'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { + $setupstring = ''; foreach ($fieldstosearchall as $key => $val) { $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; } + print ''."\n"; print '
    '.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
    '; } @@ -450,7 +474,7 @@ $moreforfilter.= $langs->trans('MyFilter') . ': '; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print ''; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
    '; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -474,15 +501,16 @@ print ''; +print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; } foreach ($object->fields as $key => $val) { + $searchkey = empty($search[$key]) ? '' : $search[$key]; $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']); if ($key == 'status') { $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -490,15 +518,15 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; } @@ -536,11 +564,11 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; @@ -555,7 +583,7 @@ $totalarray['nbfield'] = 0; print ''; // Action column if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { @@ -566,11 +594,12 @@ foreach ($object->fields as $key => $val) { $cssforfield .= ($cssforfield ? ' ' : '').'center'; } elseif (in_array($val['type'], array('timestamp'))) { $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; - } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { + } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label if (!empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; $totalarray['nbfield']++; } } @@ -589,11 +618,11 @@ if (!empty($arrayfields['wr.fk_resource']['checked'])) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; @@ -614,6 +643,7 @@ if (isset($extrafields->attributes[$object->table_element]['computed']) && is_ar // -------------------------------------------------------------------- $i = 0; $savnbfield = $totalarray['nbfield']; +$totalarray = array(); $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); while ($i < $imaxinloop) { @@ -630,7 +660,7 @@ while ($i < $imaxinloop) { if ($mode == 'kanban') { if ($i == 0) { - print ''; } } else { - // Show here line of result + // Show line of result $j = 0; print ''; // Action column @@ -674,18 +704,22 @@ while ($i < $imaxinloop) { } if (in_array($val['type'], array('timestamp'))) { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } elseif ($key == 'ref') { - $cssforfield .= ($cssforfield ? ' ' : '').'nowrap'; + $cssforfield .= ($cssforfield ? ' ' : '').'nowraponall'; } - if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) { + if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && empty($val['arrayofkeyval'])) { $cssforfield .= ($cssforfield ? ' ' : '').'right'; } //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100'; if (!empty($arrayfields['t.'.$key]['checked'])) { - print ''; + print '$key)) { + print ' title="'.dol_escape_htmltag($object->$key).'"'; + } + print '>'; if ($key == 'status') { print $object->getLibStatut(5); } elseif ($key == 'rowid') { @@ -726,7 +760,7 @@ while ($i < $imaxinloop) { $toprint[] = '
  • ' . $g->getNomUrl(1, '', 0, 'categtextwhite') . '
  • '; } - print '
    '; } @@ -745,7 +779,7 @@ while ($i < $imaxinloop) { $toprint[] = '
  • ' . $r->getNomUrl(1, '', '', 0, 'categtextwhite') . '
  • '; } - print ''; } @@ -754,7 +788,7 @@ while ($i < $imaxinloop) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { @@ -796,7 +830,7 @@ if ($num == 0) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
    '; + print ''; $searchpicto = $form->showFilterButtons('left'); print $searchpicto; print ''; + print ''; if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { - print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1); + print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), 1, 0, 0, '', 1, 0, 0, '', 'maxwidth100'.($key == 'status' ? ' search_status width100 onrightofpage' : ''), 1); } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) { - print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', 'maxwidth125', 1); + print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1); } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { print '
    '; print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); @@ -519,7 +547,7 @@ foreach ($object->fields as $key => $val) { // usergroups if (!empty($arrayfields['wug.fk_usergroup']['checked'])) { - print '
    '; + print ''; print $form->select_dolgroups($groups, 'groups', 1, '', 0, '', '', $conf->entity, true); print ''; + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
    '; + print '
    '; print '
    '; } // Output Kanban @@ -647,7 +677,7 @@ while ($i < $imaxinloop) { print '
    '; + print ''; print '
      ' . implode(' ', $toprint) . '
    '; print '
    '; + print ''; print '
      ' . implode(' ', $toprint) . '
    '; print '
    '."\n"; @@ -821,7 +855,7 @@ if (in_array('builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords $genallowed = $permissiontoread; $delallowed = $permissiontoadd; - print $formfile->showdocuments('massfilesarea_workstation', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); + print $formfile->showdocuments('massfilesarea_'.$object->module, '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } // End of page diff --git a/phpstan.neon b/phpstan.neon index a898f05f524..1562b13e1e2 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -50,27 +50,28 @@ parameters: - '#Undefined variable: \$errors#' - '#Undefined variable: \$form#' - '#has an unused parameter \$param#' - - '#Result of function fieldList#' - - '#Caught class Stripe#' - '#Function llxHeader invoked with#' - '#Function llxHeaderVierge invoked with#' - '#Function llxFooter invoked with#' - '#Function llxFooterVierge invoked with#' - '#If condition is always true#' - '#always exists and is not falsy#' - - '#has no return type specified#' - '#is always true#' - '#is always fal#' + - '#has no return type specified#' - '#always exists and is not nullable#' - '#PHPDoc tag @return has invalid value#' - '#type has no value type specified in iterable type array#' - '#with no value type specified in iterable type array#' - '#Empty array passed to foreach#' + - '#Result of function fieldList#' - '#in isset\(\) is not nullable#' - '#in isset\(\) is never defined#' - '#(\$force_dolibarr_lib|\$dolibarr_main_db).*in empty\(\) is never defined.#' + - '#Caught class Stripe#' - '#Sprain\\SwissQrBill\\#' - '#Constructor of class DolEditor has an unused parameter \$toolbarlocation#' + - '#Constructor of class DoliDB\w+ has an unused parameter $type#' internalErrorsCountLimit: 50 cache: nodesByFileCountMax: 512 diff --git a/scripts/company/sync_contacts_dolibarr2ldap.php b/scripts/company/sync_contacts_dolibarr2ldap.php index c19d6d692df..bdfb856e255 100755 --- a/scripts/company/sync_contacts_dolibarr2ldap.php +++ b/scripts/company/sync_contacts_dolibarr2ldap.php @@ -89,7 +89,7 @@ print "----- To LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN target=" . getDolGlobalString('LDAP_CONTACT_DN')."\n"; print "\n"; @@ -103,8 +103,7 @@ if (!$confirmed) { } /* - * if (! $conf->global->LDAP_CONTACT_ACTIVE) - * { + * if (!getDolGlobalSring('LDAP_CONTACT_ACTIVE')) { * print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); * exit(-1); * } diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index f66df4b011d..24f1529d341 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -248,7 +248,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, } $newlangs = new Translate('', $conf); - $newlangs->setDefaultLang(empty($userlang) ? (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $userlang); + $newlangs->setDefaultLang(empty($userlang) ? getDolGlobalString('MAIN_LANG_DEFAULT', 'auto') : $userlang); $newlangs->load("main"); $newlangs->load("contracts"); @@ -262,26 +262,26 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $title = $newlangs->transnoentities("ListOfServicesToExpire"); } - $subject = (!getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_SUBJECT') ? $title : $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_SUBJECT); + $subject = getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_SUBJECT', $title); $sendto = $oldemail; - $from = $conf->global->MAIN_MAIL_EMAIL_FROM; - $errorsto = $conf->global->MAIN_MAIL_ERRORS_TO; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + $errorsto = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); $msgishtml = -1; print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n"; dol_syslog("email_expire_services_to_customers.php: send mail to ".$oldemail); $usehtml = 0; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER)) { + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER'))) { $usehtml += 1; } - if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER)) { + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER'))) { $usehtml += 1; } $allmessage = ''; if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER; + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_HEADER'); } else { $allmessage .= "Dear customer".($usehtml ? "
    \n" : "\n").($usehtml ? "
    \n" : "\n"); $allmessage .= "Please, find a summary of the services contracted by you that are about to expire.".($usehtml ? "
    \n" : "\n").($usehtml ? "
    \n" : "\n"); @@ -289,8 +289,8 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $allmessage .= $message.($usehtml ? "
    \n" : "\n"); // $allmessage.= $langs->trans("Total")." = ".price($total,0,$userlang,0,0,-1,$conf->currency).($usehtml?"
    \n":"\n"); if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER)) { + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER'); + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_CUSTOMERS_FOOTER'))) { $usehtml += 1; } } diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index 2fb61e73c85..43c46c8a1b4 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -197,7 +197,7 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, } $newlangs = new Translate('', $conf); - $newlangs->setDefaultLang(empty($userlang) ? (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $userlang); + $newlangs->setDefaultLang(empty($userlang) ? getDolGlobalString('MAIN_LANG_DEFAULT', 'auto') : $userlang); $newlangs->load("main"); $newlangs->load("contracts"); @@ -211,26 +211,26 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $title = $newlangs->transnoentities("ListOfServicesToExpire"); } - $subject = (!getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_SUBJECT') ? $title : $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_SUBJECT); + $subject = getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_SUBJECT', $title); $sendto = $oldemail; - $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; - $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + $errorsto = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); $msgishtml = -1; print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n"; dol_syslog("email_expire_services_to_representatives.php: send mail to ".$oldemail); $usehtml = 0; - if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER') && dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER)) { + if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER'))) { $usehtml += 1; } - if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER') && dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER)) { + if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER'))) { $usehtml += 1; } $allmessage = ''; if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER; + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_HEADER'); } else { $allmessage .= $title.($usehtml ? "
    \n" : "\n").($usehtml ? "
    \n" : "\n"); $allmessage .= $newlangs->transnoentities("NoteListOfYourExpiredServices").($usehtml ? "
    \n" : "\n").($usehtml ? "
    \n" : "\n"); @@ -238,8 +238,8 @@ function sendEmailTo($mode, $oldemail, $message, $total, $userlang, $oldtarget, $allmessage .= $message.($usehtml ? "
    \n" : "\n"); $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "
    \n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER)) { + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER'); + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_EXPIRE_SERVICES_SALESREPRESENTATIVES_FOOTER'))) { $usehtml += 1; } } diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 005c05a1de0..3aa4f601bc1 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -101,7 +101,7 @@ if (!isModEnabled('cron')) { } // Check security key -if ($key != $conf->global->CRON_KEY) { +if ($key != getDolGlobalString('CRON_KEY')) { print "Error: securitykey is wrong\n"; exit(-1); } @@ -142,7 +142,7 @@ if ($result < 0) { } // Reload langs -$langcode = (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT); +$langcode = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'); if (!empty($user->conf->MAIN_LANG_DEFAULT)) { $langcode = $user->conf->MAIN_LANG_DEFAULT; } @@ -224,7 +224,7 @@ if (is_array($object->lines) && (count($object->lines) > 0)) { } // Reload langs - $langcode = (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT); + $langcode = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'); if (!empty($user->conf->MAIN_LANG_DEFAULT)) { $langcode = $user->conf->MAIN_LANG_DEFAULT; } diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index d24b3dfcd15..0e6d655468e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -86,8 +86,8 @@ if (!isModEnabled('mailing')) { @set_time_limit(0); print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; -if (getDolGlobalString('MAILING_DELAY')) { - print 'A delay of '.((float) $conf->global->MAILING_DELAY).' seconds has been set between each email'."\n"; +if (getDolGlobalInt('MAILING_DELAY')) { + print 'A delay of '.((float) getDolGlobalInt('MAILING_DELAY')).' seconds has been set between each email'."\n"; } if (getDolGlobalString('MAILING_LIMIT_SENDBYCLI') == '-1') { @@ -153,7 +153,7 @@ if ($resql) { if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) { $sql2 .= " LIMIT " . getDolGlobalString('MAILING_LIMIT_SENDBYCLI'); } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) { - $sql2 .= " LIMIT ".min($conf->global->MAILING_LIMIT_SENDBYCLI, $max); + $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max); } elseif ($max > 0) { $sql2 .= " LIMIT ".((int) $max); } @@ -383,8 +383,8 @@ if ($resql) { } } - if (getDolGlobalString('MAILING_DELAY')) { - usleep((float) $conf->global->MAILING_DELAY * 1000000); + if (getDolGlobalInt('MAILING_DELAY')) { + usleep((float) getDolGlobalInt('MAILING_DELAY') * 1000000); } } } else { diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 6d51a2bd24a..2a5a199db4d 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -250,24 +250,24 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) } $newlangs = new Translate('', $conf); - $newlangs->setDefaultLang(empty($userlang) ? (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $userlang); + $newlangs->setDefaultLang(empty($userlang) ? getDolGlobalString('MAIN_LANG_DEFAULT', 'auto') : $userlang); $newlangs->load("main"); $newlangs->load("bills"); - $subject = (!getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT') ? $newlangs->trans("ListOfYourUnpaidInvoices") : $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT); + $subject = getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_SUBJECT', $newlangs->trans("ListOfYourUnpaidInvoices")); $sendto = $oldemail; - $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; - $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + $errorsto = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); $msgishtml = -1; print "- Send email to '".$oldtarget."' (".$oldemail."), total: ".$total."\n"; dol_syslog("email_unpaid_invoices_to_customers.php: send mail to ".$oldemail); $usehtml = 0; - if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER') && dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) { + if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER'))) { $usehtml += 1; } - if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER') && dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER)) { + if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_HEADER'))) { $usehtml += 1; } @@ -282,8 +282,8 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $allmessage .= $message.($usehtml ? "
    \n" : "\n"); $allmessage .= $langs->trans("Total")." = ".price($total, 0, $userlang, 0, 0, -1, $conf->currency).($usehtml ? "
    \n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER)) { + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER'); + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_CUSTOMERS_FOOTER'))) { $usehtml += 1; } } diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 058966e6a2b..e5da2436d67 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -206,30 +206,30 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) } $newlangs = new Translate('', $conf); - $newlangs->setDefaultLang(empty($userlang) ? (!getDolGlobalString('MAIN_LANG_DEFAULT') ? 'auto' : $conf->global->MAIN_LANG_DEFAULT) : $userlang); + $newlangs->setDefaultLang(empty($userlang) ? getDolGlobalString('MAIN_LANG_DEFAULT', 'auto') : $userlang); $newlangs->load("main"); $newlangs->load("bills"); - $subject = (!getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_SUBJECT') ? $newlangs->trans("ListOfYourUnpaidInvoices") : $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_SUBJECT); + $subject = getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_SUBJECT', $newlangs->trans("ListOfYourUnpaidInvoices")); $sendto = $oldemail; - $from = !getDolGlobalString('MAIN_MAIL_EMAIL_FROM') ? '' : $conf->global->MAIN_MAIL_EMAIL_FROM; - $errorsto = !getDolGlobalString('MAIN_MAIL_ERRORS_TO') ? '' : $conf->global->MAIN_MAIL_ERRORS_TO; + $from = getDolGlobalString('MAIN_MAIL_EMAIL_FROM'); + $errorsto = getDolGlobalString('MAIN_MAIL_ERRORS_TO'); $msgishtml = -1; print "- Send email for ".$oldtarget." (".$oldemail."), total: ".$total."\n"; dol_syslog("email_unpaid_invoices_to_representatives.php: send mail to ".$oldemail); $usehtml = 0; - if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER') && dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) { + if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER'))) { $usehtml += 1; } - if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER') && dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER)) { + if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER') && dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER'))) { $usehtml += 1; } $allmessage = ''; if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER; + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_HEADER'); } else { $allmessage .= $newlangs->transnoentities("ListOfYourUnpaidInvoices").($usehtml ? "
    \n" : "\n").($usehtml ? "
    \n" : "\n"); $allmessage .= $newlangs->transnoentities("NoteListOfYourUnpaidInvoices").($usehtml ? "
    \n" : "\n"); @@ -237,8 +237,8 @@ function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) $allmessage .= $message.($usehtml ? "
    \n" : "\n"); $allmessage .= $langs->trans("Total")." = ".price($total, 0, $newlangs, 0, 0, -1, $conf->currency).($usehtml ? "
    \n" : "\n"); if (getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER')) { - $allmessage .= $conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER; - if (dol_textishtml($conf->global->SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER)) { + $allmessage .= getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER'); + if (dol_textishtml(getDolGlobalString('SCRIPT_EMAIL_UNPAID_INVOICES_SALESREPRESENTATIVES_FOOTER'))) { $usehtml += 1; } } diff --git a/scripts/members/sync_members_dolibarr2ldap.php b/scripts/members/sync_members_dolibarr2ldap.php index dbeef136368..ae01a088393 100755 --- a/scripts/members/sync_members_dolibarr2ldap.php +++ b/scripts/members/sync_members_dolibarr2ldap.php @@ -90,7 +90,7 @@ print "----- To LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN target=" . getDolGlobalString('LDAP_MEMBER_DN')."\n"; print "\n"; @@ -104,8 +104,7 @@ if (!$confirmed) { } /* - * if (! $conf->global->LDAP_MEMBER_ACTIVE) - * { + * if (getDolGlobalString('LDAP_MEMBER_ACTIVE') { * print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); * exit(-1); * } diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index d0496c9d7c0..90dd86b0ad6 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -118,7 +118,7 @@ print "----- Synchronize all records from LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN to extract=" . getDolGlobalString('LDAP_MEMBER_DN')."\n"; if (getDolGlobalString('LDAP_MEMBER_FILTER')) { print 'Filter=(' . getDolGlobalString('LDAP_MEMBER_FILTER').')'."\n"; // Note: filter is defined into function getRecords @@ -192,7 +192,7 @@ if ($result >= 0) { // We disable synchro Dolibarr-LDAP $conf->global->LDAP_MEMBER_ACTIVE = 0; - $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_MEMBER_DN, $conf->global->LDAP_KEY_MEMBERS, $required_fields, 'member'); // Fiter on 'member' filter param + $ldaprecords = $ldap->getRecords('*', getDolGlobalString('LDAP_MEMBER_DN'), getDolGlobalString('LDAP_KEY_MEMBERS'), $required_fields, 'member'); // Fiter on 'member' filter param if (is_array($ldaprecords)) { $db->begin(); @@ -253,16 +253,16 @@ if ($result >= 0) { // print_r($member); $datefirst = ''; - if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE) { + if (getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')) { $datefirst = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE')]); $pricefirst = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT')]); } $datelast = ''; - if ($conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE) { + if (getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE')) { $datelast = dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE')]); $pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]); - } elseif ($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) { + } elseif (getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')) { $datelast = dol_time_plus_duree(dol_stringtotime($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION')]), -1, 'y') + 60 * 60 * 24; $pricelast = price2num($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT')]); diff --git a/scripts/members/sync_members_types_dolibarr2ldap.php b/scripts/members/sync_members_types_dolibarr2ldap.php index 3ec2c9d0d90..5fd145e0926 100755 --- a/scripts/members/sync_members_types_dolibarr2ldap.php +++ b/scripts/members/sync_members_types_dolibarr2ldap.php @@ -63,8 +63,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); /* - * if (! $conf->global->LDAP_SYNCHRO_ACTIVE) - * { + * if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) { * print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); * exit(-1); * } diff --git a/scripts/members/sync_members_types_ldap2dolibarr.php b/scripts/members/sync_members_types_ldap2dolibarr.php index a31d5a3c30c..8d4624bbc55 100755 --- a/scripts/members/sync_members_types_ldap2dolibarr.php +++ b/scripts/members/sync_members_types_ldap2dolibarr.php @@ -62,7 +62,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); // List of fields to get from LDAP -$required_fields = array($conf->global->LDAP_KEY_MEMBERS_TYPES, $conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME, $conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION, $conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS); +$required_fields = array(getDolGlobalString('LDAP_KEY_MEMBERS_TYPES'), getDolGlobalString('LDAP_MEMBER_TYPE_FIELD_FULLNAME'), getDolGlobalString('LDAP_MEMBER_TYPE_FIELD_DESCRIPTION'), getDolGlobalString('LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS')); // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields = array_unique(array_values(array_filter($required_fields, "dolValidElementType"))); @@ -100,7 +100,7 @@ print "----- Synchronize all records from LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN to extract=" . getDolGlobalString('LDAP_MEMBER_TYPE_DN')."\n"; print 'Filter=(' . getDolGlobalString('LDAP_KEY_MEMBERS_TYPES').'=*)'."\n"; print "----- To Dolibarr database:\n"; @@ -132,7 +132,7 @@ if ($result >= 0) { // We disable synchro Dolibarr-LDAP $conf->global->LDAP_MEMBER_TYPE_ACTIVE = 0; - $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_MEMBER_TYPE_DN, $conf->global->LDAP_KEY_MEMBERS_TYPES, $required_fields, 0, array($conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)); + $ldaprecords = $ldap->getRecords('*', getDolGlobalString('LDAP_MEMBER_TYPE_DN'), getDolGlobalString('LDAP_KEY_MEMBERS_TYPES'), $required_fields, 0, array(getDolGlobalString('LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS'))); if (is_array($ldaprecords)) { $db->begin(); diff --git a/scripts/user/sync_groups_dolibarr2ldap.php b/scripts/user/sync_groups_dolibarr2ldap.php index 7d9ed2f307e..2c37c96dd4e 100755 --- a/scripts/user/sync_groups_dolibarr2ldap.php +++ b/scripts/user/sync_groups_dolibarr2ldap.php @@ -61,8 +61,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); /* - * if (! $conf->global->LDAP_SYNCHRO_ACTIVE) - * { + * if (getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) { * print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); * exit(-1); * } diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index fd718d132d0..88d39ea2cd5 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -62,7 +62,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); // List of fields to get from LDAP -$required_fields = array($conf->global->LDAP_KEY_GROUPS, $conf->global->LDAP_GROUP_FIELD_FULLNAME, $conf->global->LDAP_GROUP_FIELD_DESCRIPTION, $conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS); +$required_fields = array(getDolGlobalString('LDAP_KEY_GROUPS'), getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME'), getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION'), getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS')); // Remove from required_fields all entries not configured in LDAP (empty) and duplicated $required_fields = array_unique(array_values(array_filter($required_fields, "dolValidElement"))); @@ -95,7 +95,7 @@ print "----- Synchronize all records from LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN to extract=" . getDolGlobalString('LDAP_GROUP_DN')."\n"; if (getDolGlobalString('LDAP_GROUP_FILTER')) { print 'Filter=(' . getDolGlobalString('LDAP_GROUP_FILTER').')'."\n"; // Note: filter is defined into function getRecords @@ -131,7 +131,7 @@ if ($result >= 0) { // We disable synchro Dolibarr-LDAP $conf->global->LDAP_SYNCHRO_ACTIVE = 0; - $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_GROUP_DN, $conf->global->LDAP_KEY_GROUPS, $required_fields, 'group', array($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)); + $ldaprecords = $ldap->getRecords('*', getDolGlobalString('LDAP_GROUP_DN'), getDolGlobalString('LDAP_KEY_GROUPS'), $required_fields, 'group', array(getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS'))); if (is_array($ldaprecords)) { $db->begin(); diff --git a/scripts/user/sync_users_dolibarr2ldap.php b/scripts/user/sync_users_dolibarr2ldap.php index abe0b9fbcf4..6ecad166ca1 100755 --- a/scripts/user/sync_users_dolibarr2ldap.php +++ b/scripts/user/sync_users_dolibarr2ldap.php @@ -61,8 +61,7 @@ print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n"; dol_syslog($script_file." launched with arg ".join(',', $argv)); /* - * if (! $conf->global->LDAP_SYNCHRO_ACTIVE) - * { + * if (! getDolGlobalString('LDAP_SYNCHRO_ACTIVE')) { * print $langs->trans("LDAPSynchronizationNotSetupInDolibarr"); * exit(-1); * } diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 98c6a3b5519..34e0c0b4382 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -113,7 +113,7 @@ print "----- Synchronize all records from LDAP database:\n"; print "host=" . getDolGlobalString('LDAP_SERVER_HOST')."\n"; print "port=" . getDolGlobalString('LDAP_SERVER_PORT')."\n"; print "login=" . getDolGlobalString('LDAP_ADMIN_DN')."\n"; -print "pass=".preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)."\n"; +print "pass=".preg_replace('/./i', '*', getDolGlobalString('LDAP_ADMIN_PASS'))."\n"; print "DN to extract=" . getDolGlobalString('LDAP_USER_DN')."\n"; if (getDolGlobalString('LDAP_FILTER_CONNECTION')) { print 'Filter=(' . getDolGlobalString('LDAP_FILTER_CONNECTION').')'."\n"; // Note: filter is defined into function getRecords @@ -177,7 +177,7 @@ if ($result >= 0) { // We disable synchro Dolibarr-LDAP $conf->global->LDAP_SYNCHRO_ACTIVE = 0; - $ldaprecords = $ldap->getRecords('*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 'user'); // Fiter on 'user' filter param + $ldaprecords = $ldap->getRecords('*', getDolGlobalString('LDAP_USER_DN'), getDolGlobalString('LDAP_KEY_USERS'), $required_fields, 'user'); // Fiter on 'user' filter param if (is_array($ldaprecords)) { $db->begin(); @@ -191,9 +191,9 @@ if ($result >= 0) { $fuser = new User($db); - if ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { + if (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_SID')) { $fuser->fetch('', '', $ldapuser[getDolGlobalString('LDAP_KEY_USERS')]); // Chargement du user concerné par le SID - } elseif ($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { + } elseif (getDolGlobalString('LDAP_KEY_USERS') == getDolGlobalString('LDAP_FIELD_LOGIN')) { $fuser->fetch('', $ldapuser[getDolGlobalString('LDAP_KEY_USERS')]); // Chargement du user concerné par le login } @@ -206,10 +206,10 @@ if ($result >= 0) { // $user->societe; /* - * $fuser->address=$ldapuser[$conf->global->LDAP_FIELD_ADDRESS]; - * $fuser->zip=$ldapuser[$conf->global->LDAP_FIELD_ZIP]; - * $fuser->town=$ldapuser[$conf->global->LDAP_FIELD_TOWN]; - * $fuser->country=$ldapuser[$conf->global->LDAP_FIELD_COUNTRY]; + * $fuser->address=$ldapuser[getDolGlobalString('LDAP_FIELD_ADDRESS')]; + * $fuser->zip=$ldapuser[getDolGlobalString('LDAP_FIELD_ZIP')]; + * $fuser->town=$ldapuser[getDolGlobalString('LDAP_FIELD_TOWN')]; + * $fuser->country=$ldapuser[getDolGlobalString('LDAP_FIELD_COUNTRY')]; * $fuser->country_id=$countries[$hashlib2rowid[strtolower($fuser->country)]]['rowid']; * $fuser->country_code=$countries[$hashlib2rowid[strtolower($fuser->country)]]['code']; */ @@ -230,11 +230,10 @@ if ($result >= 0) { $fuser->statut = 1; // TODO : revoir la gestion du status /* - * if (isset($ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS])) - * { + * if (isset($ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')])) { * $fuser->datec=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); * $fuser->datevalid=dol_stringtotime($ldapuser[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE]); - * $fuser->statut=$ldapuser[$conf->global->LDAP_FIELD_MEMBER_STATUS]; + * $fuser->statut=$ldapuser[getDolGlobalString('LDAP_FIELD_MEMBER_STATUS')]; * } */ // if ($fuser->statut > 1) $fuser->statut=1; @@ -269,7 +268,7 @@ if ($result >= 0) { // TODO : revoir la gestion des groupes (ou script de sync groupes) /* * if(!$error) { - * foreach ($ldapuser[$conf->global->LDAP_FIELD_USERGROUPS] as $groupdn) { + * foreach ($ldapuser[getDolGlobalString('LDAP_FIELD_USERGROUPS') as $groupdn) { * $groupdn; * } * } diff --git a/scripts/withdrawals/build_withdrawal_file.php b/scripts/withdrawals/build_withdrawal_file.php index 0375d6cc631..e6b99c51369 100755 --- a/scripts/withdrawals/build_withdrawal_file.php +++ b/scripts/withdrawals/build_withdrawal_file.php @@ -61,7 +61,7 @@ $month = dol_print_date($datetimeprev, "%m"); $year = dol_print_date($datetimeprev, "%Y"); $user = new User($db); -$user->fetch($conf->global->PRELEVEMENT_USER); +$user->fetch(getDolGlobalString('PRELEVEMENT_USER')); if (!isset($argv[1])) { // Check parameters print "This script check invoices with a withdrawal request and\n"; @@ -71,8 +71,7 @@ if (!isset($argv[1])) { // Check parameters } $withdrawreceipt = new BonPrelevement($db); -// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty -$result = $withdrawreceipt->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $argv[1]); +$result = $withdrawreceipt->create(getDolGlobalString('PRELEVEMENT_CODE_BANQUE'), getDolGlobalString('PRELEVEMENT_CODE_GUICHET'), $argv[1]); $db->close();