dorsale 3.9.2 → 3.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/controllers/dorsale/customer_vault/application_controller.rb +0 -16
- data/app/controllers/dorsale/customer_vault/people_controller.rb +2 -7
- data/app/filters/dorsale/billing_machine/small_data/filter_strategy_by_payment_status.rb +1 -1
- data/app/helpers/dorsale/customer_vault/application_helper.rb +12 -0
- data/app/models/dorsale/flyboy/task.rb +4 -5
- data/app/pdfs/dorsale/billing_machine/invoice_single_vat_pdf.rb +8 -8
- data/app/views/dorsale/customer_vault/people/_filters.html.slim +3 -3
- data/app/views/dorsale/customer_vault/people/_form.html.slim +1 -1
- data/lib/dorsale/version.rb +1 -1
- data/spec/controllers/dorsale/billing_machine/invoices_controller_spec.rb +103 -91
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2920c20a5fcc0b5057396ace7326452b10413142
|
|
4
|
+
data.tar.gz: 3b6318a593083ae63a1c4ad7e6b4ff19ca66beef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7930f9d2cd19663154dd4b326d2216870d890a3fdf69251a337d1776b1963b925c8081078d062105b67e3be9b35a43d5ad1a63a44c44e6dd7164d1ac27df9149
|
|
7
|
+
data.tar.gz: 1c23b59eec27a27fa88934e35586c0617236077ad83ce16097ce0036d495be15ea97c99149d1fc343d4671201e118c47195e7c44db497723e1e0ddfb0864dc79
|
data/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
1
|
class Dorsale::CustomerVault::ApplicationController < ::Dorsale::ApplicationController
|
|
2
|
-
before_action :set_form_variables, only: [
|
|
3
|
-
:new,
|
|
4
|
-
:create,
|
|
5
|
-
:edit,
|
|
6
|
-
:update,
|
|
7
|
-
]
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
|
|
11
|
-
def customer_vault_tag_list
|
|
12
|
-
Dorsale::TagListForModel.(Dorsale::CustomerVault::Person)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
def set_form_variables
|
|
16
|
-
@tags ||= customer_vault_tag_list
|
|
17
|
-
end
|
|
18
2
|
end
|
|
@@ -4,13 +4,8 @@ class Dorsale::CustomerVault::PeopleController < ::Dorsale::CustomerVault::Appli
|
|
|
4
4
|
def index
|
|
5
5
|
authorize model, :list?
|
|
6
6
|
|
|
7
|
-
@filters
|
|
8
|
-
@
|
|
9
|
-
@origins ||= policy_scope(Dorsale::CustomerVault::Origin)
|
|
10
|
-
@activity_types ||= policy_scope(Dorsale::CustomerVault::ActivityType)
|
|
11
|
-
@people ||= policy_scope(model)
|
|
12
|
-
.search(params[:q])
|
|
13
|
-
.preload(:taggings)
|
|
7
|
+
@filters ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(filters_jar)
|
|
8
|
+
@people ||= policy_scope(model).search(params[:q]).preload(:taggings)
|
|
14
9
|
|
|
15
10
|
if params[:q].blank?
|
|
16
11
|
@people = @filters.apply(@people)
|
|
@@ -13,7 +13,7 @@ class Dorsale::BillingMachine::SmallData::FilterStrategyByPaymentStatus < ::Agil
|
|
|
13
13
|
elsif value == "late"
|
|
14
14
|
query
|
|
15
15
|
.where(paid: false)
|
|
16
|
-
.where("#{table_name}.due_date < ? OR #{table_name}.due_date IS NULL
|
|
16
|
+
.where("#{table_name}.due_date < ? OR #{table_name}.due_date IS NULL", Date.current)
|
|
17
17
|
else
|
|
18
18
|
query
|
|
19
19
|
end
|
|
@@ -57,4 +57,16 @@ module Dorsale::CustomerVault::ApplicationHelper
|
|
|
57
57
|
def new_event_for(person)
|
|
58
58
|
policy_scope(Dorsale::CustomerVault::Event).new(person: person, author: current_user)
|
|
59
59
|
end
|
|
60
|
+
|
|
61
|
+
def customer_vault_tag_list
|
|
62
|
+
Dorsale::TagListForModel.(Dorsale::CustomerVault::Person)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def customer_vault_origins_for_select
|
|
66
|
+
policy_scope(Dorsale::CustomerVault::Origin)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def customer_vault_activity_types_for_select
|
|
70
|
+
policy_scope(Dorsale::CustomerVault::ActivityType)
|
|
71
|
+
end
|
|
60
72
|
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
|
|
2
|
-
|
|
3
|
-
REMINDER_UNITS = %w(days weeks months)
|
|
2
|
+
include ::Agilibox::Search
|
|
4
3
|
|
|
5
4
|
self.table_name = "dorsale_flyboy_tasks"
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
REMINDER_TYPES = %w(duration custom)
|
|
7
|
+
REMINDER_UNITS = %w(days weeks months)
|
|
8
|
+
STATES = %w(done undone ontime onwarning onalert)
|
|
8
9
|
|
|
9
10
|
paginates_per 50
|
|
10
11
|
|
|
@@ -20,8 +21,6 @@ class Dorsale::Flyboy::Task < ::Dorsale::ApplicationRecord
|
|
|
20
21
|
super.sort
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
STATES = %w(done undone ontime onwarning onalert)
|
|
24
|
-
|
|
25
24
|
def state
|
|
26
25
|
return "done" if done
|
|
27
26
|
return "onalert" if term && term <= Date.current
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
2
2
|
include Dorsale::Alexandrie::Prawn::RenderWithAttachments
|
|
3
3
|
|
|
4
|
-
def attachments
|
|
5
|
-
@main_document.try(:attachments) || []
|
|
6
|
-
end
|
|
7
|
-
|
|
8
4
|
DEBUG = false
|
|
9
5
|
|
|
10
6
|
BLACK = "000000"
|
|
@@ -12,10 +8,6 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
12
8
|
GREY = "808080"
|
|
13
9
|
LIGHT_GREY = "C0C0C0"
|
|
14
10
|
|
|
15
|
-
def bm_currency(n)
|
|
16
|
-
currency(n, Dorsale::BillingMachine.default_currency)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
11
|
attr_reader :main_document
|
|
20
12
|
|
|
21
13
|
def initialize(main_document)
|
|
@@ -24,6 +16,14 @@ class Dorsale::BillingMachine::InvoiceSingleVatPdf < Dorsale::ApplicationPdf
|
|
|
24
16
|
setup
|
|
25
17
|
end
|
|
26
18
|
|
|
19
|
+
def attachments
|
|
20
|
+
@main_document.try(:attachments) || []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def bm_currency(n)
|
|
24
|
+
currency(n, Dorsale::BillingMachine.default_currency)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
27
|
# rubocop:disable Style/SingleLineMethods, Layout/EmptyLineBetweenDefs
|
|
28
28
|
def header_height; 90.mm; end
|
|
29
29
|
def logo_height; 32.mm; end
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
:include_blank => ::Dorsale::CustomerVault::Person.t(:all_types)
|
|
5
5
|
|
|
6
6
|
= f.input :person_tags,
|
|
7
|
-
:collection =>
|
|
7
|
+
:collection => customer_vault_tag_list,
|
|
8
8
|
:input_html => {multiple: true},
|
|
9
9
|
:placeholder => ::Dorsale::CustomerVault::Person.t(:all_tags)
|
|
10
10
|
|
|
11
11
|
= f.input :person_origin,
|
|
12
|
-
:collection =>
|
|
12
|
+
:collection => customer_vault_origins_for_select,
|
|
13
13
|
:include_blank => ::Dorsale::CustomerVault::Person.t(:all_origins)
|
|
14
14
|
|
|
15
15
|
= f.input :person_activity,
|
|
16
|
-
:collection =>
|
|
16
|
+
:collection => customer_vault_activity_types_for_select,
|
|
17
17
|
:include_blank => ::Dorsale::CustomerVault::Person.t(:all_activity_types)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
= f.association :origin, collection: policy_scope(Dorsale::CustomerVault::Origin), input_html: {class: 'select2'}
|
|
15
15
|
- if @person.corporation?
|
|
16
16
|
= f.association :activity_type, collection: policy_scope(Dorsale::CustomerVault::ActivityType), input_html: {class: 'select2'}
|
|
17
|
-
= f.input :tag_list, collection:
|
|
17
|
+
= f.input :tag_list, collection: customer_vault_tag_list, input_html: {multiple: true}
|
|
18
18
|
|
|
19
19
|
.panel.panel-default
|
|
20
20
|
.panel-heading: .panel-title = t("customer_vault.additional_informations")
|
data/lib/dorsale/version.rb
CHANGED
|
@@ -30,96 +30,108 @@ describe Dorsale::BillingMachine::InvoicesController, type: :controller do
|
|
|
30
30
|
end # describe "PDF export"
|
|
31
31
|
|
|
32
32
|
describe "filters" do
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
filter
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
filter
|
|
62
|
-
|
|
63
|
-
@today
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
@yesterday,
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
@last_week
|
|
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
|
-
|
|
33
|
+
describe "filter by date" do
|
|
34
|
+
before do
|
|
35
|
+
Timecop.freeze "2016-11-08 12:00:00"
|
|
36
|
+
@today = create(:billing_machine_invoice, date: "2016-11-08")
|
|
37
|
+
@yesterday = create(:billing_machine_invoice, date: "2016-11-07")
|
|
38
|
+
@tomorrow = create(:billing_machine_invoice, date: "2016-11-09")
|
|
39
|
+
@last_week = create(:billing_machine_invoice, date: "2016-11-04")
|
|
40
|
+
@last_month = create(:billing_machine_invoice, date: "2016-10-18")
|
|
41
|
+
@last_year = create(:billing_machine_invoice, date: "2015-10-18")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def filter(period)
|
|
45
|
+
cookies[:filters] = {"bm_time_period" => period.to_s}.to_json
|
|
46
|
+
get :index
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it "should filter by all_time" do
|
|
50
|
+
filter :all_time
|
|
51
|
+
expect(assigns :invoices).to contain_exactly(
|
|
52
|
+
@today,
|
|
53
|
+
@yesterday,
|
|
54
|
+
@tomorrow,
|
|
55
|
+
@last_week,
|
|
56
|
+
@last_month,
|
|
57
|
+
@last_year,
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "should filter by today" do
|
|
62
|
+
filter :today
|
|
63
|
+
expect(assigns :invoices).to contain_exactly(@today)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it "should filter by yesterday" do
|
|
67
|
+
filter :yesterday
|
|
68
|
+
expect(assigns :invoices).to contain_exactly(@yesterday)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "should filter by this_week" do
|
|
72
|
+
filter :this_week
|
|
73
|
+
expect(assigns :invoices).to contain_exactly(@today, @yesterday, @tomorrow)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "should filter by this_month" do
|
|
77
|
+
filter :this_month
|
|
78
|
+
expect(assigns :invoices).to contain_exactly(@today, @yesterday, @tomorrow, @last_week)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it "should filter by this_year" do
|
|
82
|
+
filter :this_year
|
|
83
|
+
expect(assigns :invoices).to \
|
|
84
|
+
contain_exactly(@today, @yesterday, @tomorrow, @last_week, @last_month)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it "should filter by last_week" do
|
|
88
|
+
filter :last_week
|
|
89
|
+
expect(assigns :invoices).to contain_exactly(@last_week)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it "should filter by last_month" do
|
|
93
|
+
filter :last_month
|
|
94
|
+
expect(assigns :invoices).to contain_exactly(@last_month)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "should filter by last_year" do
|
|
98
|
+
filter :last_year
|
|
99
|
+
expect(assigns :invoices).to contain_exactly(@last_year)
|
|
100
|
+
end
|
|
101
|
+
end # describe "filter by date"
|
|
102
|
+
|
|
103
|
+
describe "filter by payment status" do
|
|
104
|
+
before do
|
|
105
|
+
Timecop.freeze "2016-11-08 12:00:00"
|
|
106
|
+
@paid = create(:billing_machine_invoice, paid: true, due_date: "2016-01-08")
|
|
107
|
+
@pending = create(:billing_machine_invoice, paid: false, due_date: "2016-11-10")
|
|
108
|
+
@late = create(:billing_machine_invoice, paid: false, due_date: "2016-06-05")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def filter(value)
|
|
112
|
+
cookies[:filters] = {"bm_payment_status" => value.to_s}.to_json
|
|
113
|
+
get :index
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it "should filter by paid" do
|
|
117
|
+
filter :paid
|
|
118
|
+
expect(assigns :invoices).to contain_exactly(@paid)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it "should filter by unpaid" do
|
|
122
|
+
filter :unpaid
|
|
123
|
+
expect(assigns :invoices).to contain_exactly(@pending, @late)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "should filter by pending" do
|
|
127
|
+
filter :pending
|
|
128
|
+
expect(assigns :invoices).to contain_exactly(@pending)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
it "should filter by late" do
|
|
132
|
+
filter :late
|
|
133
|
+
expect(assigns :invoices).to contain_exactly(@late)
|
|
134
|
+
end
|
|
135
|
+
end # describe "filter by payment status"
|
|
124
136
|
end # describe "filters"
|
|
125
137
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dorsale
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.9.
|
|
4
|
+
version: 3.9.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- agilidée
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-12-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|