diff options
author | Ivan Kohler <ivan@freeside.biz> | 2013-10-08 23:00:26 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2013-10-08 23:00:26 -0700 |
commit | fe4515eb37d76849dd08c62782d86bc7ba311dcd (patch) | |
tree | 6952cc3598de0c72b6a3eab1d53bde07a16c27f2 /httemplate/edit/cust_main/bottomfixup.js | |
parent | f2766e203e1aa144d046a26cf13e01e1f5b00f64 (diff) | |
parent | 81ae0992cf8506c6a77485548ebde25eb946a9a9 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Conflicts:
FS/FS/cust_main.pm
Diffstat (limited to 'httemplate/edit/cust_main/bottomfixup.js')
-rw-r--r-- | httemplate/edit/cust_main/bottomfixup.js | 21 |
1 files changed, 14 insertions, 7 deletions
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 </%init> - 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); |