[freeside-commits] freeside/httemplate/edit/process part_pkg_taxclass.html, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Tue Jun 30 12:38:59 PDT 2009
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv2795/httemplate/edit/process
Modified Files:
part_pkg_taxclass.html
Log Message:
disabling a taxclass, RT#5472
Index: part_pkg_taxclass.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/part_pkg_taxclass.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- part_pkg_taxclass.html 20 Feb 2008 01:16:55 -0000 1.1
+++ part_pkg_taxclass.html 30 Jun 2009 19:38:57 -0000 1.2
@@ -1,53 +1,17 @@
-% if ( $error ) {
-% $cgi->param('error', $error);
-<% $cgi->redirect(popurl(2). "part_pkg_taxclass.html?". $cgi->query_string ) %>
-%} else {
-<% $cgi->redirect(popurl(3). "browse/cust_main_county.cgi?taxclass=". uri_escape($part_pkg_taxclass->taxclass) ) %>
-%}
+<% include( 'elements/process.html',
+ 'table' => 'part_pkg_taxclass',
+ 'redirect' => sub {
+ my( $cgi, $part_pkg_taxclass ) = @_;
+
+ popurl(3). 'browse/cust_main_county.cgi?'.
+ 'taxclass='. uri_escape($part_pkg_taxclass->taxclass).
+ ';dummy=';
+ },
+ )
+%>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my $part_pkg_taxclass = new FS::part_pkg_taxclass {
- 'taxclass' => $cgi->param('taxclass'),
-};
-
-#maybe this whole thing should be in a transaction. at some point, no biggie
-#none of the follow-up stuff will fail unless there's a more serious problem
-#than a hanging record in part_pkg_taxclass...
-
-my $error = $part_pkg_taxclass->insert;
-
-unless ( $error ) {
- #auto-add the new taxclass to any regions that have taxclasses already
-
- my $sth = dbh->prepare("
- SELECT country, state, county FROM cust_main_county
- WHERE taxclass IS NOT NULL AND taxclass != ''
- GROUP BY country, state, county
- ") or die dbh->errstr;
- $sth->execute or die $sth->errstr;
-
- while ( my $row = $sth->fetchrow_hashref ) {
- warn "inserting for $row";
- my $cust_main_county = new FS::cust_main_county {
- 'country' => $row->{country},
- 'state' => $row->{state},
- 'county' => $row->{county},
- 'tax' => 0,
- 'taxclass' => $part_pkg_taxclass->taxclass,
- #exempt_amount
- #taxname
- #setuptax
- #recurtax
- };
- $error = $cust_main_county->insert;
- #last if $error;
- die $error if $error;
- }
-
-
-}
-
</%init>
More information about the freeside-commits
mailing list