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

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#confirmObject

This method confirm all draft entries


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/controllers/backend/draft_journals_controller.rb', line 46

def confirm
  conditions = nil
  begin
    conditions = eval(self.class.journal_entries_conditions(with_journals: true, state: :draft))
    journal_entries = JournalEntry.where(conditions)
    undone = 0
    for entry in journal_entries
      entry.confirm if entry.can_confirm?
      undone += 1 if entry.draft?
    end
    notify_success(:draft_journal_entries_have_been_validated, count: journal_entries.size - undone)
  rescue Exception => e
    notify_error(:exception_raised, message: e.message)
  end
  redirect_to action: :show
end

#showObject

this method lists all the entries generated in draft mode


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

def show
end