Bug 14711: Change prototype for AddReserve - pass a hashref
[koha-equinox.git] / reserve / placerequest.pl
index 89c591d..264ba96 100755 (executable)
@@ -100,24 +100,62 @@ if ( $type eq 'str8' && $borrower ) {
             my $can_item_be_reserved = CanItemBeReserved($borrower->{'borrowernumber'}, $item->itemnumber, $branch)->{status};
 
             if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) {
-                AddReserve( $branch, $borrower->{'borrowernumber'},
-                    $biblionumber, \@realbi, $rank[0], $startdate, $expirationdate, $notes, $title,
-                    $checkitem, $found, $itemtype );
+                AddReserve(
+                    {
+                        branchcode       => $branch,
+                        borrowernumber   => $borrower->{'borrowernumber'},
+                        biblionumber     => $biblionumber,
+                        priority         => $rank[0],
+                        reservation_date => $startdate,
+                        expiration_date  => $expirationdate,
+                        notes            => $notes,
+                        title            => $title,
+                        itemnumber       => $checkitem,
+                        found            => $found,
+                        itemtype         => $itemtype,
+                    }
+                );
+
             }
 
         } elsif ($multi_hold) {
             my $bibinfo = $bibinfos{$biblionumber};
             if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
-                AddReserve($branch,$borrower->{'borrowernumber'},$biblionumber,[$biblionumber],
-                           $bibinfo->{rank},$startdate,$expirationdate,$notes,$bibinfo->{title},$checkitem,$found);
+                AddReserve(
+                    {
+                        branchcode       => $branch,
+                        borrowernumber   => $borrower->{'borrowernumber'},
+                        biblionumber     => $biblionumber,
+                        priority         => $bibinfo->{rank},
+                        reservation_date => $startdate,
+                        expiration_date  => $expirationdate,
+                        notes            => $notes,
+                        title            => $bibinfo->{title},
+                        itemnumber       => $checkitem,
+                        found            => $found,
+                        itemtype         => $itemtype,
+                    }
+                );
             }
         } else {
             # place a request on 1st available
             for ( my $i = 0 ; $i < $holds_to_place_count ; $i++ ) {
                 if ( $can_override || CanBookBeReserved($borrower->{'borrowernumber'}, $biblionumber)->{status} eq 'OK' ) {
-                    AddReserve( $branch, $borrower->{'borrowernumber'},
-                        $biblionumber, \@realbi, $rank[0], $startdate, $expirationdate, $notes, $title,
-                        $checkitem, $found, $itemtype );
+                    AddReserve(
+                        {
+                            branchcode       => $branch,
+                            borrowernumber   => $borrower->{'borrowernumber'},
+                            biblionumber     => $biblionumber,
+                            priority         => $rank[0],
+                            reservation_date => $startdate,
+                            expiration_date  => $expirationdate,
+                            notes            => $notes,
+                            title            => $title,
+                            itemnumber       => $checkitem,
+                            found            => $found,
+                            itemtype         => $itemtype,
+                        }
+                    );
                 }
             }
         }