From: Mark Wells Date: Tue, 20 Aug 2013 23:27:54 +0000 (-0700) Subject: future package change: adjust behavior of date field, #20687 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=6db14d0fe65daec3d136edaa33a32a1fb24ba06a future package change: adjust behavior of date field, #20687 --- diff --git a/httemplate/elements/onload.js b/httemplate/elements/onload.js new file mode 100644 index 000000000..bfa7eef94 --- /dev/null +++ b/httemplate/elements/onload.js @@ -0,0 +1,22 @@ +<%doc> +Filter component to attach a window.onload handler. + +Usage: + + + +(function() { + var tmp = window.onload; + window.onload = function() { + if (typeof(tmp)== 'function') { + tmp(); + } +<% $m->content %> + }; +})(); diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js index 762b2ddde..4e41fd64a 100644 --- a/httemplate/elements/order_pkg.js +++ b/httemplate/elements/order_pkg.js @@ -21,6 +21,11 @@ function pkg_changed () { } } +// if this form element exists, then the start date is a future +// package change date; don't replace it + if ( form.delay ) { + return; + } form.start_date_text.value = opt.getAttribute('data-start_date'); if ( opt.getAttribute('data-can_start_date') == 1 ) { date_text.style.backgroundColor = '#ffffff'; diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index 488f04a13..8431beb4e 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -64,9 +64,9 @@ ); } - window.onload = function() { + <&| /elements/onload.js &> classnum_changed(document.getElementById('classnum')); - } + diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 887fa014a..ce8348000 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -35,16 +35,32 @@ <% mt('Change') |h %> <% ntable('#cccccc') %> + - param('delay') ? 'CHECKED' : '' %>> Now + <% !$cgi->param('delay') ? 'CHECKED' : '' %> \ + onclick="delay_changed()"> Now param('delay') ? 'CHECKED' : '' %>> In the future + <% $cgi->param('delay') ? 'CHECKED' : '' %> \ + onclick="delay_changed()"> In the future <& /elements/input-date-field.html, { 'name' => 'start_date', 'value' => ($cgi->param('start_date') || $cust_main->next_bill_date), } &> +