Fold redmine_qbo_billing into redmine_qbo

Estimates, invoices and payments written in Redmine, issues from estimates,
and the QuickBooks product/service list and accounts are now part of this
plugin (the RedmineQboBilling code, its controllers, views, strings and
permissions), so there's one plugin and one version instead of two that had
to match.

- The customer page, estimate and invoice lists and the issue page render the
  Create Estimate / Create invoice / Receive payment and Edit links directly;
  the hooks that only existed to let billing add them are gone. Users without
  the billing permissions still get the links to QuickBooks.
- Migrations 043-046 create the items and accounts tables and the estimate
  line links, skipping whatever an existing database already has
  (redmine_qbo_lineitems' tables are used as they are), and copy calendar's
  existing estimate line links in.
- The billing settings are a section of this plugin's settings page.
- The hooks other plugins use stay: qbo_billing_issue_values,
  qbo_billing_validate, qbo_billing_issue_defaults, qbo_billing_issues_created
  and view_qbo_estimate_contextual.
- rake redmine_qbo:relate_estimate_issues

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
Claude committed 2026-10-30 23:47:01 -04:00
1 parent 48a4185c16
commit 9121e079a0
67 files changed
+5570 -19

No files matched your search

+55
View File
@@ -0,0 +1,55 @@
#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.
# Billing in Redmine: writing, editing and emailing QuickBooks estimates and invoices, receiving payments,
# the QuickBooks product/service list and accounts, and creating issues from estimates. Called from
# RedmineQbo.setup. (It began as the separate redmine_qbo_billing plugin, hence the name; other plugins use
# its hooks and RedmineQboBilling::EstimateWriter.create_estimate.)
module RedmineQboBilling
def self.setup
# Invoice lines that bill time activities need a LinkedTxn
RedmineQboBilling::Patches::InvoiceLineItemLinkedTxn.apply!
# Hooks
RedmineQboBilling::Hooks::QboHookListener
RedmineQboBilling::Hooks::IssueMileageListener
# Administration menu: the QuickBooks product/service list (accounts are reached from it)
Redmine::MenuManager.map :admin_menu do |menu|
menu.push :redmine_qbo_items, { controller: 'items', action: 'index' }, icon: 'list', caption: :label_items,
html: { class: 'icon icon-list' } unless menu.exists?(:redmine_qbo_items)
end
end
# True when the user may write estimates
def self.writer?(user = User.current)
user.allowed_to?(:write_estimates, nil, global: true)
end
# True when the user may email estimates to customers
def self.sender?(user = User.current)
user.allowed_to?(:send_estimates, nil, global: true)
end
# True when the user may receive customer payments
def self.payment_receiver?(user = User.current)
user.allowed_to?(:receive_payments, nil, global: true)
end
# True when the user may write invoices
def self.invoice_writer?(user = User.current)
user.allowed_to?(:write_invoices, nil, global: true)
end
# True when the user may email invoices to customers
def self.invoice_sender?(user = User.current)
user.allowed_to?(:send_invoices, nil, global: true)
end
end