[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0]
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0] |
Date: |
Wed, 29 Nov 2006 11:52:51 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/11/29 11:52:51
Modified files:
C4/Circulation : Circ2.pm
Log message:
Some change on GetLostItems.
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.20&r2=1.114.2.21
Patches:
Index: Circ2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Circulation/Circ2.pm,v
retrieving revision 1.114.2.20
retrieving revision 1.114.2.21
diff -u -b -r1.114.2.20 -r1.114.2.21
--- Circ2.pm 28 Nov 2006 16:55:08 -0000 1.114.2.20
+++ Circ2.pm 29 Nov 2006 11:52:50 -0000 1.114.2.21
@@ -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.20 2006/11/28 16:55:08 toins Exp $
+# $Id: Circ2.pm,v 1.114.2.21 2006/11/29 11:52:50 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.20 $' =~ /\d+/g;
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.114.2.21 $' =~ /\d+/g;
shift(@v).".".join( "_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -2921,23 +2921,34 @@
=head2 GetItemsLost
-$items = GetItemsLost($filter,$value,$orderby);
+$items = GetItemsLost($where,$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.
+This function get the items lost into C<$items>.
-example of use :
+=over 2
-to search on all items orderby branchcode:
+=item input:
+C<$where> is a hashref. it containts a field of the items table as key
+and the value to match as value.
+C<$orderby> is a field of the items table.
-GetItemsLost(undef,undef,"branchcode");
+=item return:
+C<$items> is a reference to an array full of hasref which keys are items'
table column.
+
+=item usage in the perl script:
+
+my %where;
+$where{barcode} = 0001548;
+my $items = GetLostItems( \%where, "homebranch" );
+$template->param(itemsloop => $items);
+
+=back
=cut
sub GetLostItems {
# Getting input args.
- my $filter = shift;
- my $value = shift;
+ my $where = shift;
my $orderby = shift;
my $dbh = C4::Context->dbh;
@@ -2947,12 +2958,13 @@
WHERE itemlost IS NOT NULL
AND itemlost <> 0
";
- $query .= " AND ".$filter." = '".$value."'" if (defined($filter) &&
defined($value));
+ foreach my $key (keys %$where){
+ $query .= " AND " . $key . " LIKE '%" . $where->{$key} . "%'";
+ }
$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;
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/02
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Bruno Toumi, 2006/11/10
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/13
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/15
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/27
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/27
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/28
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0], Antoine Farnault, 2006/11/28
- [Koha-cvs] koha/C4/Circulation Circ2.pm [rel_3_0],
Antoine Farnault <=