mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°1976 - Duplicate Service on Customer Contract
This commit is contained in:
@@ -1627,7 +1627,36 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<duplicates>true</duplicates>
|
||||
</field>
|
||||
</fields>
|
||||
<methods/>
|
||||
<methods>
|
||||
<method id="DoCheckToWrite">
|
||||
<static>false</static>
|
||||
<access>public</access>
|
||||
<code><![CDATA[
|
||||
public function DoCheckToWrite()
|
||||
{
|
||||
parent::DoCheckToWrite();
|
||||
|
||||
$aCustomerContracts = $this->Get("customercontracts_list");
|
||||
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";
|
||||
$aQueryParams['customercontract_id'] = $oCustomerContracts->Get("customercontract_id");
|
||||
$aQueryParams['service_id'] = $oCustomerContracts->Get("service_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())
|
||||
{
|
||||
$this->m_aCheckIssues[] = Dict::Format('Class:SLA/Error:UniqueLnkCustomerContractToService',$aCurrentRow->Get('customercontract_name'),$aCurrentRow->Get('service_name'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]]></code>
|
||||
</method>
|
||||
</methods>
|
||||
<presentation>
|
||||
<details>
|
||||
<items>
|
||||
|
||||
@@ -370,6 +370,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:SLA/Attribute:slts_list+' => 'All the service level targets for this SLA',
|
||||
'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts',
|
||||
'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA',
|
||||
'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : already one SLA exist',
|
||||
));
|
||||
|
||||
//
|
||||
|
||||
@@ -360,6 +360,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Class:SLA/Attribute:slts_list+' => '',
|
||||
'Class:SLA/Attribute:customercontracts_list' => 'Contrats clients',
|
||||
'Class:SLA/Attribute:customercontracts_list+' => '',
|
||||
'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossible de sauvegarder le lien avec le contrat client %1$s et le service %2$s : un SLA existe déjà.',
|
||||
));
|
||||
|
||||
//
|
||||
|
||||
@@ -1621,7 +1621,36 @@ public function PrefillSearchForm(&$aContextParam)
|
||||
<duplicates>true</duplicates>
|
||||
</field>
|
||||
</fields>
|
||||
<methods/>
|
||||
<methods>
|
||||
<method id="DoCheckToWrite">
|
||||
<static>false</static>
|
||||
<access>public</access>
|
||||
<code><![CDATA[
|
||||
public function DoCheckToWrite()
|
||||
{
|
||||
parent::DoCheckToWrite();
|
||||
|
||||
$aCustomerContracts = $this->Get("customercontracts_list");
|
||||
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";
|
||||
$aQueryParams['customercontract_id'] = $oCustomerContracts->Get("customercontract_id");
|
||||
$aQueryParams['service_id'] = $oCustomerContracts->Get("service_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())
|
||||
{
|
||||
$this->m_aCheckIssues[] = Dict::Format('Class:SLA/Error:UniqueLnkCustomerContractToService',$aCurrentRow->Get('customercontract_name'),$aCurrentRow->Get('service_name'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
]]></code>
|
||||
</method>
|
||||
</methods>
|
||||
<presentation>
|
||||
<details>
|
||||
<items>
|
||||
|
||||
@@ -360,6 +360,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:SLA/Attribute:slts_list+' => 'All the service level targets for this SLA',
|
||||
'Class:SLA/Attribute:customercontracts_list' => 'Customer contracts',
|
||||
'Class:SLA/Attribute:customercontracts_list+' => 'All the customer contracts using this SLA',
|
||||
'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Could not save link with Customer contract %1$s and service %2$s : already one SLA exist',
|
||||
));
|
||||
|
||||
//
|
||||
|
||||
@@ -350,6 +350,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Class:SLA/Attribute:slts_list+' => '',
|
||||
'Class:SLA/Attribute:customercontracts_list' => 'Contrats clients',
|
||||
'Class:SLA/Attribute:customercontracts_list+' => '',
|
||||
'Class:SLA/Error:UniqueLnkCustomerContractToService' => 'Impossible de sauvegarder le lien avec le contrat client %1$s et le service %2$s : un SLA existe déjà.',
|
||||
));
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user