[freeside-commits] freeside/FS/FS discount.pm,1.6,1.7
Ivan,,,
ivan at wavetail.420.am
Thu Dec 22 16:04:09 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv26349
Modified Files:
discount.pm
Log Message:
fix discount display after mysql schema change fix
Index: discount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/discount.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -d -r1.6 -r1.7
--- discount.pm 29 Apr 2011 12:10:16 -0000 1.6
+++ discount.pm 23 Dec 2011 00:04:07 -0000 1.7
@@ -172,7 +172,10 @@
my $desc = $self->name ? $self->name.': ' : '';
$desc .= $money_char. sprintf('%.2f/month ', $self->amount)
if $self->amount > 0;
- $desc .= $self->percent. '% '
+
+ ( my $percent = $self->percent ) =~ s/\.0+$//;
+ $percent =~ s/(\.\d*[1-9])0+$/$1/;
+ $desc .= $percent. '% '
if $self->percent > 0;
$desc;
@@ -181,8 +184,13 @@
sub description {
my $self = shift;
my $desc = $self->description_short;
- $desc .= ' for '. $self->months. ' months' if $self->months;
+
+ ( my $months = $self->months ) =~ s/\.0+$//;
+ $months =~ s/(\.\d*[1-9])0+$/$1/;
+ $desc .= " for $months months" if $months;
+
$desc .= ', applies to setup' if $self->setup;
+
$desc;
}
More information about the freeside-commits
mailing list