bumped up MARC Perl module requirements
[koha_fer] / reserve / request.pl
index afed443..e7cbad5 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/perl
 
-# $Id$
 
 #writen 2/1/00 by chris@katipo.oc.nz
 # Copyright 2000-2002 Katipo Communications
@@ -104,8 +103,7 @@ if ($cardnumber) {
     }
 
     # we check the date expiricy of the borrower (only if there is an expiry date, otherwise, set to 1 (warn)
-    warn "BOR : ".$borrowerinfo->{'dateexpiry'};
-    if ($borrowerinfo->{'dateexpiry'}) {
+    if ($borrowerinfo->{'dateexpiry'} ne '0000-00-00') {
         my $warning = (Date_to_Days(split /-/,$date) > Date_to_Days( split /-/,$borrowerinfo->{'dateexpiry'}));
         if ( $warning > 0 ) {
             $expiry = 1;
@@ -127,6 +125,9 @@ if ($cardnumber) {
                 borrowerstreetaddress => $borrowerinfo->{'address'},
                 borrowercity => $borrowerinfo->{'city'},
                 borrowerphone => $borrowerinfo->{'phone'},
+                               borrowermobile => $borrowerinfo->{'mobile'},
+                               borrowerfax => $borrowerinfo->{'fax'},
+                               borrowerphonepro => $borrowerinfo->{'phonepro'},
                 borroweremail => $borrowerinfo->{'email'},
                 borroweremailpro => $borrowerinfo->{'emailpro'},
                 borrowercategory => $borrowerinfo->{'category'},
@@ -221,7 +222,7 @@ foreach my $itemnumber (@itemnumbers) {
     push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber );
 }
 
-@branchcodes = uniq @branchcodes;
+@branchcodes = uniq @branchcodes;
 
 my @biblioitemnumbers = keys %itemnumbers_of_biblioitem;
 
@@ -316,13 +317,25 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
 
         # If there is no loan, return and transfer, we show a checkbox.
         $item->{notforloan} = $item->{notforloan} || 0;
-
+       
+       # if independent branches is on we need to check if the person can reserve
+       # for branches they arent logged in to
+       if ( C4::Context->preference("IndependantBranches") ) { 
+           if (! C4::Context->preference("canreservefromotherbranches")){
+               # cant reserve items so need to check if item homebranch and userenv branch match if not we cant reserve
+               my $userenv = C4::Context->userenv; 
+               if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
+                   $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
+               } 
+           }
+       }
         # An item is available only if:
         if (
             not defined $reservedate    # not reserved yet
             and $issues->{'date_due'} eq ''         # not currently on loan
             and not $item->{itemlost}   # not lost
             and not $item->{notforloan} # not forbidden to loan
+           and not $item->{cantreserve}
             and $transfertwhen eq ''    # not currently on transfert
           )
         {