default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / elements / select-did.html
index 4d01ce0..60cfcab 100644 (file)
@@ -11,6 +11,46 @@ Example:
          );
 
 </%doc>
+% if ( $conf->exists('svc_phone-lnp') ) { #ask exports if they can_lnp instead?
+  <& /elements/selectlayers.html,
+       'field'      => 'lnp_status',
+       'curr_value' => $opt{'lnp_status'},
+       'options'    => [ '', 'portingin', 'native', 'portedin', 'portingout',
+                         'portin-reject', 'portout-reject',
+                       ],
+       'labels'     => { '' => 'Select new number',
+                         'portingin' => 'Port an existing number',
+                         'native' => 'Native',
+                         'portedin' => 'Ported In',
+                         'portingout' => 'Porting Out',
+                         'portin-reject' => 'Port-In Reject',
+                         'portout-reject' => 'Port-Out Reject',
+                       },
+       'layer_callback' => sub {
+         my( $layer, $layer_fields, $layer_values, $layer_prefix ) = @_;
+         if ( $layer eq 'portingin' ) {
+           $m->scomp('/elements/input-text.html', %opt, 'type'=>'text' );
+         } elsif ( $layer ne '' ) {
+           $m->scomp('/elements/hidden.html', %opt).
+           $m->scomp('/elements/phonenumber.html', $opt{'curr_value'}, 'callable' => 1);
+         } else {
+           $m->scomp('/elements/select-did.html:not_porting', %opt);
+         }
+       },
+  &>
+
+
+% } else {
+  <& /elements/select-did.html:not_porting, %opt &>
+% }
+<%init>
+
+my %opt = @_;
+
+my $conf = new FS::Conf;
+
+</%init>
+<%method not_porting>
 % if ( $use_selector ) {
 
 %   if ( $export->option('restrict_selection') eq 'non-tollfree'
@@ -81,18 +121,18 @@ Example:
 %       # if/when other folks need an areacode-less DID selector that goes
 %       # directly from state to region
 
-        <TD VALIGN="top">
-          <% include('/elements/select.html',
-                       'field'    => 'phonenum_state',
-                       'id'       => 'phonenum_state',
-                       'options'  => [ '', @{ $export->get_dids } ],
-                       'labels'   => { '' => 'Select province' },
-                       'onchange' => 'phonenum_state_changed(this);',
-                       'disabled' => ( $manual_checked ? 1 : 0 ),
-                    )
-          %>
-          <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT>
-        </TD>
+          <TD VALIGN="top">
+            <% include('/elements/select.html',
+                         'field'    => 'phonenum_state',
+                         'id'       => 'phonenum_state',
+                         'options'  => [ '', @{ $export->get_dids } ],
+                         'labels'   => { '' => 'Select province' },
+                         'onchange' => 'phonenum_state_changed(this);',
+                         'disabled' => ( $manual_checked ? 1 : 0 ),
+                      )
+            %>
+            <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT>
+          </TD>
 
           <TD VALIGN="top">
             <% include('/elements/select-region.html',
@@ -133,7 +173,7 @@ Example:
               > Manual entry
             </TD>
 
-            <TD VALIGN="top">
+            <TD VALIGN="top" COLSPAN=4>
               <& /elements/input-text.html,
                    %opt,
                    field    => 'phonenum_manual',
@@ -298,8 +338,7 @@ my @exports = $part_svc->part_export_did;
 if ( scalar(@exports) > 1 ) {
   die "more than one DID-providing export attached to svcpart $svcpart";
 }
-my $export = '';
-$export = $exports[0] if scalar(@exports);
+my $export = scalar(@exports) ? $exports[0] : '';
 
 my $use_selector = scalar(@exports) ? 1 : 0;
 
@@ -310,6 +349,5 @@ my $country  = ( $export && $export->option('country') )
             || $conf->config('countrydefault')
             || 'US';
 
-#my $field = $opt{'field'} || 'phonenum';
-
 </%init>
+</%method>