[freeside-commits] branch master updated. db3e520bad7240b3f6f0d53a2b55a64ef116890b

Ivan ivan at 420.am
Fri Jan 25 19:47:56 PST 2013


The branch, master has been updated
       via  db3e520bad7240b3f6f0d53a2b55a64ef116890b (commit)
      from  e94760d804c5638ecbd1487e8c3a2797f0034846 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit db3e520bad7240b3f6f0d53a2b55a64ef116890b
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Jan 25 19:47:54 2013 -0800

    allow manual override of phone number, RT#19883

diff --git a/FS/FS/part_export.pm b/FS/FS/part_export.pm
index 5d65062..3eee37f 100644
--- a/FS/FS/part_export.pm
+++ b/FS/FS/part_export.pm
@@ -630,6 +630,10 @@ sub info {
 
 #default fallbacks... FS::part_export::DID_Common ?
 sub get_dids_can_tollfree { 0; }
+sub get_dids_can_manual   { 0; }
+sub get_dids_can_edit     { 0; } #don't use without can_manual, otherwise the
+                                 # DID selector provisions a new number from
+                                 # inventory each edit
 sub get_dids_npa_select   { 1; }
 
 =back
diff --git a/FS/FS/part_export/fibernetics_did.pm b/FS/FS/part_export/fibernetics_did.pm
index fb03785..a51457a 100644
--- a/FS/FS/part_export/fibernetics_did.pm
+++ b/FS/FS/part_export/fibernetics_did.pm
@@ -28,6 +28,8 @@ tie my %options, 'Tie::IxHash',
 sub rebless { shift; }
 
 sub get_dids_can_tollfree { 0; };
+sub get_dids_can_manual   { 1; };
+sub get_dids_can_edit     { 1; };
 sub get_dids_npa_select   { 0; };
 
 # i guess we could get em from the API, but since its returning states without
diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html
index 7a3b43d..611b514 100644
--- a/httemplate/edit/process/svc_phone.html
+++ b/httemplate/edit/process/svc_phone.html
@@ -28,6 +28,9 @@ my $right = $opt{'bulk'} ? 'Bulk provision customer service'
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right($right);
 
+$cgi->param('phonenum', $cgi->param('phonenum_manual') )
+  if $cgi->param('phonenum_which') eq 'phonenum_manual';
+
 my $tollfreephonenum = $cgi->param('tollfreephonenum');
 $cgi->param('phonenum',$tollfreephonenum) if $tollfreephonenum =~ /^\d+$/;
 
diff --git a/httemplate/elements/select-areacode.html b/httemplate/elements/select-areacode.html
index a302bef..f0f56d5 100644
--- a/httemplate/elements/select-areacode.html
+++ b/httemplate/elements/select-areacode.html
@@ -17,7 +17,7 @@
     what.form.<% $opt{'prefix'} %>areacode.disabled = 'disabled';
     what.form.<% $opt{'prefix'} %>areacode.style.display = 'none';
     var areacodewait = document.getElementById('<% $opt{'prefix'} %>areacodewait');
-    areacodewait.style.display = '';
+    areacodewait.style.display = 'inline';
     var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror');
     areacodeerror.style.display = 'none';
 
@@ -61,7 +61,7 @@
         what.form.<% $opt{'prefix'} %>areacode.style.display = '';
       } else {
         var areacodeerror = document.getElementById('<% $opt{'prefix'} %>areacodeerror');
-        areacodeerror.style.display = '';
+        areacodeerror.style.display = 'inline';
       }
 
       //run the callback
diff --git a/httemplate/elements/select-did.html b/httemplate/elements/select-did.html
index 6e205d8..fe1e5d1 100644
--- a/httemplate/elements/select-did.html
+++ b/httemplate/elements/select-did.html
@@ -18,6 +18,27 @@ Example:
     <TABLE>
       <TR>
 
+%       my( $phonenum_checked, $manual_checked ) = ( '', '' );
+%       if ( $export->get_dids_can_manual ) {
+%         #not 100% perfect UI on error handling, but it'll do
+%         if ( $opt{'curr_value'} ) {
+%           $phonenum_checked = '';
+%           $manual_checked   = 'CHECKED';
+%         } else {
+%           $phonenum_checked = 'CHECKED';
+%           $manual_checked   = '';
+%         }
+
+        <TD VALIGN="top">
+          <INPUT TYPE     = "radio"
+                 NAME     = "phonenum_which"
+                 VALUE    = "phonenum"
+                 onChange = "phonenum_which_changed(this)"
+                 <% $phonenum_checked %>
+          > Inventory
+        </TD>
+%       }
+
 %       if ( $export->get_dids_npa_select ) {
 
         <TD VALIGN="top">
@@ -27,9 +48,10 @@ Example:
                        'svcpart'       => $svcpart,
                        'disable_empty' => 0,
                        'empty_label'   => 'Select state',
+                       'disabled'      => ( $manual_checked ? 1 : 0 ),
                     )
           %>
-          <BR><FONT SIZE="-1">State</FONT>
+          <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>State</FONT>
         </TD>
 
           <TD VALIGN="top">
@@ -39,19 +61,24 @@ Example:
                          'empty'        => 'Select area code',
                       )
             %>
-            <BR><FONT SIZE="-1">Area code</FONT>
+            <BR><FONT SIZE="-1" ID="areacode_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Area code</FONT>
           </TD>
 
           <TD VALIGN="top">
             <% include('/elements/select-exchange.html',
-                         'svcpart' => $svcpart,
-                         'empty'   => 'Select exchange',
+                         'svcpart'  => $svcpart,
+                         'empty'    => 'Select exchange',
                       )
             %>
-            <BR><FONT SIZE="-1">City / Exchange</FONT>
+            <BR><FONT SIZE="-1" ID="exchange_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>City / Exchange</FONT>
           </TD>
 
 %       } else {
+%
+%       #this code path currently only being used by fibernetics
+%       # should change "Province" label to "State" or make it configurable
+%       # if/when other folks need an areacode-less DID selector that goes
+%       # directly from state to region
 
         <TD VALIGN="top">
           <% include('/elements/select.html',
@@ -60,9 +87,10 @@ Example:
                        'options'  => [ '', @{ $export->get_dids } ],
                        'labels'   => { '' => 'Select province' },
                        'onchange' => 'phonenum_state_changed(this);',
+                       'disabled' => ( $manual_checked ? 1 : 0 ),
                     )
           %>
-          <BR><FONT SIZE="-1">Province</FONT>
+          <BR><FONT SIZE="-1" ID="phonenum_state_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Province</FONT>
         </TD>
 
           <TD VALIGN="top">
@@ -72,7 +100,7 @@ Example:
                          'empty'         => 'Select region',
                       )
             %>
-            <BR><FONT SIZE="-1">Region</FONT>
+            <BR><FONT SIZE="-1" ID="region_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Region</FONT>
           </TD>
 
 %       }
@@ -86,10 +114,131 @@ Example:
                        'region'   => ! $export->get_dids_npa_select,
                     )
           %>
-          <BR><FONT SIZE="-1">Phone number</FONT>
+          <BR><FONT SIZE="-1" ID="phonenum_phonenum_label" <% $manual_checked ? 'STYLE="color:#999999"' : '' %>>Phone number</FONT>
         </TD>
 
       </TR>
+
+%       if ( $export->get_dids_can_manual ) {
+          <TR>
+
+            <TD VALIGN="top">
+              <INPUT TYPE     = "radio"
+                     NAME     = "phonenum_which"
+                     VALUE    = "phonenum_manual"
+                     onChange = "phonenum_which_changed(this)"
+                     <% $manual_checked %>
+              > Manual entry
+            </TD>
+
+            <TD VALIGN="top">
+              <& /elements/input-text.html,
+                   %opt,
+                   field    => 'phonenum_manual',
+                   id       => 'phonenum_manual',
+                   type     => 'text',
+                   disabled => ( $phonenum_checked ? 1 : 0 ),
+              &>
+            </TD>
+          </TR>
+
+          <SCRIPT TYPE="text/javascript">
+            function phonenum_which_changed(what) {
+
+              if ( what.value == 'phonenum' && what.checked ) {
+
+                what.form.phonenum_manual.disabled = true;
+                what.form.phonenum_manual.style.backgroundColor = '#dddddd';
+
+                what.form.phonenum_state.disabled = false;
+
+                document.getElementById('phonenum_state_label').style.color = '#000000';
+                if ( document.getElementById('areacode_label') ) {
+                  document.getElementById('areacode_label').style.color = '#000000';
+                }
+                if ( document.getElementById('exchange_label') ) {
+                  document.getElementById('exchange_label').style.color = '#000000';
+                }
+                if ( document.getElementById('region_label') ) {
+                  document.getElementById('region_label').style.color = '#000000';
+                }
+                document.getElementById('phonenum_phonenum_label').style.color = '#000000';
+
+                var value = what.form.phonenum_state.options[ what.form.phonenum_state.selectedIndex].value;
+
+                if ( value != '' ) {
+
+                  if ( what.form.areacode ) {
+                    what.form.areacode.disabled = false;
+
+                    var areacode_value = what.form.areacode.options[ what.form.areacode.selectedIndex].value;
+
+                    if ( areacode_value != '' ) {
+                      what.form.exchange.disabled = false;
+
+                      var exchange_value = what.form.exchange.options[ what.form.exchange.selectedIndex].value;
+
+                      if ( exchange_value != '' ) {
+                        what.form.phonenum.disabled = false;
+                      }
+
+                    }
+
+                  }
+                  if ( what.form.region ) {
+                    what.form.region.disabled = false;
+                    
+                    var region_value = what.form.region.options[ what.form.region.selectedIndex].value;
+
+                    if ( region_value != '' ) {
+                      what.form.phonenum.disabled = false;
+                    }
+
+                  }
+
+                }
+
+              }
+
+              if ( what.value == 'phonenum_manual' && what.checked ) {
+
+                what.form.phonenum_manual.disabled = false;
+                what.form.phonenum_manual.style.backgroundColor = '#ffffff';
+
+                what.form.phonenum_state.disabled = true;
+
+                document.getElementById('phonenum_state_label').style.color = '#999999';
+                if ( document.getElementById('areacode_label') ) {
+                  document.getElementById('areacode_label').style.color = '#999999';
+                }
+                if ( document.getElementById('exchange_label') ) {
+                  document.getElementById('exchange_label').style.color = '#999999';
+                }
+                if ( document.getElementById('region_label') ) {
+                  document.getElementById('region_label').style.color = '#999999';
+                }
+                document.getElementById('phonenum_phonenum_label').style.color = '#999999';
+
+                if ( what.form.areacode ) {
+                  what.form.areacode.disabled = true;
+                }
+
+                if ( what.form.exchange ) {
+                  what.form.exchange.disabled = true;
+                }
+
+                if ( what.form.region ) {
+                  what.form.region.disabled = true;
+                }
+
+                what.form.phonenum.disabled = true;
+              }
+
+            }
+          </SCRIPT>
+
+%       }
+
     </TABLE>
 
 % } 
diff --git a/httemplate/elements/select-exchange.html b/httemplate/elements/select-exchange.html
index 9e4b5ce..b967709 100644
--- a/httemplate/elements/select-exchange.html
+++ b/httemplate/elements/select-exchange.html
@@ -17,7 +17,7 @@
     what.form.<% $opt{'prefix'} %>exchange.disabled = 'disabled';
     what.form.<% $opt{'prefix'} %>exchange.style.display = 'none';
     var exchangewait = document.getElementById('<% $opt{'prefix'} %>exchangewait');
-    exchangewait.style.display = '';
+    exchangewait.style.display = 'inline';
     var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
     exchangeerror.style.display = 'none';
 
@@ -56,7 +56,7 @@
         what.form.<% $opt{'prefix'} %>exchange.style.display = '';
       } else {
         var exchangeerror = document.getElementById('<% $opt{'prefix'} %>exchangeerror');
-        exchangeerror.style.display = '';
+        exchangeerror.style.display = 'inline';
       }
 
       //run the callback
diff --git a/httemplate/elements/select-phonenum.html b/httemplate/elements/select-phonenum.html
index 18abe3d..a8d9a7c 100644
--- a/httemplate/elements/select-phonenum.html
+++ b/httemplate/elements/select-phonenum.html
@@ -17,7 +17,7 @@
     what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
     what.form.<% $opt{'prefix'} %>phonenum.style.display = 'none';
     var phonenumwait = document.getElementById('<% $opt{'prefix'} %>phonenumwait');
-    phonenumwait.style.display = '';
+    phonenumwait.style.display = 'inline';
     var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
     phonenumerror.style.display = 'none';
 
@@ -54,7 +54,7 @@
         what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
       } else {
         var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
-        phonenumerror.style.display = '';
+        phonenumerror.style.display = 'inline';
       }
 
       //run the callback
diff --git a/httemplate/elements/select-region.html b/httemplate/elements/select-region.html
index 9823290..7ed9592 100644
--- a/httemplate/elements/select-region.html
+++ b/httemplate/elements/select-region.html
@@ -17,7 +17,7 @@
     what.form.<% $opt{'prefix'} %>region.disabled = 'disabled';
     what.form.<% $opt{'prefix'} %>region.style.display = 'none';
     var regionwait = document.getElementById('<% $opt{'prefix'} %>regionwait');
-    regionwait.style.display = '';
+    regionwait.style.display = 'inline';
     var regionerror = document.getElementById('<% $opt{'prefix'} %>regionerror');
     regionerror.style.display = 'none';
 
@@ -56,7 +56,7 @@
         what.form.<% $opt{'prefix'} %>region.style.display = '';
       } else {
         var regionerror = document.getElementById('<% $opt{'prefix'} %>regionerror');
-        regionerror.style.display = '';
+        regionerror.style.display = 'inline';
       }
 
       //run the callback
diff --git a/httemplate/elements/tr-select-did.html b/httemplate/elements/tr-select-did.html
index 987ade6..2aa712f 100644
--- a/httemplate/elements/tr-select-did.html
+++ b/httemplate/elements/tr-select-did.html
@@ -1,6 +1,6 @@
 <% include('tr-td-label.html', @_ ) %>
 
-% if ( $opt{'curr_value'} ne '' && $use_selector ) {
+% if ( $use_selector && $opt{'curr_value'} ne '' && ! $can_edit ) {
 
     <TD BGCOLOR="#dddddd" <% $cell_style %>><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %></TD>
     
@@ -38,4 +38,6 @@ if ( scalar(@exports) > 1 ) {
 
 my $use_selector = scalar(@exports) ? 1 : 0;
 
+my $can_edit = scalar(@exports) && $exports[0]->get_dids_can_edit;
+
 </%init>

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/part_export.pm                     |    4 +
 FS/FS/part_export/fibernetics_did.pm     |    2 +
 httemplate/edit/process/svc_phone.html   |    3 +
 httemplate/elements/select-areacode.html |    4 +-
 httemplate/elements/select-did.html      |  165 ++++++++++++++++++++++++++++--
 httemplate/elements/select-exchange.html |    4 +-
 httemplate/elements/select-phonenum.html |    4 +-
 httemplate/elements/select-region.html   |    4 +-
 httemplate/elements/tr-select-did.html   |    4 +-
 9 files changed, 177 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list