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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-7 / +57 lines)
Lines 92-97 Link Here
92
                        [% IF nochanges %]
92
                        [% IF nochanges %]
93
                            <div class="alert alert-error">No changes were made.</div>
93
                            <div class="alert alert-error">No changes were made.</div>
94
                        [% END %]
94
                        [% END %]
95
                        [% IF self_renewal %]
96
                            <div class="alert alert-info">Please verify your details to proceed with your self-renewal.</div>
97
                        [% END %]
95
                    [% END %]
98
                    [% END %]
96
99
97
                    [% IF empty_mandatory_fields %]
100
                    [% IF empty_mandatory_fields %]
Lines 241-247 Link Here
241
                        >
244
                        >
242
                    [% END %]
245
                    [% END %]
243
246
244
                    <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
247
                    <form
248
                        method="post"
249
                        [% IF (self_renewal) %]action="/api/v1/public/patrons/[% logged_in_user.borrowernumber | uri %]/self_renewal" id="self-renewal-form"[% ELSE %]action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form"[% END %]
250
                        autocomplete="off"
251
                    >
245
                        [% INCLUDE 'csrf-token.inc' %]
252
                        [% INCLUDE 'csrf-token.inc' %]
246
253
247
                        [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'preferred_name' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %]
254
                        [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'preferred_name' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %]
Lines 1362-1368 Link Here
1362
                                    [% IF OPACPatronDetails %]
1369
                                    [% IF OPACPatronDetails %]
1363
                                        <fieldset class="action">
1370
                                        <fieldset class="action">
1364
                                            <input type="hidden" name="op" value="cud-update" />
1371
                                            <input type="hidden" name="op" value="cud-update" />
1365
                                            <input type="submit" class="btn btn-primary" value="Submit update request" />
1372
                                            [% IF (self_renewal) %]
1373
                                                <input type="submit" class="btn btn-primary" value="Submit renewal request" />
1374
                                            [% ELSE %]
1375
                                                <input type="submit" class="btn btn-primary" value="Submit update request" />
1376
                                            [% END %]
1366
                                        </fieldset>
1377
                                        </fieldset>
1367
                                    [% END %]
1378
                                    [% END %]
1368
                                [% ELSE %]
1379
                                [% ELSE %]
Lines 1391-1406 Link Here
1391
    [% INCLUDE 'calendar.inc' %]
1402
    [% INCLUDE 'calendar.inc' %]
1392
    <script>
1403
    <script>
1393
        $(document).ready(function() {
1404
        $(document).ready(function() {
1405
                let formName
1406
                [% IF (self_renewal) %]
1407
                    formName = 'self-renewal-form'
1408
                [% ELSE %]
1409
                    formName = 'memberentry-form'
1410
                [% END %]
1411
1394
                [% IF op == 'edit' && !OPACPatronDetails %]
1412
                [% IF op == 'edit' && !OPACPatronDetails %]
1395
                    $("#memberentry-form :input").attr('readonly', true);
1413
                    $("#" + formName + " :input").attr('readonly', true);
1396
                    $("#borrower_branchcode").attr('disabled',true);
1414
                    $("#borrower_branchcode").attr('disabled',true);
1397
                    $("#borrower_title").attr('disabled',true);
1415
                    $("#borrower_title").attr('disabled',true);
1398
                    $('#memberentry-form :radio').attr('disabled',true);
1416
                    $('#' + formName + ' :radio').attr('disabled',true);
1399
                    $('span.required').remove();
1417
                    $('span.required').remove();
1400
                    $('label.required').removeClass('required');
1418
                    $('label.required').removeClass('required');
1401
                [% END %]
1419
                [% END %]
1402
1420
1403
                $("#memberentry-form").validate({
1421
                $("#" + formName).validate({
1404
                    rules: {
1422
                    rules: {
1405
                        borrower_email: {
1423
                        borrower_email: {
1406
                            email: true
1424
                            email: true
Lines 1430-1437 Link Here
1430
                            return false;
1448
                            return false;
1431
                        }
1449
                        }
1432
                        else {
1450
                        else {
1433
                            form.beenSubmitted = true;
1451
                            if(formName === 'self-renewal-form') {
1434
                            form.submit();
1452
                                const formValues = $(form).serializeArray()
1453
                                const renewalBody = formValues.reduce((body, curr, i) => {
1454
                                    if(curr.name.includes("borrower")) {
1455
                                        const fieldName = curr.name.replace("borrower_", "")
1456
                                        body[fieldName] = curr.value
1457
                                    }
1458
                                    if(curr.name === "patron_attribute_code") {
1459
                                        const matchingValue = formValues[i + 1].value
1460
                                        body.extended_attributes.push({code: curr.value, attribute: matchingValue})
1461
                                    }
1462
                                    return body
1463
                                }, {extended_attributes: []})
1464
                                const options = {
1465
                                    url: $(form).attr('action'),
1466
                                    method: $(form).attr('method').toUpperCase(),
1467
                                    contentType: 'application/json',
1468
                                    data: JSON.stringify({patron: renewalBody})
1469
                                };
1470
                                $.ajax(options)
1471
                                    .then(function(result) {
1472
                                        let newLocation = "/cgi-bin/koha/opac-user.pl?self_renewal_success=" + result.expiry_date
1473
                                        if(result.confirmation_sent) {
1474
                                            newLocation += "&confirmation_sent=1"
1475
                                        }
1476
                                        document.location = newLocation
1477
                                    })
1478
                                    .fail(function(err) {
1479
                                        document.location = "/cgi-bin/koha/opac-user.pl?self_renewal_success=0";
1480
                                    });
1481
                            } else {
1482
                                form.beenSubmitted = true;
1483
                                form.submit();
1484
                            }
1435
                        }
1485
                        }
1436
                    }
1486
                    }
1437
                });
1487
                });
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-3 / +38 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE To %]
2
[% USE Asset %]
3
[% USE Asset %]
3
[% USE Koha %]
4
[% USE Koha %]
4
[% USE KohaDates %]
5
[% USE KohaDates %]
Lines 126-143 Link Here
126
                        </div>
127
                        </div>
127
                    [% END %]
128
                    [% END %]
128
129
129
                    [% IF ( borrower.warndeparture ) %]
130
                    [% IF ( borrower.warndeparture) %]
130
                        <div class="alert alert-warning" id="warndeparture">
131
                        <div class="alert alert-warning" id="warndeparture">
131
                            <strong>Please note:</strong><span> Your library card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
132
                            <strong>Please note:</strong
133
                            ><span>
134
                                Your library card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>.
135
                                [% IF ( !self_renewal_available) %]Please contact the library for more information.[% END %]</span
136
                            >
132
                            [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your library card expires.</span>[% END %]
137
                            [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your library card expires.</span>[% END %]
133
                        </div>
138
                        </div>
134
                    [% END %]
139
                    [% END %]
135
136
                    [% IF ( borrower.warnexpired ) %]
140
                    [% IF ( borrower.warnexpired ) %]
137
                        <div class="alert alert-warning" id="warnexpired">
141
                        <div class="alert alert-warning" id="warnexpired">
138
                            <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
142
                            <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
139
                        </div>
143
                        </div>
140
                    [% END %]
144
                    [% END %]
145
                    [% IF ( self_renewal_available && !self_renewal_alert ) %]
146
                        <div class="alert alert-info" id="self_renewal_available">
147
                            [% IF ( self_renewal_available ) %]
148
                                <span> You are eligible for self-renewal. <a href="#patronSelfRenewal" data-bs-toggle="modal">Please click here to renew your account.</a></span>
149
                            [% END %]
150
                        </div>
151
                    [% END %]
152
                    [% IF ( self_renewal_success ) %]
153
                        <div class="alert alert-success" id="self_renewal_success">
154
                            <span>Your account has been successfully renewed until [% self_renewal_success | $KohaDates %].</span>
155
                            [% IF ( self_renewal_confirmation_sent ) %]
156
                                <span>You should receive a confirmation shortly.</span>
157
                            [% END %]
158
                        </div>
159
                    [% END %]
160
                    [% IF ( self_renewal_alert ) %]
161
                        <div class="alert alert-warning" id="self_renewal_alert">
162
                            <span>[% self_renewal_alert | html %]</span>
163
                        </div>
164
                    [% END %]
141
165
142
                    [% IF ( RENEW_ERROR ) %]
166
                    [% IF ( RENEW_ERROR ) %]
143
                        <div class="alert alert-warning">
167
                        <div class="alert alert-warning">
Lines 1010-1015 Link Here
1010
</main>
1034
</main>
1011
<!-- /#main -->
1035
<!-- /#main -->
1012
1036
1037
[% IF ( self_renewal_available ) %]
1038
    <patron-self-renewal patron="[% borrowernumber | html %]"></patron-self-renewal>
1039
[% END %]
1040
1041
[% SET islands = Asset.js("js/vue/dist/islands.esm.js").match('(src="([^"]+)")').1 %]
1042
<script src="[% islands | $raw %]" type="module">
1043
</script>
1044
<script type="module">
1045
    import { hydrate } from "[% islands | $raw %]";
1046
    hydrate();
1047
</script>
1013
[%# hold suspend modal form %]
1048
[%# hold suspend modal form %]
1014
<div id="suspendHoldModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="suspendModalLabel" aria-hidden="true" data-focus="false">
1049
<div id="suspendHoldModal" class="modal" tabindex="-1" role="dialog" aria-labelledby="suspendModalLabel" aria-hidden="true" data-focus="false">
1015
    <div class="modal-dialog">
1050
    <div class="modal-dialog">
(-)a/opac/opac-memberentry.pl (-17 / +6 lines)
Lines 354-375 if ( $op eq 'cud-create' ) { Link Here
354
            $borrower_changes{borrowernumber}      = $borrowernumber;
354
            $borrower_changes{borrowernumber}      = $borrowernumber;
355
            $borrower_changes{extended_attributes} = to_json($extended_attributes_changes);
355
            $borrower_changes{extended_attributes} = to_json($extended_attributes_changes);
356
356
357
            Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->delete;
358
359
            $borrower_changes{verification_token} = q{};    # prevent warn Missing value for PK column
360
            my $m = Koha::Patron::Modification->new( \%borrower_changes )->store();
361
362
            #Automatically approve patron profile changes if set in syspref
363
364
            if ( C4::Context->preference('AutoApprovePatronProfileSettings') ) {
365
366
                # Need to get the object from database, otherwise it is not complete enough to allow deletion
367
                # when approval has been performed.
368
                my $tmp_m = Koha::Patron::Modifications->find( { borrowernumber => $borrowernumber } );
369
                $tmp_m->approve() if $tmp_m;
370
            }
371
372
            my $patron = Koha::Patrons->find($borrowernumber);
357
            my $patron = Koha::Patrons->find($borrowernumber);
358
            $patron->request_modification( \%borrower_changes );
373
            $template->param( borrower => $patron->unblessed );
359
            $template->param( borrower => $patron->unblessed );
374
        } else {
360
        } else {
375
            my $patron = Koha::Patrons->find($borrowernumber);
361
            my $patron = Koha::Patrons->find($borrowernumber);
Lines 385-393 if ( $op eq 'cud-create' ) { Link Here
385
    my $patron   = Koha::Patrons->find($borrowernumber);
371
    my $patron   = Koha::Patrons->find($borrowernumber);
386
    my $borrower = $patron->unblessed;
372
    my $borrower = $patron->unblessed;
387
373
374
    my $self_renewal = $cgi->param('self_renewal') || 0;
375
388
    $template->param(
376
    $template->param(
389
        borrower => $borrower,
377
        borrower     => $borrower,
390
        hidden   => GetHiddenFields( $mandatory, 'edit' ),
378
        hidden       => GetHiddenFields( $mandatory, 'edit' ),
379
        self_renewal => $self_renewal
391
    );
380
    );
392
381
393
    if ( C4::Context->preference('OPACpatronimages') ) {
382
    if ( C4::Context->preference('OPACpatronimages') ) {
(-)a/opac/opac-user.pl (-339 / +349 lines)
Lines 16-425 Link Here
16
# You should have received a copy of the GNU General Public License
16
# You should have received a copy of the GNU General Public License
17
# along with Koha; if not, see <https://www.gnu.org/licenses>.
17
# along with Koha; if not, see <https://www.gnu.org/licenses>.
18
18
19
use Modern::Perl;
19
    use Modern::Perl;
20
20
21
use CGI qw ( -utf8 );
21
    use CGI qw ( -utf8 );
22
use URI;
22
    use URI;
23
23
24
use C4::Auth qw( get_template_and_user );
24
    use C4::Auth qw( get_template_and_user );
25
use C4::Koha qw(
25
    use C4::Koha qw(
26
    getitemtypeimagelocation
26
        getitemtypeimagelocation
27
    GetNormalizedISBN
27
        GetNormalizedISBN
28
    GetNormalizedUPC
28
        GetNormalizedUPC
29
    GetNormalizedOCLCNumber
29
        GetNormalizedOCLCNumber
30
);
30
    );
31
use C4::Circulation           qw( CanBookBeRenewed GetRenewCount GetIssuingCharges );
31
    use C4::Circulation           qw( CanBookBeRenewed GetRenewCount GetIssuingCharges );
32
use C4::External::BakerTaylor qw( image_url link_url );
32
    use C4::External::BakerTaylor qw( image_url link_url );
33
use C4::Reserves              qw( GetReserveStatus );
33
    use C4::Reserves              qw( GetReserveStatus );
34
use C4::Members;
34
    use C4::Members;
35
use C4::Output qw( output_html_with_http_headers );
35
    use C4::Output qw( output_html_with_http_headers );
36
use Koha::Account::Lines;
36
    use Koha::Account::Lines;
37
use Koha::Biblios;
37
    use Koha::Biblios;
38
use Koha::Libraries;
38
    use Koha::Libraries;
39
use Koha::DateUtils qw( output_pref );
39
    use Koha::DateUtils qw( output_pref );
40
use Koha::Holds;
40
    use Koha::Holds;
41
use Koha::Database;
41
    use Koha::Database;
42
use Koha::ItemTypes;
42
    use Koha::ItemTypes;
43
use Koha::Patron::Attribute::Types;
43
    use Koha::Patron::Attribute::Types;
44
use Koha::Patrons;
44
    use Koha::Patrons;
45
use Koha::Patron::Messages;
45
    use Koha::Patron::Messages;
46
use Koha::Patron::Discharge;
46
    use Koha::Patron::Discharge;
47
use Koha::Patrons;
47
    use Koha::Patrons;
48
use Koha::Ratings;
48
    use Koha::Ratings;
49
use Koha::Recalls;
49
    use Koha::Recalls;
50
50
51
use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
51
    use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE';
52
52
53
use Scalar::Util qw( looks_like_number );
53
    use Scalar::Util qw( looks_like_number );
54
use Date::Calc   qw( Date_to_Days Today );
54
    use Date::Calc   qw( Date_to_Days Today );
55
55
56
my $query = CGI->new;
56
    my $query = CGI->new;
57
57
58
my $op = $query->param('op') || q{};
58
    my $op = $query->param('op') || q{};
59
59
60
# CAS single logout handling
60
# CAS single logout handling
61
# Will print header and exit
61
# Will print header and exit
62
if ( C4::Context->preference('casAuthentication') ) {
62
    if ( C4::Context->preference('casAuthentication') ) {
63
    require C4::Auth_with_cas;
63
        require C4::Auth_with_cas;
64
    C4::Auth_with_cas::logout_if_required($query);
64
        C4::Auth_with_cas::logout_if_required($query);
65
}
66
67
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
68
    {
69
        template_name => "opac-user.tt",
70
        query         => $query,
71
        type          => "opac",
72
    }
65
    }
73
);
74
66
75
my %renewed = map { $_ => 1 } split( ':', $query->param('renewed') || '' );
67
    my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
68
        {
69
            template_name => "opac-user.tt",
70
            query         => $query,
71
            type          => "opac",
72
        }
73
    );
74
75
    my %renewed = map { $_ => 1 } split( ':', $query->param('renewed') || '' );
76
76
77
my $show_priority;
77
    my $show_priority;
78
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
78
    for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
79
    m/priority/ and $show_priority = 1;
79
        m/priority/ and $show_priority = 1;
80
}
80
    }
81
81
82
my $patronupdate = $query->param('patronupdate');
82
    my $patronupdate = $query->param('patronupdate');
83
my $canrenew     = 1;
83
    my $canrenew     = 1;
84
84
85
$template->param( shibbolethAuthentication => C4::Context->config('useshibboleth') );
85
    $template->param( shibbolethAuthentication => C4::Context->config('useshibboleth') );
86
86
87
# get borrower information ....
87
# get borrower information ....
88
my $patron = Koha::Patrons->find($borrowernumber);
88
    my $patron = Koha::Patrons->find($borrowernumber);
89
90
if ( $op eq 'cud-update_arc' && C4::Context->preference("AllowPatronToControlAutorenewal") ) {
91
    my $autorenew_checkouts = $query->param('borrower_autorenew_checkouts');
92
    $patron->autorenew_checkouts($autorenew_checkouts)->store() if defined $autorenew_checkouts;
93
}
94
89
95
my $borr = $patron->unblessed;
90
    if ( $op eq 'cud-update_arc' && C4::Context->preference("AllowPatronToControlAutorenewal") ) {
91
        my $autorenew_checkouts = $query->param('borrower_autorenew_checkouts');
92
        $patron->autorenew_checkouts($autorenew_checkouts)->store() if defined $autorenew_checkouts;
93
    }
96
94
97
my ( $today_year, $today_month, $today_day ) = Today();
95
    my $borr = $patron->unblessed;
98
my ( $warning_year, $warning_month, $warning_day ) = split /-/, $borr->{'dateexpiry'};
99
96
100
my $debar = Koha::Patrons->find($borrowernumber)->is_debarred;
97
    my ( $today_year, $today_month, $today_day ) = Today();
101
my $userdebarred;
98
    my ( $warning_year, $warning_month, $warning_day ) = split /-/, $borr->{'dateexpiry'};
102
99
103
if ($debar) {
100
    my $debar = Koha::Patrons->find($borrowernumber)->is_debarred;
104
    $userdebarred = 1;
101
    my $userdebarred;
105
    $template->param( 'userdebarred' => $userdebarred );
106
    if ( $debar ne "9999-12-31" ) {
107
        $borr->{'userdebarreddate'} = $debar;
108
    }
109
102
110
    # FIXME looks like $available is not needed
103
    if ($debar) {
111
    # If a user is discharged they have a validated discharge available
104
        $userdebarred = 1;
112
    my $available = Koha::Patron::Discharge::count(
105
        $template->param( 'userdebarred' => $userdebarred );
113
        {
106
        if ( $debar ne "9999-12-31" ) {
114
            borrowernumber => $borrowernumber,
107
            $borr->{'userdebarreddate'} = $debar;
115
            validated      => 1,
116
        }
108
        }
117
    );
118
    $template->param( 'discharge_available' => $available
119
            && Koha::Patron::Discharge::is_discharged( { borrowernumber => $borrowernumber } ) );
120
}
121
109
122
if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
110
        # FIXME looks like $available is not needed
123
    $borr->{'flagged'} = 1;
111
        # If a user is discharged they have a validated discharge available
124
    $canrenew = 0;
112
        my $available = Koha::Patron::Discharge::count(
125
}
113
            {
114
                borrowernumber => $borrowernumber,
115
                validated      => 1,
116
            }
117
        );
118
        $template->param( 'discharge_available' => $available
119
                && Koha::Patron::Discharge::is_discharged( { borrowernumber => $borrowernumber } ) );
120
    }
126
121
127
my $amountoutstanding = $patron->account->balance;
122
    if ( $userdebarred || $borr->{'gonenoaddress'} || $borr->{'lost'} ) {
128
my $no_renewal_amt    = C4::Context->preference('OPACFineNoRenewals');
123
        $borr->{'flagged'} = 1;
129
$no_renewal_amt = undef unless looks_like_number($no_renewal_amt);
124
        $canrenew = 0;
130
my $amountoutstandingfornewal =
125
    }
131
    C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
132
    ? $amountoutstanding
133
    : $patron->account->outstanding_debits->total_outstanding;
134
135
if (   C4::Context->preference('OpacRenewalAllowed')
136
    && defined($no_renewal_amt)
137
    && $amountoutstandingfornewal > $no_renewal_amt )
138
{
139
    $borr->{'flagged'} = 1;
140
    $canrenew = 0;
141
    $template->param(
142
        renewal_blocked_fines                   => $no_renewal_amt,
143
        renewal_blocked_fines_amountoutstanding => $amountoutstandingfornewal,
144
    );
145
}
146
126
147
my $maxoutstanding = C4::Context->preference('maxoutstanding');
127
    my $amountoutstanding = $patron->account->balance;
148
if ( $amountoutstanding && ( $amountoutstanding > $maxoutstanding ) ) {
128
    my $no_renewal_amt    = C4::Context->preference('OPACFineNoRenewals');
149
    $borr->{blockedonfines} = 1;
129
    $no_renewal_amt = undef unless looks_like_number($no_renewal_amt);
150
}
130
    my $amountoutstandingfornewal =
131
        C4::Context->preference("OPACFineNoRenewalsIncludeCredits")
132
        ? $amountoutstanding
133
        : $patron->account->outstanding_debits->total_outstanding;
134
135
    if (   C4::Context->preference('OpacRenewalAllowed')
136
        && defined($no_renewal_amt)
137
        && $amountoutstandingfornewal > $no_renewal_amt )
138
    {
139
        $borr->{'flagged'} = 1;
140
        $canrenew = 0;
141
        $template->param(
142
            renewal_blocked_fines                   => $no_renewal_amt,
143
            renewal_blocked_fines_amountoutstanding => $amountoutstandingfornewal,
144
        );
145
    }
146
147
    my $maxoutstanding = C4::Context->preference('maxoutstanding');
148
    if ( $amountoutstanding && ( $amountoutstanding > $maxoutstanding ) ) {
149
        $borr->{blockedonfines} = 1;
150
    }
151
151
152
# Warningdate is the date that the warning starts appearing
152
# Warningdate is the date that the warning starts appearing
153
if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
153
    if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture') ) {
154
    my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) -
154
        my $days_to_expiry = Date_to_Days( $warning_year, $warning_month, $warning_day ) -
155
        Date_to_Days( $today_year, $today_month, $today_day );
155
            Date_to_Days( $today_year, $today_month, $today_day );
156
    if ( $days_to_expiry < 0 ) {
156
        if ( $days_to_expiry < 0 ) {
157
157
158
        #borrower card has expired, warn the borrower
158
            #borrower card has expired, warn the borrower
159
        $borr->{'warnexpired'} = $borr->{'dateexpiry'};
159
            $borr->{'warnexpired'} = $borr->{'dateexpiry'};
160
    } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) {
160
        } elsif ( $days_to_expiry < C4::Context->preference('NotifyBorrowerDeparture') ) {
161
161
162
        # borrower card soon to expire, warn the borrower
162
            # borrower card soon to expire, warn the borrower
163
        $borr->{'warndeparture'} = $borr->{dateexpiry};
163
            $borr->{'warndeparture'} = $borr->{dateexpiry};
164
        if ( C4::Context->preference('ReturnBeforeExpiry') ) {
164
            if ( C4::Context->preference('ReturnBeforeExpiry') ) {
165
            $borr->{'returnbeforeexpiry'} = 1;
165
                $borr->{'returnbeforeexpiry'} = 1;
166
            }
166
        }
167
        }
167
    }
168
    }
168
}
169
169
170
my $saving_display = C4::Context->preference('OPACShowSavings');
170
    my $saving_display = C4::Context->preference('OPACShowSavings');
171
if ( $saving_display =~ /user/ ) {
171
    if ( $saving_display =~ /user/ ) {
172
    $template->param( savings => $patron->get_savings );
172
        $template->param( savings => $patron->get_savings );
173
}
173
    }
174
174
175
# pass on any renew errors to the template for displaying
175
# pass on any renew errors to the template for displaying
176
my $renew_error = $query->param('renew_error');
176
    my $renew_error = $query->param('renew_error');
177
177
178
$template->param(
178
    $template->param(
179
    amountoutstanding => $amountoutstanding,
179
        amountoutstanding => $amountoutstanding,
180
    borrowernumber    => $borrowernumber,
180
        borrowernumber    => $borrowernumber,
181
    patron_flagged    => $borr->{flagged},
181
        patron_flagged    => $borr->{flagged},
182
    surname           => $borr->{surname},
182
        surname           => $borr->{surname},
183
    RENEW_ERROR       => $renew_error,
183
        RENEW_ERROR       => $renew_error,
184
    borrower          => $borr,
184
        borrower          => $borr,
185
);
185
    );
186
186
187
#get issued items ....
187
#get issued items ....
188
188
189
my $count          = 0;
189
    my $count          = 0;
190
my $overdues_count = 0;
190
    my $overdues_count = 0;
191
my @overdues;
191
    my @overdues;
192
my @issuedat;
192
    my @issuedat;
193
my $itemtypes         = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
193
    my $itemtypes         = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
194
my $pending_checkouts = $patron->pending_checkouts->search(
194
    my $pending_checkouts = $patron->pending_checkouts->search(
195
    {},
195
        {},
196
    {
196
        {
197
        order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ],
197
            order_by => [ { -desc => 'date_due' }, { -asc => 'issue_id' } ],
198
        prefetch => 'item'
198
            prefetch => 'item'
199
    }
200
);
201
my $are_renewable_items = 0;
202
if ( $pending_checkouts->count ) {    # Useless test
203
    while ( my $c = $pending_checkouts->next ) {
204
        my $issue = $c->unblessed_all_relateds;
205
206
        # check for reserves
207
        my $restype = GetReserveStatus( $issue->{'itemnumber'} );
208
        if ($restype) {
209
            $issue->{'reserved'} = 1;
210
        }
199
        }
200
    );
201
    my $are_renewable_items = 0;
202
    if ( $pending_checkouts->count ) {    # Useless test
203
        while ( my $c = $pending_checkouts->next ) {
204
            my $issue = $c->unblessed_all_relateds;
205
206
            # check for reserves
207
            my $restype = GetReserveStatus( $issue->{'itemnumber'} );
208
            if ($restype) {
209
                $issue->{'reserved'} = 1;
210
            }
211
211
212
        # Must be moved in a module if reused
212
            # Must be moved in a module if reused
213
        my $charges = Koha::Account::Lines->search(
213
            my $charges = Koha::Account::Lines->search(
214
            {
214
                {
215
                borrowernumber    => $patron->borrowernumber,
215
                    borrowernumber    => $patron->borrowernumber,
216
                amountoutstanding => { '>' => 0 },
216
                    amountoutstanding => { '>' => 0 },
217
                debit_type_code   => [ 'OVERDUE', 'LOST' ],
217
                    debit_type_code   => [ 'OVERDUE', 'LOST' ],
218
                itemnumber        => $issue->{itemnumber}
218
                    itemnumber        => $issue->{itemnumber}
219
            },
219
                },
220
        );
220
            );
221
        $issue->{charges} = $charges->total_outstanding;
221
            $issue->{charges} = $charges->total_outstanding;
222
222
223
        my $rental_fines = Koha::Account::Lines->search(
223
            my $rental_fines = Koha::Account::Lines->search(
224
            {
224
                {
225
                borrowernumber    => $patron->borrowernumber,
225
                    borrowernumber    => $patron->borrowernumber,
226
                amountoutstanding => { '>'    => 0 },
226
                    amountoutstanding => { '>'    => 0 },
227
                debit_type_code   => { 'LIKE' => 'RENT_%' },
227
                    debit_type_code   => { 'LIKE' => 'RENT_%' },
228
                itemnumber        => $issue->{itemnumber}
228
                    itemnumber        => $issue->{itemnumber}
229
                }
230
            );
231
            $issue->{rentalfines} = $rental_fines->total_outstanding;
232
233
            # check if item is renewable
234
            my ( $status, $renewerror, $info ) = CanBookBeRenewed( $patron, $c );
235
            (
236
                $issue->{'renewcount'},
237
                $issue->{'renewsallowed'},
238
                $issue->{'renewsleft'},
239
                $issue->{'unseencount'},
240
                $issue->{'unseenallowed'},
241
                $issue->{'unseenleft'}
242
            ) = GetRenewCount( $patron, $c->item );
243
            ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) =
244
                GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
245
            $issue->{itemtype_object} = Koha::ItemTypes->find( $c->item->effective_itemtype );
246
            if ( $status && C4::Context->preference("OpacRenewalAllowed") ) {
247
                $are_renewable_items = 1;
248
                $issue->{'status'} = $status;
229
            }
249
            }
230
        );
231
        $issue->{rentalfines} = $rental_fines->total_outstanding;
232
233
        # check if item is renewable
234
        my ( $status, $renewerror, $info ) = CanBookBeRenewed( $patron, $c );
235
        (
236
            $issue->{'renewcount'},
237
            $issue->{'renewsallowed'},
238
            $issue->{'renewsleft'},
239
            $issue->{'unseencount'},
240
            $issue->{'unseenallowed'},
241
            $issue->{'unseenleft'}
242
        ) = GetRenewCount( $patron, $c->item );
243
        ( $issue->{'renewalfee'}, $issue->{'renewalitemtype'} ) =
244
            GetIssuingCharges( $issue->{'itemnumber'}, $borrowernumber );
245
        $issue->{itemtype_object} = Koha::ItemTypes->find( $c->item->effective_itemtype );
246
        if ( $status && C4::Context->preference("OpacRenewalAllowed") ) {
247
            $are_renewable_items = 1;
248
            $issue->{'status'} = $status;
249
        }
250
250
251
        $issue->{'renewed'} = $renewed{ $issue->{'itemnumber'} };
251
            $issue->{'renewed'} = $renewed{ $issue->{'itemnumber'} };
252
252
253
        if ($renewerror) {
253
            if ($renewerror) {
254
            $issue->{'too_many'}                    = 1 if $renewerror eq 'too_many';
254
                $issue->{'too_many'}                    = 1 if $renewerror eq 'too_many';
255
            $issue->{'too_unseen'}                  = 1 if $renewerror eq 'too_unseen';
255
                $issue->{'too_unseen'}                  = 1 if $renewerror eq 'too_unseen';
256
            $issue->{'on_reserve'}                  = 1 if $renewerror eq 'on_reserve';
256
                $issue->{'on_reserve'}                  = 1 if $renewerror eq 'on_reserve';
257
            $issue->{'norenew_overdue'}             = 1 if $renewerror eq 'overdue';
257
                $issue->{'norenew_overdue'}             = 1 if $renewerror eq 'overdue';
258
            $issue->{'auto_renew'}                  = 1 if $renewerror eq 'auto_renew';
258
                $issue->{'auto_renew'}                  = 1 if $renewerror eq 'auto_renew';
259
            $issue->{'auto_too_soon'}               = 1 if $renewerror eq 'auto_too_soon';
259
                $issue->{'auto_too_soon'}               = 1 if $renewerror eq 'auto_too_soon';
260
            $issue->{'auto_too_late'}               = 1 if $renewerror eq 'auto_too_late';
260
                $issue->{'auto_too_late'}               = 1 if $renewerror eq 'auto_too_late';
261
            $issue->{'auto_too_much_oweing'}        = 1 if $renewerror eq 'auto_too_much_oweing';
261
                $issue->{'auto_too_much_oweing'}        = 1 if $renewerror eq 'auto_too_much_oweing';
262
            $issue->{'item_denied_renewal'}         = 1 if $renewerror eq 'item_denied_renewal';
262
                $issue->{'item_denied_renewal'}         = 1 if $renewerror eq 'item_denied_renewal';
263
            $issue->{'item_issued_to_other_patron'} = 1 if $renewerror eq 'item_issued_to_other_patron';
263
                $issue->{'item_issued_to_other_patron'} = 1 if $renewerror eq 'item_issued_to_other_patron';
264
264
265
            if ( $renewerror eq 'too_soon' ) {
265
                if ( $renewerror eq 'too_soon' ) {
266
                $issue->{'too_soon'}         = 1;
266
                    $issue->{'too_soon'}         = 1;
267
                $issue->{'soonestrenewdate'} = $info->{soonest_renew_date};
267
                    $issue->{'soonestrenewdate'} = $info->{soonest_renew_date};
268
                }
268
            }
269
            }
269
        }
270
270
271
        if ( $c->is_overdue ) {
271
            if ( $c->is_overdue ) {
272
            push @overdues, $issue;
272
                push @overdues, $issue;
273
            $overdues_count++;
273
                $overdues_count++;
274
            $issue->{'overdue'} = 1;
274
                $issue->{'overdue'} = 1;
275
        } else {
275
            } else {
276
            $issue->{'issued'} = 1;
276
                $issue->{'issued'} = 1;
277
        }
277
            }
278
278
279
        # imageurl:
279
            # imageurl:
280
        my $itemtype = $issue->{'itemtype'};
280
            my $itemtype = $issue->{'itemtype'};
281
        if ($itemtype) {
281
            if ($itemtype) {
282
            $issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
282
                $issue->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
283
            $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
283
                $issue->{'description'} = $itemtypes->{$itemtype}->{'description'};
284
        }
284
            }
285
285
286
        if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
286
            if ( C4::Context->preference('OpacStarRatings') eq 'all' ) {
287
            my $ratings = Koha::Ratings->search( { biblionumber => $issue->{biblionumber} } );
287
                my $ratings = Koha::Ratings->search( { biblionumber => $issue->{biblionumber} } );
288
            $issue->{ratings} = $ratings;
288
                $issue->{ratings} = $ratings;
289
            $issue->{my_rating} =
289
                $issue->{my_rating} =
290
                $borrowernumber ? $ratings->search( { borrowernumber => $borrowernumber } )->next : undef;
290
                    $borrowernumber ? $ratings->search( { borrowernumber => $borrowernumber } )->next : undef;
291
        }
291
            }
292
292
293
        my $biblio_object = Koha::Biblios->find( $issue->{biblionumber} );
293
            my $biblio_object = Koha::Biblios->find( $issue->{biblionumber} );
294
        $issue->{biblio_object} = $biblio_object;
294
            $issue->{biblio_object} = $biblio_object;
295
        push @issuedat, $issue;
295
            push @issuedat, $issue;
296
        $count++;
296
            $count++;
297
297
298
        my $isbn = GetNormalizedISBN( $issue->{'isbn'} );
298
            my $isbn = GetNormalizedISBN( $issue->{'isbn'} );
299
        $issue->{normalized_isbn} = $isbn;
299
            $issue->{normalized_isbn} = $isbn;
300
300
301
        if (   C4::Context->preference('BakerTaylorEnabled')
301
            if (   C4::Context->preference('BakerTaylorEnabled')
302
            || C4::Context->preference('SyndeticsEnabled')
302
                || C4::Context->preference('SyndeticsEnabled')
303
            || C4::Context->preference('SyndeticsCoverImages') )
303
                || C4::Context->preference('SyndeticsCoverImages') )
304
        {
304
            {
305
            my $marcrecord = $biblio_object->metadata_record(
305
                my $marcrecord = $biblio_object->metadata_record(
306
                {
306
                    {
307
                    embed_items => 1,
307
                        embed_items => 1,
308
                    interface   => 'opac',
308
                        interface   => 'opac',
309
                    patron      => $patron
309
                        patron      => $patron
310
                }
310
                    }
311
            );
311
                );
312
            $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
312
                $issue->{normalized_upc}  = GetNormalizedUPC( $marcrecord, C4::Context->preference('marcflavour') );
313
            $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
313
                $issue->{normalized_oclc} = GetNormalizedOCLCNumber( $marcrecord, C4::Context->preference('marcflavour') );
314
        }
314
            }
315
315
316
        if ( C4::Context->preference('UseRecalls') ) {
316
            if ( C4::Context->preference('UseRecalls') ) {
317
            my $maybe_recalls = Koha::Recalls->search(
317
                my $maybe_recalls = Koha::Recalls->search(
318
                { biblio_id => $issue->{biblionumber}, item_id => [ undef, $issue->{itemnumber} ], completed => 0 } );
318
                    { biblio_id => $issue->{biblionumber}, item_id => [ undef, $issue->{itemnumber} ], completed => 0 } );
319
            while ( my $recall = $maybe_recalls->next ) {
319
                while ( my $recall = $maybe_recalls->next ) {
320
                if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) {
320
                    if ( $recall->checkout and $recall->checkout->issue_id == $issue->{issue_id} ) {
321
                    $issue->{recall} = 1;
321
                        $issue->{recall} = 1;
322
                    last;
322
                        last;
323
                    }
323
                }
324
                }
324
            }
325
            }
325
        }
326
        }
326
    }
327
    }
327
}
328
    my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
328
my $overduesblockrenewing = C4::Context->preference('OverduesBlockRenewing');
329
    $canrenew = 0 if ( $overduesblockrenewing ne 'allow' and $overdues_count == $count ) || !$are_renewable_items;
329
$canrenew = 0 if ( $overduesblockrenewing ne 'allow' and $overdues_count == $count ) || !$are_renewable_items;
330
330
331
    $template->param( ISSUES         => \@issuedat );
331
$template->param( ISSUES         => \@issuedat );
332
    $template->param( issues_count   => $count );
332
$template->param( issues_count   => $count );
333
    $template->param( canrenew       => $canrenew );
333
$template->param( canrenew       => $canrenew );
334
    $template->param( OVERDUES       => \@overdues );
334
$template->param( OVERDUES       => \@overdues );
335
    $template->param( overdues_count => $overdues_count );
335
$template->param( overdues_count => $overdues_count );
336
336
337
    my $show_barcode = Koha::Patron::Attribute::Types->search(    # FIXME we should not need this search
337
my $show_barcode = Koha::Patron::Attribute::Types->search(    # FIXME we should not need this search
338
        { code => ATTRIBUTE_SHOW_BARCODE }
338
    { code => ATTRIBUTE_SHOW_BARCODE }
339
    )->count;
339
)->count;
340
    if ($show_barcode) {
340
if ($show_barcode) {
341
        my $patron_show_barcode = $patron->get_extended_attribute(ATTRIBUTE_SHOW_BARCODE);
341
    my $patron_show_barcode = $patron->get_extended_attribute(ATTRIBUTE_SHOW_BARCODE);
342
        undef $show_barcode if $patron_show_barcode and not $patron_show_barcode->attribute;
342
    undef $show_barcode if $patron_show_barcode and not $patron_show_barcode->attribute;
343
    }
343
}
344
    $template->param( show_barcode => 1 ) if $show_barcode;
344
$template->param( show_barcode => 1 ) if $show_barcode;
345
345
346
# now the reserved items....
346
# now the reserved items....
347
my $reserves = $patron->holds->filter_out_has_cancellation_requests;
347
    my $reserves = $patron->holds->filter_out_has_cancellation_requests;
348
349
$template->param(
350
    RESERVES       => $reserves,
351
    reserves_count => $reserves->count_holds,
352
    showpriority   => $show_priority,
353
);
354
348
355
if ( C4::Context->preference('UseRecalls') ) {
356
    my $recalls = Koha::Recalls->search( { patron_id => $borrowernumber, completed => 0 } );
357
    $template->param( RECALLS => $recalls );
358
}
359
360
if ( C4::Context->preference('BakerTaylorEnabled') ) {
361
    $template->param(
349
    $template->param(
362
        BakerTaylorEnabled      => 1,
350
        RESERVES       => $reserves,
363
        BakerTaylorImageURL     => &image_url(),
351
        reserves_count => $reserves->count_holds,
364
        BakerTaylorLinkURL      => &link_url(),
352
        showpriority   => $show_priority,
365
        BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
366
    );
353
    );
367
}
368
354
369
if (   C4::Context->preference("OPACAmazonCoverImages")
355
    if ( C4::Context->preference('UseRecalls') ) {
370
    or C4::Context->preference("GoogleJackets")
356
        my $recalls = Koha::Recalls->search( { patron_id => $borrowernumber, completed => 0 } );
371
    or C4::Context->preference("BakerTaylorEnabled")
357
        $template->param( RECALLS => $recalls );
372
    or C4::Context->preference("SyndeticsCoverImages")
358
    }
373
    or ( C4::Context->preference('OPACCustomCoverImages') and C4::Context->preference('CustomCoverImagesURL') ) )
374
{
375
    $template->param( JacketImages => 1 );
376
}
377
359
378
$template->param(
360
    if ( C4::Context->preference('BakerTaylorEnabled') ) {
379
    overdrive_error => scalar $query->param('overdrive_error') || undef,
361
        $template->param(
380
    overdrive_tab   => scalar $query->param('overdrive_tab')   || 0,
362
            BakerTaylorEnabled      => 1,
381
);
363
            BakerTaylorImageURL     => &image_url(),
364
            BakerTaylorLinkURL      => &link_url(),
365
            BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
366
        );
367
    }
382
368
383
my $patron_messages = Koha::Patron::Messages->search(
369
    if (   C4::Context->preference("OPACAmazonCoverImages")
370
        or C4::Context->preference("GoogleJackets")
371
        or C4::Context->preference("BakerTaylorEnabled")
372
        or C4::Context->preference("SyndeticsCoverImages")
373
        or ( C4::Context->preference('OPACCustomCoverImages') and C4::Context->preference('CustomCoverImagesURL') ) )
384
    {
374
    {
385
        borrowernumber => $borrowernumber,
375
        $template->param( JacketImages => 1 );
386
        message_type   => 'B',
387
    }
376
    }
388
);
389
377
390
if (   C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
378
    $template->param(
391
    || C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
379
        overdrive_error => scalar $query->param('overdrive_error') || undef,
392
{
380
        overdrive_tab   => scalar $query->param('overdrive_tab')   || 0,
393
    my @relatives;
381
    );
382
383
    my $patron_messages = Koha::Patron::Messages->search(
384
        {
385
            borrowernumber => $borrowernumber,
386
            message_type   => 'B',
387
        }
388
    );
394
389
395
    # Filter out guarantees that don't want guarantor to see checkouts
390
    if (   C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor')
396
    foreach my $gr ( $patron->guarantee_relationships->as_list ) {
391
        || C4::Context->preference('AllowStaffToSetCheckoutsVisibilityForGuarantor') )
397
        my $g = $gr->guarantee;
392
    {
398
        push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
393
        my @relatives;
394
395
        # Filter out guarantees that don't want guarantor to see checkouts
396
        foreach my $gr ( $patron->guarantee_relationships->as_list ) {
397
            my $g = $gr->guarantee;
398
            push( @relatives, $g ) if $g->privacy_guarantor_checkouts;
399
        }
400
        $template->param( relatives => \@relatives );
399
    }
401
    }
400
    $template->param( relatives => \@relatives );
401
}
402
402
403
if (   C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
403
    if (   C4::Context->preference('AllowPatronToSetFinesVisibilityForGuarantor')
404
    || C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor') )
404
        || C4::Context->preference('AllowStaffToSetFinesVisibilityForGuarantor') )
405
{
405
    {
406
    my @relatives_with_fines;
406
        my @relatives_with_fines;
407
407
408
    # Filter out guarantees that don't want guarantor to see checkouts
408
        # Filter out guarantees that don't want guarantor to see checkouts
409
    foreach my $gr ( $patron->guarantee_relationships->as_list ) {
409
        foreach my $gr ( $patron->guarantee_relationships->as_list ) {
410
        my $g = $gr->guarantee;
410
            my $g = $gr->guarantee;
411
        push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
411
            push( @relatives_with_fines, $g ) if $g->privacy_guarantor_fines;
412
        }
413
        $template->param( relatives_with_fines => \@relatives_with_fines );
412
    }
414
    }
413
    $template->param( relatives_with_fines => \@relatives_with_fines );
414
}
415
415
416
if ( C4::Context->preference("ArticleRequests") ) {
416
    if ( C4::Context->preference("ArticleRequests") ) {
417
    $template->param(
417
        $template->param(
418
        current_article_requests => [ $patron->article_requests->filter_by_current->as_list ],
418
            current_article_requests => [ $patron->article_requests->filter_by_current->as_list ],
419
    );
419
        );
420
}
420
    }
421
422
    my $self_renewal_available = $patron->is_eligible_for_self_renewal();
423
    my $self_renewal_alert;
424
    my $self_renewal_success = $query->param('self_renewal_success');
425
    $self_renewal_alert = $patron->category->self_renewal_failure_message
426
        if defined $self_renewal_success && !$self_renewal_success;
427
    my $self_renewal_confirmation_sent = $query->param('confirmation_sent');
421
428
422
$template->param(
429
    $template->param(
423
    patron_messages          => $patron_messages,
430
    patron_messages          => $patron_messages,
424
    opacnote                 => $borr->{opacnote},
431
    opacnote                 => $borr->{opacnote},
425
    patronupdate             => $patronupdate,
432
    patronupdate             => $patronupdate,
Lines 430-435 $template->param( Link Here
430
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
437
    AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
431
    OpacHoldNotes            => C4::Context->preference('OpacHoldNotes'),
438
    OpacHoldNotes            => C4::Context->preference('OpacHoldNotes'),
432
    failed_holds             => scalar $query->param('failed_holds'),
439
    failed_holds             => scalar $query->param('failed_holds'),
440
    self_renewal_available         => $self_renewal_available,
441
    self_renewal_success           => $self_renewal_success,
442
    self_renewal_alert             => $self_renewal_alert,
443
    self_renewal_confirmation_sent => $self_renewal_confirmation_sent,
433
);
444
);
434
445
435
# if not an empty string this indicates to return
446
# if not an empty string this indicates to return
436
- 

Return to bug 26355