X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fquick-charge.html;h=466091dfac97173e6faa0625d7cf32ff317943dc;hb=3be3194b8429383cf47fde8ea662327a0a60d8b0;hp=145898746687003bb4e4624bd0d6b8e8c8ed98ce;hpb=df4c3a581b4e37920a144dee8342f296405d7946;p=freeside.git diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 145898746..466091dfa 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -1,4 +1,4 @@ -<& /elements/header-popup.html, emt('One-time charge'), '', +<& /elements/header-popup.html, mt('One-time charge'), '', ( $cgi->param('error') ? '' : 'onload="addRow()"' ), &> @@ -11,13 +11,30 @@ -
+ @@ -85,7 +107,13 @@ function bill_now_changed (what) { <% mt('Amount') |h %> - <% $money_char %> + <% $money_char %> @@ -93,7 +121,11 @@ function bill_now_changed (what) { <% mt('Quantity') |h %> - + % } @@ -107,12 +139,12 @@ function bill_now_changed (what) { NAME = "bill_now" VALUE = "1" <% $cgi->param('bill_now') ? 'CHECKED' : '' %> + onClick = "bill_now_changed(this);" onChange = "bill_now_changed(this);" > <% mt('with terms') |h %> <& /elements/select-terms.html, 'curr_value' => scalar($cgi->param('invoice_terms')), - 'empty_value' => $default_terms, 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ), &> @@ -127,7 +159,11 @@ function bill_now_changed (what) { SIZE = 32 ID = "start_date_text" VALUE = "<% $start_date %>" - <% $cgi->param('bill_now') ? 'STYLE = "background-color:#dddddd" DISABLED' : '' %> + onKeyPress="return enable_quick_charge(event)" + <% $cgi->param('bill_now') + ? 'STYLE = "background-color:#dddddd" DISABLED' + : '' + %> > payby =~ /^(CARD|CHEK)$/ ) { % my $what = lc(FS::payby->shortname($cust_main->payby)); - <% mt('Disable automatic $what charge') |h %> + <% mt("Disable automatic $what charge") |h %> % } @@ -173,7 +209,14 @@ function bill_now_changed (what) { <% mt('Description') |h %> - + @@ -191,7 +234,15 @@ function bill_now_changed (what) { - " rownum="<% $row %>" onkeyup = "possiblyAddRow;" > + " + rownum = "<% $row %>" + onKeyPress = "return enable_quick_charge(event)" + onKeyUp = "return possiblyAddRow(event)" + > % } @@ -210,10 +261,26 @@ function bill_now_changed (what) { var rownum = <% $row %>; - function possiblyAddRow() { + function possiblyAddRow(e) { + if ( ( rownum - this.getAttribute('rownum') ) == 1 ) { addRow(); } + +% if ( $curuser->option('disable_enter_submit_onetimecharge') ) { + + var key; + if (window.event) + key = window.event.keyCode; //IE + else + key = e.which; //firefox, others + + return (key != 13); + +% } else { + return true; +% } + } function addRow() { @@ -228,14 +295,16 @@ function bill_now_changed (what) { var description_cell = document.createElement('TD'); - var description_input = document.createElement('INPUT'); - description_input.setAttribute('name', 'description'+rownum); - description_input.setAttribute('id', 'description'+rownum); - description_input.setAttribute('size', 60); - description_input.setAttribute('maxLength', 65); - description_input.setAttribute('rownum', rownum); - description_input.onkeyup = possiblyAddRow; - description_cell.appendChild(description_input); + //var description_input = document.createElement('INPUT'); + var di = document.createElement('INPUT'); + di.setAttribute('name', 'description'+rownum); + di.setAttribute('id', 'description'+rownum); + di.setAttribute('size', 60); + di.setAttribute('maxLength', 65); + di.setAttribute('rownum', rownum); + di.onkeyup = possiblyAddRow; + di.onkeypress = enable_quick_charge; + description_cell.appendChild(di); row.appendChild(description_cell); @@ -251,8 +320,10 @@ function bill_now_changed (what) { <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('One-time charge'); + unless $curuser->access_right('One-time charge'); my $conf = new FS::Conf; my $date_format = $conf->config('date_format') || '%m/%d/%Y';