diff options
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 2 | ||||
-rw-r--r-- | httemplate/edit/cust_main/bottomfixup.js | 29 | ||||
-rw-r--r-- | httemplate/edit/invoice_conf.html | 32 | ||||
-rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 2 | ||||
-rw-r--r-- | httemplate/elements/location.html | 6 | ||||
-rw-r--r-- | httemplate/elements/standardize_locations.js | 33 | ||||
-rw-r--r-- | httemplate/graph/cust_bill_pkg.cgi | 15 | ||||
-rw-r--r-- | httemplate/misc/confirm-censustract.html | 22 |
8 files changed, 62 insertions, 79 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 480047cae..629c8081d 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -53,6 +53,8 @@ <& /elements/location.html, object => $cust_main->bill_location, prefix => 'bill_', + enable_censustract => 1, + enable_district => 1, enable_coords => 1, &> <& cust_main/after_bill_location.html, $cust_main &> diff --git a/httemplate/edit/cust_main/bottomfixup.js b/httemplate/edit/cust_main/bottomfixup.js index ecfcb3cbc..5a8835f53 100644 --- a/httemplate/edit/cust_main/bottomfixup.js +++ b/httemplate/edit/cust_main/bottomfixup.js @@ -7,7 +7,7 @@ my $company_longitude = $conf->config('company_longitude'); my @fixups = ('copy_payby_fields', 'standardize_locations'); -push @fixups, 'confirm_censustract' +push @fixups, 'confirm_censustract_bill', 'confirm_censustract_ship' if $conf->exists('cust_main-require_censustract'); my $uniqueness = $conf->config('cust_main-check_unique'); @@ -101,14 +101,17 @@ function copyelement(from, to) { } % # the value in pre+'censustract' is the confirmed censustract; if it's set, -% # do nothing here -function confirm_censustract() { +% # and the user hasn't changed it manually, skip this +function confirm_censustract(pre) { var cf = document.CustomerForm; - var pre = cf.elements['same'].checked ? 'bill_' : 'ship_'; - if ( cf.elements[pre+'censustract'].value == '' ) { + if ( cf.elements[pre+'censustract'].value == '' || + cf.elements[pre+'enter_censustract'].value != + cf.elements[pre+'censustract'].value ) + { var address_info = form_address_info(); address_info[pre+'latitude'] = cf.elements[pre+'latitude'].value; address_info[pre+'longitude'] = cf.elements[pre+'longitude'].value; + address_info['prefix'] = pre; OLpostAJAX( '<%$p%>/misc/confirm-censustract.html', 'q=' + encodeURIComponent(JSON.stringify(address_info)), @@ -121,14 +124,22 @@ function confirm_censustract() { 0); } else submit_continue(); } +function confirm_censustract_bill() { + confirm_censustract('bill_'); +} -%# called from confirm-censustract.html -function set_censustract(tract, year) { +function confirm_censustract_ship() { var cf = document.CustomerForm; - var pre = 'ship_'; if ( cf.elements['same'].checked ) { - pre = 'bill_'; + submit_continue(); + } else { + confirm_censustract('ship_'); } +} + +%# called from confirm-censustract.html +function set_censustract(tract, year, pre) { + var cf = document.CustomerForm; cf.elements[pre + 'censustract'].value = tract; cf.elements[pre + 'censusyear'].value = year; submit_continue(); diff --git a/httemplate/edit/invoice_conf.html b/httemplate/edit/invoice_conf.html index b7b3a4ebc..7122653f2 100644 --- a/httemplate/edit/invoice_conf.html +++ b/httemplate/edit/invoice_conf.html @@ -49,14 +49,8 @@ my @fields = ( 'Footer', 'Summary header', 'Return address', - 'Coupon', 'Small footer', - 'Top margin', - 'Header separation', - 'Address separation', - 'Text height', - 'Coupon height', - 'Footer separation', + 'Enable coupon', ), { type => 'columnnext' }, @@ -65,19 +59,8 @@ my @fields = ( { field => 'latexfooter', %textarea }, { field => 'latexsummary', %textarea }, { field => 'latexreturnaddress', %textarea }, - { field => 'latexcoupon', %textarea }, { field => 'latexsmallfooter', %textarea }, - { field => 'latextopmargin', size => 16 }, - { field => 'latexheadsep', size => 16 }, - { field => 'latexaddresssep', size => 16 }, - { field => 'latextextheight', size => 16 }, - { field => 'latexextracouponspace', size => 16 }, - { field => 'latexcouponfootsep', size => 16 }, - # are these still used? - #{ field => 'latexcouponamountenclosedsep', size => 16 }, - #{ field => 'latexverticalreturnaddress', type => 'checkbox' }, - #{ field => 'latexcouponaddcompanytoaddress',type => 'checkbox' }, - # logo -- implement if someone really needs it... + { field => 'with_latexcoupon', type => 'checkbox', value => 'Y' }, { type => 'columnnext' }, { type => 'title', value => 'HTML' }, @@ -104,20 +87,12 @@ my %labels = ( latexfooter latexsummary latexreturnaddress - latexcoupon + with_latexcoupon latexsmallfooter - latextopmargin - latexheadsep - latexaddresssep - latextextheight - latexextracouponspace - latexcouponfootsep htmlnotes htmlfooter htmlsummary htmlreturnaddress - logo_png - logo_eps ) ), ); @@ -211,7 +186,6 @@ sub edit_callback { or die "invoice mode $modenum not found"; $object->set('modename', $invoice_mode->modename); $object->set('agentnum', $invoice_mode->agentnum); - } sub menubar_opt_callback { diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index 95c92432e..c3ab6fec3 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -134,7 +134,7 @@ my %hash = ( $hash{'custnum'} = $cust_main->custnum if $cust_main; my @cust_pkg_usageprice = (); -foreach my $quantity_param ( grep ( $cgi->param($_) && $cgi->param($_) > 0 ), +foreach my $quantity_param ( grep { $cgi->param($_) && $cgi->param($_) > 0 } grep /^usagepricenum(\d+)_quantity$/, $cgi->param ) diff --git a/httemplate/elements/location.html b/httemplate/elements/location.html index a820bf2a6..799531e01 100644 --- a/httemplate/elements/location.html +++ b/httemplate/elements/location.html @@ -213,7 +213,8 @@ Example: <TD ALIGN="right">Census tract</TD> <TD COLSPAN=8> <INPUT TYPE="text" SIZE=15 - NAME="enter_censustract" + ID="<% $pre %>enter_censustract" + NAME="<% $pre %>enter_censustract" VALUE="<% $object->censustract |h %>"> <% '(automatic)' %> </TD> @@ -250,7 +251,8 @@ Example: var clear_coords_ids = [ '<%$pre%>latitude', '<%$pre%>longitude', - 'enter_censustract', + '<%$pre%>enter_censustract', + '<%$pre%>censustract', '<%$pre%>district' ]; function clear_coords() { diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js index cea59b801..2d1fc7423 100644 --- a/httemplate/elements/standardize_locations.js +++ b/httemplate/elements/standardize_locations.js @@ -11,26 +11,14 @@ function form_address_info() { % if ( $billship ) { returnobj['same'] = cf.elements['same'].checked; % } -% if ( $withcensus ) { -% # "entered" censustract always goes with the ship_ address if there is one -% if ( $billship ) { - returnobj['ship_censustract'] = cf.elements['enter_censustract'].value; -% } else { # there's only a package address, so it's just "censustract" - returnobj['censustract'] = cf.elements['enter_censustract'].value; -% } -% } % for my $pre (@prefixes) { - if ( <% $pre eq 'ship_' ? 1 : 0 %> && returnobj['same'] ) { -% # special case: don't include any ship_ fields, and move the entered -% # censustract over to bill_. - returnobj['bill_censustract'] = returnobj['ship_censustract']; - delete returnobj['ship_censustract']; - } else { % # normal case % for my $field (qw(address1 address2 city state zip country)) { returnobj['<% $pre %><% $field %>'] = cf.elements['<% $pre %><% $field %>'].value; % } #for $field - } // if returnobj['same'] +% if ( $withcensus ) { + returnobj['<% $pre %>censustract'] = cf.elements['<% $pre %>enter_censustract'].value; +% } % } #foreach $pre return returnobj; @@ -181,18 +169,11 @@ function confirm_manual_address() { %# not much to do in this case, just confirm the censustract % if ( $withcensus ) { var cf = document.<% $formname %>; -% if ( $billship ) { - if ( cf.elements['same'] && cf.elements['same'].checked ) { - cf.elements['bill_censustract'].value = - cf.elements['enter_censustract'].value; - } else { - cf.elements['ship_censustract'].value = - cf.elements['enter_censustract'].value; - } -% } else { - cf.elements['censustract'].value = cf.elements['enter_censustract'].value; +% foreach my $pre (@prefixes) { + cf.elements['<% $pre %>censustract'].value = + cf.elements['<% $pre %>enter_censustract'].value; % } -% } +% } # $withcensus post_standardization(); } diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi index edc339d3a..151b29504 100644 --- a/httemplate/graph/cust_bill_pkg.cgi +++ b/httemplate/graph/cust_bill_pkg.cgi @@ -254,12 +254,17 @@ foreach my $agent ( $all_agent || $sel_agent || $FS::CurrentUser::CurrentUser->a } elsif ( $cgi->param('class_agg_break') eq 'breakdown' ) { - # if we're working with report options, @classnums here contains - # arrays of multiple classnums for (my $i = 0; $i < scalar @classnums; $i++) { - my $row_classnum = join(',', @{ $classnums[$i] }); - my $row_classname = join(', ', @{ $classnames[$i] }); - my $not_row_classnum = join(',', @{ $not_classnums[$i] }); + my $row_classnum = $classnums[$i]; + my $row_classname = $classnames[$i]; + my $not_row_classnum = ''; + if ( $class_param eq 'report_optionnum' ) { + # if we're working with report options, @classnums here contains + # arrays of multiple classnums + $row_classnum = join(',', @$row_classnum); + $row_classname = join(', ', @$row_classname); + $not_row_classnum = join(',', @{ $not_classnums[$i] }); + } foreach my $component ( @components ) { push @items, 'cust_bill_pkg'; diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html index 9e0af498f..880cade3a 100644 --- a/httemplate/misc/confirm-censustract.html +++ b/httemplate/misc/confirm-censustract.html @@ -6,6 +6,9 @@ Census tract error Confirm census tract % } </B><BR> +<% $location{address1} %> <% $location{address2} %><BR> +<% $location{city} %>, <% $location{state} %> <% $location{zip} %><BR> +<BR> % my $querystring = "census_year=$year&latitude=".$cache->get('latitude').'&longitude='.$cache->get('longitude'); <A HREF="http://maps.ffiec.gov/FFIECMapper/TGMapSrv.aspx?<% $querystring %>" TARGET="_blank">Map service module location</A><BR> @@ -29,13 +32,14 @@ Confirm census tract <TR> <TD ALIGN="center"> <BUTTON TYPE="button" - onclick="set_censustract('<% $old_tract %>', '<% $year %>')"> + onclick="set_censustract('<% $old_tract %>', '<% $year %>', '<% $pre %>')"> <IMG SRC="<%$p%>images/error.png" ALT=""> Use entered census tract </BUTTON> </TD> +% if ( !$error ) { <TD ALIGN="center"> <BUTTON TYPE="button" - onclick="set_censustract('<% $new_tract %>', '<% $year %>')"> + onclick="set_censustract('<% $new_tract %>', '<% $year %>', '<% $pre %>')"> <IMG SRC="<%$p%>images/tick.png" ALT=""> Use calculated census tract </BUTTON> </TD> @@ -47,6 +51,14 @@ Confirm census tract </BUTTON> </TD> </TR> +% } else { # don't show a button to use the calculated value + <TD COLSPAN=1 ALIGN="center"> + <BUTTON TYPE="button" onclick="submit_abort()"> + <IMG SRC="<%$p%>images/cross.png" ALT=""> Cancel submission + </BUTTON> + </TD> + </TR> +% } </TABLE></CENTER> <%init> @@ -61,11 +73,7 @@ warn $cgi->param('q') if $DEBUG; my $q = decode_json($cgi->param('q')) or die "bad argument '".$cgi->param('q')."'"; -my $pre = ''; -if ($q->{billship}) { - # this still isn't quite correct - $pre = $q->{'same'} ? 'bill_' : 'ship_'; -} +my $pre = $q->{prefix} || ''; my %location = ( map { $_ => $q->{$pre.$_} } qw( company address1 address2 city state zip country latitude longitude ) |