| 1 | package Net::Z3950::FOLIO::HoldingsRecords; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Net::Z3950::FOLIO::lodashGet qw(lodashGet); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | sub makeHoldingsRecords { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
makeHoldingsRecords: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | my($rec, $marc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | my $cfg = $rec->rs()->session()->{cfg}; # XXX maybe make an accessor method | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | my $holdings = $rec->jsonStructure()->{holdingsRecords2}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | return [ map { _makeSingleHoldingsRecord($_, $marc, $cfg) } @$holdings ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # The YAZ XML format for OPAC records is a fairly close representation | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # of the Z39.50 OPAC record, which is specified by the ASN.1 at | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # https://www.loc.gov/z3950/agency/asn1.html#RecordSyntax-opac | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # But this is only very lightly documented. Some of the fields are | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # commented with what seem to be references to the MARC format, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # e.g. `typeOfRecord` is commented "LDR 06", which is indeed "Type of | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # record" is the MARC specification: see | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # https://www.loc.gov/marc/bibliographic/bdleader.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # But why would we include information from the MARC record describing | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # the bibliographic data related to the holding when we already have | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | # the actual MARC record in <bibliographicRecord>? | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # Based on the document "z39.50 OPAC response examples for Cornell" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | # attached to UXPROD-560, it seems like the key elements to fill in | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | # are: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | # format | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # localLocation | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # shelvingLocation | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # callNumber | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # enumAndChron | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # availableNow | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # availabilityDate | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # availableThru | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # itemId | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # temporaryLocation (overrides shelvingLocation) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # In the FOLIO data model, <enumAndChron> does not exist at the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # holdings or volume level, only at the item level. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub _makeSingleHoldingsRecord { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeSingleHoldingsRecord: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my($holding, $marc, $cfg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $nucCode; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | my $localLocation; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $shelvingLocation; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | my $location = $holding->{temporaryLocation} || $holding->{permanentLocation}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$holding->{'temporaryLocation'} || $holding->{'permanentLocation'}
MC/DC0%0/2
$holding->{'temporaryLocation'} || $holding->{'permanentLocation'}
$holding->{'temporaryLocation'}
$holding->{'permanentLocation'}
Truth table0%0/3
A || B
A= $holding->{'temporaryLocation'}B= $holding->{'permanentLocation'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if ($location) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | $nucCode = ($location->{institution} || {})->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$location->{'institution'} || {}
MC/DC0%0/1
$location->{'institution'} || {}
$location->{'institution'}
Truth table0%0/2
A
A= $location->{'institution'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | $localLocation = ($location->{library} || {})->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$location->{'library'} || {}
MC/DC0%0/1
$location->{'library'} || {}
$location->{'library'}
Truth table0%0/2
A
A= $location->{'library'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | $shelvingLocation = $location->{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $itemObjects = _makeItemRecords($holding->{bareHoldingsItems}, $cfg, $location, $holding->{permanentLocation}); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | return bless [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | [ 'typeOfRecord', substr($marc->leader(), 5, 1) ], # LDR 06 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | [ 'encodingLevel', substr($marc->leader(), 16, 1) ], # LDR 017 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | [ 'format', _format($holding, $marc) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | [ 'receiptAcqStatus', _marcFieldChars($marc, '008', '06') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | [ 'generalRetention', _marcFieldChars($marc, '008', '12') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | [ 'completeness', _marcFieldChars($marc, '008', '16') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | [ 'dateOfReport', _marcFieldChars($marc, '008', '26-31') ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | [ 'nucCode', $nucCode ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | [ 'localLocation', $localLocation ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | [ 'shelvingLocation', $shelvingLocation ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # Z39.50 OPAC record has no way to express item-level callNumber | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | [ '_callNumberPrefix', $holding->{callNumberPrefix} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | [ 'callNumber', $holding->{callNumber} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | [ '_callNumberSuffix', $holding->{callNumberSuffix} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | [ 'shelvingData', _makeShelvingData($holding) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | [ 'copyNumber', $holding->{copyNumber} ], # 852 $t | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | [ 'publicNote', _makePublicNote($holding) ], # 852 $z | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | [ 'reproductionNote', _notesOfType($holding->{notes}, qr/reproduction/i) ], # 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | [ 'termsUseRepro', _makeTermsUseRepro($marc) ], # 845 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | [ 'circulations', $itemObjects, undef, 1 ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ], 'Net::z3950::FOLIO::OPACXMLRecord::holding'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub _marcFieldChars { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_marcFieldChars: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my($marc, $fieldName, $chars) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | my $field = $marc->field($fieldName); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | return undef if !$field; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $data = $field->data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | return undef if !$data; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | my @pieces = split(/-/, $chars); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | my($start1, $end1) = @pieces; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | $end1 = $start1 if !$end1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | return substr($data, $start1-1, $end1-$start1+1); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # I don't really know what they want of me here. The "documentation", | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # found only in the OPAC record-format ASN-1, simply says "852 $j thru | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # $m". But these fields mostly just duplicate the call-number: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # $j - Shelving control number (NR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # $k - Call number prefix (R) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # $l - Shelving form of title (NR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # $m - Call number suffix (R) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # Since the only thing we have that is _not_ part of the call-number | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # is the shelving title, I guess we may as well return that. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | sub _makeShelvingData { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeShelvingData: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my($holding) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return $holding->{shelvingTitle}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | # This field is rather overloaded. It must contain not only holdings | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # notes of type "public" and similar, but also any holdings statements | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # (each potentially consisting of statement, note and staffNote) along | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | # with the same thing for holdingsStatementsForSupplements and | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | # holdingsStatementsForIndexes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | # Here's how we do this: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # * Each entry is newline-separated | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | # * Each holdings statement is included | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | # * Each holdings-for-supplements statement is included, prefixed with "SUPPLEMENT: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # * Each holdings-for-indexes statement is included, prefixed with "INDEX: " | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | # * Any public notes are included | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # When there is more than one statement in any of the categories | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | # (holdings, holdings for supplements, holdings for indexes), they are | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # all numbered within that category. When there is only one statement | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | # in a category, it is not numbered. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | # This means that in the common case of a single holdings statement, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | # it will appear alone and unadorned. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub _makePublicNote { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makePublicNote: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my($holding) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my @notes; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | push @notes, _holdingsStatements($holding->{holdingsStatements}, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | push @notes, _holdingsStatements($holding->{holdingsStatementsForSupplements}, "SUPPLEMENT"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | push @notes, _holdingsStatements($holding->{holdingsStatementsForIndexes}, "INDEX"); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | push @notes, _notesOfType($holding->{notes}, qr/public/i); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | @notes = grep { defined } @notes; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | ▶ | return undef if @notes == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | return join("\n", @notes); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub _holdingsStatements { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_holdingsStatements: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my($statements, $caption) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | return undef if !defined $statements || @$statements == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $statements or @$statements == 0
MC/DC0%0/2
not defined $statements or @$statements == 0
not defined $statements
@$statements == 0
Truth table0%0/3
not(A) or B
A= not defined $statementsB= @$statements == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | my @res = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $s = $statements->[$_-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if (defined $caption && @$statements > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition0%0/3
defined $caption and @$statements > 1
MC/DC0%0/2
defined $caption and @$statements > 1
defined $caption
@$statements > 1
Truth table0%0/3
A and B
A= defined $captionB= @$statements > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $res = "$caption $_: "; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } elsif (defined $caption) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $res = "$caption: "; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } elsif (@$statements > 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $res = "$_: "; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $res .= $s->{statement}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | $res .= " [NOTE: " . $s->{note} . "]" if $s->{note}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | $res .= " [STAFF NOTE: " . $s->{staffNote} . "]" if $s->{staffNote}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } 1..@$statements; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return join("\n", @res); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | # In the FOLIO inventory model, instances, holdings records and items | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | # can all have a set of zero or more notes, each of which has a note | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | # type. These note types are drawn from three separate vocabularies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | # (one each for instances, holdings records and items), each | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # maintained in the Settings rather than hardwired like identifier | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | # types. Among these vocabularies, there may be (and in the sample | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # data there are) types called "Reproduction" and "Public". So we can | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | # pick these out by referring to the note-type text rather than to | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # known UUIDS -- and pull out the text of notes of the appropriate | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | # type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | # When there is more than one note of a given type, we return a single | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # string containing each note on a line of its own preceded by its | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | # ordinal number. This number is omitted when there is a single note. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | sub _notesOfType { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_notesOfType: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | my($notes, $regexp) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my @notes; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | foreach my $note (@$notes) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my $type = $note->{holdingsNoteType}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | push @notes, $note->{note} if $type && $type->{name} =~ $regexp; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type and $type->{"name"} =~ /$regexp/
MC/DC0%0/2
$type and $type->{"name"} =~ /$regexp/
$type
$type->{"name"} =~ /$regexp/
Truth table0%0/3
A and B
A= $typeB= $type->{"name"} =~ /$regexp/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | return undef if @notes == 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | return $notes[0] if @notes == 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | return join("\n", map { "$_: " . $notes[$_-1] } 1..@notes); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | # The ASN.1 one relates this OPAC-record field to MARC field 845, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # which is "Terms Governing Use and Reproduction Note". That field has | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # 13 subfields, and there is no guidance on which might be | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | # relevant. The best we can do is probably just to glue them all | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | # together. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub _makeTermsUseRepro { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeTermsUseRepro: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my($marc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | my $field845 = $marc->field('845') or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | my @subfields = $field845->subfields() or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return join('', map { '$' . $_->[0] . $_->[1] } @subfields); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | sub _makeItemRecords { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeItemRecords: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my($items, $cfg, $defaultLocation, $defaultPermamentLocation) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | return [ map { _makeSingleItemRecord($_, $cfg, $defaultLocation, $defaultPermamentLocation) } @$items ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub _makeSingleItemRecord { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeSingleItemRecord: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my($item, $cfg, $defaultLocation, $defaultPermamentLocation) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | my @tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | push @tmp, $item->{enumeration} if $item->{enumeration}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | push @tmp, $item->{chronology} if $item->{chronology}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $enumAndChronForItem = @tmp ? join(' ', @tmp) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | my $ecnc = $item->{effectiveCallNumberComponents} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item->{'effectiveCallNumberComponents'} || {}
MC/DC0%0/1
$item->{'effectiveCallNumberComponents'} || {}
$item->{'effectiveCallNumberComponents'}
Truth table0%0/2
A
A= $item->{'effectiveCallNumberComponents'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | return bless [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | [ 'availableNow', _makeAvailableNow($item), 'value' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | [ 'availabilityDate', _makeAvailabilityDate($item) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | [ 'availableThru', _makeAvailableThru($item, $cfg) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | [ 'restrictions', _makeRestrictions($item) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | [ 'itemId', $item->{barcode} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | # XXX Determining a correct value for <renewable> would be | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | # very complicated, involving loan policies. But we have to | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | # include _something_, because this element is mandatory in | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | # YAZ's OPACXML schema -- probably accidentally | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | [ 'renewable', '', 'value' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | [ 'onHold', _makeOnHold($item), 'value' ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | [ '_enumeration', $item->{enumeration} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | [ '_chronology', $item->{chronology} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | [ 'enumAndChron', $enumAndChronForItem ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | [ 'midspine', undef ], # XXX Will be added in UIIN-220 but doesn't exist yet | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | [ 'temporaryLocation', _makeLocation($item->{temporaryLocation} || $item->{permanentLocation} || $defaultLocation) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | [ '_permanentLocation', _makeLocation($item->{permanentLocation} || $defaultPermamentLocation) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | [ '_holdingsLocation', _makeLocation($defaultLocation) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | [ '_callNumber', $ecnc->{callNumber} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | [ '_callNumberPrefix', $ecnc->{prefix} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | [ '_callNumberSuffix', $ecnc->{suffix} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | [ '_volume', $item->{volume} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | [ '_yearCaption', _makeYearCaption($item->{yearCaption}) ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | [ '_accessionNumber', $item->{accessionNumber} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | [ '_copyNumber', $item->{copyNumber} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | [ '_descriptionOfPieces', $item->{descriptionOfPieces} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | [ '_discoverySuppress', $item->{discoverySuppress} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | [ '_hrid', $item->{hrid} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | [ '_id', $item->{id} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | [ '_itemIdentifier', $item->{itemIdentifier} ], | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/9
$item->{'temporaryLocation'} || $item->{'permanentLocation'} || $defaultLocation
$item->{"temporaryLocation"} or $item->{"permanentLocation"}
$item->{'permanentLocation'} || $defaultPermamentLocation
MC/DC0%0/3
$item->{'temporaryLocation'} || $item->{'permanentLocation'} || $defaultLocation
$item->{"temporaryLocation"}
$item->{"permanentLocation"}
$defaultLocation
MC/DC0%0/2
$item->{'permanentLocation'} || $defaultPermamentLocation
$item->{'permanentLocation'}
$defaultPermamentLocation
Truth table0%0/4
A or B || C
A= $item->{"temporaryLocation"}B= $item->{"permanentLocation"}C= $defaultLocation
Truth table0%0/3
A || B
A= $item->{'permanentLocation'}B= $defaultPermamentLocation
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | ], 'Net::z3950::FOLIO::OPACXMLRecord::item'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # We _could_ make an attempt to get a holdings-level format, but to do | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # that we would need to have mod-graphql expand the the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # `holdingsTypeId` field into a holdings-type object, and somehow | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # interpret a field from within that structure into the MARC 007/0-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | # controlled vocabulary. That's a lot of work for little gain, so we | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | # just use the information from the MARC record. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub _format { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_format: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my($holding, $marc) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | my $field007 = $marc->field('007'); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | return undef if !defined $field007; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $data = $field007->data(); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | return substr($data, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # Initially, the calculation here was just that an item is available | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # if it has a status and that status is 'Available'. But since there | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # is no way to directly represent item suppression in the Z39.50 OPAC | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # record, we also use this field for it: an item that is suppressed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # from discovery is reported as unavailable. See ZF-60. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | sub _makeAvailableNow { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeAvailableNow: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | my($item) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | return 0 if $item->{discoverySuppress}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | return $item->{status} && $item->{status}->{name} eq 'Available' ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$item->{"status"} and $item->{"status"}{"name"} eq "Available"
MC/DC0%0/2
$item->{"status"} and $item->{"status"}{"name"} eq "Available"
$item->{"status"}
$item->{"status"}{"name"} eq "Available"
Truth table0%0/3
A and B
A= $item->{"status"}B= $item->{"status"}{"name"} eq "Available"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | sub _makeAvailabilityDate { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeAvailabilityDate: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my($item) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | return $item->{loans} && $item->{loans}->{dueDate}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$item->{'loans'} && $item->{'loans'}{'dueDate'}
MC/DC0%0/2
$item->{'loans'} && $item->{'loans'}{'dueDate'}
$item->{'loans'}
$item->{'loans'}{'dueDate'}
Truth table0%0/3
A && B
A= $item->{'loans'}B= $item->{'loans'}{'dueDate'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # It's not clear what the <availableThru> field even means. It's | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | # included in the name, without comment, in the Z39.50 ASN.1 and in | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | # the YAZ OPAC XML schema. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | # * I first thought it meant "Date until which the item is guaranteed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | # to remain available". | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # * Examples in the document "z39.50 OPAC response examples for | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | # Cornell" attached to UXPROD-560 suggests that it's the opaque | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | # identifier of a loan policy. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | # * A brief note in the document "Kuali OLE Z39.50 Integration - | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | # DRAFT" suggests it means "Library building location, or possibly | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # access policy". | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | # But we have concrete expectations from Lehigh that it means the | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # material-type of the item: see ZF-26. It's not clear why that would | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # be called "availableThru", but ¯\_(ツ)_/¯ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | sub _makeAvailableThru { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeAvailableThru: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | my($item, $cfg) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | # use Data::Dumper; $Data::Dumper::INDENT = 2; print "_makeAvailableThru: cfg = ", Dumper($cfg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | if ($cfg->{fieldDefinitions} && | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$cfg->{"fieldDefinitions"} and $cfg->{"fieldDefinitions"}{"circulation"} and $cfg->{"fieldDefinitions"}{"circulation"}{"availableThru"}
$cfg->{"fieldDefinitions"} and $cfg->{"fieldDefinitions"}{"circulation"}
MC/DC0%0/3
$cfg->{"fieldDefinitions"} and $cfg->{"fieldDefinitions"}{"circulation"} and $cfg->{"fieldDefinitions"}{"circulation"}{"availableThru"}
$cfg->{"fieldDefinitions"}
$cfg->{"fieldDefinitions"}{"circulation"}
$cfg->{"fieldDefinitions"}{"circulation"}{"availableThru"}
Truth table0%0/4
A and B and C
A= $cfg->{"fieldDefinitions"}B= $cfg->{"fieldDefinitions"}{"circulation"}C= $cfg->{"fieldDefinitions"}{"circulation"}{"availableThru"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | $cfg->{fieldDefinitions}->{circulation} && | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | $cfg->{fieldDefinitions}->{circulation}->{availableThru}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | my $field = $cfg->{fieldDefinitions}->{circulation}->{availableThru}; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # warn "using field '$field' for availableThru"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # XXX We may need more sophisticated interpolation from the item record and maybe even the holding or instance | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | return lodashGet($item, $field); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | return ($item->{materialType} || {})->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item->{'materialType'} || {}
MC/DC0%0/1
$item->{'materialType'} || {}
$item->{'materialType'}
Truth table0%0/2
A
A= $item->{'materialType'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | # The restrictions, if any, can be inferred from some values of | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | # status. Charlotte says "I would say all of them except: Available, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | # and On order". She will check with out contacts at Lehigh. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | # The list of valid statuses is wired right into the JSONN Schema at | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # mod-inventory-storage/ramls/item.json | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ▶ | sub _makeRestrictions { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeRestrictions: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | my($item) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | my $status = $item->{status} || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$item->{'status'} || (return undef)
MC/DC0%0/1
$item->{'status'} || (return undef)
$item->{'status'}
Truth table0%0/2
A
A= $item->{'status'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | my $name = $status->{name} || return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$status->{'name'} || (return undef)
MC/DC0%0/1
$status->{'name'} || (return undef)
$status->{'name'}
Truth table0%0/2
A
A= $status->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | return ($name ne 'Available' && $name ne 'On order') ? $name : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$name ne "Available" and $name ne "On order"
MC/DC0%0/2
$name ne "Available" and $name ne "On order"
$name ne "Available"
$name ne "On order"
Truth table0%0/3
A and B
A= $name ne "Available"B= $name ne "On order"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | # Items don't know whether they are on hold, but the requests module | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # does. We can discover this by another request (or, more likely, by | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # having mod-graphql include the results of another request). The | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | # relevant WSAPI is documented at | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # https://github.com/folio-org/mod-circulation/blob/cab5ab44a3383bad938f33ad616fb0ef1244e67a/ramls/circulation.raml#L278 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # But we have to provide a non-undef value here, because this element | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | # is mandatory in YAZ's OPACXML schema -- probably accidentally. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub _makeOnHold { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeOnHold: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my($item) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | return ''; # XXX for now | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | sub _makeLocation { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeLocation: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | my($data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | ▶ | return undef if !defined $data; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | return $data->{name} if defined $data->{name}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my @tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | foreach my $key (qw(institution campus library primaryServicePointObject)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | ▶ | push @tmp, $data->{$key}->{name} if $data->{$key}; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | return join('/', @tmp); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | sub _makeYearCaption { | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_makeYearCaption: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my($data) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | ▶ | return undef if !$data; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | return join(', ', @$data) if (ref $data eq 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 2 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 2 | our @EXPORT_OK = qw(makeHoldingsRecords _makeSingleHoldingsRecord); | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||