2
0
forked from Wavyzz/dolibarr

Fix warnings

This commit is contained in:
Laurent Destailleur
2023-12-23 19:47:10 +01:00
parent 7bb32a04b4
commit 07f4c9b335
16 changed files with 24 additions and 24 deletions

View File

@@ -154,7 +154,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'EVENTORGANIZATION_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }
@@ -279,7 +279,7 @@ if ($action == 'edit') {
print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
} elseif ($val['type'] == 'product') { } elseif ($val['type'] == 'product') {
if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("product") || isModEnabled("service")) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); $selected = getDolGlobalString($constname);
$form->select_produits($selected, $constname, '', 0); $form->select_produits($selected, $constname, '', 0);
} }
} else { } else {

View File

@@ -173,7 +173,7 @@ if (empty($conf->use_javascript_ajax)) {
} }
print '</td>'; print '</td>';
print '<td class="center centpercent width100">'; print '<td class="center centpercent width100">';
$value = (isset($conf->global->$constante) ? $conf->global->$constante : 0); $value = getDolGlobalInt($constante, 0);
if ($value == 0) { if ($value == 0) {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=enable_'.strtolower($const).'&token='.newToken().'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} elseif ($value == 1) { } elseif ($value == 1) {

View File

@@ -159,7 +159,7 @@ if ($action == 'update') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'HRMTEST_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }
@@ -549,7 +549,7 @@ if ($action == 'edit') {
print dolJSToSetRandomPassword($constname, 'generate_token' . $constname); print dolJSToSetRandomPassword($constname, 'generate_token' . $constname);
} elseif ($val['type'] == 'product') { } elseif ($val['type'] == 'product') {
if (isModEnabled('product') || isModEnabled('service')) { if (isModEnabled('product') || isModEnabled('service')) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); $selected = getDolGlobalString($constname);
$form->select_produits($selected, $constname, '', 0); $form->select_produits($selected, $constname, '', 0);
} }
} else { } else {

View File

@@ -137,7 +137,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'KNOWLEDGEMANAGEMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -851,7 +851,7 @@ if ($mode == 'common' || $mode == 'commonkanban') {
} }
// Activate/Disable and Setup (2 columns) // 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 // Set $codeenabledisable
$disableSetup = 0; $disableSetup = 0;
if (!empty($arrayofwarnings[$modName])) { if (!empty($arrayofwarnings[$modName])) {

View File

@@ -142,7 +142,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'WEBHOOK_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }
@@ -270,7 +270,7 @@ if ($action == 'edit') {
print dolJSToSetRandomPassword($constname, 'generate_token'.$constname); print dolJSToSetRandomPassword($constname, 'generate_token'.$constname);
} elseif ($val['type'] == 'product') { } elseif ($val['type'] == 'product') {
if (isModEnabled("product") || isModEnabled("service")) { if (isModEnabled("product") || isModEnabled("service")) {
$selected = (empty($conf->global->$constname) ? '' : $conf->global->$constname); $selected = getDolGlobalString($constname);
$form->select_produits($selected, $constname, '', 0); $form->select_produits($selected, $constname, '', 0);
} }
} else { } else {
@@ -447,7 +447,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '<td class="center">'; print '<td class="center">';
$constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $file) { if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} else { } else {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
@@ -589,7 +589,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default // Default
print '<td class="center">'; print '<td class="center">';
$constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON'; $constforvar = 'WEBHOOK_'.strtoupper($myTmpObjectKey).'_ADDON';
if ($conf->global->$constforvar == $name) { if (getDolGlobalString($constforvar) == $name) {
//print img_picto($langs->trans("Default"), 'on'); //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 // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';

View File

@@ -120,7 +120,7 @@ if ($action == 'updateMask') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -2098,7 +2098,7 @@ class Setup extends DolibarrApi
// Value found // Value found
$value = ''; $value = '';
if ($constname && getDolGlobalString($constname) != '') { if ($constname && getDolGlobalString($constname) != '') {
$value = $conf->global->$constname; $value = getDolGlobalString($constname);
} }
$valueforchecksum = (empty($value) ? '0' : $value); $valueforchecksum = (empty($value) ? '0' : $value);

View File

@@ -139,7 +139,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'ASSET_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -188,7 +188,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'BOOKCAL_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -1893,8 +1893,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0)
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$const = $obj->description; $const = $obj->description;
//irtoscan.=($dirtoscan?',':'').preg_replace('/[\r\n]+/',',',trim($conf->global->$const)); $dirtoscan = preg_replace('/[\r\n]+/', ',', trim(getDolGlobalString($const)));
$dirtoscan = preg_replace('/[\r\n]+/', ',', trim($conf->global->$const));
$listoffiles = array(); $listoffiles = array();

View File

@@ -765,7 +765,7 @@ if (getDolGlobalString('PRODUCT_CANVAS_ABILITY')) {
$const = "PRODUCT_SPECIAL_".strtoupper($file); $const = "PRODUCT_SPECIAL_".strtoupper($file);
if ($conf->global->$const) { if (getDolGlobalString($const)) {
print img_picto($langs->trans("Active"), 'tick'); print img_picto($langs->trans("Active"), 'tick');
print '</td><td class="right">'; print '</td><td class="right">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&spe='.urlencode($file).'&value=0">'.$langs->trans("Disable").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&spe='.urlencode($file).'&value=0">'.$langs->trans("Disable").'</a>';

View File

@@ -153,7 +153,7 @@ if ($action == 'updateMask') {
$tmpobjectkey = GETPOST('object'); $tmpobjectkey = GETPOST('object');
if (!empty($tmpobjectkey)) { if (!empty($tmpobjectkey)) {
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -153,7 +153,7 @@ if ($action == 'updateMask') {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) { if ($ret > 0) {
$constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF'; $constforval = 'RECRUITMENT_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
if ($conf->global->$constforval == "$value") { if (getDolGlobalString($constforval) == "$value") {
dolibarr_del_const($db, $constforval, $conf->entity); dolibarr_del_const($db, $constforval, $conf->entity);
} }
} }

View File

@@ -1223,7 +1223,7 @@ if (isset($_SESSION["takeposterminal"]) && $_SESSION["takeposterminal"]) {
$constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"];
//var_dump($constantforkey.' '.getDolGlobalInt($constantforkey)); //var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
if (!empty($conf->global->$constantforkey) && getDolGlobalInt($constantforkey) > 0) { if (getDolGlobalInt($constantforkey) > 0) {
array_push($paiementsModes, $obj); array_push($paiementsModes, $obj);
} }
} }

View File

@@ -323,11 +323,11 @@ if (empty($reshook)) {
$prod_batch->find(0, '', '', $line->batch, $line->fk_warehouse); $prod_batch->find(0, '', '', $line->batch, $line->fk_warehouse);
$mouvP = new MouvementStock($db); $mouvP = new MouvementStock($db);
$mouvP->origin = $invoice; $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 { } else {
$mouvP = new MouvementStock($db); $mouvP = new MouvementStock($db);
$mouvP->origin = $invoice; $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)) { if (!empty($batch)) {
$action="setbatch"; $action="setbatch";
} else { } else {
$nbofsuggested = 0;
$prod->load_stock('warehouseopen'); $prod->load_stock('warehouseopen');
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"]; $constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
if ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch!="") { if ($prod->stock_warehouse[getDolGlobalString($constantforkey)]->detail_batch!="") {
@@ -561,7 +562,7 @@ if (empty($reshook)) {
print '<td class="left">'; print '<td class="left">';
$staticwarehouse = new Entrepot($db); $staticwarehouse = new Entrepot($db);
if ($warehouse_id > 0) { if ($warehouse_id > 0) {
$staticwarehouse->fetch($conf->global->$constantforkey); $staticwarehouse->fetch(getDolGlobalString($constantforkey));
} }
$detail = ''; $detail = '';
$detail .= $langs->trans("LotSerial").': '.$dbatch->batch; $detail .= $langs->trans("LotSerial").': '.$dbatch->batch;