File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555
5656// Save form
5757$ backup_debug = $ _SESSION ['glpi_use_mode ' ];
58- $ _SESSION ['glpi_use_mode ' ] = \ Session::NORMAL_MODE ;
58+ $ _SESSION ['glpi_use_mode ' ] = Session::NORMAL_MODE ;
5959$ formAnswer = new PluginFormcreatorFormAnswer ();
6060if ($ formAnswer ->add ($ _POST ) === false ) {
6161 http_response_code (400 );
Original file line number Diff line number Diff line change 3636 Html::displayNotFoundError ();
3737}
3838
39+ Session::checkLoginUser ();
40+
3941if (!PluginFormcreatorFormAnswer::canView ()) {
4042 Html::displayRightError ();
4143}
Original file line number Diff line number Diff line change @@ -342,14 +342,15 @@ public function buildParams($rand = null) {
342342 // Set specific root if defined (CommonTreeDropdown)
343343 $ baseLevel = 0 ;
344344 if (isset ($ decodedValues ['show_tree_root ' ])
345- && (int ) $ decodedValues ['show_tree_root ' ] > 0
345+ && ((int ) $ decodedValues ['show_tree_root ' ] > 0
346+ || $ itemtype == Entity::class && (int ) $ decodedValues ['show_tree_root ' ] > -1 )
346347 ) {
347348 $ sons = (new DBUtils )->getSonsOf (
348349 $ itemtype ::getTable (),
349350 $ decodedValues ['show_tree_root ' ]
350351 );
351352 $ decodedValues ['selectable_tree_root ' ] = $ decodedValues ['selectable_tree_root ' ] ?? '1 ' ;
352- if (! isset ( $ decodedValues [ ' selectable_tree_root ' ]) || $ decodedValues ['selectable_tree_root ' ] == '0 ' ) {
353+ if ($ decodedValues ['selectable_tree_root ' ] == '0 ' ) {
353354 unset($ sons [$ decodedValues ['show_tree_root ' ]]);
354355 }
355356
Original file line number Diff line number Diff line change @@ -370,7 +370,6 @@ private function checkBeforeSave($input) : array {
370370 return [];
371371 }
372372 // - field type is compatible with accessibility of the form
373- $ form = new PluginFormcreatorForm ();
374373 $ section = PluginFormcreatorSection::getById ($ input [PluginFormcreatorSection::getForeignKeyField ()]);
375374 $ form = PluginFormcreatorForm::getByItem ($ section );
376375 if ($ form ->isPublicAccess () && !$ this ->field ->isPublicFormCompatible ()) {
Original file line number Diff line number Diff line change @@ -343,7 +343,7 @@ function plugin_formcreator_hook(): void {
343343 Session::getCurrentInterface () == 'helpdesk ' ) {
344344
345345 // Add specific JavaScript
346- $ PLUGIN_HOOKS [' add_javascript ' ]['formcreator ' ][] = 'js/scripts.js ' ;
346+ $ PLUGIN_HOOKS [Hooks:: ADD_JAVASCRIPT ]['formcreator ' ][] = 'js/scripts.js ' ;
347347 }
348348
349349 if (isset ($ _SESSION ['glpiactiveentities_string ' ])) {
You can’t perform that action at this time.
0 commit comments