Bug 16082: Display a friendly "patron does not exist" message if that's the case - circulation.pl

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
This commit is contained in:
Jonathan Druart 2016-03-16 10:01:18 +00:00 committed by Brendan Gallagher
parent 4a3404594f
commit 7aedcf643e
3 changed files with 28 additions and 18 deletions

View File

@ -537,7 +537,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 );

View 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 %]
@ -599,7 +599,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') %]
@ -977,13 +977,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>

View 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' %]