1 package FS::part_export::ikano;
3 use vars qw(@ISA %info);
5 use Date::Format qw( time2str );
6 use FS::Record qw(qsearch dbh);
10 @ISA = qw(FS::part_export);
12 tie my %options, 'Tie::IxHash',
13 'keyid' => { label=>'Ikano keyid' },
14 'username' => { label=>'Ikano username',
17 'password' => { label=>'Ikano password' },
18 'check_networks' => { label => 'Check Networks',
19 default => 'ATT,BELLCA',
25 'desc' => 'Provision DSL to Ikano',
26 'options' => \%options,
28 Requires installation of
29 <a href="http://search.cpan.org/dist/Net-Ikano">Net::Ikano</a> from CPAN.
33 sub rebless { shift; }
40 my($svc_dsl,$date_format,$separator) = (shift,shift,shift);
41 my %orderTypes = ( 'N' => 'New', 'X' => 'Cancel', 'C' => 'Change' );
42 my %orderStatus = ( 'N' => 'New', 'P' => 'Pending', 'X' => 'Cancelled',
43 'C' => 'Completed', 'E' => 'Error' );
44 my $status = "Ikano ".$orderTypes{$svc_dsl->vendor_order_type}." order #"
45 . $svc_dsl->vendor_order_id . " (Status: "
46 . $orderStatus{$svc_dsl->vendor_order_status} . ") $separator ";
47 my $monitored = $svc_dsl->monitored eq 'Y' ? 'Yes' : 'No';
48 my $pushed = $svc_dsl->pushed ?
49 time2str("$date_format %k:%M",$svc_dsl->pushed) : "never";
50 my $last_pull = $svc_dsl->last_pull ?
51 time2str("$date_format %k:%M",$svc_dsl->last_pull) : "never";
52 my $ddd = $svc_dsl->desired_dd ? time2str($date_format,$svc_dsl->desired_dd)
54 my $dd = $svc_dsl->dd ? time2str($date_format,$svc_dsl->dd) : "";
55 $status .= "$separator Pushed: $pushed Monitored: $monitored Last Pull: ";
56 $status .= "$lastpull $separator $separator Desired Due Date: $ddd ";
57 $status .= "Due Date: $dd";
62 my( $self, $command, @args ) = @_;
64 eval "use Net::Ikano;";
67 my $ikano = Net::Ikano->new(
68 'keyid' => $self->option('keyid'),
69 'username' => $self->option('username'),
70 'password' => $self->option('password'),
74 $ikano->$command(@args);
78 my( $self, $svc_dsl ) = (shift, shift);
83 my( $self, $new, $old ) = (shift, shift, shift);
88 my( $self, $svc_dsl ) = (shift, shift);
93 my( $self, $svc_dsl ) = (shift, shift);
97 sub _export_unsuspend {
98 my( $self, $svc_dsl ) = (shift, shift);