summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-05-08 02:12:03 -0700
committerIvan Kohler <ivan@freeside.biz>2013-05-08 02:12:03 -0700
commit972a6864dc38864bbe7705ef860560e257d4d7a7 (patch)
treedf926f46fe05ba55f8caeca9f8b93745fab23688
parent85e62c996e1733c59ccad85f97cbf2635429fafc (diff)
parent90be53617907d8cf156c5c9348dea22f5bad268c (diff)
Merge branch 'FREESIDE_2_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_2_3_BRANCH
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm8
-rw-r--r--FS/FS/cust_bill.pm1
-rw-r--r--FS/FS/pay_batch/BoM.pm2
-rwxr-xr-xhttemplate/search/cust_pay_pending.html5
-rw-r--r--httemplate/search/elements/cust_main_dayranges.html9
-rw-r--r--httemplate/search/elements/search-xls.html25
-rwxr-xr-xhttemplate/search/h_cust_pay.html5
-rwxr-xr-xhttemplate/search/unapplied_cust_pay.html5
8 files changed, 46 insertions, 14 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index be87e594e..d946a6239 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -704,6 +704,14 @@ sub edit_info {
$new->set( $_ => $p->{$_} )
foreach grep { exists $p->{$_} } @cust_main_editable_fields;
+ if ( $new->ship_address1 eq '' ) {
+ # then the ship address is being set to null
+ $new->set($_ => '')
+ foreach qw(ship_longitude ship_latitude ship_coord_auto ship_mobile);
+ }
+
+
+
my $payby = '';
if (exists($p->{'payby'})) {
$p->{'payby'} =~ /^([A-Z]{4})$/
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index b50f35234..d803152af 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2047,6 +2047,7 @@ sub print_csv {
$self->custnum,
$cust_main->first,
$cust_main->last,
+ $cust_main->company,
$cust_main->address1,
$cust_main->address2,
$cust_main->city,
diff --git a/FS/FS/pay_batch/BoM.pm b/FS/FS/pay_batch/BoM.pm
index a3708d477..b609df351 100644
--- a/FS/FS/pay_batch/BoM.pm
+++ b/FS/FS/pay_batch/BoM.pm
@@ -59,7 +59,7 @@ $name = 'BoM';
footer => sub {
my ($pay_batch, $batchcount, $batchtotal) = @_;
sprintf( "YD%08u%014.0f%55s\n", $batchcount, $batchtotal*100, ""). #80
- sprintf( "Z%014u%05u%014u%05u%40s", #80 now
+ sprintf( "Z%014.0f%05u%014u%05u%40s", #80 now
$batchtotal*100, $batchcount, "0", "0", "");
},
);
diff --git a/httemplate/search/cust_pay_pending.html b/httemplate/search/cust_pay_pending.html
index 2afce0ce9..54c9935ef 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 c22b73384..409c4e8e4 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 26a51c4c7..bc844a579 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 99330fadd..6d2dd9955 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 e232291fe..f5c2bf0f9 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"