File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change 88
88
}
89
89
90
90
// redirect to created item
91
- if ($ _SESSION ['glpibackcreated ' ] && Ticket::canView ()) {
92
- if (strpos ($ _SERVER ['HTTP_REFERER ' ], 'form.form.php ' ) === false ) {
93
- // User was not testing the form from preview
94
- if (count ($ formAnswer ->targetList ) == 1 ) {
95
- $ target = current ($ formAnswer ->targetList );
96
- echo json_encode (
97
- [
98
- 'redirect ' => $ target ->getFormURLWithID ($ target ->getID ()),
99
- ], JSON_FORCE_OBJECT
100
- );
101
- die ();
102
- }
91
+ if ($ _SESSION ['glpibackcreated ' ]) {
92
+ if (strpos ($ _SERVER ['HTTP_REFERER ' ], 'form.form.php ' ) !== false ) {
103
93
echo json_encode (
104
94
[
105
- 'redirect ' => $ formAnswer ->getFormURLWithID ($ formAnswer ->getID ()),
95
+ 'redirect ' => (new PluginFormcreatorForm ())->getFormURLWithID ($ formAnswer ->fields ['plugin_formcreator_forms_id ' ]),
96
+ ], JSON_FORCE_OBJECT
97
+ );
98
+ die ();
99
+ }
100
+ // User was not testing the form from preview
101
+ reset ($ formAnswer ->targetList );
102
+ $ target = current ($ formAnswer ->targetList );
103
+ if (count ($ formAnswer ->targetList ) == 1 && $ target ::canView ()) {
104
+ echo json_encode (
105
+ [
106
+ 'redirect ' => $ target ->getFormURLWithID ($ target ->getID ()),
106
107
], JSON_FORCE_OBJECT
107
108
);
108
109
die ();
109
110
}
110
111
echo json_encode (
111
112
[
112
- 'redirect ' => ( new PluginFormcreatorForm ()) ->getFormURLWithID ($ formAnswer ->fields [ ' plugin_formcreator_forms_id ' ] ),
113
+ 'redirect ' => $ formAnswer ->getFormURLWithID ($ formAnswer ->getID () ),
113
114
], JSON_FORCE_OBJECT
114
115
);
115
116
die ();
You can’t perform that action at this time.
0 commit comments