X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fquick-charge.html;h=8f376a54da64eecf15833b3441d30249ad241d04;hb=ec1f5479c8404ed7d059c309f946ed1d0b369aad;hp=94682d0a6540e50aac630a6f11ec77b54a583e9e;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index 94682d0a6..8f376a54d 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') %> +
+ - - - - + -<% include('/elements/tr-select-taxclass.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') ) %> + +<% include('/elements/tr-select-taxproduct.html', 'label' => 'Tax product', 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $cgi->param('taxproductnum') ) %> + +<% include('/elements/tr-select-taxoverride.html', 'onclick' => 'parent.taxoverridemagic(this);', 'curr_value' => $cgi->param('tax_override') ) %> + + + - + % my $row = 0; -% if ( $cgi->param('error') ) { +% if ( $cgi->param('error') || $cgi->param('magic') ) { % my $param = $cgi->Vars; % % for ( $row = 0; exists($param->{"description$row"}); $row++ ) { @@ -106,7 +106,7 @@ function validate_quick_charge () { % } @@ -116,7 +116,7 @@ function validate_quick_charge () {
Amount:Amount: - $ + $
Quantity: + +
Description: - +
Optional additional description: Optional additional description (also printed on invoice):
- " rownum="<% $row %>" onkeyup = "possiblyAddRow;" > + " rownum="<% $row %>" onkeyup = "possiblyAddRow;" >

-param('error') ? '' :' DISABLED' %>> +param('error') ? '' :' DISABLED' %>>
@@ -147,7 +147,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); @@ -164,3 +164,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; + +