enable CardFortress in test database, #71513
[freeside.git] / httemplate / edit / quick-charge.html
index 1e1232d..dde8917 100644 (file)
@@ -1,11 +1,12 @@
-<& /elements/header-popup.html, mt('One-time charge'), '',
-            ( $cgi->param('error') ? '' : 'onload="addRow()"' ),
+<& /elements/header.html, mt('One-time charge'), '',
+            ( ($quotationnum || $cgi->param('error')) ? '' : 'onload="addRow()"' ),
 &>
 
 <LINK REL="stylesheet" TYPE="text/css" HREF="<%$fsurl%>elements/calendar-win2k-2.css" TITLE="win2k-2">
 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar_stripped.js"></SCRIPT>
 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-en.js"></SCRIPT>
 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/calendar-setup.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/xregexp-all.js"></SCRIPT>
 
 <& /elements/error.html &>
 
@@ -39,7 +40,7 @@ function enable_quick_charge (e) {
 
 function validate_quick_charge () {
   var pkg = document.QuickChargeForm.pkg.value;
-  var pkg_regex = /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]*)$/ ;
+  var pkg_regex = XRegExp('^([\\p{L}\\p{N} \_\!\@\#\$\%\&\(\)\+\;\:\'\"\,\.\?\/\=\\-\\[\\]]*)$');
   var amount = document.QuickChargeForm.amount.value;
   var amount_regex = /^\s*\$?\s*(\d*(\.?\d{1,2}))\s*$/ ;
   var rval = true;
@@ -93,6 +94,18 @@ function bill_now_changed (what) {
 
 </SCRIPT>
 
+<P>
+% if ( $cust_main ) {
+<& /elements/small_custview.html,
+             $cust_main->custnum,
+             scalar($conf->config('countrydefault')),
+             1, #no balance
+&>
+% } else {
+<& /elements/small_prospect_view.html, $prospect_main &>
+% }
+</P>
+
 <FORM ACTION   = "process/quick-charge.cgi"
       NAME     = "QuickChargeForm"
       ID       = "QuickChargeForm"
@@ -169,7 +182,25 @@ function bill_now_changed (what) {
           noinit  => 1,
         }
       &>
-%   }
+
+      <& /elements/tr-checkbox.html,
+        label => emt('Invoice this charge separately'),
+        field => 'separate_bill',
+        value => 'Y',
+        curr_value => $cust_pkg->get('separate_bill'),
+      &>
+      <TR>
+        <TD ALIGN="right"><% mt('Tax exempt') |h %> </TD>
+        <TD><INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y" <% $cgi->param('setuptax') ? 'CHECKED' : '' %>></TD>
+      </TR>
+
+      <& /elements/tr-select-taxclass.html, 'curr_value' => $part_pkg->get('taxclass')  &>
+
+      <& /elements/tr-select-taxproduct.html,
+        'label' => emt('Tax product'),
+        'curr_value' => $part_pkg->get('taxproductnum')
+      &>
+% }
 
 % } else { # new one-time charge
 
@@ -269,6 +300,12 @@ function bill_now_changed (what) {
       });
     </SCRIPT>
 
+<& /elements/tr-checkbox.html,
+  label => emt('Invoice this charge separately'),
+  field => 'separate_bill',
+  value => 'Y'
+&>
+
 % }
 
 % if ( ! $quotationnum && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
@@ -284,11 +321,16 @@ function bill_now_changed (what) {
   <TD><INPUT TYPE="checkbox" NAME="setuptax" VALUE="Y" <% $cgi->param('setuptax') ? 'CHECKED' : '' %>></TD>
 </TR>
 
-<& /elements/tr-select-taxclass.html, 'curr_value' => $cgi->param('taxclass')  &>
+<& /elements/tr-select-taxclass.html, 'curr_value' => scalar($cgi->param('taxclass')) &>
 
-<& /elements/tr-select-taxproduct.html, 'label' => emt('Tax product'), 'onclick' => 'parent.taxproductmagic(this);', 'curr_value' => $cgi->param('taxproductnum')  &>
+<& /elements/tr-select-taxproduct.html,
+  'label'      => emt('Tax product'),
+  'curr_value' => scalar($cgi->param('taxproductnum')),
+&>
 
-<& /elements/tr-select-taxoverride.html, 'onclick' => 'parent.taxoverridemagic(this);', 'curr_value' => $cgi->param('tax_override')  &>
+<& /elements/tr-select-taxoverride.html,
+  'curr_value' => scalar($cgi->param('tax_override')),
+&>
 
 % } # if !$cust_pkg
 
@@ -306,13 +348,16 @@ function bill_now_changed (what) {
   </TD>
 </TR>
 
+% my $row = 0;
+% # quotation details are handled by quotation_pkg_detail records, added via link from view/quotation.html
+% # the details below get attached to the part_pkg record, and there's no way to edit that from quotations
+% unless ($quotationnum) {
 <TR>
   <TD></TD>
   <TD><FONT SIZE="-1"><% mt('Optional additional description (also printed on invoice):') |h %> </FONT></TD>
 </TR>
 
-% my $row = 0;
-% foreach (@description) {
+%   foreach (@description) {
     <TR>
       <TD></TD>
       <TD>
@@ -327,8 +372,9 @@ function bill_now_changed (what) {
         >
       </TD>
     </TR>
-% $row++;
-% } 
+%     $row++;
+%   }
+% }
 
 
 </TABLE>