Class: ODDB::State::Admin::Package

Inherits:
Global show all
Includes:
PackageMethods
Defined in:
src/state/admin/root.rb,
src/state/admin/admin.rb,
src/state/admin/package.rb,
src/state/admin/companyuser.rb

Direct Known Subclasses

CompanyPackage

Constant Summary

VIEW =
View::Admin::RootPackage

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 included from PackageMethods

#ajax_create_part, #ajax_delete_part, #check_model, #delete, #update_parts

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) new_item



154
155
156
157
158
# File 'src/state/admin/package.rb', line 154

def new_item
  item = Persistence::CreateItem.new(@model.pointer + [:sl_entry])
  item.carry(:limitation, false)
  State::Admin::SlEntry.new(@session, item)
end

- (Object) update



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'src/state/admin/package.rb', line 159

def update
  super
  unless error?
    pointer = nil
    group = @session.user_input(:generic_group)
    unless group.empty?
      packages = []
      group.scan(/(\d{8})\s*(?:\(\s*([\d.]+)\s*x?\s*\))?/) do |ikskey, factor|
        packages.push [ @session.package_by_ikskey(ikskey),
                        (factor || 1).to_f ]
      end
      packages.push [@model, 1]
      group = @model.generic_group
      if group.nil?
        group = @session.create Persistence::Pointer.new([:generic_group, @model.pointer])
      end
      pointer = group.pointer
      add = packages - group.packages
      rem = group.packages - packages
      rem.each do |pac, factor|
        @session.app.update pac.pointer, { :generic_group => nil }, unique_email
      end
      add.each do |pac, factor|
        args = { :generic_group => pointer, :generic_group_factor => factor }
        @session.app.update pac.pointer, args, unique_email
      end
    end
    args = { :generic_group => pointer }
    @model = @session.app.update(@model.pointer, args, unique_email)
  end
  self
end