Bug 16082: Display a friendly "patron does not exist" message if that's the case...
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 16 Mar 2016 10:01:18 +0000 (10:01 +0000)
committerJulian Maurice <julian.maurice@biblibre.com>
Fri, 1 Apr 2016 13:12:27 +0000 (15:12 +0200)
The major part of pages you can access from a patron detail page (menu)
does not take into consideration the 'patron does not exist' case.
If the borrowernumber is linked to a deleted patron, a friendly message
should be displayed instead of an empty patron detail page.

Test plan:
Go on circ/circulation.pl?borrowernumber=424242
and   circ/circulation.pl?borrowernumber=424242&batch=1
Notice the difference before and after this patch

Signed-off-by: Marc VĂ©ron <veron@veron.ch>

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

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit 7aedcf643e6f7793b4ebf55b1c7cdec7ec04a25d)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

circ/circulation.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt

index e9c2417..e4c5424 100755 (executable)
@@ -529,7 +529,7 @@ foreach my $flag ( sort keys %$flags ) {
     }
 }
 
-my $amountold = $borrower->{flags}->{'CHARGES'}->{'message'} || 0;
+my $amountold = $borrower->{flags} ? $borrower->{flags}->{'CHARGES'}->{'message'} || 0 : 0;
 $amountold =~ s/^.*\$//;    # remove upto the $, if any
 
 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
index 604db1c..192be01 100644 (file)
@@ -10,7 +10,7 @@
 [% INCLUDE 'doc-head-open.inc' %]
 [% SET destination = "circ" %]
 <title>Koha &rsaquo; Circulation
-[% IF borrowernumber %]
+[% IF borrowernumber and borrower%]
   &rsaquo; Checking out to [% INCLUDE 'patron-title.inc' invert_name = 1 %]
 [% END %]
 </title>
@@ -50,7 +50,7 @@ var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export");
 
 columns_settings = [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) %]
 
-[% IF ( borrowernumber ) %]
+[% IF borrowernumber and borrower %]
     if($.cookie("holdfor") != [% borrowernumber %]){
         $.removeCookie("holdfor", { path: '/' });
     }
@@ -129,7 +129,7 @@ $(document).ready(function() {
 [% INCLUDE 'circ-search.inc' %]
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
-[% IF ( borrowernumber ) %]
+[% IF borrowernumber and borrower %]
     <a href="/cgi-bin/koha/circ/circulation.pl">Checkouts</a> &rsaquo; [% INCLUDE 'patron-title.inc' %]
 [% ELSE %]
     <strong>Checkouts</strong>
@@ -149,7 +149,7 @@ $(document).ready(function() {
        <div class="yui-b">
 [% END %]
 
-[% IF ( borrowernumber ) %]
+[% IF borrowernumber and borrower %]
 [% INCLUDE 'members-toolbar.inc' %]
 [% END %]
 
@@ -594,7 +594,7 @@ No patron matched <span class="ex">[% message %]</span>
 
 <!-- BARCODE ENTRY -->
 
-[% IF ( borrowernumber ) %]
+[% IF borrowernumber and borrower %]
 <div class="yui-g">
 
 [% IF privacy == 2 AND NOT Koha.Preference('AnonymousPatron') %]
@@ -976,13 +976,15 @@ No patron matched <span class="ex">[% message %]</span>
 [% END %]
 </div> <!-- reservesloop -->
 
-[% END %] <!-- borrowernumber -->
+[% ELSE %]
+    <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
+[% END %] <!-- borrowernumber and borrower-->
 </div></div>
 [% END %]
 
 </div>
 </div>
-[% UNLESS ( borrowers ) %][% IF ( borrowernumber ) %]<div class="yui-b">
+[% UNLESS ( borrowers ) %][% IF borrowernumber and borrower %]<div class="yui-b">
 [% INCLUDE 'circ-menu.inc' %]
 </div>[% END %][% END %]
 </div>
index 8118251..eadeb1d 100644 (file)
@@ -7,7 +7,7 @@
 [% INCLUDE 'doc-head-open.inc' %]
 [% SET destination = "circ" %]
 <title>Koha &rsaquo; Circulation
-[% IF borrowernumber %]
+[% IF borrowernumber and borrower %]
   &rsaquo; Batch check out &rsaquo; Issuing items to [% INCLUDE 'patron-title.inc' invert_name = 1 %]
 [% END %]
 </title>
@@ -42,7 +42,11 @@ $(document).ready(function() {
 [% INCLUDE 'circ-search.inc' %]
 
 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/circ/circulation-home.pl">Circulation</a> &rsaquo;
-    <a href="/cgi-bin/koha/circ/circulation.pl">Batch check out</a> &rsaquo; [% INCLUDE 'patron-title.inc' %]
+    [% IF borrower and borrowernumber %]
+        <a href="/cgi-bin/koha/circ/circulation.pl">Batch check out</a> &rsaquo; [% INCLUDE 'patron-title.inc' %]
+    [% ELSE %]
+        Batch check out
+    [% END %]
 </div>
 <div id="doc3" class="yui-t2">
 
@@ -52,20 +56,20 @@ $(document).ready(function() {
 
 <div class="yui-g">
 
-[% IF ( borrowernumber ) %]
+[% IF borrowernumber and borrower %]
 [% INCLUDE 'members-toolbar.inc' %]
 [% END %]
 
-[% IF NOT batch_allowed %]
+[% IF borrower and not batch_allowed %]
   <div class="dialog alert">You are not allowed to use batch checkout for this patron</div>
-[% ELSIF noissues and not checkout_infos %]
+[% ELSIF borrower and noissues and not checkout_infos %]
   <div class="dialog alert">
     Cannot check out!
     [% IF charges_is_blocker %]
       Checkouts are <span class="circ-hlt">BLOCKED</span> because fine balance is <span class="circ-hlt">OVER THE LIMIT</span>.
     [% END %]
   </div>
-[% ELSIF NOT checkout_infos %]
+[% ELSIF borrower and not checkout_infos %]
   <form method="post" enctype="multipart/form-data" action="/cgi-bin/koha/circ/circulation.pl">
     <fieldset id="circ_circulation_issue">
       <label for="barcode">Checking out to [% INCLUDE 'patron-title.inc' %]</label>
@@ -94,7 +98,7 @@ $(document).ready(function() {
     </fieldset>
   </form>
 
-[% ELSE %]
+[% ELSIF borrower %]
   [% IF confirmation_needed && CAN_user_circulate_force_checkout %]
     <h3>Batch checkout confirmation [% IF borrowernumber %] for [% INCLUDE 'patron-title.inc' invert_name = 1 %] [% END %]</h3>
     <form method="post" action="/cgi-bin/koha/circ/circulation.pl" id="mainform" name="mainform" autocomplete="off">
@@ -276,13 +280,17 @@ $(document).ready(function() {
     </form>
     [% END %]
 
+[% ELSE %]
+    <div class="dialog message">This patron does not exist. <a href="/cgi-bin/koha/members/members-home.pl">Find another patron?</a></div>
 [% END %]
 
 </div>
 </div>
 </div>
-<div class="yui-b">
-[% INCLUDE 'circ-menu.inc' %]
-</div>
+[% IF borrower %]
+    <div class="yui-b">
+        [% INCLUDE 'circ-menu.inc' %]
+    </div>
+[% END %]
 </div>
 [% INCLUDE 'intranet-bottom.inc' %]