Bugzilla – Attachment 56999 Details for
Bug 17522
opac-user.pl gives error of OpacRenewalAllowed is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17522 - opac-user.pl gives error of OpacRenewalAllowed is enabled
Bug-17522---opac-userpl-gives-error-of-OpacRenewal.patch (text/plain), 6.87 KB, created by
Kyle M Hall (khall)
on 2016-10-31 14:07:36 UTC
(
hide
)
Description:
Bug 17522 - opac-user.pl gives error of OpacRenewalAllowed is enabled
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-10-31 14:07:36 UTC
Size:
6.87 KB
patch
obsolete
>From 91a55a7b59744af4098d2b3b749567f9ef7b4ce3 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 31 Oct 2016 14:04:01 +0000 >Subject: [PATCH] Bug 17522 - opac-user.pl gives error of OpacRenewalAllowed is > enabled > >If OpacRenewalAllowed is enabled, the following error message is >displayed: > >Template process failed: undef error - The method is_expired is not >covered by tests! at /home/vagrant/kohaclone/C4/Templates.pm line 121. > >Test Plan: >1) Check out an item for a patron >2) Enable OpacRenewalAllowed >3) Log in as that patron, go to opac-user.pl >4) Note the error >5) Apply this patch >6) Reload opac-user.pl >7) Page should now load! >--- > Koha/Patron.pm | 15 +++++++++++++++ > .../opac-tmpl/bootstrap/en/modules/opac-user.tt | 10 +++++----- > t/Patron.t | 22 +++++++++++++++++++++- > 3 files changed, 41 insertions(+), 6 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 9a2fd18..9787ffb 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -266,6 +266,21 @@ sub is_debarred { > return; > } > >+=head2 is_expired >+ >+my $is_expired = $patron->is_expired; >+ >+Returns true if the patron is passed the expiry date, false otherwise >+ >+=cut >+ >+sub is_expired { >+ my ($self) = @_; >+ >+ return 1 if $self->dateexpiry && dt_from_string( $self->dateexpiry ) < dt_from_string; >+ return 0; >+} >+ > =head2 update_password > > my $updated = $patron->update_password( $userid, $password ); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >index 438cb10..af533a4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt >@@ -156,7 +156,7 @@ Using this account is not recommended because some parts of Koha will not functi > <th>Barcode</th> > [% END %] > <th>Call no.</th> >- [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] >+ [% IF ( OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %] > <th class="nosort">Renew</th> > [% END %] > [% IF ( OPACFinesTab ) %] >@@ -245,7 +245,7 @@ Using this account is not recommended because some parts of Koha will not functi > <span class="tdlabel">Call no.:</span> > [% ISSUE.itemcallnumber %] > </td> >- [% IF ( OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] >+ [% IF ( OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %] > <td class="renew"> > [% IF ISSUE.renewed %]<span class="blabel label-success">Renewed!</span><br />[% END %] > [% IF ( ISSUE.status ) %] >@@ -285,12 +285,12 @@ Using this account is not recommended because some parts of Koha will not functi > [% END # /FOREACH ISSUES %] > </tbody> > </table> >- [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] >+ [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %] > <input type="submit" class="btn" value="Renew selected" /> > [% END %] > </form> > >- [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] >+ [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %] > <form id="renewall" action="/cgi-bin/koha/opac-renew.pl" method="post"> > <input type="hidden" name="from" value="opac_user" /> > <input type="hidden" name="borrowernumber" value="[% borrowernumber %]" /> >@@ -876,7 +876,7 @@ Using this account is not recommended because some parts of Koha will not functi > e.preventDefault(); > $("#renewall").submit(); > }); >- [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && borrower.BlockExpiredPatronOpacActions ) ) %] >+ [% IF ( canrenew && !userdebarred && OpacRenewalAllowed && !( borrower.is_expired && Koha.Preference('BlockExpiredPatronOpacActions') ) ) %] > $("#checkoutst caption").append("<div id=\"renewcontrols\"><a id=\"renewselected_link\" href=\"#\">"+_("Renew selected")+"</a> <a id=\"renewall_link\" href=\"#\">"+_("Renew all")+"</a></div>"); > [% END %] > [% END %] >diff --git a/t/Patron.t b/t/Patron.t >index c32de10..14a5b81 100755 >--- a/t/Patron.t >+++ b/t/Patron.t >@@ -17,14 +17,16 @@ > > use Modern::Perl; > >-use Test::More tests => 11; >+use Test::More tests => 13; > use Test::Warn; > use t::lib::Mocks; >+use t::lib::Mocks qw(mock_preference); > > BEGIN { > t::lib::Mocks::mock_dbh; > use_ok('Koha::Object'); > use_ok('Koha::Patron'); >+ use_ok('Koha::DateUtils'); > } > > my $object = Koha::Patron->new( { surname => 'Test Patron' } ); >@@ -324,4 +326,22 @@ subtest 'Set tests' => sub { > is( $patron->privacy, '667789', 'privacy field set ok' ); > }; > >+subtest 'is_expiry tests' => sub { >+ plan tests => 4; >+ >+ t::lib::Mocks::mock_preference( "dateformat", "iso" ); >+ >+ $patron->dateexpiry(undef); >+ ok( !$patron->is_expired, "Patron is not expired if expiry date is not set" ); >+ >+ $patron->dateexpiry("1900-01-01"); >+ ok( $patron->is_expired, "Patron is expired with expiry date 1900-01-01" ); >+ >+ $patron->dateexpiry("9999-01-01"); >+ ok( !$patron->is_expired, "Patron is not expired with expiry date 9999-01-01" ); >+ >+ $patron->dateexpiry( dt_from_string->ymd ); >+ ok( $patron->is_expired, "Patron is not expired if the expiration date is today's date" ); >+}; >+ > 1; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17522
:
56999
|
57047
|
57048
|
57102
|
57414
|
57415
|
57478
|
57505