X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbottomfixup.js;h=4e11087273fb68455cbc0dc6e0034fffd27b0ab2;hb=7ac86daf67b0a95153b736d5811f9050363f6553;hp=40bcbd52138441d5edd3be4823078db869d19db0;hpb=041a755d45f580c1f04cd228022aba3ed5a167fa;p=freeside.git diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index 40bcbd521..4e1108727 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -7,8 +7,7 @@ my $company_longitude = $conf->config('company_longitude'); my @fixups = ('copy_payby_fields', 'standardize_locations'); -#push @fixups, 'fetch_censustract' -# if $conf->exists('cust_main-require_censustract'); +push @fixups, 'confirm_censustract'; push @fixups, 'check_unique' if $conf->exists('cust_main-check_unique') and !$opt{'custnum'}; @@ -95,6 +94,35 @@ function copyelement(from, to) { //alert(from + " (" + from.type + "): " + to.name + " => " + to.value); } +% # the value in 'censustract' is the confirmed censustract; if it's set, +% # do nothing here +function confirm_censustract() { + var cf = document.CustomerForm; + if ( cf.elements['censustract'].value == '' ) { + var address_info = form_address_info(); + address_info['ship_latitude'] = cf.elements['ship_latitude'].value; + address_info['ship_longitude'] = cf.elements['ship_longitude'].value; + OLpostAJAX( + '<%$p%>/misc/confirm-censustract.html', + 'q=' + encodeURIComponent(JSON.stringify(address_info)), + function() { + overlib( OLresponseAJAX, CAPTION, 'Confirm censustract', STICKY, + AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, + 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', + TEXTSIZE, 3 ); + }, + 0); + } else submit_continue(); +} + +%# called from confirm-censustract.html +function set_censustract(tract, year) { + var cf = document.CustomerForm; + cf.elements['censustract'].value = tract; + cf.elements['censusyear'].value = year; + submit_continue(); +} + function check_unique() { var search_hash = new Object; % foreach ($conf->config('cust_main-check_unique')) {