summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2009-10-30 00:02:52 +0000
committerivan <ivan>2009-10-30 00:02:52 +0000
commit1a71a9d6cb7f847947b1e95a61f49cf16b92ab6a (patch)
treeccccf62a1bb287a7a2c8b263cd520f452b29233e /httemplate
parentcccd6a6039ed390c95f1989f8ac8af259ffc2061 (diff)
bulk tax changes, RT#6445
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/cust_main_county.cgi9
-rw-r--r--httemplate/edit/bulk-cust_main_county.html22
-rw-r--r--httemplate/edit/process/bulk-cust_main_county.html9
3 files changed, 22 insertions, 18 deletions
diff --git a/httemplate/browse/cust_main_county.cgi b/httemplate/browse/cust_main_county.cgi
index 232e6883c..14bdfff38 100755
--- a/httemplate/browse/cust_main_county.cgi
+++ b/httemplate/browse/cust_main_county.cgi
@@ -262,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,
@@ -295,7 +295,7 @@ my $html_foot = <<END;
}
}
- function bulkPopup() {
+ function bulkPopup(action) {
var bulk_popup_link = "$bulk_popup_link";
var bulkstring = '';
theForm = document.taxesForm;
@@ -312,6 +312,7 @@ my $html_foot = <<END;
}
}
+ bulkstring = bulkstring + ';action=' + action;
if ( bulk_popup_link.length > 1920 ) { // IE 2083 URL limit
alert('Too many selections'); // should do some session thing...
return false;
@@ -327,7 +328,9 @@ my $html_foot = <<END;
<A HREF="javascript:setAll(false)">unselect all</A> |
<A HREF="javascript:toggleAll()">toggle all</A>
<BR><BR>
-<A HREF="javascript:void(0);" onClick="bulkPopup();">Add new tax to selected</A>
+<A HREF="javascript:void(0);" onClick="bulkPopup('add');">Add new tax to selected</A>
+|
+<A HREF="javascript:void(0);" onClick="bulkPopup('edit');">Bulk edit selected</A>
END
diff --git a/httemplate/edit/bulk-cust_main_county.html b/httemplate/edit/bulk-cust_main_county.html
index 93d9444b8..8e447e54f 100644
--- a/httemplate/edit/bulk-cust_main_county.html
+++ b/httemplate/edit/bulk-cust_main_county.html
@@ -1,7 +1,8 @@
-<% include('/elements/header-popup.html', 'Bulk Tax rate') %>
+<% include('/elements/header-popup.html', $title ) %>
<FORM ACTION="<% popurl(1)."process/bulk-cust_main_county.html" %>" METHOD="POST">
+<INPUT TYPE="hidden" NAME="action" VALUE="<% $action %>">
<INPUT TYPE="hidden" NAME="taxnum" VALUE="<% join(',', @taxnum) %>">
<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
@@ -68,7 +69,7 @@
<BR>
-<INPUT TYPE="submit" VALUE="Bulk add tax">
+<INPUT TYPE="submit" VALUE="Bulk <% $action %> tax">
<%init>
@@ -78,16 +79,13 @@ die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
my @taxnum;
-if ( $cgi->param('error') ) {
- $cgi->param('taxnum') =~ /^([\d,]+)$/
- or die "no taxnum, but error: ". $cgi->param('error');
- @taxnum = split(',', $1);
-} else {
- my($query) = $cgi->keywords;
- $query =~ /^([\d,]+)$/
- or $m->comp('/elements/errorpage-popup.html', 'Nothing selected');
- @taxnum = split(',', $1);
-}
+$cgi->param('taxnum') =~ /^([\d,]+)$/
+ or $m->comp('/elements/errorpage-popup.html', $cgi->param('error') || 'Nothing selected');
+my @taxnum = split(',', $1);
+
+$cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
+my $action = $1;
+my $title = "Bulk $action tax rate";
my @cust_main_county =
map {
diff --git a/httemplate/edit/process/bulk-cust_main_county.html b/httemplate/edit/process/bulk-cust_main_county.html
index e05192e96..af9e49500 100644
--- a/httemplate/edit/process/bulk-cust_main_county.html
+++ b/httemplate/edit/process/bulk-cust_main_county.html
@@ -1,6 +1,6 @@
% if ( $error ) { #better to redirect back to
%# <% $cgi->redirect("$url?". $cgi->query_string ) %>
- <% include('/elements/header-popup.html', 'Error adding taxes' ) %>
+ <% include('/elements/header-popup.html', "Error ${action}ing taxes" ) %>
<FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
<BR><BR>
@@ -9,7 +9,7 @@
</HTML>
% } else {
- <% include('/elements/header-popup.html', 'Taxes added') %>
+ <% include('/elements/header-popup.html', "Taxes ${action}ed") %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
@@ -24,13 +24,16 @@ $cgi->param('taxnum') =~ /^([\d,]+)$/
or die 'Guru Meditation #69'; #??? should have been passed in
my @taxnum = split(',', $1);
+$cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
+my $action = $1;
+
my $error = '';
foreach my $taxnum ( @taxnum ) {
my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } )
or die "unknown taxnum: $taxnum";
- if ( $cust_main_county->tax == 0 ) { #let's replace
+ if ( $action eq 'edit' || $cust_main_county->tax == 0 ) { #let's replace
foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
$cust_main_county->set( $_ => scalar($cgi->param($_)) )