change configuration file layout to support multiple distinct databases (with
[freeside.git] / htdocs / docs / man / cust_pkg.txt
1 NAME
2     FS::cust_pkg - Object methods for cust_pkg objects
3
4 SYNOPSIS
5       use FS::cust_pkg;
6
7       $record = create FS::cust_pkg \%hash;
8       $record = create FS::cust_pkg { 'column' => 'value' };
9
10       $error = $record->insert;
11
12       $error = $new_record->replace($old_record);
13
14       $error = $record->delete;
15
16       $error = $record->check;
17
18       $error = $record->cancel;
19
20       $error = $record->suspend;
21
22       $error = $record->unsuspend;
23
24       $part_pkg = $record->part_pkg;
25
26       $error = FS::cust_pkg::order( $custnum, \@pkgparts );
27       $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );
28
29 DESCRIPTION
30     An FS::cust_pkg object represents a customer billing item.
31     FS::cust_pkg inherits from FS::Record. The following fields are
32     currently supported:
33
34     pkgnum - primary key (assigned automatically for new billing items)
35     custnum - Customer (see the FS::cust_main manpage)
36     pkgpart - Billing item definition (see the FS::part_pkg manpage)
37     setup - date
38     bill - date
39     susp - date
40     expire - date
41     cancel - date
42     otaker - order taker (assigned automatically if null, see the FS::UID manpage)
43     Note: setup, bill, susp, expire and cancel are specified as UNIX
44     timestamps; see the section on "time" in the perlfunc manpage.
45     Also see the Time::Local manpage and the Date::Parse manpage for
46     conversion functions.
47
48 METHODS
49     create HASHREF
50         Create a new billing item. To add the item to the database,
51         see the section on "insert".
52
53     insert
54         Adds this billing item to the database ("Orders" the item).
55         If there is an error, returns the error, otherwise returns
56         false.
57
58     delete
59         Currently unimplemented. You don't want to delete billing
60         items, because there would then be no record the customer
61         ever purchased the item. Instead, see the cancel method.
62
63         sub delete { return "Can't delete cust_pkg records!"; }
64
65     replace OLD_RECORD
66         Replaces the OLD_RECORD with this one in the database. If
67         there is an error, returns the error, otherwise returns
68         false.
69
70         Currently, custnum, setup, bill, susp, expire, and cancel
71         may be changed.
72
73         pkgpart may not be changed, but see the order subroutine.
74
75         setup and bill are normally updated by calling the bill
76         method of a customer object (see the FS::cust_main manpage).
77
78         suspend is normally updated by the suspend and unsuspend
79         methods.
80
81         cancel is normally updated by the cancel method (and also
82         the order subroutine in some cases).
83
84     check
85         Checks all fields to make sure this is a valid billing item.
86         If there is an error, returns the error, otherwise returns
87         false. Called by the insert and replace methods.
88
89     cancel
90         Cancels and removes all services (see the FS::cust_svc
91         manpage and the FS::part_svc manpage) in this package, then
92         cancels the package itself (sets the cancel field to now).
93
94         If there is an error, returns the error, otherwise returns
95         false.
96
97     suspend
98         Suspends all services (see the FS::cust_svc manpage and the
99         FS::part_svc manpage) in this package, then suspends the
100         package itself (sets the susp field to now).
101
102         If there is an error, returns the error, otherwise returns
103         false.
104
105     unsuspend
106         Unsuspends all services (see the FS::cust_svc manpage and
107         the FS::part_svc manpage) in this package, then unsuspends
108         the package itself (clears the susp field).
109
110         If there is an error, returns the error, otherwise returns
111         false.
112
113     part_pkg
114         Returns the definition for this billing item, as an
115         FS::part_pkg object (see L<FS::part_pkg).
116
117 SUBROUTINES
118     order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
119         CUSTNUM is a customer (see the FS::cust_main manpage)
120
121         PKGPARTS is a list of pkgparts specifying the the billing
122         item definitions (see the FS::part_pkg manpage) to order for
123         this customer. Duplicates are of course permitted.
124
125         REMOVE_PKGNUMS is an optional list of pkgnums specifying the
126         billing items to remove for this customer. The services (see
127         the FS::cust_svc manpage) are moved to the new billing
128         items. An error is returned if this is not possible (see the
129         FS::pkg_svc manpage).
130
131 BUGS
132     It doesn't properly override FS::Record yet.
133
134     sub order is not OO. Perhaps it should be moved to FS::cust_main
135     and made so?
136
137     In sub order, the @pkgparts array (passed by reference) is
138     clobbered.
139
140     Also in sub order, no money is adjusted. Once FS::part_pkg
141     defines a standard method to pass dates to the recur_prog
142     expression, it should do so.
143
144 SEE ALSO
145     the FS::Record manpage, the FS::cust_main manpage, the
146     FS::part_pkg manpage, the FS::cust_svc manpage , the FS::pkg_svc
147     manpage, schema.html from the base documentation
148
149 HISTORY
150     ivan@voicenet.com 97-jul-1 - 21
151
152     fixed for new agent->agent_type->type_pkgs in &order
153     ivan@sisd.com 98-mar-7
154
155     pod ivan@sisd.com 98-sep-21
156
157     $Log: cust_pkg.txt,v $
158     Revision 1.2  1998-11-13 09:56:40  ivan
159     change configuration file layout to support multiple distinct databases (with
160     own set of config files, export, etc.)
161  Revision 1.2 1998/11/12 03:42:45 ivan
162     added label method
163