[freeside-commits] freeside/FS/FS Schema.pm, 1.168, 1.169 cust_main_county.pm, 1.23, 1.24 Misc.pm, 1.33, 1.34 Mason.pm, 1.19, 1.20

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


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

Modified Files:
	Schema.pm cust_main_county.pm Misc.pm Mason.pm 
Log Message:
UI for per-city taxes (setup and assigning to customers/package locations), RT#5852

Index: cust_main_county.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main_county.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cust_main_county.pm	18 Jan 2009 23:43:39 -0000	1.23
+++ cust_main_county.pm	12 Oct 2009 01:45:12 -0000	1.24
@@ -2,7 +2,7 @@
 
 use strict;
 use vars qw( @ISA @EXPORT_OK $conf
-             @cust_main_county %cust_main_county $countyflag );
+             @cust_main_county %cust_main_county $countyflag ); # $cityflag );
 use Exporter;
 use FS::Record qw( qsearch dbh );
 use FS::cust_bill_pkg;
@@ -17,6 +17,7 @@
 
 @cust_main_county = ();
 $countyflag = '';
+#$cityflag = '';
 
 #ask FS::UID to run this stuff for us later
 $FS::UID::callback{'FS::cust_main_county'} = sub { 
@@ -55,10 +56,12 @@
 
 =item taxnum - primary key (assigned automatically for new tax rates)
 
-=item state
+=item city
 
 =item county
 
+=item state
+
 =item country
 
 =item tax - percentage
@@ -116,8 +119,9 @@
   $self->exempt_amount(0) unless $self->exempt_amount;
 
   $self->ut_numbern('taxnum')
-    || $self->ut_anything('state')
+    || $self->ut_textn('city')
     || $self->ut_textn('county')
+    || $self->ut_anything('state')
     || $self->ut_text('country')
     || $self->ut_float('tax')
     || $self->ut_textn('taxclass') # ...

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- Schema.pm	9 Oct 2009 23:59:24 -0000	1.168
+++ Schema.pm	12 Oct 2009 01:45:12 -0000	1.169
@@ -405,12 +405,13 @@
         'printed',      'int',     '', '', '', '', 
 
         #specific use cases
-        'closed',      'char', 'NULL',  1, '', '', 
+        'closed',      'char', 'NULL',  1, '', '', #not yet used much
         'statementnum', 'int', 'NULL', '', '', '', #invoice aggregate statements
+        'agent_invid',  'int', 'NULL', '', '', '', #(varchar?) importing legacy
       ],
       'primary_key' => 'invnum',
-      'unique' => [],
-      'index' => [ ['custnum'], ['_date'], ['statementnum'], ],
+      'unique' => [ [ 'custnum', 'agent_invid' ] ], #agentnum?  huh
+      'index' => [ ['custnum'], ['_date'], ['statementnum'], ['agent_invid'] ],
     },
 
     'cust_statement' => {
@@ -866,8 +867,9 @@
                             # a tax rate.
       'columns' => [
         'taxnum',   'serial',   '',    '', '', '', 
-        'state',    'varchar',  'NULL',    $char_d, '', '', 
+        'city',     'varchar',  'NULL',    $char_d, '', '',
         'county',   'varchar',  'NULL',    $char_d, '', '', 
+        'state',    'varchar',  'NULL',    $char_d, '', '', 
         'country',  'char',  '', 2, '', '', 
         'taxclass',   'varchar', 'NULL', $char_d, '', '', 
         'exempt_amount', @money_type, '', '', 
@@ -879,7 +881,7 @@
       'primary_key' => 'taxnum',
       'unique' => [],
   #    'unique' => [ ['taxnum'], ['state', 'county'] ],
-      'index' => [ [ 'county' ], [ 'state' ], [ 'country' ],
+      'index' => [ [ 'city' ], [ 'county' ], [ 'state' ], [ 'country' ],
                    [ 'taxclass' ],
                  ],
     },

Index: Misc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- Misc.pm	3 Dec 2008 01:42:25 -0000	1.33
+++ Misc.pm	12 Oct 2009 01:45:12 -0000	1.34
@@ -14,7 +14,7 @@
 
 @ISA = qw( Exporter );
 @EXPORT_OK = qw( generate_email send_email send_fax
-                 states_hash counties state_label
+                 states_hash counties cities state_label
                  card_types
                  generate_ps generate_pdf do_print
                  csv_from_fixed
@@ -556,6 +556,7 @@
 sub counties {
   my( $state, $country ) = @_;
 
+  map { $_ } #return num_counties($state, $country) unless wantarray;
   sort map { s/[\n\r]//g; $_; }
        map { $_->county }
            qsearch({
@@ -567,6 +568,28 @@
            });
 }
 
+=item cities COUNTY STATE COUNTRY
+
+Returns a list of cities for this county, state and country.
+
+=cut
+
+sub cities {
+  my( $county, $state, $country ) = @_;
+
+  map { $_ } #return num_cities($county, $state, $country) unless wantarray;
+  sort map { s/[\n\r]//g; $_; }
+       map { $_->city }
+           qsearch({
+             'select'  => 'DISTINCT city',
+             'table'   => 'cust_main_county',
+             'hashref' => { 'county'  => $county,
+                            'state'   => $state,
+                            'country' => $country,
+                          },
+           });
+}
+
 =item state_label STATE COUNTRY_OR_LOCALE_SUBCOUNRY_OBJECT
 
 =cut

Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- Mason.pm	22 Sep 2009 03:08:19 -0000	1.19
+++ Mason.pm	12 Oct 2009 01:45:12 -0000	1.20
@@ -118,7 +118,9 @@
   use FS::UI::Web::small_custview qw(small_custview);
   use FS::UI::bytecount;
   use FS::Msgcat qw(gettext geterror);
-  use FS::Misc qw( send_email send_fax states_hash counties state_label );
+  use FS::Misc qw( send_email send_fax
+                   states_hash counties cities state_label
+                 );
   use FS::Misc::eps2png qw( eps2png );
   use FS::Report::Table::Monthly;
   use FS::TicketSystem;



More information about the freeside-commits mailing list