diff options
Diffstat (limited to 'httemplate')
| -rw-r--r-- | httemplate/elements/order_pkg.js | 17 | ||||
| -rw-r--r-- | httemplate/elements/select-part_pkg.html | 2 | ||||
| -rw-r--r-- | httemplate/elements/tr-select-cust-part_pkg.html | 16 | ||||
| -rw-r--r-- | httemplate/misc/cust-part_pkg.cgi | 12 | ||||
| -rw-r--r-- | httemplate/misc/order_pkg.html | 1 | 
5 files changed, 35 insertions, 13 deletions
| diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js index 2c13ed254..2f53e3631 100644 --- a/httemplate/elements/order_pkg.js +++ b/httemplate/elements/order_pkg.js @@ -1,8 +1,9 @@ -function enable_order_pkg () { +function pkg_changed () {    var form = document.OrderPkgForm;    var discountnum = form.discountnum;    if ( form.pkgpart.selectedIndex > 0 ) { +      form.submitButton.disabled = false;      if ( discountnum ) {        if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { @@ -11,6 +12,20 @@ function enable_order_pkg () {          form.discountnum.disabled = true;        }      } + +    if ( form.pkgpart.options[form.pkgpart.selectedIndex].getAttribute('data-can_start_date') == 1 ) { +      form.start_date_text.disabled = false; +      form.start_date.style.backgroundColor = '#ffffff'; +      form.start_date_button.style.display = ''; +      form.start_date_button_disabled.style.display = 'none'; +      form.invoice_terms.disabled = true; +    } else { +      form.start_date_text.disabled = true; +      form.start_date.style.backgroundColor = '#dddddd'; +      form.start_date_button.style.display = 'none'; +      form.start_date_button_disabled.style.display = ''; +    } +    } else {      form.submitButton.disabled = true;      if ( discountnum ) { form.discountnum.disabled = true; } diff --git a/httemplate/elements/select-part_pkg.html b/httemplate/elements/select-part_pkg.html index 885bb806b..439c4b53e 100644 --- a/httemplate/elements/select-part_pkg.html +++ b/httemplate/elements/select-part_pkg.html @@ -23,7 +23,7 @@ Example:                'empty_label'    => 'Select package', #should this be the default?                'label_callback' => sub { shift->pkg_comment },                'hashref'        => \%hash, -              'extra_option_attributes' => [ 'can_discount' ], +              'extra_option_attributes' => [ 'can_discount', 'can_start_date' ],                %opt,            )  %> diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index e55cbee30..767d23264 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -7,9 +7,10 @@    <SCRIPT TYPE="text/javascript"> -    function part_pkg_opt(what,value,text,can_discount) { +    function part_pkg_opt(what, value, text, can_discount, can_start_date) {        var optionName = new Option(text, value, false, false); -      optionName.setAttribute('data-can_discount', can_discount); +      optionName.setAttribute('data-can_discount',   can_discount); +      optionName.setAttribute('data-can_start_date', can_start_date);        var length = what.length;        what.options[length] = optionName;      } @@ -37,11 +38,12 @@          // add the new packages          opt(what.form.pkgpart, '', 'Select package');          var packagesArray = eval('(' + part_pkg + ')' ); -        for ( var s = 0; s < packagesArray.length; s=s+3 ) { -          var packagesLabel = packagesArray[s+1]; -          var can_discount  = packagesArray[s+2]; +        for ( var s = 0; s < packagesArray.length; s=s+4 ) { +          var packagesLabel  = packagesArray[s+1]; +          var can_discount   = packagesArray[s+2]; +          var can_start_date = packagesArray[s+3];            part_pkg_opt( -            what.form.pkgpart, packagesArray[s], packagesLabel, can_discount +            what.form.pkgpart, packagesArray[s], packagesLabel, can_discount, can_start_date            );          } @@ -75,7 +77,7 @@                   'curr_value' => $opt{'curr_value'}, #$pkgpart                   'classnum'   => $opt{'classnum'},                   'cust_main'  => $opt{'cust_main'},  #$cust_main -                 'onchange'   => 'enable_order_pkg', +                 'onchange'   => 'pkg_changed',      &>    </TD>  </TR> diff --git a/httemplate/misc/cust-part_pkg.cgi b/httemplate/misc/cust-part_pkg.cgi index 524799ced..dcd033ff2 100644 --- a/httemplate/misc/cust-part_pkg.cgi +++ b/httemplate/misc/cust-part_pkg.cgi @@ -23,8 +23,14 @@ my @part_pkg = qsearch({    'order_by'  => 'ORDER BY pkg',  }); -my @return = map  { ( $_->pkgpart, $_->pkg_comment, $_->can_discount ); } -             #sort { $a->pkg_comment cmp $b->pkg_comment } -             @part_pkg; +my @return = map  { warn $_->can_start_date; +                    ( $_->pkgpart, +                      $_->pkg_comment, +                      $_->can_discount, +                      $_->can_start_date, +                    ); +                  } +                  #sort { $a->pkg_comment cmp $b->pkg_comment } +                  @part_pkg;  </%init> diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 4c7a02b1e..2332f2028 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -29,7 +29,6 @@                   'curr_value' => $pkgpart,                   'classnum'   => -1,                   'cust_main'  => $cust_main, -                 'onchange'   => 'enable_order_pkg',      &>  % } | 
