summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-xhttemplate/edit/agent.cgi8
-rwxr-xr-xhttemplate/edit/cust_main.cgi4
-rwxr-xr-xhttemplate/edit/cust_main_county-expand.cgi15
-rwxr-xr-xhttemplate/edit/cust_main_county.cgi29
-rwxr-xr-xhttemplate/edit/part_pkg.cgi26
-rwxr-xr-xhttemplate/edit/process/cust_main_county-expand.cgi4
-rwxr-xr-xhttemplate/edit/process/cust_main_county.cgi11
7 files changed, 71 insertions, 26 deletions
diff --git a/httemplate/edit/agent.cgi b/httemplate/edit/agent.cgi
index 3fca34326..449456cdd 100755
--- a/httemplate/edit/agent.cgi
+++ b/httemplate/edit/agent.cgi
@@ -51,12 +51,12 @@ print <<END;
</SELECT></TD>
</TR>
<TR>
- <TD ALIGN="right">Frequency (unimplemented)</TD>
- <TD><INPUT TYPE="text" NAME="freq" VALUE="$hashref->{freq}"></TD>
+ <TD ALIGN="right"><!--Frequency--></TD>
+ <TD><INPUT TYPE="hidden" NAME="freq" VALUE="$hashref->{freq}"></TD>
</TR>
<TR>
- <TD ALIGN="right">Program (unimplemented)</TD>
- <TD><INPUT TYPE="text" NAME="prog" VALUE="$hashref->{prog}"></TD>
+ <TD ALIGN="right"><!--Program--></TD>
+ <TD><INPUT TYPE="hidden" NAME="prog" VALUE="$hashref->{prog}"></TD>
</TR>
</TABLE>
END
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index 33e72d864..e92abefd7 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -98,7 +98,9 @@ if ( $custnum && ! $conf->exists('editreferrals') ) {
print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
} else {
my(@referrals) = qsearch('part_referral',{});
- if ( scalar(@referrals) == 1 ) {
+ if ( scalar(@referrals) == 0 ) {
+ die "You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to ". popurl(2). "browse/part_referral.cgi and create one or more advertising sources.";
+ } elsif ( scalar(@referrals) == 1 ) {
$refnum ||= $referrals[0]->refnum;
print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
} else {
diff --git a/httemplate/edit/cust_main_county-expand.cgi b/httemplate/edit/cust_main_county-expand.cgi
index 66e8aaf9e..9f314a457 100755
--- a/httemplate/edit/cust_main_county-expand.cgi
+++ b/httemplate/edit/cust_main_county-expand.cgi
@@ -1,16 +1,18 @@
<!-- mason kludge -->
<%
-my($taxnum, $delim, $expansion );
+my($taxnum, $delim, $expansion, $taxclass );
+my($query) = $cgi->keywords;
if ( $cgi->param('error') ) {
$taxnum = $cgi->param('taxnum');
$delim = $cgi->param('delim');
$expansion = $cgi->param('expansion');
+ $taxclass = $cgi->param('taxclass');
} else {
- my ($query) = $cgi->keywords;
- $query =~ /^(\d+)$/
- or die "Illegal taxnum!";
- $taxnum = $1;
+ $query =~ /^(taxclass)?(\d+)$/
+ or die "Illegal taxnum (query $query)";
+ $taxclass = $1 ? 'taxclass' : '';
+ $taxnum = $2;
$delim = 'n';
$expansion = '';
}
@@ -31,11 +33,12 @@ print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
print <<END;
<FORM ACTION="${p1}process/cust_main_county-expand.cgi" METHOD=POST>
<INPUT TYPE="hidden" NAME="taxnum" VALUE="$taxnum">
+ <INPUT TYPE="hidden" NAME="taxclass" VALUE="$taxclass">
Separate by
END
print '<INPUT TYPE="radio" NAME="delim" VALUE="n"';
print ' CHECKED' if $delim eq 'n';
-print '>line (rumor has it broken on some browsers) or',
+print '>line (broken on some browsers) or',
'<INPUT TYPE="radio" NAME="delim" VALUE="s"';
print ' CHECKED' if $delim eq 's';
print '>whitespace.';
diff --git a/httemplate/edit/cust_main_county.cgi b/httemplate/edit/cust_main_county.cgi
index a11711770..7ef37a48d 100755
--- a/httemplate/edit/cust_main_county.cgi
+++ b/httemplate/edit/cust_main_county.cgi
@@ -14,8 +14,10 @@ print qq!<FORM ACTION="!, popurl(1),
<TR>
<TH><FONT SIZE=-1>Country</FONT></TH>
<TH><FONT SIZE=-1>State</FONT></TH>
- <TH>County</TH>
+ <TH><FONT SIZE=-1>County</FONT></TH>
+ <TH><FONT SIZE=-1>Taxclass</FONT></TH>
<TH><FONT SIZE=-1>Tax</FONT></TH>
+ <TH><FONT SIZE=-1>Exempt<BR>per<BR>month</TH>
</TR>
END
@@ -26,22 +28,29 @@ foreach my $cust_main_county ( sort { $a->country cmp $b->country
my($hashref)=$cust_main_county->hashref;
print <<END;
<TR>
- <TD>$hashref->{country}</TD>
+ <TD BGCOLOR="#ffffff">$hashref->{country}</TD>
END
- print "<TD>", $hashref->{state}
- ? $hashref->{state}
- : '(ALL)'
+ print "<TD", $hashref->{state}
+ ? ' BGCOLOR="#ffffff">'.$hashref->{state}
+ : ' BGCOLOR="#cccccc">(ALL)'
, "</TD>";
- print "<TD>", $hashref->{county}
- ? $hashref->{county}
- : '(ALL)'
+ print "<TD", $hashref->{county}
+ ? ' BGCOLOR="#ffffff">'. $hashref->{county}
+ : ' BGCOLOR="#cccccc">(ALL)'
+ , "</TD>";
+
+ print "<TD", $hashref->{taxclass}
+ ? ' BGCOLOR="#ffffff">'. $hashref->{taxclass}
+ : ' BGCOLOR="#cccccc">(ALL)'
, "</TD>";
print qq!<TD><INPUT TYPE="text" NAME="tax!, $hashref->{taxnum},
- qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6>%</TD></TR>!;
-END
+ qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6>%</TD>!;
+ print qq!<TD>\$<INPUT TYPE="text" NAME="exempt_amount!, $hashref->{taxnum},
+ qq!" VALUE="!, $hashref->{exempt_amount}||0, qq!" SIZE=6></TD>!;
+ print '</TR>';
}
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index a63fc23fe..e03017db4 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -88,6 +88,23 @@ print '>';
print '</TD></TR>';
+my $conf = new FS::Conf;
+if ( $conf->exists('enable_taxclasses') ) {
+ print '<TR><TD ALIGN="right">Tax class</TD><TD><SELECT NAME="taxclass">';
+ my $sth = dbh->prepare('SELECT DISTINCT taxclass FROM cust_main_county')
+ or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ foreach my $taxclass ( map $_->[0], @{$sth->fetchall_arrayref} ) {
+ print qq!<OPTION VALUE="$taxclass"!;
+ print ' SELECTED' if $taxclass eq $hashref->{taxclass};
+ print qq!>$taxclass</OPTION>!;
+ }
+ print '</SELECT></TD></TR>';
+} else {
+ print
+ '<INPUT TYPE="hidden" NAME="taxclass" VALUE="'. $hashref->{taxclass}. '">';
+}
+
print '<TR><TD ALIGN="right">Disable new orders</TD><TD>';
print '<INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"';
print ' CHECKED' if $hashref->{disabled} eq "Y";
@@ -344,6 +361,14 @@ my %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
tie my %options, 'Tie::IxHash', map { $_=>$plans{$_}->{'name'} } keys %plans;
+my @form_select = ();
+if ( $conf->exists('enable_taxclasses') ) {
+ push @form_select, 'taxclass';
+} else {
+ push @fixups, 'taxclass'; #hidden
+}
+
+
my $widget = new HTML::Widgets::SelectLayers(
'selected_layer' => $part_pkg->plan,
'options' => \%options,
@@ -351,6 +376,7 @@ my $widget = new HTML::Widgets::SelectLayers(
'form_action' => 'process/part_pkg.cgi',
'form_text' => [ qw(pkg comment freq clone pkgnum pkgpart), @fixups ],
'form_checkbox' => [ qw(setuptax recurtax disabled) ],
+ 'form_select' => [ @form_select ],
'fixup_callback' => sub {
#my $ = @_;
my $html = '';
diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi
index 64061deed..a452711c1 100755
--- a/httemplate/edit/process/cust_main_county-expand.cgi
+++ b/httemplate/edit/process/cust_main_county-expand.cgi
@@ -27,7 +27,9 @@ foreach ( @expansion) {
my(%hash)=$cust_main_county->hash;
my($new)=new FS::cust_main_county \%hash;
$new->setfield('taxnum','');
- if ( ! $cust_main_county->state ) {
+ if ( $cgi->param('taxclass') ) {
+ $new->setfield('taxclass', $_);
+ } elsif ( ! $cust_main_county->state ) {
$new->setfield('state',$_);
} else {
$new->setfield('county',$_);
diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi
index 0800789b5..990a23919 100755
--- a/httemplate/edit/process/cust_main_county.cgi
+++ b/httemplate/edit/process/cust_main_county.cgi
@@ -1,13 +1,16 @@
<%
-foreach ( $cgi->param ) {
+foreach ( grep { /^tax\d+$/ } $cgi->param ) {
/^tax(\d+)$/ or die "Illegal form $_!";
my($taxnum)=$1;
my($old)=qsearchs('cust_main_county',{'taxnum'=>$taxnum})
or die "Couldn't find taxnum $taxnum!";
- next unless $old->getfield('tax') ne $cgi->param("tax$taxnum");
- my(%hash)=$old->hash;
- $hash{tax}=$cgi->param("tax$taxnum");
+ my $exempt_amount = $cgi->param("exempt_amount$taxnum");
+ next unless $old->tax ne $cgi->param("tax$taxnum")
+ || $old->exempt_amount ne $exempt_amount;
+ my %hash = $old->hash;
+ $hash{tax} = $cgi->param("tax$taxnum");
+ $hash{exempt_amount} = $exempt_amount;
my($new)=new FS::cust_main_county \%hash;
my($error)=$new->replace($old);
if ( $error ) {