[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 Bookfund.pm
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/C4 Bookfund.pm |
Date: |
Mon, 31 Jul 2006 15:58:26 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Antoine Farnault <toins> 06/07/31 15:58:26
Modified files:
C4 : Bookfund.pm
Log message:
New function "GetBookFundsId" : this function get the list of bookfund
id into an array.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Bookfund.pm?cvsroot=koha&r1=1.2&r2=1.3
Patches:
Index: Bookfund.pm
===================================================================
RCS file: /sources/koha/koha/C4/Bookfund.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- Bookfund.pm 31 Jul 2006 14:36:40 -0000 1.2
+++ Bookfund.pm 31 Jul 2006 15:58:26 -0000 1.3
@@ -17,8 +17,7 @@
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
-# $Id: Bookfund.pm,v 1.2 2006/07/31 14:36:40 toins Exp $
-
+# $Id: Bookfund.pm,v 1.3 2006/07/31 15:58:26 toins Exp $
use strict;
@@ -26,7 +25,7 @@
use vars qw($VERSION @ISA @EXPORT);
# set the version for version checking
-$VERSION = do { my @v = '$Revision: 1.2 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.3 $' =~ /\d+/g; shift(@v) . "." . join(
"_", map { sprintf "%03d", $_ } @v ); };
=head1 NAME
@@ -45,9 +44,10 @@
@ISA = qw(Exporter);
@EXPORT = qw(
- &GetBookFund &GetBookFunds &GetBookFundBreakdown &GetCurrencies
+ &GetBookFund &GetBookFunds &GetBookFundsId &GetBookFundBreakdown
&GetCurrencies
&NewBookFund
&ModBookFund &ModCurrencies
+ &SearchBookFund
&Countbookfund
&ConvertCurrency
&DelBookFund
@@ -93,6 +93,36 @@
return $sth->fetchrow_hashref;
}
+
+=head3 GetBookFundsId
+
+=over 4
+
+$sth = &GetBookFundsId
+Read on aqbookfund table and execute a simple SQL query.
+
+return:
+$sth->execute. Don't forget to fetch row from the database after using
+this function by using, for example, $sth->fetchrow_hashref;
+
+C<@results> is an array of id existing on the database.
+
+=back
+
+=cut
+
+sub GetBookFundsId {
+ my @bookfundids_loop;
+ my $dbh= C4::Context->dbh;
+ my $query = "
+ SELECT bookfundid
+ FROM aqbookfund
+ ";
+ my $sth = $dbh->prepare($query);
+ $sth->execute;
+ return $sth;
+}
+
#-------------------------------------------------------------#
=head3 GetBookFunds
@@ -377,7 +407,7 @@
bookfundgroup,
branchcode
FROM aqbookfund
- WHERE 1 = 1";
+ WHERE 1 = 1 ";
if ($filter) {
if ($filter_bookfundid) {
@@ -436,18 +466,18 @@
=over 4
-$data = Countbookfund($bookfundid);
+$number = Countbookfund($bookfundid);
this function count the number of bookfund with id given on input arg.
return :
-the result of the SQL query as an hashref.
+the result of the SQL query as a number.
=back
=cut
sub Countbookfund {
- my $bookfundid = @_;
+ my $bookfundid = shift;
my $dbh = C4::Context->dbh;
my $query ="
SELECT COUNT(*)
@@ -456,7 +486,7 @@
";
my $sth = $dbh->prepare($query);
$sth->execute($bookfundid);
- return $sth->fetchrow_hashref;
+ return $sth->fetchrow;
}