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 8888}
8989
9090// 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 ) {
10393 echo json_encode (
10494 [
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 ()),
106107 ], JSON_FORCE_OBJECT
107108 );
108109 die ();
109110 }
110111 echo json_encode (
111112 [
112- 'redirect ' => ( new PluginFormcreatorForm ()) ->getFormURLWithID ($ formAnswer ->fields [ ' plugin_formcreator_forms_id ' ] ),
113+ 'redirect ' => $ formAnswer ->getFormURLWithID ($ formAnswer ->getID () ),
113114 ], JSON_FORCE_OBJECT
114115 );
115116 die ();
You can’t perform that action at this time.
0 commit comments