mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 13:50:36 -05:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
This commit is contained in:
10 files changed
+21
-27
No files matched your search
@@ -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.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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)),
|
||||
|
||||
@@ -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 %>
|
||||
<i class="fa-solid fa-list-check"></i> <%= l(:button_create_issues_from_estimate) %>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%# The issues-from-estimate settings moved to redmine_qbo_billing %>
|
||||
<%# The issues-from-estimate settings moved to redmine_qbo %>
|
||||
<p>
|
||||
<%= 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') %>
|
||||
</p>
|
||||
@@ -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."
|
||||
@@ -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?}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in new issue
Block a user