[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha C4/Circulation/Circ2.pm reports/inventory.pl [rel_2_2]
From: |
Ryan Higgins |
Subject: |
[Koha-cvs] koha C4/Circulation/Circ2.pm reports/inventory.pl [rel_2_2] |
Date: |
Tue, 05 Jun 2007 15:54:44 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_2_2
Changes by: Ryan Higgins <rych> 07/06/05 15:54:44
Modified files:
C4/Circulation : Circ2.pm
reports : inventory.pl
Log message:
add lcsort and return numitems on shelf for inventory report.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Circulation/Circ2.pm?cvsroot=koha&only_with_tag=rel_2_2&r1=1.87.2.24&r2=1.87.2.25
http://cvs.savannah.gnu.org/viewcvs/koha/reports/inventory.pl?cvsroot=koha&only_with_tag=rel_2_2&r1=1.1.4.5&r2=1.1.4.6
Patches:
Index: C4/Circulation/Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Attic/Circ2.pm,v
retrieving revision 1.87.2.24
retrieving revision 1.87.2.25
diff -u -b -r1.87.2.24 -r1.87.2.25
--- C4/Circulation/Circ2.pm 14 May 2007 19:59:39 -0000 1.87.2.24
+++ C4/Circulation/Circ2.pm 5 Jun 2007 15:54:43 -0000 1.87.2.25
@@ -3,7 +3,7 @@
package C4::Circulation::Circ2;
-# $Id: Circ2.pm,v 1.87.2.24 2007/05/14 19:59:39 rych Exp $
+# $Id: Circ2.pm,v 1.87.2.25 2007/06/05 15:54:43 rych Exp $
#package to deal with Returns
#written 3/11/99 by address@hidden
@@ -89,21 +89,47 @@
}
sub listitemsforinventory {
- my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_;
+ my ($minlocation,$maxlocation,$datelastseen,$offset,$size,$lcsort) = @_;
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");
$sth->execute($minlocation,$maxlocation,$datelastseen);
my @results;
+ my @lccs;
+ my $numresults;
+#TODO - port tumer's lcsort stuff ... adds lcsort to items table, allowing
numeric sort.
+
while (my $row = $sth->fetchrow_hashref) {
+ if($lcsort) {
+ push @results,$row;
+ } else {
$offset-- if ($offset);
if ((!$offset) && $size) {
push @results,$row;
$size--;
}
}
- return address@hidden;
+ $numresults++;
+ }
+ if ($lcsort) {
+ my @sres = sort _lcsort @results;
+ @results = @sres[$offset..$offset+$size];
+ }
+ return address@hidden,$numresults;
+}
+# FIXME - this faails if the call number doesn't split nicely.
+sub _lcsort ($a,$b)
+{
+ my @a = ($a->{itemcallnumber} =~
/^([A-Z]+)(\d+(?:\.\d+)?)\.?([A-Z]*)(\d*)\.?([A-Z]*)(\d*)(?: (\d{4}))?/);
+ my @b = ($b->{itemcallnumber} =~
/^([A-Z]+)(\d+(?:\.\d+)?)\.?([A-Z]*)(\d*)\.?([A-Z]*)(\d*)(?: (\d{4}))?/);
+
+ return $a[0] cmp $b[0] ||
+ $a[1] <=> $b[1] ||
+ $a[2] cmp $b[2] ||
+ "0.$a[3]" <=> "0.$b[3]" ||
+ $a[4] cmp $b[4] ||
+ "0.$a[5]" <=> "0.$b[5]" ||
+ $a[6] <=> $b[6] ;
}
-
=head2 getpatroninformation
($borrower, $flags) = &getpatroninformation($env, $borrowernumber,
$cardnumber);
Index: reports/inventory.pl
===================================================================
RCS file: /sources/koha/koha/reports/inventory.pl,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -u -b -r1.1.4.5 -r1.1.4.6
--- reports/inventory.pl 3 May 2007 00:57:16 -0000 1.1.4.5
+++ reports/inventory.pl 5 Jun 2007 15:54:43 -0000 1.1.4.6
@@ -27,13 +27,6 @@
use C4::Date;
use HTML::Template;
-# Fixed variables
-my $linecolor1='#ffffcc';
-my $linecolor2='white';
-my $backgroundimage="/images/background-mem.gif";
-my $script_name="/cgi-bin/koha/admin/branches.pl";
-my $pagepagesize=20;
-
#######################################################################################
# Main loop....
@@ -43,6 +36,7 @@
$maxlocation=$minlocation.'Z' unless $maxlocation;
my $datelastseen = $input->param('datelastseen');
my $offset = $input->param('offset');
+my $lcsort= $input->param('lcsort');
my $markseen = $input->param('markseen');
$offset=0 unless $offset;
my $pagesize = $input->param('pagesize');
@@ -67,16 +61,18 @@
intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
IntranetNav => C4::Context->preference("IntranetNav"),
);
+#warn $uploadbarcodes;
if ($uploadbarcodes && length($uploadbarcodes)>0){
my $dbh=C4::Context->dbh;
- my $date=format_date($input->param('setdate'));
- $date = format_date("today") unless $date;
-# warn "$date";
- my $strsth="update items set (datelastseen = $date) where items.barcode
=?";
+
+ my $date=format_date_in_iso($input->param('setdate')) ;
+#warn $date;
+ $date = 'CURDATE()' unless $date;
+ my $strsth="update items set datelastseen = ? where items.barcode =?";
my $qupdate = $dbh->prepare($strsth);
my $strsth="select * from issues, items where
items.itemnumber=issues.itemnumber and items.barcode =? and issues.returndate
is null";
my $qonloan = $dbh->prepare($strsth);
- my $strsth="select * from items where items.barcode =? and
issues.wthdrawn=1";
+ my $strsth="select * from items where items.barcode =? and
items.wthdrawn=1";
my $qwthdrawn = $dbh->prepare($strsth);
my @errorloop;
my $count=0;
@@ -87,14 +83,15 @@
if ($qwthdrawn->execute($barcode) &&$qwthdrawn->rows){
push @errorloop,
{'barcode'=>$barcode,'ERR_WTHDRAWN'=>1};
}else{
- $qupdate->execute($barcode);
+ $qupdate->execute($date,$barcode);
$count += $qupdate->rows;
-# warn "$count";
+ # warn "$count";
if ($count){
$qonloan->execute($barcode);
if ($qonloan->rows){
my $data = $qonloan->fetchrow_hashref;
my ($doreturn, $messages,
$iteminformation, $borrower) =returnbook($barcode, $data->{homebranch});
+ # TODO - add note to issue / patron
acc't in case of overdues ?
if ($doreturn){push @errorloop,
{'barcode'=>$barcode,'ERR_ONLOAN_RET'=>1}}
else {push @errorloop,
{'barcode'=>$barcode,'ERR_ONLOAN_NOT_RET'=>1}}
}
@@ -113,13 +110,15 @@
if ($markseen) {
foreach my $field ($input->param) {
if ($field =~ /SEEN-(.*)/) {
+ #FIXME - should above (doreturn, etc) be done
here, too?
&itemseen($1);
}
}
}
if ($minlocation) {
- my $res =
C4::Circulation::Circ2::listitemsforinventory($minlocation,$maxlocation,$datelastseen,$offset,$pagesize);
+ my ($res,$numitems) =
C4::Circulation::Circ2::listitemsforinventory($minlocation,$maxlocation,$datelastseen,$offset,$pagesize,$lcsort
) ;
$template->param(loop =>$res,
+ numitems => $numitems,
nextoffset =>
($offset+$pagesize),
prevoffset =>
($offset?$offset-$pagesize:0),
);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha C4/Circulation/Circ2.pm reports/inventory.pl [rel_2_2],
Ryan Higgins <=