[freeside-commits] freeside/FS/FS Misc.pm,1.17,1.18

Ivan,,, ivan at wavetail.420.am
Tue Dec 26 18:37:19 PST 2006


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv4360/FS/FS

Modified Files:
	Misc.pm 
Log Message:
Add a (magically appearing and disappearing) label on the county selector.  confusing when labeled "state"

Index: Misc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc.pm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Misc.pm	14 Nov 2006 03:30:10 -0000	1.17
+++ Misc.pm	27 Dec 2006 02:37:17 -0000	1.18
@@ -7,7 +7,10 @@
 use Data::Dumper;
 
 @ISA = qw( Exporter );
- at EXPORT_OK = qw( send_email send_fax states_hash state_label card_types );
+ at EXPORT_OK = qw( send_email send_fax
+                 states_hash counties state_label
+                 card_types
+               );
 
 $DEBUG = 0;
 
@@ -359,13 +362,12 @@
 #     sort
      map { s/[\n\r]//g; $_; }
      map { $_->state; }
-     qsearch({ 
-               'select'    => 'state',
-               'table'     => 'cust_main_county',
-               'hashref'   => { 'country' => $country },
-               'extra_sql' => 'GROUP BY state',
-            })
-  ;
+         qsearch({ 
+                   'select'    => 'state',
+                   'table'     => 'cust_main_county',
+                   'hashref'   => { 'country' => $country },
+                   'extra_sql' => 'GROUP BY state',
+                });
 
   #it could throw a fatal "Invalid country code" error (for example "AX")
   my $subcountry = eval { new Locale::SubCountry($country) }
@@ -378,6 +380,26 @@
        @states;
 }
 
+=item counties STATE COUNTRY
+
+Returns a list of counties for this state and country.
+
+=cut
+
+sub counties {
+  my( $state, $country ) = @_;
+
+  sort map { s/[\n\r]//g; $_; }
+       map { $_->county }
+           qsearch({
+             'select'  => 'DISTINCT county',
+             'table'   => 'cust_main_county',
+             'hashref' => { 'state'   => $state,
+                            'country' => $country,
+                          },
+           });
+}
+
 =item state_label STATE COUNTRY_OR_LOCALE_SUBCOUNRY_OBJECT
 
 =cut



More information about the freeside-commits mailing list