X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fcust_main_county.cgi;h=14bdfff384edbb47479c3d2173cb742230436962;hb=9f0a2d6b88789a9eb940ff2a1d6b121ccb8083bc;hp=c4d1d18823aa75acde5c40ff9ead5022e3e30325;hpb=d8cb6cd67cc574c90dbbfbd8db2da6711c516d65;p=freeside.git diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi index c4d1d1882..14bdfff38 100755 --- a/httemplate/browse/cust_main_county.cgi +++ b/httemplate/browse/cust_main_county.cgi @@ -23,10 +23,6 @@ 'link_onclicks' => \@link_onclicks, ) %> -% -% # collapse state -% # % } -% <%once> my $conf = new FS::Conf; @@ -102,6 +98,17 @@ sub expand_link { ''; } +sub collapse_link { + my %param = @_; + + my $taxnum = $param{'row'}->taxnum; + my $url = "${p}edit/process/cust_main_county-collapse.cgi?$taxnum"; + $url = "javascript:collapse_areyousure('$url')"; + + qq($param{'label'}); +} + + sub separate_taxclasses_link { my( $row ) = @_; my $taxnum = $row->taxnum; @@ -110,6 +117,8 @@ sub separate_taxclasses_link { qq!!; } +#un-separate taxclasses too + <%init> @@ -122,9 +131,18 @@ my $enable_taxclasses = $conf->exists('enable_taxclasses'); my @menubar; -my $html_init = - "Click on add states to specify a country's tax rates by state or province. -
Click on add counties to specify a state's tax rates by county."; +my $html_init = < + function collapse_areyousure(href) { + if (confirm("Are you sure you want to remove all county tax rates for this state?") == true) + window.location.href = href; + } + + + Click on add states to specify a country's tax rates by state or province. +
Click on add counties to specify a state's tax rates by county, or remove counties to remove per-county tax rates. +END + $html_init .= "
Click on separate taxclasses to specify taxes per taxclass." if $enable_taxclasses; $html_init .= '

'; @@ -148,7 +166,11 @@ if ( $country && $cgi->param('state') =~ /^([\w \-\'\[\]]+)$/ ) { $cgi->delete('state'); my $county = ''; -if ( $country && $state && $cgi->param('county') =~ /^([\w \-\'\[\]]+)$/ ) { +if ( $country && $state && + $cgi->param('county') =~ + /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]+)$/ + ) +{ $county = $1; if ( $county eq '__NONE__' ) { $title = "No county, $title"; @@ -175,9 +197,9 @@ $cgi->param('dummy', 1); my $filter_change = "window.location = '". $cgi->self_url. - ";country=' + document.getElementById('country').options[document.getElementById('country').selectedIndex].value + ". - "';state=' + document.getElementById('state').options[document.getElementById('state').selectedIndex].value +". - "';county=' + document.getElementById('county').options[document.getElementById('county').selectedIndex].value;"; + ";country=' + encodeURIComponent( document.getElementById('country').options[document.getElementById('country').selectedIndex].value ) + ". + "';state=' + encodeURIComponent( document.getElementById('state').options[document.getElementById('state').selectedIndex].value ) +". + "';county=' + encodeURIComponent( document.getElementById('county').options[document.getElementById('county').selectedIndex].value );"; #restore this so pagination works $cgi->param('country', $country) if $country; @@ -186,7 +208,7 @@ $cgi->param('county', $county ) if $county; $cgi->param('taxclass', $county ) if $taxclass; my $html_posttotal = - '( show country: '. + '
( show country: '. include('/elements/select-country.html', 'country' => $country, 'onchange' => $filter_change, @@ -240,7 +262,7 @@ $html_posttotal .= ' )'; my $bulk_popup_link = include( '/elements/popup_link_onclick.html', - 'action' => "${p}edit/bulk-cust_main_county.html?MAGIC_taxnum_MAGIC", + 'action' => "${p}edit/bulk-cust_main_county.html?taxnum=MAGIC_taxnum_MAGIC", 'actionlabel' => 'Bulk add new tax', 'nofalse' => 1, 'height' => 420, @@ -273,7 +295,7 @@ my $html_foot = <unselect all
| toggle all

-Add new tax to selected +Add new tax to selected +| +Bulk edit selected END @@ -356,11 +381,16 @@ my @fields = ( ) ) }, - sub { $_[0]->county || '(all) '. - expand_link( desc => 'Add Counties', - row => $_[0], - label => 'add counties', - ) + sub { $_[0]->county + ? $_[0]->county. ' '. + collapse_link( label=> 'remove counties', + row => $_[0], + ) + : '(all) '. + expand_link( desc => 'Add Counties', + row => $_[0], + label => 'add counties', + ); }, );