projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#17599: display cancelled services from history [display unprovisionable services...
[freeside.git]
/
FS
/
FS
/
cust_main.pm
diff --git
a/FS/FS/cust_main.pm
b/FS/FS/cust_main.pm
index
9ba1129
..
3fb0a87
100644
(file)
--- a/
FS/FS/cust_main.pm
+++ b/
FS/FS/cust_main.pm
@@
-2174,7
+2174,10
@@
reason and reason_otaker arguments will be taken from those objects.
sub cancel_pkgs {
my( $self, %opt ) = @_;
sub cancel_pkgs {
my( $self, %opt ) = @_;
- my $oldAutoCommit = $FS::UID::AutoCommit;
+ # we're going to cancel services, which is not reversible
+ die "cancel_pkgs cannot be run inside a transaction"
+ if $FS::UID::AutoCommit == 0;
+
local $FS::UID::AutoCommit = 0;
return ( 'access denied' )
local $FS::UID::AutoCommit = 0;
return ( 'access denied' )
@@
-2193,7
+2196,7
@@
sub cancel_pkgs {
my $ban = new FS::banned_pay $cust_payby->_new_banned_pay_hashref;
my $error = $ban->insert;
if ($error) {
my $ban = new FS::banned_pay $cust_payby->_new_banned_pay_hashref;
my $error = $ban->insert;
if ($error) {
- dbh->rollback
if $oldAutoCommit
;
+ dbh->rollback;
return ( $error );
}
return ( $error );
}
@@
-2213,13
+2216,16
@@
sub cancel_pkgs {
'time' => $cancel_time );
if ($error) {
warn "Error billing during cancel, custnum ". $self->custnum. ": $error";
'time' => $cancel_time );
if ($error) {
warn "Error billing during cancel, custnum ". $self->custnum. ": $error";
- dbh->rollback
if $oldAutoCommit
;
+ dbh->rollback;
return ( "Error billing during cancellation: $error" );
}
}
return ( "Error billing during cancellation: $error" );
}
}
+ dbh->commit;
+ $FS::UID::AutoCommit = 1;
my @errors;
my @errors;
- # now cancel all services, the same way we would for individual packages
+ # now cancel all services, the same way we would for individual packages.
+ # if any of them fail, cancel the rest anyway.
my @cust_svc = map { $_->cust_svc } @pkgs;
my @sorted_cust_svc =
map { $_->[0] }
my @cust_svc = map { $_->cust_svc } @pkgs;
my @sorted_cust_svc =
map { $_->[0] }
@@
-2236,7
+2242,6
@@
sub cancel_pkgs {
push @errors, $error if $error;
}
if (@errors) {
push @errors, $error if $error;
}
if (@errors) {
- dbh->rollback if $oldAutoCommit;
return @errors;
}
return @errors;
}
@@
-2259,12
+2264,7
@@
sub cancel_pkgs {
push @errors, 'pkgnum '.$_->pkgnum.': '.$error if $error;
}
push @errors, 'pkgnum '.$_->pkgnum.': '.$error if $error;
}
- if (@errors) {
- dbh->rollback if $oldAutoCommit;
- return @errors;
- }
-
- return;
+ return @errors;
}
sub _banned_pay_hashref {
}
sub _banned_pay_hashref {
@@
-4769,15
+4769,10
@@
Returns an SQL expression identifying un-cancelled cust_main records.
=cut
sub uncancelled_sql { uncancel_sql(@_); }
=cut
sub uncancelled_sql { uncancel_sql(@_); }
-sub uncancel_sql { "
- ( 0 < ( $select_count_pkgs
- AND ( cust_pkg.cancel IS NULL
- OR cust_pkg.cancel = 0
- )
- )
- OR 0 = ( $select_count_pkgs )
- )
-"; }
+sub uncancel_sql {
+ my $self = shift;
+ "( NOT (".$self->cancelled_sql.") )"; #sensitive to cust_main-status_module
+}
=item balance_sql
=item balance_sql