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