X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=459206b1a0eaff57c33e356b672bdfbcbb5b5b32;hb=103dfde149eec5034696d073253255f508a1be78;hp=47f71c45890751c7eca158fa28dba437623d322c;hpb=a5bfed744069d69a1fe07eca1a64a2b22692cc22;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 47f71c458..459206b1a 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -41,6 +41,7 @@ use FS::cust_bill_void; use FS::reason; use FS::reason_type; use FS::L10N; +use FS::Misc::Savepoint; $DEBUG = 0; $me = '[FS::cust_bill]'; @@ -890,7 +891,7 @@ sub owed { Returns the amount to be displayed as the "Balance Due" on this invoice. Amount returned depends on conf flags for invoicing -See L for the true amount currently owed +See L for the true amount currently owed =cut @@ -974,6 +975,9 @@ sub apply_payments_and_credits { local $FS::UID::AutoCommit = 0; my $dbh = dbh; + my $savepoint_label = 'cust_bill__apply_payments_and_credits'; + savepoint_create( $savepoint_label ); + $self->select_for_update; #mutex my @payments = grep { $_->unapplied > 0 } @@ -1062,6 +1066,7 @@ sub apply_payments_and_credits { my $error = $app->insert(%options); if ( $error ) { + savepoint_rollback_and_release( $savepoint_label ); $dbh->rollback if $oldAutoCommit; return "Error inserting ". $app->table. " record: $error"; } @@ -1069,6 +1074,7 @@ sub apply_payments_and_credits { } + savepoint_release( $savepoint_label ); $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; #no error @@ -1366,7 +1372,7 @@ sub ftp_invoice { =item spool_invoice [ TEMPLATENAME ] -Spools this invoice data (see L) +Spools this invoice data (see L) TEMPLATENAME is unused? @@ -3824,7 +3830,7 @@ The delete method. =head1 SEE ALSO L, L, L, L, -L, L, schema.html from the base +L, L, schema.html from the base documentation. =cut