[freeside-commits] freeside/httemplate/edit/process/elements ApplicationCommon.html, 1.3, 1.4

Jeff Finucane,420,, jeff at wavetail.420.am
Wed Oct 28 12:01:20 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process/elements
In directory wavetail.420.am:/tmp/cvs-serv6542/httemplate/edit/process/elements

Modified Files:
	ApplicationCommon.html 
Log Message:
UI changes for credit applications include on the fly tax calculations #4729

Index: ApplicationCommon.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/elements/ApplicationCommon.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ApplicationCommon.html	26 Oct 2009 07:12:12 -0000	1.3
+++ ApplicationCommon.html	28 Oct 2009 19:01:18 -0000	1.4
@@ -34,6 +34,8 @@
 
 my %opt = @_;
 
+my $error = '';
+
 my $src_thing = ucfirst($opt{'src_thing'});
 my $src_table = $opt{'src_table'};
 my $src_pkey = dbdef->table($src_table)->primary_key;
@@ -58,6 +60,10 @@
 
 my %options = ();
 $options{subitems} = \@subitems if scalar(@subitems);
+
+my $oldAutoCommit = $FS::UID::AutoCommit;
+local $FS::UID::AutoCommit = 0;
+my $dbh = dbh;
  
 my $new;
 #  $new = new FS::cust_refund ( {
@@ -70,6 +76,11 @@
 #  } );
 #} else {
 
+  if ($src->amount != $cgi->param('src_amount')) {
+    $src->amount($cgi->param('src_amount'));
+    $error = $src->replace;
+  }
+
   my $class = 'FS::'. $opt{link_table};
 
   $new = $class->new( {
@@ -82,6 +93,11 @@
 
 
 $options{manual} = 1;
-my $error = $new->insert( %options );
+$error ||= $new->insert( %options );
 
+if ($error) {
+  $dbh->rollback if $oldAutoCommit;
+} else {
+  $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+}
 </%init>



More information about the freeside-commits mailing list