N°4454 - Measuring the use of the queryphrase book (code review)

This commit is contained in:
Benjamin Dalsass
2022-01-19 07:48:03 +01:00
parent ff7d1f2d6a
commit 1fac2ae787
2 changed files with 13 additions and 5 deletions

View File

@@ -115,12 +115,16 @@ abstract class Query extends cmdbAbstractObject
}
/** @inheritdoc */
/**
* @inheritdoc
*
* @since 3.1.0
*/
public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '')
{
// read only attribute
if (in_array($sAttCode, ['export_count', 'export_last_date', 'export_last_user_id'])){
return(OPT_ATT_READONLY);
return OPT_ATT_READONLY;
}
return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState);
@@ -133,14 +137,13 @@ abstract class Query extends cmdbAbstractObject
* @param array|null $aValues optional values for the query
*
* @return string|null
* @since 3.1.0
*/
public abstract function GetExportUrl(array $aValues = null) : ?string;
/**
* Update last export information.
*
* @todo validation with Pierre
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreException
@@ -230,7 +233,7 @@ class QueryOQL extends Query
// inject parameters
$aParameters = $oSearch->GetQueryParams();
foreach ($aParameters as $sParam => $val) {
($aValues === null || $aValues[$sParam] === null) ? $paramValue = $sParam : $paramValue = $aValues[$sParam];
$paramValue = ($aValues === null || $aValues[$sParam] === null) ? $sParam : $aValues[$sParam];
$sUrl .= '&arg_' . $sParam . '=' . $paramValue;
}

View File

@@ -19,7 +19,12 @@
*
*/
namespace Combodo\iTop\Test\UnitTest\Application\Search;
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
use MetaModel;
use Query;
use QueryOQL;
/**
* This test creates call export on requests and check request usage counter.