From e58957e603b200e24ef48020b4483a64981d3458 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Jul 2015 08:18:32 +0200 Subject: [PATCH 1/4] Fix: broken feature: Check the entity because He may be the same reference in several entities --- htdocs/paypal/lib/paypal.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index b40b0f9fd4c..8323b4aa3eb 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -311,7 +311,7 @@ function getPaypalPaymentUrl($mode,$type,$ref='',$amount='9.99',$freetag='your_f } // For multicompany - //$out.="&entity=".$conf->entity; // This should not be into link. Link contains already a ref of an object that allow to retreive entity + $out.="&entity=".$conf->entity; // Check the entity because He may be the same reference in several entities return $out; } From 4fb5af74426d473ce3c65af824f606a9b6594cf1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Jul 2015 10:58:55 +0200 Subject: [PATCH 2/4] Fix: reset the current entity --- htdocs/core/modules/DolibarrModules.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 045bb1ddbcf..cc2680d187c 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1412,7 +1412,6 @@ abstract class DolibarrModules global $conf; $error=0; - $entity=$conf->entity; if (is_array($this->module_parts) && ! empty($this->module_parts)) { @@ -1420,6 +1419,7 @@ abstract class DolibarrModules { if (is_array($value) && count($value) == 0) continue; // Discard empty arrays + $entity=$conf->entity; // Reset the current entity $newvalue = $value; // Serialize array parameters From 4273c4aad9445ac8234802ff96e14ea153e1610f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Jul 2015 11:35:11 +0200 Subject: [PATCH 3/4] Fix: data can be just a value, not an array --- htdocs/core/modules/DolibarrModules.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index cc2680d187c..b2c650e10e1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1431,6 +1431,11 @@ abstract class DolibarrModules $newvalue = json_encode($value['data']); if (isset($value['entity'])) $entity = $value['entity']; } + else if (isset($value['data']) && !is_array($value['data'])) + { + $newvalue = $value['data']; + if (isset($value['entity'])) $entity = $value['entity']; + } else { $newvalue = json_encode($value); From e82f4c474b36a8d3f653cd3d1ab41f9e19d6ba16 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 3 Jul 2015 22:06:24 +0200 Subject: [PATCH 4/4] Fix: for avoid error with main context hooks, with $langs object for example. --- htdocs/core/ajax/constantonoff.php | 3 ++- htdocs/main.inc.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index bbcd19b5234..331a5e87513 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2015 Regis Houssin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOREQUIREHOOK')) define('NOREQUIREHOOK','1'); require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index e432db3e025..8fbd48bc855 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -575,7 +575,7 @@ if (! defined('NOLOGIN')) exit; } else - { + { // Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('main'));