diff options
author | levinse <levinse> | 2010-11-25 01:46:34 +0000 |
---|---|---|
committer | levinse <levinse> | 2010-11-25 01:46:34 +0000 |
commit | 46ef8524cf2e6db7b851967062ce92ffb0773d10 (patch) | |
tree | 5698390a5c5f95b15997264319f1a1303f97271e /FS/FS | |
parent | 39289cd1e5a06044aa9a8dc3d2e4d8c9ffb02b11 (diff) |
ikano.pm initial commit, svc_dsl UI initial commit, and svc_dsl on-going work, RT7111
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/Schema.pm | 14 | ||||
-rw-r--r-- | FS/FS/part_export/ikano.pm | 102 | ||||
-rw-r--r-- | FS/FS/part_svc.pm | 11 | ||||
-rw-r--r-- | FS/FS/svc_dsl.pm | 63 |
4 files changed, 183 insertions, 7 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 89f3c63..39b1ab7 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -1682,7 +1682,7 @@ sub tables_hashref { 'columns' => [ 'qualnum', 'serial', '', '', '', '', 'contactnum', 'int', '', '', '', '', - 'svctn', 'int', 'NULL', '', '', '', + 'svctn', 'varchar', 'NULL', 24, '', '', 'svcdb', 'varchar', '', $char_d, '', '', 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '', 'status', 'char', '', 1, '', '', @@ -1837,16 +1837,16 @@ sub tables_hashref { 'columns' => [ 'svcnum', 'int', '', '', '', '', 'pushed', 'int', 'NULL', '', '', '', - 'desired_dd', 'int', '', '', '', '', + 'desired_dd', 'int', 'NULL', '', '', '', 'dd', 'int', 'NULL', '', '', '', 'vendor_order_id', 'varchar', 'NULL', $char_d, '', '', 'vendor_qual_id', 'varchar', 'NULL', $char_d, '', '', - 'vendor_order_type', 'char', '', 1, '', '', + 'vendor_order_type', 'char', 'NULL', 1, '', '', 'vendor_order_status', 'char', 'NULL', 1, '', '', - 'first', 'varchar', '', $char_d, '', '', - 'last', 'varchar', '', $char_d, '', '', + 'first', 'varchar', 'NULL', $char_d, '', '', + 'last', 'varchar', 'NULL', $char_d, '', '', 'company', 'varchar', 'NULL', $char_d, '', '', - 'svctn', 'int', 'NULL', '', '', '', + 'svctn', 'varchar', 'NULL', 24, '', '', 'loop_type', 'char', 'NULL', 1, '', '', 'lvp', 'varchar', 'NULL', $char_d, '', '', 'cktnum', 'varchar', 'NULL', $char_d, '', '', @@ -1856,7 +1856,7 @@ sub tables_hashref { 'username', 'varchar', 'NULL', $char_d, '', '', 'password', 'varchar', 'NULL', $char_d, '', '', 'staticips', 'text', 'NULL', '', '', '', - 'monitored', 'char', '', 1, '', '', + 'monitored', 'char', 'NULL', 1, '', '', 'last_pull', 'int', 'NULL', '', '', '', 'notes', 'text', 'NULL', '', '', '', ], diff --git a/FS/FS/part_export/ikano.pm b/FS/FS/part_export/ikano.pm new file mode 100644 index 0000000..c44db64 --- /dev/null +++ b/FS/FS/part_export/ikano.pm @@ -0,0 +1,102 @@ +package FS::part_export::ikano; + +use vars qw(@ISA %info); +use Tie::IxHash; +use Date::Format qw( time2str ); +use FS::Record qw(qsearch dbh); +use FS::part_export; +use FS::svc_dsl; + +@ISA = qw(FS::part_export); + +tie my %options, 'Tie::IxHash', + 'keyid' => { label=>'Ikano keyid' }, + 'username' => { label=>'Ikano username', + default => 'admin', + }, + 'password' => { label=>'Ikano password' }, + 'check_networks' => { label => 'Check Networks', + default => 'ATT,BELLCA', + }, +; + +%info = ( + 'svc' => 'svc_dsl', + 'desc' => 'Provision DSL to Ikano', + 'options' => \%options, + 'notes' => <<'END' +Requires installation of +<a href="http://search.cpan.org/dist/Net-Ikano">Net::Ikano</a> from CPAN. +END +); + +sub rebless { shift; } + +sub dsl_pull { + ''; +} + +sub status_line { + my($svc_dsl,$date_format,$separator) = (shift,shift,shift); + my %orderTypes = ( 'N' => 'New', 'X' => 'Cancel', 'C' => 'Change' ); + my %orderStatus = ( 'N' => 'New', 'P' => 'Pending', 'X' => 'Cancelled', + 'C' => 'Completed', 'E' => 'Error' ); + my $status = "Ikano ".$orderTypes{$svc_dsl->vendor_order_type}." order #" + . $svc_dsl->vendor_order_id . " (Status: " + . $orderStatus{$svc_dsl->vendor_order_status} . ") $separator "; + my $monitored = $svc_dsl->monitored eq 'Y' ? 'Yes' : 'No'; + my $pushed = $svc_dsl->pushed ? + time2str("$date_format %k:%M",$svc_dsl->pushed) : "never"; + my $last_pull = $svc_dsl->last_pull ? + time2str("$date_format %k:%M",$svc_dsl->last_pull) : "never"; + my $ddd = $svc_dsl->desired_dd ? time2str($date_format,$svc_dsl->desired_dd) + : ""; + my $dd = $svc_dsl->dd ? time2str($date_format,$svc_dsl->dd) : ""; + $status .= "$separator Pushed: $pushed Monitored: $monitored Last Pull: "; + $status .= "$lastpull $separator $separator Desired Due Date: $ddd "; + $status .= "Due Date: $dd"; + return $status; +} + +sub ikano_command { + my( $self, $command, @args ) = @_; + + eval "use Net::Ikano;"; + die $@ if $@; + + my $ikano = Net::Ikano->new( + 'keyid' => $self->option('keyid'), + 'username' => $self->option('username'), + 'password' => $self->option('password'), + #'debug' => 1, + ); + + $ikano->$command(@args); +} + +sub _export_insert { + my( $self, $svc_dsl ) = (shift, shift); + ''; +} + +sub _export_replace { + my( $self, $new, $old ) = (shift, shift, shift); + ''; +} + +sub _export_delete { + my( $self, $svc_dsl ) = (shift, shift); + ''; +} + +sub _export_suspend { + my( $self, $svc_dsl ) = (shift, shift); + ''; +} + +sub _export_unsuspend { + my( $self, $svc_dsl ) = (shift, shift); + ''; +} + +1; diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm index 3ed153e..164bad0 100644 --- a/FS/FS/part_svc.pm +++ b/FS/FS/part_svc.pm @@ -459,6 +459,17 @@ sub part_export_did { grep $_->can('get_dids'), $self->part_export; } +=item part_export_dsl_pull + +Returns a list of any exports (see L<FS::part_export>) for this service that +are capable of pulling/pushing DSL orders. + +=cut + +sub part_export_dsl_pull { + my $self = shift; + grep $_->can('dsl_pull'), $self->part_export; +} =item cust_svc [ PKGPART ] diff --git a/FS/FS/svc_dsl.pm b/FS/FS/svc_dsl.pm index 0b4b0d1..2e84dea 100644 --- a/FS/FS/svc_dsl.pm +++ b/FS/FS/svc_dsl.pm @@ -155,8 +155,71 @@ points to. You can ask the object for a copy with the I<hash> method. # the new method can be inherited from FS::Record, if a table method is defined +sub table_info { + my %dis1 = ( disable_default=>1, disable_fixed=>1, disable_inventory=>1, disable_select=>1 ); + my %dis2 = ( disable_inventory=>1, disable_select=>1 ); + + { + 'name' => 'DSL', + 'sorts' => [ 'svctn' ], + 'display_weight' => 55, + 'cancel_weight' => 75, + 'fields' => { + 'pushed' => { label => 'Pushed', + type => 'disabled' }, + 'desired_dd' => { label => 'Desired Due Date', %dis2, }, + 'dd' => { label => 'Due Date', %dis2, }, + 'vendor_order_id' => { label => 'Vendor Order Id', %dis2, }, + 'vendor_qual_id' => { label => 'Vendor Qualification Id', + type => 'disabled' }, + 'vendor_order_type' => { label => 'Vendor Order Type', + disable_inventory => 1, + }, + 'vendor_order_status' => { label => 'Vendor Order Status', + disable_inventory => 1, + }, + 'first' => { label => 'First Name', %dis2, }, + 'last' => { label => 'Last Name', %dis2, }, + 'company' => { label => 'Company Name', %dis2, }, + 'svctn' => { label => 'Service Telephone Number', }, + 'loop_type' => { label => 'Loop Type', + disable_inventory => 1, + }, + 'lvp' => { label => 'Local Voice Provider', + disable_inventory => 1, + }, + 'cktnum' => { label => 'Circuit #', }, + 'rate_band' => { label => 'Rate Band', + disable_inventory => 1, + }, + 'isp_chg' => { label => 'ISP Changing?', + type => 'checkbox', %dis2 }, + 'isp_prev' => { label => 'Current or Previous ISP', + disable_inventory => 1, + }, + 'username' => { label => 'PPPoE Username', + type => 'text', + }, + 'password' => { label => 'PPPoE Password', %dis2 }, + 'staticips' => { label => 'Static IPs', %dis1 }, + 'monitored' => { label => 'Monitored', + type => 'checkbox', %dis2 }, + 'last_pull' => { label => 'Last Pull', type => 'disabled' }, + 'notes' => { label => 'Order Notes', %dis1 }, + }, + }; +} + sub table { 'svc_dsl'; } +sub label { + my $self = shift; + return $self->svctn if $self->svctn; + return $self->username if $self->username; + return $self->vendor_order_id if $self->vendor_order_id; + return $self->svcnum; +} + =item insert Adds this record to the database. If there is an error, returns the error, |