diff options
author | jeff <jeff> | 2009-06-29 13:53:25 +0000 |
---|---|---|
committer | jeff <jeff> | 2009-06-29 13:53:25 +0000 |
commit | 55f003404af6a2416571138356d11c5ad3755e58 (patch) | |
tree | 3f57ddfbe96b7057859857858f847324eef066bd /httemplate/edit | |
parent | 7784bb1c43ea3031b2ca3bedf4b1a39aeb4ffe17 (diff) |
FCC form 477 reporting #4912
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/cust_main/bottomfixup.html | 7 | ||||
-rw-r--r-- | httemplate/edit/cust_main/bottomfixup.js | 179 | ||||
-rw-r--r-- | httemplate/edit/cust_main/choose_tax_location.html | 2 | ||||
-rw-r--r-- | httemplate/edit/cust_main/contact.html | 1 | ||||
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 28 | ||||
-rw-r--r-- | httemplate/edit/part_pkg_report_option.html | 23 | ||||
-rwxr-xr-x | httemplate/edit/process/part_pkg.cgi | 5 | ||||
-rw-r--r-- | httemplate/edit/process/part_pkg_report_option.html | 11 |
8 files changed, 215 insertions, 41 deletions
diff --git a/httemplate/edit/cust_main/bottomfixup.html b/httemplate/edit/cust_main/bottomfixup.html index 3eb43e0e5..1b29c671a 100644 --- a/httemplate/edit/cust_main/bottomfixup.html +++ b/httemplate/edit/cust_main/bottomfixup.html @@ -7,6 +7,13 @@ ) %> +<% include( '/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-cust_main-censustract.html', + 'subs' => [ 'censustract' ], + #'method' => 'POST', #could get too long? + ) +%> + <SCRIPT TYPE="text/javascript"> <% include('bottomfixup.js') %> </SCRIPT> diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index ae4aafb70..822f98d39 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -86,52 +86,17 @@ function update_address(arg) { cf.elements['ship_zip'].value = argsHash['new_ship_zip']; } - } - - var cf = document.CustomerForm; - -% if ( $conf->exists('enable_taxproducts') ) { - - if ( <% $taxpre %>error || - new String(argsHash['new_<% $taxpre %>zip']).length < 10 ) - { - - var country_el = cf.elements['<% $taxpre %>country']; - var country = country_el.options[ country_el.selectedIndex ].value; - - if ( country == 'CA' || country == 'US' ) { - - var state_el = cf.elements['<% $taxpre %>state']; - var state = state_el.options[ state_el.selectedIndex ].value; - - var url = "cust_main/choose_tax_location.html" + - "?data_vendor=cch-zip" + - ";city=" + cf.elements['<% $taxpre %>city'].value + - ";state=" + state + - ";zip=" + cf.elements['<% $taxpre %>zip'].value + - ";country=" + country + - ";"; - - // popup a chooser - OLgetAJAX( url, update_geocode, 300 ); - - } else { - - cf.elements['geocode'].value = 'DEFAULT'; - cf.submit(); + post_standardization(); - } + } - } else -% } if ( changed || ship_changed ) { % if ( $conf->exists('cust_main-auto_standardize_address') ) { standardize_address(); - cf.submit(); % } else { @@ -198,9 +163,9 @@ function update_address(arg) { confirm_change = confirm_change + '<TR><TD>' + - '<BUTTON TYPE="button" onClick="document.CustomerForm.submit();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' + + '<BUTTON TYPE="button" onClick="post_standardization();"><IMG SRC="<%$p%>images/error.png" ALT=""> Use entered ' + addresses + '</BUTTON>' + '</TD><TD>' + - '<BUTTON TYPE="button" onClick="standardize_address(); document.CustomerForm.submit();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' + + '<BUTTON TYPE="button" onClick="standardize_address();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Use standardized ' + addresses + '</BUTTON>' + '</TD></TR>' + '<TR><TD COLSPAN=2 ALIGN="center">' + '<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' + @@ -213,10 +178,85 @@ function update_address(arg) { } else { - cf.submit(); + post_standardization(); + + } + + +} + +function post_standardization() { + + var cf = document.CustomerForm; + +% if ( $conf->exists('enable_taxproducts') ) { + + if ( new String(cf.elements['<% $taxpre %>zip'].value).length < 10 ) + { + + var country_el = cf.elements['<% $taxpre %>country']; + var country = country_el.options[ country_el.selectedIndex ].value; + + if ( country == 'CA' || country == 'US' ) { + + var state_el = cf.elements['<% $taxpre %>state']; + var state = state_el.options[ state_el.selectedIndex ].value; + + var url = "cust_main/choose_tax_location.html" + + "?data_vendor=cch-zip" + + ";city=" + cf.elements['<% $taxpre %>city'].value + + ";state=" + state + + ";zip=" + cf.elements['<% $taxpre %>zip'].value + + ";country=" + country + + ";"; + + // popup a chooser + OLgetAJAX( url, update_geocode, 300 ); + + } else { + + cf.elements['geocode'].value = 'DEFAULT'; + post_geocode(); + + } + + } else { + + post_geocode(); } +% } else { + + post_geocode(); + +% } + +} + +function post_geocode() { + +% if ( $conf->exists('cust_main-require_censustract') ) { + + //alert('fetch census tract data'); + var cf = document.CustomerForm; + var state_el = cf.elements['ship_state']; + var census_data = new Array( + 'year', '2008', // from config value? + 'address', cf.elements['ship_address1'].value, + 'city', cf.elements['ship_city'].value, + 'state', state_el.options[ state_el.selectedIndex ].value, + 'zip', cf.elements['ship_zip'].value + ); + + censustract( census_data, update_censustract ); + +% }else{ + + document.CustomerForm.submit(); + +% } + } function update_geocode() { @@ -232,6 +272,7 @@ function update_geocode() { setselect(cf.elements['<% $taxpre %>state'], argsHash['state']); cf.elements['<% $taxpre %>zip'].value = argsHash['zip']; cf.elements['geocode'].value = argsHash['geocode']; + post_geocode(); } @@ -241,6 +282,64 @@ function update_geocode() { } +var set_censustract; + +function update_censustract(arg) { + + var argsHash = eval('(' + arg + ')'); + + var cf = document.CustomerForm; + + var msacode = argsHash['msacode']; + var statecode = argsHash['statecode']; + var countycode = argsHash['countycode']; + var tractcode = argsHash['tractcode']; + var error = argsHash['error']; + + set_censustract = function () { + + cf.elements['censustract'].value = + document.forms.popupcensustract.elements.censustract.value; + cf.submit(); + + } + + if (error) { + // popup an entry dialog + + var choose_censustract = + '<CENTER><BR><B>Enter census tract</B><BR><BR>' + + '<FORM name="popupcensustract">' + + '<TABLE>'; + + choose_censustract = choose_censustract + + '<TR><TH>Census Tract: </TH>' + + '<TD><INPUT NAME="censustract" ID="censustract"></TD>' + + '</TR><TR>' + + '<TD> </TD><TD> </TD></TR>'; + + choose_censustract = choose_censustract + + '<TR><TD>' + + '<BUTTON TYPE="button" onClick="set_censustract();"><IMG SRC="<%$p%>images/tick.png" ALT="">Submit census tract</BUTTON>' + + '</TD><TD>' + + '<BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission</BUTTON></TD></TR>' + + '</TABLE></FORM></CENTER>'; + + overlib( choose_censustract, CAPTION, 'Choose a census tract', STICKY, AUTOSTATUSCAP, CLOSETEXT, '', MIDX, 0, MIDY, 0, DRAGGABLE, WIDTH, 576, HEIGHT, 268, BGCOLOR, '#333399', CGCOLOR, '#333399', TEXTSIZE, 3 ); + + setTimeout("document.forms.popupcensustract.elements.censustract.focus()",1); + } else { + + cf.elements['censustract'].value = + new String(statecode) + + new String(countycode) + + new String(tractcode); + cf.submit(); + + } + +} + function copyelement(from, to) { if ( from == undefined ) { to.value = ''; diff --git a/httemplate/edit/cust_main/choose_tax_location.html b/httemplate/edit/cust_main/choose_tax_location.html index 2a4192632..be93a5de8 100644 --- a/httemplate/edit/cust_main/choose_tax_location.html +++ b/httemplate/edit/cust_main/choose_tax_location.html @@ -26,7 +26,7 @@ </SELECT><BR><BR> <TABLE><TR> - <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes')); document.CustomerForm.submit();"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD> + <TD> <BUTTON TYPE="button" onClick="set_geocode(document.getElementById('geocodes'));"><IMG SRC="<%$p%>images/tick.png" ALT=""> Set location </BUTTON></TD> <TD><BUTTON TYPE="button" onClick="document.CustomerForm.submitButton.disabled=false; parent.cClick();"><IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission </BUTTON></TD> </TR> </TABLE> diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index 27dd38516..2691da652 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -32,6 +32,7 @@ 'disabled' => $disabled, 'same_checked' => $opt{'same_checked'}, 'geocode' => $opt{'geocode'}, + 'censustract' => $opt{'censustract'}, ) %> diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index 0934f501a..a78aa87d8 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -46,6 +46,7 @@ 'recur_fee' => 'Recurring fee', 'bill_dst_pkgpart' => 'Include line item(s) from package', 'svc_dst_pkgpart' => 'Include services of package', + 'report_option' => 'Report classes', }, 'fields' => [ @@ -161,6 +162,19 @@ { type => 'columnend' }, + { 'type' => $census ? 'tablebreak-tr-title' + : 'hidden', + 'value' => 'Optional report classes', + 'field' => 'census_title', + }, + { 'field' => 'report_option', + 'type' => $census ? 'select-table' : 'hidden', + 'table' => 'part_pkg_report_option', + 'name_col' => 'name', + 'multiple' => 1, + }, + + { 'type' => 'tablebreak-tr-title', 'value' => 'Pricing add-ons', }, @@ -224,6 +238,7 @@ my $agent_clone_extra_sql = my $conf = new FS::Conf; my $taxproducts = $conf->exists('enable_taxproducts'); +my $census = scalar( qsearch( 'part_pkg_report_option', {} ) ); #XXX # - tr-part_pkg_freq: month_increments_only (from price plans) @@ -301,14 +316,27 @@ my $edit_callback = sub { (@agent_type) = map {$_->typenum} qsearch('type_pkgs',{'pkgpart'=>$1}); + my @report_option = (); foreach ($object->options) { /^usage_taxproductnum_(\d+)$/ && ($taxproductnums{$1} = 1); + /^report_option_(\d+)$/ && (push @report_option, $1); } foreach ($object->part_pkg_taxoverride) { $taxproductnums{$_->usage_class} = 1 if $_->usage_class; } + $cgi->param('report_option', join(',', @report_option)); + foreach my $field ( @$fields ) { + next unless ( + ref($field) eq 'HASH' && + $field->{field} && + $field->{field} eq 'report_option' + ); + #$field->{curr_value} = join(',', @report_option); + $field->{value} = join(',', @report_option); + } + %options = $object->options; $object->set($_ => $object->option($_)) diff --git a/httemplate/edit/part_pkg_report_option.html b/httemplate/edit/part_pkg_report_option.html new file mode 100644 index 000000000..a6f8e57b7 --- /dev/null +++ b/httemplate/edit/part_pkg_report_option.html @@ -0,0 +1,23 @@ +<% include( 'elements/edit.html', + 'name' => 'Package optional report class', + 'table' => 'part_pkg_report_option', + 'fields' => [ + 'name', + { field=>'num', type=>'hidden' }, + { field=>'disabled', type=>'checkbox', value=>'Y', }, + ], + 'labels' => { + 'num' => 'Class number', + 'name' => 'Class name', + 'disabled' => 'Disable class', + }, + 'viewall_dir' => 'browse', + ) + +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 3116b7b28..107d45972 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -102,6 +102,11 @@ my $args_callback = sub { $options{"usage_taxproductnum_$_"} = $value; } + foreach ( split(',', $cgi->param('report_option') ) ) { + $error ||= "Illegal optional report class: $_" unless ( $_ =~ /^\d*$/ ); + $options{"report_option_$_"} = 1; + } + $options{$_} = scalar( $cgi->param($_) ) for (qw( setup_fee recur_fee )); diff --git a/httemplate/edit/process/part_pkg_report_option.html b/httemplate/edit/process/part_pkg_report_option.html new file mode 100644 index 000000000..052aabd72 --- /dev/null +++ b/httemplate/edit/process/part_pkg_report_option.html @@ -0,0 +1,11 @@ +<% include( 'elements/process.html', + 'table' => 'part_pkg_report_option', + 'viewall_dir' => 'browse', + ) +%> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); + +</%init> |