forked from echarp/haltr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.rb
More file actions
129 lines (107 loc) · 5.49 KB
/
init.rb
File metadata and controls
129 lines (107 loc) · 5.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
require 'redmine'
Rails.logger.info 'Starting haltr plugin'
require_dependency 'haltr'
# Haltr has plugins of his own
# similar to config/initializers/00-core_plugins.rb in Redmine
# Loads the core plugins located in lib/plugins
Dir.glob(File.join(File.dirname(__FILE__), "lib/plugins/*")).sort.each do |directory|
if File.directory?(directory)
lib = File.join(directory, "lib")
if File.directory?(lib)
$:.unshift lib
ActiveSupport::Dependencies.autoload_paths += [lib]
end
initializer = File.join(directory, "init.rb")
if File.file?(initializer)
config = config = RedmineApp::Application.config
eval(File.read(initializer), binding, initializer)
end
end
end
Date::DATE_FORMATS[:ddmmyy] = "%d%m%y"
require_dependency 'utils'
require_dependency 'iso_countries'
require_dependency File.expand_path(File.join(File.dirname(__FILE__), 'app/models/export_channels'))
if (Redmine::VERSION::MAJOR == 1 and Redmine::VERSION::MINOR >= 4) or Redmine::VERSION::MAJOR == 2
require_dependency 'country_iso_translater'
else
config.gem 'sundawg_country_codes', :lib => 'country_iso_translater'
config.gem 'money', :version => '>=5.0.0'
end
Rails.configuration.to_prepare do
Project.send(:include, ProjectHaltrPatch)
User.send(:include, UserHaltrPatch)
end
Redmine::Plugin.register :haltr do
name 'haltr'
author 'Ingent'
description 'Hackers dont do books'
version '1.2'
settings :default => {
'trace_url' => 'http://localhost:3000',
'export_channels_path' => '/tmp',
'issues_controller_name' => 'issues',
'default_country' => 'es',
'default_currency' => 'EUR',
'hide_unauthorized' => '1'
},
:partial => '/common/settings'
project_module :haltr do
permission :general_use,
{ :clients => [:index, :new, :edit, :create, :update, :destroy, :check_cif, :link_to_profile, :unlink,
:allow_link, :deny_link, :ccc2iban],
:people => [:index, :new, :show, :edit, :create, :update, :destroy],
:invoices => [:index, :new, :edit, :create, :update, :destroy, :show, :mark_sent, :mark_closed, :mark_not_sent,
:destroy_payment, :facturae30, :facturae31, :facturae32, :peppolubl20, :send_invoice, :legal,
:update_payment_stuff, :amend_for_invoice, :download_new_invoices, :send_new_invoices, :duplicate_invoice,
:biiubl20, :svefaktura, :oioubl20, :efffubl, :report, :context_menu, :bulk_mark_as, :original, :show_original],
:received => [:index, :new, :edit, :create, :update, :destroy, :show, :show_original,
:mark_accepted, :mark_accepted_with_mail, :mark_refused,
:mark_refused_with_mail, :legal, :context_menu, :original, :validate, :bulk_mark_as],
:companies => [:my_company,:update,:linked_to_mine,:check_iban]},
:require => :member
permission :manage_payments, { :payments => [:index, :new, :edit, :create, :update, :destroy, :payment_initiation, :n19, :payment_done, :import_aeb43_index, :import_aeb43, :invoices] }, :require => :member
permission :use_templates, { :invoice_templates => [:index, :new, :edit, :create, :update, :destroy, :show, :new_from_invoice,
:new_invoices_from_template, :create_invoices, :update_taxes] }, :require => :member
permission :use_all_readonly,
{ :clients => [:index, :edit, :check_cif, :ccc2iban],
:people => [:index, :edit],
:invoices => [:index, :show, :facturae30, :facturae31, :facturae32, :peppolubl20,
:legal, :download_new_invoices, :biiubl20, :svefaktura, :oioubl20, :efffubl, :report,
:context_menu, :show_original],
:received => [:index, :show, :show_original, :legal, :context_menu],
:companies => [:my_company, :update, :linked_to_mine, :check_iban],
:payments => [:index, :n19],
:invoice_templates => [:index, :show] }, :require => :member
permission :bulk_operations,
{ :invoices => [:bulk_download,:bulk_send],
:received => [:bulk_download,:bulk_validate] }, :require => :member
permission :add_multiple_bank_infos,
{ :companies => [:add_bank_info] }, :require => :member
permission :use_sepa,
{ :payments => [:sepa],
:mandates => [:index,:new,:show,:create,:edit,:update,:destroy,:signed_doc] }, :require => :member
permission :import_invoices,
{ :invoices => [:import] }, :require => :member
# Loads permisons from config/channels.yml
ExportChannels.permissions.each do |permission,actions|
permission permission, actions, :require => :member
end
end
menu :project_menu, :companies, { :controller => 'clients', :action => 'index' }, :param => :project_id, :caption => :label_companies
menu :project_menu, :invoices, { :controller => 'invoices', :action => 'index' }, :param => :project_id, :caption => :label_invoice_plural
menu :project_menu, :payments, { :controller => 'payments', :action => 'index' }, :param => :project_id, :caption => :label_payment_plural
# submenus defined at lib/haltr.rb
end
# avoid taxis error
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular 'taxes', 'tax'
end
Mime::Type.register "text/xml", :facturae30
Mime::Type.register "text/xml", :facturae31
Mime::Type.register "text/xml", :facturae32
Mime::Type.register "text/xml", :peppolubl20
Mime::Type.register "text/xml", :biiubl20
Mime::Type.register "text/xml", :svefaktura
Mime::Type.register "text/xml", :oioubl20
Mime::Type.register "text/xml", :efffubl