47 lines
2.8 KiB
Ruby
47 lines
2.8 KiB
Ruby
#The MIT License (MIT)
|
|
#
|
|
#Copyright (c) 2026 rick barrette
|
|
#
|
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#
|
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
Redmine::Plugin.register :redmine_qbo_bonus do
|
|
|
|
# About
|
|
name 'Redmine QBO Bonus plugin'
|
|
author 'Rick Barrette'
|
|
description 'Weekly billable hours bonus for technicians (SOP-OPS-012): totals the shop\'s billable hours for a week, ' \
|
|
'and credits each qualifying technician\'s QuickBooks customer account with an emailed credit memo'
|
|
version '2026.11.2'
|
|
url 'https://gitea.rickbarrette.org/ricky/redmine_qbo_bonus'
|
|
author_url 'https://barrettefabrication.com'
|
|
requires_redmine version_or_higher: '7.0.0'
|
|
|
|
# Customers, products/services and the QuickBooks connection live in redmine_qbo
|
|
begin
|
|
requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.11.0'
|
|
rescue Redmine::PluginNotFound
|
|
raise 'Please install the redmine_qbo plugin (https://github.com/rickbarrette/redmine_qbo)'
|
|
end
|
|
|
|
settings default: RedmineQboBonus::Settings::DEFAULTS.dup, partial: 'settings/qbo_bonus'
|
|
|
|
# Seeing a week's hours and bonuses (e.g. the Foreman), without the weeks run, running them or opening the credit memos
|
|
permission :view_tech_bonuses, { tech_bonuses: [:current, :show] }, global: true
|
|
# The weeks run, previewing a week's bonus, creating and emailing its credit memos
|
|
permission :run_tech_bonuses, { tech_bonuses: [:index, :current, :show, :create, :resend, :pdf] }, global: true
|
|
|
|
menu :top_menu, :tech_bonuses, { controller: 'tech_bonuses', action: 'current' },
|
|
caption: :label_tech_bonus_plural, after: :my_page,
|
|
if: proc { RedmineQboBonus.visible? }
|
|
|
|
# The technicians who earn the bonus and their QuickBooks customer accounts
|
|
menu :admin_menu, :bonus_technicians, { controller: 'bonus_technicians', action: 'index' },
|
|
caption: :label_bonus_technician_plural, icon: 'user', html: { class: 'icon icon-user' }
|
|
end
|
|
|
|
RedmineQboBonus.setup
|