dorsale 3.15.0 → 3.16.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0bd710629c9ecaa72a71a0df0645d38fae72cc1a0f5203a0e4c5ddfd8c966f24
4
- data.tar.gz: 726555caa581d9251e2d40388414b974f5d1570fa5463be6ee28bd17c9a26b80
3
+ metadata.gz: 8c07aa163d58442697fc7cbbd50008cff4128218f6c28a567ec693fa028112a8
4
+ data.tar.gz: 137b46a639e3e82c637e001e6bcdf06e307f357fd07c4bc69fbcce69e7600bf5
5
5
  SHA512:
6
- metadata.gz: e8d08edee46c29a4f80adbc0f371d70c532f9e06325141837ff94bd19c9d116ae7e7f41fa077ae6ce94305ab45362502f3d459c2a703563c5b72fbead3bc47ae
7
- data.tar.gz: d41ad18d76e122b20249254ec2df1e79d016411cf3ca11060396cc859026d15f4a7a893e089e4dac32eb624aba83dcbf4bac7a1a1581f996da14306740352f7d
6
+ metadata.gz: 3cc2d98f933b68bb02d421f3f8ba132fa70d54c910292db9539b3c7e2bd8027692cf4d8e30ba333a0abfe6825bd34fee362a0f5d699c91a542ff7fcf0dac59ce
7
+ data.tar.gz: 00cc8a3a2a6ac15cdd523871ed2b8ea3ffeb7832006c6b643fe3e0c801aa17579de20e22d525f36a273bcf93fcb13142f0257bda5dcef56b0b5758e40bdccf04
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 3.16.0
6
+ - Allow to reorder BM lines (require Sorting.js + reimport migrations)
7
+ - Remove unused url.js
8
+
5
9
  ## 3.15.0
6
10
  - Fix Ruby 2.7 warnings
7
11
  - Faker 2
@@ -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
 
@@ -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
@@ -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
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Dorsale
2
- VERSION = "3.15.0"
2
+ VERSION = "3.16.0"
3
3
  end
@@ -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.15.0
4
+ version: 3.16.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-12-07 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -468,7 +468,6 @@ files:
468
468
  - app/assets/javascripts/dorsale/engines/billing_machine.coffee.erb
469
469
  - app/assets/javascripts/dorsale/engines/customer_vault.coffee
470
470
  - app/assets/javascripts/dorsale/engines/flyboy.coffee
471
- - app/assets/javascripts/url.min.js
472
471
  - app/assets/stylesheets/dorsale/all.sass
473
472
  - app/assets/stylesheets/dorsale/common.sass
474
473
  - app/assets/stylesheets/dorsale/common/comments.sass
@@ -835,6 +834,7 @@ files:
835
834
  - db/migrate/20171023133219_customer_vault_events_add_contact_type.rb
836
835
  - db/migrate/20171024075514_customer_vault_contact_type_default_value.rb
837
836
  - db/migrate/20171115171425_dorsale_customer_vault_people_add_secondary_emails.rb
837
+ - db/migrate/20210202100529_billing_machine_add_positions.rb
838
838
  - features/access.feature
839
839
  - features/billing_machine_invoices.feature
840
840
  - features/billing_machine_multiple_vat.feature
@@ -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)}});