From d98a8b8cc4ef944c2a7eb5db139d79fc092021d2 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Fri, 17 Nov 2017 10:14:05 -0500 Subject: [PATCH] Fixed Project releationships and database migration --- db/migrate/025_update_projects.rb | 4 ++-- init.rb | 3 ++- lib/project_patch.rb | 5 +++-- lib/projects_form_hook_listener.rb | 10 +--------- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/db/migrate/025_update_projects.rb b/db/migrate/025_update_projects.rb index 97749ac..d857412 100644 --- a/db/migrate/025_update_projects.rb +++ b/db/migrate/025_update_projects.rb @@ -10,7 +10,7 @@ class UpdateProjects < ActiveRecord::Migration def change - add_reference :projects, :customers, index: true - add_reference :projects, :vehicles, index: true + add_reference :projects, :customer, index: true + add_reference :projects, :vehicle, index: true end end diff --git a/init.rb b/init.rb index d85fc07..3aa5075 100644 --- a/init.rb +++ b/init.rb @@ -20,6 +20,7 @@ Redmine::Plugin.register :redmine_qbo do # Patches to the Redmine core. Will not work in development mode require_dependency 'issue_patch' + require_dependency 'project_patch' require_dependency 'user_patch' require_dependency 'query_patch' require_dependency 'time_entry_query_patch' @@ -29,7 +30,7 @@ Redmine::Plugin.register :redmine_qbo do name 'Redmine Quickbooks Online plugin' author 'Rick Barrette' description 'This is a plugin for Redmine to intergrate with Quickbooks Online to allow for seamless intergration CRM and invoicing of completed issues' - version '0.5.0' + version '0.6.0' url 'https://github.com/rickbarrette/redmine_qbo' author_url 'http://rickbarrette.org' settings :default => {'empty' => true}, :partial => 'qbo/settings' diff --git a/lib/project_patch.rb b/lib/project_patch.rb index 19791ac..20c3809 100644 --- a/lib/project_patch.rb +++ b/lib/project_patch.rb @@ -24,7 +24,8 @@ module ProjectPatch unloadable # Send unloadable so it will not be unloaded in development belongs_to :customer, primary_key: :id belongs_to :vehicle, primary_key: :id - end + end + end end module ClassMethods @@ -35,5 +36,5 @@ module InstanceMethods end -# Add module to Issue +# Add module to Project Project.send(:include, ProjectPatch) diff --git a/lib/projects_form_hook_listener.rb b/lib/projects_form_hook_listener.rb index 70252a6..f1a66f1 100644 --- a/lib/projects_form_hook_listener.rb +++ b/lib/projects_form_hook_listener.rb @@ -10,15 +10,7 @@ class ProjectsFormHookListener < Redmine::Hook::ViewListener - # Load the javascript - def view_layouts_base_html_head(context = {}) - js = javascript_include_tag 'application', :plugin => 'redmine_qbo' - js += javascript_include_tag 'autocomplete-rails', :plugin => 'redmine_qbo' - return js - end - - # Edit Issue Form - # Show a dropdown for quickbooks contacts + # Edit Project Form def view_projects_form(context={}) f = context[:form]