@@ -220,7 +220,7 @@ public function rawSearchOptions() {
220220 '0 ' => 'equals ' ,
221221 '1 ' => 'notequals '
222222 ],
223- 'massiveaction ' => true
223+ 'massiveaction ' => false
224224 ];
225225
226226 $ tab [] = [
@@ -1195,16 +1195,16 @@ public function prepareInputForUpdate($input) {
11951195 return false ;
11961196 }
11971197
1198- if (!$ this ->checkConditionSettings ($ input )) {
1199- $ input ['show_rule ' ] = PluginFormcreatorCondition::SHOW_RULE_ALWAYS ;
1200- }
1198+ // if (!$this->checkConditionSettings($input)) {
1199+ // $input['show_rule'] = PluginFormcreatorCondition::SHOW_RULE_ALWAYS;
1200+ // }
12011201
1202- if (!$ this ->checkValidators ($ input )) {
1203- $ input ['validation_required ' ] = self ::VALIDATION_NONE ;
1204- }
1202+ // if (!$this->checkValidators($input)) {
1203+ // $input['validation_required'] = self::VALIDATION_NONE;
1204+ // }
12051205 }
12061206
1207- return $ input ;
1207+ // return $input;
12081208 }
12091209
12101210 // Control fields values :
@@ -1239,6 +1239,13 @@ public function prepareInputForUpdate($input) {
12391239 }
12401240 }
12411241
1242+ if (isset ($ input ['restrictions ' ])) {
1243+ $ input ['users ' ] = AbstractRightsDropdown::getPostedIds ($ input ['restrictions ' ], User::class);
1244+ $ input ['groups ' ] = AbstractRightsDropdown::getPostedIds ($ input ['restrictions ' ], Group::class);
1245+ $ input ['profiles ' ] = AbstractRightsDropdown::getPostedIds ($ input ['restrictions ' ], Profile::class);
1246+ unset($ input ['restrictions ' ]);
1247+ }
1248+
12421249 return $ input ;
12431250 }
12441251
@@ -1458,6 +1465,35 @@ public static function showMassiveActionsSubForm(MassiveAction $ma) {
14581465 ]);
14591466 echo '<br /><br /> ' . Html::submit (_x ('button ' , 'Post ' ), ['name ' => 'massiveaction ' ]);
14601467 return true ;
1468+
1469+ case 'AccessRights ' :
1470+ echo '<p></p> ' ;
1471+ Dropdown::showFromArray (
1472+ 'access_rights ' ,
1473+ PluginFormcreatorForm::getEnumAccessType (),
1474+ [
1475+ 'value ' => PluginFormcreatorForm::ACCESS_PRIVATE ,
1476+ 'on_change ' => 'plugin_formcreator.showMassiveRestrictions(this) ' ,
1477+ ]
1478+ );
1479+ echo '<p></p> ' ;
1480+ echo '<div id="plugin_formcreator_restrictions_head" style="display: none"> ' ;
1481+ echo PluginFormcreatorFormAccessType::getTypeName (2 );
1482+ echo '</div> ' ;
1483+ echo '<div id="plugin_formcreator_restrictions" style="display: none"> ' ;
1484+ echo PluginFormcreatorRestrictedFormDropdown::show ('restrictions ' , [
1485+ 'users_id ' => [],
1486+ 'groups_id ' => [],
1487+ 'profiles_id ' => [],
1488+ ]);
1489+ echo '</div> ' ;
1490+ echo '<div id="plugin_formcreator_captcha" style="display: none"> ' ;
1491+ echo __ ('Enable captcha ' , 'formcreator ' ) . ' ' ;
1492+ Dropdown::showYesNo ('is_captcha_enabled ' );
1493+ echo '</div> ' ;
1494+ echo '<br /><br /> ' . Html::submit (_x ('button ' , 'Post ' ), ['name ' => 'massiveaction ' ]);
1495+ return true ;
1496+
14611497 }
14621498 return parent ::showMassiveActionsSubForm ($ ma );
14631499 }
@@ -1511,6 +1547,18 @@ public static function processMassiveActionsForOneItemtype(MassiveAction $ma, Co
15111547 Html::redirect (FORMCREATOR_ROOTDOC ."/front/export.php? " .Toolbox::append_params ($ listOfId ));
15121548 header ("Content-disposition:attachment filename= \"test \"" );
15131549 return ;
1550+
1551+ case 'AccessRights ' :
1552+ foreach ($ ids as $ id ) {
1553+ if ($ item ->getFromDB ($ id ) && $ item ->update ($ ma ->POST + ['id ' => $ id ])) {
1554+ Session::addMessageAfterRedirect (sprintf (__ ('Form updated: %s ' , 'formcreator ' ), $ item ->getName ()));
1555+ $ ma ->itemDone ($ item ->getType (), $ id , MassiveAction::ACTION_OK );
1556+ } else {
1557+ // Example of ko count
1558+ $ ma ->itemDone ($ item ->getType (), $ id , MassiveAction::ACTION_KO );
1559+ }
1560+ }
1561+ return ;
15141562 }
15151563 parent ::processMassiveActionsForOneItemtype ($ ma , $ item , $ ids );
15161564 }
0 commit comments