X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbottomfixup.js;h=ecfcb3cbcf3e656c425663f25fd944794c83ed1e;hb=913b38d717fc7f2fae32722e9f30462fc9344fb3;hp=1cfa52d8ffa63973b77382e4e11a521867fee5a3;hpb=2bb7db96a07599e980323c1b6b23a8c79cc17a9a;p=freeside.git diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 1cfa52d8f..ecfcb3cbc 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -10,16 +10,20 @@ my @fixups = ('copy_payby_fields', 'standardize_locations'); push @fixups, 'confirm_censustract' if $conf->exists('cust_main-require_censustract'); +my $uniqueness = $conf->config('cust_main-check_unique'); push @fixups, 'check_unique' - if $conf->exists('cust_main-check_unique') and !$opt{'custnum'}; + if $uniqueness and !$opt{'custnum'}; push @fixups, 'do_submit'; # always last - var fixups = <% encode_json(\@fixups) %>; var fixup_position; var running = false; +<&| /elements/onload.js &> +submit_abort(); + + %# state machine to deal with all the asynchronous stuff we're doing %# call this after each fixup on success: function submit_continue() { @@ -70,8 +74,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) { @@ -131,10 +135,14 @@ function set_censustract(tract, year) { } function check_unique() { - var search_hash = new Object; -% foreach ($conf->config('cust_main-check_unique')) { - search_hash['<% $_ %>'] = document.CustomerForm.elements['<% $_ %>'].value; + var search_hash = {}; +% if ($uniqueness eq 'address') { + search_hash['address'] = [ + document.CustomerForm.elements['bill_address1'].value, + document.CustomerForm.elements['ship_address1'].value + ]; % } +%# no other options yet %# supported in IE8+, Firefox 3.5+, WebKit, Opera 10.5+ duplicates_form(JSON.stringify(search_hash), confirm_unique);