2 FS::cust_pkg - Object methods for cust_pkg objects
7 $record = create FS::cust_pkg \%hash;
8 $record = create FS::cust_pkg { 'column' => 'value' };
10 $error = $record->insert;
12 $error = $new_record->replace($old_record);
14 $error = $record->delete;
16 $error = $record->check;
18 $error = $record->cancel;
20 $error = $record->suspend;
22 $error = $record->unsuspend;
24 $part_pkg = $record->part_pkg;
26 $error = FS::cust_pkg::order( $custnum, \@pkgparts );
27 $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );
30 An FS::cust_pkg object represents a customer billing item.
31 FS::cust_pkg inherits from FS::Record. The following fields are
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)
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
50 Create a new billing item. To add the item to the database,
51 see the section on "insert".
54 Adds this billing item to the database ("Orders" the item).
55 If there is an error, returns the error, otherwise returns
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.
63 sub delete { return "Can't delete cust_pkg records!"; }
66 Replaces the OLD_RECORD with this one in the database. If
67 there is an error, returns the error, otherwise returns
70 Currently, custnum, setup, bill, susp, expire, and cancel
73 pkgpart may not be changed, but see the order subroutine.
75 setup and bill are normally updated by calling the bill
76 method of a customer object (see the FS::cust_main manpage).
78 suspend is normally updated by the suspend and unsuspend
81 cancel is normally updated by the cancel method (and also
82 the order subroutine in some cases).
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.
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).
94 If there is an error, returns the error, otherwise returns
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).
102 If there is an error, returns the error, otherwise returns
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).
110 If there is an error, returns the error, otherwise returns
114 Returns the definition for this billing item, as an
115 FS::part_pkg object (see L<FS::part_pkg).
118 order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
119 CUSTNUM is a customer (see the FS::cust_main manpage)
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.
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).
132 It doesn't properly override FS::Record yet.
134 sub order is not OO. Perhaps it should be moved to FS::cust_main
137 In sub order, the @pkgparts array (passed by reference) is
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.
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
150 ivan@voicenet.com 97-jul-1 - 21
152 fixed for new agent->agent_type->type_pkgs in &order
153 ivan@sisd.com 98-mar-7
155 pod ivan@sisd.com 98-sep-21
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