Bugzilla – Attachment 51707 Details for
Bug 16534
Error when checking out already checked out item (depending on AllowReturnToBranch)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16534: Make CanBookBeIssued test if the issue can be returned
Bug-16534-Make-CanBookBeIssued-test-if-the-issue-c.patch (text/plain), 4.14 KB, created by
Marc Véron
on 2016-05-23 05:39:58 UTC
(
hide
)
Description:
Bug 16534: Make CanBookBeIssued test if the issue can be returned
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-05-23 05:39:58 UTC
Size:
4.14 KB
patch
obsolete
>From 16b2328381f37d6d6f4e7972869a25ef3a7eae1f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 22 May 2016 10:01:48 +0100 >Subject: [PATCH] Bug 16534: Make CanBookBeIssued test if the issue can be > returned >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >If an issue is already checked out, CanBookBeIssued must check if the >issue can be checked in before processing the return. >In such cases (depending of the AllowReturnToBranch pref), the issue >should not be allowed. > >Prior to this patch, the checkin was not done and the checkout failed >with "Duplicate entry '1204321' for key 'itemnumber'". Indeed since bug >14978, there is an uniq key on issues.itemnumber. Before bug 14978 the >issue existed but was hidden (and some weird behaviors certainly >happened!). > >To avoid Koha to crash, a check is added to CanBookBeIssued (call to >CanBookBeReturned) and the librarian is not able to process the >checkout. > >Test plan: > >- Set AllowReturnToBranch to anywhere >- Check an item (homebranch Library 1, holding branch Library 1) out from Library 1 >- Check the item out from Library 2 >=> Confirm the checkout (should work with and without this patch) > >- Set AllowReturnToBranch to holdinbranch ("only the library the item > was checked out from"). >- Check an item (homebranch Library 1, holding branch Library 1) out from Library 1 >- Check the item out from Library 2 >=> Without this patch, Koha crashed >=> With this patch, you will be warned that the checkin is not possible. > >Try other combinations of the AllowReturnToBranch syspref > >Followed test plan, works as expected >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Circulation.pm | 19 +++++++++++++------ > .../prog/en/modules/circ/circulation.tt | 4 ++++ > 2 files changed, 17 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 913ec0b..d6e3ca0 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1046,12 +1046,19 @@ sub CanBookBeIssued { > # issued to someone else > my $currborinfo = C4::Members::GetMember( borrowernumber => $issue->{borrowernumber} ); > >-# warn "=>.$currborinfo->{'firstname'} $currborinfo->{'surname'} ($currborinfo->{'cardnumber'})"; >- $needsconfirmation{ISSUED_TO_ANOTHER} = 1; >- $needsconfirmation{issued_firstname} = $currborinfo->{'firstname'}; >- $needsconfirmation{issued_surname} = $currborinfo->{'surname'}; >- $needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'}; >- $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; >+ >+ my ( $can_be_returned, $message ) = CanBookBeReturned( $item, C4::Context->userenv->{branch} ); >+ >+ unless ( $can_be_returned ) { >+ $issuingimpossible{RETURN_IMPOSSIBLE} = 1; >+ $issuingimpossible{branch_to_return} = $message; >+ } else { >+ $needsconfirmation{ISSUED_TO_ANOTHER} = 1; >+ $needsconfirmation{issued_firstname} = $currborinfo->{'firstname'}; >+ $needsconfirmation{issued_surname} = $currborinfo->{'surname'}; >+ $needsconfirmation{issued_cardnumber} = $currborinfo->{'cardnumber'}; >+ $needsconfirmation{issued_borrowernumber} = $currborinfo->{'borrowernumber'}; >+ } > } > > unless ( $ignore_reserves ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index cd3fc35..90c2d42 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -554,6 +554,10 @@ $(document).ready(function() { > <li>This item belongs to [% Branches.GetName( itemhomebranch ) %] and cannot be checked out from this location.</li> > [% END %] > >+ [% IF RETURN_IMPOSSIBLE %] >+ <li>This item must be return to [% Branches.GetName( branch_to_return ) %].</li> >+ [% END %] >+ > [% IF ( USERBLOCKEDWITHENDDATE ) %] > <li>Patron has a restriction until [% USERBLOCKEDWITHENDDATE | $KohaDates %].</li> > [% END %] >-- >1.7.10.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 16534
:
51687
|
51697
|
51698
|
51699
|
51700
|
51706
|
51707
|
51708
|
51709
|
51710
|
52487
|
52488
|
52489
|
52490
|
52491
|
52492
|
52493