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.
22 use C4::SQLHelper qw<:all>;
25 use vars qw($VERSION @ISA @EXPORT);
28 # set the version for version checking
45 # -------------------------------------------------------------------
46 my %count_issues_a_year=(
55 my ($class, $opts) = @_;
56 bless $opts => $class;
61 my ($class,$frequency) = @_;
62 return InsertInTable("subscription_frequency",$frequency);
65 sub GetExpectedissuesayear {
66 my ($class,$unit,$issuesperunit,$unitperissues) = @_;
67 return Int($count_issues_a_year{$unit}/$issuesperunit)*$unitperissues;
70 # -------------------------------------------------------------------
72 my ($class,$frequency) = @_;
73 return UpdateInTable("subscription_frequency",$frequency);
76 # -------------------------------------------------------------------
78 my ($class,$frequency) = @_;
79 return DeleteInTable("subscription_frequency",$frequency);
84 my $dbh = C4::Context->dbh;
85 return map { $class->new($_) } @{$dbh->selectall_arrayref(
86 # The subscription_frequency table is small enough for
87 # `SELECT *` to be harmless.
88 "SELECT * FROM subscription_frequency ORDER BY description",
97 &GetFrequency($freq_id);
99 gets frequency where $freq_id is the identifier
105 # -------------------------------------------------------------------
108 return undef unless $freq_id;
109 my $results= SearchInTable("subscription_frequency",{frequency_id=>$freq_id}, undef, undef,undef, undef, "wide");
110 return undef unless ($results);
114 =head3 GetFrequencies
118 &GetFrequencies($filter, $order_by);
120 gets frequencies restricted on filters
126 # -------------------------------------------------------------------
128 my ($filters,$orderby) = @_;
129 return SearchInTable("subscription_frequency",$filters, $orderby, undef,undef, undef, "wide");
132 END { } # module clean-up code here (global destructor)
139 Koha Developement team <info@koha.org>