Skip to content

Commit 8b1e3b8

Browse files
committed
fix(issue): issue not updated to refused status
1 parent f1ac36b commit 8b1e3b8

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

front/form_answer.form.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@
3232
$_POST['plugin_formcreator_forms_id'] = intval($_POST['formcreator_form']);
3333
$_POST['status'] = 'waiting';
3434
$formanswer->saveAnswers($_POST);
35-
$formanswer->redirectToList();
35+
if (plugin_formcreator_replaceHelpdesk()) {
36+
$issue = new PluginFormcreatorIssue();
37+
$issue->redirectToList();
38+
} else {
39+
$formanswer->redirectToList();
40+
}
3641

3742
// Show target ticket form
3843
} else {

inc/form.class.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,6 @@ public function showServiceCatalog() {
571571
}
572572

573573
public function showWizard($service_catalog = false) {
574-
575574
echo '<div id="plugin_formcreator_wizard_categories">';
576575
echo '<div><h2>'._n("Category", "Categories", 2, 'formcreator').'</h2></div>';
577576
echo '<div><a href="#" id="wizard_seeall">' . __('see all', 'formcreator') . '</a></div>';

inc/form_answer.class.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,19 +655,19 @@ public function saveAnswers($data) {
655655
}
656656

657657
// Update issues table
658+
$issue = new PluginFormcreatorIssue();
659+
$formAnswerId = $this->getID();
658660
if ($status != 'refused') {
659661

660662
// If cannot get itemTicket from DB it happens either
661663
// when no item exist
662664
// when several rows matches
663665
// Both are processed the same way
664-
$formAnswerId = $this->getID();
665666
$itemTicket = new Item_Ticket();
666667
$rows = $itemTicket->find("`itemtype` = 'PluginFormcreatorForm_Answer' AND `items_id` = '$formAnswerId'");
667668
if (count($rows) != 1) {
668669
if ($is_newFormAnswer) {
669670
// This is a new answer for the form. Create an issue
670-
$issue = new PluginFormcreatorIssue();
671671
$issue->add([
672672
'original_id' => $id,
673673
'sub_itemtype' => 'PluginFormcreatorForm_Answer',
@@ -682,7 +682,6 @@ public function saveAnswers($data) {
682682
'comment' => '',
683683
]);
684684
} else {
685-
$issue = new PluginFormcreatorIssue();
686685
$issue->getFromDBByQuery("WHERE `sub_itemtype` = 'PluginFormcreatorForm_Answer' AND `original_id` = '$formAnswerId'");
687686
$id = $this->getID();
688687
$issue->update([
@@ -707,7 +706,6 @@ public function saveAnswers($data) {
707706
$ticket->getFromDB($itemTicket->getField('tickets_id'));
708707
$ticketId = $ticket->getID();
709708
if ($is_newFormAnswer) {
710-
$issue = new PluginFormcreatorIssue();
711709
$issue->add([
712710
'original_id' => $ticketId,
713711
'sub_itemtype' => 'Ticket',
@@ -722,7 +720,6 @@ public function saveAnswers($data) {
722720
'comment' => addslashes($ticket->getField('content')),
723721
]);
724722
} else {
725-
$issue = new PluginFormcreatorIssue();
726723
$issue->getFromDBByQuery("WHERE `sub_itemtype` = 'PluginFormcreatorForm_Answer' AND `original_id` = '$formAnswerId'");
727724
$issue->update([
728725
'id' => $issue->getID(),
@@ -740,6 +737,14 @@ public function saveAnswers($data) {
740737
]);
741738
}
742739
}
740+
} else {
741+
$issue->getFromDBByQuery("WHERE `sub_itemtype` = 'PluginFormcreatorForm_Answer' AND `original_id` = '$formAnswerId'");
742+
$issue->update([
743+
'id' => $issue->getID(),
744+
'sub_itemtype' => 'PluginFormcreatorForm_Answer',
745+
'original_id' => $formAnswerId,
746+
'status' => $status,
747+
]);
743748
}
744749
}
745750

0 commit comments

Comments
 (0)