| 1 | package Net::Z3950::FOLIO::PostProcess::OPAC; | ||||||||||||||||||||||||||||
| 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 | 2 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Data::Dumper; $Data::Dumper::INDENT = 2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Net::Z3950::FOLIO::PostProcess::Transform qw(transform); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 8 | ▶ | sub postProcessHoldings { | ||||||||||||||||||||||||||
|
Subroutine
postProcessHoldings: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 8 | my($cfg, $holdings) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 8 | foreach my $holding (@$holdings) { | |||||||||||||||||||||||||||
| 15 | 16 | processListOfFields($cfg, $holding, 0); | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 8 | return $holdings; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 32 | ▶ | sub processListOfFields { | ||||||||||||||||||||||||||
|
Subroutine
processListOfFields: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 32 | my($cfg, $list, $isItem) = @_; | |||||||||||||||||||||||||||
| 24 | 32 | ▶ | my $thisCfg = $cfg->{$isItem ? 'circulation' : 'holding' }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 5 | ▶ | my $getFieldFromRecord = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||||||||||||||||||||
| 27 | 5 | my($fieldname) = @_; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | # XXX maybe we should make a hash the first time we need to do this | ||||||||||||||||||||||||||||
| 30 | 5 | ▶ | foreach (my $i = 0; $i < @$list; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 37 | my $field = $list->[$i]; | |||||||||||||||||||||||||||
| 32 | 37 | my($name, $value) = @$field; | |||||||||||||||||||||||||||
| 33 | 37 | ▶ | if ($name eq $fieldname) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 5 | return $value; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | return undef; | |||||||||||||||||||||||||||
| 39 | 32 | }; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 32 | ▶ | foreach (my $i = 0; $i < @$list; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 144 | my $field = $list->[$i]; | |||||||||||||||||||||||||||
| 43 | 144 | my($name, $value) = @$field; | |||||||||||||||||||||||||||
| 44 | 144 | ▶ | if (!$isItem && $name eq 'circulations') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $isItem and $name eq "circulations"
MC/DC100%2/2
not $isItem and $name eq "circulations"
not $isItem
$name eq "circulations"
Truth table100%3/3
not(A) and B
A= not $isItemB= $name eq "circulations"
| |||||||||||||||||||||||||||||
| 45 | 8 | ▶ | foreach (my $j = 0; $j < @$value; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 16 | processListOfFields($cfg, $value->[$j], 1); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | } else { | ||||||||||||||||||||||||||||
| 49 | 136 | my $rule = $thisCfg->{$name}; | |||||||||||||||||||||||||||
| 50 | 136 | ▶ | if ($rule) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | 12 | $field->[1] = transform($rule, $value, $getFieldFromRecord); | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 2 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | 2 | our @EXPORT_OK = qw(postProcessHoldings); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 2 | 1; | |||||||||||||||||||||||||||