diff --git a/datamodels/2.x/itop-service-mgmt-provider/datamodel.itop-service-mgmt-provider.xml b/datamodels/2.x/itop-service-mgmt-provider/datamodel.itop-service-mgmt-provider.xml index ad7912c31..389ce94d3 100755 --- a/datamodels/2.x/itop-service-mgmt-provider/datamodel.itop-service-mgmt-provider.xml +++ b/datamodels/2.x/itop-service-mgmt-provider/datamodel.itop-service-mgmt-provider.xml @@ -1637,23 +1637,26 @@ public function PrefillSearchForm(&$aContextParam) parent::DoCheckToWrite(); $aCustomerContracts = $this->Get("customercontracts_list"); - foreach($aCustomerContracts as $sAttCode => $oCustomerContracts) + foreach ($aCustomerContracts as $sAttCode => $oCustomerContracts) { // Recurse inside the subdirectories - $sOql="SELECT lnkCustomerContractToService AS ccs WHERE ccs.customercontract_id=:customercontract_id AND ccs.service_id=:service_id AND ccs.sla_id!=:sla_id"; + $sOql = "SELECT lnkCustomerContractToService AS ccs WHERE ccs.customercontract_id=:customercontract_id AND ccs.service_id=:service_id"; $aQueryParams['customercontract_id'] = $oCustomerContracts->Get("customercontract_id"); $aQueryParams['service_id'] = $oCustomerContracts->Get("service_id"); - $aQueryParams['sla_id'] = $this->Get("id"); + if($this->Get("id")!=null) + { + $sOql=$sOql." AND ccs.sla_id!=:sla_id"; + $aQueryParams['sla_id'] = $this->Get("id"); + } $oQuery = DBSearch::FromOQL($sOql, $aQueryParams); $oResultSql = new DBObjectSet($oQuery); $oResultSql->OptimizeColumnLoad(['ccs.customercontract_name','ccs.service_name']); - while ($aCurrentRow = $oResultSql->Fetch()) + if ($aCurrentRow = $oResultSql->Fetch()) { $this->m_aCheckIssues[] = Dict::Format('Class:SLA/Error:UniqueLnkCustomerContractToService',$aCurrentRow->Get('customercontract_name'),$aCurrentRow->Get('service_name')); } } } - ]]> diff --git a/datamodels/2.x/itop-service-mgmt/datamodel.itop-service-mgmt.xml b/datamodels/2.x/itop-service-mgmt/datamodel.itop-service-mgmt.xml index 19f1885bb..319c85f77 100755 --- a/datamodels/2.x/itop-service-mgmt/datamodel.itop-service-mgmt.xml +++ b/datamodels/2.x/itop-service-mgmt/datamodel.itop-service-mgmt.xml @@ -1631,23 +1631,26 @@ public function PrefillSearchForm(&$aContextParam) parent::DoCheckToWrite(); $aCustomerContracts = $this->Get("customercontracts_list"); - foreach($aCustomerContracts as $sAttCode => $oCustomerContracts) + foreach ($aCustomerContracts as $sAttCode => $oCustomerContracts) { // Recurse inside the subdirectories - $sOql="SELECT lnkCustomerContractToService AS ccs WHERE ccs.customercontract_id=:customercontract_id AND ccs.service_id=:service_id AND ccs.sla_id!=:sla_id"; + $sOql = "SELECT lnkCustomerContractToService AS ccs WHERE ccs.customercontract_id=:customercontract_id AND ccs.service_id=:service_id"; $aQueryParams['customercontract_id'] = $oCustomerContracts->Get("customercontract_id"); $aQueryParams['service_id'] = $oCustomerContracts->Get("service_id"); - $aQueryParams['sla_id'] = $this->Get("id"); + if($this->Get("id")!=null) + { + $sOql=$sOql." AND ccs.sla_id!=:sla_id"; + $aQueryParams['sla_id'] = $this->Get("id"); + } $oQuery = DBSearch::FromOQL($sOql, $aQueryParams); $oResultSql = new DBObjectSet($oQuery); $oResultSql->OptimizeColumnLoad(['ccs.customercontract_name','ccs.service_name']); - while ($aCurrentRow = $oResultSql->Fetch()) + if ($aCurrentRow = $oResultSql->Fetch()) { $this->m_aCheckIssues[] = Dict::Format('Class:SLA/Error:UniqueLnkCustomerContractToService',$aCurrentRow->Get('customercontract_name'),$aCurrentRow->Get('service_name')); } } } - ]]>