diff --git a/htdocs/adherents/admin/public.php b/htdocs/adherents/admin/public.php
index 740a5c97879..088f96b00c1 100644
--- a/htdocs/adherents/admin/public.php
+++ b/htdocs/adherents/admin/public.php
@@ -215,7 +215,12 @@ dol_fiche_end();
print '
';
//print $langs->trans('FollowingLinksArePublic').'
';
print img_picto('','object_globe.png').' '.$langs->trans('BlankSubscriptionForm').':
';
-print ''.DOL_MAIN_URL_ROOT.'/public/members/new.php';
+if ($conf->multicompany->enabled) {
+ $entity_qr='?entity='.$conf->entity;
+} else {
+ $entity_qr='';
+}
+print ''.DOL_MAIN_URL_ROOT.'/public/members/new.php'.$entity_qr.'';
/*
print '
';
diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php
index ba7f4cd3f90..ca79c21e9ef 100644
--- a/htdocs/core/lib/json.lib.php
+++ b/htdocs/core/lib/json.lib.php
@@ -251,7 +251,9 @@ function dol_json_decode($json, $assoc=false)
if (! empty($array))
{
$object = false;
-
+ if (count($array)>0) {
+ $object = (object) array();
+ }
foreach ($array as $key => $value)
{
if ($key) $object->{$key} = $value;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 8fbd48bc855..cd8377ca5a8 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -660,7 +660,7 @@ if (! defined('NOLOGIN'))
$cryptkey = (! empty($conf->file->cookie_cryptkey) ? $conf->file->cookie_cryptkey : '' );
$entityCookie = new DolCookie($cryptkey);
- $entityCookie->_setCookie($entityCookieName, $entity, $ttl);
+ $entityCookie->setCookie($entityCookieName, $entity, $ttl);
}
// Hooks on successfull login