X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbottomfixup.js;fp=httemplate%2Fedit%2Fcust_main%2Fbottomfixup.js;h=ecfcb3cbcf3e656c425663f25fd944794c83ed1e;hb=913b38d717fc7f2fae32722e9f30462fc9344fb3;hp=9e18fa0dfc5725f173bfc3c7ba20fe234a41712d;hpb=9f26e78e38c70af6d2de28808c119b0e2251fd41;p=freeside.git diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 9e18fa0df..ecfcb3cbc 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -10,17 +10,20 @@ my @fixups = ('copy_payby_fields', 'standardize_locations'); push @fixups, 'confirm_censustract' if $conf->exists('cust_main-require_censustract'); -# currently doesn't work; disable to avoid problems -#push @fixups, 'check_unique' -# if $conf->exists('cust_main-check_unique') and !$opt{'custnum'}; +my $uniqueness = $conf->config('cust_main-check_unique'); +push @fixups, 'check_unique' + 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() { @@ -132,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);