$SC->count4($pdetails->{unavail_holds_count})
);
- # TODO: Add
- # fine items AV variable-length optional field (this field should be sent for each fine item).
- # recall items BU variable-length optional field (this field should be sent for each recall item).
- # unavailable hold items CD variable-length optional field (this field should be sent for each unavailable hold item).
-
if ($list_items eq 'hold_items') {
for my $hold (@{$pdetails->{hold_items}}) {
push(@{$response->{fields}}, {AS => $hold});
for my $item (@{$pdetails->{overdue_items}}) {
push(@{$response->{fields}}, {AT => $item});
}
+ } elsif ($list_items eq 'fine_items') {
+ for my $item (@{$pdetails->{fine_items}}) {
+ push(@{$response->{fields}}, {AV => $item});
+ }
+ } elsif ($list_items eq 'unavailable_holds') {
+ for my $item (@{$pdetails->{unavailable_holds}}) {
+ push(@{$response->{fields}}, {CD => $item});
+ }
}
+ # NOTE: Recall Items (BU) is not supported.
+
return $response;
}
$details->{recall_count} = 0; # not supported
- my $hold_ids = get_hold_ids($session, $patron);
- $details->{holds_count} = scalar(@$hold_ids);
+ $details->{hold_ids} = get_hold_ids($session, $patron);
+ $details->{holds_count} = scalar(@{$details->{hold_ids}});
- my $unavail_hold_ids = get_hold_ids($session, $patron, 1);
- $details->{unavail_holds_count} = scalar(@$unavail_hold_ids);
+ $details->{unavailable_hold_ids} = get_hold_ids($session, $patron, 1);
+ $details->{unavail_holds_count} = scalar(@{$details->{unavailable_hold_ids}});
$details->{overdue_count} = 0;
$details->{out_count} = 0;
add_hold_items($session, $details, $offset, $limit)
if $list_items eq 'hold_items';
+ add_hold_items($session, $details, $offset, $limit, 1)
+ if $list_items eq 'unavailable_holds';
+
add_items_out($session, $details, $offset, $limit)
if $list_items eq 'charged_items';
}
sub add_hold_items {
- my ($session, $details, $offset, $limit) = @_;
+ my ($session, $details, $offset, $limit, $unavailable) = @_;
my $patron = $details->{patron};
my $format = $session->config->{msg64_hold_datatype} || '';
- my $hold_ids = get_hold_ids($session, $patron, 0, $offset, $limit);
+ my $hold_ids = $unavailable ?
+ $details->{unavailable_hold_ids} : $details->{hold_ids};
my @hold_items;
for my $hold_id (@$hold_ids) {
}
]);
- my $displays = $e->search_metabib_flat_display_entry({
- source => $circ->target_copy->call_number->record,
- name => ['title', 'author']
- });
+ if ($circ->target_copy->call_number->id == -1) {
+ $title = $circ->target_copy->dummy_title;
+ $author = $circ->target_copy->dummy_author;
+
+ } else {
+
+ my $displays = $e->search_metabib_flat_display_entry({
+ source => $circ->target_copy->call_number->record,
+ name => ['title', 'author']
+ });
- ($title) = map {$_->value} grep {$_->name eq 'title'} @$displays;
- ($author) = map {$_->value} grep {$_->name eq 'author'} @$displays;
+ ($title) = map {$_->value} grep {$_->name eq 'title'} @$displays;
+ ($author) = map {$_->value} grep {$_->name eq 'author'} @$displays;
+ }
# Scrub "/" chars since they are used in some cases
# to delineate title/author.