• 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

98.21
/app/models/requests/patron.rb
1
# frozen_string_literal: true
2
require 'faraday'
1✔
3

4
module Requests
1✔
5
  class Patron
1✔
6
    attr_reader :user, :patron_hash, :errors
1✔
7

8
    delegate :guest?, :provider, :cas_provider?, :alma_provider?, to: :user
1✔
9

10
    def initialize(user:, patron_hash: nil)
1✔
11
      @user = user
469✔
12
      @errors = []
469✔
13
      # load the patron_hash from bibdata or alma unless we are passing it in
14
      @patron_hash = patron_hash || load_patron(user:)
469✔
15
    end
16

17
    def self.authorize(user:)
1✔
18
      Patron.new(user:)
75✔
19
    end
20

21
    def barcode
1✔
22
      patron_hash[:barcode]
3,924✔
23
    end
24

25
    def active_email
1✔
26
      patron_hash[:active_email] || ldap[:email]
471✔
27
    end
28

29
    def first_name
1✔
30
      patron_hash[:first_name] || ldap[:givenname]
172✔
31
    end
32

33
    def last_name
1✔
34
      patron_hash[:last_name] || ldap[:surname]
237✔
35
    end
36

37
    def netid
1✔
38
      patron_hash[:netid]
379✔
39
    end
40

41
    def patron_id
1✔
42
      patron_hash[:patron_id]
77✔
43
    end
44

45
    def patron_group
1✔
46
      patron_hash[:patron_group]
3,604✔
47
    end
48

49
    def university_id
1✔
50
      patron_hash[:university_id] || user.uid
38✔
51
    end
52

53
    def eligible_for_library_services?
1✔
54
      barcode.present?
3,451✔
55
    end
56

57
    def telephone
1✔
58
      ldap[:telephone]
8✔
59
    end
60

61
    def status
1✔
62
      ldap[:status]
39✔
63
    end
64

65
    def pustatus
1✔
66
      ldap[:pustatus]
43✔
67
    end
68

69
    def department
1✔
70
      ldap[:department]
7✔
71
    end
72

73
    def title
1✔
74
      ldap[:title]
×
75
    end
76

77
    def address
1✔
78
      ldap[:address]
7✔
79
    end
80

81
    def ldap
1✔
82
      patron_hash[:ldap] || {}
129✔
83
    end
84

85
    def blank?
1✔
86
      patron_hash.empty?
70✔
87
    end
88

89
    def to_h
1✔
90
      patron_hash
49✔
91
    end
92

93
    private
1✔
94

95
      def load_patron(user:)
1✔
96
        patron_hash = current_patron_hash(user.uid)
123✔
97
        errors << "A problem occurred looking up your library account." if patron_hash.blank?
122✔
98
        patron_hash || {}
122✔
99
      end
100

101
      def current_patron_hash(uid)
1✔
102
        if alma_provider?
123✔
103
          AlmaPatron.new(uid:).patron_hash
14✔
104
        else
105
          FullPatron.new(user:).patron_hash
109✔
106
        end
107
      end
108
  end
109
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