diff --git a/app/controllers/blacklight_cornell_requests/request_controller.rb b/app/controllers/blacklight_cornell_requests/request_controller.rb index b457112..1d57a98 100644 --- a/app/controllers/blacklight_cornell_requests/request_controller.rb +++ b/app/controllers/blacklight_cornell_requests/request_controller.rb @@ -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 = {} @@ -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 @@ -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| diff --git a/app/views/blacklight_cornell_requests/request/microfiche.html.haml b/app/views/blacklight_cornell_requests/request/microfiche.html.haml new file mode 100644 index 0000000..f11283d --- /dev/null +++ b/app/views/blacklight_cornell_requests/request/microfiche.html.haml @@ -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' \ No newline at end of file diff --git a/lib/blacklight_cornell_requests/version.rb b/lib/blacklight_cornell_requests/version.rb index b9acd3e..03bb387 100644 --- a/lib/blacklight_cornell_requests/version.rb +++ b/lib/blacklight_cornell_requests/version.rb @@ -1,3 +1,3 @@ module BlacklightCornellRequests - VERSION = "4.3.4" + VERSION = "4.4" end diff --git a/release_notes.md b/release_notes.md index d220125..16cdc55 100644 --- a/release_notes.md +++ b/release_notes.md @@ -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)