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

(-)a/opac/sco/sco-main.pl (-14 / +14 lines)
Lines 108-117 if (C4::Context->preference('SelfCheckoutByLogin') && !$patronid) { Link Here
108
    ($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw);
108
    ($resval, $patronid) = checkpw($dbh, $patronlogin, $patronpw);
109
}
109
}
110
110
111
my $borrower;
111
my ( $borrower, $patron );
112
if ( $patronid ) {
112
if ( $patronid ) {
113
    $borrower = Koha::Patrons->find( { cardnumber => $patronid } );
113
    $patron = Koha::Patrons->find( { cardnumber => $patronid } );
114
    $borrower = $borrower->unblessed if $borrower;
114
    $borrower = $patron->unblessed if $patron;
115
}
115
}
116
116
117
my $branch = $issuer->{branchcode};
117
my $branch = $issuer->{branchcode};
Lines 245-268 if ($borrower) { Link Here
245
#   warn "issuer's  branchcode: " .   $issuer->{branchcode};
245
#   warn "issuer's  branchcode: " .   $issuer->{branchcode};
246
#   warn   "user's  branchcode: " . $borrower->{branchcode};
246
#   warn   "user's  branchcode: " . $borrower->{branchcode};
247
    my $borrowername = sprintf "%s %s", ($borrower->{firstname} || ''), ($borrower->{surname} || '');
247
    my $borrowername = sprintf "%s %s", ($borrower->{firstname} || ''), ($borrower->{surname} || '');
248
    my @issues;
248
    my $pending_checkouts = $patron->pending_checkouts;
249
    my ($issueslist) = GetPendingIssues( $borrower->{'borrowernumber'} );
249
    my @checkouts;
250
    foreach my $it (@$issueslist) {
250
    while ( my $c = $pending_checkouts->next ) {
251
        my $checkout = $c->unblessed_all_relateds;
251
        my ($can_be_renewed, $renew_error) = CanBookBeRenewed(
252
        my ($can_be_renewed, $renew_error) = CanBookBeRenewed(
252
            $borrower->{borrowernumber},
253
            $borrower->{borrowernumber},
253
            $it->{itemnumber},
254
            $checkout->{itemnumber},
254
        );
255
        );
255
        $it->{can_be_renewed} = $can_be_renewed;
256
        $checkout->{can_be_renewed} = $can_be_renewed; # In the future this will be $checkout->can_be_renewed
256
        $it->{renew_error} = $renew_error;
257
        $checkout->{renew_error} = $renew_error;
257
        $it->{date_due}  = $it->{date_due_sql};
258
        $checkout->{overdue} = $c->is_overdue;
258
        push @issues, $it;
259
        push @checkouts, $checkout;
259
    }
260
    }
260
261
261
    $template->param(
262
    $template->param(
262
        validuser => 1,
263
        validuser => 1,
263
        borrowername => $borrowername,
264
        borrowername => $borrowername,
264
        issues_count => scalar(@issues),
265
        issues_count => scalar(@checkouts),
265
        ISSUES => \@issues,
266
        ISSUES => \@checkouts,
266
        patronid => $patronid,
267
        patronid => $patronid,
267
        patronlogin => $patronlogin,
268
        patronlogin => $patronlogin,
268
        patronpw => $patronpw,
269
        patronpw => $patronpw,
269
- 

Return to bug 19935