File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -446,6 +446,27 @@ function plugin_formcreator_hook_pre_purge_targetChange(CommonDBTM $item) {
446
446
$ item ->pre_purgeItem ();
447
447
}
448
448
449
+ function plugin_formcreator_hook_update_ticketvalidation (CommonDBTM $ item ) {
450
+ $ ticket = new Ticket ();
451
+ $ ticket ->getFromDB ($ item ->fields ['tickets_id ' ]);
452
+ if ($ ticket ->isNewItem ()) {
453
+ // Should not happen
454
+ return ;
455
+ }
456
+
457
+ $ status = PluginFormcreatorCommon::getTicketStatusForIssue ($ ticket );
458
+
459
+ $ issue = new PluginFormcreatorIssue ();
460
+ $ issue ->getFromDBByCrit ([
461
+ 'sub_itemtype ' => Ticket::getType (),
462
+ 'original_id ' => $ item ->fields ['tickets_id ' ]
463
+ ]);
464
+ if ($ issue ->isNewItem ()) {
465
+ return ;
466
+ }
467
+ $ issue ->update (['status ' => $ status ['status ' ]] + $ issue ->fields );
468
+ }
469
+
449
470
function plugin_formcreator_dynamicReport ($ params ) {
450
471
switch ($ params ['item_type ' ]) {
451
472
case PluginFormcreatorFormAnswer::class;
Original file line number Diff line number Diff line change @@ -154,6 +154,9 @@ function plugin_init_formcreator() {
154
154
$ PLUGIN_HOOKS ['item_purge ' ]['formcreator ' ] = [
155
155
Ticket::class => 'plugin_formcreator_hook_purge_ticket '
156
156
];
157
+ $ PLUGIN_HOOKS ['item_update ' ]['formcreator ' ] = [
158
+ TicketValidation::class => 'plugin_formcreator_hook_update_ticketvalidation '
159
+ ];
157
160
$ PLUGIN_HOOKS ['pre_item_purge ' ]['formcreator ' ] = [
158
161
PluginFormcreatorTargetTicket::class => 'plugin_formcreator_hook_pre_purge_targetTicket ' ,
159
162
PluginFormcreatorTargetChange::class => 'plugin_formcreator_hook_pre_purge_targetChange '
You can’t perform that action at this time.
0 commit comments