3 # Copyright 2009-2010 BibLibre SARL
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #use warnings; FIXME - Bug 2505
24 use C4::SQLHelper qw(:all);
26 use vars qw($VERSION @ISA @EXPORT);
29 # set the version for version checking
30 $VERSION = 3.07.00.049;
44 C4::Contract - Koha functions for dealing with bookseller contracts.
52 The functions in this module deal with contracts. They allow to
53 add a new contract, to modify it or to get some informations around
61 $contractlist = GetContracts({
62 booksellerid => $booksellerid,
63 activeonly => $activeonly
66 Looks up the contracts that belong to a bookseller
68 Returns a list of contracts
72 =item C<$booksellerid> is the "id" field in the "aqbooksellers" table.
74 =item C<$activeonly> if exists get only contracts that are still active.
82 my $booksellerid = $params->{booksellerid};
83 my $activeonly = $params->{activeonly};
85 my $dbh = C4::Context->dbh;
86 my $query = "SELECT * FROM aqcontract";
89 $query .= " WHERE booksellerid=?";
92 $query .= " AND contractenddate >= CURDATE( )";
95 $result_set = $dbh->selectall_arrayref( $query, { Slice => {} }, $booksellerid );
98 $result_set = $dbh->selectall_arrayref( $query, { Slice => {} } );
106 $contract = GetContract( { contractnumber => $contractnumber } );
108 Looks up the contract that has PRIMKEY (contractnumber) value $contractID
116 my $contractno = $params->{contractnumber};
118 my $dbh = C4::Context->dbh;
119 my $query = "SELECT * FROM aqcontract WHERE contractnumber=?";
121 my $sth = $dbh->prepare($query);
122 $sth->execute($contractno);
123 my $result = $sth->fetchrow_hashref;
128 #sub GetContract { SearchInTable("aqcontract", shift); }
130 sub AddContract { InsertInTable("aqcontract", shift); }
132 sub ModContract { UpdateInTable("aqcontract", shift); }
134 sub DelContract { DeleteInTable("aqcontract", shift); }
142 Koha Development Team <http://koha-community.org/>