[freeside-commits] freeside/httemplate/browse cust_main_county.cgi, 1.30.4.2, 1.30.4.3
Ivan,,,
ivan at wavetail.420.am
Sat Jan 29 23:02:51 PST 2011
Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv1232/browse
Modified Files:
Tag: FREESIDE_2_1_BRANCH
cust_main_county.cgi
Log Message:
improve tax edit UI: add more cities & remove individual cities, 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.2
retrieving revision 1.30.4.3
diff -u -w -d -r1.30.4.2 -r1.30.4.3
--- cust_main_county.cgi 30 Jan 2011 06:44:06 -0000 1.30.4.2
+++ cust_main_county.cgi 30 Jan 2011 07:02:49 -0000 1.30.4.3
@@ -10,7 +10,7 @@
'table' => 'cust_main_county',
'hashref' => $hashref,
'order_by' =>
- 'ORDER BY country, state, county, taxclass',
+ 'ORDER BY country, state, county, city, taxclass',
},
'count_query' => $count_query,
'header' => \@header,
@@ -449,14 +449,17 @@
my %seen_country = ();
my %seen_state = ();
+my %seen_county = ();
my @fields = (
sub { my $country = shift->country;
return '' if $seen_country{$country}++;
code2country($country). " ($country)";
},
+
sub { my $label = $seen_state{$_[0]->country}->{$_[0]->state}++
? '' : state_label($_[0]->state, $_[0]->country);
+
my $countylinks = ( $_[0]->county && $label )
? ' '. add_link(
desc => 'Add more counties',
@@ -472,6 +475,7 @@
cgi => $cgi,
)
: '';
+
my $addlink =
( $_[0]->state
? ''
@@ -481,15 +485,39 @@
cgi => $cgi,
)
);
+
$label.$countylinks.$addlink;
},
- sub { $_[0]->county
- ? $_[0]->county. ' '.
- remove_link( col => 'county',
- label=> 'remove county',
+
+ sub { my $label =
+ $seen_county{$_[0]->country}->{$_[0]->state}->{$_[0]->county}++
+ ? '' : $_[0]->county;
+
+ my $citylinks = '';
+ if ( $label ) {
+ $citylinks = $_[0]->city
+ ? ' '. add_link(
+ desc => 'Add more cities',
+ col => 'county',
+ label=> 'add more cities',
+ row => $_[0],
+ cgi => $cgi,
+ ).
+ ' '. collapse_link(
+ col => 'county',
+ label=> 'remove all cities',
row => $_[0],
cgi => $cgi,
)
+ : ' '. remove_link( col => 'county',
+ label=> 'remove county',
+ row => $_[0],
+ cgi => $cgi,
+ );
+ }
+
+ $_[0]->county
+ ? $label.$citylinks
: '(all) '.
expand_link( desc => 'Add Counties',
row => $_[0],
@@ -497,10 +525,11 @@
cgi => $cgi,
);
},
+
sub { $_[0]->city
? $_[0]->city. ' '.
- collapse_link( col => 'county',
- label=> 'remove cities',
+ remove_link( col => 'city',
+ label=> 'remove city',
row => $_[0],
cgi => $cgi,
)
More information about the freeside-commits
mailing list