Inital update for redmine 4.0+ compatibility

This commit is contained in:
2022-02-01 20:53:20 -05:00
parent 4b34852c72
commit 7cc8a946fd
21 changed files with 94 additions and 166 deletions

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -27,14 +27,18 @@ class CustomersController < ApplicationController
include SortHelper include SortHelper
helper :timelog helper :timelog
before_filter :add_customer, :only => :new before_action :add_customer, :only => :new
before_filter :view_customer, :except => :new before_action :view_customer, :except => :new
skip_before_filter :verify_authenticity_token, :check_if_login_required, :only => [:view] skip_before_action :verify_authenticity_token, :check_if_login_required, :only => [:view]
default_search_scope :names default_search_scope :names
autocomplete :customer, :name, :full => true, :extra_data => [:id] autocomplete :customer, :name, :full => true, :extra_data => [:id]
def allowed_params
params.require(:customer).permit(:name, :email, :primary_phone, :mobile_phone, :phone_number)
end
# getter method for a customer's vehicles # getter method for a customer's vehicles
# used for customer autocomplete field / issue form # used for customer autocomplete field / issue form
def filter_vehicles_by_customer def filter_vehicles_by_customer
@@ -70,7 +74,7 @@ class CustomersController < ApplicationController
# create a new customer # create a new customer
def create def create
@customer = Customer.new(params[:customer]) @customer = Customer.new(allowed_params)
if @customer.save if @customer.save
flash[:notice] = "New Customer Created" flash[:notice] = "New Customer Created"
redirect_to @customer redirect_to @customer
@@ -104,7 +108,7 @@ class CustomersController < ApplicationController
def update def update
begin begin
@customer = Customer.find_by_id(params[:id]) @customer = Customer.find_by_id(params[:id])
if @customer.update_attributes(params[:customer]) if @customer.update_attributes(allowed_params)
flash[:notice] = "Customer updated" flash[:notice] = "Customer updated"
redirect_to @customer redirect_to @customer
else else

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -12,7 +12,7 @@ class EstimateController < ApplicationController
include AuthHelper include AuthHelper
before_filter :require_user before_action :require_user
# #
# Downloads and forwards the estimate pdf # Downloads and forwards the estimate pdf

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -12,8 +12,8 @@ class InvoiceController < ApplicationController
include AuthHelper include AuthHelper
before_filter :require_user, :unless => proc {|c| session[:token].nil? } before_action :require_user, :unless => proc {|c| session[:token].nil? }
skip_before_filter :verify_authenticity_token, :check_if_login_required, :unless => proc {|c| session[:token].nil? } skip_before_action :verify_authenticity_token, :check_if_login_required, :unless => proc {|c| session[:token].nil? }
# #
# Downloads and forwards the invoice pdf # Downloads and forwards the invoice pdf

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2018 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -14,7 +14,7 @@ class LineItemsController < ApplicationController
include AuthHelper include AuthHelper
before_filter :require_user before_action :require_user
# display all line items for an issue # display all line items for an issue
def index def index

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -12,7 +12,7 @@ class PaymentsController < ApplicationController
include AuthHelper include AuthHelper
before_filter :check_permissions before_action :check_permissions
def new def new
@payment = Payment.new @payment = Payment.new

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -15,8 +15,8 @@ class QboController < ApplicationController
include AuthHelper include AuthHelper
before_filter :require_user, :except => :qbo_webhook before_action :require_user, :except => :qbo_webhook
skip_before_filter :verify_authenticity_token, :check_if_login_required, :only => [:qbo_webhook] skip_before_action :verify_authenticity_token, :check_if_login_required, :only => [:qbo_webhook]
# #
# Called when the QBO Top Menu us shown # Called when the QBO Top Menu us shown

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -14,7 +14,11 @@ class VehiclesController < ApplicationController
include AuthHelper include AuthHelper
before_filter :require_user before_action :require_user
def allowed_params
params.require(:vehicle).permit(:year, :make, :model, :customer_id, :notes, :vin)
end
# display a list of all vehicles # display a list of all vehicles
def index def index
@@ -43,7 +47,7 @@ class VehiclesController < ApplicationController
# create a new vehicle # create a new vehicle
def create def create
@vehicle = Vehicle.new(params[:vehicle]) @vehicle = Vehicle.new(allowed_params)
if @vehicle.save if @vehicle.save
flash[:notice] = "New Vehicle Created" flash[:notice] = "New Vehicle Created"
redirect_to @vehicle redirect_to @vehicle
@@ -78,7 +82,7 @@ class VehiclesController < ApplicationController
@customer = params[:customer] @customer = params[:customer]
begin begin
@vehicle = Vehicle.find_by_id(params[:id]) @vehicle = Vehicle.find_by_id(params[:id])
if @vehicle.update_attributes(params[:vehicle]) if @vehicle.update_attributes(allowed_params)
flash[:notice] = "Vehicle updated" flash[:notice] = "Vehicle updated"
redirect_to @vehicle redirect_to @vehicle
else else
@@ -117,4 +121,4 @@ class VehiclesController < ApplicationController
found_non_zero found_non_zero
end end
end end

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -17,7 +17,7 @@ class Customer < ActiveRecord::Base
has_many :qbo_estimates has_many :qbo_estimates
has_many :vehicles has_many :vehicles
attr_accessible :name, :notes, :email, :primary_phone, :mobile_phone, :phone_number #attr_accessible :name, :notes, :email, :primary_phone, :mobile_phone, :phone_number
validates_presence_of :id, :name validates_presence_of :id, :name
self.primary_key = :id self.primary_key = :id

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -11,7 +11,7 @@
class CustomerToken < ActiveRecord::Base class CustomerToken < ActiveRecord::Base
unloadable unloadable
has_many :issues has_many :issues
attr_accessible :token, :expires_at, :issue_id #attr_accessible :token, :expires_at, :issue_id
validates_presence_of :expires_at, :issue_id validates_presence_of :expires_at, :issue_id
before_create :generate_token before_create :generate_token

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2018 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -14,7 +14,7 @@ class LineItem < ActiveRecord::Base
belongs_to :issue belongs_to :issue
attr_accessible :amount, :description, :unit_price, :quantity, :item_id #attr_accessible :amount, :description, :unit_price, :quantity, :item_id
validates_presence_of :amount, :description, :unit_price, :quantity validates_presence_of :amount, :description, :unit_price, :quantity
def add_to_invoice(invoice) def add_to_invoice(invoice)

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -11,7 +11,7 @@
class QboEmployee < ActiveRecord::Base class QboEmployee < ActiveRecord::Base
unloadable unloadable
has_many :users has_many :users
attr_accessible :name #attr_accessible :name
validates_presence_of :id, :name validates_presence_of :id, :name
def self.get_base def self.get_base

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -13,7 +13,7 @@ class QboEstimate < ActiveRecord::Base
has_and_belongs_to_many :issues has_and_belongs_to_many :issues
belongs_to :customer belongs_to :customer
attr_accessible :doc_number, :id #attr_accessible :doc_number, :id
validates_presence_of :doc_number, :id validates_presence_of :doc_number, :id
self.primary_key = :id self.primary_key = :id

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -13,7 +13,7 @@ class QboInvoice < ActiveRecord::Base
has_and_belongs_to_many :issues has_and_belongs_to_many :issues
belongs_to :customer belongs_to :customer
attr_accessible :doc_number, :id #attr_accessible :doc_number, :id
validates_presence_of :doc_number, :id validates_presence_of :doc_number, :id
self.primary_key = :id self.primary_key = :id

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -11,7 +11,7 @@
class QboItem < ActiveRecord::Base class QboItem < ActiveRecord::Base
unloadable unloadable
has_many :issues has_many :issues
attr_accessible :name #attr_accessible :name
validates_presence_of :id, :name validates_presence_of :id, :name
self.primary_key = :id self.primary_key = :id

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -12,7 +12,7 @@ class QboPurchase < ActiveRecord::Base
unloadable unloadable
belongs_to :issues belongs_to :issues
belongs_to :qbo_customer belongs_to :qbo_customer
attr_accessible :description #attr_accessible :description
validates_presence_of :id, :line_id, :description, :qbo_customer_id validates_presence_of :id, :line_id, :description, :qbo_customer_id
def self.get_base def self.get_base

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -15,7 +15,7 @@ class Vehicle < ActiveRecord::Base
belongs_to :customer belongs_to :customer
has_many :issues, :foreign_key => 'vehicles_id' has_many :issues, :foreign_key => 'vehicles_id'
attr_accessible :year, :make, :model, :customer_id, :notes, :vin #attr_accessible :year, :make, :model, :customer_id, :notes, :vin
validates_presence_of :customer validates_presence_of :customer
validates :vin, uniqueness: true validates :vin, uniqueness: true

View File

@@ -1,18 +0,0 @@
#The MIT License (MIT)
#
#Copyright (c) 2017 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.
# This sidekiq worker class will handle emailing weekly time reports
class EmailWorker
include Sidekiq::Worker
def perform()
# email something
end
end

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2020 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -28,10 +28,11 @@ Redmine::Plugin.register :redmine_qbo do
require_dependency 'pdf_patch' require_dependency 'pdf_patch'
require_dependency 'attachments_controller_patch' require_dependency 'attachments_controller_patch'
# About
name 'Redmine Quickbooks Online plugin' name 'Redmine Quickbooks Online plugin'
author 'Rick Barrette' 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' 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.8.1' version '1.0.0'
url 'https://github.com/rickbarrette/redmine_qbo' url 'https://github.com/rickbarrette/redmine_qbo'
author_url 'http://rickbarrette.org' author_url 'http://rickbarrette.org'
settings :default => {'empty' => true}, :partial => 'qbo/settings' settings :default => {'empty' => true}, :partial => 'qbo/settings'
@@ -53,6 +54,7 @@ Redmine::Plugin.register :redmine_qbo do
# set per_page globally # set per_page globally
WillPaginate.per_page = 20 WillPaginate.per_page = 20
# Permissions for security
permission :view_customers, :customers => :index, :public => false permission :view_customers, :customers => :index, :public => false
permission :add_customers, :customers => :new, :public => false permission :add_customers, :customers => :new, :public => false
permission :view_payments, :payments => :index, :public => false permission :view_payments, :payments => :index, :public => false

View File

@@ -1,3 +1,13 @@
#The MIT License (MIT)
#
#Copyright (c) 2022 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 'redmine/export/pdf' require_dependency 'redmine/export/pdf'
require_dependency 'redmine/export/pdf/issues_pdf_helper' require_dependency 'redmine/export/pdf/issues_pdf_helper'
@@ -7,7 +17,9 @@ module IssuesPdfHelperPatch
base.send(:include, InstanceMethods) base.send(:include, InstanceMethods)
base.class_eval do base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development unloadable # Send unloadable so it will not be unloaded in development
alias_method_chain :issue_to_pdf, :patch alias_method :issue_to_pdf, :issue_to_pdf_with_patch
alias_method :issue_to_pdf_with_patch, :issue_to_pdf
end end
end end

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -11,62 +11,24 @@
require_dependency 'issue_query' require_dependency 'issue_query'
module QueryPatch module QueryPatch
def self.included(base) # :nodoc: # Add qbo options to the aviable columns
base.extend(ClassMethods) def available_columns
unless @available_columns
base.send(:include, InstanceMethods) @available_columns = self.class.available_columns.dup
@available_columns << QueryColumn.new(:customer, :sortable => "#{Customer.table_name}.name", :groupable => true, :caption => :field_customer)
# Same as typing in the class @available_columns << QueryColumn.new(:qbo_billed, :sortable => "#{TimeEntry.table_name}.qbo_billed", :groupable => true, :caption => :field_qbo_billed)
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
alias_method_chain :available_columns, :qbo
alias_method_chain :available_filters, :qbo
end end
end super
module ClassMethods
end end
module InstanceMethods # Add customers to filters
def initialize_available_filters
def available_columns_with_qbo add_available_filter "customer", :type => :text
unless @available_columns super
@available_columns = available_columns_without_qbo
@available_columns << QueryColumn.new(:customer, :sortable => "#{Customer.table_name}.name", :groupable => true, :caption => :field_customer)
@available_columns << QueryColumn.new(:qbo_billed, :sortable => "#{TimeEntry.table_name}.qbo_billed", :groupable => true, :caption => :field_qbo_billed)
end
@available_columns
end
def available_filters_with_qbo
unless @available_filters
@available_filters = available_filters_without_qbo
#qbo_filters = {
# :customer => {
# :id => l(:field_customer),
# :type => :integer,
# :order => @available_filters.size + 1},
#}
#qbo_filters = {
# "customer_id" => {
# :id => :customer_id,
# :type => :list_optional
#:order => @available_filters.size + 1,
#:values => Customer.find(:all).collect { |c| [c.name, c.id.to_s]}
# }
#}
#@available_filters.merge!(qbo_filters)
end
@available_filters
end
end end
end end
# Add module to Issue # Add module to Issue
IssueQuery.send(:include, QueryPatch) IssueQuery.send(:prepend, QueryPatch)

View File

@@ -1,6 +1,6 @@
#The MIT License (MIT) #The MIT License (MIT)
# #
#Copyright (c) 2017 rick barrette #Copyright (c) 2022 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: #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:
# #
@@ -12,60 +12,22 @@ require_dependency 'time_entry_query'
module TimeEntryQueryPatch module TimeEntryQueryPatch
def self.included(base) # :nodoc: # Add QBO options to columns
base.extend(ClassMethods) def available_columns
unless @available_columns
base.send(:include, InstanceMethods) @available_columns = self.class.available_columns.dup
@available_columns << QueryColumn.new(:qbo_billed, :sortable => "#{TimeEntry.table_name}.name", :groupable => true, :caption => :field_qbo_billed)
# Same as typing in the class
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
alias_method_chain :available_columns, :qbo_billed
alias_method_chain :available_filters, :qbo_billed
end end
end super
module ClassMethods
end end
module InstanceMethods # Add QBO options to the filter
def initialize_available_filters
def available_columns_with_qbo_billed add_available_filter "qbo_billed", :type => :boolean
unless @available_columns super
@available_columns = available_columns_without_qbo
@available_columns << QueryColumn.new(:qbo_billed, :sortable => "#{TimeEntry.table_name}.name", :groupable => true, :caption => :field_qbo_billed)
end
@available_columns
end
def available_filters_with_qbo_billed
unless @available_filters
@available_filters = available_filters_without_qbo
#qbo_filters = {
# :customer => {
# :id => l(:field_qbo_billed),
# :type => :boolean,
# :order => @available_filters.size + 1},
#}
qbo_filters = {
"qbo_billed" => {
:id => :qbo_billed,
:type => :list_optional,
:order => @available_filters.size + 1,
#:values => Customer.find(:all).collect { |c| [c.name, c.id.to_s]}
}
}
@available_filters.merge!(qbo_filters)
end
@available_filters
end
end end
end end
# Add module to TimeEntryQuery # Add module to TimeEntryQuery
TimeEntryQuery.send(:include, QueryPatch) TimeEntryQuery.send(:prepend, QueryPatch)