Class: Backend::DraftJournalsController

Inherits:
BaseController show all
Includes:
JournalEntriesCondition
Defined in:
app/controllers/backend/draft_journals_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

account_lettering_states_crit, accounts_range_crit, amount_range_crit, crit_params, journal_entries_states_crit, journal_letter_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name, #session_controller?

Instance Method Details

#confirmObject

This method confirm all draft entries


45
46
47
48
49
50
51
52
53
54
55
# File 'app/controllers/backend/draft_journals_controller.rb', line 45

def confirm
  conditions = eval(self.class.journal_entries_conditions(with_journals: true, state: :draft))
  journal_entries = JournalEntry.where(conditions)
  count = journal_entries.count
  JournalEntry.transaction do
    journal_entries.update_all(state: :confirmed, validated_at: Time.zone.now)
    JournalEntryItem.where(entry_id: journal_entries).update_all(state: :confirmed)
  end
  notify_success(:draft_journal_entries_have_been_validated, count: count)
  redirect_to action: :show
end

#showObject

this method lists all the entries generated in draft mode


42
# File 'app/controllers/backend/draft_journals_controller.rb', line 42

def show; end