diff --git a/modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php b/modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php index 244c00b2f..6ec59e0dc 100644 --- a/modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php +++ b/modules/itop-change-mgmt-1.0.0/model.itop-change-mgmt.php @@ -118,7 +118,7 @@ abstract class Change extends Ticket 'workgroup_id' => OPT_ATT_MANDATORY, 'supervisor_group_id' => OPT_ATT_MANDATORY, 'manager_group_id' => OPT_ATT_MANDATORY, - 'description' => OPT_ATT_READONLY, + 'description' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_MANDATORY, ), @@ -141,7 +141,7 @@ abstract class Change extends Ticket 'agent_id' => OPT_ATT_MUSTCHANGE, 'supervisor_id' => OPT_ATT_MUSTCHANGE, 'manager_id' => OPT_ATT_MUSTCHANGE, - 'description' => OPT_ATT_READONLY, + 'description' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, ), ) @@ -288,14 +288,18 @@ abstract class Change extends Ticket public function ComputeValues() { - $iKey = $this->GetKey(); - if ($iKey < 0) + $sCurrRef = $this->Get('ref'); + if (strlen($sCurrRef) == 0) { - // Object not yet in the Database - $iKey = MetaModel::GetNextKey(get_class($this)); + $iKey = $this->GetKey(); + if ($iKey < 0) + { + // Object not yet in the Database + $iKey = MetaModel::GetNextKey(get_class($this)); + } + $sName = sprintf('C-%06d', $iKey); + $this->Set('ref', $sName); } - $sName = sprintf('C-%06d', $iKey); - $this->Set('ref', $sName); } /** diff --git a/modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php b/modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php index 49c55dd36..dc7cb1a70 100644 --- a/modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php +++ b/modules/itop-incident-mgmt-1.0.0/model.itop-incident-mgmt.php @@ -52,14 +52,19 @@ class Incident extends ResponseTicket public function ComputeValues() { - $iKey = $this->GetKey(); - if ($iKey < 0) + $sCurrRef = $this->Get('ref'); + if (strlen($sCurrRef) == 0) { - // Object not yet in the Database - $iKey = MetaModel::GetNextKey(get_class($this)); + $iKey = $this->GetKey(); + if ($iKey < 0) + { + // Object not yet in the Database + $iKey = MetaModel::GetNextKey(get_class($this)); + } + $sName = sprintf('I-%06d', $iKey); + $this->Set('ref', $sName); } - $sName = sprintf('I-%06d', $iKey); - $this->Set('ref', $sName); + return parent::ComputeValues(); } diff --git a/modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php b/modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php index f3daff62c..3c9f4c97d 100644 --- a/modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php +++ b/modules/itop-problem-mgmt-1.0.0/model.itop-problem-mgmt.php @@ -209,17 +209,21 @@ class Problem extends Ticket public function ComputeValues() { - // Compute the priority of the ticket - $this->Set('priority', $this->ComputePriority()); + // Compute the priority of the ticket + $this->Set('priority', $this->ComputePriority()); - $iKey = $this->GetKey(); - if ($iKey < 0) + $sCurrRef = $this->Get('ref'); + if (strlen($sCurrRef) == 0) { - // Object not yet in the Database - $iKey = MetaModel::GetNextKey(get_class($this)); + $iKey = $this->GetKey(); + if ($iKey < 0) + { + // Object not yet in the Database + $iKey = MetaModel::GetNextKey(get_class($this)); + } + $sName = sprintf('P-%06d', $iKey); + $this->Set('ref', $sName); } - $sName = sprintf('P-%06d', $iKey); - $this->Set('ref', $sName); } } diff --git a/modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php b/modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php index 4edf59464..ed939b330 100644 --- a/modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php +++ b/modules/itop-request-mgmt-1.0.0/model.itop-request-mgmt.php @@ -75,14 +75,19 @@ class UserRequest extends ResponseTicket public function ComputeValues() { - $iKey = $this->GetKey(); - if ($iKey < 0) + $sCurrRef = $this->Get('ref'); + if (strlen($sCurrRef) == 0) { - // Object not yet in the Database - $iKey = MetaModel::GetNextKey(get_class($this)); + $iKey = $this->GetKey(); + if ($iKey < 0) + { + // Object not yet in the Database + $iKey = MetaModel::GetNextKey(get_class($this)); + } + $sName = sprintf('R-%06d', $iKey); + $this->Set('ref', $sName); } - $sName = sprintf('R-%06d', $iKey); - $this->Set('ref', $sName); + return parent::ComputeValues(); }