app/helpers/cornell_catalog_helper.rb
# parse the circ status response so all statuses are stored by item id.
# parse_item_status
parse the circ status response so all statuses are stored by item id.
parse the circ status response so all statuses are stored by item id .
def parse_item_status(bibid, response,items_solr)
	    locations_by_iid = {}
	    statuses_by_iid = {}
	    statuses_as_text = {}
	    items_by_lid = {}
	    items_by_hid = {}
	    orders_by_hid = {}
	    if response[bibid] and response[bibid][bibid] and response[bibid][bibid][:records]
	      response[bibid][bibid][:records].each do |record|
		if record[:bibid].to_s == bibid
		  record[:holdings].each do |holding|
		      locations_by_iid[holding[:ITEM_ID].to_s] = holding[:TEMP_LOCATION_DISPLAY_NAME].nil? ? holding[:PERM_LOCATION_DISPLAY_NAME]:holding[:TEMP_LOCATION_DISPLAY_NAME]
		      statuses_by_iid[holding[:ITEM_ID].to_s] = holding[:ITEM_STATUS].to_s
		      lk=holding[:TEMP_LOCATION_DISPLAY_NAME].nil? ? holding[:PERM_LOCATION_DISPLAY_NAME]:holding[:TEMP_LOCATION_DISPLAY_NAME]
		      hk=holding[:MFHD_ID]
		      items_by_lid[lk] ||= []
		      items_by_lid[lk] << holding[:ITEM_ID].to_s
		      items_by_hid[hk] ||= []
		      orders_by_hid[hk.to_s] ||= []
		      items_by_hid[hk] << holding[:ITEM_ID].to_s
		      statuses_as_text[holding[:ITEM_ID].to_s] = make_substitute(holding,items_solr)
		      if holding[:ITEM_ID].nil? and !(holding[:ODATE].nil?)  and holding[:PO_TYPE] != 5 and holding[:DISPLAY_CALL_NO].blank?
			 orders_by_hid[hk.to_s] = "1 Copy Ordered as of " + holding[:ODATE].to_s[0,10]
		      end
		      if holding[:ITEM_ID].nil? and !(holding[:ODATE].nil?) and holding[:PO_TYPE] != 5 and holding[:LINE_ITEM_STATUS]== 1
			 orders_by_hid[hk.to_s] = "1 Copy Received."
                      end
		  end
		end
	      end
	    end
	  return locations_by_iid,statuses_by_iid,items_by_lid,items_by_hid,statuses_as_text,orders_by_hid
	  end
def parse_item_status ( bibid , response , items_solr ) locations_by_iid = { } statuses_by_iid = { } statuses_as_text = { } items_by_lid = { } items_by_hid = { } orders_by_hid = { } if response [ bibid ] and response [ bibid ] [ bibid ] and response [ bibid ] [ bibid ] [ :records ] response [ bibid ] [ bibid ] [ :records ] . each do | record | if record [ :bibid ] . to_s == bibid record [ :holdings ] . each do | holding | locations_by_iid [ holding [ :ITEM_ID ] . to_s ] = holding [ :TEMP_LOCATION_DISPLAY_NAME ] . nil? ? holding [ :PERM_LOCATION_DISPLAY_NAME ] : holding [ :TEMP_LOCATION_DISPLAY_NAME ] statuses_by_iid [ holding [ :ITEM_ID ] . to_s ] = holding [ :ITEM_STATUS ] . to_s lk = holding [ :TEMP_LOCATION_DISPLAY_NAME ] . nil? ? holding [ :PERM_LOCATION_DISPLAY_NAME ] : holding [ :TEMP_LOCATION_DISPLAY_NAME ] hk = holding [ :MFHD_ID ] items_by_lid [ lk ] ||= [ ] items_by_lid [ lk ] << holding [ :ITEM_ID ] . to_s items_by_hid [ hk ] ||= [ ] orders_by_hid [ hk . to_s ] ||= [ ] items_by_hid [ hk ] << holding [ :ITEM_ID ] . to_s statuses_as_text [ holding [ :ITEM_ID ] . to_s ] = make_substitute ( holding , items_solr ) if holding [ :ITEM_ID ] . nil? and ! ( holding [ :ODATE ] . nil? ) and holding [ :PO_TYPE ] != 5 and holding [ :DISPLAY_CALL_NO ] . blank? orders_by_hid [ hk . to_s ] = "1 Copy Ordered as of " + holding [ :ODATE ] . to_s [ 0 , 10 ] end if holding [ :ITEM_ID ] . nil? and ! ( holding [ :ODATE ] . nil? ) and holding [ :PO_TYPE ] != 5 and holding [ :LINE_ITEM_STATUS ] == 1 orders_by_hid [ hk . to_s ] = "1 Copy Received." end end end end end return locations_by_iid , statuses_by_iid , items_by_lid , items_by_hid , statuses_as_text , orders_by_hid end
parse the circ status response so all statuses are stored by item id.
parse the circ status response so all statuses are stored by item id .
##Rails.logger.debug "\nes287_debug line #{__LINE__} one holding = " + holding.inspect ##Rails.logger.debug "\nes287_debug line #{__LINE__} is there an item id  = " + holding.inspect ##Rails.logger.debug "\nes287_debug line #{__FILE__} #{__LINE__} there no item id, there is an order date so treat as order  = " + holding.inspect ##Rails.logger.debug "\nes287_debug line #{__FILE__} #{__LINE__} there no item id, there is an order date status is 1 = " + holding.inspect
bibid
<not_specific>
response
<not_specific>
items_solr
<not_specific>