Remove Project Level Integration

This commit is contained in:
2026-01-27 18:04:32 -05:00
parent 68c1ec01fa
commit 896d5a64ba
7 changed files with 0 additions and 83 deletions

View File

@@ -12,7 +12,6 @@ class Vehicle < ActiveRecord::Base
belongs_to :customer belongs_to :customer
has_many :issues has_many :issues
has_many :projects
validates_presence_of :customer validates_presence_of :customer
validates :vin, uniqueness: true validates :vin, uniqueness: true
before_save :decode_vin before_save :decode_vin

View File

@@ -27,7 +27,6 @@ class CreateVehicles < ActiveRecord::Migration[5.1]
add_reference :vehicles, :customers, index: true add_reference :vehicles, :customers, index: true
add_reference :issues, :vehicle, index: true add_reference :issues, :vehicle, index: true
add_reference :projects, :vehicle, index: true
} }
rescue rescue
logger.error "Failed to create vehicles & refrences" logger.error "Failed to create vehicles & refrences"

View File

@@ -14,7 +14,6 @@ class UpdateVehicles < ActiveRecord::Migration[5.1]
reversible do |direction| reversible do |direction|
direction.up { direction.up {
rename_column :issues, :vehicles_id, :vehicle_id rename_column :issues, :vehicles_id, :vehicle_id
rename_column :projects, :vehicles_id, :vehicle_id
} }
rescue rescue
logger.error "Failed to update to use vehicle_id" logger.error "Failed to update to use vehicle_id"

View File

@@ -28,7 +28,6 @@ Redmine::Plugin.register :redmine_qbo_vehicles do
# Add safe attributes for core models # Add safe attributes for core models
Issue.safe_attributes 'vehicle_id' Issue.safe_attributes 'vehicle_id'
Project.safe_attributes 'vehicle_id'
# Permissions for security # Permissions for security
permission :view_vehicles, :vehicles => :new, :public => false permission :view_vehicles, :vehicles => :new, :public => false

View File

@@ -21,11 +21,6 @@ module Vehicles
f = context[:form] f = context[:form]
issue = context[:issue] issue = context[:issue]
# check project level vehicle ownership first
# if context[:project]
# selected_vehicle = context[:project].vehicle.id unless context[:project].vehicle.nil?
# end
# Check to see if the issue already belongs to a customer # Check to see if the issue already belongs to a customer
selected_vehicle = issue.vehicle.id unless issue.vehicle.nil? selected_vehicle = issue.vehicle.id unless issue.vehicle.nil?

View File

@@ -1,45 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2016 - 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 Vehicles
module Hooks
class ProjectsFormHookListener < Redmine::Hook::ViewListener
# Edit Project Form
def view_projects_form(context={})
f = context[:form]
# Check to see if there is a quickbooks user attached to the issue
selected_customer = context[:project].customer ? context[:project].customer : nil
selected_vehicle = context[:project].vehicle_id ? context[:project].vehicle_id : nil
# Load customer information
customer = Customer.find_by_id(selected_customer) if selected_customer
search_customer = f.autocomplete_field :customer,
autocomplete_customer_name_customers_path,
:selected => selected_customer,
:update_elements => {:id => '#project_customer_id', :value => '#project_customer'}
customer_id = f.hidden_field :customer_id, :id => "project_customer_id"
if context[:project].customer
vehicles = customer.vehicles.pluck(:name, :id).sort!
else
vehicles = [nil].compact
end
vehicle = f.select :vehicle_id, vehicles, :selected => selected_vehicle, include_blank: true
return "<p><label for=\"project_customer\">Customer</label>#{search_customer} #{customer_id}</p> <p>#{vehicle}</p>"
end
end
end
end

View File

@@ -1,29 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2016 - 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.
require_dependency 'project'
module Vehicles
module Patches
# Patches Redmine's Projects dynamically.
# Adds a relationships
module ProjectPatch
ActiveSupport.on_load(:active_record) do
Project.class_eval do
belongs_to :vehicle
end
end
end
end
end