projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bulk credit import, RT#26319
[freeside.git]
/
FS
/
FS
/
cust_svc.pm
diff --git
a/FS/FS/cust_svc.pm
b/FS/FS/cust_svc.pm
index
d6d7d4c
..
7bf41ee
100644
(file)
--- a/
FS/FS/cust_svc.pm
+++ b/
FS/FS/cust_svc.pm
@@
-1,12
+1,12
@@
package FS::cust_svc;
package FS::cust_svc;
+use base qw( FS::cust_main_Mixin FS::option_Common ); #FS::Record );
use strict;
use strict;
-use vars qw(
@ISA
$DEBUG $me $ignore_quantity $conf $ticket_system );
+use vars qw( $DEBUG $me $ignore_quantity $conf $ticket_system );
use Carp;
#use Scalar::Util qw( blessed );
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh str2time_sql );
use Carp;
#use Scalar::Util qw( blessed );
use FS::Conf;
use FS::Record qw( qsearch qsearchs dbh str2time_sql );
-use FS::cust_pkg;
use FS::part_pkg;
use FS::part_svc;
use FS::pkg_svc;
use FS::part_pkg;
use FS::part_svc;
use FS::pkg_svc;
@@
-18,7
+18,6
@@
use FS::UI::Web;
#most FS::svc_ classes are autoloaded in svc_x emthod
use FS::svc_acct; #this one is used in the cache stuff
#most FS::svc_ classes are autoloaded in svc_x emthod
use FS::svc_acct; #this one is used in the cache stuff
-@ISA = qw( FS::cust_main_Mixin FS::option_Common ); #FS::Record );
$DEBUG = 0;
$me = '[cust_svc]';
$DEBUG = 0;
$me = '[cust_svc]';
@@
-113,6
+112,10
@@
my $rt_session;
sub delete {
my $self = shift;
sub delete {
my $self = shift;
+
+ my $cust_pkg = $self->cust_pkg;
+ my $custnum = $cust_pkg->custnum if $cust_pkg;
+
my $error = $self->SUPER::delete;
return $error if $error;
my $error = $self->SUPER::delete;
return $error if $error;
@@
-126,7
+129,15
@@
sub delete {
$links->Limit(FIELD => 'Target',
VALUE => 'freeside://freeside/cust_svc/'.$svcnum);
while ( my $l = $links->Next ) {
$links->Limit(FIELD => 'Target',
VALUE => 'freeside://freeside/cust_svc/'.$svcnum);
while ( my $l = $links->Next ) {
- my ($val, $msg) = $l->Delete;
+ my ($val, $msg);
+ if ( $custnum ) {
+ # re-link to point to the customer instead
+ ($val, $msg) =
+ $l->SetTarget('freeside://freeside/cust_main/'.$custnum);
+ } else {
+ # unlinked service
+ ($val, $msg) = $l->Delete;
+ }
# can't do anything useful on error
warn "error unlinking ticket $svcnum: $msg\n" if !$val;
}
# can't do anything useful on error
warn "error unlinking ticket $svcnum: $msg\n" if !$val;
}
@@
-397,13
+408,6
@@
sub part_svc {
Returns the package this service belongs to, as a FS::cust_pkg object (see
L<FS::cust_pkg>).
Returns the package this service belongs to, as a FS::cust_pkg object (see
L<FS::cust_pkg>).
-=cut
-
-sub cust_pkg {
- my $self = shift;
- qsearchs( 'cust_pkg', { 'pkgnum' => $self->pkgnum } );
-}
-
=item pkg_svc
Returns the pkg_svc record for for this service, if applicable.
=item pkg_svc
Returns the pkg_svc record for for this service, if applicable.