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

(-)a/Koha/Patron.pm (+15 lines)
Lines 266-271 sub is_debarred { Link Here
266
    return;
266
    return;
267
}
267
}
268
268
269
=head2 is_expired
270
271
my $is_expired = $patron->is_expired;
272
273
Returns true if the patron is passed the expiry date, false otherwise
274
275
=cut
276
277
sub is_expired {
278
    my ($self) = @_;
279
280
    return 1 if $self->dateexpiry && dt_from_string( $self->dateexpiry ) < dt_from_string;
281
    return 0;
282
}
283
269
=head2 update_password
284
=head2 update_password
270
285
271
my $updated = $patron->update_password( $userid, $password );
286
my $updated = $patron->update_password( $userid, $password );
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-5 / +5 lines)
Lines 156-162 Using this account is not recommended because some parts of Koha will not functi Link Here
156
                                                    <th>Barcode</th>
156
                                                    <th>Barcode</th>
157
                                                [% END %]
157
                                                [% END %]
158
                                                    <th>Call no.</th>
158
                                                    <th>Call no.</th>
159
                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
159
                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %]
160
                                                    <th class="nosort">Renew</th>
160
                                                    <th class="nosort">Renew</th>
161
                                                [% END %]
161
                                                [% END %]
162
                                                [% IF ( OPACFinesTab ) %]
162
                                                [% IF ( OPACFinesTab ) %]
Lines 245-251 Using this account is not recommended because some parts of Koha will not functi Link Here
245
                                                    <span class="tdlabel">Call no.:</span>
245
                                                    <span class="tdlabel">Call no.:</span>
246
                                                    [% ISSUE.itemcallnumber %]
246
                                                    [% ISSUE.itemcallnumber %]
247
                                                </td>
247
                                                </td>
248
                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
248
                                                [% IF ( OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %]
249
                                                    <td class="renew">
249
                                                    <td class="renew">
250
                                                    [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
250
                                                    [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %]
251
                                                    [% IF ( ISSUE.status ) %]
251
                                                    [% IF ( ISSUE.status ) %]
Lines 285-296 Using this account is not recommended because some parts of Koha will not functi Link Here
285
                                        [% END # /FOREACH ISSUES %]
285
                                        [% END # /FOREACH ISSUES %]
286
                                    </tbody>
286
                                    </tbody>
287
                                </table>
287
                                </table>
288
                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
288
                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %]
289
                                    <input type="submit" class="btn" value="Renew selected" />
289
                                    <input type="submit" class="btn" value="Renew selected" />
290
                                [% END %]
290
                                [% END %]
291
                                </form>
291
                                </form>
292
292
293
                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
293
                                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %]
294
                                <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
294
                                <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post">
295
                                    <input type="hidden" name="from" value="opac_user" />
295
                                    <input type="hidden" name="from" value="opac_user" />
296
                                    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
296
                                    <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" />
Lines 876-882 Using this account is not recommended because some parts of Koha will not functi Link Here
876
                    e.preventDefault();
876
                    e.preventDefault();
877
                    $("#renewall").submit();
877
                    $("#renewall").submit();
878
                });
878
                });
879
                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %]
879
                [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %]
880
                    $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");
880
                    $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>");
881
                [% END %]
881
                [% END %]
882
            [% END %]
882
            [% END %]
(-)a/t/Patron.t (-2 / +21 lines)
Lines 17-30 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 11;
20
use Test::More tests => 13;
21
use Test::Warn;
21
use Test::Warn;
22
use t::lib::Mocks;
22
use t::lib::Mocks;
23
use t::lib::Mocks qw(mock_preference);
23
24
24
BEGIN {
25
BEGIN {
25
    t::lib::Mocks::mock_dbh;
26
    t::lib::Mocks::mock_dbh;
26
    use_ok('Koha::Object');
27
    use_ok('Koha::Object');
27
    use_ok('Koha::Patron');
28
    use_ok('Koha::Patron');
29
    use_ok('Koha::DateUtils');
28
}
30
}
29
31
30
my $object = Koha::Patron->new( { surname => 'Test Patron' } );
32
my $object = Koha::Patron->new( { surname => 'Test Patron' } );
Lines 324-327 subtest 'Set tests' => sub { Link Here
324
    is( $patron->privacy,             '667789',                           'privacy field set ok' );
326
    is( $patron->privacy,             '667789',                           'privacy field set ok' );
325
};
327
};
326
328
329
subtest 'is_expiry tests' => sub {
330
    plan tests => 4;
331
332
    t::lib::Mocks::mock_preference( "dateformat", "iso" );
333
334
    $patron->dateexpiry(undef);
335
    ok( !$patron->is_expired, "Patron is not expired if expiry date is not set" );
336
337
    $patron->dateexpiry("1900-01-01");
338
    ok( $patron->is_expired, "Patron is expired with expiry date 1900-01-01" );
339
340
    $patron->dateexpiry("9999-01-01");
341
    ok( !$patron->is_expired, "Patron is not expired with expiry date 9999-01-01" );
342
343
    $patron->dateexpiry( dt_from_string->ymd );
344
    ok( $patron->is_expired, "Patron is not expired if the expiration date is today's date" );
345
};
346
327
1;
347
1;
328
- 

Return to bug 17522