[freeside-commits] freeside/httemplate/misc counties.cgi,1.2,1.3

Ivan,,, ivan at wavetail.420.am
Tue Dec 26 17:07:30 PST 2006


Update of /home/cvs/cvsroot/freeside/httemplate/misc
In directory wavetail:/tmp/cvs-serv3135/misc

Modified Files:
	counties.cgi 
Log Message:
fix county selector

Index: counties.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/misc/counties.cgi,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- counties.cgi	23 Aug 2006 22:25:38 -0000	1.2
+++ counties.cgi	27 Dec 2006 01:07:28 -0000	1.3
@@ -1,18 +1,27 @@
-%
-%
-%  my( $state, $country ) = $cgi->param('arg');
-%
-%  my @counties = 
-%     sort
-%     map { s/[\n\r]//g; $_; }
-%     map { $_->county; }
-%     qsearch( 'cust_main_county',
-%              { 'state'   => $state,
-%                'country' => $country,
-%              },
-%            )
-%  ;
-%
-%
-%
 [ <% join(', ', map { qq("$_") } @counties) %> ]
+<%init>
+
+my $DEBUG = 0;
+
+my( $state, $country ) = $cgi->param('arg');
+
+warn "fetching counties for $state / $country \n"
+  if $DEBUG;
+
+my @counties = 
+    sort
+    map { s/[\n\r]//g; $_; }
+    map { $_->county; }
+    qsearch( {
+      'select'  => 'DISTINCT county',
+      'table'   => 'cust_main_county',
+      'hashref' => { 'state'   => $state,
+                     'country' => $country,
+                   },
+    } )
+;
+
+warn "counties: ". join(', ', map { qq("$_") } @counties). "\n"
+  if $DEBUG;
+
+</%init>



More information about the freeside-commits mailing list