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 $error = FS::cust_pkg::order( $custnum, \@pkgparts );
25 $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] );
28 An FS::cust_pkg object represents a customer billing item.
29 FS::cust_pkg inherits from FS::Record. The following fields are
32 pkgnum - primary key (assigned automatically for new billing items)
33 custnum - Customer (see the FS::cust_main manpage)
34 pkgpart - Billing item definition (see the FS::part_pkg manpage)
40 otaker - order taker (assigned automatically if null, see the FS::UID manpage)
41 Note: setup, bill, susp, expire and cancel are specified as UNIX
42 timestamps; see the section on "time" in the perlfunc manpage.
43 Also see the Time::Local manpage and the Date::Parse manpage for
48 Create a new billing item. To add the item to the database,
49 see the section on "insert".
52 Adds this billing item to the database ("Orders" the item).
53 If there is an error, returns the error, otherwise returns
57 Currently unimplemented. You don't want to delete billing
58 items, because there would then be no record the customer
59 ever purchased the item. Instead, see the cancel method.
61 sub delete { return "Can't delete cust_pkg records!"; }
64 Replaces the OLD_RECORD with this one in the database. If
65 there is an error, returns the error, otherwise returns
68 Currently, custnum, setup, bill, susp, expire, and cancel
71 pkgpart may not be changed, but see the order subroutine.
73 setup and bill are normally updated by calling the bill
74 method of a customer object (see the FS::cust_main manpage).
76 suspend is normally updated by the suspend and unsuspend
79 cancel is normally updated by the cancel method (and also
80 the order subroutine in some cases).
83 Checks all fields to make sure this is a valid billing item.
84 If there is an error, returns the error, otherwise returns
85 false. Called by the insert and replace methods.
88 Cancels and removes all services (see the FS::cust_svc
89 manpage and the FS::part_svc manpage) in this package, then
90 cancels the package itself (sets the cancel field to now).
92 If there is an error, returns the error, otherwise returns
96 Suspends all services (see the FS::cust_svc manpage and the
97 FS::part_svc manpage) in this package, then suspends the
98 package itself (sets the susp field to now).
100 If there is an error, returns the error, otherwise returns
104 Unsuspends all services (see the FS::cust_svc manpage and
105 the FS::part_svc manpage) in this package, then unsuspends
106 the package itself (clears the susp field).
108 If there is an error, returns the error, otherwise returns
112 order CUSTNUM, PKGPARTS_ARYREF, [ REMOVE_PKGNUMS_ARYREF ]
113 CUSTNUM is a customer (see the FS::cust_main manpage)
115 PKGPARTS is a list of pkgparts specifying the the billing
116 item definitions (see the FS::part_pkg manpage) to order for
117 this customer. Duplicates are of course permitted.
119 REMOVE_PKGNUMS is an optional list of pkgnums specifying the
120 billing items to remove for this customer. The services (see
121 the FS::cust_svc manpage) are moved to the new billing
122 items. An error is returned if this is not possible (see the
123 FS::pkg_svc manpage).
126 It doesn't properly override FS::Record yet.
128 sub order is not OO. Perhaps it should be moved to FS::cust_main
131 In sub order, the @pkgparts array (passed by reference) is
134 Also in sub order, no money is adjusted. Once FS::part_pkg
135 defines a standard method to pass dates to the recur_prog
136 expression, it should do so.
139 the FS::Record manpage, the FS::cust_main manpage, the
140 FS::part_pkg manpage, the FS::cust_svc manpage , the FS::pkg_svc
141 manpage, schema.html from the base documentation
144 ivan@voicenet.com 97-jul-1 - 21
146 fixed for new agent->agent_type->type_pkgs in &order
147 ivan@sisd.com 98-mar-7
149 pod ivan@sisd.com 98-sep-21