mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
Log changes in Invoices or InvoiceItems records for better handling of accounting certification issues
This commit is contained in:
parent
f60d19fa27
commit
3320ee103b
@ -1,5 +1,6 @@
|
||||
# Changelog Fab Manager
|
||||
|
||||
- Log changes in Invoices or InvoiceItems records for better handling of accounting certification issues
|
||||
- Upgrade dev environments from ruby 2.3.6 to 2.3.8 (#143)
|
||||
- Fix a bug: Users with role 'member' cannot download their invoices
|
||||
- [TODO DEPLOY] `rake db:migrate`
|
||||
|
@ -27,6 +27,7 @@ class Invoice < ActiveRecord::Base
|
||||
before_create :add_environment
|
||||
after_create :update_reference, :chain_record
|
||||
after_commit :generate_and_send_invoice, on: [:create], if: :persisted?
|
||||
after_update :log_changes
|
||||
|
||||
validates_with ClosedPeriodValidator
|
||||
|
||||
@ -311,4 +312,13 @@ class Invoice < ActiveRecord::Base
|
||||
Checksum.text("#{columns.map { |c| self[c] }.join}#{previous.first ? previous.first.footprint : ''}")
|
||||
end
|
||||
|
||||
def log_changes
|
||||
return unless changed?
|
||||
|
||||
puts "WARNING: Invoice update triggered [ id: #{id}, reference: #{reference} ]"
|
||||
puts '---------- changes ----------'
|
||||
puts changes
|
||||
puts '---------------------------------'
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -10,6 +10,7 @@ class InvoiceItem < ActiveRecord::Base
|
||||
has_one :invoice_item # to associated invoice_items of an invoice to invoice_items of an avoir
|
||||
|
||||
after_create :chain_record
|
||||
after_update :log_changes
|
||||
|
||||
def chain_record
|
||||
self.footprint = compute_footprint
|
||||
@ -32,4 +33,13 @@ class InvoiceItem < ActiveRecord::Base
|
||||
|
||||
Checksum.text("#{columns.map { |c| self[c] }.join}#{previous.first ? previous.first.footprint : ''}")
|
||||
end
|
||||
|
||||
def log_changes
|
||||
return unless changed?
|
||||
|
||||
puts "WARNING: InvoiceItem update triggered [ id: #{id}, invoice reference: #{invoice.reference} ]"
|
||||
puts '---------- changes ----------'
|
||||
puts changes
|
||||
puts '---------------------------------'
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user