diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php
index 075ece751ce..3be38cca113 100644
--- a/htdocs/admin/emailcollector_list.php
+++ b/htdocs/admin/emailcollector_list.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
-dol_include_once('/emailcollector/class/emailcollector.class.php');
+require_once DOL_DOCUMENT_ROOT.'/emailcollector/class/emailcollector.class.php';
// Load translation files required by page
$langs->loadLangs(array("admin", "other"));
@@ -50,7 +50,7 @@ $mode = GETPOST('mode', 'aZ');
$id = GETPOST('id', 'int');
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
diff --git a/htdocs/admin/stocktransfer.php b/htdocs/admin/stocktransfer.php
index 099312ef491..3bcd00c1fe8 100644
--- a/htdocs/admin/stocktransfer.php
+++ b/htdocs/admin/stocktransfer.php
@@ -24,19 +24,7 @@
*/
// Load Dolibarr environment
-$res = 0;
-// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
-if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
-// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
-$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
-while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; }
-if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
-if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
-// Try main.inc.php using relative path
-if (!$res && file_exists("../main.inc.php")) $res = @include "../main.inc.php";
-if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php";
-if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php";
-if (!$res) die("Include of main fails");
+require '../main.inc.php';
global $langs, $user;
@@ -56,6 +44,8 @@ $action = GETPOST('action', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha');
$value = GETPOST('value', 'alpha');
+$label = GETPOST('label', 'alpha');
+$scandir = GETPOST('scan_dir', 'alpha');
$arrayofparameters = array(
'STOCKTRANSFER_MYPARAM1'=>array('css'=>'minwidth200', 'enabled'=>1),
@@ -70,9 +60,8 @@ $setupnotempty = 0;
* Actions
*/
-if ((float) DOL_VERSION >= 6) {
- include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
-}
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
if ($action == 'updateMask') {
$maskconststocktransfer = GETPOST('maskconststocktransfer', 'alpha');
@@ -131,7 +120,9 @@ if ($action == 'updateMask') {
$ret = delDocumentModel($value, 'stocktransfer');
if ($ret > 0) {
$constforval = strtoupper($tmpobjectkey).'_ADDON_PDF';
- if ($conf->global->$constforval == "$value") dolibarr_del_const($db, $constforval, $conf->entity);
+ if (getDolGlobalString($constforval) == "$value") {
+ dolibarr_del_const($db, $constforval, $conf->entity);
+ }
}
} elseif ($action == 'setdoc') { // Set default model
$tmpobjectkey = 'StockTransfer';
@@ -294,7 +285,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
print '
';
$constforvar = 'STOCKTRANSFER_'.strtoupper($myTmpObjectKey).'_ADDON';
- if ($conf->global->$constforvar == $file) {
+ if (getDolGlobalString($constforvar) == $file) {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '';
@@ -428,7 +419,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
// Default
print ' | ';
$constforvar = strtoupper($myTmpObjectKey).'_ADDON_PDF';
- if ($conf->global->$constforvar == $name) {
+ if (getDolGlobalString($constforvar) == $name) {
print img_picto($langs->trans("Default"), 'on');
} else {
print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'';
diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php
index bccad47e2d8..c53117a6821 100644
--- a/htdocs/compta/bank/list.php
+++ b/htdocs/compta/bank/list.php
@@ -652,7 +652,7 @@ foreach ($accounts as $key => $type) {
print ''.$langs->trans("ConciliationDisabled").'';
} else {
$result = $objecttmp->load_board($user, $objecttmp->id);
- if ($result < 0) {
+ if (is_numeric($result) && $result < 0) {
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
} else {
print '';
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index 3e3ada6e8cf..2f69a3936c9 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -5667,7 +5667,7 @@ if ($action == 'create') {
&& $usercancreate
&& !$objectidnext
&& $object->is_last_in_cycle()
- && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE
+ && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE')
) {
if ($usercanunvalidate) {
print ''.$langs->trans("CreateCreditNote").'';
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 508129ba141..3bd6991feac 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -4917,15 +4917,18 @@ abstract class CommonObject
// Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook.
$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach ($dirtpls as $module => $reldir) {
+ $res = 0;
if (!empty($module)) {
$tpl = dol_buildpath($reldir.'/objectline_title.tpl.php');
} else {
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_title.tpl.php';
}
- if (empty($conf->file->strict_mode)) {
- $res = @include $tpl;
- } else {
- $res = include $tpl; // for debug
+ if (file_exists($tpl)) {
+ if (empty($conf->file->strict_mode)) {
+ $res = @include $tpl;
+ } else {
+ $res = include $tpl; // for debug
+ }
}
if ($res) {
break;
@@ -5040,16 +5043,18 @@ abstract class CommonObject
// Note: This is deprecated. If you need to overwrite the tpl file, use instead the hook printObjectLine and printObjectSubLine.
$dirtpls = array_merge($conf->modules_parts['tpl'], array($defaulttpldir));
foreach ($dirtpls as $module => $reldir) {
+ $res = 0;
if (!empty($module)) {
$tpl = dol_buildpath($reldir.'/objectline_view.tpl.php');
} else {
$tpl = DOL_DOCUMENT_ROOT.$reldir.'/objectline_view.tpl.php';
}
-
- if (empty($conf->file->strict_mode)) {
- $res = @include $tpl;
- } else {
- $res = include $tpl; // for debug
+ if (file_exists($tpl)) {
+ if (empty($conf->file->strict_mode)) {
+ $res = @include $tpl;
+ } else {
+ $res = include $tpl; // for debug
+ }
}
if ($res) {
break;
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 041f6902040..f2d104368f4 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -8887,7 +8887,7 @@ class Form
$form = new Form($this->db);
print $form->textwithpicto('', $langs->trans("InformationOnLinkToContract")).' ';
}
- print ''.price($objp->total_ht).'';
+ print ''.(isset($objp->total_ht) ? price($objp->total_ht) : '').'';
print ' | ';
print ''.$objp->name.' | ';
print '';
diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php
index 61737ab00f3..513d964014a 100644
--- a/htdocs/core/class/html.formmargin.class.php
+++ b/htdocs/core/class/html.formmargin.class.php
@@ -100,7 +100,7 @@ class FormMargin
$pv = $line->total_ht;
$pa_ht = ($pv < 0 ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign
if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION)
- || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && $conf->global->INVOICE_USE_SITUATION_CREDIT_NOTE && $object->situation_counter > 0)) {
+ || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) {
$pa = $line->qty * $pa_ht * ($line->situation_percent / 100);
} else {
$pa = $line->qty * $pa_ht;
diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php
index aef01514eba..c57ee0c5106 100644
--- a/htdocs/core/class/html.formsetup.class.php
+++ b/htdocs/core/class/html.formsetup.class.php
@@ -1079,7 +1079,7 @@ class FormSetupItem
$tmp = explode(':', $this->type);
$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
- if ($template<0) {
+ if (is_numeric($template) && $template < 0) {
$this->setErrors($formmail->errors);
}
$out.= $this->langs->trans($template->label);
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index f1cf8e43269..b5f8ced66a0 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -438,7 +438,11 @@ function societe_prepare_head2($object)
*/
function societe_admin_prepare_head()
{
- global $langs, $conf, $user;
+ global $langs, $conf, $user, $db;
+
+ $extrafields = new ExtraFields($db);
+ $extrafields->fetch_name_optionals_label('societe');
+ $extrafields->fetch_name_optionals_label('socpeople');
$h = 0;
$head = array();
@@ -456,11 +460,19 @@ function societe_admin_prepare_head()
$head[$h][0] = DOL_URL_ROOT.'/societe/admin/societe_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsThirdParties");
+ $nbExtrafields = $extrafields->attributes['societe']['count'];
+ if ($nbExtrafields > 0) {
+ $head[$h][1] .= ''.$nbExtrafields.'';
+ }
$head[$h][2] = 'attributes';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/societe/admin/contact_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsContacts");
+ $nbExtrafields = $extrafields->attributes['socpeople']['count'];
+ if ($nbExtrafields > 0) {
+ $head[$h][1] .= ''.$nbExtrafields.'';
+ }
$head[$h][2] = 'attributes_contacts';
$h++;
diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
index 67d41199594..267ca6803c9 100644
--- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
+++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php
@@ -23,7 +23,7 @@ if (!empty($extrafieldsobjectkey) && !empty($extrafields->attributes[$extrafield
$tmpkey = 'options_'.$key;
- if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && !is_numeric($obj->$tmpkey)) {
+ if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp')) && isset($obj->$tmpkey) && !is_numeric($obj->$tmpkey)) {
$datenotinstring = $obj->$tmpkey;
if (!is_numeric($obj->$tmpkey)) { // For backward compatibility
$datenotinstring = $db->jdate($datenotinstring);
diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php
index 6ec5c1d0b9b..be7f006d5a0 100644
--- a/htdocs/product/stock/replenish.php
+++ b/htdocs/product/stock/replenish.php
@@ -849,8 +849,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
$desiredstock = $objp->desiredstock;
$alertstock = $objp->seuil_stock_alerte;
- $desiredstockwarehouse = ($objp->desiredstockpse ? $objp->desiredstockpse : 0);
- $alertstockwarehouse = ($objp->seuil_stock_alertepse ? $objp->seuil_stock_alertepse : 0);
+ $desiredstockwarehouse = (!empty($objp->desiredstockpse) ? $objp->desiredstockpse : 0);
+ $alertstockwarehouse = (!empty($objp->seuil_stock_alertepse) ? $objp->seuil_stock_alertepse : 0);
$warning = '';
if ($alertstock && ($stock < $alertstock)) {
diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php
index d077c1d0ba8..c3c031b14bd 100644
--- a/htdocs/product/stock/replenishorders.php
+++ b/htdocs/product/stock/replenishorders.php
@@ -51,6 +51,7 @@ $search_dateyear = GETPOST('search_dateyear', 'int');
$search_datemonth = GETPOST('search_datemonth', 'int');
$search_dateday = GETPOST('search_dateday', 'int');
$search_date = dol_mktime(0, 0, 0, $search_datemonth, $search_dateday, $search_dateyear);
+$optioncss = GETPOST('optioncss', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
@@ -130,9 +131,9 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
}
$sql .= ' WHERE cf.fk_soc = s.rowid ';
$sql .= ' AND cf.entity = '.$conf->entity;
-if ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) {
+if (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) {
$sql .= ' AND cf.fk_statut < 3';
-} elseif ($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
+} elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) {
$sql .= ' AND cf.fk_statut < 6'; // We want also status 5, we will keep them visible if dispatching is not yet finished (tested with function dolDispatchToDo).
} else {
$sql .= ' AND cf.fk_statut < 5';