Add a new system preference 'AutomaticItemReturn' :
authoralaurin <alaurin>
Thu, 8 Jun 2006 15:36:31 +0000 (15:36 +0000)
committeralaurin <alaurin>
Thu, 8 Jun 2006 15:36:31 +0000 (15:36 +0000)
if this prefence is switched on: the document returned in another library than homebranch, the system automaticly transfer the document to his homebranch (with notification for librarian in returns.tmpl) .

switch off : the document stay in the holdingbranch ...

correcting bugs :
- comment C4::acquisition (not using in request.pl).
- correcting date in request.pl
-add the new call of function getbranches in request.pl

C4/Circulation/Circ2.pm
circ/returns.pl
koha-tmpl/intranet-tmpl/prog/en/circ/returns.tmpl
reserve/request.pl
updater/updatedatabase

index 72eb115..b9e131d 100755 (executable)
@@ -511,8 +511,8 @@ sub transferbook {
 #              $messages->{'ResFound'} = $resrec;
                $dotransfer = 1;
        }
-
-       if ($dotransfer and not $resfound) {
+       
+       if ($dotransfer) {
                dotransfer($iteminformation->{'itemnumber'}, $fbr, $tbr);
                $messages->{'WasTransfered'} = 1;
        }
@@ -534,7 +534,7 @@ sub dotransfer {
        #update holdingbranch in items .....
        $dbh->do("UPDATE items set holdingbranch = $tbr WHERE items.itemnumber = $itm");
        &itemseen($itm);
-       &domarctransfer($dbh,$itm);
+       &domarctransfer($dbh,$itm);
        return;
 }
 
@@ -1197,13 +1197,12 @@ sub returnbook {
 #              now we check if there is a reservation with the validate of transfer if we have one, we can             set it with the status 'W'
                my $updateWaiting = SetWaitingStatus($iteminformation->{'itemnumber'});
        }
-#      if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly .
+#      if we don't have a transfer on run, we check if the document is not in his homebranch and there is not a reservation, we transfer this one to his home branch directly if system preference Automaticreturn is turn on .
        else {
-       #       new op dev
                my $checkreserves = CheckReserves($iteminformation->{'itemnumber'});
-               if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves)){
-                       my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'});
-                       $messages->{'WasTransfered'} = 1;
+               if (($iteminformation->{'homebranch'} ne $iteminformation->{'holdingbranch'}) and (not $checkreserves) and (C4::Context->preference("AutomaticItemReturn") == 1)){
+                               my $automatictransfer = dotransfer($iteminformation->{'itemnumber'},$iteminformation->{'holdingbranch'},$iteminformation->{'homebranch'});
+                               $messages->{'WasTransfered'} = 1;
                }
        }
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
index acea45f..d338619 100755 (executable)
@@ -57,7 +57,7 @@ my $headerbackgroundcolor = '#99cc33';
 my $linecolor1            = '#ffffcc';
 my $linecolor2            = 'white';
 
-my $branches = getbranches();
+my $branches = getbranches('IS');
 my $printers = getprinters( \%env );
 
 my $branch  = C4::Context->userenv->{'branch'};
index e488d6b..9edcd97 100644 (file)
                                <input type="hidden" name="bn-<!-- TMPL_VAR Name="counter" -->" value="<!-- TMPL_VAR Name="bornum" -->" />
                        <!-- /TMPL_LOOP -->
                        <input type="hidden" name="barcode" value="0" />
-                       </form>
+                       </form>                 
+               <!-- /TMPL_IF -->
                
-                       
+               <!-- TMPL_IF Name="transfer" -->
+                       <h2>This item must return to his homebranch :</h2>
+                       <p>The document <!-- TMPL_VAR NAME="itemtitle" --> (<!-- TMPL_VAR NAME="itemauthor" -->) Must be returned to his homebranch(<b><!-- TMPL_VAR NAME="itemhomebranch" --></b>)
+                               <form method="post" action="returns.pl">
+                                       <!-- TMPL_LOOP Name="inputloop" -->
+                                               <input type="hidden" name="ri-<!-- TMPL_VAR NAME="counter" -->" value="<!-- TMPL_VAR NAME="barcode" -->">
+                                               <input type="hidden" name="dd-<!-- TMPL_VAR NAME="counter" -->" value="<!-- TMPL_VAR NAME="duedate" -->">
+                                               <input type="hidden" name="bn-<!-- TMPL_VAR NAME="counter" -->" value="<!-- TMPL_VAR NAME="bornum" -->">
+                                       <!-- /TMPL_LOOP -->
+                                       <input type="hidden" name="barcode" value="0">
+                                       <input type="submit" value="OK">
+                               </form>
                <!-- /TMPL_IF -->
+               
                <!-- TMPL_IF Name="diffbranch" -->
                        <h3>Item Consigned:</h3>
        
index 95b012f..9b16450 100755 (executable)
@@ -29,6 +29,7 @@ use CGI;
 use Date::Manip;
 use List::MoreUtils qw/uniq/;
 use Data::Dumper;
+use Date::Calc qw/Today/;
 
 use C4::Search;
 use C4::Output;
@@ -38,7 +39,8 @@ use C4::Reserves2;
 use C4::Biblio;
 use C4::Koha;
 use C4::Circulation::Circ2;
-use C4::Acquisition;
+# FIXME Is there utility to use Acquisition.pm ???? 
+# use C4::Acquisition;
 use C4::Date;
 use C4::Members;
 
@@ -66,7 +68,8 @@ my %env;
 my $borrowerslist;
 my $messageborrower;
 
-my $date = today();
+# my $date = today();
+my $date= sprintf('%04d-%02d-%02d', Today());
 
 if ($findborrower) {
     my ($count,$borrowers) =  BornameSearch(\%env, $findborrower, 'cardnumber', 'web');
@@ -318,7 +321,7 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
 
 # existingreserves building
 my @reserveloop;
-my $branches = getbranches();
+my $branches = getbranches('RE');
 foreach my $res (sort {$a->{found} cmp $b->{found}} @$reserves){
     my %reserve;
     my @optionloop;
@@ -381,7 +384,6 @@ foreach my $branchcode (keys %{$branches}) {
     push @values, $branchcode;
     $label_of{$branchcode} = $branches->{$branchcode}->{branchname};
 }
-
 my $CGIbranch = CGI::scrolling_list(
     -name     => 'pickup',
     -values   => \@values,
index deb003c..133bc54 100755 (executable)
@@ -445,6 +445,15 @@ my %tabledata = (
             explanation         => 'Allow no debt alert if the patron is issuing item that accumulate debt',
             type                => 'YesNo',
         },
+       {
+            uniquefieldrequired => 'variable',
+            variable            => 'AutomaticItemReturn',
+            value               => '1',
+            forceupdate         => { 'explanation' => 1,
+                                     'type' => 1},
+            explanation         => 'This Variable allow or not to return automaticly to his homebranch',
+            type                => 'YesNo',
+        },
     ],
 
 );
@@ -1604,6 +1613,18 @@ sub MARCgetitem {
 exit;
 
 # $Log$
+# Revision 1.144  2006/06/08 15:36:31  alaurin
+# Add a new system preference 'AutomaticItemReturn' :
+#
+# if this prefence is switched on: the document returned in another library than homebranch, the system automaticly transfer the document to his homebranch (with notification for librarian in returns.tmpl) .
+#
+# switch off : the document stay in the holdingbranch ...
+#
+# correcting bugs :
+# - comment C4::acquisition (not using in request.pl).
+# - correcting date in request.pl
+# -add the new call of function getbranches in request.pl
+#
 # Revision 1.143  2006/06/07 02:02:47  bob_lyon
 # merging katipo changes...
 #