dorsale 3.8.1 → 3.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -1
- data/app/commands/dorsale/flyboy/task_commands.rb +1 -1
- data/app/controllers/concerns/dorsale/flyboy/tasks_summary_concern.rb +0 -1
- data/app/controllers/dorsale/alexandrie/attachments_controller.rb +1 -2
- data/app/controllers/dorsale/application_controller.rb +0 -1
- data/app/controllers/dorsale/billing_machine/application_controller.rb +0 -2
- data/app/controllers/dorsale/billing_machine/invoices_controller.rb +9 -22
- data/app/controllers/dorsale/billing_machine/payment_terms_controller.rb +0 -1
- data/app/controllers/dorsale/billing_machine/quotations_controller.rb +1 -4
- data/app/controllers/dorsale/comments_controller.rb +3 -2
- data/app/controllers/dorsale/customer_vault/activity_types_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/links_controller.rb +22 -12
- data/app/controllers/dorsale/customer_vault/origins_controller.rb +0 -1
- data/app/controllers/dorsale/customer_vault/people_controller.rb +2 -3
- data/app/controllers/dorsale/expense_gun/categories_controller.rb +0 -1
- data/app/controllers/dorsale/expense_gun/expenses_controller.rb +0 -1
- data/app/controllers/dorsale/flyboy/task_comments_controller.rb +0 -1
- data/app/controllers/dorsale/flyboy/tasks_controller.rb +28 -21
- data/app/controllers/dorsale/users_controller.rb +0 -1
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +9 -5
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_state.rb +2 -2
- data/app/filters/dorsale/flyboy/small_data/filter_for_tasks.rb +1 -1
- data/app/helpers/dorsale/billing_machine/application_helper.rb +6 -6
- data/app/helpers/dorsale/context_helper.rb +1 -1
- data/app/helpers/dorsale/flyboy/application_helper.rb +4 -5
- data/app/mailers/dorsale/billing_machine/invoice_mailer.rb +0 -1
- data/app/mailers/dorsale/flyboy/task_mailer.rb +0 -1
- data/app/mailers/dorsale/user_mailer.rb +0 -1
- data/app/models/dorsale/address.rb +2 -2
- data/app/models/dorsale/alexandrie/attachment_type.rb +0 -1
- data/app/models/dorsale/billing_machine.rb +1 -2
- data/app/models/dorsale/billing_machine/invoice.rb +19 -30
- data/app/models/dorsale/billing_machine/invoice_line.rb +2 -2
- data/app/models/dorsale/billing_machine/quotation.rb +11 -17
- data/app/models/dorsale/billing_machine/quotation_line.rb +2 -3
- data/app/models/dorsale/comment.rb +1 -1
- data/app/models/dorsale/customer_vault/corporation.rb +11 -10
- data/app/models/dorsale/customer_vault/event.rb +2 -2
- data/app/models/dorsale/customer_vault/individual.rb +4 -2
- data/app/models/dorsale/customer_vault/person.rb +14 -4
- data/app/models/dorsale/customer_vault/person_data.rb +1 -2
- data/app/models/dorsale/expense_gun/expense.rb +2 -5
- data/app/models/dorsale/expense_gun/expense_line.rb +2 -2
- data/app/models/dorsale/flyboy/task.rb +17 -18
- data/app/models/dorsale/flyboy/task_comment.rb +1 -1
- data/app/models/dorsale/users/active.rb +1 -1
- data/app/models/dorsale/users/avatar.rb +2 -1
- data/app/models/dorsale/users/password_generation.rb +0 -1
- data/app/pdfs/concerns/dorsale/alexandrie/prawn/render_with_attachments.rb +1 -1
- data/app/pdfs/dorsale/application_pdf.rb +7 -0
- data/app/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf.rb +52 -47
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +94 -205
- data/app/pdfs/dorsale/prawn_helpers.rb +107 -0
- data/app/policies/dorsale/application_policy.rb +2 -4
- data/app/policies/dorsale/expense_gun/expense_policy_helper.rb +0 -1
- data/app/policies/dorsale/flyboy/task_policy_helper.rb +3 -3
- data/app/policies/dorsale/policy_checker.rb +11 -18
- data/app/services/dorsale/billing_machine/invoice/copy.rb +2 -2
- data/app/services/dorsale/billing_machine/pdf_file_generator.rb +7 -2
- data/app/services/dorsale/billing_machine/quotation/copy.rb +1 -1
- data/app/services/dorsale/billing_machine/quotation/to_invoice.rb +10 -7
- data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
- data/app/views/dorsale/billing_machine/invoices/_details.html.slim +1 -2
- data/app/views/dorsale/billing_machine/invoices/_form.html.slim +4 -11
- data/app/views/dorsale/billing_machine/invoices/index.xlsx.ruby +1 -1
- data/app/views/dorsale/flyboy/tasks/index.xlsx.ruby +1 -1
- data/config/locales/alexandrie.en.yml +0 -4
- data/config/locales/alexandrie.fr.yml +0 -4
- data/config/locales/billing_machine.en.yml +0 -41
- data/config/locales/billing_machine.fr.yml +0 -41
- data/config/routes.rb +0 -1
- data/db/migrate/20161119064536_delete_id_cards.rb +9 -0
- data/features/billing_machine_invoices.feature +0 -1
- data/features/billing_machine_multiple_vat.feature +0 -1
- data/features/billing_machine_quotations.feature +0 -1
- data/features/step_definitions/billing_machine_invoices_steps.rb +73 -79
- data/features/step_definitions/billing_machine_multiple_vat.rb +5 -6
- data/features/step_definitions/billing_machine_payment_terms_steps.rb +2 -2
- data/features/step_definitions/billing_machine_quotations_steps.rb +45 -80
- data/features/step_definitions/common_steps.rb +0 -4
- data/features/step_definitions/customer_vault_activity_types_steps.rb +1 -1
- data/features/step_definitions/customer_vault_corporations_steps.rb +27 -23
- data/features/step_definitions/customer_vault_individuals_steps.rb +8 -9
- data/features/step_definitions/customer_vault_invoices_steps.rb +1 -1
- data/features/step_definitions/customer_vault_links_steps.rb +6 -6
- data/features/step_definitions/customer_vault_origins_steps.rb +1 -1
- data/features/step_definitions/customer_vault_people_steps.rb +2 -1
- data/features/step_definitions/expense_gun_categories_steps.rb +2 -2
- data/features/step_definitions/expense_gun_expenses_steps.rb +6 -6
- data/features/step_definitions/flyboy_tasks_steps.rb +4 -7
- data/features/step_definitions/tasks_summary_steps.rb +3 -3
- data/features/support/env.rb +3 -2
- data/lib/dorsale/engine.rb +8 -8
- data/lib/dorsale/file_loader.rb +1 -1
- data/lib/dorsale/simple_form.rb +3 -3
- data/lib/dorsale/simple_form_bootstrap.rb +46 -46
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/alexandrie/attachments_controller_spec.rb +3 -3
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +0 -1
- data/spec/controllers/dorsale/comments_controller_spec.rb +1 -1
- data/spec/controllers/dorsale/customer_vault/events_controller_spec.rb +9 -9
- data/spec/controllers/dorsale/customer_vault/people_controller_spec.rb +15 -19
- data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +1 -2
- data/spec/controllers/dorsale/flyboy/tasks_controller_spec.rb +43 -19
- data/spec/factories/alexandrie_attachment_types.rb +1 -1
- data/spec/factories/alexandrie_attachments.rb +1 -1
- data/spec/factories/billing_machine_invoice_lines.rb +1 -1
- data/spec/factories/billing_machine_invoices.rb +1 -2
- data/spec/factories/billing_machine_payment_terms.rb +1 -1
- data/spec/factories/billing_machine_quotation_lines.rb +1 -2
- data/spec/factories/billing_machine_quotations.rb +1 -2
- data/spec/factories/customer_vault_activity_types.rb +1 -1
- data/spec/factories/customer_vault_corporations.rb +1 -1
- data/spec/factories/customer_vault_event.rb +1 -1
- data/spec/factories/customer_vault_individuals.rb +2 -2
- data/spec/factories/customer_vault_links.rb +1 -1
- data/spec/factories/customer_vault_origins.rb +1 -1
- data/spec/factories/dorsale_addresses.rb +1 -1
- data/spec/factories/dorsale_comments.rb +1 -1
- data/spec/factories/expense_gun_categories.rb +2 -2
- data/spec/factories/expense_gun_expense_lines.rb +8 -8
- data/spec/factories/expense_gun_expenses.rb +2 -3
- data/spec/factories/flyboy_task_comments.rb +1 -1
- data/spec/factories/flyboy_tasks.rb +1 -1
- data/spec/mailers/user_mailer.rb +5 -6
- data/spec/models/dorsale/address_spec.rb +26 -26
- data/spec/models/dorsale/billing_machine/invoice_line_spec.rb +6 -6
- data/spec/models/dorsale/billing_machine/invoice_spec.rb +37 -23
- data/spec/models/dorsale/billing_machine/quotation_line_spec.rb +9 -10
- data/spec/models/dorsale/billing_machine/quotation_spec.rb +26 -28
- data/spec/models/dorsale/billing_machine_spec.rb +0 -1
- data/spec/models/dorsale/comment_spec.rb +0 -1
- data/spec/models/dorsale/customer_vault/corporation_spec.rb +20 -20
- data/spec/models/dorsale/customer_vault/event_spec.rb +1 -1
- data/spec/models/dorsale/customer_vault/individual_spec.rb +0 -2
- data/spec/models/dorsale/customer_vault/link_spec.rb +0 -1
- data/spec/models/dorsale/customer_vault/person_spec.rb +7 -6
- data/spec/models/dorsale/expense_gun/category_spec.rb +2 -2
- data/spec/models/dorsale/expense_gun/expense_line_spec.rb +14 -14
- data/spec/models/dorsale/expense_gun/expense_spec.rb +23 -13
- data/spec/models/dorsale/flyboy/task_comment_spec.rb +5 -6
- data/spec/models/dorsale/flyboy/task_spec.rb +66 -42
- data/spec/models/dorsale/users_spec.rb +3 -5
- data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +6 -11
- data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +7 -11
- data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +6 -11
- data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +7 -14
- data/spec/rails_helper.rb +1 -1
- data/spec/routing/dorsale/billing_machine/invoices_routing_spec.rb +0 -1
- data/spec/routing/dorsale/billing_machine/quotations_routing_spec.rb +0 -1
- data/spec/routing/dorsale/comments_routing_spec.rb +0 -2
- data/spec/routing/dorsale/customer_vault/people_routing_spec.rb +0 -1
- data/spec/routing/dorsale/expense_gun/expenses_routing_spec.rb +0 -1
- data/spec/routing/dorsale/flyboy/task_comments_routing_spec.rb +0 -1
- data/spec/routing/dorsale/users_routing_spec.rb +1 -1
- data/spec/services/dorsale/billing_machine/quotation/copy_spec.rb +2 -2
- data/spec/services/dorsale/expense_gun/expense/copy_spec.rb +13 -17
- data/spec/services/dorsale/flyboy/task/copy_spec.rb +1 -2
- data/spec/services/dorsale/flyboy/task/snoozer_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- metadata +5 -43
- data/app/controllers/dorsale/billing_machine/id_cards_controller.rb +0 -106
- data/app/models/dorsale/billing_machine/id_card.rb +0 -14
- data/app/policies/dorsale/billing_machine/id_card_policy_helper.rb +0 -7
- data/app/views/dorsale/billing_machine/id_cards/_form.html.slim +0 -42
- data/app/views/dorsale/billing_machine/id_cards/_index_actions.html.slim +0 -2
- data/app/views/dorsale/billing_machine/id_cards/_list.html.slim +0 -27
- data/app/views/dorsale/billing_machine/id_cards/edit.html.slim +0 -1
- data/app/views/dorsale/billing_machine/id_cards/index.html.slim +0 -11
- data/app/views/dorsale/billing_machine/id_cards/new.html.slim +0 -1
- data/features/billing_machine_id_cards.feature +0 -19
- data/features/step_definitions/billing_machine_id_cards_steps.rb +0 -53
- data/features/support/ajax.rb +0 -20
- data/features/support/database_cleaner.rb +0 -12
- data/features/support/factory_girl.rb +0 -1
- data/features/support/fix_referrer.rb +0 -9
- data/features/support/message_delivery.rb +0 -1
- data/features/support/poltergeist.rb +0 -22
- data/features/support/rails.rb +0 -1
- data/features/support/rspec.rb +0 -6
- data/features/support/screenshots.rb +0 -5
- data/features/support/sign_in.rb +0 -17
- data/features/support/simplecov.rb +0 -1
- data/features/support/turbolinks.rb +0 -30
- data/spec/factories/billing_machine_id_cards.rb +0 -26
- data/spec/models/dorsale/billing_machine/id_card_spec.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f957740f5e197d1396130300fa94904f32e3571
|
4
|
+
data.tar.gz: 1a1210313bd18d1bae5e90c5a057bd4db71fe876
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bfb5ef6465100808adb9fdb9b88d26475d53ad63a50f607ccd3b82d8ca04d6bd3e9e11f4a4ba1f8c29ce86e3d288934cda1510403b43f716d7773836365348f
|
7
|
+
data.tar.gz: 4a0afd7c630a26b280a4b555c0e48c8e70da325ad2f02b088e7507220e5c1f3c7c3e82160bd53301ca16048f4f2aaecadcf083024be39ce632d9b3e2a490b0f2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[![Build Status](https://semaphoreci.com/api/v1/agilidee/dorsale/branches/master/badge.svg)](https://semaphoreci.com/agilidee/dorsale)
|
2
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/c3b2143566f714fcb104/maintainability)](https://codeclimate.com/github/agilidee/dorsale/maintainability)
|
3
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/c3b2143566f714fcb104/test_coverage)](https://codeclimate.com/github/agilidee/dorsale/test_coverage)
|
4
|
+
|
1
5
|
# Dorsale
|
2
6
|
|
3
7
|
This project uses the GNU AGPLv3 license.
|
@@ -20,4 +24,4 @@ Hosting application shall define a global current_user method providing the curr
|
|
20
24
|
|
21
25
|
Returned user shall implement followings methods:
|
22
26
|
tasks: returns all taks visible by the user
|
23
|
-
colleagues(context): return all people affected in the provided context
|
27
|
+
colleagues(context): return all people affected in the provided context
|
@@ -2,7 +2,7 @@ module Dorsale::Flyboy::TaskCommands
|
|
2
2
|
def self.send_daily_term_emails!
|
3
3
|
::Dorsale::Flyboy::Task.all.each do |task|
|
4
4
|
next if task.done?
|
5
|
-
next if task.term !=
|
5
|
+
next if task.term != Date.current
|
6
6
|
next if task.owner.nil?
|
7
7
|
|
8
8
|
::Dorsale::Flyboy::TaskMailer.term_email(task).deliver_later
|
@@ -98,7 +98,7 @@ class Dorsale::Alexandrie::AttachmentsController < ::Dorsale::ApplicationControl
|
|
98
98
|
def common_permitted_params
|
99
99
|
[
|
100
100
|
:name,
|
101
|
-
:attachment_type_id
|
101
|
+
:attachment_type_id,
|
102
102
|
]
|
103
103
|
end
|
104
104
|
|
@@ -138,5 +138,4 @@ class Dorsale::Alexandrie::AttachmentsController < ::Dorsale::ApplicationControl
|
|
138
138
|
def notify_attachable
|
139
139
|
@attachment.attachable.send(:try, :after_attachments_changes)
|
140
140
|
end
|
141
|
-
|
142
141
|
end
|
@@ -11,8 +11,6 @@ class Dorsale::BillingMachine::ApplicationController < ::Dorsale::ApplicationCon
|
|
11
11
|
|
12
12
|
def set_common_variables
|
13
13
|
@payment_terms ||= policy_scope(::Dorsale::BillingMachine::PaymentTerm)
|
14
|
-
@id_cards ||= policy_scope(::Dorsale::BillingMachine::IdCard)
|
15
14
|
@people ||= policy_scope(::Dorsale::CustomerVault::Person)
|
16
15
|
end
|
17
|
-
|
18
16
|
end
|
@@ -26,8 +26,7 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
26
26
|
# callback in BillingMachine::ApplicationController
|
27
27
|
@invoice ||= scope.new
|
28
28
|
|
29
|
-
@invoice.lines.build
|
30
|
-
@invoice.id_card = @id_cards.first if @id_cards.one?
|
29
|
+
@invoice.lines.build if @invoice.lines.empty?
|
31
30
|
|
32
31
|
authorize @invoice, :create?
|
33
32
|
end
|
@@ -103,26 +102,16 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
103
102
|
def email
|
104
103
|
authorize @invoice, :email?
|
105
104
|
|
106
|
-
@
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
105
|
+
default_subject = "#{model.t} #{@invoice.tracking_id} : #{@invoice.label}"
|
106
|
+
default_body = t("emails.invoices.send_invoice_to_customer",
|
107
|
+
:from => current_user.to_s,
|
108
|
+
:to => @invoice.customer.to_s,
|
109
|
+
)
|
112
110
|
|
113
|
-
@
|
114
|
-
|
115
|
-
params[:email][:body]
|
116
|
-
rescue
|
117
|
-
t("emails.invoices.send_invoice_to_customer",
|
118
|
-
:from => current_user.to_s,
|
119
|
-
:to => @invoice.customer.to_s,
|
120
|
-
)
|
121
|
-
end
|
111
|
+
@subject = params.dig(:email, :subject) || default_subject
|
112
|
+
@body = params.dig(:email, :body) || default_body
|
122
113
|
|
123
|
-
if request.get?
|
124
|
-
return
|
125
|
-
end
|
114
|
+
return if request.get?
|
126
115
|
|
127
116
|
email = ::Dorsale::BillingMachine::InvoiceMailer
|
128
117
|
.send_invoice_to_customer(@invoice, @subject, @body, current_user)
|
@@ -156,7 +145,6 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
156
145
|
|
157
146
|
def permitted_params
|
158
147
|
[
|
159
|
-
:id_card_id,
|
160
148
|
:customer_guid,
|
161
149
|
:payment_term_id,
|
162
150
|
:label,
|
@@ -190,5 +178,4 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
|
|
190
178
|
def invoice_params_for_update
|
191
179
|
invoice_params
|
192
180
|
end
|
193
|
-
|
194
181
|
end
|
@@ -26,8 +26,7 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
|
|
26
26
|
# callback in BillingMachine::ApplicationController
|
27
27
|
@quotation ||= scope.new
|
28
28
|
|
29
|
-
@quotation.lines.build
|
30
|
-
@quotation.id_card = @id_cards.first if @id_cards.one?
|
29
|
+
@quotation.lines.build if @quotation.lines.empty?
|
31
30
|
|
32
31
|
authorize @quotation, :create?
|
33
32
|
end
|
@@ -133,7 +132,6 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
|
|
133
132
|
:state,
|
134
133
|
:customer_guid,
|
135
134
|
:payment_term_id,
|
136
|
-
:id_card_id,
|
137
135
|
:date,
|
138
136
|
:expires_at,
|
139
137
|
:comments,
|
@@ -162,5 +160,4 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
|
|
162
160
|
def quotation_params_for_update
|
163
161
|
quotation_params
|
164
162
|
end
|
165
|
-
|
166
163
|
end
|
@@ -74,8 +74,9 @@ class Dorsale::CommentsController < ::Dorsale::ApplicationController
|
|
74
74
|
[
|
75
75
|
params[:form_url],
|
76
76
|
request.referer,
|
77
|
-
|
78
|
-
|
77
|
+
main_app.try(:root_path),
|
78
|
+
"/",
|
79
|
+
].find(&:present?)
|
79
80
|
end
|
80
81
|
|
81
82
|
def model
|
@@ -66,21 +66,32 @@ class Dorsale::CustomerVault::LinksController < ::Dorsale::CustomerVault::Applic
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def set_objects
|
69
|
+
set_people
|
70
|
+
set_person
|
71
|
+
set_link
|
72
|
+
end
|
73
|
+
|
74
|
+
def set_people
|
69
75
|
@people ||= person_scope.all
|
76
|
+
end
|
77
|
+
|
78
|
+
def set_person
|
70
79
|
@person ||= person_scope.find(params[:person_id])
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_link
|
83
|
+
return unless params.key?(:id)
|
71
84
|
|
72
|
-
|
73
|
-
@link ||= scope.find(params[:id])
|
85
|
+
@link ||= scope.find(params[:id])
|
74
86
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
87
|
+
if @person == @link.alice
|
88
|
+
@link.person = @link.alice
|
89
|
+
@link.other_person = @link.bob
|
90
|
+
end
|
79
91
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
end
|
92
|
+
if @person == @link.bob
|
93
|
+
@link.person = @link.bob
|
94
|
+
@link.other_person = @link.alice
|
84
95
|
end
|
85
96
|
end
|
86
97
|
|
@@ -97,12 +108,11 @@ class Dorsale::CustomerVault::LinksController < ::Dorsale::CustomerVault::Applic
|
|
97
108
|
def link_params_for_create
|
98
109
|
link_params.merge(
|
99
110
|
:alice => @person,
|
100
|
-
:bob_id => params.dig(:link, :bob_id)
|
111
|
+
:bob_id => params.dig(:link, :bob_id),
|
101
112
|
)
|
102
113
|
end
|
103
114
|
|
104
115
|
def link_params_for_update
|
105
116
|
link_params
|
106
117
|
end
|
107
|
-
|
108
118
|
end
|
@@ -155,7 +155,7 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
|
|
155
155
|
:street_bis,
|
156
156
|
:zip,
|
157
157
|
:city,
|
158
|
-
:country
|
158
|
+
:country,
|
159
159
|
],
|
160
160
|
]
|
161
161
|
end
|
@@ -205,8 +205,7 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
|
|
205
205
|
:author => current_user,
|
206
206
|
:person => @person,
|
207
207
|
:action => action,
|
208
|
-
:text => ::Dorsale::CustomerVault::Event.t("text.#{action}")
|
208
|
+
:text => ::Dorsale::CustomerVault::Event.t("text.#{action}"),
|
209
209
|
)
|
210
210
|
end
|
211
|
-
|
212
211
|
end
|
@@ -24,23 +24,7 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
24
24
|
|
25
25
|
@tasks ||= scope.all.preload(:taskable)
|
26
26
|
|
27
|
-
@order ||=
|
28
|
-
case column
|
29
|
-
when :name, :status
|
30
|
-
%(LOWER(dorsale_flyboy_tasks.#{column}) #{direction})
|
31
|
-
when :progress, :term
|
32
|
-
%(dorsale_flyboy_tasks.#{column} #{direction})
|
33
|
-
when :taskable
|
34
|
-
if direction == :asc
|
35
|
-
proc { |a, b| a.taskable.to_s.downcase <=> b.taskable.to_s.downcase }
|
36
|
-
else
|
37
|
-
proc { |a, b| b.taskable.to_s.downcase <=> a.taskable.to_s.downcase }
|
38
|
-
end
|
39
|
-
else
|
40
|
-
params["sort"] = "term"
|
41
|
-
"term ASC"
|
42
|
-
end
|
43
|
-
end
|
27
|
+
@order ||= order_from_params
|
44
28
|
|
45
29
|
@filters ||= ::Dorsale::Flyboy::SmallData::FilterForTasks.new(filters_jar)
|
46
30
|
|
@@ -90,7 +74,6 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
90
74
|
|
91
75
|
def edit
|
92
76
|
authorize @task, :update?
|
93
|
-
|
94
77
|
end
|
95
78
|
|
96
79
|
def update
|
@@ -123,7 +106,7 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
123
106
|
:progress => 100,
|
124
107
|
:description => t("messages.tasks.complete_ok"),
|
125
108
|
:date => Time.zone.now,
|
126
|
-
:author => current_user
|
109
|
+
:author => current_user,
|
127
110
|
)
|
128
111
|
|
129
112
|
if @task_comment.save
|
@@ -139,8 +122,13 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
139
122
|
authorize @task, :snooze?
|
140
123
|
|
141
124
|
if @task.snoozer.snooze
|
142
|
-
|
143
|
-
|
125
|
+
Dorsale::Flyboy::TaskComment.create!(
|
126
|
+
:task => @task,
|
127
|
+
:progress => @task.progress,
|
128
|
+
:description => t("messages.tasks.snooze_ok"),
|
129
|
+
:author => current_user,
|
130
|
+
)
|
131
|
+
|
144
132
|
flash[:success] = t("messages.tasks.snooze_ok")
|
145
133
|
else
|
146
134
|
flash[:danger] = t("messages.tasks.snooze_error")
|
@@ -212,4 +200,23 @@ class Dorsale::Flyboy::TasksController < ::Dorsale::Flyboy::ApplicationControlle
|
|
212
200
|
params.fetch(:task, {}).permit(permitted_params)
|
213
201
|
end
|
214
202
|
|
203
|
+
def order_from_params
|
204
|
+
sortable_column_order do |column, direction|
|
205
|
+
case column
|
206
|
+
when :name, :status
|
207
|
+
%(LOWER(dorsale_flyboy_tasks.#{column}) #{direction})
|
208
|
+
when :progress, :term
|
209
|
+
%(dorsale_flyboy_tasks.#{column} #{direction})
|
210
|
+
when :taskable
|
211
|
+
if direction == :asc
|
212
|
+
proc { |a, b| a.taskable.to_s.downcase <=> b.taskable.to_s.downcase }
|
213
|
+
else
|
214
|
+
proc { |a, b| b.taskable.to_s.downcase <=> a.taskable.to_s.downcase }
|
215
|
+
end
|
216
|
+
else
|
217
|
+
params["sort"] = "term"
|
218
|
+
"term ASC"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
end
|
215
222
|
end
|
@@ -3,15 +3,19 @@ class Dorsale::BillingMachine::SmallData::FilterStrategyByPaymentStatus < ::Agil
|
|
3
3
|
table_name = query.model.table_name
|
4
4
|
|
5
5
|
if value == "paid"
|
6
|
-
|
6
|
+
query.where(paid: true)
|
7
7
|
elsif value == "unpaid"
|
8
|
-
|
8
|
+
query.where(paid: false)
|
9
9
|
elsif value == "pending"
|
10
|
-
|
10
|
+
query
|
11
|
+
.where(paid: false)
|
12
|
+
.where("#{table_name}.due_date >= ?", Date.current)
|
11
13
|
elsif value == "late"
|
12
|
-
|
14
|
+
query
|
15
|
+
.where(paid: false)
|
16
|
+
.where("#{table_name}.due_date < ? OR #{table_name}.due_date IS NULL)", Date.current)
|
13
17
|
else
|
14
|
-
|
18
|
+
query
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Dorsale::BillingMachine::SmallData::FilterStrategyByState < ::Agilibox::SmallData::FilterStrategy
|
2
2
|
def apply(query, value)
|
3
|
-
if value.to_s.match(/not_(.+)/)
|
4
|
-
query.where.not(state:
|
3
|
+
if (m = value.to_s.match(/not_(.+)/))
|
4
|
+
query.where.not(state: m[1])
|
5
5
|
else
|
6
6
|
query.where(state: value)
|
7
7
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Dorsale::Flyboy::SmallData::FilterForTasks < ::Agilibox::SmallData::Filter
|
2
2
|
STRATEGIES = {
|
3
3
|
"fb_state" => ::Dorsale::Flyboy::SmallData::FilterStrategyByTaskState.new,
|
4
|
-
"fb_owner" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new(:owner_id)
|
4
|
+
"fb_owner" => ::Agilibox::SmallData::FilterStrategyByKeyValue.new(:owner_id),
|
5
5
|
}
|
6
6
|
end
|
@@ -9,10 +9,10 @@ module Dorsale::BillingMachine::ApplicationHelper
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def billing_machine_quotation_states_for_filter_select
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
[
|
13
|
+
[::Dorsale::BillingMachine::Quotation.t("state.all"), ""],
|
14
|
+
[::Dorsale::BillingMachine::Quotation.t("state.not_canceled"), "not_canceled"],
|
15
|
+
] + billing_machine_quotation_states_for_select
|
16
16
|
end
|
17
17
|
|
18
18
|
def billing_machine_payment_status_for_filter_select
|
@@ -27,9 +27,9 @@ module Dorsale::BillingMachine::ApplicationHelper
|
|
27
27
|
|
28
28
|
def quotation_state_classes(quotation)
|
29
29
|
if quotation.state == "pending" && quotation.date < 1.month.ago
|
30
|
-
|
30
|
+
"pending late"
|
31
31
|
else
|
32
|
-
|
32
|
+
quotation.state
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|