@@ -80,6 +80,7 @@ class MassiveAction
8080
8181 /**
8282 * Class used to process current action.
83+ * @var class-string|null
8384 */
8485 private string $ processor ;
8586
@@ -819,7 +820,7 @@ public function showSubForm()
819820 **/
820821 public function showDefaultSubForm ()
821822 {
822- echo Html::submit (_x ('button ' , 'Post ' ), [
823+ echo Html::submit (_x ('button ' , 'Post 3 ' ), [
823824 'name ' => 'massiveaction ' ,
824825 'icon ' => 'ti ti-device-floppy ' ,
825826 'class ' => 'btn btn-sm btn-primary ' ,
@@ -852,6 +853,7 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
852853 ]);
853854 echo '<br> ' ;
854855 echo Html::submit(_x ('button ' , 'Post ' ), [
856+ echo Html::submit (_x ('button ' , 'Post 4 ' ), [
855857 'name ' => 'massiveaction ' ,
856858 ]);
857859 return true ;
@@ -1068,7 +1070,19 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
10681070 "infocom " => UPDATE ,
10691071 ]);
10701072 } else {
1071- $ so_item ->checkGlobal (UPDATE );
1073+ // redirect to reauth if needed // @todo cleanup
1074+ // pas possible de faire redirection ici, c'est géré en ajax : pas d'effet
1075+ // mais on peut afficher un bouton vers la reauth et on redirige vers la page actuelle
1076+ $ reauth_needed = null ;
1077+ $ allowed = $ so_item ->canGlobal (UPDATE , $ reauth_needed ); // @todo juste update ? action delete/purge/etc
1078+ if (!$ allowed && !$ reauth_needed ) {
1079+ // just to throw the redirect Exception, maybe we can refactor
1080+ // maybe we can refactor \CommonDBTM::checkGlobal to call \CommonDBTM::throwAccessDeniedException.
1081+ // then we can just call this method here instead of checkGlobal()
1082+ $ so_item ->checkGlobal (UPDATE );
1083+ }
1084+ // continue event if not currently authorized, to show the submit button
1085+ // right check (and reauth redirection) will be process on form submission
10721086 }
10731087
10741088 $ itemtype_search_options = SearchOption::getOptionsForItemtype ($ so_itemtype );
@@ -1160,7 +1174,7 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
11601174 if (isset ($ ma ->POST ['submitname ' ]) && $ ma ->POST ['submitname ' ]) {
11611175 $ submitname = $ ma ->POST ['submitname ' ];
11621176 } else {
1163- $ submitname = _x ('button ' , 'Post ' );
1177+ $ submitname = _x ('button ' , 'Post 5 ' );
11641178 $ submit_options ['icon ' ] = 'ti ti-device-floppy ' ;
11651179 }
11661180 echo Html::submit ($ submitname , $ submit_options );
@@ -1192,7 +1206,7 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
11921206 if (isset ($ ma ->POST ['submitname ' ]) && $ ma ->POST ['submitname ' ]) {
11931207 $ submitname = $ ma ->POST ['submitname ' ];
11941208 } else {
1195- $ submitname = _x ('button ' , 'Post ' );
1209+ $ submitname = _x ('button ' , 'Post 6 ' );
11961210 $ submit_options ['icon ' ] = 'ti ti-device-floppy ' ;
11971211 }
11981212 echo Html::submit ($ submitname , $ submit_options );
@@ -1218,7 +1232,7 @@ public static function showMassiveActionsSubForm(MassiveAction $ma)
12181232 if (isset ($ ma ->POST ['submitname ' ]) && $ ma ->POST ['submitname ' ]) {
12191233 $ submitname = $ ma ->POST ['submitname ' ];
12201234 } else {
1221- $ submitname = _x ('button ' , 'Post ' );
1235+ $ submitname = _x ('button ' , 'Post 7 ' );
12221236 $ submit_options ['icon ' ] = 'ti ti-device-floppy ' ;
12231237 }
12241238 echo Html::submit ($ submitname , $ submit_options );
0 commit comments