replace references to defunct info email address
[koha.git] / C4 / Serials / NumberPattern.pm
1 package C4::Numberpattern;
2
3 # Copyright 2000-2002 Biblibre SARL
4 #
5 # This file is part of Koha.
6 #
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.
11 #
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.
15 #
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.
19
20 use strict;
21 #use warnings; FIXME - Bug 2505
22 use C4::Context;
23 use C4::SQLHelper qw<:all>;
24 use C4::Debug;
25
26 use vars qw($VERSION @ISA @EXPORT);
27
28 BEGIN {
29         # set the version for version checking
30         $VERSION = 3.01;
31         require Exporter;
32         @ISA    = qw(Exporter);
33         @EXPORT = qw(
34
35         &GetNumberpatterns
36         &GetNumberpattern
37                 &new
38                 &all
39             &AddNumberpattern
40         &ModNumberpattern
41         &DelNumberpattern
42
43         );
44 }
45
46 # -------------------------------------------------------------------
47 sub new {
48     my ($class, $opts) = @_;
49     bless $opts => $class;
50 }
51
52
53 sub AddNumberpattern {
54     my ($class,$numberpattern) = @_;
55         return InsertInTable("subscription_numberpattern",$numberpattern);
56 }
57
58 # -------------------------------------------------------------------
59 sub ModNumberpattern {
60     my ($class,$numberpattern) = @_;
61         return UpdateInTable("subscription_numberpattern",$numberpattern);
62 }
63
64 # -------------------------------------------------------------------
65 sub DelNumberpattern {
66         my ($class,$numberpattern) = @_;
67         return DeleteInTable("subscription_numberpattern",$numberpattern);
68 }
69
70 sub all {
71     my ($class) = @_;
72     my $dbh = C4::Context->dbh;
73     return    map { $class->new($_) }    @{$dbh->selectall_arrayref(
74         # The subscription_numberpattern table is small enough for
75         # `SELECT *` to be harmless.
76         "SELECT * FROM subscription_numberpattern ORDER BY description",
77         { Slice => {} },
78     )};
79 }
80
81 =head3 GetNumberpattern
82
83 =over 4
84
85 &GetNumberpattern($freq_id);
86
87 gets numberpattern where $freq_id is the identifier
88
89 =back
90
91 =cut
92
93 # -------------------------------------------------------------------
94 sub GetNumberpattern {
95     my ($numpattern_id) = @_;
96         return undef unless $num_patternid;
97     my $results= SearchInTable("subscription_numberpattern",{numberpattern_id=>$freq_id}, undef, undef,undef, undef, "wide");
98         return undef unless ($results);
99         return $$results[0];
100 }
101
102 =head3 GetFrequencies
103
104 =over 4
105
106 &GetFrequencies($filter, $order_by);
107
108 gets frequencies restricted on filters
109
110 =back
111
112 =cut
113
114 # -------------------------------------------------------------------
115 sub GetNumberPatterns {
116     my ($filters,$orderby) = @_;
117     return SearchInTable("subscription_numberpattern",$filters, $orderby, undef,undef, undef, "wide");
118 }
119
120 END { }    # module clean-up code here (global destructor)
121
122 1;
123 __END__
124
125 =head1 AUTHOR
126
127 Koha Development Team <http://koha-community.org/>
128
129 =cut