summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorjeff <jeff>2008-08-28 21:32:26 +0000
committerjeff <jeff>2008-08-28 21:32:26 +0000
commit42132c9a86d36d7fefa7ba5f058f764ba6e7ad5b (patch)
treecc02b304e583dd1a10d09f300cc15c56e5863a65 /httemplate/edit
parentf0d52fc82b138598228c401d99b56e88366c6945 (diff)
taxproduct selection for one time charges
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/part_pkg_taxoverride.html9
-rw-r--r--httemplate/edit/process/quick-charge.cgi13
-rw-r--r--httemplate/edit/quick-charge.html8
3 files changed, 25 insertions, 5 deletions
diff --git a/httemplate/edit/part_pkg_taxoverride.html b/httemplate/edit/part_pkg_taxoverride.html
index 5f191b373..61dfa2ac5 100644
--- a/httemplate/edit/part_pkg_taxoverride.html
+++ b/httemplate/edit/part_pkg_taxoverride.html
@@ -10,8 +10,8 @@
<TR><TD>
<FORM="dummy">
<CENTER>
- <INPUT type="submit" value="Finish" onclick="s=fetchSelected(); s.shift(); parent.document.getElementById('<% $element_name || "tax_override" %>').value=s.toString(); parent.cClick();">
- <INPUT type="reset" value="Cancel" onclick="parent.cClick();">
+ <INPUT type="submit" value="Finish" onclick="s=fetchSelected(); s.shift(); parent.document.getElementById('<% $element_name || "tax_override" %>').value=s.toString(); parent.<% $onclick %>();">
+ <INPUT type="reset" value="Cancel" onclick="parent.<% $onclick %>();">
</CENTER>
</FORM>
</TD></TR>
@@ -124,4 +124,9 @@ my $selected = $1
my $element_name = $1
if $cgi->param('element_name') =~/^(\w+)$/;
+my $onclick = $1
+ if $cgi->param('onclick') =~/^(\w+)$/;
+
+$onclick = 'cClick' unless $onclick;
+
</%init>
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi
index 4c4927f4d..839a4e911 100644
--- a/httemplate/edit/process/quick-charge.cgi
+++ b/httemplate/edit/process/quick-charge.cgi
@@ -14,6 +14,7 @@ die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('One-time charge');
my $error = '';
+my $conf = new FS::conf;
my $param = $cgi->Vars;
my @description = ();
@@ -35,8 +36,16 @@ if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
$quantity = $1;
}
+$param->{'tax_override'} =~ /^\s*([,\d]*)\s*$/
+ or $error .= "Illegal tax override " . $param->{"tax_override"} . " ";
+my $override = $1;
+
if ( $param->{'taxclass'} eq '(select)' ) {
- $error .= "Must select a tax class. ";
+ $error .= "Must select a tax class. "
+ unless ($conf->exists('enable_taxproducts') &&
+ ( $override || $param->{taxproductnum} )
+ );
+ $cgi->param('taxclass', '');
}
unless ( $error ) {
@@ -48,6 +57,8 @@ unless ( $error ) {
'quantity' => $quantity,
'pkg' => scalar($cgi->param('pkg')),
'taxclass' => scalar($cgi->param('taxclass')),
+ 'taxproductnum' => scalar($cgi->param('taxproductnum')),
+ 'tax_override' => $override,
'classnum' => scalar($cgi->param('classnum')),
'additional' => \@description,
} );
diff --git a/httemplate/edit/quick-charge.html b/httemplate/edit/quick-charge.html
index d51015054..bf4c44571 100644
--- a/httemplate/edit/quick-charge.html
+++ b/httemplate/edit/quick-charge.html
@@ -71,7 +71,7 @@ function validate_quick_charge () {
</SCRIPT>
-<FORM ACTION="process/quick-charge.cgi" NAME="QuickChargeForm" METHOD="POST" onsubmit="document.QuickChargeForm.submit.disabled=true;return validate_quick_charge();">
+<FORM ACTION="process/quick-charge.cgi" NAME="QuickChargeForm" ID="QuickChargeForm" METHOD="POST" onsubmit="document.QuickChargeForm.submit.disabled=true;return validate_quick_charge();">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
@@ -97,6 +97,10 @@ function validate_quick_charge () {
<% 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') ) %>
+
<TR>
<TD>Description:</TD>
<TD>
@@ -110,7 +114,7 @@ function validate_quick_charge () {
</TR>
% 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++ ) {