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

(-)a/opac/opac-renew.pl (-4 / +5 lines)
Lines 49-77 my $opacrenew = C4::Context->preference("OpacRenewalAllowed"); Link Here
49
49
50
my $errorstring = q{};
50
my $errorstring = q{};
51
my $renewed     = q{};
51
my $renewed     = q{};
52
my @errors;
52
53
53
my $patron = Koha::Patrons->find( $borrowernumber );
54
my $patron = Koha::Patrons->find( $borrowernumber );
54
55
55
if (   $patron->category->effective_BlockExpiredPatronOpacActions
56
if (   $patron->category->effective_BlockExpiredPatronOpacActions
56
    && $patron->is_expired )
57
    && $patron->is_expired )
57
{
58
{
58
    $errorstring = 'card_expired';
59
    push @errors, 'card_expired';
59
}
60
}
60
else {
61
else {
61
    my @renewed;
62
    my ( @renewed, @errors );
62
    for my $itemnumber (@items) {
63
    for my $itemnumber (@items) {
63
        my ( $status, $error ) =
64
        my ( $status, $error ) =
64
          CanBookBeRenewed( $borrowernumber, $itemnumber );
65
          CanBookBeRenewed( $borrowernumber, $itemnumber );
65
        $error = $error->[0] if @$error;
66
        if ( $status == 1 && $opacrenew == 1 ) {
66
        if ( $status == 1 && $opacrenew == 1 ) {
67
            AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef );
67
            AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef );
68
            push( @renewed, $itemnumber );
68
            push( @renewed, $itemnumber );
69
        }
69
        }
70
        else {
70
        else {
71
            $errorstring .= $error . "|";
71
            push @errors, @$error;
72
        }
72
        }
73
    }
73
    }
74
    $renewed = join( ':', @renewed );
74
    $renewed = join( ':', @renewed );
75
    $errorstring = join "|", @errors;
75
}
76
}
76
77
77
print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring&renewed=$renewed");
78
print $query->redirect("/cgi-bin/koha/opac-user.pl?renew_error=$errorstring&renewed=$renewed");
(-)a/opac/opac-user.pl (-13 / +18 lines)
Lines 232-249 if ( $pending_checkouts->count ) { # Useless test Link Here
232
232
233
        $issue->{'renewed'} = $renewed{ $issue->{'itemnumber'} };
233
        $issue->{'renewed'} = $renewed{ $issue->{'itemnumber'} };
234
234
235
        use Data::Printer colored => 1; warn p $renewerror;
235
        if (@$renewerror) {
236
        if (@$renewerror) {
236
            $renewerror = $renewerror->[0];
237
            $issue->{'too_many'}             = 1 if grep { $_ eq 'too_many' } @$renewerror;
237
            $issue->{'too_many'}       = 1 if $renewerror eq 'too_many';
238
            $issue->{'on_reserve'}           = 1 if grep { $_ eq 'on_reserve' } @$renewerror;
238
            $issue->{'on_reserve'}     = 1 if $renewerror eq 'on_reserve';
239
            $issue->{'norenew_overdue'}      = 1 if grep { $_ eq 'overdue' } @$renewerror;
239
            $issue->{'norenew_overdue'} = 1 if $renewerror eq 'overdue';
240
            $issue->{'auto_renew'}           = 1 if grep { $_ eq 'auto_renew' } @$renewerror;
240
            $issue->{'auto_renew'}     = 1 if $renewerror eq 'auto_renew';
241
            $issue->{'auto_too_soon'}        = 1 if grep { $_ eq 'auto_too_soon' } @$renewerror;
241
            $issue->{'auto_too_soon'}  = 1 if $renewerror eq 'auto_too_soon';
242
            $issue->{'auto_too_late'}        = 1 if grep { $_ eq 'auto_too_late' } @$renewerror;
242
            $issue->{'auto_too_late'}  = 1 if $renewerror eq 'auto_too_late';
243
            $issue->{'auto_too_much_oweing'} = 1 if grep { $_ eq 'auto_too_much_oweing' } @$renewerror;
243
            $issue->{'auto_too_much_oweing'}  = 1 if $renewerror eq 'auto_too_much_oweing';
244
            $issue->{'item_denied_renewal'}  = 1 if grep { $_ eq 'item_denied_renewal' } @$renewerror;
244
            $issue->{'item_denied_renewal'}  = 1 if $renewerror eq 'item_denied_renewal';
245
245
246
            if ( grep { $_ eq 'too_soon' } @$renewerror ) {
246
            if ( $renewerror eq 'too_soon' ) {
247
                $issue->{'too_soon'}         = 1;
247
                $issue->{'too_soon'}         = 1;
248
                $issue->{'soonestrenewdate'} = output_pref(
248
                $issue->{'soonestrenewdate'} = output_pref(
249
                    C4::Circulation::GetSoonestRenewDate(
249
                    C4::Circulation::GetSoonestRenewDate(
Lines 254-259 if ( $pending_checkouts->count ) { # Useless test Link Here
254
            }
254
            }
255
        }
255
        }
256
256
257
        $issue->{can_renew} = ! scalar @$renewerror;
258
257
        if ( $c->is_overdue ) {
259
        if ( $c->is_overdue ) {
258
            push @overdues, $issue;
260
            push @overdues, $issue;
259
            $overdues_count++;
261
            $overdues_count++;
Lines 301-307 if ( $pending_checkouts->count ) { # Useless test Link Here
301
    }
303
    }
302
}
304
}
303
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
305
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
304
$canrenew = 0 if ($overduesblockrenewing ne 'allow' and $overdues_count == $count);
306
my $canrenew_count = grep { $_->{canrenew} } @issuedat;
307
$canrenew = 0
308
  if ( $overduesblockrenewing ne 'allow'
309
    && $overdues_count == $count )
310
  || $canrenew_count == 0;
305
311
306
$template->param( ISSUES       => \@issuedat );
312
$template->param( ISSUES       => \@issuedat );
307
$template->param( issues_count => $count );
313
$template->param( issues_count => $count );
308
- 

Return to bug 25758