Fix FSF address in directory admin/
[koha.git] / C4 / Serials / NumberPattern.pm
blobb61db88115cf901d946669013848049f6b60fabd
1 package C4::Numberpattern;
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
10 # version.
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 with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
20 use strict;
21 use C4::Context;
22 use C4::SQLHelper qw<:all>;
23 use C4::Debug;
25 use vars qw($VERSION @ISA @EXPORT);
27 BEGIN {
28 # set the version for version checking
29 $VERSION = 3.01;
30 require Exporter;
31 @ISA = qw(Exporter);
32 @EXPORT = qw(
34 &GetNumberpatterns
35 &GetNumberpattern
36 &new
37 &all
38 &AddNumberpattern
39 &ModNumberpattern
40 &DelNumberpattern
45 # -------------------------------------------------------------------
46 sub new {
47 my ($class, $opts) = @_;
48 bless $opts => $class;
52 sub AddNumberpattern {
53 my ($class,$numberpattern) = @_;
54 return InsertInTable("subscription_numberpattern",$numberpattern);
57 # -------------------------------------------------------------------
58 sub ModNumberpattern {
59 my ($class,$numberpattern) = @_;
60 return UpdateInTable("subscription_numberpattern",$numberpattern);
63 # -------------------------------------------------------------------
64 sub DelNumberpattern {
65 my ($class,$numberpattern) = @_;
66 return DeleteInTable("subscription_numberpattern",$numberpattern);
69 sub all {
70 my ($class) = @_;
71 my $dbh = C4::Context->dbh;
72 return map { $class->new($_) } @{$dbh->selectall_arrayref(
73 # The subscription_numberpattern table is small enough for
74 # `SELECT *` to be harmless.
75 "SELECT * FROM subscription_numberpattern ORDER BY description",
76 { Slice => {} },
77 )};
80 =head3 GetNumberpattern
82 =over 4
84 &GetNumberpattern($freq_id);
86 gets numberpattern where $freq_id is the identifier
88 =back
90 =cut
92 # -------------------------------------------------------------------
93 sub GetNumberpattern {
94 my ($numpattern_id) = @_;
95 return undef unless $num_patternid;
96 my $results= SearchInTable("subscription_numberpattern",{numberpattern_id=>$freq_id}, undef, undef,undef, undef, "wide");
97 return undef unless ($results);
98 return $$results[0];
101 =head3 GetFrequencies
103 =over 4
105 &GetFrequencies($filter, $order_by);
107 gets frequencies restricted on filters
109 =back
111 =cut
113 # -------------------------------------------------------------------
114 sub GetNumberPatterns {
115 my ($filters,$orderby) = @_;
116 return SearchInTable("subscription_numberpattern",$filters, $orderby, undef,undef, undef, "wide");
119 END { } # module clean-up code here (global destructor)
122 __END__
124 =head1 AUTHOR
126 Koha Developement team <info@koha.org>
128 =cut