Fix for 1582, if independent branches is on, you cant return to
authorChris Cormack <crc@liblime.com>
Thu, 27 Dec 2007 23:13:03 +0000 (17:13 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Thu, 27 Dec 2007 23:24:37 +0000 (17:24 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Circulation.pm
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tmpl

index eebbe41..2c8fbf3 100644 (file)
@@ -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;
index b728496..0d78a77 100755 (executable)
@@ -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
index 33d4827..c892d17 100644 (file)
        <div id="yui-main">
 
 <div class="yui-g">
+<!-- TMPL_IF NAME="wrongbranch" -->
+<div class="message"><h3 class="problem">Independent Branches is on, and you
+are trying to return this item to a branch other than its homebranch, NOT RETURNED
+</h3></div>
+<!-- /TMPL_IF -->
 <!-- case of a mistake in transfer loop -->
 <!-- TMPL_IF Name="WrongTransfer" --><div class="message"><!-- WrongTransfer --><h3 class="problem">Please return <a href="/cgi-bin/koha/catalogue/detail.pl?type=intra&amp;biblionumber=<!-- TMPL_VAR NAME="itembiblionumber" -->"><!-- TMPL_VAR Name="title" --></a> to <!-- TMPL_VAR Name="TransferWaitingAt" --></h3>
 <!-- TMPL_IF Name="wborcnum"--><h5>Hold for:</h5>