mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 08:54:23 -05:00
Dynamically load hooks/patches & require redmine4+
This commit is contained in:
97
init.rb
97
init.rb
@@ -8,61 +8,52 @@
|
|||||||
#
|
#
|
||||||
#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.
|
#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.
|
||||||
|
|
||||||
|
# Dynamically load all Hooks & Patches
|
||||||
|
ActiveSupport::Reloader.to_prepare do
|
||||||
|
Dir::foreach(File.join(File.dirname(__FILE__), 'lib')) do |file|
|
||||||
|
next unless /\.rb$/ =~ file
|
||||||
|
require_dependency file
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Redmine::Plugin.register :redmine_qbo do
|
Redmine::Plugin.register :redmine_qbo do
|
||||||
|
|
||||||
# View Hook Listeners
|
|
||||||
require_dependency 'issues_form_hook_listener'
|
|
||||||
require_dependency 'issues_save_hook_listener'
|
|
||||||
require_dependency 'issues_show_hook_listener'
|
|
||||||
require_dependency 'users_show_hook_listener'
|
|
||||||
require_dependency 'header_footer_hook_listener'
|
|
||||||
require_dependency 'projects_form_hook_listener'
|
|
||||||
require_dependency 'view_hook_listener'
|
|
||||||
|
|
||||||
# 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'
|
|
||||||
require_dependency 'pdf_patch'
|
|
||||||
require_dependency 'attachments_controller_patch'
|
|
||||||
|
|
||||||
# About
|
|
||||||
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 '1.1.0'
|
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo'
|
|
||||||
author_url 'http://rickbarrette.org'
|
|
||||||
settings :default => {'empty' => true}, :partial => 'qbo/settings'
|
|
||||||
|
|
||||||
# Add safe attributes
|
# About
|
||||||
Issue.safe_attributes 'customer_id'
|
name 'Redmine Quickbooks Online plugin'
|
||||||
Issue.safe_attributes 'qbo_item_id'
|
author 'Rick Barrette'
|
||||||
Issue.safe_attributes 'qbo_estimate_id'
|
description 'This is a plugin for Redmine to intergrate with Quickbooks Online to allow for seamless intergration CRM and invoicing of completed issues'
|
||||||
Issue.safe_attributes 'qbo_invoice_id'
|
version '1.1.0'
|
||||||
Issue.safe_attributes 'vehicles_id'
|
url 'https://github.com/rickbarrette/redmine_qbo'
|
||||||
User.safe_attributes 'qbo_employee_id'
|
author_url 'http://rickbarrette.org'
|
||||||
TimeEntry.safe_attributes 'qbo_billed'
|
settings :default => {'empty' => true}, :partial => 'qbo/settings'
|
||||||
Project.safe_attributes 'customer_id'
|
requires_redmine :version_or_higher => '4.0.0'
|
||||||
Project.safe_attributes 'vehicle_id'
|
|
||||||
|
|
||||||
# We are playing in the sandbox
|
|
||||||
#Quickbooks.sandbox_mode = true
|
|
||||||
|
|
||||||
# set per_page globally
|
|
||||||
WillPaginate.per_page = 20
|
|
||||||
|
|
||||||
# Permissions for security
|
# Add safe attributes for core models
|
||||||
permission :view_customers, :customers => :index, :public => false
|
Issue.safe_attributes 'customer_id'
|
||||||
permission :add_customers, :customers => :new, :public => false
|
Issue.safe_attributes 'qbo_item_id'
|
||||||
permission :view_payments, :payments => :index, :public => false
|
Issue.safe_attributes 'qbo_estimate_id'
|
||||||
permission :add_payments, :payments => :new, :public => false
|
Issue.safe_attributes 'qbo_invoice_id'
|
||||||
permission :view_vehicles, :payments => :new, :public => false
|
Issue.safe_attributes 'vehicles_id'
|
||||||
|
User.safe_attributes 'qbo_employee_id'
|
||||||
# Register QBO top menu item
|
TimeEntry.safe_attributes 'qbo_billed'
|
||||||
menu :top_menu, :customers, { :controller => :customers, :action => :index }, :caption => 'Customers', :if => Proc.new {User.current.logged?}
|
Project.safe_attributes 'customer_id'
|
||||||
menu :top_menu, :vehicles, { :controller => :vehicles, :action => :index }, :caption => 'Vehicles', :if => Proc.new { User.current.logged? }
|
Project.safe_attributes 'vehicle_id'
|
||||||
|
|
||||||
|
# We are playing in the sandbox
|
||||||
|
#Quickbooks.sandbox_mode = true
|
||||||
|
|
||||||
|
# set per_page globally
|
||||||
|
WillPaginate.per_page = 20
|
||||||
|
|
||||||
|
# Permissions for security
|
||||||
|
permission :view_customers, :customers => :index, :public => false
|
||||||
|
permission :add_customers, :customers => :new, :public => false
|
||||||
|
permission :view_payments, :payments => :index, :public => false
|
||||||
|
permission :add_payments, :payments => :new, :public => false
|
||||||
|
permission :view_vehicles, :payments => :new, :public => false
|
||||||
|
|
||||||
|
# Register top menu items
|
||||||
|
menu :top_menu, :customers, { :controller => :customers, :action => :index }, :caption => 'Customers', :if => Proc.new {User.current.logged?}
|
||||||
|
menu :top_menu, :vehicles, { :controller => :vehicles, :action => :index }, :caption => 'Vehicles', :if => Proc.new { User.current.logged? }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user