dorsale 3.14.10 → 3.18.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/app/assets/javascripts/dorsale/dependencies.coffee +1 -1
  4. data/app/assets/javascripts/dorsale/engines/billing_machine.coffee.erb +14 -0
  5. data/app/assets/stylesheets/dorsale/engines/billing_machine.sass +4 -1
  6. data/app/controllers/dorsale/billing_machine/invoices_controller.rb +14 -9
  7. data/app/controllers/dorsale/billing_machine/quotations_controller.rb +14 -9
  8. data/app/controllers/dorsale/flyboy/task_comments_controller.rb +2 -2
  9. data/app/mailers/dorsale/flyboy/task_mailer.rb +2 -2
  10. data/app/models/dorsale/billing_machine/invoice.rb +2 -4
  11. data/app/models/dorsale/billing_machine/invoice_line.rb +1 -1
  12. data/app/models/dorsale/billing_machine/quotation.rb +1 -1
  13. data/app/models/dorsale/billing_machine/quotation_line.rb +1 -1
  14. data/app/models/dorsale/customer_vault/corporation.rb +11 -2
  15. data/app/models/dorsale/customer_vault/individual.rb +4 -2
  16. data/app/models/dorsale/customer_vault/person.rb +1 -1
  17. data/app/models/dorsale/expense_gun/expense.rb +3 -3
  18. data/app/services/dorsale/billing_machine/pdf_file_generator.rb +0 -7
  19. data/app/services/dorsale/flyboy/task/snoozer.rb +1 -1
  20. data/app/uploaders/dorsale/image_uploader.rb +1 -1
  21. data/app/uploaders/dorsale/pdf_uploader.rb +1 -1
  22. data/app/views/dorsale/billing_machine/commons/_form.html.slim +2 -1
  23. data/app/views/dorsale/billing_machine/commons/_line_fields.html.slim +4 -0
  24. data/app/views/dorsale/flyboy/task_mailer/new_task.html.slim +1 -1
  25. data/app/views/dorsale/flyboy/task_mailer/term_email.html.slim +1 -1
  26. data/config/locales/billing_machine.fr.yml +1 -0
  27. data/db/migrate/20210202100529_billing_machine_add_positions.rb +6 -0
  28. data/db/migrate/20210311131928_billing_machine_add_missing_unique_indexes.rb +6 -0
  29. data/features/step_definitions/customer_vault_people_steps.rb +1 -1
  30. data/lib/dorsale/version.rb +1 -1
  31. data/spec/controllers/dorsale/flyboy/task_comments_controller_spec.rb +2 -2
  32. data/spec/factories/customer_vault_individuals.rb +13 -13
  33. data/spec/factories/expense_gun_categories.rb +3 -3
  34. data/spec/factories/expense_gun_expense_lines.rb +7 -7
  35. data/spec/factories/expense_gun_expenses.rb +3 -3
  36. data/spec/pdfs/dorsale/billing_machine/invoice_multiple_vat_pdf_spec.rb +1 -1
  37. data/spec/pdfs/dorsale/billing_machine/invoice_single_vat_pdf_spec.rb +1 -1
  38. data/spec/pdfs/dorsale/billing_machine/quotation_multiple_vat_pdf_spec.rb +1 -1
  39. data/spec/pdfs/dorsale/billing_machine/quotation_single_vat_pdf_spec.rb +1 -1
  40. data/spec/rails_helper.rb +0 -1
  41. metadata +5 -21
  42. data/app/assets/javascripts/url.min.js +0 -1
  43. data/app/models/dorsale/customer_vault/corporation_data.rb +0 -10
  44. data/app/models/dorsale/customer_vault/individual_data.rb +0 -3
  45. data/app/models/dorsale/customer_vault/person_data.rb +0 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bed10bfd8955fa8dec1e5c01787b450201bfb08941099fbe6d2e413f8b679dd1
4
- data.tar.gz: 7bdab067a557c8d7ceb4d660462be2452bb429cf6bdbd540c84b6b3dc5972446
3
+ metadata.gz: f967e032d9c4918a372978e3c92216d542751e9e29881843aa029c7d63be401f
4
+ data.tar.gz: 35fbc1b26a2dea2067f936674324804b8d02fd6a673adfd92354886060b56ced
5
5
  SHA512:
6
- metadata.gz: 83a3b664703cae40e41a194157e4369474d461b29042e48e13b4d259dd02f3db99e2835c885b73d83e1bc254e1d1a3c51ef7b4a025db86d45ab3653bb7da4fb0
7
- data.tar.gz: '03826fb01f8843a16685a23d319611d393f988376b59418d37cbfa60fcc7e0f3baf44f518ed9a581d682615cce7061e5c35e805087eacf7dac3803edb19506ca'
6
+ metadata.gz: b0bb3cf0a9cd7322cc3e6928101ba486c8dddd577fa9962f1c462612d3c876e2df525224acdc6a2a4902510943ca61c500986431a6b1e895313f246c60467826
7
+ data.tar.gz: 135ff2e5848baede200b8ab36ba6bed2078f1c56024a8a1e901bcad21b9ae3f0bb700a314d74582006ae9275d6779f082bbcd6d17577af38f9296291fa379c76
data/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ # 3.18.0
6
+ - Change uploaders `extension_whitelist` to `extension_allowlist`
7
+ - Rails 6.1 compatibility
8
+
9
+ ## 3.17.0
10
+ - Refactor CV models using stores
11
+ - Fix redirect after task comment create
12
+ - Add missing unique indexes on invoices and quotations
13
+
14
+ ## 3.16.0
15
+ - Allow to reorder BM lines (require Sorting.js + reimport migrations)
16
+ - Remove unused url.js
17
+
18
+ ## 3.15.0
19
+ - Fix Ruby 2.7 warnings
20
+ - Faker 2
21
+
22
+ ## 3.14.11
23
+ - Fix BM missing PDFs
24
+
5
25
  ## 3.14.10
6
26
  - Change BillingMachine PDF filenames
7
27
  - Fix CustomerVault layout
@@ -4,11 +4,11 @@
4
4
  //= require bootstrap
5
5
  //= require cocoon
6
6
  //= require accounting
7
- //= require url.min
8
7
  //= require select2
9
8
  //= require select2_locale_fr
10
9
  //= require bootstrap-datepicker/core
11
10
  //= require bootstrap-datepicker/locales/bootstrap-datepicker.fr
12
11
  //= require Chart.bundle
13
12
  //= require chartkick
13
+ //= require Sortable
14
14
  //= require agilibox/all
@@ -77,6 +77,10 @@ BillingMachine.formatInputs = ->
77
77
  formatted_number = BillingMachine.num2str BillingMachine.str2num $(this).val()
78
78
  $(this).val formatted_number
79
79
 
80
+ BillingMachine.updatePositions = ->
81
+ i = 0
82
+ $("#billing_machine-form input[name*=position]").map -> this.value = (i = i + 1)
83
+
80
84
  # Empty number inputs on focus if value is 0
81
85
  $(document).on "focus", "#billing_machine-form input.number", ->
82
86
  $(this).val("") if BillingMachine.str2num($(this).val()) == 0
@@ -96,6 +100,7 @@ $(document).on "click", "#billing_machine-form a.delete", (e) ->
96
100
  $(document).on "turbolinks:load cocoon:after-insert", ->
97
101
  BillingMachine.formatInputs()
98
102
  BillingMachine.updateTotals()
103
+ BillingMachine.updatePositions()
99
104
 
100
105
  # Fix Cocoon bug
101
106
  $("#billing_machine-form .line textarea").map ->
@@ -106,3 +111,12 @@ $(document).on "keyup", "#billing_machine-form input.number", ->
106
111
 
107
112
  $(document).on "blur", "#billing_machine-form input.number", ->
108
113
  BillingMachine.formatInputs()
114
+
115
+ $(document).on "turbolinks:load", ->
116
+ $("#billing_machine-form tbody").map ->
117
+ container = this
118
+
119
+ new Sortable container,
120
+ handle: ".handle"
121
+ animation: 150
122
+ onSort: -> BillingMachine.updatePositions()
@@ -103,11 +103,14 @@
103
103
 
104
104
  th.actions,
105
105
  td.actions,
106
+ th.position,
107
+ td.position,
106
108
  padding: 0
107
109
  width: 2.5em
108
110
  text-align: center
109
111
 
110
- th.actions
112
+ th.actions,
113
+ th.position,
111
114
  border: none
112
115
 
113
116
  // disabled fields
@@ -157,15 +157,20 @@ class Dorsale::BillingMachine::InvoicesController < ::Dorsale::BillingMachine::A
157
157
  :advance,
158
158
  :due_date,
159
159
  :comments,
160
- :lines_attributes => [
161
- :_destroy,
162
- :id,
163
- :label,
164
- :quantity,
165
- :unit,
166
- :unit_price,
167
- :vat_rate,
168
- ],
160
+ :lines_attributes => line_permitted_params,
161
+ ]
162
+ end
163
+
164
+ def line_permitted_params
165
+ [
166
+ :_destroy,
167
+ :id,
168
+ :label,
169
+ :quantity,
170
+ :unit,
171
+ :unit_price,
172
+ :vat_rate,
173
+ :position,
169
174
  ]
170
175
  end
171
176
 
@@ -165,15 +165,20 @@ class Dorsale::BillingMachine::QuotationsController < ::Dorsale::BillingMachine:
165
165
  :comments,
166
166
  :vat_rate,
167
167
  :commercial_discount,
168
- :lines_attributes => [
169
- :_destroy,
170
- :id,
171
- :label,
172
- :quantity,
173
- :unit,
174
- :unit_price,
175
- :vat_rate,
176
- ],
168
+ :lines_attributes => line_permitted_params,
169
+ ]
170
+ end
171
+
172
+ def line_permitted_params
173
+ [
174
+ :_destroy,
175
+ :id,
176
+ :label,
177
+ :quantity,
178
+ :unit,
179
+ :unit_price,
180
+ :vat_rate,
181
+ :position,
177
182
  ]
178
183
  end
179
184
 
@@ -19,9 +19,9 @@ class Dorsale::Flyboy::TaskCommentsController < ::Dorsale::Flyboy::ApplicationCo
19
19
 
20
20
  def back_url
21
21
  task_path = flyboy_task_path(@task)
22
- back_url = super
22
+ back_url = super.to_s
23
23
 
24
- if back_url.to_s.start_with?(task_path)
24
+ if back_url == task_path || back_url.start_with?(task_path + "?")
25
25
  back_url
26
26
  else
27
27
  task_path
@@ -11,7 +11,7 @@ class Dorsale::Flyboy::TaskMailer < ::Dorsale::ApplicationMailer
11
11
 
12
12
  mail(
13
13
  :to => task.owner.email,
14
- :subject => t("task_mailer.new_task.subject", @locals),
14
+ :subject => t("task_mailer.new_task.subject", **@locals),
15
15
  )
16
16
  end
17
17
 
@@ -26,7 +26,7 @@ class Dorsale::Flyboy::TaskMailer < ::Dorsale::ApplicationMailer
26
26
 
27
27
  mail(
28
28
  :to => task.owner.email,
29
- :subject => t("task_mailer.term_email.subject", @locals),
29
+ :subject => t("task_mailer.term_email.subject", **@locals),
30
30
  )
31
31
  end
32
32
  end
@@ -55,7 +55,7 @@ class Dorsale::BillingMachine::Invoice < ::Dorsale::ApplicationRecord
55
55
  lines.each(&:update_total)
56
56
  apply_vat_rate_to_lines
57
57
 
58
- lines_sum = lines.map(&:total).sum.round(2)
58
+ lines_sum = lines.sum(&:total).round(2)
59
59
 
60
60
  self.total_excluding_taxes = lines_sum - commercial_discount
61
61
 
@@ -109,9 +109,7 @@ class Dorsale::BillingMachine::Invoice < ::Dorsale::ApplicationRecord
109
109
  def payment_status
110
110
  if paid?
111
111
  :paid
112
- elsif due_date.nil?
113
- :on_alert
114
- elsif Date.current >= due_date + 15
112
+ elsif due_date.nil? || Date.current >= due_date + 15
115
113
  :on_alert
116
114
  elsif Date.current > due_date
117
115
  :late
@@ -6,7 +6,7 @@ class Dorsale::BillingMachine::InvoiceLine < ::Dorsale::ApplicationRecord
6
6
  validates :invoice, presence: true
7
7
 
8
8
  default_scope -> {
9
- order(created_at: :asc)
9
+ order(position: :asc, created_at: :asc, id: :asc)
10
10
  }
11
11
 
12
12
  before_validation :update_total
@@ -61,7 +61,7 @@ class Dorsale::BillingMachine::Quotation < ::Dorsale::ApplicationRecord
61
61
  lines.each(&:update_total)
62
62
  apply_vat_rate_to_lines
63
63
 
64
- lines_sum = lines.map(&:total).sum
64
+ lines_sum = lines.sum(&:total)
65
65
 
66
66
  self.total_excluding_taxes = lines_sum - commercial_discount
67
67
 
@@ -6,7 +6,7 @@ class Dorsale::BillingMachine::QuotationLine < ::Dorsale::ApplicationRecord
6
6
  validates :quotation, presence: true
7
7
 
8
8
  default_scope -> {
9
- order(:created_at => :asc)
9
+ order(position: :asc, created_at: :asc, id: :asc)
10
10
  }
11
11
 
12
12
  before_validation :update_total
@@ -1,6 +1,15 @@
1
1
  class Dorsale::CustomerVault::Corporation < Dorsale::CustomerVault::Person
2
- serialize :data, Dorsale::CustomerVault::CorporationData
3
- def_delegators :data, *Dorsale::CustomerVault::CorporationData.methods_to_delegate
2
+ data_attributes = %i(
3
+ legal_form
4
+ immatriculation_number
5
+ naf
6
+ european_union_vat_number
7
+ societe_com
8
+ capital
9
+ revenue
10
+ number_of_employees
11
+ )
12
+ store :data, accessors: data_attributes, coder: JSON
4
13
 
5
14
  validates :corporation_name, presence: true
6
15
  has_many :individuals, dependent: :nullify
@@ -1,6 +1,8 @@
1
1
  class Dorsale::CustomerVault::Individual < Dorsale::CustomerVault::Person
2
- serialize :data, Dorsale::CustomerVault::IndividualData
3
- def_delegators :data, *Dorsale::CustomerVault::IndividualData.methods_to_delegate
2
+ data_attributes = %i(
3
+ title
4
+ )
5
+ store :data, accessors: data_attributes, coder: JSON
4
6
 
5
7
  validates :first_name, presence: true
6
8
  validates :last_name, presence: true
@@ -10,7 +10,7 @@ class Dorsale::CustomerVault::Person < ::Dorsale::ApplicationRecord
10
10
  end
11
11
 
12
12
  def verify_class
13
- if self.class == ::Dorsale::CustomerVault::Person
13
+ if instance_of?(Dorsale::CustomerVault::Person)
14
14
  # self.abstract_class does not work with STI
15
15
  raise "Cannot directly instantiate Person class"
16
16
  end
@@ -29,17 +29,17 @@ class Dorsale::ExpenseGun::Expense < ::Dorsale::ApplicationRecord
29
29
 
30
30
  # Sum of line amounts
31
31
  def total_all_taxes
32
- expense_lines.map(&:total_all_taxes).sum
32
+ expense_lines.sum(&:total_all_taxes)
33
33
  end
34
34
 
35
35
  # Sum of line emplee payback
36
36
  def total_employee_payback
37
- expense_lines.map(&:employee_payback).sum
37
+ expense_lines.sum(&:employee_payback)
38
38
  end
39
39
 
40
40
  # Sum of deductible deductible vat
41
41
  def total_vat_deductible
42
- expense_lines.map(&:total_vat_deductible).sum
42
+ expense_lines.sum(&:total_vat_deductible)
43
43
  end
44
44
 
45
45
  delegate :current_state, to: :aasm
@@ -4,13 +4,6 @@ class Dorsale::BillingMachine::PdfFileGenerator < Dorsale::Service
4
4
  def initialize(document)
5
5
  super()
6
6
  @document = document
7
-
8
- # I have no idea why I need to do that,
9
- # if I don't do that, CarrierWare do not stores the file.
10
- # The reload() method don't work either.
11
- # The problem appears only on server, not in console.
12
- # I think CarrierWave do not work anymore after first save.
13
- @document = document.class.find(document.id) if document.persisted?
14
7
  end
15
8
 
16
9
  def call
@@ -29,7 +29,7 @@ class Dorsale::Flyboy::Task::Snoozer < ::Dorsale::Service
29
29
  task.reminder_date <= current_date
30
30
  elsif task.term
31
31
  task.term <= current_date
32
- else
32
+ else # rubocop:disable Lint/DuplicateBranch
33
33
  false
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  class Dorsale::ImageUploader < ::Dorsale::ApplicationUploader
2
- def extension_whitelist
2
+ def extension_allowlist
3
3
  %w(jpg jpeg gif png)
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  class Dorsale::PdfUploader < ::Dorsale::ApplicationUploader
2
- def extension_whitelist
2
+ def extension_allowlist
3
3
  %w(pdf)
4
4
  end
5
5
  end
@@ -21,6 +21,7 @@
21
21
  table#lines-table
22
22
  thead
23
23
  tr
24
+ th.position
24
25
  th.actions
25
26
  th.line-label = Dorsale::BillingMachine::InvoiceLine.t(:label)
26
27
  th.line-quantity = Dorsale::BillingMachine::InvoiceLine.t(:quantity)
@@ -32,7 +33,7 @@
32
33
 
33
34
  tbody
34
35
  = f.simple_fields_for :lines do |lf|
35
- = render "dorsale/billing_machine/invoices/line_fields", f: lf
36
+ = render "dorsale/billing_machine/#{document.document_type}s/line_fields", f: lf
36
37
 
37
38
  .row
38
39
  .col-sm-6
@@ -1,4 +1,8 @@
1
1
  tr.line
2
+ td.position
3
+ = icon(:arrows_alt, class: "handle")
4
+ = f.hidden_field :position
5
+
2
6
  td.actions
3
7
  a.delete href="#"
4
8
  span.fa.fa-fw.fa-trash
@@ -1 +1 @@
1
- p == lf2br t("task_mailer.new_task.body", @locals)
1
+ p == lf2br t("task_mailer.new_task.body", **@locals)
@@ -1 +1 @@
1
- p == lf2br t("task_mailer.term_email.body", @locals)
1
+ p == lf2br t("task_mailer.term_email.body", **@locals)
@@ -25,6 +25,7 @@ fr:
25
25
  expires_at: "Date d'expiration"
26
26
  balance: "Reste à payer"
27
27
  pdf_file: "Fichier PDF"
28
+ position: "Position"
28
29
 
29
30
  activerecord:
30
31
  models:
@@ -0,0 +1,6 @@
1
+ class BillingMachineAddPositions < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_column :dorsale_billing_machine_invoice_lines, :position, :integer, null: false, default: 0
4
+ add_column :dorsale_billing_machine_quotation_lines, :position, :integer, null: false, default: 0
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ class BillingMachineAddMissingUniqueIndexes < ActiveRecord::Migration[6.0]
2
+ def change
3
+ add_index :dorsale_billing_machine_invoices, :unique_index, unique: true
4
+ add_index :dorsale_billing_machine_quotations, :unique_index, unique: true
5
+ end
6
+ end
@@ -7,7 +7,7 @@ Then(/^the file is downloaded$/) do
7
7
  end
8
8
 
9
9
  Given(/^a very long comment on this person$/) do
10
- text = Faker::Lorem.paragraph(30)
10
+ text = Faker::Lorem.paragraph(sentence_count: 30)
11
11
  @comment = create(:customer_vault_event_comment, person: @person, text: text)
12
12
  end
13
13
 
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.14.10"
2
+ VERSION = "3.18.0"
3
3
  end
@@ -18,7 +18,7 @@ describe Dorsale::Flyboy::TaskCommentsController, type: :controller do
18
18
  expect(assigns(:task_comment).persisted?).to be true
19
19
  end
20
20
 
21
- it "should redirect to referrer if referrer is task" do
21
+ it "should redirect to referrer if referrer is task show" do
22
22
  url = flyboy_task_path(task) + "?sort=xxx"
23
23
  request.env["HTTP_REFERER"] = url
24
24
  post :create, params: valid_params
@@ -26,7 +26,7 @@ describe Dorsale::Flyboy::TaskCommentsController, type: :controller do
26
26
  end
27
27
 
28
28
  it "should redirect to task if referrer is not task" do
29
- url = "/anywhere"
29
+ url = flyboy_task_path(task) + "/some-action"
30
30
  request.env["HTTP_REFERER"] = url
31
31
  post :create, params: valid_params
32
32
  expect(response).to redirect_to flyboy_task_path(task)
@@ -1,17 +1,17 @@
1
1
  FactoryBot.define do
2
2
  factory :customer_vault_individual, class: ::Dorsale::CustomerVault::Individual do
3
- origin { create(:customer_vault_origin) }
4
- first_name { Faker::Name.first_name }
5
- last_name { Faker::Name.last_name }
6
- short_name { "SN" }
7
- email { Faker::Internet.email("#{first_name} #{last_name}") }
8
- title { "Individual-Title" }
9
- twitter { "#{first_name}#{last_name}" }
10
- www { Faker::Internet.url }
11
- context { "Individual-Context" }
12
- phone { "01 23 xx xx xx" }
13
- fax { "09 xx xx xx xx" }
14
- mobile { "06 xx xx xx xx" }
15
- address { build(:dorsale_address) }
3
+ origin { create(:customer_vault_origin) }
4
+ first_name { Faker::Name.first_name }
5
+ last_name { Faker::Name.last_name }
6
+ short_name { "SN" }
7
+ email { Faker::Internet.email(name: name) }
8
+ title { "Individual-Title" }
9
+ twitter { "#{first_name}#{last_name}" }
10
+ www { Faker::Internet.url }
11
+ context { "Individual-Context" }
12
+ phone { "01 23 xx xx xx" }
13
+ fax { "09 xx xx xx xx" }
14
+ mobile { "06 xx xx xx xx" }
15
+ address { build(:dorsale_address) }
16
16
  end
17
17
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :expense_gun_category, class: ::Dorsale::ExpenseGun::Category do
3
- name { Faker::Lorem.word }
4
- code { Faker::Number.number(4) }
5
- vat_deductible { [true, false].sample }
3
+ name { Faker::Lorem.word }
4
+ code { Faker::Number.number(digits: 4) }
5
+ vat_deductible { [true, false].sample }
6
6
  end
7
7
  end
@@ -1,11 +1,11 @@
1
1
  FactoryBot.define do
2
2
  factory :expense_gun_expense_line, class: ::Dorsale::ExpenseGun::ExpenseLine do
3
- expense { build(:expense_gun_expense) }
4
- name { Faker::Lorem.sentence(3) }
5
- category { build(:expense_gun_category) }
6
- date { Faker::Date.backward(30) }
7
- total_all_taxes { rand(100..1000) }
8
- vat { rand(1..(total_all_taxes/5)) }
9
- company_part { [25, 50, 75, 100].sample }
3
+ expense { build(:expense_gun_expense) }
4
+ name { Faker::Lorem.sentence(word_count: 3) }
5
+ category { build(:expense_gun_category) }
6
+ date { Faker::Date.backward(days: 30) }
7
+ total_all_taxes { rand(100..1000) }
8
+ vat { rand(1..(total_all_taxes/5)) }
9
+ company_part { [25, 50, 75, 100].sample }
10
10
  end
11
11
  end
@@ -1,8 +1,8 @@
1
1
  FactoryBot.define do
2
2
  factory :expense_gun_expense, class: ::Dorsale::ExpenseGun::Expense do
3
- name { Faker::Lorem.sentence(3) }
4
- date { Date.current }
5
- user { create(:user) }
3
+ name { Faker::Lorem.sentence(word_count: 3) }
4
+ date { Date.current }
5
+ user { create(:user) }
6
6
 
7
7
  after(:create) { |expense|
8
8
  rand(2..5).times {
@@ -23,7 +23,7 @@ describe ::Dorsale::BillingMachine::InvoiceMultipleVatPdf, pdfs: true do
23
23
 
24
24
  let(:content) {
25
25
  generate!
26
- Yomu.new(invoice.pdf_file.path).text
26
+ PDF::Reader.new(invoice.pdf_file.path).pages.map(&:text).join("\n")
27
27
  }
28
28
 
29
29
  it "should not display global vat rate" do
@@ -23,7 +23,7 @@ describe ::Dorsale::BillingMachine::InvoiceSingleVatPdf, pdfs: true do
23
23
 
24
24
  let(:content) {
25
25
  generate!
26
- Yomu.new(invoice.pdf_file.path).text
26
+ PDF::Reader.new(invoice.pdf_file.path).pages.map(&:text).join("\n")
27
27
  }
28
28
 
29
29
  it "should display global vat rate" do
@@ -23,7 +23,7 @@ describe ::Dorsale::BillingMachine::QuotationMultipleVatPdf, pdfs: true do
23
23
 
24
24
  let(:content) {
25
25
  generate!
26
- Yomu.new(quotation.pdf_file.path).text
26
+ PDF::Reader.new(quotation.pdf_file.path).pages.map(&:text).join("\n")
27
27
  }
28
28
 
29
29
  it "should not display global vat rate" do
@@ -23,7 +23,7 @@ describe ::Dorsale::BillingMachine::QuotationSingleVatPdf, pdfs: true do
23
23
 
24
24
  let(:content) {
25
25
  generate!
26
- Yomu.new(quotation.pdf_file.path).text
26
+ PDF::Reader.new(quotation.pdf_file.path).pages.map(&:text).join("\n")
27
27
  }
28
28
 
29
29
  it "should display global vat rate" do
data/spec/rails_helper.rb CHANGED
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
  require File.expand_path("../dummy/config/environment", __FILE__)
5
5
  require 'rspec/rails'
6
6
  require "agilibox/rspec"
7
- require "yomu"
8
7
  # Add additional requires below this line. Rails is not loaded until this point!
9
8
  # Requires supporting ruby files with custom matchers and macros, etc,
10
9
  # in spec/support/ and its subdirectories.
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.14.10
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-21 00:00:00.000000000 Z
11
+ date: 2021-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -50,20 +50,6 @@ dependencies:
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '99'
53
- - !ruby/object:Gem::Dependency
54
- name: virtus
55
- requirement: !ruby/object:Gem::Requirement
56
- requirements:
57
- - - "<"
58
- - !ruby/object:Gem::Version
59
- version: '99'
60
- type: :runtime
61
- prerelease: false
62
- version_requirements: !ruby/object:Gem::Requirement
63
- requirements:
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: '99'
67
53
  - !ruby/object:Gem::Dependency
68
54
  name: slim-rails
69
55
  requirement: !ruby/object:Gem::Requirement
@@ -468,7 +454,6 @@ files:
468
454
  - app/assets/javascripts/dorsale/engines/billing_machine.coffee.erb
469
455
  - app/assets/javascripts/dorsale/engines/customer_vault.coffee
470
456
  - app/assets/javascripts/dorsale/engines/flyboy.coffee
471
- - app/assets/javascripts/url.min.js
472
457
  - app/assets/stylesheets/dorsale/all.sass
473
458
  - app/assets/stylesheets/dorsale/common.sass
474
459
  - app/assets/stylesheets/dorsale/common/comments.sass
@@ -550,14 +535,11 @@ files:
550
535
  - app/models/dorsale/customer_vault.rb
551
536
  - app/models/dorsale/customer_vault/activity_type.rb
552
537
  - app/models/dorsale/customer_vault/corporation.rb
553
- - app/models/dorsale/customer_vault/corporation_data.rb
554
538
  - app/models/dorsale/customer_vault/event.rb
555
539
  - app/models/dorsale/customer_vault/individual.rb
556
- - app/models/dorsale/customer_vault/individual_data.rb
557
540
  - app/models/dorsale/customer_vault/link.rb
558
541
  - app/models/dorsale/customer_vault/origin.rb
559
542
  - app/models/dorsale/customer_vault/person.rb
560
- - app/models/dorsale/customer_vault/person_data.rb
561
543
  - app/models/dorsale/email.rb
562
544
  - app/models/dorsale/expense_gun.rb
563
545
  - app/models/dorsale/expense_gun/category.rb
@@ -835,6 +817,8 @@ files:
835
817
  - db/migrate/20171023133219_customer_vault_events_add_contact_type.rb
836
818
  - db/migrate/20171024075514_customer_vault_contact_type_default_value.rb
837
819
  - db/migrate/20171115171425_dorsale_customer_vault_people_add_secondary_emails.rb
820
+ - db/migrate/20210202100529_billing_machine_add_positions.rb
821
+ - db/migrate/20210311131928_billing_machine_add_missing_unique_indexes.rb
838
822
  - features/access.feature
839
823
  - features/billing_machine_invoices.feature
840
824
  - features/billing_machine_multiple_vat.feature
@@ -989,7 +973,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
989
973
  - !ruby/object:Gem::Version
990
974
  version: '0'
991
975
  requirements: []
992
- rubygems_version: 3.0.3
976
+ rubygems_version: 3.1.6
993
977
  signing_key:
994
978
  specification_version: 4
995
979
  summary: Modular ERP made with Ruby on Rails
@@ -1 +0,0 @@
1
- /*! js-url - v2.3.0 - 2016-03-10 */window.url=function(){function a(){}function b(a){return decodeURIComponent(a.replace(/\+/g," "))}function c(a,b){var c=a.charAt(0),d=b.split(c);return c===a?d:(a=parseInt(a.substring(1),10),d[0>a?d.length+a:a-1])}function d(a,c){for(var d=a.charAt(0),e=c.split("&"),f=[],g={},h=[],i=a.substring(1),j=0,k=e.length;k>j;j++)if(f=e[j].match(/(.*?)=(.*)/),f||(f=[e[j],e[j],""]),""!==f[1].replace(/\s/g,"")){if(f[2]=b(f[2]||""),i===f[1])return f[2];h=f[1].match(/(.*)\[([0-9]+)\]/),h?(g[h[1]]=g[h[1]]||[],g[h[1]][h[2]]=f[2]):g[f[1]]=f[2]}return d===a?g:g[i]}return function(b,e){var f,g={};if("tld?"===b)return a();if(e=e||window.location.toString(),!b)return e;if(b=b.toString(),f=e.match(/^mailto:([^\/].+)/))g.protocol="mailto",g.email=f[1];else{if((f=e.match(/(.*?)\/#\!(.*)/))&&(e=f[1]+f[2]),(f=e.match(/(.*?)#(.*)/))&&(g.hash=f[2],e=f[1]),g.hash&&b.match(/^#/))return d(b,g.hash);if((f=e.match(/(.*?)\?(.*)/))&&(g.query=f[2],e=f[1]),g.query&&b.match(/^\?/))return d(b,g.query);if((f=e.match(/(.*?)\:?\/\/(.*)/))&&(g.protocol=f[1].toLowerCase(),e=f[2]),(f=e.match(/(.*?)(\/.*)/))&&(g.path=f[2],e=f[1]),g.path=(g.path||"").replace(/^([^\/])/,"/$1").replace(/\/$/,""),b.match(/^[\-0-9]+$/)&&(b=b.replace(/^([^\/])/,"/$1")),b.match(/^\//))return c(b,g.path.substring(1));if(f=c("/-1",g.path.substring(1)),f&&(f=f.match(/(.*?)\.(.*)/))&&(g.file=f[0],g.filename=f[1],g.fileext=f[2]),(f=e.match(/(.*)\:([0-9]+)$/))&&(g.port=f[2],e=f[1]),(f=e.match(/(.*?)@(.*)/))&&(g.auth=f[1],e=f[2]),g.auth&&(f=g.auth.match(/(.*)\:(.*)/),g.user=f?f[1]:g.auth,g.pass=f?f[2]:void 0),g.hostname=e.toLowerCase(),"."===b.charAt(0))return c(b,g.hostname);a()&&(f=g.hostname.match(a()),f&&(g.tld=f[3],g.domain=f[2]?f[2]+"."+f[3]:void 0,g.sub=f[1]||void 0)),g.port=g.port||("https"===g.protocol?"443":"80"),g.protocol=g.protocol||("443"===g.port?"https":"http")}return b in g?g[b]:"{}"===b?g:void 0}}(),"undefined"!=typeof jQuery&&jQuery.extend({url:function(a,b){return window.url(a,b)}});
@@ -1,10 +0,0 @@
1
- class Dorsale::CustomerVault::CorporationData < Dorsale::CustomerVault::PersonData
2
- attribute :legal_form, String
3
- attribute :immatriculation_number, String
4
- attribute :naf, String
5
- attribute :european_union_vat_number, String
6
- attribute :societe_com, String
7
- attribute :capital, Integer
8
- attribute :revenue, Integer
9
- attribute :number_of_employees, Integer
10
- end
@@ -1,3 +0,0 @@
1
- class Dorsale::CustomerVault::IndividualData < Dorsale::CustomerVault::PersonData
2
- attribute :title, String
3
- end
@@ -1,17 +0,0 @@
1
- require "virtus"
2
-
3
- class Dorsale::CustomerVault::PersonData
4
- include Virtus.model
5
-
6
- def self.dump(obj)
7
- JSON.dump(obj.attributes)
8
- end
9
-
10
- def self.load(json_string)
11
- new JSON.parse(json_string.presence || "{}")
12
- end
13
-
14
- def self.methods_to_delegate
15
- instance_methods - Dorsale::CustomerVault::PersonData.instance_methods
16
- end
17
- end