X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fdiscount.pm;h=6771510d0c249c415e2adfe62b943e0afb012cd6;hb=4cacb3fa439b56fc7c9a742b69ec3f6ffd660433;hp=558d0f8814fb19dfe99b7475eaa635b740801d49;hpb=0fcdc36642e1430f02ebf5326740e231883bd41f;p=freeside.git diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm index 558d0f881..6771510d0 100644 --- a/FS/FS/discount.pm +++ b/FS/FS/discount.pm @@ -126,28 +126,38 @@ sub check { $self->SUPER::check; } +=item description_short + =item description Returns a text description incorporating the amount, percent and months fields. +description_short omits term information + =cut -sub description { +sub description_short { my $self = shift; my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; - my $desc = ''; + my $desc = $self->name ? $self->name.': ' : ''; $desc .= $money_char. sprintf('%.2f/month ', $self->amount) if $self->amount > 0; $desc .= $self->percent. '% ' if $self->percent > 0; - $desc .= 'for '. $self->months. ' months' if $self->months; $desc; } +sub description { + my $self = shift; + my $desc = $self->description_short; + $desc .= ' for '. $self->months. ' months' if $self->months; + $desc; +} + =back =head1 BUGS