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 two 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;
77 #a good idea to queue anything that could fail or take any time
79 my( $self, $svcnum, $method ) = (shift, shift, shift);
80 my $queue = new FS::queue {
82 'job' => "FS::part_export::myexport::myexport_$method",
84 $queue->insert( @_ ) or $queue;
87 sub myexport_insert { #subroutine, not method
88 my( $username, $password ) = @_;
89 #do things with $username and $password
92 sub myexport_replace { #subroutine, not method
95 sub myexport_delete { #subroutine, not method
97 #do things with $username
100 sub myexport_suspend { #subroutine, not method
103 sub myexport_unsuspend { #subroutine, not method