[freeside-commits] freeside/httemplate/edit/process part_pkg.cgi, 1.21, 1.22

Jeff Finucane,420,, jeff at wavetail.420.am
Sat Oct 13 10:33:50 PDT 2007


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv26810/httemplate/edit/process

Modified Files:
	part_pkg.cgi 
Log Message:
correct agent_defaultpkg handling

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/part_pkg.cgi,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- part_pkg.cgi	4 Oct 2007 02:07:30 -0000	1.21
+++ part_pkg.cgi	13 Oct 2007 17:33:48 -0000	1.22
@@ -1,6 +1,7 @@
 %
 %
 %my $dbh = dbh;
+%my $conf = new FS::Conf;
 %
 %my $pkgpart = $cgi->param('pkgpart');
 %
@@ -42,6 +43,9 @@
 %  } fields('part_pkg')
 %} );
 %
+%my $oldAutoCommit = $FS::UID::AutoCommit;
+%local $FS::UID::AutoCommit = 0;
+%
 %my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) }
 %              map { $_->svcpart }
 %              qsearch('part_svc', {} );
@@ -71,7 +75,7 @@
 %  $pkgpart = $new->pkgpart;
 %}
 %
-%unless ($error) {
+%unless ( $error || $conf->exists('agent_defaultpkg') ) {
 %  my $error = $new->process_m2m(
 %    'link_table'   => 'type_pkgs',
 %    'target_table' => 'agent_type',
@@ -79,11 +83,14 @@
 %  );
 %}
 %if ( $error ) {
+%  $dbh->rollback if $oldAutoCommit;
 %  $cgi->param('error', $error );
 %  print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
 %} elsif ( $custnum )  {
+%  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 %  print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");
 %} else {
+%  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
 %  print $cgi->redirect(popurl(3). "browse/part_pkg.cgi");
 %}
 %



More information about the freeside-commits mailing list