add part_pkg_msgcat, RT#19906
[freeside.git] / FS / FS / part_pkg_msgcat.pm
1 package FS::part_pkg_msgcat;
2
3 use strict;
4 use base qw( FS::Record );
5 use FS::Locales;
6 #use FS::Record qw( qsearch qsearchs );
7 use FS::part_pkg;
8
9 =head1 NAME
10
11 FS::part_pkg_msgcat - Object methods for part_pkg_msgcat records
12
13 =head1 SYNOPSIS
14
15   use FS::part_pkg_msgcat;
16
17   $record = new FS::part_pkg_msgcat \%hash;
18   $record = new FS::part_pkg_msgcat { 'column' => 'value' };
19
20   $error = $record->insert;
21
22   $error = $new_record->replace($old_record);
23
24   $error = $record->delete;
25
26   $error = $record->check;
27
28 =head1 DESCRIPTION
29
30 An FS::part_pkg_msgcat object represents localized labels of a package
31 definition.  FS::part_pkg_msgcat inherits from FS::Record.  The following
32 fields are currently supported:
33
34 =over 4
35
36 =item pkgpartmsgnum
37
38 primary key
39
40 =item pkgpart
41
42 Package definition
43
44 =item locale
45
46 locale
47
48 =item pkg
49
50 Localized package name (customer-viewable)
51
52 =item comment
53
54 Localized package comment (non-customer-viewable), optional
55
56 =back
57
58 =head1 METHODS
59
60 =over 4
61
62 =item new HASHREF
63
64 Creates a new record.  To add the record to the database, see L<"insert">.
65
66 Note that this stores the hash reference, not a distinct copy of the hash it
67 points to.  You can ask the object for a copy with the I<hash> method.
68
69 =cut
70
71 # the new method can be inherited from FS::Record, if a table method is defined
72
73 sub table { 'part_pkg_msgcat'; }
74
75 =item insert
76
77 Adds this record to the database.  If there is an error, returns the error,
78 otherwise returns false.
79
80 =cut
81
82 # the insert method can be inherited from FS::Record
83
84 =item delete
85
86 Delete this record from the database.
87
88 =cut
89
90 # the delete method can be inherited from FS::Record
91
92 =item replace OLD_RECORD
93
94 Replaces the OLD_RECORD with this one in the database.  If there is an error,
95 returns the error, otherwise returns false.
96
97 =cut
98
99 # the replace method can be inherited from FS::Record
100
101 =item check
102
103 Checks all fields to make sure this is a valid record.  If there is
104 an error, returns the error, otherwise returns false.  Called by the insert
105 and replace methods.
106
107 =cut
108
109 # the check method should currently be supplied - FS::Record contains some
110 # data checking routines
111
112 sub check {
113   my $self = shift;
114
115   my $error = 
116     $self->ut_numbern('pkgpartmsgnum')
117     || $self->ut_foreign_key('pkgpart', 'part_pkg', 'pkgpart')
118     || $self->ut_enum('locale', [ FS::Locales->locales ] )
119     || $self->ut_text('pkg')
120     || $self->ut_textn('comment')
121   ;
122   return $error if $error;
123
124   $self->SUPER::check;
125 }
126
127 =back
128
129 =head1 BUGS
130
131 =head1 SEE ALSO
132
133 L<FS::Record>, schema.html from the base documentation.
134
135 =cut
136
137 1;
138