iTop
iTop copied to clipboard
Attachment class : now creation_date is init by default
New fields were added to the class in 2.7.0 with N°330 The creation_date isn't initialized by default, that means every consumer needs to fill it. Currently Mail TO Ticket extension doesn't...
This PR adds a __construct override in the class so that the field is set by default to the current date.
This would solve part of N°4081
Why not implemented as $this->SetCurrentDate('creation_date');?
Or even better, as a lot of other datamodel classes already do, as $this->SetIfNull('creation_date', time()); in an overload of OnInsert or DBInsertNoReload.
Indeed you're right, second solution is what is made everywhere in the datamodel ! I will switch to it !
Accepted during technical review
Functional review: Pierre will run the audit to list impacted customers. As we tend to not make any datamodel change in a maintenance release, it might be merged in develop only.
Didn't find any Attachment children in the clients customization (details are in N°4081) Setting this PR to be reviewed for next functional review !
Accepted during functional review but for branch develop instead of support/2.7. As this is addressing a non blocking bug with a partial fix (other part must be done in the Mail To Ticket Automation extension) we rather stick to our retrofitting guidelines and don't make a datamodel change in a minor version.
To be done before next technical review then merge:
- [x] Add default user_id in the Attachment creation as a fallback in case the consumer didn't pass it.
- [x] Check whereas we need to remove the creation date being set in the portal like it was done for the backoffice
- [x] Rebase PR onto develop branch
- [x] Update PR's title with the bug number in our internal tracker
Rebased branch + PR on develop
PR ready to review again
Accepted during technical review. You can merge Pierre.
Please also see https://sourceforge.net/p/itop/tickets/2167/