summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_main
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-10-05 20:01:42 -0700
committerMark Wells <mark@freeside.biz>2013-10-05 20:01:42 -0700
commit76f26627c28cb5e95e61d67f21b53020f2b362b6 (patch)
tree31174accf89ea197e37e80e427cb0d47172aa727 /httemplate/edit/cust_main
parentc67b0f0200f3398fa0791722e79003054f0f7e8a (diff)
restore duplicate customer checking with 3.x locations, #16582
Diffstat (limited to 'httemplate/edit/cust_main')
-rw-r--r--httemplate/edit/cust_main/bottomfixup.js21
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);