[Koha-cvs] koha opac/opac-reserve.pl koha-tmpl/opac-tmpl/n... [dev_week]

Chris Cormack crc at liblime.com
Tue Jun 12 02:58:17 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Chris Cormack <rangi>	07/06/12 00:58:17

Modified files:
	opac           : opac-reserve.pl 
	koha-tmpl/opac-tmpl/npl/en: opac-reserve.tmpl 

Log message:
	Item level reserves

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-reserve.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.22.2.9.2.4&r2=1.22.2.9.2.5
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/npl/en/opac-reserve.tmpl?cvsroot=koha&only_with_tag=dev_week&r1=1.1.2.4.2.4&r2=1.1.2.4.2.5

Patches:
Index: opac/opac-reserve.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-reserve.pl,v
retrieving revision 1.22.2.9.2.4
retrieving revision 1.22.2.9.2.5
diff -u -b -r1.22.2.9.2.4 -r1.22.2.9.2.5
--- opac/opac-reserve.pl	2 Apr 2007 15:20:53 -0000	1.22.2.9.2.4
+++ opac/opac-reserve.pl	12 Jun 2007 00:58:17 -0000	1.22.2.9.2.5
@@ -25,6 +25,7 @@
 			     authnotrequired => 0,
 			     flagsrequired => {borrow => 1},
 			     debug => 1,
+				 loop_context_vars => 1,
 			     });
 
 # load the languages
@@ -157,6 +158,10 @@
 
 
 $template->param(ITEMS => \@duedates);
+if ( scalar @items > 1 ) {
+	$template->param(ITEMSLOOP => \@items);
+	$template->param( manyitems => 1);
+}
 
 my $width = keys %types;
 my @publictypes = sort {$b->{'count'} <=> $a->{'count'}} values %types;
@@ -164,7 +169,12 @@
 foreach my $pt (@publictypes) {
     $typecount += $pt->{'count'};
 }
-$template->param(onlyone => 1) if $typecount == 1;
+if (C4::Context->preference('itemlevelreserves')){
+	$template->param(itemlevel => 1);
+}
+else {
+	$template->param(onlyone => 1) if $typecount == 1;
+}
 
 my @typerows;
 for (my $rownum=0;$rownum<$publictypes[0]->{'count'} ;$rownum++) {
@@ -177,9 +187,15 @@
     $row[$last-1]->{'last'} =1 if $last == $width;
     my $fill = ($width - $last)*2;
     $fill-- if $fill;
+	
     push @typerows, {ROW => \@row, fill => $fill};
 }
-$template->param(TYPE_ROWS => \@typerows);
+if (C4::Context->preference('itemlevelreserves')){
+	$template->param(TYPE_ROWS => \@items);
+	}
+else {
+	$template->param(TYPE_ROWS => \@typerows);
+	}
 $width = 2*$width -1;
 $template->param(totalwidth => 2*$width-1,
 );
@@ -206,11 +222,30 @@
 		$fee += CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs);
 		}
 		$proceed = 1;
-	} elsif ($query->param('all')) {
+	} 
+	elsif (C4::Context->preference('itemlevelreserves')){
+		my @itemnumbers = $query->param('itemnumber');
+		my @reqbibs;
+		if (@itemnumbers){
+			@reqbibs=@itemnumbers;
+			}
+		my @items;
+		foreach my $item (@itemnumbers){
+			my %newitem;
+			$newitem{'itemnumber'} = $item;
+			my $itemdata=getiteminformation('',$item,'');
+			$newitem{'barcode'}=$itemdata->{'barcode'};
+			push @items,\%newitem;
+		}
+		$template->param(ITEMS => \@items);
+		$fee += CalcReserveFee(undef,$borrowernumber,$biblionumber,'o',\@reqbibs);
+		$proceed = 1;
+	} 
+	elsif ($query->param('all')) {
 		$template->param(all => 1);
 		# No idea why fee would be set to 1 ... it's supposed to be a monetary value, not a flag
 		# -- JF
-		#$fee = 1;
+		# $fee = 1;
 		$proceed = 1;
 	}
 	if ($proceed && $branch) {
@@ -230,6 +265,12 @@
 } elsif ($query->param('place_reserve')) {
 	# here we actually do the reserveration. Stage 3.
 	my $title = $bibdata->{'title'};
+	if (C4::Context->preference('itemlevelreserves')){                                                                                                       		
+		if (my @reqbibs=$query->param('itemnumber')){                                                                                                        
+			CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title);                                                        			
+		}                                                                                                                                                    		
+	}                                                                                                                                                        
+	else {                                                                                                                                                   
 	my @itemtypes = $query->param('itemtype');
 	foreach my $type (@itemtypes) {
 		my @reqbibs;
@@ -240,10 +281,10 @@
 		}
 		CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'o',\@reqbibs,$rank,'',$title);
 	}
+	}                                                                                                                                                        
 	if ($query->param('all')) {
 		CreateReserve(undef,$branch,$borrowernumber,$biblionumber,'a', undef, $rank,'',$title);
 	}
-	print $query->redirect("/cgi-bin/koha/opac-user.pl?display=reserves");
 } else {
 	# Here we check that the borrower can actually make reserves Stage 1.
 	my $noreserves = 0;
@@ -278,10 +319,14 @@
 		$template->param(too_many_reserves => $resnum);
 	}
 	foreach my $res (@$reserves) {
-		if ($res->{'biblionumber'} == $biblionumber) {
-		$template->param(message => 1);
+		if (C4::Context->preference('itemlevelreserves')){
+		}
+		else {
+			if ( $res->{'biblionumber'} == $biblionumber ) {
+				$template->param( message => 1 );
 		$noreserves = 1;
-		$template->param(already_reserved => 1);
+				$template->param( already_reserved => 1 );
+			}
 		}
 	}
 	unless ($noreserves) {

Index: koha-tmpl/opac-tmpl/npl/en/opac-reserve.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/opac-tmpl/npl/en/Attic/opac-reserve.tmpl,v
retrieving revision 1.1.2.4.2.4
retrieving revision 1.1.2.4.2.5
diff -u -b -r1.1.2.4.2.4 -r1.1.2.4.2.5
--- koha-tmpl/opac-tmpl/npl/en/opac-reserve.tmpl	30 Nov 2006 21:10:09 -0000	1.1.2.4.2.4
+++ koha-tmpl/opac-tmpl/npl/en/opac-reserve.tmpl	12 Jun 2007 00:58:17 -0000	1.1.2.4.2.5
@@ -31,16 +31,55 @@
     <tr><th>For:</th><td><!-- TMPL_LOOP NAME="USER_INFO" --><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)<!-- /TMPL_LOOP --></td></tr>
 
     <tr><th>Pick up from:</th><td><select name="branch" id="branch">
-		<option>-- Please choose your branch --</option>
+	<!--	<option>-- Please choose your branch --</option> -->
 		<!-- TMPL_LOOP NAME="CGIbranch" --><option value="<!-- TMPL_VAR NAME="value" -->"><!-- TMPL_VAR NAME="branch" --></option><!-- /TMPL_LOOP -->
 </select></td></tr>
 </table>
 
-</div><p><input type="submit" class="submit" value="Next &gt;&gt;" />
-<input type="hidden" name="all" value="1" /></p>
+
+<!-- If there is more than one type -->                                    
+                                                                            
+ <h4>Choose Either...</h4>                    
+ <p><input class="checkbox" type="checkbox" name="all" value="next-available">                
+ Next Available Copy (any format)</p>      
+ <h4>                     
+  <!-- TMPL_IF NAME="itemlevel" -->             
+   ...Or Choose item  
+   <!-- TMPL_ELSE -->                     
+   ...Or Choose Acceptable Formats          
+   <!-- /TMPL_IF -->        
+   </h4> 
+ <!-- TMPL_IF NAME="itemlevel" -->
+    <ul>     
+	<!-- TMPL_LOOP NAME="TYPE_ROWS" -->        
+	<li><input type="checkbox" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber"-->"><!-- TMPL_VAR NAME="itemtype" -->
+    <!--TMPL_VAR NAME="holdingbranch" --> <!-- TMPL_VAR NAME="barcode" --></li>     
+    <!-- /TMPL_LOOP -->                    
+	</ul>          
+	<!-- TMPL_ELSE -->                       
+	<!-- TMPL_LOOP NAME="TYPE_ROWS" -->
+	<ul><!-- TMPL_LOOP NAME="ROW" -->                                      
+	<li><input type="checkbox" name="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->" class="checkbox"><!-- TMPL_VAR NAME="description" --></li>            
+<!-- /TMPL_LOOP -->
+</ul><!-- /TMPL_LOOP -->                     
+<!-- /TMPL_IF -->              
+                                                                            
+
+</div><p><input type="submit" class="submit" value="Next &gt;&gt;">
+
 </form>
 
 
+ <table>
+	<tr>
+    <th>Number of Copies</th><th>Requests already received for this title</th> <th>Items curently on issue, due back</th></tr>
+    <td><!-- TMPL_VAR NAME="itemcount" --></td>
+    <td><!-- TMPL_VAR NAME="reservecount" --></td>
+     <td><!-- TMPL_LOOP NAME="ITEMS" --><!-- TMPL_VAR NAME="date_due" -->, <!-- /TMPL_LOOP --></td>
+</table> 
+
+
+
 <!-- end of the first form -->
 <!-- /TMPL_IF -->
 
@@ -54,14 +93,20 @@
 		<tr><th>Title: </th><td><span class="title"><!-- TMPL_VAR NAME="title" --></span></td></tr>
 
 <!-- TMPL_IF NAME="all" -->
-		<tr><th>Item Type: </th><td>Any<input type="hidden" name="all" value="1" /></td></tr>
+		<tr><th>Item Type: </th><td>Any<input type="hidden" name="all" value="1"></td></tr>
 <!-- TMPL_ELSE -->
-		<tr><th>Item Types: </th><td><!-- TMPL_LOOP NAME="TYPES" -->
-<input type="hidden" name="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->" /><!-- TMPL_VAR NAME="description" -->;
+<!-- TMPL_IF NAME="itemlevel" -->                            
+  <tr><th>Items</th><td><!--TMPL_LOOP NAME="ITEMS"-->                        
+  <input type="hidden" name="itemnumber" value="<!-- TMPL_VAR NAME="itemnumber" -->"> <!-- TMPL_VAR NAME="barcode" -->            
+  <!-- /TMPL_LOOP -->                  
+  </td></tr>               
+<!-- TMPL_ELSE -->                               
+<tr><th>Item Types: </th><td><!-- TMPL_LOOP NAME="TYPES" --> 
+<input type="hidden" name="itemtype" value="<!-- TMPL_VAR NAME="itemtype" -->"><!-- TMPL_VAR NAME="description" -->
 <!-- /TMPL_LOOP --></td></tr>
-
 <!-- /TMPL_IF -->
-		<tr><th>Pick up From: </th><td><!-- TMPL_VAR NAME="branchname" --><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" /></td></tr>
+<!-- /TMPL_IF --> 
+		<tr><th>Pick up From: </th><td><!-- TMPL_VAR NAME="branchname" --><input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->"></td></tr>
 </table>
 		<!-- TMPL_IF NAME="reservefee" -->
 			<p>Note there will be a reserve charge of <strong>$<!-- TMPL_VAR NAME="reservefee" --></strong></p>





More information about the Koha-cvs mailing list