[freeside-commits] branch FREESIDE_2_3_BRANCH updated. daeea9a9429bfa33eb2d56a29ff6e766c13782dd
Mark Wells
mark at 420.am
Thu May 2 14:24:20 PDT 2013
The branch, FREESIDE_2_3_BRANCH has been updated
via daeea9a9429bfa33eb2d56a29ff6e766c13782dd (commit)
from e169cafd3a30a51ad8976cdb94058b057de846b6 (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 daeea9a9429bfa33eb2d56a29ff6e766c13782dd
Author: Mark Wells <mark at freeside.biz>
Date: Thu May 2 14:23:56 2013 -0700
excel download fixes, #21937, #20337, etc.
diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html
index 2afce0c..54c9935 100755
--- a/httemplate/search/cust_pay_pending.html
+++ b/httemplate/search/cust_pay_pending.html
@@ -1,4 +1,4 @@
-<% include( 'elements/cust_pay_or_refund.html',
+<& elements/cust_pay_or_refund.html,
'thing' => 'pay_pending',
'amount_field' => 'paid',
'name_singular' => 'pending payment',
@@ -10,8 +10,7 @@
$status_sub,
],
'redirect_empty' => $redirect_empty,
- )
-%>
+&>
<%init>
my %statusaction = (
diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html
index c22b733..409c4e8 100644
--- a/httemplate/search/elements/cust_main_dayranges.html
+++ b/httemplate/search/elements/cust_main_dayranges.html
@@ -2,10 +2,10 @@
Example:
- include( 'elements/cust_main_dayranges.html',
+ <& elements/cust_main_dayranges.html,
'title' => 'Accounts Receivable Aging Summary',
'range_sub' => $mysub,
- )
+ &>
my $mysub = sub {
my( $start, $end ) = @_;
@@ -44,7 +44,7 @@ Example:
$row->{'rangecol_60_90'} ),
sprintf( $money_char.'%.2f',
$row->{'rangecol_90_0'} ),
- sprintf( '<b>'. $money_char.'%.2f'. '</b>',
+ sprintf( '<b>'.$money_char.'%.2f</b>',
$row->{'rangecol_0_0'} ),
('') x @pay_labels,
],
@@ -81,6 +81,9 @@ Example:
'', '', '', '', 'b',
( map '', @pay_labels ),
],
+ 'xls_format' => [ (map '', FS::UI::Web::cust_styles),
+ '', '', '', '', { bold => 1 },
+ ],
'color' => [
FS::UI::Web::cust_colors(),
'',
diff --git a/httemplate/search/elements/search-xls.html b/httemplate/search/elements/search-xls.html
index 26a51c4..bc844a5 100644
--- a/httemplate/search/elements/search-xls.html
+++ b/httemplate/search/elements/search-xls.html
@@ -6,6 +6,8 @@ my $header = $args{'header'};
my $rows = $args{'rows'};
my %opt = %{ $args{'opt'} };
+my $style = $opt{'style'};
+
my $override = scalar(@$rows) >= 65536 ? 'XLSX' : '';
my $format = $FS::CurrentUser::CurrentUser->spreadsheet_format($override);
@@ -42,6 +44,12 @@ my $header_format = $workbook->add_format(
bg_color => 55, #22,
bottom => 3,
);
+my $footer_format = $workbook->add_format(
+ italic => 1,
+ locked => 1,
+ bg_color => 55,
+ top => 3,
+);
my $default_format = $workbook->add_format(locked => 0);
my %money_format;
@@ -50,10 +58,24 @@ my $money_char = FS::Conf->new->config('money_char') || '$';
my %date_format;
xl_parse_date_init();
+my %bold_format;
+
my $writer = sub {
# Wrapper for $worksheet->write.
# Do any massaging of the value/format here.
my ($r, $c, $value, $format) = @_;
+ #warn "writer called with format $format\n";
+
+ if ( $style->[$c] eq 'b' or $value =~ /<b>/i ) { # the only one in common use
+ $value =~ s[</?b>][]ig;
+ if ( !exists($bold_format{$format}) ) {
+ $bold_format{$format} = $workbook->add_format();
+ $bold_format{$format}->copy($format);
+ $bold_format{$format}->set_bold();
+ }
+ $format = $bold_format{$format};
+ }
+
# convert HTML entities
# both Spreadsheet::WriteExcel and Excel::Writer::XLSX accept UTF-8 strings
$value = decode_entities($value);
@@ -86,6 +108,7 @@ my $writer = sub {
# String: replace line breaks with newlines
$value =~ s/<BR>/\n/gi;
}
+ #warn "writing with format $format\n";
$worksheet->write($r, $c, $value, $format);
};
@@ -140,7 +163,7 @@ if ( $opt{'footer'} ) {
if ( ref($item) eq 'CODE' ) {
$item = &{$item}();
}
- $writer->( $r, $c++, $item, $header_format );
+ $writer->( $r, $c++, $item, $footer_format );
}
}
diff --git a/httemplate/search/h_cust_pay.html b/httemplate/search/h_cust_pay.html
index 99330fa..6d2dd99 100755
--- a/httemplate/search/h_cust_pay.html
+++ b/httemplate/search/h_cust_pay.html
@@ -1,9 +1,8 @@
-<% include( 'elements/cust_pay_or_refund.html',
+<& elements/cust_pay_or_refund.html,
'table' => 'h_cust_pay',
'amount_field' => 'paid',
'name_singular' => 'payment',
'name_verb' => 'paid',
'pre_header' => [ 'Transaction', 'By' ],
'pre_fields' => [ 'history_action', 'history_user' ],
- )
-%>
+&>
diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html
index e232291..f5c2bf0 100755
--- a/httemplate/search/unapplied_cust_pay.html
+++ b/httemplate/search/unapplied_cust_pay.html
@@ -1,9 +1,8 @@
-<% include( 'elements/cust_main_dayranges.html',
+<& elements/cust_main_dayranges.html,
#'title' => 'Prepaid Balance Aging Summary', #???
'title' => 'Unapplied Payments Aging Summary',
'range_sub' => \&unapplied_payments,
- )
-%>
+&>
<%init>
die "access denied"
-----------------------------------------------------------------------
Summary of changes:
httemplate/search/cust_pay_pending.html | 5 +--
.../search/elements/cust_main_dayranges.html | 9 ++++--
httemplate/search/elements/search-xls.html | 25 +++++++++++++++++++-
httemplate/search/h_cust_pay.html | 5 +--
httemplate/search/unapplied_cust_pay.html | 5 +--
5 files changed, 36 insertions(+), 13 deletions(-)
More information about the freeside-commits
mailing list