View tech bonuses permission, for the Foreman

A global "View tech bonuses" permission shows the weeks run and each
week's hours, tiers and bonuses, read-only: no attendance boxes, run
button or Email again, and no customer accounts, emailed-to addresses,
or QuickBooks/PDF links. "Run tech bonuses" is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-16 12:45:57 -05:00
1 parent a2ecb74c1d
commit 07e79a3c00
7 files changed
+58 -9

No files matched your search

+6
View File
@@ -12,10 +12,16 @@ module RedmineQboBonus
def self.setup; end
# May run the bonus (create and email credit memos)
def self.allowed?(user = User.current)
user.allowed_to?(:run_tech_bonuses, nil, global: true)
end
# May see the bonus pages (run them, or only view them)
def self.visible?(user = User.current)
allowed?(user) || user.allowed_to?(:view_tech_bonuses, nil, global: true)
end
# 95.5 => "95.5", 110.0 => "110", 87.583 => "87.58"
def self.format_hours(hours)
rounded = hours.to_d.round(2)