bug Fixing opac/opac-reserve.pl was broken
[koha.git] / opac / opac-reserve.pl
index 8e2e75c..552cffb 100755 (executable)
@@ -113,7 +113,8 @@ foreach my $branch ( keys %$branches ) {
         push @CGIbranchlooparray, \%line;
     }
 }
-@CGIbranchlooparray = sort { $a->{branch} cmp $b->{branch} } @CGIbranchlooparray;
+@CGIbranchlooparray =
+  sort { $a->{branch} cmp $b->{branch} } @CGIbranchlooparray;
 my $CGIbranchloop = \@CGIbranchlooparray;
 $template->param( CGIbranch => $CGIbranchloop );
 
@@ -145,7 +146,6 @@ if ( $query->param('place_reserve') ) {
     my $checkitem=$query->param('checkitem');
     my $found;
     
-<<<<<<< HEAD:opac/opac-reserve.pl
     #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' unless C4::Context->preference('ReservesNeedReturns');
@@ -153,26 +153,6 @@ if ( $query->param('place_reserve') ) {
         $item = GetItem($item);
         if ( $item->{'holdingbranch'} eq $branch ){
             $found = 'W' unless C4::Context->preference('ReservesNeedReturns');
-=======
-    my @selectedItems = split /\//, $selectedItems;
-
-    # Make sure there is a biblionum/itemnum/branch triplet for each item.
-    # The itemnum can be 'any', meaning next available.
-    my $selectionCount = @selectedItems;
-    if (($selectionCount == 0) || (($selectionCount % 3) != 0)) {
-        $template->param(message=>1, bad_data=>1);
-        &get_out($query, $cookie, $template->output);
-    }
-
-    while (@selectedItems) {
-        my $biblioNum = shift(@selectedItems);
-        my $itemNum   = shift(@selectedItems);
-        my $branch    = shift(@selectedItems); # i.e., branch code, not name
-
-        my $singleBranchMode = $template->param('singleBranchMode');
-        if ($singleBranchMode) {
-            $branch = $borr->{'branchcode'};
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
         }
     }
         
@@ -274,17 +254,8 @@ my @bibitemloop;
 foreach my $biblioitemnumber (@biblioitemnumbers) {
     my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber};
 
-<<<<<<< HEAD:opac/opac-reserve.pl
     $biblioitem->{description} =
       $itemtypes->{ $biblioitem->{itemtype} }{description};
-=======
-    # Get relevant biblio data.
-    my $biblioData = $biblioDataHash{$biblioNum};
-    if (! $biblioData) {
-        $template->param(message=>1, bad_biblionumber=>$biblioNum);
-        &get_out($query, $cookie, $template->output);
-    }
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
 
     foreach
       my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } )
@@ -301,48 +272,12 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
               $branches->{ $item->{holdingbranch} }{branchname};
         }
         
-<<<<<<< HEAD:opac/opac-reserve.pl
 #      add information
        $item->{itemcallnumber} = $item->{itemcallnumber};
        
         # if the item is currently on loan, we display its return date and
         # change the background color
         my $issues= GetItemIssue($itemnumber);
-=======
-        if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
-            $biblioLoopIter{forloan} = 1;
-        }
-    }
-
-    $biblioLoopIter{itemTypeDescription} = $itemTypes->{$biblioData->{itemtype}}{description};
-
-    $biblioLoopIter{itemLoop} = [];
-    my $numCopiesAvailable = 0;
-    foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
-        my $itemNum = $itemInfo->{itemnumber};
-        my $itemLoopIter = {};
-
-        $itemLoopIter->{itemnumber} = $itemNum;
-        $itemLoopIter->{barcode} = $itemInfo->{barcode};
-        $itemLoopIter->{homeBranchName} = $branches->{$itemInfo->{homebranch}}{branchname};
-        $itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
-        $itemLoopIter->{copynumber} = $itemInfo->{copynumber};
-        if ($itemLevelTypes) {
-            $itemLoopIter->{description} = $itemInfo->{description};
-            $itemLoopIter->{imageurl} = $itemInfo->{imageurl};
-        }
-
-        # If the holdingbranch is different than the homebranch, we show the
-        # holdingbranch of the document too.
-        if ( $itemInfo->{homebranch} ne $itemInfo->{holdingbranch} ) {
-            $itemLoopIter->{holdingBranchName} =
-              $branches->{ $itemInfo->{holdingbranch} }{branchname};
-        }
-
-        # If the item is currently on loan, we display its return date and
-        # change the background color.
-        my $issues= GetItemIssue($itemNum);
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
         if ( $issues->{'date_due'} ) {
             $item->{date_due} = format_date($issues->{'date_due'});
             $item->{backgroundcolor} = 'onloan';
@@ -353,7 +288,6 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
         my $ItemBorrowerReserveInfo = GetMemberDetails( $reservedfor, 0);
 
         if ( defined $reservedate ) {
-<<<<<<< HEAD:opac/opac-reserve.pl
             $item->{backgroundcolor} = 'reserved';
             $item->{reservedate}     = format_date($reservedate);
             $item->{ReservedForBorrowernumber}     = $reservedfor;
@@ -361,14 +295,6 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
             $item->{ReservedForFirstname}     = $ItemBorrowerReserveInfo->{'firstname'};
             $item->{ExpectedAtLibrary}     = $expectedAt;
             
-=======
-            $itemLoopIter->{backgroundcolor} = 'reserved';
-            $itemLoopIter->{reservedate}     = format_date($reservedate);
-            $itemLoopIter->{ReservedForBorrowernumber} = $reservedfor;
-            $itemLoopIter->{ReservedForSurname}        = $ItemBorrowerReserveInfo->{'surname'};
-            $itemLoopIter->{ReservedForFirstname}      = $ItemBorrowerReserveInfo->{'firstname'};
-            $itemLoopIter->{ExpectedAtLibrary}         = $expectedAt;
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
         }
 
         # Management of the notforloan document
@@ -415,44 +341,13 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
         while (my $wait_hashref = $sth2->fetchrow_hashref) {
             $item->{waitingdate} = format_date($wait_hashref->{waitingdate});
         }
-<<<<<<< HEAD:opac/opac-reserve.pl
        $item->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $item->{itype} }{imageurl} );
         push @{ $biblioitem->{itemloop} }, $item;
-=======
-       $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
-        
-        push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
-    }
-
-    if ($numCopiesAvailable > 0) {
-        $numBibsAvailable++;
-        $biblioLoopIter{bib_available} = 1;
-        $biblioLoopIter{holdable} = 1;
-    }
-    if ($biblioLoopIter{already_reserved}) {
-        $biblioLoopIter{holdable} = undef;
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
     }
 
     push @bibitemloop, $biblioitem;
 }
 
-<<<<<<< HEAD:opac/opac-reserve.pl
-=======
-if ( $numBibsAvailable == 0 ) {
-    $template->param( none_available => 1, message => 1 );
-}
-
-my $itemTableColspan = 5;
-if (!$template->param('OPACItemHolds')) {
-    $itemTableColspan--;
-}
-if ($template->param('singleBranchMode')) {
-    $itemTableColspan--;
-}
-$template->param(itemtable_colspan => $itemTableColspan);
-
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl
 # display infos
 $template->param(
        forloan           => $forloan,
@@ -460,9 +355,6 @@ $template->param(
 );
 output_html_with_http_headers $query, $cookie, $template->output;
 
-<<<<<<< HEAD:opac/opac-reserve.pl
 # Local Variables:
 # tab-width: 8
 # End:
-=======
->>>>>>> 9f01cc0... whitespace cleanup and remove editor comments:opac/opac-reserve.pl