From c8017b00caf002519d370b5dc41fb8f6a9c12622 Mon Sep 17 00:00:00 2001 From: Rusty Braze <180222500+RustyBraze@users.noreply.github.com> Date: Sat, 7 Sep 2024 21:10:15 +0200 Subject: [PATCH] Closing Bugfix #23 - Fix the missing " from the German language file - Hide/show the shift button based on Critter permission level - Critter shifts filter is updated to match the permission level --- includes/pages/user_shifts.php | 6 ++++- includes/view/AngelTypes_view.php | 39 ++++++++++++++++++++----------- resources/lang/de_DE/default.po | 2 +- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php index bb75b00ce..24edcc667 100644 --- a/includes/pages/user_shifts.php +++ b/includes/pages/user_shifts.php @@ -203,7 +203,11 @@ function load_types() )' . ($isShico ? '' : 'WHERE angel_types.hide_on_shift_view = 0 - OR user_angel_type.user_id IS NOT NULL ') . + OR ( + user_angel_type.user_id IS NOT NULL + AND + NOT `user_angel_type`.`confirm_user_id` IS NULL + ) ') . 'ORDER BY `angel_types`.`name` ', [ diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index b48621d08..4eaa2f4ba 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -520,25 +520,36 @@ function AngelType_view( '', __('general.add') ) : ''); + + // Let's create the tabs as we go, so we can hide if needed + // Tab #1 -> INFO + $pagetabs = [ + __('Info') => AngelType_view_info( + $angeltype, + $members, + $admin_user_angeltypes, + $admin_angeltypes, + $supporter + ), + ]; + // Tab #2 -> Only if the user deserves :) + if ($admin_user_angeltypes || + !$angeltype->hide_on_shift_view || + ($angeltype->hide_on_shift_view && (!is_null($user_angeltype) && $user_angeltype->confirm_user_id))) { + // Yup, you can see this: admin, not to hide or confirmed user + $pagetabs[__('general.shifts')] = AngelType_view_shifts( + $angeltype, + $shiftsFilterRenderer, + $shiftCalendarRenderer + ); + } + return page_with_title( $back . ' ' . sprintf(__('Team %s'), htmlspecialchars($angeltype->name)) . ' ' . $add, [ AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_license, $user), msg(), - tabs([ - __('Info') => AngelType_view_info( - $angeltype, - $members, - $admin_user_angeltypes, - $admin_angeltypes, - $supporter - ), - __('general.shifts') => AngelType_view_shifts( - $angeltype, - $shiftsFilterRenderer, - $shiftCalendarRenderer - ), - ], $tab), + tabs($pagetabs, $tab), ], true ); diff --git a/resources/lang/de_DE/default.po b/resources/lang/de_DE/default.po index a3aaaaf74..b52bb740b 100644 --- a/resources/lang/de_DE/default.po +++ b/resources/lang/de_DE/default.po @@ -427,7 +427,7 @@ msgstr "Dein Konto wurde gelöscht." msgid "" "Your %s account has been deleted. If you have any questions regarding your " -"account deletion, please contact the Info Desk. +"account deletion, please contact the Info Desk." msgstr "" "Dein %s-Konto wurde gelöscht. Wenn Du dazu Fragen hast, kontaktiere bitte " "den Info Desk."