1 package FS::part_export::myexport;
3 use vars qw(@ISA %info);
7 @ISA = qw(FS::part_export);
9 tie my %options, 'Tie::IxHash',
10 'regular_option' => { label => 'Option description', default => 'value' },
11 'select_option' => { label => 'Select option description',
12 type => 'select', options=>[qw(chocolate vanilla)],
15 'textarea_option' => { label => 'Textarea option description',
17 default => 'Default text.',
19 'checkbox_option' => { label => 'Checkbox label', type => 'checkbox' },
24 #'svc' => [qw( svc_acct svc_forward )],
26 'Export short description',
27 'options' => \%options,
30 HTML notes about this export.
33 sub rebless { shift; }
36 my($self, $svc_something) = (shift, shift);
37 $err_or_queue = $self->myexport_queue( $svc_something->svcnum, 'insert',
38 $svc_something->username, $svc_something->_password );
39 ref($err_or_queue) ? '' : $err_or_queue;
43 my( $self, $new, $old ) = (shift, shift, shift);
44 #return "can't change username with myexport"
45 # if $old->username ne $new->username;
46 #return '' unless $old->_password ne $new->_password;
47 $err_or_queue = $self->myexport_queue( $new->svcnum,
48 'replace', $new->username, $new->_password );
49 ref($err_or_queue) ? '' : $err_or_queue;
53 my( $self, $svc_something ) = (shift, shift);
54 $err_or_queue = $self->myexport_queue( $svc_something->svcnum,
55 'delete', $svc_something->username );
56 ref($err_or_queue) ? '' : $err_or_queue;
59 #these three are optional
60 # fallback for svc_acct will change and restore password
62 my( $self, $svc_something ) = (shift, shift);
63 $err_or_queue = $self->myexport_queue( $svc_something->svcnum,
64 'suspend', $svc_something->username );
65 ref($err_or_queue) ? '' : $err_or_queue;
68 sub _export_unsuspend {
69 my( $self, $svc_something ) = (shift, shift);
70 $err_or_queue = $self->myexport_queue( $svc_something->svcnum,
71 'unsuspend', $svc_something->username );
72 ref($err_or_queue) ? '' : $err_or_queue;
76 my($self, $svc_something, $arrayref) = (shift, shift, shift);
77 #push @$arrayref, qq!<A HREF="http://example.com/~!. $svc_something->username.
78 # qq!">!. $svc_something->username. qq!</A>!;
84 #a good idea to queue anything that could fail or take any time
86 my( $self, $svcnum, $method ) = (shift, shift, shift);
87 my $queue = new FS::queue {
89 'job' => "FS::part_export::myexport::myexport_$method",
91 $queue->insert( @_ ) or $queue;
94 sub myexport_insert { #subroutine, not method
95 my( $username, $password ) = @_;
96 #do things with $username and $password
99 sub myexport_replace { #subroutine, not method
102 sub myexport_delete { #subroutine, not method
103 my( $username ) = @_;
104 #do things with $username
107 sub myexport_suspend { #subroutine, not method
110 sub myexport_unsuspend { #subroutine, not method