[freeside-commits] freeside/httemplate/edit/process cust_main_county-expand.cgi, 1.12, 1.13 cust_main_county-collapse.cgi, 1.7, 1.8

Ivan,,, ivan at wavetail.420.am
Sun Oct 11 18:45:14 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail.420.am:/tmp/cvs-serv1395/httemplate/edit/process

Modified Files:
	cust_main_county-expand.cgi cust_main_county-collapse.cgi 
Log Message:
UI for per-city taxes (setup and assigning to customers/package locations), RT#5852

Index: cust_main_county-collapse.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/cust_main_county-collapse.cgi,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- cust_main_county-collapse.cgi	23 Jul 2009 13:25:10 -0000	1.7
+++ cust_main_county-collapse.cgi	12 Oct 2009 01:45:12 -0000	1.8
@@ -12,10 +12,15 @@
 
 #really should do this in a .pm & start transaction
 
-foreach my $delete ( qsearch('cust_main_county', {
-                    'country' => $cust_main_county->country,
-                    'state' => $cust_main_county->state  
-                 } ) ) {
+my %search = (
+               'country' => $cust_main_county->country,
+               'state'   => $cust_main_county->state,
+             );
+
+$search{'county'} = $cust_main_county->county
+  if $cust_main_county->city;
+
+foreach my $delete ( qsearch('cust_main_county', \%search) ) {
 #  unless ( qsearch('cust_main',{
 #    'state'  => $cust_main_county->getfield('state'),
 #    'county' => $cust_main_county->getfield('county'),
@@ -30,7 +35,11 @@
 }
 
 $cust_main_county->taxnum('');
-$cust_main_county->county('');
+if ( $cust_main_county->city ) {
+  $cust_main_county->city('');
+} else {
+  $cust_main_county->county('');
+}
 my $error = $cust_main_county->insert;
 die $error if $error;
 

Index: cust_main_county-expand.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/cust_main_county-expand.cgi,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cust_main_county-expand.cgi	28 Dec 2008 19:08:41 -0000	1.12
+++ cust_main_county-expand.cgi	12 Oct 2009 01:45:12 -0000	1.13
@@ -48,17 +48,21 @@
     $new->setfield('taxclass', $_);
   } elsif ( ! $cust_main_county->state ) {
     $new->setfield('state',$_);
-  } else {
+  } elsif ( ! $cust_main_county->county ) {
     $new->setfield('county',$_);
+  } else {
+    #uppercase cities in the US to try and agree with USPS validation
+    $new->setfield('city', $new->country eq 'US' ? uc($_) : $_ );
   }
   my $error = $new->insert;
   die $error if $error;
 }
 
 unless ( qsearch( 'cust_main', {
-                                 'state'  => $cust_main_county->state,
-                                 'county' => $cust_main_county->county,
-                                 'country' =>  $cust_main_county->country,
+                                 'city'    => $cust_main_county->city,
+                                 'county'  => $cust_main_county->county,
+                                 'state'   => $cust_main_county->state,
+                                 'country' => $cust_main_county->country,
                                } )
          || ! @expansion
 ) {
@@ -68,8 +72,9 @@
 
 if ( $cgi->param('taxclass') ) {
   print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi?".
-                         'state='.   uri_escape($cust_main_county->state  ).';'.
+                         'city='.    uri_escape($cust_main_county->city   ).';'.
                          'county='.  uri_escape($cust_main_county->county ).';'.
+                         'state='.   uri_escape($cust_main_county->state  ).';'.
                          'country='. uri_escape($cust_main_county->country)
                       );
   myexit;



More information about the freeside-commits mailing list