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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5358e48332086ea75f9a49b3578793b5d16967a4
4
- data.tar.gz: 12a4d387aa03f2b70f1461b9961b1e8cc034800a
3
+ metadata.gz: 2920c20a5fcc0b5057396ace7326452b10413142
4
+ data.tar.gz: 3b6318a593083ae63a1c4ad7e6b4ff19ca66beef
5
5
  SHA512:
6
- metadata.gz: eb146a34700533fc56964b13a83249d901233c4c3d746ca51454796e3c70bcd1c0013b513805ef47e622dc8732b001f5e2935fbfdadef1ed24d16dbb695bd34a
7
- data.tar.gz: e8a441114f93b6074e80d298b29c1a362686e5c5fc07a78af43e05bc77f09abf83f7893e0c561c475fec365367b604909787d96273ce32faf51e4e9e5fb084eb
6
+ metadata.gz: 7930f9d2cd19663154dd4b326d2216870d890a3fdf69251a337d1776b1963b925c8081078d062105b67e3be9b35a43d5ad1a63a44c44e6dd7164d1ac27df9149
7
+ data.tar.gz: 1c23b59eec27a27fa88934e35586c0617236077ad83ce16097ce0036d495be15ea97c99149d1fc343d4671201e118c47195e7c44db497723e1e0ddfb0864dc79
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.9.3
6
+
7
+ - BillingMachine : Fix payment status filter
8
+
5
9
  ## 3.9.2
6
10
 
7
11
  - CustomerVault : Add secondary emails + uniqueness validation
@@ -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 ||= ::Dorsale::CustomerVault::SmallData::FilterForPeople.new(filters_jar)
8
- @tags ||= customer_vault_tag_list
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)", Date.current)
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
- REMINDER_TYPES = %w(duration custom)
3
- REMINDER_UNITS = %w(days weeks months)
2
+ include ::Agilibox::Search
4
3
 
5
4
  self.table_name = "dorsale_flyboy_tasks"
6
5
 
7
- include ::Agilibox::Search
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 => @tags,
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 => @origins,
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 => @activity_types,
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: @tags, input_html: {multiple: true}
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")
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.9.2"
2
+ VERSION = "3.9.3"
3
3
  end
@@ -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
- before do
34
- Timecop.freeze "2016-11-08 12:00:00"
35
- @today = create(:billing_machine_invoice, date: "2016-11-08")
36
- @yesterday = create(:billing_machine_invoice, date: "2016-11-07")
37
- @tomorrow = create(:billing_machine_invoice, date: "2016-11-09")
38
- @last_week = create(:billing_machine_invoice, date: "2016-11-04")
39
- @last_month = create(:billing_machine_invoice, date: "2016-10-18")
40
- @last_year = create(:billing_machine_invoice, date: "2015-10-18")
41
- end
42
-
43
- def filter(period)
44
- cookies[:filters] = {"bm_time_period" => period.to_s}.to_json
45
- get :index
46
- end
47
-
48
- it "should filter by all_time" do
49
- filter :all_time
50
- expect(assigns :invoices).to contain_exactly(
51
- @today,
52
- @yesterday,
53
- @tomorrow,
54
- @last_week,
55
- @last_month,
56
- @last_year,
57
- )
58
- end
59
-
60
- it "should filter by today" do
61
- filter :today
62
- expect(assigns :invoices).to contain_exactly(
63
- @today,
64
- )
65
- end
66
-
67
- it "should filter by yesterday" do
68
- filter :yesterday
69
- expect(assigns :invoices).to contain_exactly(
70
- @yesterday,
71
- )
72
- end
73
-
74
- it "should filter by this_week" do
75
- filter :this_week
76
- expect(assigns :invoices).to contain_exactly(
77
- @today,
78
- @yesterday,
79
- @tomorrow,
80
- )
81
- end
82
-
83
- it "should filter by this_month" do
84
- filter :this_month
85
- expect(assigns :invoices).to contain_exactly(
86
- @today,
87
- @yesterday,
88
- @tomorrow,
89
- @last_week,
90
- )
91
- end
92
-
93
- it "should filter by this_year" do
94
- filter :this_year
95
- expect(assigns :invoices).to contain_exactly(
96
- @today,
97
- @yesterday,
98
- @tomorrow,
99
- @last_week,
100
- @last_month,
101
- )
102
- end
103
-
104
- it "should filter by last_week" do
105
- filter :last_week
106
- expect(assigns :invoices).to contain_exactly(
107
- @last_week,
108
- )
109
- end
110
-
111
- it "should filter by last_month" do
112
- filter :last_month
113
- expect(assigns :invoices).to contain_exactly(
114
- @last_month,
115
- )
116
- end
117
-
118
- it "should filter by last_year" do
119
- filter :last_year
120
- expect(assigns :invoices).to contain_exactly(
121
- @last_year,
122
- )
123
- end
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.2
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-29 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails