[freeside-commits] freeside/httemplate/edit/process bulk-cust_main_county.html, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Sat Oct 11 17:54:20 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv7229/edit/process
Added Files:
bulk-cust_main_county.html
Log Message:
add a quick bulk tax add tool (eating my own dogfood instead of running a one-off SQL query), RT#4117
--- NEW FILE: bulk-cust_main_county.html ---
% if ( $error ) { #better to redirect back to
%# <% $cgi->redirect("$url?". $cgi->query_string ) %>
<% include('/elements/header-popup.html', 'Error adding taxes' ) %>
<FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
<BR><BR>
</BODY>
</HTML>
% } else {
<% include('/elements/header-popup.html', 'Taxes added') %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
</BODY>
</HTML>
% }
<%init>
$cgi->param('taxnum') =~ /^([\d,]+)$/
or die 'Guru Meditation #69'; #??? should have been passed in
my @taxnum = split(',', $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
foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
$cust_main_county->set( $_ => scalar($cgi->param($_)) )
}
$error = $cust_main_county->replace and last;
} else { #let's insert a new record
my $new =
new FS::cust_main_county {
( map { $_ => scalar($cgi->param($_)) }
qw( taxname tax exempt_amount setuptax recurtax )
),
( map { $_ => $cust_main_county->get($_) }
qw( country state county taxclass )
)
};
$error = $new->insert and last;
}
}
if ( $error ) {
$cgi->param('error', $error);
}
</%init>
More information about the freeside-commits
mailing list