• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / orangelight / 4c391e0e-519a-40cb-8ad3-354445f4ce03

12 Aug 2025 08:47PM UTC coverage: 85.348% (-10.0%) from 95.335%
4c391e0e-519a-40cb-8ad3-354445f4ce03

push

circleci

web-flow
[#5143] Use access restriction note as Aeon ItemInfo1 if available (#5173)

With this commit, if a user visits a record with an access
restrictions note and presses the Reading Room Request
button, they will get to an Aeon form with the 'Restrictions'
field pre-filled with the restriction note.

If the record does not have an access restrictions note,
the field will be pre-filled with 'Reading Room Access Only',
as it has been previously.

Closes #5143

5493 of 6436 relevant lines covered (85.35%)

251.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

59.57
/app/controllers/concerns/orangelight/catalog.rb
1
# frozen_string_literal: true
2

3
module Orangelight
1✔
4
  module Catalog
1✔
5
    extend ActiveSupport::Concern
1✔
6

7
    def oclc
1✔
8
      redirect_to oclc_resolve(params[:id])
×
9
    end
10

11
    def isbn
1✔
12
      redirect_to isbn_resolve(params[:id])
×
13
    end
14

15
    def issn
1✔
16
      redirect_to issn_resolve(params[:id])
×
17
    end
18

19
    def lccn
1✔
20
      redirect_to lccn_resolve(params[:id])
×
21
    end
22

23
    def alma
1✔
24
      bib_id = params[:BBID] || params[:bbid]
×
25
      redirect_to "/catalog/#{bib_id}"
×
26
    end
27

28
    def redirect_browse
1✔
29
      if params[:search_field] && params[:controller] != 'advanced'
144✔
30
        if params[:search_field] == 'browse_subject' && !params[:id]
27✔
31
          redirect_to "/browse/subjects?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
1✔
32
        elsif params[:search_field] == 'browse_cn' && !params[:id]
26✔
33
          redirect_to "/browse/call_numbers?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
1✔
34
        elsif params[:search_field] == 'browse_name' && !params[:id]
25✔
35
          redirect_to "/browse/names?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
1✔
36
        elsif params[:search_field] == 'name_title' && !params[:id]
24✔
37
          redirect_to "/browse/name_titles?search_field=#{params[:search_field]}&q=#{CGI.escape params[:q]}"
1✔
38
        end
39
      end
40
    end
41

42
    # Email Action (this will render the appropriate view on GET requests and process the form and send the email on POST requests)
43
    def email_action(documents)
1✔
44
      mail = Orangelight::RecordMailer.email_record(documents, { to: params[:to], reply_to: user_email, message: params[:message], subject: params[:subject] }, url_options)
×
45
      if mail.respond_to? :deliver_later
×
46
        mail.deliver_later
×
47
      else
48
        mail.deliver
×
49
      end
50
    end
51

52
    # rubocop:disable Naming/PredicateMethod
53
    def validate_email_params
1✔
54
      if current_user.nil?
×
55
        flash[:error] = 'You must be logged in to send an email.'
×
56
      elsif params[:to].blank?
×
57
        flash[:error] = I18n.t('blacklight.email.errors.to.blank')
×
58
      elsif !params[:to].match(Blacklight::Engine.config.blacklight.email_regexp)
×
59
        flash[:error] = I18n.t('blacklight.email.errors.to.invalid', to: params[:to])
×
60
      end
61

62
      flash[:error].blank?
×
63
    end
64
    # rubocop:enable Naming/PredicateMethod
65

66
    def user_email
1✔
67
      return current_user.email if current_or_guest_user.cas_provider?
×
68
    end
69

70
    def online_holding_note?(_field_config, document)
1✔
71
      location_notes = JSON.parse(document[:holdings_1display] || '{}').collect { |_k, v| v['location_has'] }
351✔
72
      document[:electronic_access_1display].present? && location_notes.any? && document[:location].blank?
146✔
73
    end
74

75
    def linked_records
1✔
76
      return head(:bad_request) unless params[:id] && params[:field]
1✔
77

78
      begin
79
        document = search_service.fetch(params[:id])
1✔
80
      rescue Blacklight::Exceptions::RecordNotFound
81
        return head(:bad_request)
×
82
      end
83

84
      render json: document.linked_records(field: params[:field], maximum_records: 500).decorated
1✔
85
    end
86
  end
87
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc