From 13e8c07c0d7dba4a74b84d96a222c8b9ed41cda7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 30 Oct 2026 23:49:17 -0400 Subject: [PATCH] Depend on redmine_qbo for estimate issues and labor hours Billing has been folded into redmine_qbo 2026.11.0; the settings link now opens redmine_qbo's settings. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM --- README.md | 9 +++++---- .../customer_appointments_controller.rb | 4 ++-- app/models/customer_appointment.rb | 2 +- .../_estimate_actions.html.erb | 2 +- app/views/customer_appointments/show.html.erb | 2 +- .../settings/_qbo_calendar_settings.html.erb | 4 ++-- config/locales/en.yml | 4 ++-- init.rb | 17 +++++------------ .../hooks/billing_hook_listener.rb | 2 +- .../hooks/customer_actions_hook_listener.rb | 2 +- 10 files changed, 21 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index c7b8fd2..33a5aec 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ This plugin allows for adding customer appointment capability to the Redmine cal * **Parent Plugin:** [Redmine QuickBooks Online](https://github.com/rickbarrette/redmine_qbo) (must be installed and configured) -* **Billing Plugin:** [Redmine QuickBooks Billing](https://github.com/rickbarrette/redmine_qbo_billing). It creates issues from an appointment's estimate and works out the estimate's labor hours. +* Version 2026.11.0 or newer of redmine_qbo: it creates issues from an appointment's estimate and works out the estimate's labor hours. --- @@ -21,6 +21,7 @@ This plugin allows for adding customer appointment capability to the Redmine cal | Plugin Version | Redmine Version | Parent Plugin Version | | --- | --- | --- | | 2026.8.0+ | 7.0.x | 2026.8.0+ | +| 2026.10.0+ | 7.0.x | 2026.11.0+ | --- @@ -28,9 +29,9 @@ This plugin allows for adding customer appointment capability to the Redmine cal Add appointments to the redmine calanedar with the abiltiy to attach a QBO customer, QBO Vehicle, QBO Estimate, ect. -* An appointment's hours can't be less than its estimate's labor hours (the lines matching redmine_qbo_billing's estimate item codes). Picking an estimate raises the hours to match. -* The appointment page lists the issues linked to its estimate, and **Create Issues from Estimate** opens redmine_qbo_billing's Create issues page with the appointment's dates, technician and vehicle. -* Estimate pages in redmine_qbo_billing get an **Add appointment** link. +* An appointment's hours can't be less than its estimate's labor hours (the lines matching redmine_qbo's estimate item codes). Picking an estimate raises the hours to match. +* The appointment page lists the issues linked to its estimate, and **Create Issues from Estimate** opens redmine_qbo's Create issues page with the appointment's dates, technician and vehicle. +* Estimate pages in redmine_qbo get an **Add appointment** link. --- diff --git a/app/controllers/customer_appointments_controller.rb b/app/controllers/customer_appointments_controller.rb index 27644a6..617b629 100644 --- a/app/controllers/customer_appointments_controller.rb +++ b/app/controllers/customer_appointments_controller.rb @@ -24,7 +24,7 @@ class CustomerAppointmentsController < ApplicationController } end - # The estimate's labor hours (redmine_qbo_billing's item codes), so the form can make sure the + # The estimate's labor hours (redmine_qbo's item codes), so the form can make sure the # appointment's hours aren't less def estimate_hours estimate = Estimate.find_by(id: params[:estimate_id]) @@ -109,7 +109,7 @@ class CustomerAppointmentsController < ApplicationController private - # Links from an estimate (redmine_qbo_billing) pass the estimate and vehicle; each is used only when it + # Links from an estimate (redmine_qbo) pass the estimate and vehicle; each is used only when it # belongs to the appointment's customer def prefill_estimate_and_vehicle customer = @appointment.customer diff --git a/app/models/customer_appointment.rb b/app/models/customer_appointment.rb index fb2c270..b9a171e 100644 --- a/app/models/customer_appointment.rb +++ b/app/models/customer_appointment.rb @@ -81,7 +81,7 @@ class CustomerAppointment < ActiveRecord::Base end # The estimate's labor hours rounded up to whole hours (appointment hours are whole numbers): the - # quantities of its lines whose item matches redmine_qbo_billing's item codes (e.g. Labor). 0 if the + # quantities of its lines whose item matches redmine_qbo's item codes (e.g. Labor). 0 if the # estimate can't be read from QuickBooks. def self.estimate_labor_hours(estimate) return 0 if estimate.nil? diff --git a/app/views/customer_appointments/_estimate_actions.html.erb b/app/views/customer_appointments/_estimate_actions.html.erb index 156b454..696660c 100644 --- a/app/views/customer_appointments/_estimate_actions.html.erb +++ b/app/views/customer_appointments/_estimate_actions.html.erb @@ -1,4 +1,4 @@ -<%# Add appointment link on an estimate's page (redmine_qbo_billing) %> +<%# Add appointment link on an estimate's page (redmine_qbo) %> <% if User.current.allowed_to?(:add_customer_appointments, nil, global: true) %> <% vehicle = customer.vehicles.detect { |v| v.vin.to_s.casecmp?(vin.to_s.strip) } if vin.present? && customer.respond_to?(:vehicles) %> <%= link_to sprite_icon('time-add', l(:label_add_appointment)), diff --git a/app/views/customer_appointments/show.html.erb b/app/views/customer_appointments/show.html.erb index 64b4946..1dd68ff 100644 --- a/app/views/customer_appointments/show.html.erb +++ b/app/views/customer_appointments/show.html.erb @@ -14,7 +14,7 @@ <% end %> <% end %> - <%# Issues from the estimate are made by redmine_qbo_billing, with this appointment's dates, technician and vehicle %> + <%# Issues from the estimate are made by redmine_qbo, with this appointment's dates, technician and vehicle %> <% if @appointment.estimate && User.current.allowed_to?(:create_estimate_issues, nil, global: true) %> <%= link_to issues_preview_qbo_estimate_path(@appointment.estimate_id, appointment_id: @appointment.id) do %> <%= l(:button_create_issues_from_estimate) %> diff --git a/app/views/settings/_qbo_calendar_settings.html.erb b/app/views/settings/_qbo_calendar_settings.html.erb index 008355a..2216f17 100644 --- a/app/views/settings/_qbo_calendar_settings.html.erb +++ b/app/views/settings/_qbo_calendar_settings.html.erb @@ -1,5 +1,5 @@ -<%# The issues-from-estimate settings moved to redmine_qbo_billing %> +<%# The issues-from-estimate settings moved to redmine_qbo %>

<%= l(:text_estimate_issue_settings_moved) %> - <%= link_to l(:label_redmine_qbo_billing_settings), plugin_settings_path(id: 'redmine_qbo_billing') %> + <%= link_to l(:label_redmine_qbo_settings), plugin_settings_path(id: 'redmine_qbo') %>

diff --git a/config/locales/en.yml b/config/locales/en.yml index 6ada001..7363372 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -88,5 +88,5 @@ en: title_customer_appointments: Customer Appointments error_hours_less_than_estimate: "The hours can't be less than the %{hours} labor hours on estimate #%{estimate}" label_estimate_issues: "Issues for estimate #%{estimate}" - label_redmine_qbo_billing_settings: "Redmine QBO Billing settings" - text_estimate_issue_settings_moved: "Creating issues from estimates moved to redmine_qbo_billing: the item codes, default project and default tracker are set there." + label_redmine_qbo_settings: "Redmine QBO settings (Billing)" + text_estimate_issue_settings_moved: "Creating issues from estimates moved to redmine_qbo: the item codes, default project and default tracker are set there." diff --git a/init.rb b/init.rb index ddaa106..d189eb4 100644 --- a/init.rb +++ b/init.rb @@ -20,7 +20,7 @@ Redmine::Plugin.register :redmine_qbo_calendar do requires_redmine version_or_higher: '7.0.0' # Item codes: which QBO estimate items can become issues (e.g. Labor, Alignments) - # The issues-from-estimate settings moved to redmine_qbo_billing, which reads these old values until its + # The issues-from-estimate settings moved to redmine_qbo, which reads these old values until its # own are saved, so they're still registered here settings default: { 'item_codes' => "Labor", 'default_tracker_id' => '', 'default_project_id' => '' }, partial: 'settings/qbo_calendar_settings' @@ -28,28 +28,21 @@ Redmine::Plugin.register :redmine_qbo_calendar do # Add Holidays index to the Redmine Administration Menu menu :admin_menu, :holidays, { controller: 'holidays', action: 'index' }, caption: :label_holiday_plural, html: { class: 'icon icon-list' } - # Ensure redmine_qbo is installed + # Ensure redmine_qbo is installed: creating issues from estimates and estimate labor hours live there + # (from 2026.11.0) begin - requires_redmine_plugin :redmine_qbo, version_or_higher: '2026.8.2' + 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 - # Creating issues from estimates and estimate labor hours live in redmine_qbo_billing (it sorts before this - # plugin, so Redmine has already loaded it) - begin - requires_redmine_plugin :redmine_qbo_billing, version_or_higher: '2026.10.0' - rescue Redmine::PluginNotFound - raise 'Please install the redmine_qbo_billing plugin (https://github.com/rickbarrette/redmine_qbo_billing)' - end - # Global Permissions permission :view_customer_appointments, { customer_appointments: [:index, :show, :history] }, global: true # customer_options feeds the vehicle/estimate dropdowns on the new and edit forms permission :add_customer_appointments, { customer_appointments: [:new, :create, :customer_options, :estimate_hours] }, global: true permission :edit_customer_appointments, { customer_appointments: [:edit, :update, :customer_options, :estimate_hours] }, global: true permission :delete_customer_appointments, { customer_appointments: [:destroy] }, global: true - # Creating issues from an appointment's estimate is redmine_qbo_billing's "Create issues from estimates" + # Creating issues from an appointment's estimate is redmine_qbo's "Create issues from estimates" # Register top menu items menu :top_menu, :calendar, { controller: :calendars, action: :show }, caption: :label_calendar, if: Proc.new {User.current.logged?} diff --git a/lib/redmine_qbo_calendar/hooks/billing_hook_listener.rb b/lib/redmine_qbo_calendar/hooks/billing_hook_listener.rb index ff8200c..87a1f18 100644 --- a/lib/redmine_qbo_calendar/hooks/billing_hook_listener.rb +++ b/lib/redmine_qbo_calendar/hooks/billing_hook_listener.rb @@ -11,7 +11,7 @@ module RedmineQboCalendar module Hooks - # Hooks for redmine_qbo_billing + # Hooks for redmine_qbo's billing class BillingHookListener < Redmine::Hook::Listener # "Create issues" opened from an appointment (?appointment_id=): the issues get the appointment's dates, diff --git a/lib/redmine_qbo_calendar/hooks/customer_actions_hook_listener.rb b/lib/redmine_qbo_calendar/hooks/customer_actions_hook_listener.rb index a04215d..b7264d5 100644 --- a/lib/redmine_qbo_calendar/hooks/customer_actions_hook_listener.rb +++ b/lib/redmine_qbo_calendar/hooks/customer_actions_hook_listener.rb @@ -20,7 +20,7 @@ module RedmineQboCalendar locals: { customer: context[:customer] }) end - # Adds "Add appointment" to an estimate's page in redmine_qbo_billing (:view_qbo_estimate_contextual), + # Adds "Add appointment" to an estimate's page in redmine_qbo (:view_qbo_estimate_contextual), # with the customer, the estimate and the vehicle matching its VIN filled in def view_qbo_estimate_contextual(context = {}) customer = Customer.find_by(id: context[:customer_id])