oops forgot these from working on the road
[freeside.git] / eg / export_template.pm
1 package FS::part_export::myexport;
2
3 use vars qw(@ISA);
4 use FS::part_export;
5
6 @ISA = qw(FS::part_export);
7
8 sub rebless { shift; }
9
10 sub _export_insert {
11   my($self, $svc_something) = (shift, shift);
12   $self->myexport_queue( $svc_acct->svcnum, 'insert',
13     $svc_something->username, $svc_something->password );
14 }
15
16 sub _export_replace {
17   my( $self, $new, $old ) = (shift, shift, shift);
18   #return "can't change username with myexport"
19   #  if $old->username ne $new->username;
20   #return '' unless $old->_password ne $new->_password;
21   $self->myexport_queue( $new->svcnum,
22     'replace', $new->username, $new->password );
23 }
24
25 sub _export_delete {
26   my( $self, $svc_something ) = (shift, shift);
27   $self->myexport_queue( $svc_acct->svcnum,
28     'delete', $svc_something->username );
29 }
30
31 #a good idea to queue anything that could fail or take any time
32 sub myexport_queue {
33   my( $self, $svcnum, $method ) = (shift, shift, shift);
34   my $queue = new FS::queue {
35     'svcnum' => $svcnum,
36     'job'    => "FS::part_export::myexport::myexport_$method",
37   };
38   $queue->insert( @_ );
39 }
40
41 sub myexport_insert { #subroutine, not method
42 }
43 sub myexport_replace { #subroutine, not method
44 }
45 sub myexport_delete { #subroutine, not method
46 }
47