From a63b2729682586d8860290576e9307629424dbe0 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 May 2002 12:38:40 +0000 Subject: texas tax! --- httemplate/edit/agent.cgi | 8 +++--- httemplate/edit/cust_main.cgi | 4 ++- httemplate/edit/cust_main_county-expand.cgi | 15 ++++++----- httemplate/edit/cust_main_county.cgi | 29 ++++++++++++++-------- httemplate/edit/part_pkg.cgi | 26 +++++++++++++++++++ .../edit/process/cust_main_county-expand.cgi | 4 ++- httemplate/edit/process/cust_main_county.cgi | 11 +++++--- 7 files changed, 71 insertions(+), 26 deletions(-) (limited to 'httemplate/edit') 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 < - Frequency (unimplemented) - + + - Program (unimplemented) - + + 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!!; } 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!!; } 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 @@ <% -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!Error: !, $cgi->param('error'), print < + Separate by END print 'line (rumor has it broken on some browsers) or', +print '>line (broken on some browsers) or', '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!
$hashref->{country} END - print "", $hashref->{state} - ? $hashref->{state} - : '(ALL)' + print "{state} + ? ' BGCOLOR="#ffffff">'.$hashref->{state} + : ' BGCOLOR="#cccccc">(ALL)' , ""; - print "", $hashref->{county} - ? $hashref->{county} - : '(ALL)' + print "{county} + ? ' BGCOLOR="#ffffff">'. $hashref->{county} + : ' BGCOLOR="#cccccc">(ALL)' + , ""; + + print "{taxclass} + ? ' BGCOLOR="#ffffff">'. $hashref->{taxclass} + : ' BGCOLOR="#cccccc">(ALL)' , ""; print qq!%!; -END + qq!" VALUE="!, $hashref->{tax}, qq!" SIZE=6 MAXLENGTH=6>%!; + print qq!\$!; + print ''; } 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 ''; +my $conf = new FS::Conf; +if ( $conf->exists('enable_taxclasses') ) { + print 'Tax class'; +} else { + print + ''; +} + print 'Disable new orders'; print '{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 ) { -- cgit v1.2.1