Use redmine_qbo_calendar's configurable statuses; skip call-outs

The "statuses that get reminders" setting lists the statuses set up in redmine_qbo_calendar
(falling back to the old fixed list on older versions). Reminder runs and the appointment page's
reminder panel skip employee call-outs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-02 20:22:52 -05:00
1 parent acad2614c7
commit 48275a25be
4 files changed
+10 -6

No files matched your search

+1 -1
View File
@@ -3,7 +3,7 @@
Emails customers a reminder before their appointments in [redmine_qbo_calendar](https://github.com/rickbarrette/redmine_qbo_calendar), at the email address on their QuickBooks Online customer ([redmine_qbo](https://github.com/rickbarrette/redmine_qbo)). The email comes from your own mailbox (for example sales@yourdomain.com through Google Workspace), so there's nothing extra to pay for, and customers can reply to confirm or reschedule.
* **When**: a set number of days before the appointment at a set time (default: the day before at 4 PM), only between set hours (default 8 AM–8 PM), and not within a set number of hours of the appointment (default 2). An appointment booked after its reminder time gets one right away. Rescheduling an appointment sends a reminder for the new time.
* **Which**: appointments with the chosen statuses (default: Scheduled), with a customer who has an email address in QuickBooks and hasn't had reminders turned off.
* **Which**: appointments with the chosen statuses (default: Scheduled; the statuses are set up in redmine_qbo_calendar's settings), not employee call-outs, with a customer who has an email address in QuickBooks and hasn't had reminders turned off.
* **What**: a short plain-text and HTML email in your words (placeholders for the customer, vehicle, day, time and shop details), with the appointment attached as a calendar file. A footer says why they got it and to reply if they'd rather not get reminders.
* **Appointment page**: whether the reminder was sent (when, to whom), when it will be, or why it won't be, with **Send now** / **Send again**.
* **Customer page**: turn reminders off (or back on) for a customer.
@@ -1,6 +1,7 @@
<%# The reminder's status on an appointment's page (redmine_qbo_calendar's show_customer_appointment hook) %>
<% appointment = local_assigns[:appointment] %>
<% if appointment %>
<%# Not on an employee's call-out (redmine_qbo_calendar), which has no customer to remind %>
<% if appointment && !(appointment.respond_to?(:call_out?) && appointment.call_out?) %>
<% rs = RedmineQboReminders::ReminderStatus.for(appointment) %>
<% can_send = User.current.allowed_to?(:send_appointment_reminders, nil, global: true) %>
<div class="box appointment-reminder appointment-reminder-<%= rs.state %>">
@@ -14,7 +15,7 @@
when :scheduled then l(:text_reminder_scheduled, time: format_time(rs.at), email: rs.email)
when :off then l(:text_reminder_off)
when :opted_out then l(:text_reminder_opted_out)
when :status then l(:text_reminder_status, status: appointment.status.to_s.humanize)
when :status then l(:text_reminder_status, status: appointment.respond_to?(:status_record) ? appointment.status_record.name : appointment.status.to_s.humanize)
when :no_customer then l(:text_reminder_no_customer)
when :no_email then l(:text_reminder_no_email)
else l(:text_reminder_too_late)
@@ -85,10 +85,12 @@
<p>
<label><%= l(:label_reminders_statuses) %></label>
<%= hidden_field_tag "#{field.call('statuses')}[]", '', id: nil %>
<% CustomerAppointment::STATUSES.each do |status| %>
<%# The statuses set up in redmine_qbo_calendar's settings (older versions had a fixed list) %>
<% status_options = CustomerAppointment.respond_to?(:status_options) ? CustomerAppointment.status_options : CustomerAppointment::STATUSES.map { |st| [st.humanize, st] } %>
<% status_options.each do |label, status| %>
<label class="inline" style="margin-right: 10px">
<%= check_box_tag "#{field.call('statuses')}[]", status, s.statuses.include?(status), id: "reminders_status_#{status.parameterize}" %>
<%= status.humanize %>
<%= label %>
</label>
<% end %>
</p>
+2 -1
View File
@@ -37,7 +37,8 @@ module RedmineQboReminders
return result unless schedule.in_window?(now)
from, to = schedule.lookahead(now)
CustomerAppointment.where(date: from..to).includes(:customer).find_each do |appointment|
# Customer appointments only: employee call-outs (redmine_qbo_calendar) are kept in the same table
CustomerAppointment.where(date: from..to, event_type: [nil, '']).includes(:customer).find_each do |appointment|
consider(appointment, schedule)
end
log "Run finished: #{result}" if result.sent + result.failed > 0