[freeside-commits] branch master updated. ff8a7535a81005b7c66e8e75e5cfa8449a8cef04

Ivan ivan at 420.am
Fri Feb 5 10:45:13 PST 2016


The branch, master has been updated
       via  ff8a7535a81005b7c66e8e75e5cfa8449a8cef04 (commit)
      from  fcd7e712ea5286c418dd4f77c4faa41544d95f0b (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 ff8a7535a81005b7c66e8e75e5cfa8449a8cef04
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Feb 5 10:45:12 2016 -0800

    prevent changing Start before picking a package

diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js
index a850d21..d8ee790 100644
--- a/httemplate/elements/order_pkg.js
+++ b/httemplate/elements/order_pkg.js
@@ -5,15 +5,15 @@ function pkg_changed () {
 
   usageprice_pkg_changed( opt.value );
 
-  if ( form.pkgpart.selectedIndex > 0 ) {
+  var date_button = document.getElementById('start_date_button');
+  var date_button_disabled = document.getElementById('start_date_disabled');
+  var date_text = document.getElementById('start_date_text');
 
-    var date_button = document.getElementById('start_date_button');
-    var date_button_disabled = document.getElementById('start_date_disabled');
-    var date_text = document.getElementById('start_date_text');
+  var radio_now = document.getElementById('start_now');
+  var radio_on_hold = document.getElementById('start_on_hold');
+  var radio_on_date = document.getElementById('start_on_date');
 
-    var radio_now = document.getElementById('start_now');
-    var radio_on_hold = document.getElementById('start_on_hold');
-    var radio_on_date = document.getElementById('start_on_date');
+  if ( form.pkgpart.selectedIndex > 0 ) {
 
     form.submitButton.disabled = false;
     if ( discountnum ) {
@@ -39,8 +39,9 @@ function pkg_changed () {
       date_button_disabled.style.display = 'none';
       if ( radio_on_date ) {
         // un-disable all the buttons that might get disabled
-        radio_on_date.disabled = false;
         radio_now.disabled = false;
+        radio_on_hold.disabled = false;
+        radio_on_date.disabled = false;
         // if a start date has been entered, assume the user wants it
         if ( form.start_date_text.value.length > 0 ) {
           radio_now.checked = false;
@@ -72,6 +73,15 @@ function pkg_changed () {
 
   } else {
     form.submitButton.disabled = true;
+
+    date_text.style.backgroundColor = '#dddddd';
+    date_text.disabled = true;
+    date_button.style.display = 'none';
+    date_button_disabled.style.display = '';
+    radio_now.disabled = true;
+    radio_on_date.disabled = true;
+    radio_on_hold.disabled = true;
+
     if ( discountnum ) { form.discountnum.disabled = true; }
     discountnum_changed(form.discountnum);
   }
diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html
index 23916d9..6244b6c 100644
--- a/httemplate/elements/tr-select-cust-part_pkg.html
+++ b/httemplate/elements/tr-select-cust-part_pkg.html
@@ -53,9 +53,11 @@
 
         what.form.pkgpart.disabled = ''; //re-enable part_pkg dropdown
 %       if ( $opt{'curr_value'} ) {
-        what.form.pkgpart.value = <% $opt{'curr_value'} %>;
+          what.form.pkgpart.value = <% $opt{'curr_value'} %>;
 %       }
 
+        pkg_changed();
+
       }
 
       get_part_pkg( <% $cust_main     ? $cust_main->custnum         : '0' %>,
diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index e282501..4e061e2 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -85,18 +85,38 @@
     <TR>
       <TH ALIGN="right"><% mt('Start') |h %> </TD>
       <TD COLSPAN=6>
-        <INPUT TYPE="radio" NAME="start" ID="start_now" VALUE="" <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>>Now
+        <INPUT TYPE  = "radio"
+               NAME  = "start"
+               ID    = "start_now"
+               VALUE = ""
+               <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>
+               <% $pkgpart ? '' : 'DISABLED' %>
+        >Now
          
-        <INPUT TYPE="radio" NAME="start" ID="start_on_hold" VALUE="on_hold" <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>>On hold
+        <INPUT TYPE  = "radio"
+               NAME  = "start"
+               ID    = "start_on_hold"
+               VALUE = "on_hold"
+               <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>
+               <% $pkgpart ? '' : 'DISABLED' %>
+        >On hold
          
-        <INPUT TYPE="radio" NAME="start" ID="start_on_date" VALUE="on_date" <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>>On date
+        <INPUT TYPE  = "radio" 
+               NAME  = "start" 
+               ID    = "start_on_date" 
+               VALUE = "on_date" 
+               <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>
+               <% $pkgpart ? '' : 'DISABLED' %>
+        >On date
+
+        <& /elements/input-date-field.html,
+             { 'name'      => 'start_date',
+               'format'    => $date_format,
+               'value'     => '',
+               'noinit'    => 1,
+             }
+        &>
 
-        <& /elements/input-date-field.html,{
-                    'name'      => 'start_date',
-                    'format'    => $date_format,
-                    'value'     => '',
-                    'noinit'    => 1,
-                  } &>
       </TD>
     </TR>
 

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

Summary of changes:
 httemplate/elements/order_pkg.js                 |   26 ++++++++++-----
 httemplate/elements/tr-select-cust-part_pkg.html |    4 ++-
 httemplate/misc/order_pkg.html                   |   38 +++++++++++++++++-----
 3 files changed, 50 insertions(+), 18 deletions(-)




More information about the freeside-commits mailing list