X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fdocs%2Fman%2Fcust_pkg.txt;h=3954031927b5cacaf7fe06f6b6a0cb8bea1f487a;hb=991f8f1fd45bb229c3d2d28abae7356d94534a03;hp=5409083d8a23a33ef03e9ffadc04cbf81cf6be68;hpb=08f52e31c5f777963d565085d077c9d8d9734e17;p=freeside.git diff --git a/htdocs/docs/man/cust_pkg.txt b/htdocs/docs/man/cust_pkg.txt index 5409083d8..395403192 100644 --- a/htdocs/docs/man/cust_pkg.txt +++ b/htdocs/docs/man/cust_pkg.txt @@ -4,8 +4,8 @@ NAME SYNOPSIS use FS::cust_pkg; - $record = create FS::cust_pkg \%hash; - $record = create FS::cust_pkg { 'column' => 'value' }; + $record = new FS::cust_pkg \%hash; + $record = new FS::cust_pkg { 'column' => 'value' }; $error = $record->insert; @@ -21,6 +21,10 @@ SYNOPSIS $error = $record->unsuspend; + $part_pkg = $record->part_pkg; + + @labels = $record->labels; + $error = FS::cust_pkg::order( $custnum, \@pkgparts ); $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] ); @@ -44,7 +48,7 @@ DESCRIPTION conversion functions. METHODS - create HASHREF + new HASHREF Create a new billing item. To add the item to the database, see the section on "insert". @@ -53,13 +57,26 @@ METHODS If there is an error, returns the error, otherwise returns false. + sub insert { my $self = shift; + + # custnum might not have have been defined in sub check (for one-shot new + # customers), so check it here instead + + my $error = $self->ut_number('custnum'); + return $error if $error + + return "Unknown customer" + unless qsearchs( 'cust_main', { 'custnum' => $self->custnum } ); + + $self->SUPER::insert; + + } + delete Currently unimplemented. You don't want to delete billing items, because there would then be no record the customer ever purchased the item. Instead, see the cancel method. - sub delete { return "Can't delete cust_pkg records!"; } - replace OLD_RECORD Replaces the OLD_RECORD with this one in the database. If there is an error, returns the error, otherwise returns @@ -68,7 +85,8 @@ METHODS Currently, custnum, setup, bill, susp, expire, and cancel may be changed. - pkgpart may not be changed, but see the order subroutine. + Changing pkgpart may have disasterous effects. See the order + subroutine. setup and bill are normally updated by calling the bill method of a customer object (see the FS::cust_main manpage). @@ -108,6 +126,15 @@ METHODS If there is an error, returns the error, otherwise returns false. + part_pkg + Returns the definition for this billing item, as an + FS::part_pkg object (see L