[freeside-commits] freeside/httemplate/browse cust_main_county.cgi, 1.30.4.4, 1.30.4.5
Ivan,,,
ivan at wavetail.420.am
Mon Apr 11 13:40:45 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv8556
Modified Files:
Tag: FREESIDE_2_1_BRANCH
cust_main_county.cgi
Log Message:
improve tax edit: don't offer to remove cities that have already been split into taxclasses, RT#11144
Index: cust_main_county.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/cust_main_county.cgi,v
retrieving revision 1.30.4.4
retrieving revision 1.30.4.5
diff -u -w -d -r1.30.4.4 -r1.30.4.5
--- cust_main_county.cgi 30 Jan 2011 07:13:45 -0000 1.30.4.4
+++ cust_main_county.cgi 11 Apr 2011 20:40:43 -0000 1.30.4.5
@@ -456,6 +456,7 @@
code2country($country). " ($country)";
},
+ #state
sub { my $label = $seen_state{$_[0]->country}->{$_[0]->state}++
? '' : state_label($_[0]->state, $_[0]->country);
@@ -488,6 +489,7 @@
$label.$countylinks.$addlink;
},
+ #county
sub { my $label =
$seen_county{$_[0]->country}->{$_[0]->state}->{$_[0]->county}++
? '' : $_[0]->county;
@@ -525,19 +527,29 @@
);
},
- sub { $_[0]->city
- ? $_[0]->city. ' '.
+ #city
+ sub {
+ my $r = shift;
+ if ( $r->city ) {
+
+ if ( $r->taxclass ) { #but if it has a taxclass, can't remove
+ $r->city;
+ } else {
+ $r->city. ' '.
remove_link( col => 'city',
label=> 'remove city',
- row => $_[0],
+ row => $r,
cgi => $cgi,
- )
- : '(all) '.
+ );
+ }
+ } else {
+ '(all) '.
expand_link( desc => 'Add Cities',
- row => $_[0],
+ row => $r,
label => 'add cities',
cgi => $cgi,
);
+ }
},
);
@@ -551,9 +563,23 @@
if ( $conf->exists('enable_taxclasses') ) {
push @header, qq!Tax class (<A HREF="${p}edit/part_pkg_taxclass.html">add new</A>)!;
push @header2, '(per-package classification)';
- push @fields, sub { $_[0]->taxclass || '(all) '.
- separate_taxclasses_link($_[0], 'Separate Taxclasses').
- 'separate taxclasses</A></FONT>'
+ push @fields, sub {
+ my $r = shift;
+ if ( $r->taxclass ) {
+ $r->taxclass;
+ } else {
+ my $sql = 'SELECT COUNT(*) FROM cust_main_county
+ WHERE country = ? AND state = ? AND county = ?
+ AND city = ? AND taxclass IS NOT NULL';
+ if ( FS::Record->scalar_sql($sql, map $r->$_,
+ qw( country state county city) ) ) {
+ '(none)';
+ } else {
+ '(all) '.
+ separate_taxclasses_link($r, 'Separate Taxclasses').
+ 'separate taxclasses</A></FONT>';
+ }
+ }
};
push @color, sub { shift->taxclass ? '000000' : '999999' };
push @links, '';
More information about the freeside-commits
mailing list