mirror of
https://github.com/rickbarrette/redmine_qbo_vehicles.git
synced 2026-11-18 02:40:37 -05:00
Listens for redmine_qbo_billing's hooks: qbo_billing_issue_values gives each work order's VIN, so the invoice's VIN box fills in when its time or estimates are imported; qbo_billing_validate stops an invoice whose work orders are for more than one vehicle (one vehicle per invoice). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BiwYMjhoQvL7XsKKfRz4pM
32 lines
1.8 KiB
Ruby
32 lines
1.8 KiB
Ruby
#The MIT License (MIT)
|
|
#
|
|
#Copyright (c) 2026 rick barrette
|
|
#
|
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
#
|
|
#The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
#
|
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
module RedmineQboVehicles
|
|
def self.setup
|
|
Issue.prepend Vehicles::Patches::IssuePatch
|
|
Customer.prepend Vehicles::Patches::CustomerPatch
|
|
|
|
Vehicles::Hooks::CustomerShowHookListener
|
|
Vehicles::Hooks::IssuesFormHookListener
|
|
Vehicles::Hooks::IssuesShowHookListener
|
|
Vehicles::Hooks::PdfHookListener
|
|
Vehicles::Hooks::ViewHookListener
|
|
Vehicles::Hooks::CustomerAppointmentShowHookListener
|
|
Vehicles::Hooks::BillingHookListener
|
|
|
|
# If the SubtaskFieldCopier plugin is installed, register our fields
|
|
if defined?(SubtaskFieldCopier)
|
|
SubtaskFieldCopier.registered_fields << :vehicle
|
|
|
|
# Ensure there are no duplicates in case of hot-reloads in development mode
|
|
SubtaskFieldCopier.registered_fields.uniq!
|
|
end
|
|
end
|
|
end |