[freeside-commits] branch FREESIDE_2_3_BRANCH updated. ad73c5caef5fb3ea7ba87c575d4784bd76b72ef4
Mark Wells
mark at 420.am
Sun Oct 28 12:33:05 PDT 2012
The branch, FREESIDE_2_3_BRANCH has been updated
via ad73c5caef5fb3ea7ba87c575d4784bd76b72ef4 (commit)
from e5dd9525e20e6a21fce2e5d5170c27efe3db5893 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ad73c5caef5fb3ea7ba87c575d4784bd76b72ef4
Author: Mark Wells <mark at freeside.biz>
Date: Sun Oct 28 12:28:38 2012 -0700
pkgpart in invoice templates, #19907
diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm
index a4947ae..ca421c3 100644
--- a/FS/FS/cust_bill_pkg.pm
+++ b/FS/FS/cust_bill_pkg.pm
@@ -713,9 +713,10 @@ appropriate FS::cust_bill_pkg_display objects.
Options are passed as a list of name/value pairs. Options are:
-part_pkg: FS::part_pkg object from the
+part_pkg: FS::part_pkg object from this line item's package.
-real_pkgpart: if this line item comes from a bundled package, the pkgpart of the owning package. Otherwise the same as the part_pkg's pkgpart above.
+real_pkgpart: if this line item comes from a bundled package, the pkgpart
+of the owning package. Otherwise the same as the part_pkg's pkgpart above.
=cut
@@ -726,13 +727,19 @@ sub set_display {
my $conf = new FS::Conf;
+ # whether to break this down into setup/recur/usage
my $separate = $conf->exists('separate_usage');
+
my $usage_mandate = $part_pkg->option('usage_mandate', 'Hush!')
|| $cust_pkg->part_pkg->option('usage_mandate', 'Hush!');
# or use the category from $opt{'part_pkg'} if its not bundled?
my $categoryname = $cust_pkg->part_pkg->categoryname;
+ # if we don't have to separate setup/recur/usage, or put this in a
+ # package-specific section, or display a usage summary, then don't
+ # even create one of these. The item will just display in the unnamed
+ # section as a single line plus details.
return $self->set('display', [])
unless $separate || $categoryname || $usage_mandate;
@@ -740,34 +747,46 @@ sub set_display {
my %hash = ( 'section' => $categoryname );
+ # whether to put usage details in a separate section, and if so, which one
my $usage_section = $part_pkg->option('usage_section', 'Hush!')
|| $cust_pkg->part_pkg->option('usage_section', 'Hush!');
+ # whether to show a usage summary line (total usage charges, no details)
my $summary = $part_pkg->option('summarize_usage', 'Hush!')
|| $cust_pkg->part_pkg->option('summarize_usage', 'Hush!');
if ( $separate ) {
+ # create lines for setup and (non-usage) recur, in the main section
push @display, new FS::cust_bill_pkg_display { type => 'S', %hash };
push @display, new FS::cust_bill_pkg_display { type => 'R', %hash };
} else {
+ # display everything in a single line
push @display, new FS::cust_bill_pkg_display
{ type => '',
%hash,
+ # and if usage_mandate is enabled, hide details
+ # (this only works on multisection invoices...)
( ( $usage_mandate ) ? ( 'summary' => 'Y' ) : () ),
};
}
if ($separate && $usage_section && $summary) {
+ # create a line for the usage summary in the main section
push @display, new FS::cust_bill_pkg_display { type => 'U',
summary => 'Y',
%hash,
};
}
+
if ($usage_mandate || ($usage_section && $summary) ) {
$hash{post_total} = 'Y';
}
if ($separate || $usage_mandate) {
+ # show call details for this line item in the usage section.
+ # if usage_mandate is on, this will display below the section subtotal.
+ # this also happens if usage is in a separate section and there's a
+ # summary in the main section, though I'm not sure why.
$hash{section} = $usage_section if $usage_section;
push @display, new FS::cust_bill_pkg_display { type => 'U', %hash };
}
diff --git a/FS/FS/cust_bill_pkg_display.pm b/FS/FS/cust_bill_pkg_display.pm
index a864ec1..d7c1472 100644
--- a/FS/FS/cust_bill_pkg_display.pm
+++ b/FS/FS/cust_bill_pkg_display.pm
@@ -27,26 +27,26 @@ FS::cust_bill_pkg_display - Object methods for cust_bill_pkg_display records
=head1 DESCRIPTION
-An FS::cust_bill_pkg_display object represents line item display information.
-FS::cust_bill_pkg_display inherits from FS::Record. The following fields are
-currently supported:
+An FS::cust_bill_pkg_display object represents an instruction to display a
+line item in a specific invoice section. FS::cust_bill_pkg_display inherits
+from FS::Record and is many-to-one with FS::cust_bill_pkg (invoice line
+items).
-=over 4
-
-=item billpkgdisplaynum
+The following fields are currently supported:
-primary key
-
-=item billpkgnum
+=over 4
-billpkgnum
+=item billpkgdisplaynum - primary key
-=item section
+=item billpkgnum - the line item number (L<FS::cust_bill_pkg> foreign key)
-section
+=item section - the section name where this item should be shown. Defaults
+to the package category name, if there is one.
=cut
+# actually it defaults to null, but then calling ->section will return the
+# category name.
sub section {
my ( $self, $value ) = @_;
if ( defined($value) ) {
@@ -64,17 +64,19 @@ sub section {
}
}
-=item post_total
+=item post_total - 'Y' to have this item shown in a "late" section (below
+the invoice totals).
-post_total
+=item type - Which portion of the item's charges to show in the specified
+position. 'S' to show setup fees (including tax and one-time charge),
+'R' to show the non-usage recurring charge, 'U' to show the usage charge,
+null to show all three as a single amount.
-=item type
-
-type
-
-=item summary
-
-summary
+=item summary - 'Y' to show a usage summary of this line item. This has
+the following effects if type = 'U':
+- The description will always be "Usage charges" rather than the package name.
+- Service labels and usage details (CDRs) are hidden.
+- It will only display on multisection invoices.
=back
@@ -84,7 +86,8 @@ summary
=item new HASHREF
-Creates a new line item display object. To add the record to the database, see L<"insert">.
+Creates a new line item display object. To add the record to the database,
+see L<"insert">.
Note that this stores the hash reference, not a distinct copy of the hash it
points to. You can ask the object for a copy with the I<hash> method.
@@ -155,7 +158,6 @@ sub cust_bill_pkg {
=head1 BUGS
-
=head1 SEE ALSO
L<FS::Record>, L<FS::cust_bill_pkg>, schema.html from the base documentation.
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_bill_pkg.pm | 23 +++++++++++++++++-
FS/FS/cust_bill_pkg_display.pm | 48 ++++++++++++++++++++-------------------
2 files changed, 46 insertions(+), 25 deletions(-)
More information about the freeside-commits
mailing list