2019-01-08 17:32:45 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# AccountingPeriod is a period of N days (N > 0) which as been closed by an admin
|
|
|
|
# to prevent writing new accounting lines (invoices & refunds) during this period of time.
|
2019-01-07 12:29:52 +01:00
|
|
|
class AccountingPeriod < ActiveRecord::Base
|
|
|
|
before_destroy { false }
|
|
|
|
before_update { false }
|
|
|
|
|
2019-01-08 17:32:45 +01:00
|
|
|
validates :start_at, :end_at, :closed_at, :closed_by, presence: true
|
|
|
|
validates_with DateRangeValidator
|
|
|
|
validates_with PeriodOverlapValidator
|
|
|
|
|
2019-01-07 12:29:52 +01:00
|
|
|
def delete
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|