[freeside-commits] branch master updated. f88dda7fe57054bd030491a5b9363a1aff601bf2
Mark Wells
mark at 420.am
Sun Jan 13 14:22:42 PST 2013
The branch, master has been updated
via f88dda7fe57054bd030491a5b9363a1aff601bf2 (commit)
via 2659c88ba3c5b34cf6087d874c1a26a24bed9243 (commit)
from ceaa9e6ca4222595c1795c4bbde8d1c9609045e7 (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 f88dda7fe57054bd030491a5b9363a1aff601bf2
Author: Mark Wells <mark at freeside.biz>
Date: Sun Jan 13 14:22:21 2013 -0800
fix address standardization when changing package locations, #13763
diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js
index 1cfa52d..0de6d9d 100644
--- a/httemplate/edit/cust_main/bottomfixup.js
+++ b/httemplate/edit/cust_main/bottomfixup.js
@@ -70,8 +70,8 @@ function copy_payby_fields() {
<& /elements/standardize_locations.js,
'callback' => 'submit_continue();',
- 'main_prefix' => 'bill_',
- 'no_company' => 1,
+ 'billship' => 1,
+ 'with_census' => 1, # no with_firm, apparently
&>
function copyelement(from, to) {
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js
index 8c1efd9..1069a0e 100644
--- a/httemplate/elements/order_pkg.js
+++ b/httemplate/elements/order_pkg.js
@@ -44,4 +44,5 @@ function standardize_new_location() {
function submit_abort() {
document.OrderPkgForm.submitButton.disabled = false;
+ nd(1);
}
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index 15c5761..88c87c1 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -7,8 +7,8 @@ function status_message(text, caption) {
function form_address_info() {
var cf = document.<% $formname %>;
- var returnobj = { onlyship: <% $onlyship ? 1 : 0 %> };
-% if ( !$onlyship ) {
+ var returnobj = { billship: <% $billship %> };
+% if ( $billship ) {
returnobj['same'] = cf.elements['same'].checked;
% }
% if ( $withfirm ) {
@@ -59,16 +59,12 @@ function standardize_locations() {
cf.elements['<% $pre %>coord_auto'].value = 'Y';
changed = true;
}
-
-% } #foreach $pre
-
// standardize if the old address wasn't clean
- if ( cf.elements['old_ship_addr_clean'].value == '' ||
- cf.elements['old_bill_addr_clean'].value == '' ) {
-
+ if ( cf.elements['<% $pre %>addr_clean'].value == '' ) {
changed = true;
-
}
+% } #foreach $pre
+
// or if it was clean but has been changed
for (var key in address_info) {
var old_el = cf.elements['old_'+key];
@@ -81,7 +77,7 @@ function standardize_locations() {
% # If address hasn't been changed, auto-confirm the existing value of
% # censustract so that we don't ask the user to confirm it again.
- if ( !changed ) {
+ if ( !changed && <% $withcensus %> ) {
if ( address_info['same'] ) {
cf.elements['bill_censustract'].value =
address_info['bill_censustract'];
@@ -279,21 +275,18 @@ function setselect(el, value) {
my %opt = @_;
my $conf = new FS::Conf;
-my $withfirm = 1;
-my $withcensus = 1;
+my $withfirm = $opt{'with_firm'} ? 1 : 0;
+my $withcensus = $opt{'with_census'} ? 1 : 0;
+
+my @prefixes = '';
+my $billship = $opt{'billship'} ? 1 : 0; # whether to have bill_ and ship_ prefixes
+my $taxpre = '';
+if ($billship) {
+ @prefixes = qw(bill_ ship_);
+ $taxpre = $conf->exists('tax-ship_address') ? 'ship_' : 'bill_';
+}
my $formname = $opt{form} || 'CustomerForm';
-my $onlyship = $opt{onlyship} || '';
-#my $main_prefix = $opt{main_prefix} || '';
-#my $ship_prefix = $opt{ship_prefix} || ($onlyship ? '' : 'ship_');
-# The prefixes are now 'ship_' and 'bill_'.
-my $taxpre = 'bill_';
-$taxpre = 'ship_' if ( $conf->exists('tax-ship_address') || $onlyship );
my $post_geocode = $opt{callback} || 'post_geocode();';
-$withfirm = 0 if $opt{no_company};
-$withcensus = 0 if $opt{no_census};
-
-my @prefixes = ('ship_');
-unshift @prefixes, 'bill_' unless $onlyship;
</%init>
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi
index 7b08f7b..03e336c 100755
--- a/httemplate/misc/change_pkg.cgi
+++ b/httemplate/misc/change_pkg.cgi
@@ -32,9 +32,6 @@
<& /elements/standardize_locations.html,
'form' => "OrderPkgForm",
- 'onlyship' => 1,
- 'no_company' => 1,
- 'no_census' => 1,
'callback' => 'document.OrderPkgForm.submit();',
&>
diff --git a/httemplate/misc/confirm-address_standardize.html b/httemplate/misc/confirm-address_standardize.html
index 57201ea..420e8ea 100644
--- a/httemplate/misc/confirm-address_standardize.html
+++ b/httemplate/misc/confirm-address_standardize.html
@@ -11,16 +11,14 @@ Confirm address standardization
</B><BR><BR>
<TABLE WIDTH="100%">
-% my @prefixes;
-% if ( $old{onlyship} ) {
-% @prefixes = ('ship_');
-% } elsif ( $old{same} ) {
+% my @prefixes = ('');
+% if ( $old{same} ) {
% @prefixes = ('bill_');
-% } else {
+% } elsif ( $old{billship} ) {
% @prefixes = ('bill_', 'ship_');
% }
% for my $pre (@prefixes) {
-% my $name = $pre eq 'ship_' ? 'service' : 'billing';
+% my $name = $pre eq 'bill_' ? 'billing' : 'service';
% if ( $new{$pre.'addr_clean'} ) {
<TR>
<TH>Entered <%$name%> address</TH>
@@ -128,6 +126,6 @@ my $q = decode_json($cgi->param('q'));
my %old = %{ $q->{old} };
my %new = %{ $q->{new} };
-my $addresses = $old{onlyship} ? 'address' : 'addresses';
+my $addresses = $old{billship} ? 'addresses' : 'address';
</%init>
diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index bfc7b69..993ea36 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -129,9 +129,6 @@
<& /elements/standardize_locations.html,
'form' => "OrderPkgForm",
- 'onlyship' => 1,
- 'no_company' => 1,
- 'no_census' => 1,
'callback' => 'document.OrderPkgForm.submit();',
&>
diff --git a/httemplate/misc/xmlhttp-address_standardize.html b/httemplate/misc/xmlhttp-address_standardize.html
index 9880571..15f266a 100644
--- a/httemplate/misc/xmlhttp-address_standardize.html
+++ b/httemplate/misc/xmlhttp-address_standardize.html
@@ -16,12 +16,10 @@ my %old = %{ decode_json($cgi->param('arg')) }
my %new;
-my @prefixes;
-if ($old{onlyship}) {
- @prefixes = ('ship_');
-} elsif ( $old{same} ) {
+my @prefixes = ('');
+if ( $old{same} ) {
@prefixes = ('bill_');
-} else {
+} elsif ( $old{billship} ) {
@prefixes = ('bill_', 'ship_');
}
my $all_same = 1;
@@ -44,6 +42,8 @@ foreach my $pre ( @prefixes ) {
$all_same = 0 if ( $new{$pre.$_} ne $old{$pre.$_} );
last if !$all_same;
}
+
+ $all_same = 0 if $new{$pre.'error'};
}
my $return = { old => \%old, new => \%new, all_same => $all_same };
commit 2659c88ba3c5b34cf6087d874c1a26a24bed9243
Author: Mark Wells <mark at freeside.biz>
Date: Sun Jan 13 14:21:44 2013 -0800
debug
diff --git a/httemplate/view/cust_main/packages/section.html b/httemplate/view/cust_main/packages/section.html
index 53bdfa1..5224619 100755
--- a/httemplate/view/cust_main/packages/section.html
+++ b/httemplate/view/cust_main/packages/section.html
@@ -37,7 +37,6 @@
% # include supplemental packages if any
% $iopt{'supplemental'} = ($iopt{'supplemental'} || 0) + 1;
% foreach my $supp_pkg ($cust_pkg->supplemental_pkgs) {
-% warn $supp_pkg->pkgnum;
<& .packagerow, $supp_pkg, %iopt &>
% }
</%def>
-----------------------------------------------------------------------
Summary of changes:
httemplate/edit/cust_main/bottomfixup.js | 4 +-
httemplate/elements/order_pkg.js | 1 +
httemplate/elements/standardize_locations.js | 39 +++++++++-------------
httemplate/misc/change_pkg.cgi | 3 --
httemplate/misc/confirm-address_standardize.html | 12 +++----
httemplate/misc/order_pkg.html | 3 --
httemplate/misc/xmlhttp-address_standardize.html | 10 +++---
httemplate/view/cust_main/packages/section.html | 1 -
8 files changed, 29 insertions(+), 44 deletions(-)
More information about the freeside-commits
mailing list