iTop icon indicating copy to clipboard operation
iTop copied to clipboard

Attachment class : now creation_date is init by default

Open piRGoif opened this issue 3 years ago • 5 comments

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

piRGoif avatar Sep 21 '22 13:09 piRGoif

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.

Hipska avatar Sep 21 '22 14:09 Hipska

Indeed you're right, second solution is what is made everywhere in the datamodel ! I will switch to it !

piRGoif avatar Sep 21 '22 15:09 piRGoif

Accepted during technical review

Molkobain avatar Oct 10 '22 14:10 Molkobain

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.

Molkobain avatar Oct 11 '22 15:10 Molkobain

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 !

piRGoif avatar Oct 11 '22 15:10 piRGoif

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

Molkobain avatar Nov 08 '22 18:11 Molkobain

Rebased branch + PR on develop

piRGoif avatar Nov 21 '22 11:11 piRGoif

PR ready to review again

piRGoif avatar Nov 21 '22 16:11 piRGoif

Accepted during technical review. You can merge Pierre.

Molkobain avatar Mar 07 '23 17:03 Molkobain

Please also see https://sourceforge.net/p/itop/tickets/2167/

jbostoen avatar Jun 04 '23 08:06 jbostoen