X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FReport%2FFCC_477.pm;h=4c94fff2e53355e03d3b1defba3b677d200072c9;hb=b00cb41411f82ce689308240e47fef1104a2ee0e;hp=582ddbee47e7cee2fa956add0f021959f2ddc087;hpb=743fcf73549f9290805ac1924df5e3cd87750500;p=freeside.git diff --git a/FS/FS/Report/FCC_477.pm b/FS/FS/Report/FCC_477.pm index 582ddbee4..4c94fff2e 100644 --- a/FS/FS/Report/FCC_477.pm +++ b/FS/FS/Report/FCC_477.pm @@ -142,25 +142,44 @@ Documentation. ); sub restore_fcc477map { - my $key = shift; - FS::Record::scalar_sql('',"select formvalue from fcc477map where formkey = ?",$key); + my $key = shift; + FS::Record::scalar_sql('',"select formvalue from fcc477map where formkey = ?",$key); } sub save_fcc477map { - my $key = shift; - my $value = shift; - - # lame, particularly lack of transactions - - 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; - - $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; - - ''; + my $key = shift; + my $value = shift; + + 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 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 do { + warn "WARNING: Error setting FCC 477 form defaults: " . $sth->errstr; + $dbh->rollback if $oldAutoCommit; + }; + + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + + ''; } sub parse_technology_option {