mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
N°1703 The dates are no longer reset when inserting a Ticket
Could cause problems when importing using REST API or using form prefill
This commit is contained in:
@@ -448,6 +448,25 @@ abstract class DBObject implements iDisplay
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sAttCode
|
||||
* @param mixed $value
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \Exception
|
||||
* @since 2.6
|
||||
*/
|
||||
public function SetIfNull($sAttCode, $value)
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
|
||||
$oCurrentValue = $this->Get($sAttCode);
|
||||
if ($oAttDef->IsNull($oCurrentValue))
|
||||
{
|
||||
$this->Set($sAttCode, $value);
|
||||
}
|
||||
}
|
||||
|
||||
public function SetTrim($sAttCode, $sValue)
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
|
||||
|
||||
@@ -935,8 +935,8 @@
|
||||
{
|
||||
parent::OnInsert();
|
||||
$this->UpdateImpactedItems();
|
||||
$this->Set('creation_date', time());
|
||||
$this->Set('last_update', time());
|
||||
$this->SetIfNull('creation_date', time());
|
||||
$this->SetIfNull('last_update', time());
|
||||
}]]>
|
||||
</code>
|
||||
</method>
|
||||
|
||||
@@ -503,8 +503,8 @@
|
||||
{
|
||||
parent::OnInsert();
|
||||
$this->UpdateImpactedItems();
|
||||
$this->Set('creation_date', time());
|
||||
$this->Set('last_update', time());
|
||||
$this->SetIfNull('creation_date', time());
|
||||
$this->SetIfNull('last_update', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="OnUpdate">
|
||||
|
||||
@@ -1344,8 +1344,8 @@
|
||||
{
|
||||
parent::OnInsert();
|
||||
$this->ComputeImpactedItems();
|
||||
$this->Set('last_update', time());
|
||||
$this->Set('start_date', time());
|
||||
$this->SetIfNull('last_update', time());
|
||||
$this->SetIfNull('start_date', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="OnUpdate">
|
||||
|
||||
@@ -459,8 +459,8 @@
|
||||
<type>Overload-DBObject</type>
|
||||
<code><![CDATA[ protected function OnInsert()
|
||||
{
|
||||
$this->Set('start_date', time());
|
||||
$this->Set('last_update', time());
|
||||
$this->SetIfNull('start_date', time());
|
||||
$this->SetIfNull('last_update', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="OnUpdate">
|
||||
|
||||
@@ -1397,8 +1397,8 @@
|
||||
protected function OnInsert()
|
||||
{
|
||||
$this->ComputeImpactedItems();
|
||||
$this->Set('last_update', time());
|
||||
$this->Set('start_date', time());
|
||||
$this->SetIfNull('last_update', time());
|
||||
$this->SetIfNull('start_date', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="OnUpdate">
|
||||
|
||||
@@ -1421,8 +1421,9 @@
|
||||
{
|
||||
parent::OnInsert();
|
||||
$this->ComputeImpactedItems();
|
||||
$this->Set('last_update', time());
|
||||
$this->Set('start_date', time());
|
||||
|
||||
$this->SetIfNull('last_update', time());
|
||||
$this->SetIfNull('start_date', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="OnUpdate">
|
||||
|
||||
@@ -851,6 +851,30 @@
|
||||
</argument>
|
||||
</arguments>
|
||||
</method>
|
||||
<method id="SetIfNull">
|
||||
<arguments>
|
||||
<argument id="1">
|
||||
<type>attcode</type>
|
||||
<mandatory>true</mandatory>
|
||||
<type_restrictions>
|
||||
<operation>deny</operation>
|
||||
<types>
|
||||
<type id="AttributeStopWatch"/>
|
||||
<type id="AttributeSubItem"/>
|
||||
<type id="AttributeExternalField"/>
|
||||
<type id="AttributeLinkedSetIndirect"/>
|
||||
<type id="AttributeLinkedSet"/>
|
||||
<type id="AttributeImage"/>
|
||||
<type id="AttributeBlob"/>
|
||||
</types>
|
||||
</type_restrictions>
|
||||
</argument>
|
||||
<argument id="2">
|
||||
<type>string</type>
|
||||
<mandatory>true</mandatory>
|
||||
</argument>
|
||||
</arguments>
|
||||
</method>
|
||||
<method id="SetCurrentDate">
|
||||
<arguments>
|
||||
<argument id="1">
|
||||
|
||||
Reference in New Issue
Block a user