Merge pull request #19156 from frederic34/defaultvaluegetglobal
can specify default in getDolGlobalString and getDolGlobalInt
This commit is contained in:
commit
e12d9ee979
@ -38,6 +38,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
|||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$massaction = GETPOST('massaction', 'aZ09');
|
$massaction = GETPOST('massaction', 'aZ09');
|
||||||
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingaccountlist'; // To manage different context of search
|
||||||
|
|
||||||
$search_account = GETPOST('search_account', 'alpha');
|
$search_account = GETPOST('search_account', 'alpha');
|
||||||
|
|||||||
@ -70,6 +70,7 @@ $search_onpurchase = GETPOST('search_onpurchase', 'alpha');
|
|||||||
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
$accounting_product_mode = GETPOST('accounting_product_mode', 'alpha');
|
||||||
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
$btn_changeaccount = GETPOST('changeaccount', 'alpha');
|
||||||
$btn_changetype = GETPOST('changetype', 'alpha');
|
$btn_changetype = GETPOST('changetype', 'alpha');
|
||||||
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
|
|
||||||
if (empty($accounting_product_mode)) {
|
if (empty($accounting_product_mode)) {
|
||||||
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
$accounting_product_mode = 'ACCOUNTANCY_SELL';
|
||||||
@ -266,18 +267,18 @@ $aarowid_prodsell = $accounting->fetch('', getDolGlobalString('ACCOUNT
|
|||||||
$aarowid_prodsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT'), 1);
|
$aarowid_prodsell_intra = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT'), 1);
|
||||||
$aarowid_prodsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT'), 1);
|
$aarowid_prodsell_export = $accounting->fetch('', getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT'), 1);
|
||||||
|
|
||||||
$aacompta_servbuy = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servbuy = getDolGlobalString('ACCOUNTING_SERVICE_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_servbuy_intra = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servbuy_intra = getDolGlobalString('ACCOUNTING_SERVICE_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_servbuy_export = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servbuy_export = getDolGlobalString('ACCOUNTING_SERVICE_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodbuy = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodbuy = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodbuy_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodbuy_intra = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodbuy_export = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodbuy_export = getDolGlobalString('ACCOUNTING_PRODUCT_BUY_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_servsell = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servsell = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_servsell_intra = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servsell_intra = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_servsell_export = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_servsell_export = getDolGlobalString('ACCOUNTING_SERVICE_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodsell = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodsell = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodsell_intra = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodsell_intra = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
$aacompta_prodsell_export = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT : $langs->trans("CodeNotDef"));
|
$aacompta_prodsell_export = getDolGlobalString('ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', $langs->trans("CodeNotDef"));
|
||||||
|
|
||||||
llxHeader('', $langs->trans("ProductsBinding"));
|
llxHeader('', $langs->trans("ProductsBinding"));
|
||||||
|
|
||||||
|
|||||||
@ -36,6 +36,7 @@ $cancel = GETPOST('cancel', 'alpha');
|
|||||||
$id = GETPOST('id', 'int');
|
$id = GETPOST('id', 'int');
|
||||||
$rowid = GETPOST('rowid', 'int');
|
$rowid = GETPOST('rowid', 'int');
|
||||||
$massaction = GETPOST('massaction', 'aZ09');
|
$massaction = GETPOST('massaction', 'aZ09');
|
||||||
|
$optioncss = GETPOST('optioncss', 'alpha');
|
||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'accountingsubaccountlist'; // To manage different context of search
|
||||||
|
|
||||||
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
$search_subaccount = GETPOST('search_subaccount', 'alpha');
|
||||||
@ -367,6 +368,7 @@ if ($resql) {
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$totalarray = array();
|
$totalarray = array();
|
||||||
|
$totalarray['nbfield'] = 0;
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < min($num, $limit)) {
|
while ($i < min($num, $limit)) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
|
|||||||
@ -44,25 +44,27 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
|||||||
/**
|
/**
|
||||||
* Return dolibarr global constant string value
|
* Return dolibarr global constant string value
|
||||||
* @param string $key key to return value, return '' if not set
|
* @param string $key key to return value, return '' if not set
|
||||||
|
* @param string $default value to return
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getDolGlobalString($key)
|
function getDolGlobalString($key, $default = '')
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
// return $conf->global->$key ?? '';
|
// return $conf->global->$key ?? $default;
|
||||||
return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
|
return (string) (empty($conf->global->$key) ? $default : $conf->global->$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return dolibarr global constant int value
|
* Return dolibarr global constant int value
|
||||||
* @param string $key key to return value, return 0 if not set
|
* @param string $key key to return value, return 0 if not set
|
||||||
|
* @param int $default value to return
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getDolGlobalInt($key)
|
function getDolGlobalInt($key, $default = 0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
// return $conf->global->$key ?? 0;
|
// return $conf->global->$key ?? $default;
|
||||||
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
|
return (int) (empty($conf->global->$key) ? $default : $conf->global->$key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user