From 12ec7e574507f247ba5f83df4f7326b42f796267 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 23 Feb 2004 08:12:54 +0000 Subject: [PATCH] implement fallback suspension code --- FS/FS/part_export.pm | 10 +++++++--- FS/FS/svc_Common.pm | 26 +++++++++++++++++++++++++- FS/FS/svc_acct.pm | 28 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm index 17726cb9b..d00bf5782 100644 --- a/FS/FS/part_export.pm +++ b/FS/FS/part_export.pm @@ -468,18 +468,22 @@ sub _export_delete { return "_export_delete: unknown export type ". $self->exporttype; } -#fallbacks providing null operations +#call svcdb-specific fallbacks sub _export_suspend { my $self = shift; #warn "warning: _export_suspened unimplemented for". ref($self); - ''; + my $svc_x = shift; + my $new = $svc_x->clone_suspended; + $self->_export_replace( $new, $svc_x ); } sub _export_unsuspend { my $self = shift; #warn "warning: _export_unsuspend unimplemented for ". ref($self); - ''; + my $svc_x = shift; + my $old = $svc_x->clone_kludge_unsuspend; + $self->_export_replace( $svc_x, $old ); } =back diff --git a/FS/FS/svc_Common.pm b/FS/FS/svc_Common.pm index 2e236ee2e..a4011f049 100644 --- a/FS/FS/svc_Common.pm +++ b/FS/FS/svc_Common.pm @@ -376,11 +376,35 @@ methods. Called by the cancel method of FS::cust_pkg (see L). sub cancel { ''; } +=item clone_suspended + +Constructor used by FS::part_export::_export_suspend fallback. Stub returning +same object for svc_ classes which don't implement a suspension fallback +(everything except svc_acct at the moment). Document better. + +=cut + +sub clone_suspended { + shift; +} + +=item clone_kludge_unsuspend + +Constructor used by FS::part_export::_export_unsuspend fallback. Stub returning +same object for svc_ classes which don't implement a suspension fallback +(everything except svc_acct at the moment). Document better. + +=cut + +sub clone_kludge_unsuspend { + shift; +} + =back =head1 VERSION -$Id: svc_Common.pm,v 1.12.4.4 2003-11-12 12:29:55 ivan Exp $ +$Id: svc_Common.pm,v 1.12.4.5 2004-02-23 08:12:54 ivan Exp $ =head1 BUGS diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index 8c99c9e48..e49c2ebe7 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -1080,6 +1080,34 @@ sub radius_groups { } } +=item clone_suspended + +Constructor used by FS::part_export::_export_suspend fallback. Document +better. + +=cut + +sub clone_suspended { + my $self = shift; + my %hash = $self->hash; + $hash{_password} = join('',map($pw_set[ int(rand $#pw_set) ], (0..7) ) ); + new FS::svc_acct \%hash; +} + +=item clone_kludge_unsuspend + +Constructor used by FS::part_export::_export_unsuspend fallback. Document +better. + +=cut + +sub clone_kludge_unsuspend { + my $self = shift; + my %hash = $self->hash; + $hash{_password} = ''; + new FS::svc_acct \%hash; +} + =back =head1 SUBROUTINES -- 2.11.0