class ComptaEditAccounts
Public Instance Methods
get_mult_keep(acc)
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 48 def get_mult_keep(acc) [acc.multiplier == -1 ? 'active' : 'passive', acc.keep_total ? 'true' : 'false'] end
layout()
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 2 def layout @rpc_update = true @order = 200 @functions_need = [:accounting] gui_hboxg do gui_vboxg :nogroup do show_entity_account :account_archive, :drop, :callback => true show_entity_account :account_list, :single, :width => 400, :flex => 1, :callback => true show_button :delete, :new end gui_vbox :nogroup do show_str :name show_str :desc, :width => 300 show_list_drop :multiplier, '%w(passive active)' show_list_drop :keep_total, '%w(true false)' show_button :save, :account_update end gui_window :account_new do show_str :name_new, :width => 300 show_str :desc_new show_list_drop :multiplier_new, '%w(passive active)' show_list_drop :keep_total_new, '%w(true false)' show_button :add_account, :close end gui_window :msg_win do show_html :msg show_button :close end end end
rpc_list_choice_account_archive(session, data)
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 135 def rpc_list_choice_account_archive(session, data) update_list(data._account_archive) end
rpc_list_choice_account_list(session, data)
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 121 def rpc_list_choice_account_list(session, data) reply(:empty_nonlists) + if (acc = data._account_list) != [] mult, kt = get_mult_keep(acc) reply(:update, {total: acc.total_form, desc: acc.desc, name: acc.name, multiplier: [mult], keep_total: [kt]}) else [] end end
rpc_update_view(session)
click to toggle source
Calls superclass method
# File lib/africompta/views/compta/edit_accounts.rb, line 115 def rpc_update_view(session) super(session) + update_list + update_archive end
set_mult_keep(acc, mult, keep)
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 43 def set_mult_keep(acc, mult, keep) acc.multiplier = mult.first == 'active' ? -1 : 1 acc.keep_total = keep.first == 'true' end
update_archive()
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 104 def update_archive reply(:empty_nonlists, :account_archive) + reply(:update_silent, :account_archive => [[0, "Actual"]].concat( if archive = AccountRoot.archive archive.accounts.collect { |a| [a.id, a.path] }.sort_by { |a| a[1] } else [] end)) end
update_list(account = [])
click to toggle source
# File lib/africompta/views/compta/edit_accounts.rb, line 97 def update_list(account = []) account.class == Account or account = AccountRoot.current reply(:empty_nonlists, :account_list) + reply(:update, :account_list => account.listp_path) end