X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fquick-charge.html;h=d510150541a4f26feda6cf98f71c11ef488b7b8e;hb=1203e278e2ec38fcf1468da2e4f10862004bebeb;hp=b30285c215ad0e219afc5bc687e55a3643964a78;hpb=2a863bbb144830dfb8fca4afb3af76a84a647c76;p=freeside.git diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index b30285c21..d51015054 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -2,10 +2,8 @@ ( $cgi->param('error') ? '' : 'onload="addRow()"' ), ) %> -% if ( $cgi->param('error') ) { - <% $cgi->param('error') %>

-% } +<% include('/elements/error.html') %> - -
- - + + +
- + - + +% if ( $conf->exists('invoice-unitprice') ) { + + + + +% } + +<% include('/elements/tr-select-pkg_class.html', 'curr_value' => $cgi->param('classnum') ) %> + +<% include('/elements/tr-select-taxclass.html', 'curr_value' => $cgi->param('taxclass') ) %> + + + + + + + + % my $row = 0; % if ( $cgi->param('error') ) { % my $param = $cgi->Vars; @@ -103,7 +118,7 @@ function validate_quick_charge () { % } @@ -113,7 +128,7 @@ function validate_quick_charge () {
Amount:Amount: - $ - - <% include('/elements/select-taxclass.html') %> + $
Quantity: + +
Description: - +
Optional additional description:
- " rownum="<% $row %>" onkeyup = "possiblyAddRow;" > + " rownum="<% $row %>" onkeyup = "possiblyAddRow;" >

- +param('error') ? '' :' DISABLED' %>>
@@ -144,7 +159,7 @@ function validate_quick_charge () { 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('maxLength', 65); description_input.setAttribute('rownum', rownum); description_input.onkeyup = possiblyAddRow; description_cell.appendChild(description_input); @@ -161,3 +176,28 @@ function validate_quick_charge () { +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('One-time charge'); + +my $conf = new FS::Conf; + +$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; +my $custnum = $1; + +my $amount = ''; +if ( $cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ ) { + $amount = $1; +} + +my $quantity = 1; +if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) { + $quantity = $1; +} + +$cgi->param('pkg') =~ /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]*)$/ + or die 'illegal description'; +my $pkg = $1; + +