summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/edit/elements/edit.html13
-rwxr-xr-xhttemplate/edit/part_svc.cgi9
-rw-r--r--httemplate/edit/process/svc_phone.html6
-rw-r--r--httemplate/edit/svc_phone.cgi35
-rw-r--r--httemplate/elements/select-lnp_status.html22
-rw-r--r--httemplate/elements/tr-input-date-field.html6
-rw-r--r--httemplate/elements/tr-select-lnp_status.html14
-rw-r--r--httemplate/view/svc_phone.cgi27
8 files changed, 109 insertions, 23 deletions
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 142d0c3ae..cab5167c6 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -356,6 +356,19 @@ Example:
% %include_common,
% %opt,
% );
+%
+% if ( $include eq 'tr-input-date-field' ) {
+% # it's either hacking it here, or changing a lot more stuff
+% @include = (
+% "/elements/$include.html", {
+% 'name' => $field,
+% 'value' => $opt{curr_value},
+% 'label' => $label,
+% 'noinit' => $f->{noinit},
+% }
+% );
+% }
+%
% @include;
% };
%
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index d156ccd0a..437f7e850 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -334,6 +334,15 @@ that field.
% 'multiple' => ($flag eq 'S'),
% );
%
+% } elsif ( $def->{type} eq 'select-lnp_status.html' ) {
+%
+% $html .= include('/elements/select-lnp_status.html',
+% 'curr_value' => $value,
+% 'element_name' => "${layer}__${field}",
+% 'element_etc' => $disabled,
+% 'multiple' => ($flag eq 'S'),
+% );
+%
% } elsif ( $def->{type} eq 'radius_usergroup_selector' ) {
%
% #XXX disable the RADIUS usergroup selector? ugh it sure does need
diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html
index e02ec5ccc..ddc938216 100644
--- a/httemplate/edit/process/svc_phone.html
+++ b/httemplate/edit/process/svc_phone.html
@@ -1,6 +1,7 @@
<% include( 'elements/svc_Common.html',
'table' => 'svc_phone',
'args_callback' => $args_callback,
+ 'value_callback' => $value_callback,
)
%>
<%init>
@@ -24,6 +25,9 @@ my $args_callback = sub {
};
-
+my $value_callback = sub {
+ my ($field, $value) = @_;
+ ($field =~ /_date$/) ? parse_datetime($value) : $value;
+};
</%init>
diff --git a/httemplate/edit/svc_phone.cgi b/httemplate/edit/svc_phone.cgi
index b77d96233..6482165dc 100644
--- a/httemplate/edit/svc_phone.cgi
+++ b/httemplate/edit/svc_phone.cgi
@@ -1,17 +1,6 @@
<% include( 'elements/svc_Common.html',
'table' => 'svc_phone',
'fields' => \@fields,
- 'labels' => {
- 'svcnum' => 'Service',
- 'countrycode' => 'Country code',
- 'phonenum' => 'Phone number',
- 'domsvc' => 'Domain',
- 'sip_password' => 'SIP password',
- 'pin' => 'Voicemail PIN',
- 'phone_name' => 'Name',
- 'pbxsvc' => 'PBX',
- 'locationnum' => 'E911 location',
- },
'svc_new_callback' => sub {
my( $cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt ) = @_;
$svc_x->locationnum($cust_pkg->locationnum) if $cust_pkg;
@@ -73,5 +62,29 @@ push @fields, { field => 'pbxsvc',
{ field => 'custnum', type=> 'hidden' }, #for new cust_locations
;
+if ( $conf->exists('svc_phone-lnp') ) {
+ push @fields,
+ { value => 'Number Portability',
+ type => 'tablebreak-tr-title',
+ colspan => 7,
+ },
+ { field => 'lnp_status',
+ type => 'select-lnp_status',
+ },
+ { field => 'portable',
+ type => 'checkbox',
+ },
+ 'lrn',
+ { field => 'lnp_desired_due_date',
+ type => 'input-date-field',
+ },
+ { field => 'lnp_due_date',
+ type => 'input-date-field',
+ noinit => 1,
+ },
+ 'lnp_other_provider',
+ 'lnp_other_provider_account',
+;
+}
</%init>
diff --git a/httemplate/elements/select-lnp_status.html b/httemplate/elements/select-lnp_status.html
new file mode 100644
index 000000000..f4910e0b6
--- /dev/null
+++ b/httemplate/elements/select-lnp_status.html
@@ -0,0 +1,22 @@
+<SELECT NAME = "<% $opt{'element_name'} || $opt{'field'} || 'lnp_status' %>"
+ <% $opt{'element_etc'} %>
+>
+% unless ( $opt{'disable_empty'} ) {
+ <OPTION VALUE=""><% $opt{'empty_label'} || '' %></OPTION>
+% }
+% foreach my $selopt ( keys %seloptions ) {
+% my $selected = ($selopt eq $opt{'curr_value'}) ? 'SELECTED' : '';
+ <OPTION VALUE="<%$selopt%>" <% $selected %>><% $seloptions{$selopt} %></OPTION>
+% }
+</SELECT>
+<%init>
+
+my %opt = @_;
+
+my %seloptions = (
+ 'native' => 'Native',
+ 'portedin' => 'Ported In',
+ 'portingin' => 'Porting In',
+ 'portingout' => 'Porting Out',
+ );
+</%init>
diff --git a/httemplate/elements/tr-input-date-field.html b/httemplate/elements/tr-input-date-field.html
index ff4996faf..5400fcb80 100644
--- a/httemplate/elements/tr-input-date-field.html
+++ b/httemplate/elements/tr-input-date-field.html
@@ -1,8 +1,9 @@
-
+% unless ( $noinit ) {
<LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2">
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT>
<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT>
+% }
<TR>
<TD ALIGN="right"><% $label %></TD>
@@ -23,7 +24,7 @@
<%init>
-my($name, $value, $label, $format, $usedatetime);
+my($name, $value, $label, $format, $usedatetime, $noinit);
if ( ref($_[0]) ) {
my $opt = shift;
$name = $opt->{'name'};
@@ -31,6 +32,7 @@ if ( ref($_[0]) ) {
$label = $opt->{'label'};
$format = $opt->{'format'};
$usedatetime = $opt->{'usedatetime'};
+ $noinit = $opt->{'noinit'};
} else {
($name, $value, $label, $format, $usedatetime) = @_;
}
diff --git a/httemplate/elements/tr-select-lnp_status.html b/httemplate/elements/tr-select-lnp_status.html
new file mode 100644
index 000000000..a71e94bfa
--- /dev/null
+++ b/httemplate/elements/tr-select-lnp_status.html
@@ -0,0 +1,14 @@
+ <TR>
+ <TD ALIGN="right"><% $opt{'label'} || 'LNP Status' %></TD>
+ <TD>
+ <% include('/elements/select-lnp_status.html',
+ 'curr_value' => $opt{'curr_value'},
+ )
+ %>
+ </TD>
+ </TR>
+<%init>
+
+my %opt = @_;
+
+</%init>
diff --git a/httemplate/view/svc_phone.cgi b/httemplate/view/svc_phone.cgi
index 27d270c89..94948a78b 100644
--- a/httemplate/view/svc_phone.cgi
+++ b/httemplate/view/svc_phone.cgi
@@ -1,15 +1,7 @@
<% include('elements/svc_Common.html',
'table' => 'svc_phone',
'fields' => \@fields,
- 'labels' => {
- 'countrycode' => 'Country code',
- 'phonenum' => 'Phone number',
- 'domain' => 'Domain',
- 'pbx_title' => 'PBX',
- 'sip_password' => 'SIP password',
- 'pin' => 'PIN',
- 'phone_name' => 'Name',
- },
+ 'labels' => \%labels,
'html_foot' => $html_foot,
)
%>
@@ -18,10 +10,27 @@
my $conf = new FS::Conf;
my $countrydefault = $conf->config('countrydefault') || 'US';
+my $fields = FS::svc_phone->table_info->{'fields'};
+my %labels = map { $_ => ( ref($fields->{$_})
+ ? $fields->{$_}{'label'}
+ : $fields->{$_}
+ );
+ } keys %$fields;
+
my @fields = qw( countrycode phonenum );
push @fields, 'domain' if $conf->exists('svc_phone-domain');
push @fields, qw( pbx_title sip_password pin phone_name );
+if ( $conf->exists('svc_phone-lnp') ) {
+push @fields, 'lnp_status',
+ { field => 'portable', type => 'checkbox', },
+ 'lrn',
+ { field => 'lnp_desired_due_date', type => 'date', },
+ { field => 'lnp_due_date', type => 'date', },
+ 'lnp_other_provider',
+ 'lnp_other_provider_account';
+}
+
my $html_foot = sub {
my $svc_phone = shift;