Prerequisites for custom fields

SVN:trunk[3918]
This commit is contained in:
Romain Quetiez
2016-02-19 12:30:19 +00:00
parent 08c6bb5c5e
commit bfadbc4098
4 changed files with 9 additions and 6 deletions

View File

@@ -503,6 +503,7 @@ class UserRightsProfile extends UserRightsAddOnAPI
$aRet = array();
$oSearch = new DBObjectSearch('URP_UserProfile');
$oSearch->AllowAllData();
$oSearch->NoContextParameters();
$oSearch->Addcondition('userid', $oUser->GetKey(), '=');
$oProfiles = new DBObjectSet($oSearch);
while ($oUserProfile = $oProfiles->Fetch())

View File

@@ -40,6 +40,7 @@ require_once('dbunionsearch.class.php');
abstract class DBSearch
{
protected $m_bDataFiltered = false;
protected $m_bNoContextParameters = false;
protected $m_aModifierProperties = array();
// By default, some information may be hidden to the current user
@@ -60,6 +61,8 @@ abstract class DBSearch
public function AllowAllData() {$this->m_bAllowAllData = true;}
public function IsAllDataAllowed() {return $this->m_bAllowAllData;}
public function NoContextParameters() {$this->m_bNoContextParameters = true;}
public function HasContextParameters() {return $this->m_bNoContextParameters;}
public function IsDataFiltered() {return $this->m_bDataFiltered; }
public function SetDataFiltered() {$this->m_bDataFiltered = true;}
@@ -354,13 +357,12 @@ abstract class DBSearch
* @param int $iLimitCount
* @param int $iLimitStart
* @param bool $bGetCount
* @param bool $bNoArguments
* @return string
* @throws CoreException
* @throws Exception
* @throws MissingQueryArgument
*/
public function MakeSelectQuery($aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false, $bNoArguments = false)
public function MakeSelectQuery($aOrderBy = array(), $aArgs = array(), $aAttToLoad = null, $aExtendedDataSpec = null, $iLimitCount = 0, $iLimitStart = 0, $bGetCount = false)
{
// Check the order by specification, and prefix with the class alias
// and make sure that the ordering columns are going to be selected
@@ -413,7 +415,7 @@ abstract class DBSearch
$oSQLQuery = $this->GetSQLQuery($aOrderBy, $aArgs, $aAttToLoad, $aExtendedDataSpec, $iLimitCount, $iLimitStart, $bGetCount);
if ($bNoArguments)
if ($this->m_bNoContextParameters)
{
// Only internal parameters
$aScalarArgs = $this->GetInternalParams();

View File

@@ -4485,8 +4485,8 @@ abstract class MetaModel
{
$oFilter->AllowAllData();
}
$sSQL = $oFilter->MakeSelectQuery(array(), array(), null, null, 0, 0, false, true); // bNoMagicArguments = true
$oFilter->NoContextParameters();
$sSQL = $oFilter->MakeSelectQuery();
self::$aQueryCacheGetObject[$sQuerySign] = $sSQL;
self::$aQueryCacheGetObjectHits[$sQuerySign] = 0;
}

View File

@@ -162,7 +162,7 @@ try
foreach($oFilter->GetQueryParams() as $sParam => $foo)
{
// Skip magic parameters
$iPos = strpos($sArgName, '->');
$iPos = strpos($sParam, '->');
if ($iPos === false)
{
$sRefName = $sParam;