View | Details | Raw Unified | Return to bug 10817
Collapse All | Expand All

(-)a/C4/SIP/ILS/Patron.pm (-11 / +45 lines)
Lines 22-27 use C4::Members; Link Here
22
use C4::Reserves;
22
use C4::Reserves;
23
use C4::Branch qw(GetBranchName);
23
use C4::Branch qw(GetBranchName);
24
use Digest::MD5 qw(md5_base64);
24
use Digest::MD5 qw(md5_base64);
25
use C4::Items qw( GetBarcodeFromItemnumber GetItemnumbersForBiblio);
25
26
26
our $VERSION = 3.07.00.049;
27
our $VERSION = 3.07.00.049;
27
28
Lines 91-98 sub new { Link Here
91
        screen_msg      => 'Greetings from Koha. ' . $kp->{opacnote},
92
        screen_msg      => 'Greetings from Koha. ' . $kp->{opacnote},
92
        print_line      => '',
93
        print_line      => '',
93
        items           => [],
94
        items           => [],
94
        hold_items      => $flags->{WAITING}{itemlist},
95
        hold_items      => $flags->{WAITING}->{itemlist},
95
        overdue_items   => $flags->{ODUES}{itemlist},
96
        overdue_items   => $flags->{ODUES}->{itemlist},
96
        fine_items      => [],
97
        fine_items      => [],
97
        recall_items    => [],
98
        recall_items    => [],
98
        unavail_holds   => [],
99
        unavail_holds   => [],
Lines 114-121 sub new { Link Here
114
    }
115
    }
115
116
116
    # FIXME: populate fine_items recall_items
117
    # FIXME: populate fine_items recall_items
117
#   $ilspatron{hold_items}    = (GetReservesFromBorrowernumber($kp->{borrowernumber},'F'));
118
    $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber});
118
    $ilspatron{unavail_holds} = [(GetReservesFromBorrowernumber($kp->{borrowernumber}))];
119
    $ilspatron{items} = GetPendingIssues($kp->{borrowernumber});
119
    $ilspatron{items} = GetPendingIssues($kp->{borrowernumber});
120
    $self = \%ilspatron;
120
    $self = \%ilspatron;
121
    $debug and warn Dumper($self);
121
    $debug and warn Dumper($self);
Lines 248-259 sub x_items { Link Here
248
    my $self      = shift;
248
    my $self      = shift;
249
    my $array_var = shift or return;
249
    my $array_var = shift or return;
250
    my ($start, $end) = @_;
250
    my ($start, $end) = @_;
251
    $self->{$array_var} or return [];
252
    $start = 1 unless defined($start);
253
    $end   = scalar @{$self->{$array_var}} unless defined($end);
254
    # syslog("LOG_DEBUG", "$array_var: start = %d, end = %d; items(%s)", $start, $end, join(', ', @{$self->{items}}));
255
251
256
    return [@{$self->{$array_var}}[$start-1 .. $end-1]];
252
    my $item_list = [];
253
    if ($self->{$array_var}) {
254
        if ($start && $start > 1) {
255
            --$start;
256
        }
257
        else {
258
            $start = 0;
259
        }
260
        if ( $end && $end < @{$self->{$array_var}} ) {
261
        }
262
        else {
263
            $end = @{$self->{$array_var}};
264
            --$end;
265
        }
266
        @{$item_list} = @{$self->{$array_var}}[ $start .. $end ];
267
268
    }
269
    return $item_list;
257
}
270
}
258
271
259
#
272
#
Lines 261-267 sub x_items { Link Here
261
#
274
#
262
sub hold_items {
275
sub hold_items {
263
    my $self = shift;
276
    my $self = shift;
264
    return $self->x_items('hold_items', @_);
277
    my $item_arr = $self->x_items('hold_items', @_);
278
    foreach my $item (@{$item_arr}) {
279
        $item->{barcode} = GetBarcodeFromItemnumber($item->{itemnumber});
280
    }
281
    return $item_arr;
265
}
282
}
266
283
267
sub overdue_items {
284
sub overdue_items {
Lines 365-370 sub _get_address { Link Here
365
    return $address;
382
    return $address;
366
}
383
}
367
384
385
sub _get_outstanding_holds {
386
    my $borrowernumber = shift;
387
    my @hold_array = grep { !defined $_->{found} || $_->{found} ne 'W'} GetReservesFromBorrowernumber($borrowernumber);
388
    foreach my $h (@hold_array) {
389
        my $item;
390
        if ($h->{itemnumber}) {
391
            $item = $h->{itemnumber};
392
        }
393
        else {
394
            # We need to return a barcode for the biblio so the client
395
            # can request the biblio info
396
            $item = ( GetItemnumbersForBiblio($h->{biblionumber}) )[0];
397
        }
398
        $h->{barcode} = GetBarcodeFromItemnumber($item);
399
    }
400
    return \@hold_array;
401
}
402
368
1;
403
1;
369
__END__
404
__END__
370
405
371
- 

Return to bug 10817