projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'FREESIDE_4_BRANCH' of ssh://git.freeside.biz/home/git/freeside into...
[freeside.git]
/
FS
/
FS
/
cust_bill.pm
diff --git
a/FS/FS/cust_bill.pm
b/FS/FS/cust_bill.pm
index
d4383f9
..
84487d2
100644
(file)
--- 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::reason;
use FS::reason_type;
use FS::L10N;
+use FS::Misc::Savepoint;
$DEBUG = 0;
$me = '[FS::cust_bill]';
$DEBUG = 0;
$me = '[FS::cust_bill]';
@@
-971,6
+972,9
@@
sub apply_payments_and_credits {
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
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 }
$self->select_for_update; #mutex
my @payments = grep { $_->unapplied > 0 }
@@
-1059,6
+1063,7
@@
sub apply_payments_and_credits {
my $error = $app->insert(%options);
if ( $error ) {
my $error = $app->insert(%options);
if ( $error ) {
+ savepoint_rollback_and_release( $savepoint_label );
$dbh->rollback if $oldAutoCommit;
return "Error inserting ". $app->table. " record: $error";
}
$dbh->rollback if $oldAutoCommit;
return "Error inserting ". $app->table. " record: $error";
}
@@
-1066,6
+1071,7
@@
sub apply_payments_and_credits {
}
}
+ savepoint_release( $savepoint_label );
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no error
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no error
@@
-1402,6
+1408,11
@@
See L</print_csv> for a description of the output format.
sub send_csv {
my($self, %opt) = @_;
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";
#create file(s)
my $spooldir = "/usr/local/etc/freeside/export.". datasrc. "/cust_bill";
@@
-1478,6
+1489,11
@@
in the ICS format.
sub spool_csv {
my($self, %opt) = @_;
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;
my $time = $opt{'time'} || time;
my $cust_main = $self->cust_main;
@@
-2713,7
+2729,7
@@
sub _items_svc_phone_sections {
}
}
-=
sub
_items_usage_class_summary OPTIONS
+=
item
_items_usage_class_summary OPTIONS
Returns a list of detail items summarizing the usage charges on this
invoice. Each one will have 'amount', 'description' (the usage charge name),
Returns a list of detail items summarizing the usage charges on this
invoice. Each one will have 'amount', 'description' (the usage charge name),
@@
-2762,7
+2778,7
@@
sub _items_usage_class_summary {
return @l;
}
return @l;
}
-=
sub
_items_previous()
+=
item
_items_previous()
Returns an array of hashrefs, each hashref representing a line-item on
the current bill for previous unpaid invoices.
Returns an array of hashrefs, each hashref representing a line-item on
the current bill for previous unpaid invoices.
@@
-2896,7
+2912,7
@@
sub _items_previous {
}
}
-=
sub
_items_previous_total
+=
item
_items_previous_total
Return sum of amounts from all items returned by _items_previous
Results will vary based on invoicing conf flags
Return sum of amounts from all items returned by _items_previous
Results will vary based on invoicing conf flags
@@
-2946,7
+2962,7
@@
sub __items_previous_map_invoice {
}
}
}
}
-=
sub
_items_credits()
+=
item
_items_credits()
Return array of hashrefs containing credits to be shown as line-items
when rendering this bill.
Return array of hashrefs containing credits to be shown as line-items
when rendering this bill.
@@
-3085,7
+3101,7
@@
sub _items_credits {
@return;
}
@return;
}
-=
sub
_items_credits_total
+=
item
_items_credits_total
Return the total of al items from _items_credits
Will vary based on invoice display conf flag
Return the total of al items from _items_credits
Will vary based on invoice display conf flag
@@
-3101,7
+3117,7
@@
sub _items_credits_total {
-=
sub
_items_credits_postbill()
+=
item
_items_credits_postbill()
Returns an array of hashrefs for credits where
- Credit issued after this invoice
Returns an array of hashrefs for credits where
- Credit issued after this invoice
@@
-3143,7
+3159,7
@@
sub _items_credits_postbill {
}} @cust_credit_bill;
}
}} @cust_credit_bill;
}
-=
sub
_items_payments_postbill()
+=
item
_items_payments_postbill()
Returns an array of hashrefs for payments where
- Payment occured after this invoice
Returns an array of hashrefs for payments where
- Payment occured after this invoice
@@
-3179,7
+3195,7
@@
sub _items_payments_postbill {
}} @cust_bill_pay;
}
}} @cust_bill_pay;
}
-=
sub
_items_payments()
+=
item
_items_payments()
Return array of hashrefs containing payments to be shown as line-items
when rendering this bill.
Return array of hashrefs containing payments to be shown as line-items
when rendering this bill.
@@
-3240,7
+3256,6
@@
sub _items_payments {
if ( $self->conf->exists('previous_balance-payments_since') ) {
if ($template eq 'statement') {
if ( $self->conf->exists('previous_balance-payments_since') ) {
if ($template eq 'statement') {
-print "\nCASE 3\n";
# Case 3 (see above)
# Return payments timestamped between the previous and following bills
# Case 3 (see above)
# Return payments timestamped between the previous and following bills
@@
-3264,7
+3279,7
@@
print "\nCASE 3\n";
} else {
# Case 2 (see above)
# Return payments timestamped between this and the previous bill
} else {
# Case 2 (see above)
# Return payments timestamped between this and the previous bill
-print "\nCASE 2\n";
+
my $date_start = 0;
my $date_end = $self->_date;
my $date_start = 0;
my $date_end = $self->_date;
@@
-3298,7
+3313,7
@@
print "\nCASE 2\n";
return @{ $self->get('_items_payments') };
}
return @{ $self->get('_items_payments') };
}
-=
sub
_items_payments_total
+=
item
_items_payments_total
Return a total of all records returned by _items_payments
Results vary based on invoicing conf flags
Return a total of all records returned by _items_payments
Results vary based on invoicing conf flags
@@
-3355,7
+3370,7
@@
sub __items_payments_make_hashref {
return @return;
}
return @return;
}
-=
sub
_items_total()
+=
item
_items_total()
Generate the line-items to be shown on the bill in the "Totals" section
Generate the line-items to be shown on the bill in the "Totals" section
@@
-3445,17
+3460,12
@@
sub _items_total {
$total_descr = $self->mt('Total Charges');
}
$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 ) {
# 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,
} elsif ( $self->terms ) {
$total_descr = join(' ',
$total_descr,