X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fquick-charge.html;h=a472915a1eb2ddfeddaa8322f280879b3e617f9c;hb=e0a26680d75fc2000bde195eba7946805a3aaa28;hp=b30285c215ad0e219afc5bc687e55a3643964a78;hpb=2a863bbb144830dfb8fca4afb3af76a84a647c76;p=freeside.git diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html index b30285c21..a472915a1 100644 --- a/httemplate/edit/quick-charge.html +++ b/httemplate/edit/quick-charge.html @@ -1,11 +1,14 @@ -<% include("/elements/header-popup.html", 'One-time charge entry', '', +<% include("/elements/header-popup.html", 'One-time charge', '', ( $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') ) %> - + + + +%# false laziness w/misc/order_pkg.html + + - + + + +% if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) { +% my $what = lc(FS::payby->shortname($cust_main->payby)); + + + + +% } + + + + + + +<% 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++ ) { @@ -103,7 +193,7 @@ function validate_quick_charge () { % } @@ -113,7 +203,7 @@ function validate_quick_charge () {
Amount + $ +
Quantity + +
Amount:Invoice now - $ + param('bill_now') ? 'CHECKED' : '' %> + onChange = "bill_now_changed(this);" + > + with terms + <% include('/elements/select-terms.html', + 'curr_value' => scalar($cgi->param('invoice_terms')), + 'empty_value' => $default_terms, + 'disabled' => ( $cgi->param('bill_now') ? 0 : 1 ), + ) + %>
Charge date - <% include('/elements/select-taxclass.html') %> + param('bill_now') ? 'STYLE = "background-color:#dddddd" DISABLED' : '' %> + > + + param('bill_now') ? '' : 'STYLE="display:none"' %> + > + (leave blank to charge immediately)
Description:
Disable automatic <% $what %> charge
Tax exempt param('setuptax') ? 'CHECKED' : '' %>>
Description - +
Optional additional description (also printed on invoice):
- " rownum="<% $row %>" onkeyup = "possiblyAddRow;" > + " rownum="<% $row %>" onkeyup = "possiblyAddRow;" >

- +param('error') ? '' :' DISABLED' %>>
@@ -144,7 +234,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 +251,44 @@ function validate_quick_charge () { +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('One-time charge'); + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; +my $custnum = $1; +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ); #XXX agent-virt + +my $format = "%m/%d/%Y %T %z (%Z)"; #false laziness w/REAL_cust_pkg.cgi? +my $start_date = $cust_main->next_bill_date; +$start_date = $start_date ? time2str($format, $start_date) : ''; + +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; + +my $default_terms; +if ( $cust_main->invoice_terms ) { + $default_terms = 'Customer default ('. $cust_main->invoice_terms. ')'; +} else { + $default_terms = + 'Default ('. + ($conf->config('invoice_default_terms') || 'Payable upon receipt'). + ')'; +} + +