Bug 22134: (follow-up) Simplify check for expired patron
authorOwen Leonard <oleonard@myacpl.org>
Fri, 18 Jan 2019 13:05:55 +0000 (13:05 +0000)
committerNick Clemens <nick@bywatersolutions.com>
Mon, 28 Jan 2019 14:51:41 +0000 (14:51 +0000)
This patch move the check for "is_expired" to the template and removes
unnecessary code from the script.

The page now correctly handles messages for patrons who are about to
expire, as defined in the NotifyBorrowerDeparture preference.

To test, apply the patch and locate a patron record which is expired.

 - On the patron detail page (members/moremember.pl) you should see a
   message at the top of the page.
 - In the body of the page, next to the expiration date information, you
   should see similar message and links.

Select a patron who will expire within the period defined in
NotifyBorrowerDeparture.

 - On the patron detail page you should see a message at the top of the page.
 - In the body of the page, next to the expiration date information, you
   should see similar message and links.

Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
members/moremember.pl

index 5430b74..1dda5d0 100644 (file)
                                     [% IF ( lost ) %]
                                         <li class="blocker">Patron's card has been reported lost.</li>
                                     [% END %]
-                                    [% IF ( expired ) %]
+                                    [% IF ( patron.is_expired ) %]
                                         <li class="blocker">
                                             <span class="circ-hlt">Expiration:</span>
                                             [% IF ( patron.dateexpiry ) %]
                                             [% ELSE %]
                                                 Patron's card has expired.
                                             [% END %]
-                                            <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;destination=circ&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% patron.borrowernumber | html %]&amp;categorycode=[% categorycode | html %]">Edit details</a>
+                                            <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=[% patron.borrowernumber | html %]&amp;categorycode=[% categorycode | html %]">Edit details</a>
+                                        </li>
+                                    [% ELSIF ( patron.is_going_to_expire ) %]
+                                        <li>
+                                            <span class="circ-hlt">Expiration:</span> Patron's card will expire soon.
+                                            Patron's card expires on [% expiry | $KohaDates %]
+                                            <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;borrowernumber=[% patron.borrowernumber | html %]&amp;categorycode=[% categorycode | html %]">Edit details</a>
                                         </li>
                                     [% END %]
                                 </ul>
                                             <span class="label">Expiration date: </span>
                                             [% IF ( was_renewed ) %]
                                                 <strong class="reregistrinfo">[% patron.dateexpiry | $KohaDates %]</strong>
-                                            [% ELSIF ( expired ) %]
+                                            [% ELSIF ( patron.is_expired ) %]
                                                 <span class="blocker">
                                                     [% patron.dateexpiry | $KohaDates %]
                                                     <strong><em>Expired</em></strong>
                                                     <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify]&amp;borrowernumber=[% patron.borrowernumber | html %]&amp;categorycode=[% categorycode | html %]">Edit details</a>
                                                 </span>
+                                            [% ELSIF ( patron.is_going_to_expire ) %]
+                                                [% patron.dateexpiry | $KohaDates %]
+                                                <strong><em>Patron expires soon</em></strong>
+                                                <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&amp;reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify]&amp;borrowernumber=[% patron.borrowernumber | html %]&amp;categorycode=[% categorycode | html %]">Edit details</a>
                                             [% ELSE %]
                                                 [% patron.dateexpiry | $KohaDates %]
                                             [% END %]
index e76dcd0..faaa95e 100755 (executable)
@@ -309,17 +309,8 @@ my ( $subtag, $region ) = split '-', $patron->lang;
 my $translated_language = C4::Languages::language_get_description( $subtag, $subtag, 'language' );
 
 # if the expiry date is before today ie they have expired
-if ( $patron->is_expired ) {
+if ( $patron->is_expired || $patron->is_going_to_expire ) {
     $template->param(
-        expired => "1",
-        flagged => 1
-    );
-}
-# check for NotifyBorrowerDeparture
-elsif ( $patron->is_going_to_expire ) {
-    # borrower card soon to expire warn librarian
-    $template->param(
-        "warndeparture" => $patron->dateexpiry,
         flagged => 1
     );
 }