diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index 8e2f07ec4fc..7f8e415e4b1 100644
--- a/htdocs/categories/class/categorie.class.php
+++ b/htdocs/categories/class/categorie.class.php
@@ -1146,6 +1146,8 @@ class Categorie extends CommonObject
// First build full array $motherof
//$this->load_motherof(); // Disabled because already done by caller of build_path_from_id_categ
+ // $this->cats[$id_categ] is supposed to be already an array. We just want to complete it with property fullpath and fulllabel
+
// Define fullpath and fulllabel
$this->cats[$id_categ]['fullpath'] = '_'.$id_categ;
$this->cats[$id_categ]['fulllabel'] = $this->cats[$id_categ]['label'];
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 909f786beec..a156f35292e 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -7123,9 +7123,9 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
foreach (array_keys($array) as $key)
{
if (is_object($array[$key])) {
- $temp[$key] = $array[$key]->$index;
+ $temp[$key] = empty($array[$key]->$index) ? 0 : $array[$key]->$index;
} else {
- $temp[$key] = $array[$key][$index];
+ $temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index];
}
}
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 8391c6aab06..a77f38f8f66 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -1252,7 +1252,7 @@ function check_value($mask, $value)
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode." maskraz=".$maskraz." maskoffset=".$maskoffset."
\n";
if (function_exists('mb_strrpos')) {
- $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8');
+ $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 0, 'UTF-8');
}
else {
$posnumstart = strrpos($maskwithnocode, $maskcounter);
diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php
index 9b870bd5dd2..18947732b16 100644
--- a/htdocs/core/modules/societe/mod_codeclient_elephant.php
+++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php
@@ -212,8 +212,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode
// Get Mask value
$mask = '';
- if ($type == 0) $mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER;
- if ($type == 1) $mask = $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER;
+ if ($type == 0) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER;
+ if ($type == 1) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_SUPPLIER;
if (!$mask)
{
$this->error = 'NotConfigured';
diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
index 961fa1a4e73..ea25a480d45 100644
--- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php
+++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php
@@ -157,6 +157,8 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
$i = 0;
$this->code = '';
+ $disponibility = 0;
+
if (is_object($societe))
{
dol_syslog("mod_codecompta_digitaria::get_code search code for type=".$type." & company=".(!empty($societe->name) ? $societe->name : ''));
@@ -216,8 +218,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode
}
}
- if ($disponibility == 0)
- {
+ if ($disponibility == 0) {
return 0; // return ok
} else {
return -1; // return ko
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 0fc33232c5d..7fccdf994b9 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -109,7 +109,7 @@ if ($object->id > 0) {
$permissiontoread = $user->rights->societe->lire;
$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
-$permissiontodelete = $user->rights->societe->delete || ($permissiontoadd && isset($object->status) && $object->status == 0);
+$permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0);
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
@@ -1355,7 +1355,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
print '