summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2013-01-13 19:01:29 -0800
committerIvan Kohler <ivan@freeside.biz>2013-01-13 19:01:29 -0800
commita65d16767bcaa1077be0f41568a4349c9db18990 (patch)
treefc4c3e6465b735ddcf4d740afd9f1196c89fbac7 /httemplate/elements
parenta62346b3ac1f66ffbf12d109c9da186c8d0ca576 (diff)
parentf88dda7fe57054bd030491a5b9363a1aff601bf2 (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/order_pkg.js1
-rw-r--r--httemplate/elements/standardize_locations.js39
2 files changed, 17 insertions, 23 deletions
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js
index 8c1efd93a..1069a0ee4 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 15c5761a0..88c87c154 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>