• 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

89.8
/app/models/concerns/requests/aeon.rb
1
# frozen_string_literal: true
2
module Requests
1✔
3
  module Aeon
1✔
4
    # for Aeon Related Bibliographic Helpers
5
    extend ActiveSupport::Concern
1✔
6

7
    def aeon_mapped_params
1✔
8
      params = {
4✔
9
        Action: '10',
10
        Form: '21',
11
        ItemTitle: aeon_title.truncate(247),
12
        ItemAuthor: author,
13
        ItemDate: pub_date,
14
        ItemVolume: item_volume
15
      }
16
      params[:ItemNumber] = item[:barcode] if barcode?
4✔
17
      params.merge! aeon_basic_params
4✔
18
      params.reject { |_k, v| v.nil? }
50✔
19
    end
20

21
    ## params shared by both alma and non-alma aeon requests
22
    def aeon_basic_params
1✔
23
      {
24
        ReferenceNumber: bib[:id],
10✔
25
        CallNumber: call_number,
26
        Site: site,
27
        Location: shelf_location_code,
28
        SubLocation: sub_location,
29
        ItemInfo1: bib[:access_restrictions_note_display]&.first || I18n.t("requests.aeon.access_statement")
30
      }.compact
31
    end
32

33
    def aeon_request_url
1✔
34
      AeonUrl.new(document: bib, holding: holding.to_h, item:).to_s
7✔
35
    end
36

37
    def site
1✔
38
      if location[:holding_library].present?
13✔
39
        holding_location_to_site(location['holding_library']['code'])
7✔
40
      elsif location['library']['code'] == 'eastasian' && aeon_location?
6✔
41
        'EAL'
×
42
      elsif location['library']['code'] == 'marquand'  && aeon_location?
6✔
43
        'MARQ'
×
44
      elsif location['library']['code'] == 'mudd'
6✔
45
        'MUDD'
1✔
46
      else
47
        "FIRE"
5✔
48
      end
49
    end
50

51
    private
1✔
52

53
      def holding_location_to_site(location_code)
1✔
54
        if  location_code == 'eastasian' && aeon_location?
7✔
55
          'EAL'
×
56
        elsif location_code == 'marquand' && aeon_location?
7✔
57
          'MARQ'
1✔
58
        elsif location_code == 'mudd' && aeon_location?
6✔
59
          'MUDD'
×
60
        else
61
          'FIRE'
6✔
62
        end
63
      end
64

65
      def aeon_location?
1✔
66
        location['aeon_location'] == true
1✔
67
      end
68

69
      def call_number
1✔
70
        holding.holding_data['call_number']
×
71
      end
72

73
      def pub_date
1✔
74
        bib[:pub_date_start_sort]
4✔
75
      end
76

77
      def shelf_location_code
1✔
78
        holding.holding_data['location_code']
10✔
79
      end
80

81
      def item_volume
1✔
82
        item.description if item.present? && enumerated?
4✔
83
      end
84

85
      def sub_location
1✔
86
        holding.holding_data['sub_location']&.first
10✔
87
      end
88

89
      def aeon_title
1✔
90
        "#{bib[:title_display]}#{genre}"
4✔
91
      end
92

93
      ## Don T requested this be appended when present
94
      def genre
1✔
95
        " [ #{bib[:form_genre_display].first} ]" unless bib[:form_genre_display].nil?
4✔
96
      end
97

98
      def author
1✔
99
        bib[:author_display]&.join(" AND ")
4✔
100
      end
101
  end
102
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