mirror of
https://github.com/rickbarrette/redmine_qbo_calendar.git
synced 2026-11-17 21:50:37 -05:00
Fix permissions, holiday, hours, visibility and scheduling bugs
- customer_options is now covered by the add/edit permissions, so non-admin staff get the vehicle/estimate dropdowns - create_issues is now a POST member route with its own permission, checks add_issues on the target project, no longer redirects to a missing route, and has a button on the appointment page - "Last" week-of-month holidays (e.g. Memorial Day) now match every year - Cancelled and Call Out appointments no longer count toward hours - Calendar only shows appointments to users with View customer appointments, and only loads those near the displayed month - due_date skips weekends and holidays, matching the calendar layout - Subjects keep their casing; only the first letter is capitalized 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
+130
-17
No files matched your search
@@ -15,7 +15,9 @@
|
||||
all_holidays = Holiday.all
|
||||
|
||||
# Safely collect all unique CustomerAppointments across the entire calendar date range
|
||||
all_appointments = (calendar.startdt..calendar.enddt).flat_map { |date|
|
||||
# Prefer the list loaded by CalendarsControllerPatch; fall back to the calendar's own events
|
||||
# (e.g. if this partial is rendered somewhere else)
|
||||
all_appointments = @qbo_calendar_appointments || (calendar.startdt..calendar.enddt).flat_map { |date|
|
||||
calendar.events_on(date)
|
||||
}.select { |e| e.is_a?(CustomerAppointment) }.uniq
|
||||
|
||||
@@ -62,6 +64,9 @@
|
||||
calculate_event_hours = lambda do |event, target_day|
|
||||
if event.is_a?(Issue)
|
||||
event.estimated_hours.to_f
|
||||
elsif event.is_a?(CustomerAppointment) && !event.counts_toward_hours?
|
||||
# Cancelled / call-out appointments stay on the calendar but don't use scheduled time
|
||||
0.0
|
||||
elsif event.is_a?(CustomerAppointment)
|
||||
if event.duration.to_i > 1
|
||||
app_total_hours = if event.respond_to?(:estimated_hours) && event.estimated_hours.present?
|
||||
|
||||
Reference in new issue
Block a user