From 358ec9c6c339006561447d917dcbb8d654225a57 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 27 Dec 2007 17:13:03 -0600 Subject: [PATCH] Fix for 1582, if independent branches is on, you cant return to Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 8 +++++++- circ/returns.pl | 8 ++++++++ koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index eebbe41334..2c8fbf3467 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1155,7 +1155,13 @@ sub AddReturn { if ( $hbr && $branches->{$hbr}->{'PE'} ) { $messages->{'IsPermanent'} = $hbr; } - + + # if independent branches are on and returning to different branch, refuse the return + if ($hbr ne C4::Context->userenv->{'branch'} && C4::Context->preference("IndependantBranches")){ + $messages->{'Wrongbranch'} = 1; + $doreturn=0; + } + # check that the book has been cancelled if ( $iteminformation->{'wthdrawn'} ) { $messages->{'wthdrawn'} = 1; diff --git a/circ/returns.pl b/circ/returns.pl index b728496ac0..0d78a77654 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -246,6 +246,12 @@ if ( $messages->{'NeedsTransfer'} ){ ); } +if ( $messages->{'Wrongbranch'} ){ + $template->param( + wrongbranch => 1, + ); +} + # adding a case of wrong transfert, if the document wasn't transfered in the good library (according to branchtransfer (tobranch) BDD) if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) { @@ -405,6 +411,8 @@ foreach my $code ( keys %$messages ) { } elsif ( $code eq 'NeedsTransfer' ) { } + elsif ( $code eq 'Wrongbranch' ) { + } else { die "Unknown error code $code"; # XXX diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl index 33d48279b0..c892d17965 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl @@ -15,6 +15,11 @@
+ +

Independent Branches is on, and you +are trying to return this item to a branch other than its homebranch, NOT RETURNED +

+

Please return "> to

Hold for:
-- 2.39.5