Skip to content

Commit

Permalink
DISCOVERYACCESS-8064: Activate special workflow for annex microfiche (#…
Browse files Browse the repository at this point in the history
…274)

* Add special handling for micofiche at Annex (temporary)

* Update test for Annex microfiche

* Log an error for PDA problems instead of a debug message
  • Loading branch information
Baroquem authored Oct 9, 2023
1 parent c81f19a commit 9e416ce
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
37 changes: 35 additions & 2 deletions app/controllers/blacklight_cornell_requests/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,40 @@ def magic_request(target = '')
options[rm] = []
end

############ TEMPORARY HANDLING CODE FOR MICROFICHE AT ANNEX #############
# This should eventually be removed (along with microfiche view)
# Look for Annex microfiche
hid = holdings.keys[0]
holdings_data = holdings[hid]
# Get item metadata
matched_item = nil
JSON.parse(@document['items_json']).each do |h, i|
i.each do |item|
volume_string = "|#{item['enum']}|#{item['chron']}|#{item['year']}|"
if volume_string == params[:volume]
matched_item = item
end
end
end
annex_microfiche =
holdings_data&.dig('location', 'code') == 'acc,anx' ||
matched_item&.dig('location', 'code') == 'acc,anx'

patron = BlacklightCornellRequests::Patron.new(user)

@microfiche_link = 'https://cornell.libwizard.com/f/annex?'
@microfiche_link += "4661140=#{patron.display_name}" # name
@microfiche_link += "&4661145=#{user}" # netid or 'visitor'
@microfiche_link += "&4661162=#{@document['title_display']}" # title
@microfiche_link += "&4661160=#{holdings_data['call']}" # call number
@microfiche_link += "&4661164=#{matched_item['enum']}" # volume

if annex_microfiche
render('microfiche')
return
end
############ END TEMPORARY HANDLING CODE FOR MICROFICHE AT ANNEX #########

# Rails.logger.debug "mjc12test: items: #{items}"
items.each do |i|
# rp = {}
Expand Down Expand Up @@ -528,7 +562,7 @@ def make_pda_request
response = RestClient.post(url, body, headers)
flash[:success] = I18n.t('requests.success')
rescue StandardError => e
Rails.logger.debug "Requests: PDA request failed (#{e})"
Rails.logger.error "Requests: PDA request failed (#{e})"
error_msg = I18n.t('requests.failure')
error_msg += ' (The requestor could not be identified.)' if params[:netid].nil?
flash[:error] = error_msg
Expand All @@ -545,7 +579,6 @@ def make_pda_request
# AJAX responder used with requests.js.coffee to set the volume
# when the user selects one in the volume drop-down list
def set_volume
Rails.logger.warn "mjc12test: setvol params: #{params}"
session[:volume] = params[:volume]
session[:setvol] = 1
respond_to do |format|
Expand Down
27 changes: 27 additions & 0 deletions app/views/blacklight_cornell_requests/request/microfiche.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
= render :partial => 'shared/back_to_item'
%h2 Microfiche Request
%div.card
%div.card-body
%h3.item-title-request.blacklight-title_display
=@ti
-if @iis.present?
-@iis.each do |copyn, copyd|
-if copyd[:item_enum].present?
= copyd[:item_enum]
%div.request-author=@au
%p
To request this item, use the Annex microfiche request form by clicking the button below.
%p
- if !@estimate.blank?
Delivery time:
= delivery_estimate_display @estimate
.clearfix
%a{:href => @microfiche_link, :class => 'btn btn-danger pull-left'}
Go to the Annex microfiche request form
-if @alternate_methods && @alternate_methods.count > 1
= render :partial => 'shared/request_options'
-else
.form-alternative-action
= succeed "." do
If you need further help, please
=link_to 'Ask a Librarian','http://www.library.cornell.edu/get-help/ask'
2 changes: 1 addition & 1 deletion lib/blacklight_cornell_requests/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BlacklightCornellRequests
VERSION = "4.3.4"
VERSION = "4.4"
end
3 changes: 3 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes - blacklight-cornell-requests

## 4.4 (Microfiche update)
- Add special handling for microfiche at Annex with 'acc,anx' location.

## 4.3.4
- Update PDA code to connect to Prefect 2 (DISCOVERYACCESS-8018)

Expand Down

0 comments on commit 9e416ce

Please sign in to comment.