X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2Fcust_main%2FPackages.pm;h=13c2945b87b88a95d1019c13a64b3d7c9e412acf;hb=a80456f3f7f775cc50d343a7bcaef69e83f96c42;hp=5a14e2e86d10378437e4c52b8b22a316d627b746;hpb=900d4d72315d52f8838f397522e0cae238f38811;p=freeside.git diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index 5a14e2e86..13c2945b8 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -74,6 +74,14 @@ Optional subject for a ticket created and attached to this customer Optional queue name for ticket additions +=item invoice_details + +Optional arrayref of invoice detail strings to add (creates cust_pkg_detail detailtype 'I') + +=item package_comments + +Optional arrayref of package comment strings to add (creates cust_pkg_detail detailtype 'C') + =back =cut @@ -208,6 +216,22 @@ sub order_pkg { } } + # add details/comments + if ($opt->{'invoice_details'}) { + $error = $cust_pkg->set_cust_pkg_detail('I', @{$opt->{'invoice_details'}}); + } + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "setting invoice details: $error"; + } + if ($opt->{'package_comments'}) { + $error = $cust_pkg->set_cust_pkg_detail('C', @{$opt->{'package_comments'}}); + } + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "setting package comments: $error"; + } + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; #no error @@ -410,7 +434,7 @@ sub all_pkgs { my $self = shift; my $extra_qsearch = ref($_[0]) ? shift : { @_ }; - return $self->num_pkgs unless wantarray || keys %$extra_qsearch; + return $self->num_pkgs($extra_qsearch) unless wantarray; my @cust_pkg = (); if ( $self->{'_pkgnum'} && ! keys %$extra_qsearch ) { @@ -440,11 +464,11 @@ Returns all non-cancelled packages (see L) for this customer. sub ncancelled_pkgs { my $self = shift; - my $extra_qsearch = ref($_[0]) ? shift : {}; + my $extra_qsearch = ref($_[0]) ? shift : { @_ }; local($DEBUG) = $FS::cust_main::DEBUG if $FS::cust_main::DEBUG > $DEBUG; - return $self->num_ncancelled_pkgs unless wantarray; + return $self->num_ncancelled_pkgs($extra_qsearch) unless wantarray; my @cust_pkg = (); if ( $self->{'_pkgnum'} ) {