From 201c93e20a64be34fce01682fb98507689ca625c Mon Sep 17 00:00:00 2001 From: Pierre Goiffon Date: Wed, 1 Aug 2018 09:12:00 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B01582=20Fix=20audit=20when=20a=20current?= =?UTF-8?q?=20organization=20is=20set=20and=20there=20is=20an=20audit=20ru?= =?UTF-8?q?le=20with=20valid=3Dtrue=20Was=20generating=20an=20OQL=20missin?= =?UTF-8?q?g=20query=20argument=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[5991] --- core/coreexception.class.inc.php | 2 -- core/dbobjectsearch.class.php | 38 +++++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/core/coreexception.class.inc.php b/core/coreexception.class.inc.php index fe1f58b6c..ae1a18af8 100644 --- a/core/coreexception.class.inc.php +++ b/core/coreexception.class.inc.php @@ -127,5 +127,3 @@ class SecurityException extends CoreException class ArchivedObjectException extends CoreException { } - -?> diff --git a/core/dbobjectsearch.class.php b/core/dbobjectsearch.class.php index 8c2b24eb0..ce6153aa4 100644 --- a/core/dbobjectsearch.class.php +++ b/core/dbobjectsearch.class.php @@ -497,6 +497,8 @@ class DBObjectSearch extends DBSearch * @param bool $bPositiveMatch if true will add a IN filter, else a NOT IN * * @throws \CoreException + * + * @since 2.5 N°1418 */ public function AddConditionForInOperatorUsingParam($sFilterCode, $aValues, $bPositiveMatch = true) { @@ -506,7 +508,7 @@ class DBObjectSearch extends DBSearch $sInParamName = $this->GenerateUniqueParamName(); $oParamExpression = new VariableExpression($sInParamName); - $this->SetInternalParams(array($sInParamName => $aValues)); + $this->GetInternalParamsByRef()[$sInParamName] = $aValues; $oListExpression = new ListExpression(array($oParamExpression)); @@ -1086,11 +1088,45 @@ class DBObjectSearch extends DBSearch return $this->m_aParams = $aParams; } + /** + * @return array warning : array returned by value + * @see self::GetInternalParamsByRef to get the attribute by reference + */ public function GetInternalParams() { return $this->m_aParams; } + /** + * @return array + * @see http://php.net/manual/en/language.references.return.php + * @since 2.5.1 N°1582 + */ + public function &GetInternalParamsByRef() + { + return $this->m_aParams; + } + + /** + * @param string $sKey + * @param mixed $value + * @param bool $bDoNotOverride + * + * @throws \CoreUnexpectedValue if $bDoNotOverride and $sKey already exists + */ + public function AddInternalParam($sKey, $value, $bDoNotOverride = false) + { + if ($bDoNotOverride) + { + if (array_key_exists($sKey, $this->m_aParams)) + { + throw new CoreUnexpectedValue("The key $sKey already exists with value : ".$this->m_aParams[$sKey]); + } + } + + $this->m_aParams[$sKey] = $value; + } + public function GetQueryParams($bExcludeMagicParams = true) { $aParams = array();