summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm22
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/Record.pm14
-rw-r--r--FS/FS/Schema.pm7
-rw-r--r--FS/FS/svc_phone.pm28
5 files changed, 76 insertions, 2 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 9a20285..d619e84 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -18,6 +18,7 @@ use FS::Conf;
use FS::Record qw(qsearch qsearchs dbh);
use FS::Msgcat qw(gettext);
use FS::Misc qw(card_types);
+use FS::Misc::DateTime qw(parse_datetime);
use FS::ClientAPI_SessionCache;
use FS::svc_acct;
use FS::svc_domain;
@@ -978,6 +979,7 @@ sub list_pkgs {
'wholesale_view' => 1,
'login_svcpart' => [ $conf->config('selfservice_server-login_svcpart') ],
'date_format' => $conf->config('date_format') || '%m/%d/%Y',
+ 'lnp' => $conf->exists('svc_phone-lnp'),
};
}
@@ -1568,7 +1570,23 @@ sub cancel_pkg {
sub provision_phone {
my $p = shift;
- my @bulkdid = @{$p->{'bulkdid'}};
+ my @bulkdid;
+ @bulkdid = @{$p->{'bulkdid'}} if $p->{'bulkdid'};
+
+# single DID LNP
+ unless($p->{'lnp'}) {
+ $p->{'lnp_desired_due_date'} = parse_datetime($p->{'lnp_desired_due_date'});
+ $p->{'lnp_status'} = "portingin";
+ return _provision( 'FS::svc_phone',
+ [qw(lnp_desired_due_date lnp_other_provider
+ lnp_other_provider_account phonenum countrycode lnp_status)],
+ [qw(phonenum countrycode)],
+ $p,
+ @_
+ );
+ }
+
+# single DID order
unless (scalar(@bulkdid)) {
return _provision( 'FS::svc_phone',
[qw(phonenum countrycode)],
@@ -1578,7 +1596,7 @@ sub provision_phone {
);
}
-# bulk case
+# bulk DID order case
my $error;
foreach my $did ( @bulkdid ) {
$did =~ s/[^0-9]//g;
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 132ee47..fbf18cb 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3789,6 +3789,13 @@ and customer address. Include units.',
'description' => 'Maximum length of the phone service "Name" field (svc_phone.phone_name). Sometimes useful to limit this (to 15?) when exporting as Caller ID data.',
'type' => 'text',
},
+
+ {
+ 'key' => 'svc_phone-lnp',
+ 'section' => '',
+ 'description' => 'Enables Number Portability features for svc_phone',
+ 'type' => 'checkbox',
+ },
{
'key' => 'default_phone_countrycode',
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 16520f4..2e2612e 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -2589,6 +2589,20 @@ sub ut_enum {
return "Illegal (enum) field $field: ". $self->getfield($field);
}
+=item ut_enumn COLUMN CHOICES_ARRAYREF
+
+Like ut_enum, except the null value is also allowed.
+
+=cut
+
+sub ut_enumn {
+ my( $self, $field, $choices ) = @_;
+ $self->getfield($field)
+ ? $self->ut_enum($field, $choices)
+ : '';
+}
+
+
=item ut_foreign_key COLUMN FOREIGN_TABLE FOREIGN_COLUMN
Check/untaint a foreign column key. Call a regular ut_ method (like ut_number)
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 253eb66..7224341 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -2873,6 +2873,13 @@ sub tables_hashref {
'pbxsvc', 'int', 'NULL', '', '', '',
'domsvc', 'int', 'NULL', '', '', '',
'locationnum', 'int', 'NULL', '', '', '',
+ 'lnp_status', 'varchar', 'NULL', $char_d, '', '',
+ 'portable', 'char', 'NULL', 1, '', '',
+ 'lrn', 'char', 'NULL', 10, '', '',
+ 'lnp_desired_due_date', 'int', 'NULL', '', '', '',
+ 'lnp_due_date', 'int', 'NULL', '', '', '',
+ 'lnp_other_provider', 'varchar', 'NULL', $char_d, '', '',
+ 'lnp_other_provider_account', 'varchar', 'NULL', $char_d, '', '',
],
'primary_key' => 'svcnum',
'unique' => [],
diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm
index adf7a6c..be6e2f7 100644
--- a/FS/FS/svc_phone.pm
+++ b/FS/FS/svc_phone.pm
@@ -97,6 +97,7 @@ 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 %dis2 = ( disable_inventory=>1, disable_select=>1 );
{
'name' => 'Phone number',
'sorts' => 'phonenum',
@@ -134,6 +135,26 @@ sub table_info {
disable_inventory => 1,
disable_select => 1,
},
+ 'lnp_status' => { label => 'LNP Status',
+ type => 'select-lnp_status.html',
+ %dis2,
+ },
+ 'portable' => { label => 'Portable?', %dis2, },
+ 'lrn' => { label => 'LRN',
+ disable_inventory => 1,
+ },
+ 'lnp_desired_due_date' =>
+ { label => 'LNP Desired Due Date', %dis2 },
+ 'lnp_due_date' =>
+ { label => 'LNP Due Date', %dis2 },
+ 'lnp_other_provider' =>
+ { label => 'LNP Other Provider',
+ disable_inventory => 1,
+ },
+ 'lnp_other_provider_account' =>
+ { label => 'LNP Other Provider Account #',
+ %dis2
+ },
},
};
}
@@ -392,6 +413,13 @@ sub check {
|| $self->ut_foreign_keyn('pbxsvc', 'svc_pbx', 'svcnum' )
|| $self->ut_foreign_keyn('domsvc', 'svc_domain', 'svcnum' )
|| $self->ut_foreign_keyn('locationnum', 'cust_location', 'locationnum')
+ || $self->ut_numbern('lrn')
+ || $self->ut_numbern('lnp_desired_due_date')
+ || $self->ut_numbern('lnp_due_date')
+ || $self->ut_textn('lnp_other_provider')
+ || $self->ut_textn('lnp_other_provider_account')
+ || $self->ut_enumn('lnp_status', ['','portingin','portingout','portedin','native'])
+ || $self->ut_enumn('portable', ['','Y'])
;
return $error if $error;