class ComptaAdmin
Public Instance Methods
layout()
click to toggle source
# File lib/africompta/views/compta/admin.rb, line 2 def layout @order = 300 @rsync_log = '/tmp/update_africompta' gui_vbox do gui_hbox do show_button :merge end gui_hbox do show_button :update_program end gui_hbox do show_button :archive, :clean_up, :connect_server end gui_window :result do show_html :txt show_button :close end gui_window :get_server do show_str :url, width: 200 show_str :user show_str :pass show_button :copy_from_server end end end
rpc_update_view(session)
click to toggle source
Calls superclass method
# File lib/africompta/views/compta/admin.rb, line 30 def rpc_update_view(session) super(session) + reply_visible(ConfigBase.has_function?(:accounting_standalone), [:connect_server, :update_program]) end
rpc_update_with_values(session, data)
click to toggle source
# File lib/africompta/views/compta/admin.rb, line 81 def rpc_update_with_values(session, data) case session.s_data._compta_admin when :merge stat_str = %w(got_accounts put_accounts got_movements put_movements put_movements_changes).collect { |v| "#{v}: #{@remote.send(v)}" }. join('<br>') ret = @remote.step =~ /^done/ ? reply(:auto_update, 0) : [] ret + reply(:update, txt: "Merge-step: #{@remote.step}<br>" + stat_str) when :update_program stat = IO.read(@rsync_log).split("\r") if Process.waitpid(session.s_data._update_program, Process::WNOHANG) session.s_data._update_program = nil reply(:update, txt: 'Update finished<br>eventual non-100% total is normal<br>' + stat.last(2).join('<br>')) + reply(:auto_update, 0) else reply(:update, txt: 'Updating<br>' + stat.last.to_s) end else dputs(0) { "Updating with #{data.inspect} and #{session.inspect}" } end end