[freeside-commits] branch FREESIDE_4_BRANCH updated. 4c4689fcc39ce5829a48aec2cd60bf4efdc827bc
Mark Wells
mark at 420.am
Wed Nov 16 11:58:52 PST 2016
The branch, FREESIDE_4_BRANCH has been updated
via 4c4689fcc39ce5829a48aec2cd60bf4efdc827bc (commit)
from d8ab24b3869cd8402e20f49456b0c24bc110cb1b (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 4c4689fcc39ce5829a48aec2cd60bf4efdc827bc
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);
+ }
+ }
+
'';
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_main_county.pm | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
More information about the freeside-commits
mailing list