File tree Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Expand file tree Collapse file tree 2 files changed +13
-18
lines changed Original file line number Diff line number Diff line change @@ -344,11 +344,6 @@ function plugin_formcreator_hook_add_ticket(CommonDBTM $item) {
344
344
return ;
345
345
}
346
346
347
- if (isset ($ item ->input ['items_id ' ][PluginFormcreatorFormAnswer::getType ()])) {
348
- // the ticket is associated to a form answer
349
- return ;
350
- }
351
-
352
347
$ requester = $ DB ->request ([
353
348
'SELECT ' => 'users_id ' ,
354
349
'FROM ' => Ticket_User::getTable (),
@@ -482,15 +477,16 @@ function plugin_formcreator_hook_delete_ticket(CommonDBTM $item) {
482
477
483
478
function plugin_formcreator_hook_restore_ticket (CommonDBTM $ item ) {
484
479
$ formAnswer = new PluginFormcreatorFormAnswer ();
485
- if (! $ formAnswer ->getFromDbByTicket ($ item )) {
486
- plugin_formcreator_hook_add_ticket ($ item );
480
+ if ($ formAnswer ->getFromDbByTicket ($ item )) {
481
+ $ formAnswer ->createIssue ();
482
+ $ minimalStatus = $ formAnswer ->getAggregatedStatus ();
483
+ if ($ minimalStatus !== null ) {
484
+ $ formAnswer ->updateStatus ($ minimalStatus );
485
+ }
487
486
return ;
488
487
}
489
488
490
- $ minimalStatus = $ formAnswer ->getAggregatedStatus ();
491
- if ($ minimalStatus !== null ) {
492
- $ formAnswer ->updateStatus ($ minimalStatus );
493
- }
489
+ plugin_formcreator_hook_add_ticket ($ item );
494
490
}
495
491
496
492
function plugin_formcreator_hook_purge_ticket (CommonDBTM $ item ) {
Original file line number Diff line number Diff line change @@ -1102,7 +1102,9 @@ public function post_addItem() {
1102
1102
return ;
1103
1103
}
1104
1104
}
1105
- $ this ->createIssue ();
1105
+ if ($ this ->input ['status ' ] != self ::STATUS_REFUSED ) {
1106
+ $ this ->createIssue ();
1107
+ }
1106
1108
$ minimalStatus = $ formAnswer ->getAggregatedStatus ();
1107
1109
if ($ minimalStatus !== null ) {
1108
1110
$ this ->updateStatus ($ minimalStatus );
@@ -1346,14 +1348,9 @@ private function sendNotification() {
1346
1348
}
1347
1349
}
1348
1350
1349
- private function createIssue () {
1351
+ public function createIssue () {
1350
1352
global $ DB ;
1351
1353
1352
- $ issue = new PluginFormcreatorIssue ();
1353
- if ($ this ->input ['status ' ] == self ::STATUS_REFUSED ) {
1354
- return ;
1355
- }
1356
-
1357
1354
// If cannot get itemTicket from DB it happens either
1358
1355
// when no item exist
1359
1356
// or when several rows matches
@@ -1377,6 +1374,8 @@ private function createIssue() {
1377
1374
'items_id ' => $ this ->getID (),
1378
1375
]
1379
1376
]);
1377
+
1378
+ $ issue = new PluginFormcreatorIssue ();
1380
1379
if ($ rows ->count () != 1 ) {
1381
1380
// There is no or several tickets for this form answer
1382
1381
// The issue must be created from this form answer
You can’t perform that action at this time.
0 commit comments