From 315ffb86414145b95f2541db8f9d89c1f7e71e3f Mon Sep 17 00:00:00 2001 From: Alex Brelsfoard Date: Tue, 27 Jan 2015 16:36:47 -0500 Subject: rt #28256 --- httemplate/edit/part_pkg.cgi | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index c4db83aee..778a0265e 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -959,7 +959,21 @@ my $html_bottom = sub { my @fields = exists($plans{$layer}->{'fieldorder'}) ? @{$plans{$layer}->{'fieldorder'}} : keys %{ $href }; - + + # hash of dependencies for each of the Pricing Plan fields. + # make sure NOT to use double-quotes inside the 'msg' value. + my $dependencies = { + 'unused_credit_suspend' => { + 'msg' => q|You must set the 'suspend_credit_type' option in Configuration->Settings to gain access to this option.|, + 'are_met' => sub{ + my $conf = new FS::conf; + my @suspend_credit_type_conf = qsearch('conf', { 'name' => 'suspend_credit_type' } ); + return 1 if (exists($suspend_credit_type_conf[0]) && $suspend_credit_type_conf[0]->{Hash}{value}); + return 0; + } + } + }; + foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) { if(!exists($href->{$field})) { @@ -981,7 +995,10 @@ my $html_bottom = sub { #XXX these should use elements/ fields... (or this whole thing should #just use layer_fields instead of layer_callback) - if ( ! exists($href->{$field}{'type'}) ) { + if (exists($dependencies->{$field}) && !$dependencies->{$field}{'are_met'}()) { + $html .= q!N/A!; + + } elsif ( ! exists($href->{$field}{'type'}) ) { $html .= qq!config('invoice_from'); + my $from = $conf->config('invoice_from_name') ? + $conf->config('invoice_from_name') . ' <' . + $conf->config('invoice_from') . '>' : + $conf->config('invoice_from'); my $outbuf = '';; my( $fs_interp, $rt_interp ) = mason_interps('standalone', 'outbuf'=>\$outbuf); diff --git a/FS/FS/Cron/upload.pm b/FS/FS/Cron/upload.pm index 03ed366e2..fa1762f51 100644 --- a/FS/FS/Cron/upload.pm +++ b/FS/FS/Cron/upload.pm @@ -508,7 +508,10 @@ sub prepare_report { ( to => $to, - from => $conf->config('invoice_from', $agentnum), + from => $conf->config('invoice_from_name', $agentnum) ? + $conf->config('invoice_from_name', $agentnum) . ' <' . + $conf->config('invoice_from', $agentnum) . '>' : + $conf->config('invoice_from', $agentnum), subject => $subject, body => $body, ); diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index f597058ef..036c32d4e 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -255,9 +255,9 @@ sub send_email { push @to, $options{bcc} if defined($options{bcc}); local $@; # just in case - eval { sendmail($message, { transport => $transport, - from => $from, - to => \@to }) }; +# eval { sendmail($message, { transport => $transport, +# from => $from, +# to => \@to }) }; my $error = ''; if(ref($@) and $@->isa('Email::Sender::Failure')) { diff --git a/FS/FS/Upgrade.pm b/FS/FS/Upgrade.pm index 381fd5fc5..5d092ed65 100644 --- a/FS/FS/Upgrade.pm +++ b/FS/FS/Upgrade.pm @@ -46,6 +46,22 @@ sub upgrade_config { my $conf = new FS::Conf; + if ($conf->config('invoice_from') =~ /\<(.*)\>/) { + my $realemail = $1; + $realemail =~ s/^\s*//; # remove leading spaces + $realemail =~ s/\s*$//; # remove trailing spaces + my $realname = $conf->config('invoice_from'); + $realname =~ s/\<.*\>//; # remove email address + $realname =~ s/^\s*//; # remove leading spaces + $realname =~ s/\s*$//; # remove trailing spaces + # properly quote names that contain punctuation + if (($realname =~ /[^[:alnum:][:space:]]/) && ($realname !~ /^\".*\"$/)) { + $realname = '"' . $realname . '"'; + } + $conf->set('invoice_from_name', $realname); + $conf->set('invoice_from', $realemail); + } + $conf->touch('payment_receipt') if $conf->exists('payment_receipt_email') || $conf->config('payment_receipt_msgnum'); diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index bcfbbc73f..6ded57fac 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1085,6 +1085,9 @@ sub email { # this is where we set the From: address $from ||= $self->_agent_invoice_from || #XXX should go away + $conf->config('invoice_from_name', $self->cust_main->agentnum ) ? + $conf->config('invoice_from_name', $self->cust_main->agentnum ) . ' <' . + $conf->config('invoice_from', $self->cust_main->agentnum ) . '>' : $conf->config('invoice_from', $self->cust_main->agentnum ); my @invoicing_list = $self->cust_main->invoicing_list_emailonly; diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index df2a6cc19..6f4f720c2 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -282,7 +282,10 @@ sub delete { my $cust_main = $self->cust_main; my $error = send_email( - 'from' => $conf->config('invoice_from', $self->cust_main->agentnum), + 'from' => $conf->config('invoice_from_name', $self->cust_main->agentnum) ? + $conf->config('invoice_from_name', $self->cust_main->agentnum) . ' <' . + $conf->config('invoice_from', $self->cust_main->agentnum) . '>' : + $conf->config('invoice_from', $self->cust_main->agentnum), #invoice_from??? well as good as any 'to' => $conf->config('deletecredits'), 'subject' => 'FREESIDE NOTIFICATION: Credit deleted', diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9f9562059..e4766f52b 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -4327,7 +4327,10 @@ sub notify { return unless $conf->exists($template); - my $from = $conf->config('invoice_from', $self->agentnum) + my $from = $conf->config('invoice_from_name', $self->agentnum) ? + $conf->config('invoice_from_name', $self->agentnum) . ' <' . + $conf->config('invoice_from', $self->agentnum) . '>' : + $conf->config('invoice_from', $self->agentnum) if $conf->exists('invoice_from', $self->agentnum); $from = $options{from} if exists($options{from}); diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm index 330a4547b..f9f375494 100644 --- a/FS/FS/cust_main/Billing_Realtime.pm +++ b/FS/FS/cust_main/Billing_Realtime.pm @@ -1109,7 +1109,10 @@ sub _realtime_bop_result { }; my $error = send_email( - 'from' => $conf->config('invoice_from', $self->agentnum ), + 'from' => $conf->config('invoice_from_name', $self->agentnum ) ? + $conf->config('invoice_from_name', $self->agentnum ) . ' <' . + $conf->config('invoice_from', $self->agentnum ) . '>' : + $conf->config('invoice_from', $self->agentnum ), 'to' => [ grep { $_ ne 'POST' } $self->invoicing_list ], 'subject' => 'Your payment could not be processed', 'body' => [ $template->fill_in(HASH => $templ_hash) ], diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 87fad02f1..0020a824d 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -694,7 +694,10 @@ sub send_receipt { 'msgtype' => 'receipt', }; $error = $queue->insert( - 'from' => $conf->config('invoice_from', $cust_main->agentnum), + 'from' => $conf->config('invoice_from_name', $cust_main->agentnum ) ? + $conf->config('invoice_from_name', $cust_main->agentnum ) . ' <' . + $conf->config('invoice_from', $cust_main->agentnum ) . '>' : + $conf->config('invoice_from', $cust_main->agentnum ), #invoice_from??? well as good as any 'to' => \@invoicing_list, 'subject' => 'Payment receipt', diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 5c82ad2cd..ccf63db23 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -947,7 +947,10 @@ sub cancel { } else { $error = send_email( - 'from' => $conf->config('invoice_from', $self->cust_main->agentnum), + 'from' => $conf->config('invoice_from_name', $self->cust_main->agentnum) ? + $conf->config('invoice_from_name', $self->cust_main->agentnum) . ' <' . + $conf->config('invoice_from', $self->cust_main->agentnum) . '>' : + $conf->config('invoice_from', $self->cust_main->agentnum), 'to' => \@invoicing_list, 'subject' => ( $conf->config('cancelsubject') || 'Cancellation Notice' ), 'body' => [ map "$_\n", $conf->config('cancelmessage') ], diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 65890e125..70a8e49ea 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -398,8 +398,10 @@ sub prepare { $from_addr = scalar( $conf->config($opt{'from_config'}, $cust_main->agentnum) ); } - $from_addr ||= scalar( $conf->config('invoice_from', - $cust_main->agentnum) ); + $from_addr ||= $conf->config('invoice_from_name', $cust_main->agentnum) ? + $conf->config('invoice_from_name', $cust_main->agentnum) . ' <' . + $conf->config('invoice_from', $cust_main->agentnum) . '>' : + $conf->config('invoice_from', $cust_main->agentnum); } # my @cust_msg = (); # if ( $conf->exists('log_sent_mail') and !$opt{'preview'} ) { diff --git a/FS/FS/pay_batch.pm b/FS/FS/pay_batch.pm index b6b69f3ad..3079db10f 100644 --- a/FS/FS/pay_batch.pm +++ b/FS/FS/pay_batch.pm @@ -749,7 +749,10 @@ sub import_from_gateway { my $body = "Import from gateway ".$gateway->label."\n".$error_text; send_email( to => $mail_on_error, - from => $conf->config('invoice_from'), + from => $conf->config('invoice_from_name') ? + $conf->config('invoice_from_name') . ' <' . + $conf->config('invoice_from') . '>' : + $conf->config('invoice_from'), subject => $subject, body => $body, ); diff --git a/FS/FS/quotation.pm b/FS/FS/quotation.pm index 75a592d70..774495a97 100644 --- a/FS/FS/quotation.pm +++ b/FS/FS/quotation.pm @@ -183,8 +183,10 @@ sub email { # this is where we set the From: address $from ||= $conf->config('quotation_from', $self->cust_or_prospect->agentnum ) - || $conf->config('invoice_from', $self->cust_or_prospect->agentnum ); - + || ($conf->config('invoice_from_name', $self->cust_or_prospect->agentnum ) ? + $conf->config('invoice_from_name', $self->cust_or_prospect->agentnum ) . ' <' . + $conf->config('invoice_from', $self->cust_or_prospect->agentnum ) . '>' : + $conf->config('invoice_from', $self->cust_or_prospect->agentnum )); $self->SUPER::email( { 'from' => $from, %$opt, diff --git a/FS/FS/upload_target.pm b/FS/FS/upload_target.pm index 33088cbd2..73d2a04c3 100644 --- a/FS/FS/upload_target.pm +++ b/FS/FS/upload_target.pm @@ -163,7 +163,10 @@ sub put { # (maybe use only the raw content, so that we don't have to supply a # customer for substitutions? ewww.) my %message = ( - 'from' => $conf->config('invoice_from'), + 'from' => $conf->config('invoice_from_name') ? + $conf->config('invoice_from_name') . ' <' . + $conf->config('invoice_from') . '>' : + $conf->config('invoice_from'), 'to' => $to, 'subject' => $self->subject, 'nobody' => 1, diff --git a/Makefile b/Makefile index 67bf83c09..b3b556cae 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DB_TYPE = Pg #DB_TYPE = mysql DB_USER = freeside -DB_PASSWORD= +DB_PASSWORD=hRoVj902 DATASOURCE = DBI:${DB_TYPE}:dbname=freeside @@ -27,9 +27,9 @@ MASONDATA = ${FREESIDE_CACHE}/masondata DIST_CONF = ${FREESIDE_CONF}/default_conf #mod_perl v2 1.999_22 on Apache 2.0 through 2.3 (Debian ancient through 7.x) -#APACHE_VERSION=2 +APACHE_VERSION=2 #Apache 2.4 (Debian 8.x) -APACHE_VERSION=2.4 +#APACHE_VERSION=2.4 #deb FREESIDE_DOCUMENT_ROOT = /var/www/freeside @@ -71,9 +71,9 @@ HTTPD_RESTART = /etc/init.d/apache2 restart #(an include directory, not a file, "Include /etc/apache/conf.d" in httpd.conf) #debian unstable/8.0+, apache2.4 -APACHE_CONF = /etc/apache2/conf-available +#APACHE_CONF = /etc/apache2/conf-available #deb (3.1+), apache2 -#APACHE_CONF = /etc/apache2/conf.d +APACHE_CONF = /etc/apache2/conf.d INSSERV_OVERRIDE = /etc/insserv/overrides @@ -103,10 +103,10 @@ SELFSERVICE_INSTALL_USERADD = /usr/sbin/useradd #RT_ENABLED = 0 RT_ENABLED = 1 -RT_DOMAIN = example.com -RT_TIMEZONE = US/Pacific +RT_DOMAIN = localhost +RT_TIMEZONE = US/Central #RT_TIMEZONE = US/Eastern -FREESIDE_URL = "http://192.168.1.6/freeside/" +FREESIDE_URL = "http://localhost/freeside/" #for now, same db as specified in DATASOURCE... eventually, otherwise? RT_DB_DATABASE = freeside diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 15926308e..c74c15b1e 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -103,7 +103,8 @@ Template: <& /elements/tr-td-label.html, 'label' => 'From:' &> <& /elements/input-text.html, 'field' => 'from_name', - 'value' => $conf->config('company_name', $agent_virt_agentnum), #? + 'value' => $conf->config('invoice_from_name', $agent_virt_agentnum) || + $conf->config('company_name', $agent_virt_agentnum), #? 'size' => 20, &> <\ <& /elements/input-text.html, -- cgit v1.2.1 From 8d5e4e82f9ddcc1697d9ac94bfbc4a5bbe3c5caf Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 27 Jan 2015 16:46:18 -0600 Subject: Fixing accidental commit --- FS/FS/Misc.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index 036c32d4e..f597058ef 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -255,9 +255,9 @@ sub send_email { push @to, $options{bcc} if defined($options{bcc}); local $@; # just in case -# eval { sendmail($message, { transport => $transport, -# from => $from, -# to => \@to }) }; + eval { sendmail($message, { transport => $transport, + from => $from, + to => \@to }) }; my $error = ''; if(ref($@) and $@->isa('Email::Sender::Failure')) { -- cgit v1.2.1 From c21244410514448a34d732c802ca1d3325448dff Mon Sep 17 00:00:00 2001 From: Jonathan Prykop Date: Tue, 27 Jan 2015 17:10:42 -0600 Subject: Fixing accidental commit --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index b3b556cae..67bf83c09 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ DB_TYPE = Pg #DB_TYPE = mysql DB_USER = freeside -DB_PASSWORD=hRoVj902 +DB_PASSWORD= DATASOURCE = DBI:${DB_TYPE}:dbname=freeside @@ -27,9 +27,9 @@ MASONDATA = ${FREESIDE_CACHE}/masondata DIST_CONF = ${FREESIDE_CONF}/default_conf #mod_perl v2 1.999_22 on Apache 2.0 through 2.3 (Debian ancient through 7.x) -APACHE_VERSION=2 +#APACHE_VERSION=2 #Apache 2.4 (Debian 8.x) -#APACHE_VERSION=2.4 +APACHE_VERSION=2.4 #deb FREESIDE_DOCUMENT_ROOT = /var/www/freeside @@ -71,9 +71,9 @@ HTTPD_RESTART = /etc/init.d/apache2 restart #(an include directory, not a file, "Include /etc/apache/conf.d" in httpd.conf) #debian unstable/8.0+, apache2.4 -#APACHE_CONF = /etc/apache2/conf-available +APACHE_CONF = /etc/apache2/conf-available #deb (3.1+), apache2 -APACHE_CONF = /etc/apache2/conf.d +#APACHE_CONF = /etc/apache2/conf.d INSSERV_OVERRIDE = /etc/insserv/overrides @@ -103,10 +103,10 @@ SELFSERVICE_INSTALL_USERADD = /usr/sbin/useradd #RT_ENABLED = 0 RT_ENABLED = 1 -RT_DOMAIN = localhost -RT_TIMEZONE = US/Central +RT_DOMAIN = example.com +RT_TIMEZONE = US/Pacific #RT_TIMEZONE = US/Eastern -FREESIDE_URL = "http://localhost/freeside/" +FREESIDE_URL = "http://192.168.1.6/freeside/" #for now, same db as specified in DATASOURCE... eventually, otherwise? RT_DB_DATABASE = freeside -- cgit v1.2.1 From 05889be74afd7e845b24ed75252026a466fe1ff2 Mon Sep 17 00:00:00 2001 From: Alex Brelsfoard Date: Tue, 27 Jan 2015 19:24:04 -0500 Subject: RT #29800: converting the DID range from numeric to string to maintain leading zeroes --- httemplate/edit/process/bulk-svc_phone.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httemplate/edit/process/bulk-svc_phone.html b/httemplate/edit/process/bulk-svc_phone.html index 5a1fbc647..db486de76 100644 --- a/httemplate/edit/process/bulk-svc_phone.html +++ b/httemplate/edit/process/bulk-svc_phone.html @@ -25,7 +25,7 @@ my $num_avail = $1; errorpage("There are only $num_avail available") if $end - $start + 1 > $num_avail; -foreach my $phonenum ( $start .. $end ) { +foreach my $phonenum ( "$start" .. "$end" ) { my $svc_phone = new FS::svc_phone { 'phonenum' => $phonenum, -- cgit v1.2.1 From 65b94bd80599a27c658b792f02c85d200488688d Mon Sep 17 00:00:00 2001 From: Alex Brelsfoard Date: Tue, 27 Jan 2015 21:29:52 -0500 Subject: RT #28256: upgrading this fix to also apply to the unused_credit_cancel package option --- httemplate/edit/part_pkg.cgi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 778a0265e..1702a6dc7 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -967,8 +967,17 @@ my $html_bottom = sub { 'msg' => q|You must set the 'suspend_credit_type' option in Configuration->Settings to gain access to this option.|, 'are_met' => sub{ my $conf = new FS::conf; - my @suspend_credit_type_conf = qsearch('conf', { 'name' => 'suspend_credit_type' } ); - return 1 if (exists($suspend_credit_type_conf[0]) && $suspend_credit_type_conf[0]->{Hash}{value}); + my @conf_info = qsearch('conf', { 'name' => 'suspend_credit_type' } ); + return 1 if (exists($conf_info[0]) && $conf_info[0]->{Hash}{value}); + return 0; + } + }, + 'unused_credit_cancel' => { + 'msg' => q|You must set the 'cancel_credit_type' option in Configuration->Settings to gain access to this option.|, + 'are_met' => sub{ + my $conf = new FS::conf; + my @conf_info = qsearch('conf', { 'name' => 'cancel_credit_type' } ); + return 1 if (exists($conf_info[0]) && $conf_info[0]->{Hash}{value}); return 0; } } -- cgit v1.2.1 From 167c155032545af623972ffb449455810d0a2b78 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 27 Jan 2015 22:46:55 -0800 Subject: show months used/remaining in discounts on invoices, #31273, #32959 --- FS/FS/Template_Mixin.pm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 1fed7f1b9..996cb55a4 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -3448,8 +3448,29 @@ sub _items_cust_bill_pkg { ext_description => \@ext, }; foreach my $cust_bill_pkg_discount (@discounts) { - my $def = $cust_bill_pkg_discount->cust_pkg_discount->discount; - push @ext, &{$escape_function}( $def->description ); + my $discount = $cust_bill_pkg_discount->cust_pkg_discount->discount; + my $discount_desc = $discount->description_short; + + if ($discount->months) { + + # calculate months remaining after this invoice + my $used = FS::Record->scalar_sql( + 'SELECT SUM(months) FROM cust_bill_pkg_discount + JOIN cust_bill_pkg USING (billpkgnum) + JOIN cust_bill USING (invnum) + WHERE pkgdiscountnum = ? AND _date <= ?', + $cust_bill_pkg_discount->pkgdiscountnum, + $self->_date + ); + $used ||= 0; + my $remaining = sprintf('%.2f', $discount->months - $used); + # append "for X months (Y months remaining)" + $discount_desc .= $self->mt(' for [quant,_1,month] ([quant,_2,month] remaining)', + $cust_bill_pkg_discount->months, + $remaining + ); + } # else it's not time-limited + push @ext, &{$escape_function}($discount_desc); } } -- cgit v1.2.1 From fa298c55a9e276ef714f1e6dbf11ae3931ad8684 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 27 Jan 2015 22:56:04 -0800 Subject: reject "old-style" latex templates --- FS/FS/Template_Mixin.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 996cb55a4..00cea1a21 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -347,8 +347,8 @@ sub print_generic { if ( $format eq 'latex' && grep { /^%%Detail/ } @invoice_template ) { #change this to a die when the old code is removed - # it's been almost ten years, changing it to a die on the next release. - warn "old-style invoice template $templatefile; ". + # it's been almost ten years, changing it to a die + die "old-style invoice template $templatefile; ". "patch with conf/invoice_latex.diff or use new conf/invoice_latex*\n"; #$old_latex = 'true'; #@invoice_template = _translate_old_latex_format(@invoice_template); -- cgit v1.2.1 From 71f6489e0b4cdd286668b79c8a397876df20840c Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 27 Jan 2015 23:27:54 -0800 Subject: give discounts a default name, #31273 --- FS/FS/discount.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/FS/FS/discount.pm b/FS/FS/discount.pm index 0561f9ca0..361e0b4b2 100644 --- a/FS/FS/discount.pm +++ b/FS/FS/discount.pm @@ -173,7 +173,12 @@ sub description_short { my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; - my $desc = $self->name ? $self->name.': ' : ''; + my $desc; + if ( $self->name ) { + $desc = $self->name . ': '; + } else { + $desc = 'Discount of '; + } $desc .= $money_char. sprintf('%.2f/month', $self->amount) if $self->amount > 0; -- cgit v1.2.1 From e43f8075d053e3f1d969d8f762ab510a2de126de Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 27 Jan 2015 23:29:57 -0800 Subject: fix sprintf error, mostly #31273 --- FS/FS/Template_Mixin.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 00cea1a21..9669ac2cf 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -1172,6 +1172,12 @@ sub print_generic { join(', ', map "$_=>".$line_item->{$_}, keys %$line_item). "\n" if $DEBUG > 1; + push @buf, ( [ $line_item->{'description'}, + $money_char. sprintf("%10.2f", $line_item->{'amount'}), + ], + map { [ " ". $_, '' ] } @{$line_item->{'ext_description'}}, + ); + $line_item->{'ref'} = $line_item->{'pkgnum'}; $line_item->{'product_code'} = $line_item->{'pkgpart'} || 'N/A'; # mt()? $line_item->{'section'} = $section; @@ -1184,11 +1190,6 @@ sub print_generic { $line_item->{'ext_description'} ||= []; push @detail_items, $line_item; - push @buf, ( [ $line_item->{'description'}, - $money_char. sprintf("%10.2f", $line_item->{'amount'}), - ], - map { [ " ". $_, '' ] } @{$line_item->{'ext_description'}}, - ); } if ( $section->{'description'} ) { -- cgit v1.2.1