[freeside-commits] freeside/FS/FS/Report FCC_477.pm,1.4,1.5
Ivan,,,
ivan at wavetail.420.am
Thu Aug 18 15:35:53 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/Report
In directory wavetail.420.am:/tmp/cvs-serv7085
Modified Files:
FCC_477.pm
Log Message:
fix errors saving 477 form info if run concurrently, RT#13922
Index: FCC_477.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Report/FCC_477.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- FCC_477.pm 18 Aug 2011 01:15:41 -0000 1.4
+++ FCC_477.pm 18 Aug 2011 22:35:51 -0000 1.5
@@ -150,15 +150,34 @@
my $key = shift;
my $value = shift;
- # lame, particularly lack of transactions
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ # lame (should be normal FS::Record access)
my $sql = "delete from fcc477map where formkey = ?";
my $sth = dbh->prepare($sql) or die dbh->errstr;
- $sth->execute($key) or die "Error removing FCC 477 form defaults: " . $sth->errstr;
+ $sth->execute($key) or do {
+ warn "WARNING: Error removing FCC 477 form defaults: " . $sth->errstr;
+ $dbh->rollback if $oldAutoCommit;
+ };
$sql = "insert into fcc477map (formkey,formvalue) values (?,?)";
$sth = dbh->prepare($sql) or die dbh->errstr;
- $sth->execute($key,$value) or die "Error setting FCC 477 form defaults: " . $sth->errstr;
+ $sth->execute($key,$value) or do {
+ warn "WARNING: Error setting FCC 477 form defaults: " . $sth->errstr;
+ $dbh->rollback if $oldAutoCommit;
+ };
+
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
'';
}
More information about the freeside-commits
mailing list