3 # Copyright 2000-2002 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.
21 #use warnings; FIXME - Bug 2505
23 use C4
::SQLHelper qw
<:all
>;
26 use vars
qw($VERSION @ISA @EXPORT);
29 # set the version for version checking
46 # -------------------------------------------------------------------
47 my %count_issues_a_year=(
56 my ($class, $opts) = @_;
57 bless $opts => $class;
62 my ($class,$frequency) = @_;
63 return InsertInTable
("subscription_frequency",$frequency);
66 sub GetExpectedissuesayear
{
67 my ($class,$unit,$issuesperunit,$unitperissues) = @_;
68 return Int
($count_issues_a_year{$unit}/$issuesperunit)*$unitperissues;
71 # -------------------------------------------------------------------
73 my ($class,$frequency) = @_;
74 return UpdateInTable
("subscription_frequency",$frequency);
77 # -------------------------------------------------------------------
79 my ($class,$frequency) = @_;
80 return DeleteInTable
("subscription_frequency",$frequency);
85 my $dbh = C4
::Context
->dbh;
86 return map { $class->new($_) } @
{$dbh->selectall_arrayref(
87 # The subscription_frequency table is small enough for
88 # `SELECT *` to be harmless.
89 "SELECT * FROM subscription_frequency ORDER BY description",
98 &GetFrequency($freq_id);
100 gets frequency where $freq_id is the identifier
106 # -------------------------------------------------------------------
109 return undef unless $freq_id;
110 my $results= SearchInTable
("subscription_frequency",{frequency_id
=>$freq_id}, undef, undef,undef, undef, "wide");
111 return undef unless ($results);
115 =head3 GetFrequencies
119 &GetFrequencies($filter, $order_by);
121 gets frequencies restricted on filters
127 # -------------------------------------------------------------------
129 my ($filters,$orderby) = @_;
130 return SearchInTable
("subscription_frequency",$filters, $orderby, undef,undef, undef, "wide");
133 END { } # module clean-up code here (global destructor)
140 Koha Developement team <info@koha.org>