From 25191a43a540b8fc84816d3f95b3e29f88424bd4 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 13 Aug 2013 12:27:28 -0400 Subject: [PATCH] Bug 10081: add library name to IndependentBranches error message With IndependentBranches turned on, if you try to check out an item which belongs to another library you will get an error message which is missing the library name. This patch corrects the problem by passing the necessary variable to the template and outputting the library name using the KohaBranchName TT plugin. To test, turn on IndependentBranches and try to check out an item belonging to another library (note that you must test with a staff user who is not a superlibrarian). The error message you see should include the name of the library to which the item belongs: "This item belongs to Nelsonville and cannot be checked out from this location." Checkouts of items belonging to the library should be unaffected. Signed-off-by: Galen Charlton Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton (cherry picked from commit 50ff4f4a94598ce197c0ca5656d314195cf69d07) Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 624af4b7f11a4ff8bccf3252e72880cec9c22b1b) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit 624af4b7f11a4ff8bccf3252e72880cec9c22b1b) --- C4/Circulation.pm | 6 ++++-- koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2aac23c9ec..5b1c18615e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -886,8 +886,10 @@ sub CanBookBeIssued { if ( C4::Context->preference("IndependantBranches") ) { my $userenv = C4::Context->userenv; if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) { - $issuingimpossible{ITEMNOTSAMEBRANCH} = 1 - if ( $item->{C4::Context->preference("HomeOrHoldingBranch")} ne $userenv->{branch} ); + if ( $item->{C4::Context->preference("HomeOrHoldingBranch")} ne $userenv->{branch} ){ + $issuingimpossible{ITEMNOTSAMEBRANCH} = 1; + $issuingimpossible{'itemhomebranch'} = $item->{C4::Context->preference("HomeOrHoldingBranch")}; + } $needsconfirmation{BORRNOTSAMEBRANCH} = GetBranchName( $borrower->{'branchcode'} ) if ( $borrower->{'branchcode'} ne $userenv->{branch} ); } 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 3b3bbb0de1..a4fd3869b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1,3 +1,4 @@ +[% USE KohaBranchName %] [% USE KohaDates %] [% USE KohaAuthorisedValues %] [% INCLUDE 'doc-head-open.inc' %] @@ -514,7 +515,7 @@ function validate1(date) { [% END %] [% IF ( ITEMNOTSAMEBRANCH ) %] -
  • This item belongs to [% itemhomebranch %] and cannot be issued from this location.
  • +
  • This item belongs to [% itemhomebranch | $KohaBranchName %] and cannot be checked out from this location.
  • [% END %] [% IF ( USERBLOCKEDREMAINING ) %] -- 2.39.5