[freeside-commits] branch master updated. 3e8e28b7c9ba51035564ca8eb59b374aa4a85eda

Mark Wells mark at 420.am
Wed Nov 16 11:58:52 PST 2016


The branch, master has been updated
       via  3e8e28b7c9ba51035564ca8eb59b374aa4a85eda (commit)
       via  d8844f49839b56eac11ee931f730d6e47f1ef628 (commit)
       via  5b2872a065cd65c823e9056b9153e4548ee7c201 (commit)
      from  29d80a8582103ead0b5910391cabc45cb85fa836 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3e8e28b7c9ba51035564ca8eb59b374aa4a85eda
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 16 11:55:40 2016 -0800

    adjust upgrade procedure, #73185

diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm
index 924f9bf..5325fa5 100644
--- a/FS/FS/cust_main_county.pm
+++ b/FS/FS/cust_main_county.pm
@@ -717,7 +717,7 @@ sub _upgrade_data {
   my $class = shift;
   # assume taxes in Washington with district numbers, and null name, or 
   # named 'sales tax', are looked up via the wa_sales method. mark them.
-  my $journal = 'cust_main_county__source_wa_sales';
+  my $journal = 'cust_main_county__source_wa_sales_201611';
   if (!FS::upgrade_journal->is_done($journal)) {
     my @taxes = qsearch({
         'table'     => 'cust_main_county',
@@ -737,26 +737,6 @@ sub _upgrade_data {
   }
   my @key_fields = (qw(city county state country district taxname taxclass));
 
-  # remove duplicates (except disabled records)
-  my @duplicate_sets = qsearch({
-    table => 'cust_main_county',
-    select => FS::Record::group_concat_sql('taxnum', ',') . ' AS taxnums, ' .
-              join(',', @key_fields),
-    extra_sql => ' WHERE tax > 0
-      GROUP BY city, county, state, country, district, taxname, taxclass
-      HAVING COUNT(*) > 1'
-  });
-  warn "Found ".scalar(@duplicate_sets)." set(s) of duplicate tax definitions\n"
-    if @duplicate_sets;
-  foreach my $set (@duplicate_sets) {
-    my @taxnums = split(',', $set->get('taxnums'));
-    my $first = FS::cust_main_county->by_key(shift @taxnums);
-    foreach my $taxnum (@taxnums) {
-      my $record = FS::cust_main_county->by_key($taxnum);
-      $record->_merge_into($first);
-    }
-  }
-
   # trim whitespace and convert to uppercase in the 'city' field.
   foreach my $record (qsearch({
     table => 'cust_main_county',
@@ -782,7 +762,7 @@ sub _upgrade_data {
   my $district_taxname = $conf->config('tax_district_taxname');
   $journal = 'cust_main_county__district_taxclass';
   if (!FS::upgrade_journal->is_done($journal)
-      and $conf->config('enable_taxclasses')) {
+      and $conf->exists('enable_taxclasses')) {
     eval "use FS::part_pkg_taxclass";
     my @taxes = qsearch({
         'table'     => 'cust_main_county',
@@ -856,6 +836,27 @@ sub _upgrade_data {
       }   
     }
   }
+
+  # remove duplicates (except disabled records)
+  my @duplicate_sets = qsearch({
+    table => 'cust_main_county',
+    select => FS::Record::group_concat_sql('taxnum', ',') . ' AS taxnums, ' .
+              join(',', @key_fields),
+    extra_sql => ' WHERE tax > 0
+      GROUP BY city, county, state, country, district, taxname, taxclass
+      HAVING COUNT(*) > 1'
+  });
+  warn "Found ".scalar(@duplicate_sets)." set(s) of duplicate tax definitions\n"
+    if @duplicate_sets;
+  foreach my $set (@duplicate_sets) {
+    my @taxnums = split(',', $set->get('taxnums'));
+    my $first = FS::cust_main_county->by_key(shift @taxnums);
+    foreach my $taxnum (@taxnums) {
+      my $record = FS::cust_main_county->by_key($taxnum);
+      $record->_merge_into($first);
+    }
+  }
+
  
   '';
 }

commit d8844f49839b56eac11ee931f730d6e47f1ef628
Merge: 5b2872a 29d80a8
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Nov 16 11:58:33 2016 -0800

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 5b2872a065cd65c823e9056b9153e4548ee7c201
Author: Mark Wells <mark at freeside.biz>
Date:   Mon Nov 14 16:02:31 2016 -0800

    Billsoft -> Avalara adjustments, checkpoint

diff --git a/FS/FS/TaxEngine/billsoft.pm b/FS/FS/TaxEngine/billsoft.pm
index d262aa4..6bda8db 100644
--- a/FS/FS/TaxEngine/billsoft.pm
+++ b/FS/FS/TaxEngine/billsoft.pm
@@ -105,6 +105,7 @@ sub create_batch {
     my %sales;
 
     foreach my $cust_bill_pkg ( $cust_bill->cust_bill_pkg ) {
+$DB::single = 1;
       my $cust_pkg = $cust_pkg{$cust_bill_pkg->pkgnum}
                  ||= $cust_bill_pkg->cust_pkg;
       my $pkgpart = $cust_bill_pkg->pkgpart_override || $cust_pkg->pkgpart;
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index c4ea9cd..72b586e 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -503,7 +503,7 @@ tie my %tools_importing, 'Tie::IxHash',
   'Phone numbers (DIDs)' => [ $fsurl.'misc/phone_avail-import.html', '' ],
   'Call Detail Records (CDRs)' => [ $fsurl.'misc/cdr-import.html', '' ],
 ;
-if ( $conf->config('tax_data_vendor') eq 'cch' ) {
+if ( $conf->config('tax_data_vendor') ) {
   if ( $conf->exists('taxdatadirectdownload') ) {
       $tools_importing{'Tax rates from vendor site'} =
       [ $fsurl.'misc/tax-fetch_and_import.cgi', '' ];
diff --git a/httemplate/elements/standardize_locations.js b/httemplate/elements/standardize_locations.js
index ecccd90..dd68370 100644
--- a/httemplate/elements/standardize_locations.js
+++ b/httemplate/elements/standardize_locations.js
@@ -207,8 +207,8 @@ function post_standardization() {
     prefix = 'bill_';
   }
 
-  if ( new String(cf.elements[prefix + 'zip'].value).length < 10 )
-  {
+//  if ( new String(cf.elements[prefix + 'zip'].value).length < 10 )
+//  {
 
     var country_el = cf.elements[prefix + 'country'];
     var country = country_el.options[ country_el.selectedIndex ].value;
@@ -238,12 +238,12 @@ function post_standardization() {
 
     }
 
-  } else {
-
-    cf.elements[prefix + 'geocode'].value = '';
-    <% $post_geocode %>;
-
-  }
+//  } else {
+//
+//    cf.elements[prefix + 'geocode'].value = '';
+//    <% $post_geocode %>;
+//
+//  }
 
 % } else {
 
diff --git a/httemplate/view/cust_main/billing.html b/httemplate/view/cust_main/billing.html
index 8d3925a..49dbeae 100644
--- a/httemplate/view/cust_main/billing.html
+++ b/httemplate/view/cust_main/billing.html
@@ -132,13 +132,13 @@ set_display_recurring(<% encode_json({'display_recurring' => [ $cust_main->displ
     </TR>
 % }
 
-% if ( $conf->config('tax_data_vendor') eq 'cch' ) {
+% if ( $conf->config('tax_data_vendor') ) {
 <TR>
   <TH ALIGN="right"><% mt('Tax location') |h %></TH>
 % my $tax_location = $conf->exists('tax-ship_address')
 %                    ? $cust_main->ship_location
 %                    : $cust_main->bill_location;
-  <TD><% $tax_location->geocode('cch') %></TD>
+  <TD><% $tax_location->geocode %></TD>
 </TR>
 % }
 <TR>
diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html
index 3a84b9e..7c993d6 100644
--- a/httemplate/view/cust_main/payment_history/invoice.html
+++ b/httemplate/view/cust_main/payment_history/invoice.html
@@ -3,10 +3,12 @@
 
 my( $cust_bill, %opt ) = @_;
 
-my $invoice = emt("Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed);
-
 my $under = '';
-if ( $cust_bill->owed > 0 ) {
+my $invoice;
+if ( $cust_bill->pending ) {
+  $invoice = '<I><FONT SIZE="+1" COLOR="#D05000">' .
+    emt("Pending Invoice #[_1] (Charges of [_2])", $cust_bill->display_invnum, $cust_bill->charged);
+} elsif ( $cust_bill->owed > 0 ) {
   $invoice = '<B><FONT SIZE="+1" COLOR="#FF0000">' .
     emt("Open Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed) .
     '</FONT></B>';
@@ -14,7 +16,9 @@ if ( $cust_bill->owed > 0 ) {
     $under .= '<BR>'. emt('Payment promised on [_1]',
         time2str($opt{'date_format'}, $cust_bill->promised_date));
   }
-} #if $cust_bill->owed
+} else {
+  $invoice = emt("Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed);
+}
 
 my $invnum = $cust_bill->invnum;
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/TaxEngine/billsoft.pm                        |    1 +
 FS/FS/cust_main_county.pm                          |   45 ++++++++++----------
 httemplate/elements/menu.html                      |    2 +-
 httemplate/elements/standardize_locations.js       |   16 +++----
 httemplate/view/cust_main/billing.html             |    4 +-
 .../view/cust_main/payment_history/invoice.html    |   12 ++++--
 6 files changed, 43 insertions(+), 37 deletions(-)




More information about the freeside-commits mailing list