[Koha-cvs] koha request.pl [dev_week]

Chris Cormack crc at liblime.com
Tue Jun 12 00:12:57 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Chris Cormack <rangi>	07/06/11 22:12:56

Modified files:
	.              : request.pl 

Log message:
	Working on adding itemlevelreserves to dev_week.
	This script should be now good to go

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/request.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.28.2.4.2.1&r2=1.28.2.4.2.2

Patches:
Index: request.pl
===================================================================
RCS file: /sources/koha/koha/Attic/request.pl,v
retrieving revision 1.28.2.4.2.1
retrieving revision 1.28.2.4.2.2
diff -u -b -r1.28.2.4.2.1 -r1.28.2.4.2.2
--- request.pl	5 Oct 2006 19:02:44 -0000	1.28.2.4.2.1
+++ request.pl	11 Jun 2007 22:12:56 -0000	1.28.2.4.2.2
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: request.pl,v 1.28.2.4.2.1 2006/10/05 19:02:44 kados Exp $
+# $Id: request.pl,v 1.28.2.4.2.2 2007/06/11 22:12:56 rangi Exp $
 
 #script to place reserves/requests
 #writen 2/1/00 by chris at katipo.oc.nz
@@ -61,6 +61,7 @@
 
 # make priorities options
 my $num = $count + 1;
+my $newpriority = $num;
 
 #priorityoptions building
 my @optionloop;
@@ -91,22 +92,47 @@
 	my %abibitem;
 	my @barcodeloop;
     my @barcodes = barcodes($dat->{'biblioitemnumber'});
+	if (C4::Context->preference('itemlevelreserves')){                                                                                                    
     foreach my $num (@barcodes) {
+			my %abibitem;
+			$abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
+			$abibitem{'itemlost'}=(($dat->{'notforloan'})|| ($dat->{'itemlost'} == 1)) ;
+			$abibitem{'biblioitemnumber'}=$dat->{'biblioitemnumber'};
+			$abibitem{'description'}=$dat->{'description'};
+			$abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
+			$abibitem{'publicationyear'}=$dat->{'publicationyear'};
 		my %barcode;
+			my @barcodeloop;
 		$barcode{'barcode'}=$num->{'barcode'};
-		$barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" :
-	    $num->{'itemlost'} == 2 ? "(long overdue)" : "";
+			$barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" : $num->{'itemlost'} == 2 ? "(long overdue)" : "";
 		push(@barcodeloop, \%barcode);
-    }
+			
 	$abibitem{'barcodeloop'}=\@barcodeloop;
+			$abibitem{'biblioitemnumber'}=$num->{'itemnumber'};
+			push(@bibitemloop,\%abibitem);
+			
+		}                                 
+	} 
+    else {                                
+		my @barcodeloop;
+		my %abibitem;
     $abibitem{'class'}="$dat->{'classification'}$dat->{'dewey'}$dat->{'subclass'}";
-    my $select;
     $abibitem{'itemlost'}=(($dat->{'notforloan'})|| ($dat->{'itemlost'} == 1)) ;
 	$abibitem{'biblioitemnumber'}=$dat->{'biblioitemnumber'};
 	$abibitem{'description'}=$dat->{'description'};
 	$abibitem{'volumeddesc'}=$dat->{'volumeddesc'};
 	$abibitem{'publicationyear'}=$dat->{'publicationyear'};
+		                                                          
+		foreach my $num (@barcodes) {                             
+			my %barcode;                                          
+			$barcode{'barcode'}=$num->{'barcode'}; 
+			$barcode{'message'}=$num->{'itemlost'} == 1 ? "(lost)" : 
+			$num->{'itemlost'} == 2 ? "(long overdue)" : ""; 
+			  push(@barcodeloop, \%barcode);  
+		}                                     
+		$abibitem{'barcodeloop'}=\@barcodeloop;
 	push(@bibitemloop,\%abibitem);
+	}  
 }
 
 
@@ -149,6 +175,11 @@
 			$reserve{'atdestination'} = 1;
 		}
     }
+	elsif ($res->{'itemnumber'}){
+		# item level reserves
+		my $item = getiteminformation('',$res->{'itemnumber'});
+		$reserve{'barcode'} = $item->{'barcode'};
+	} 
 	
    $reserve{'date'} = format_date($res->{'reservedate'});
 	$reserve{'borrowernumber'}=$res->{'borrowernumber'};
@@ -193,6 +224,7 @@
 								'time' => $time,
 								bibitemloop => \@bibitemloop,
 								date => $date,
+								newpriority => $newpriority,
 								bib => $bib,
 								title =>$dat->{title});
 								





More information about the Koha-cvs mailing list