X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fdocs%2Fman%2Fcust_pkg.txt;h=3954031927b5cacaf7fe06f6b6a0cb8bea1f487a;hb=991f8f1fd45bb229c3d2d28abae7356d94534a03;hp=c5d143dbeac72ad7388cdaefe7be2e4aec8820f1;hpb=0bf5ad9ff0a65195db88ed0bac3aa11c33ec1ad3;p=freeside.git diff --git a/htdocs/docs/man/cust_pkg.txt b/htdocs/docs/man/cust_pkg.txt index c5d143dbe..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; @@ -23,6 +23,8 @@ SYNOPSIS $part_pkg = $record->part_pkg; + @labels = $record->labels; + $error = FS::cust_pkg::order( $custnum, \@pkgparts ); $error = FS::cust_pkg::order( $custnum, \@pkgparts, \@remove_pkgnums ] ); @@ -46,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". @@ -55,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 @@ -70,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). @@ -114,6 +130,11 @@ METHODS Returns the definition for this billing item, as an FS::part_pkg object (see L