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

+83
View File
@@ -0,0 +1,83 @@
<div class="box tabular settings">
<p>
<label for="settings_expiration_days"><%= l(:label_estimate_expiration_days) %></label>
<%= number_field_tag 'settings[expiration_days]', @settings['expiration_days'], id: 'settings_expiration_days',
min: 0, step: 1, size: 6 %>
<em class="info"><%= l(:text_estimate_expiration_days) %></em>
</p>
<p>
<label for="settings_replaceable_item_ids"><%= l(:label_replaceable_items) %></label>
<%= hidden_field_tag 'settings[replaceable_item_ids][]', '', id: nil %>
<%= select_tag 'settings[replaceable_item_ids][]',
options_from_collection_for_select(Item.where(active: true).order(:name), :id, :name,
Array(@settings['replaceable_item_ids']).map(&:to_s)),
multiple: true, size: 8, id: 'settings_replaceable_item_ids' %>
<em class="info"><%= l(:text_replaceable_items) %></em>
</p>
</div>
<%# Issues from estimates (moved from redmine_qbo_calendar; its old values are shown until these are saved) %>
<% issue_builder = RedmineQboBilling::EstimateIssueBuilder %>
<fieldset class="box tabular">
<legend><%= l(:label_estimate_issue_settings) %></legend>
<p>
<label for="settings_issue_item_codes"><%= l(:label_estimate_item_codes) %></label>
<%= text_area_tag 'settings[issue_item_codes]', issue_builder.item_codes.join("\n"), rows: 5, cols: 30, id: 'settings_issue_item_codes' %>
<em class="info"><%= l(:text_estimate_item_codes_info) %></em>
</p>
<p>
<label for="settings_issue_default_project_id"><%= l(:label_default_project) %></label>
<%= select_tag 'settings[issue_default_project_id]',
project_tree_options_for_select(Project.active.sorted, selected: Project.find_by(id: issue_builder.default_project_id)),
include_blank: true, id: 'settings_issue_default_project_id' %>
<em class="info"><%= l(:text_default_project_info) %></em>
</p>
<p>
<label for="settings_issue_default_tracker_id"><%= l(:label_default_tracker) %></label>
<%= select_tag 'settings[issue_default_tracker_id]',
options_from_collection_for_select(Tracker.sorted, :id, :name, issue_builder.default_tracker_id),
include_blank: true, id: 'settings_issue_default_tracker_id' %>
<em class="info"><%= l(:text_default_tracker_info) %></em>
</p>
</fieldset>
<%# QuickBooks product/service list and income accounts (moved from redmine_qbo_lineitems) %>
<div class="box tabular">
<p>
<label><strong><%= t(:label_item_count) %></strong></label>
<%= Item.count %>
<em style="color: #777; font-size: 0.9em; margin-left: 8px;">
(@ <%= Item.last_sync %>)
</em>
</p>
<p>
<label><strong><%= t(:label_account_count) %></strong></label>
<%= Account.count %>
<em style="color: #777; font-size: 0.9em; margin-left: 8px;">
(@ <%= Account.last_sync %>)
</em>
</p>
<p>
<label><strong><%= t(:label_last_sync) %> (QBO)</strong></label>
<%= Qbo.exists? ? Qbo.last_sync : l(:label_never_synced) %>
</p>
<p>
<label><strong><%= t(:label_default_account) %></strong></label>
<%= Account.get_default %>
</p>
</div>
<fieldset class="box">
<legend><%= l(:label_management_and_sync) %></legend>
<div style="margin-bottom: 15px;">
<%= link_to t(:label_sync_now_items), sync_items_path, class: 'button icon icon-reload' %>
<%= link_to t(:label_sync_now_accounts), sync_accounts_path, class: 'button icon icon-reload' %>
</div>
<div>
<%= link_to t(:label_items), items_path, class: 'icon icon-list' %>
<span style="margin: 0 10px; color: #ccc;">|</span>
<%= link_to t(:label_accounts), accounts_path, class: 'icon icon-list' %>
</div>
</fieldset>
+5 -1
View File
@@ -76,4 +76,8 @@
<%= link_to t(:label_sync_now_invoices), invoices_sync_path, class: 'button icon icon-reload' %>
<%= link_to t(:label_sync_now_estimate), estimates_sync_path, class: 'button icon icon-reload' %>
</div>
</fieldset>
</fieldset>
<%# Billing: estimates, issues from estimates, invoices, the product/service list and accounts %>
<h3><%= l(:label_billing_settings) %></h3>
<%= render partial: 'qbo/billing_settings', locals: { settings: settings } %>