[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]
Antoine Farnault
antoine at koha-fr.org
Tue Nov 28 17:42:29 CET 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/11/28 16:42:29
Modified files:
C4/Circulation : Circ2.pm
Log message:
new function : GetItemsLost
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.18&r2=1.114.2.19
Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.18
retrieving revision 1.114.2.19
diff -u -b -r1.114.2.18 -r1.114.2.19
--- Circ2.pm 27 Nov 2006 14:53:29 -0000 1.114.2.18
+++ Circ2.pm 28 Nov 2006 16:42:29 -0000 1.114.2.19
@@ -17,7 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Circ2.pm,v 1.114.2.18 2006/11/27 14:53:29 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.19 2006/11/28 16:42:29 toins Exp $
use strict;
require Exporter;
@@ -38,7 +38,7 @@
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.114.2.18 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.19 $' =~ /\d+/g; shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -89,6 +89,7 @@
&RemoveNotifyLine
&GetIssuesFromBiblio
&AnonymiseIssueHistory
+ &GetItemsLost
);
=head2 itemseen
@@ -2918,6 +2919,47 @@
return $rows_affected;
}
+=head2 GetItemsLost
+
+$items = GetItemsLost($filter,$value,$orderby);
+
+this function get the items lost where C<$filter> = C<$value> ordered by C<$orderby>.
+It returns a reference to an array full of hasref which keys are items' table column.
+
+example of use :
+
+to search on all items orderby branchcode:
+
+GetItemsLost(undef,undef,"branchcode");
+
+=cut
+
+sub GetItemsLost {
+ # Getting input args.
+ my $filter = shift;
+ my $value = shift;
+ my $orderby = shift;
+ my $dbh = C4::Context->dbh;
+
+ my $query = "
+ SELECT *
+ FROM items
+ WHERE itemlost IS NOT NULL
+ AND itemlost <> 0
+ ";
+ $query .= " AND ".$filter." = '".$value."'" if (defined($filter) && defined($value));
+ $query .= " ORDER BY ".$orderby if defined $orderby;
+ warn "query=>".$query;
+ my $sth = $dbh->prepare($query);
+ $sth->execute;
+
+ my @items;
+ while ( my $row = $sth->fetchrow_hashref ){
+ push @items, $row;
+ }
+ return \@items;
+}
+
1;
__END__
More information about the Koha-cvs
mailing list