vesr 0.6.3 → 0.7.0

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.
@@ -1,7 +1,7 @@
1
1
  class EsrRecord < ActiveRecord::Base
2
2
  belongs_to :esr_file
3
3
 
4
- belongs_to :booking, :dependent => :destroy
4
+ belongs_to :booking, :dependent => :destroy, :autosave => true
5
5
  belongs_to :invoice
6
6
 
7
7
  scope :valid, where(:state => 'valid')
@@ -40,7 +40,7 @@ class EsrRecord < ActiveRecord::Base
40
40
  end
41
41
 
42
42
  def client_id
43
- reference[0..5]
43
+ reference[0..7]
44
44
  end
45
45
 
46
46
  def invoice_id
@@ -48,7 +48,7 @@ class EsrRecord < ActiveRecord::Base
48
48
  end
49
49
 
50
50
  def customer_id
51
- reference[6..18].to_i
51
+ reference[8..18].to_i
52
52
  end
53
53
 
54
54
  def parse(line)
@@ -95,6 +95,8 @@ class EsrRecord < ActiveRecord::Base
95
95
  end
96
96
 
97
97
  def assign_invoice
98
+ # Prepare remarks to not be null
99
+ self.remarks ||= ''
98
100
  if Invoice.exists?(invoice_id)
99
101
  self.invoice_id = invoice_id
100
102
  self.remarks += "Referenz #{reference}"
@@ -133,14 +135,11 @@ class EsrRecord < ActiveRecord::Base
133
135
  esr_booking.update_attributes(
134
136
  :amount => amount,
135
137
  :credit_account => vesr_account,
136
- # :debit_account => Invoice::DEBIT_ACCOUNT,
137
- :debit_account => DebitInvoice.first.profit_account,
138
+ :debit_account => invoice.balance_account,
138
139
  :value_date => value_date,
139
140
  :title => "VESR Zahlung",
140
141
  :comments => remarks)
141
142
 
142
- esr_booking.save
143
-
144
143
  self.booking = esr_booking
145
144
 
146
145
  return esr_booking
@@ -1,3 +1,3 @@
1
1
  module Vesr
2
- VERSION = "0.6.3"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vesr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 6
9
- - 3
10
- version: 0.6.3
8
+ - 7
9
+ - 0
10
+ version: 0.7.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roman Simecek
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-12-02 00:00:00 +01:00
19
+ date: 2011-12-05 00:00:00 +01:00
20
20
  default_executable:
21
21
  dependencies: []
22
22