use FS::reason;
use FS::reason_type;
use FS::L10N;
+use FS::Misc::Savepoint;
$DEBUG = 0;
$me = '[FS::cust_bill]';
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 }
my $error = $app->insert(%options);
if ( $error ) {
+ savepoint_rollback_and_release( $savepoint_label );
$dbh->rollback if $oldAutoCommit;
return "Error inserting ". $app->table. " record: $error";
}
}
+ savepoint_release( $savepoint_label );
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no error
sub send_csv {
my($self, %opt) = @_;
+ if ( $FS::Misc::DISABLE_ALL_NOTICES ) {
+ warn 'send_csv() disabled by $FS::Misc::DISABLE_ALL_NOTICES' if $DEBUG;
+ return;
+ }
+
#create file(s)
my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/cust_bill";
sub spool_csv {
my($self, %opt) = @_;
+ if ( $FS::Misc::DISABLE_ALL_NOTICES ) {
+ warn 'spool_csv() disabled by $FS::Misc::DISABLE_ALL_NOTICES' if $DEBUG;
+ return;
+ }
+
my $time = $opt{'time'} || time;
my $cust_main = $self->cust_main;
$total_descr = $self->mt('Total Charges');
}
- if ( $conf->exists('invoice_show_prior_due_date') ) {
+ if ( $conf->exists('invoice_show_prior_due_date') && !$conf->exists('invoice_omit_due_date') ) {
# then the due date should be shown with Total New Charges,
# and should NOT be shown with the Balance Due message.
if ( $self->due_date ) {
- $total_descr = join(' ',
- $total_descr,
- '-',
- $self->mt('Please pay by'),
- $self->due_date2str('short')
- );
+ $total_descr .= $self->invoice_pay_by_msg;
} elsif ( $self->terms ) {
$total_descr = join(' ',
$total_descr,