[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]

paul poulain paul at koha-fr.org
Mon Oct 30 10:49:06 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	paul poulain <tipaul>	06/10/30 09:49:06

Modified files:
	C4/Circulation : Circ2.pm 

Log message:
	indenting with spaces

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.114.2.9&r2=1.114.2.10

Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.9
retrieving revision 1.114.2.10
diff -u -b -r1.114.2.9 -r1.114.2.10
--- Circ2.pm	20 Oct 2006 10:35:05 -0000	1.114.2.9
+++ Circ2.pm	30 Oct 2006 09:49:05 -0000	1.114.2.10
@@ -3,7 +3,7 @@
 
 package C4::Circulation::Circ2;
 
-# $Id: Circ2.pm,v 1.114.2.9 2006/10/20 10:35:05 alaurin Exp $
+# $Id: Circ2.pm,v 1.114.2.10 2006/10/30 09:49:05 tipaul Exp $
 
 #package to deal with Returns
 #written 3/11/99 by olwen at katipo.co.nz
@@ -56,7 +56,7 @@
 
 =head1 SYNOPSIS
 
-  use C4::Circulation::Circ2;
+use C4::Circulation::Circ2;
 
 =head1 DESCRIPTION
 
@@ -85,7 +85,7 @@
                 &transferbook
                 &decode
                 &calc_charges
-                &listitemsforinventory
+                &GetItemsForInventory
                 &itemseen
                 &fixdate
                 get_current_return_date_of
@@ -134,11 +134,39 @@
 	return;
 }
 
-sub listitemsforinventory {
+=head2
+
+$itemlist = GetItemsForInventory($minlocation,$maxlocation,$datelastseen,$offset,$size)
+
+Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
+
+The sub returns a list of hashes, containing itemnumber, author, title, barcode & item callnumber.
+It is ordered by callnumber,title.
+
+The minlocation & maxlocation parameters are used to specify a range of item callnumbers
+the datelastseen can be used to specify that you want to see items not seen since a past date only.
+offset & size can be used to retrieve only a part of the whole listing (defaut behaviour)
+
+=cut
+
+sub GetItemsForInventory {
 	my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_;
 	my $dbh = C4::Context->dbh;
-	my $sth = $dbh->prepare("select itemnumber,barcode,itemcallnumber,title,author from items,biblio where items.biblionumber=biblio.biblionumber and itemcallnumber>= ? and itemcallnumber <=? and (datelastseen< ? or datelastseen is null) order by itemcallnumber,title");
+    my $sth;
+    if ($datelastseen) {
+        my $query = "SELECT itemnumber,barcode,itemcallnumber,title,author,datelastseen FROM items
+                    LEFT JOIN biblio on items.biblionumber=biblio.biblionumber 
+                    WHERE itemcallnumber>= ? and itemcallnumber <=? and (datelastseen< ? or datelastseen is null) ORDER BY itemcallnumber,title";
+        $sth = $dbh->prepare($query);
+        warn "DATELA :$datelastseen";
 	$sth->execute($minlocation,$maxlocation,$datelastseen);
+    } else {
+        my $query = "SELECT itemnumber,barcode,itemcallnumber,title,author,datelastseen FROM items 
+                LEFT JOIN biblio on items.biblionumber=biblio.biblionumber 
+                WHERE itemcallnumber>= ? and itemcallnumber <=? ORDER BY itemcallnumber,title";
+        $sth = $dbh->prepare($query);
+        $sth->execute($minlocation,$maxlocation);
+    }
 	my @results;
 	while (my $row = $sth->fetchrow_hashref) {
 		$offset-- if ($offset);
@@ -152,7 +180,7 @@
 
 =head2 getpatroninformation
 
-  ($borrower, $flags) = &getpatroninformation($env, $borrowernumber, $cardnumber);
+($borrower, $flags) = &getpatroninformation($env, $borrowernumber, $cardnumber);
 
 Looks up a patron and returns information about him or her. If
 C<$borrowernumber> is true (nonzero), C<&getpatroninformation> looks
@@ -1088,7 +1116,7 @@
 }
 =head2 returnbook
 
-  ($doreturn, $messages, $iteminformation, $borrower) =
+($doreturn, $messages, $iteminformation, $borrower) =
 	  &returnbook($barcode, $branch);
 
 Returns a book.
@@ -1467,7 +1495,7 @@
 # Not exported
 sub checkoverdues {
 # From Main.pm, modified to return a list of overdueitems, in addition to a count
-  #checks whether a borrower has overdue items
+#checks whether a borrower has overdue items
 	my ($env, $bornum, $dbh)=@_;
 	my @datearr = localtime;
 	my $today = ($datearr[5] + 1900)."-".($datearr[4]+1)."-".$datearr[3];
@@ -1550,7 +1578,7 @@
 
 =head2 currentissues
 
-  $issues = &currentissues($env, $borrower);
+$issues = &currentissues($env, $borrower);
 
 Returns a list of books currently on loan to a patron.
 
@@ -1653,7 +1681,7 @@
 
 =head2 getissues
 
-  $issues = &getissues($borrowernumber);
+$issues = &getissues($borrowernumber);
 
 Returns the set of books currently on loan to a patron.
 
@@ -1683,7 +1711,7 @@
 				biblioitems.dewey     AS dewey,
 				itemtypes.description AS itemtype,
 				biblioitems.subclass  AS subclass,
-   			        biblioitems.ccode  AS ccode
+                biblioitems.ccode  AS ccode,
                                 biblioitems.isbn  AS isbn,
 				biblioitems.classification AS classification
 			FROM issues,items,biblioitems,biblio, itemtypes
@@ -1730,7 +1758,7 @@
 
 =head2 renewstatus
 
-  $ok = &renewstatus($env, $dbh, $borrowernumber, $itemnumber);
+$ok = &renewstatus($env, $dbh, $borrowernumber, $itemnumber);
 
 Find out whether a borrowed item may be renewed.
 
@@ -1800,7 +1828,7 @@
 
 =head2 renewbook
 
-  &renewbook($env, $borrowernumber, $itemnumber, $datedue);
+&renewbook($env, $borrowernumber, $itemnumber, $datedue);
 
 Renews a loan.
 
@@ -1873,7 +1901,7 @@
 
 =item calc_charges
 
-  ($charge, $item_type) = &calc_charges($env, $itemnumber, $borrowernumber);
+($charge, $item_type) = &calc_charges($env, $itemnumber, $borrowernumber);
 
 Calculate how much it would cost for a given patron to borrow a given
 item, including any applicable discounts.
@@ -1950,7 +1978,7 @@
 
 =item find_reserves
 
-  ($status, $record) = &find_reserves($itemnumber);
+($status, $record) = &find_reserves($itemnumber);
 
 Looks up an item in the reserves.
 
@@ -2062,8 +2090,8 @@
     my $query = '
 SELECT date_due,
        itemnumber
-  FROM issues
-  WHERE itemnumber IN ('.join(',', @itemnumbers).') AND returndate IS NULL
+FROM issues
+WHERE itemnumber IN ('.join(',', @itemnumbers).') AND returndate IS NULL
 ';
     return get_infos_of($query, 'itemnumber', 'date_due');
 }
@@ -2077,8 +2105,8 @@
 SELECT datesent,
        frombranch,
        tobranch
-  FROM branchtransfers
-  WHERE itemnumber = ?
+FROM branchtransfers
+WHERE itemnumber = ?
     AND datearrived IS NULL
 ';
     my $sth = $dbh->prepare($query);





More information about the Koha-cvs mailing list