class PersonModify
Allows to add, modify and delete persons
Public Instance Methods
layout()
click to toggle source
# File Views/Person/Modify.rb, line 6 def layout set_data_class :Persons @update = true @order = 10 gui_hbox do gui_vbox do gui_fields do show_str_ro :login_name, :width => 150 show_str_ro :person_id show_block :address end gui_hbox :nogroup do show_button :save, :print end end gui_vbox :nogroup do show_str :new_password show_str_ro :password_plain show_html :not_allowed show_button :change_password end gui_window :printing do show_html :msg_print show_button :next_page, :close end gui_window :print_choice do show_print :print_student show_print :print_library show_print :print_responsible show_button :close end end end
rpc_find(session, field, data)
click to toggle source
# File Views/Person/Modify.rb, line 107 def rpc_find(session, field, data) rep = Persons.find(field, data) if not rep rep = {"#{field}" => data} end update_layout(session) + reply(:update, rep) + rpc_update(session) end
rpc_list_choice(session, name, data)
click to toggle source
# File Views/Person/Modify.rb, line 116 def rpc_list_choice(session, name, data) if name == 'persons' dputs(3) { "Got data: #{data.inspect}" } if data['persons'][0] and p = Persons.match_by_login_name(data._persons.flatten[0]) can_change = p.show_password?(session.owner) || session.owner.has_permission?(:director) change_pwd = reply_one_two(can_change, %i(new_password password_plain change_password), :not_allowed) + reply_visible(p.show_password?(session.owner), :password_plain) + reply(:update, :not_allowed => "<b>Vous n'avez pas le droit<br>" + 'de changer ce mot de passe</b>') dputs(4) { "change_pwd is #{change_pwd.inspect}" } reply(:empty_nonlists) + reply(:update, p) + reply(:update, update(session)) + reply(:focus, :credit_add) + reply_print(session) + change_pwd end end end
rpc_update(session)
click to toggle source
Calls superclass method
# File Views/Person/Modify.rb, line 145 def rpc_update(session) super(session) + reply(:parent, reply(:focus, :search)) + reply_print(session) + (session.owner.permissions.index('center') ? reply(:hide, :print_student) : []) end
update(session)
click to toggle source
# File Views/Person/Modify.rb, line 137 def update(session) if person = session.owner if ConfigBase.has_function? :accounting {:your_account_total_due => person.account_total_due} end end end