diff --git a/application/datamodel.application.xml b/application/datamodel.application.xml
index 2858b3c1e..8095c6368 100644
--- a/application/datamodel.application.xml
+++ b/application/datamodel.application.xml
@@ -253,6 +253,22 @@
+
+
+
+ attcode
+ true
+
+ allow
+
+
+
+
+
+
+
+
+
diff --git a/core/dbobject.class.php b/core/dbobject.class.php
index 481bd0bc7..1127b5910 100644
--- a/core/dbobject.class.php
+++ b/core/dbobject.class.php
@@ -3982,6 +3982,30 @@ abstract class DBObject implements iDisplay
return true;
}
+ /**
+ * Helper to set a value only if it is currently undefined
+ *
+ * Call SetCurrentDate() only of the internal representation of the attribute is null.
+ *
+ * @api
+ * @see SetCurrentDate()
+ *
+ * @param string $sAttCode
+ *
+ * @throws \CoreException
+ * @throws \CoreUnexpectedValue
+ * @since 3.0.0
+ */
+ public function SetCurrentDateIfNull($sAttCode)
+ {
+ $oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
+ $oCurrentValue = $this->Get($sAttCode);
+ if ($oAttDef->IsNull($oCurrentValue))
+ {
+ $this->SetCurrentDate($sAttCode);
+ }
+ }
+
/**
* Helper to set the current logged in user for the given attribute
* Suitable for use as a lifecycle action
diff --git a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
index ad7ad68f8..9b8dd7c5d 100755
--- a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
+++ b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml
@@ -604,7 +604,7 @@
closed
- SetCurrentDate
+ SetCurrentDateIfNull
end_date