[freeside-commits] branch FREESIDE_3_BRANCH updated. 71ec18a5da6072ae52bcbcca22b4ef7a5290f7ba
Ivan
ivan at 420.am
Thu Jun 29 13:40:58 PDT 2017
The branch, FREESIDE_3_BRANCH has been updated
via 71ec18a5da6072ae52bcbcca22b4ef7a5290f7ba (commit)
from 70cc4f4c76ea1e320f2d6d4cccc0f056bf2af537 (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 71ec18a5da6072ae52bcbcca22b4ef7a5290f7ba
Author: Ivan Kohler <ivan at freeside.biz>
Date: Thu Jun 29 13:40:55 2017 -0700
show a total range for prorate quotations
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index c8b419d..652756e 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -1156,14 +1156,27 @@ sub print_generic {
if ( $invoice_data{finance_section} &&
$section->{'description'} eq $invoice_data{finance_section} );
- $section->{'subtotal'} = $other_money_char.
- sprintf('%.2f', $section->{'subtotal'})
- if $multisection;
+ if ( $multisection ) {
+
+ if ( ref($section->{'subtotal'}) ) {
+
+ $section->{'subtotal'} =
+ sprintf("$other_money_char%.2f to $other_money_char%.2f",
+ $section->{'subtotal'}[0],
+ $section->{'subtotal'}[1]
+ );
+
+ } else {
+
+ $section->{'subtotal'} = $other_money_char.
+ sprintf('%.2f', $section->{'subtotal'})
- # continue some normalization
- $section->{'amount'} = $section->{'subtotal'}
- if $multisection;
+ }
+ # continue some normalization
+ $section->{'amount'} = $section->{'subtotal'}
+
+ }
if ( $section->{'description'} ) {
push @buf, ( [ &$escape_function($section->{'description'}), '' ],
diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm
index e2f6f02..1a6641f 100644
--- a/FS/FS/quotation.pm
+++ b/FS/FS/quotation.pm
@@ -133,8 +133,9 @@ sub check {
$self->usernum($FS::CurrentUser::CurrentUser->usernum) unless $self->usernum;
- return 'confidence must be an integer between 1 and 100'
- if length($self->confidence) && (($self->confidence < 1) || ($self->confidence > 100));
+ return 'confidence percentage must be an integer between 1 and 100'
+ if length($self->confidence)
+ && ( ($self->confidence < 1) || ($self->confidence > 100) );
return 'prospectnum or custnum must be specified'
if ! $self->prospectnum
@@ -364,9 +365,8 @@ sub _items_total {
'total_amount' => sprintf('%.2f',$total_recur),
'break_after' => 1,
};
- # show 'first payment' line (setup + recur) if there are no prorated
- # packages included
- my $disable_total = 0;
+
+ my $prorate_total = 0;
foreach my $quotation_pkg ($self->quotation_pkg) {
my $part_pkg = $quotation_pkg->part_pkg;
if ( $part_pkg->plan =~ /^(prorate|torrus|agent$)/
@@ -376,17 +376,27 @@ sub _items_total {
&& $self->cust_main->billing_pkgs #num_billing_pkgs when we have it
)
) {
- $disable_total = 1;
+ $prorate_total = 1;
last;
}
}
- if (!$disable_total) {
+
+ if ( $prorate_total ) {
+ push @items, {
+ 'total_item' => $self->mt('First payment (depending on day of month)'),
+ 'total_amount' => [ sprintf('%.2f', $total_setup),
+ sprintf('%.2f', $total_setup + $total_recur)
+ ],
+ 'break_after' => 1,
+ };
+ } else {
push @items, {
'total_item' => $self->mt('First payment'),
'total_amount' => sprintf('%.2f', $total_setup + $total_recur),
'break_after' => 1,
};
}
+
}
return @items;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/Template_Mixin.pm | 25 +++++++++++++++++++------
FS/FS/quotation.pm | 24 +++++++++++++++++-------
2 files changed, 36 insertions(+), 13 deletions(-)
More information about the freeside-commits
mailing list