@@ -13,39 +13,37 @@ function create_entity!(new_object::IEntity,
1313
1414 query_string = " INSERT INTO " * table_name
1515
16+ #
17+ # Enrich the created object with the creator and creation time if needed
18+ #
19+ creator_property = util_get_creator_property (orm_module)
20+ if ! ismissing (creator_property)
21+ # Only set the creator property if it is empty because the rest of the
22+ # application may want to set it (eg. if importing data)
23+ if ismissing (getproperty (new_object,creator_property))
24+ setproperty! (new_object,
25+ creator_property,
26+ creator)
27+ # If the object has the creator property set, use it
28+ else
29+ creator = getproperty (new_object,creator_property)
30+ end
31+ end
1632
17- # Record the state of the attributes in the modification table
18- if util_get_track_changes (orm_module)
19-
20- #
21- # Enrich the created object
22- #
23-
24- creator_property = util_get_creator_property (orm_module)
25- if ! ismissing (creator_property)
26- # Only set the creator property if it is empty because the rest of the
27- # application may want to set it (eg. if importing data)
28- if ismissing (getproperty (new_object,creator_property))
29- setproperty! (new_object,
30- creator_property,
31- creator)
32- # If the object has the creator property set, use it
33- else
34- creator = getproperty (new_object,creator_property)
35- end
33+ creation_time_property = util_get_creation_time_property (orm_module)
34+ if ! ismissing (creation_time_property)
35+ # Only set the creation time if it is empty because the rest of the
36+ # application may want to set it (eg. if importing data)
37+ if ismissing (getproperty (new_object, creation_time_property))
38+ setproperty! (new_object,
39+ creation_time_property,
40+ now (Dates. UTC))
41+ end
42+ end
3643
37- end
3844
39- creation_time_property = util_get_creation_time_property (orm_module)
40- if ! ismissing (creation_time_property)
41- # Only set the creation time if it is empty because the rest of the
42- # application may want to set it (eg. if importing data)
43- if ismissing (getproperty (new_object, creation_time_property))
44- setproperty! (new_object,
45- creation_time_property,
46- now (Dates. UTC))
47- end
48- end
45+ # Record the state of the attributes in the modification table
46+ if util_get_track_changes (orm_module)
4947
5048 #
5149 # Create the modification entries
@@ -85,7 +83,7 @@ function create_entity!(new_object::IEntity,
8583
8684 end
8785
88- end # if track_changes
86+ end # ENDOF if track_changes
8987
9088 props = util_get_entity_props_for_db_actions (new_object,
9189 dbconn,
0 commit comments