Class: ODDB::State::Admin::OrphanedFachinfoAssign

Inherits:
Global show all
Defined in:
src/state/admin/root.rb,
src/state/admin/orphaned_fachinfo_assign.rb

Defined Under Namespace

Classes: OrphanedFachinfoFacade

Constant Summary

VIEW =
View::Admin::OrphanedFachinfoAssign

Constants inherited from Global

HOME_STATE, ZONE

Constants inherited from Global

DIRECT_EVENT, GLOBAL_MAP, HOME_STATE, LIMITED, PRINT_STATES, READONLY_STATES, RESOLVE_STATES, REVERSE_MAP, VIEW, ZONE_NAVIGATION

Constants included from UmlautSort

FILTER_PAIRS

Instance Method Summary (collapse)

Methods inherited from Global

#zone_navigation

Methods inherited from Global

#_search_drugs, #_search_drugs_state, #_trigger, #add_to_interaction_basket, #allowed?, #atc_chooser, #checkout, #clear_interaction_basket, #creditable?, #direct_request_path, #doctorlist, #download, #export_csv, #extend, #fachinfo, #feedbacks, #help_navigation, #home_navigation, #home_state, #hospitallist, #interaction_basket, #limit_state, #limited?, #logout, #navigation, #notify, #password_reset, #paypal_return, #powerlink, #print, #proceed_download, #proceed_poweruser, #resolve, #resolve_state, #rss, #search, #show, #snapback_event, #sort, #sponsorlink, #suggest_address, #switch, #unique_email, #user_input, #user_navigation, #ywesee_contact, #zone_navigation, #zones

Methods included from LoginMethods

#autologin, #login

Methods included from UmlautSort

#sort_model, #umlaut_filter

Instance Method Details

- (Object) assign



26
27
28
29
30
31
32
33
34
35
36
37
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 26

def assign
  if(!@session.error? \
    && (pointers = @session.user_input(:pointers)) \
    && !pointers.empty?)
    @session.app.accept_orphaned(model.languages , pointers.values, :fachinfo)
    self
  else
    err = create_error(:e_no_registration_selected, :pointers, nil)
    @errors.store(:pointers, err)
    self
  end
end

- (Object) delete_orphaned_fachinfo



38
39
40
41
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 38

def delete_orphaned_fachinfo
  @session.app.delete(@model.pointer)
  orphaned_fachinfos
end

- (Object) init



21
22
23
24
25
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 21

def init
  @model = OrphanedFachinfoFacade.new(@model)
  name = @model.name[/^\w+/u]
  @model.registrations = named_registrations(name)
end

- (Object) named_registrations(name)



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 42

def named_registrations(name)
  if(name.size < 3)
    add_warning(:w_name_to_short,:name, name)
    []
  else
    sequences = @session.app.search_sequences(name.downcase)
    registrations = sequences.collect { |seq|
      seq.registration
    }.uniq
    if(registrations.size > 50)
      add_warning(:w_too_many_sequences, :name, nil)
      []
    else
      registrations 
    end
  end
end

- (Object) preview



73
74
75
76
77
78
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 73

def preview 
  if(lang = @session.user_input(:language_select))
    doc = @model.languages[lang]
      State::Drugs::FachinfoPreview.new(@session, doc)
  end
end

- (Object) search_registrations



59
60
61
62
63
64
65
66
67
68
69
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 59

def search_registrations
  name = @session.user_input(:search_query)
  if(name.is_a? String)
    registrations = named_registrations(name)
    @model.registrations = registrations
  else
    err = create_error(:e_name_to_short, :name, name)
    @errors.store(name, err)
  end
  self
end

- (Object) symbol



70
71
72
# File 'src/state/admin/orphaned_fachinfo_assign.rb', line 70

def symbol
  :name_base
end