From 82e4cac404e7e80547723b9b98ff60de70f4846b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 26 Dec 2012 14:52:52 +0100 Subject: [PATCH] Bug 9206: Followup QA FIX - Fix indentation - It is useless to loop on all items. If at least 1 item is already issued, we want to return 1. --- C4/Circulation.pm | 15 +++++++-------- koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt | 12 ++++++------ reserve/request.pl | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 55b89f9..71fe20f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -83,7 +83,7 @@ BEGIN { &GetBiblioIssues &GetOpenIssue &AnonymiseIssueHistory - &CheckIfIssuedToPatron + &CheckIfIssuedToPatron ); # subs to deal with returns @@ -3455,16 +3455,15 @@ sub TransferSlip { =cut sub CheckIfIssuedToPatron { - my ($borrowernumber, $biblionumber) = @_; - my $isissued = 0; + my ($borrowernumber, $biblionumber) = @_; - my $items = GetItemsByBiblioitemnumber($biblionumber); + my $items = GetItemsByBiblioitemnumber($biblionumber); - foreach my $item (@{$items}) { - $isissued = 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber); - } + foreach my $item (@{$items}) { + return 1 if ($item->{borrowernumber} && $item->{borrowernumber} eq $borrowernumber); + } - return $isissued; + return; } diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt index 1c5205d..53ccbbf 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-reserve.tt @@ -293,12 +293,12 @@ [% UNLESS ( bibitemloo.bib_available ) %]
No available items.
[% ELSE %] - [% IF ( bibitemloo.already_patron_possession ) %] -
This title cannot be requested because it's already in your possession.
- [% ELSE %] -
This title cannot be requested.
- [% END %] - [% END %] + [% IF ( bibitemloo.already_patron_possession ) %] +
This title cannot be requested because it's already in your possession.
+ [% ELSE %] +
This title cannot be requested.
+ [% END %] + [% END %] [% END %] diff --git a/reserve/request.pl b/reserve/request.pl index 4d1c52e..f12e0ac 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -247,7 +247,7 @@ foreach my $biblionumber (@biblionumbers) { $warnings = 1; $maxreserves = 1; } - + my $alreadypossession; if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { $warnings = 1; -- 1.7.10.4