MT 3044 : Fix CSV Export when there are blank chars in tag names
[koha.git] / reserve / placerequest.pl
index ba5ae75..6868ab2 100755 (executable)
@@ -22,7 +22,9 @@
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
 use C4::Biblio;
+use C4::Items;
 use CGI;
 use C4::Output;
 use C4::Reserves;
@@ -51,7 +53,7 @@ my $found;
 
 #if we have an item selectionned, and the pickup branch is the same as the holdingbranch of the document, we force the value $rank and $found .
 if ($checkitem ne ''){
-    $rank[0] = '0';
+    $rank[0] = '0' unless C4::Context->preference('ReservesNeedReturns');
     my $item = $checkitem;
     $item = GetItem($item);
     if ( $item->{'holdingbranch'} eq $branch ){
@@ -75,13 +77,13 @@ if ($type eq 'str8' && $borrowernumber ne ''){
        my $const;
        if ($input->param('request') eq 'any'){
             # place a request on 1st available
-            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title,$checkitem,$found);
+            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title,$checkitem,$found, "intranet");
        } elsif ($reqbib[0] ne ''){
             # FIXME : elsif probably never reached, (see top of the script)
             # place a request on a given item
-            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$notes,$title,$checkitem, $found);
+            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'o',\@reqbib,$rank[0],$notes,$title,$checkitem, $found, "intranet");
        } else {
-            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title,$checkitem, $found);
+            AddReserve($branch,$borrowernumber->{'borrowernumber'},$biblionumber,'a',\@realbi,$rank[0],$notes,$title,$checkitem, $found, "intranet");
        }
        
 print $input->redirect("request.pl?biblionumber=$biblionumber");