From c67eaf049134e6f7ab9fe8d33d043d7d397008f3 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 16 Nov 2016 17:08:18 -0800 Subject: when searching locaitons, don't search historic locations by default, RT#73412 --- FS/FS/cust_main/Search.pm | 21 +++++++++++++++++++++ FS/FS/cust_pkg.pm | 11 +++++++++++ httemplate/search/cust_main.html | 3 ++- httemplate/search/report_cust_main.html | 4 ++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index e02114016..14dd4b469 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -695,6 +695,21 @@ sub search { push @where, FS::cust_main->$method(); } + my $current = ''; + unless ( $params->{location_history} ) { + $current = ' + AND ( cust_location.locationnum IN ( cust_main.bill_locationnum, + cust_main.ship_locationnum + ) + OR cust_location.locationnum IN ( + SELECT locationnum FROM cust_pkg + WHERE cust_pkg.custnum = cust_main.custnum + AND locationnum IS NOT NULL + AND '. FS::cust_pkg->ncancelled_recurring_sql.' + ) + )'; + } + ## # address ## @@ -714,6 +729,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND (".join(' OR ',@orwhere).") + $current )"; } } @@ -727,6 +743,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.city = $city + $current )"; } @@ -739,6 +756,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.county = $county + $current )"; } @@ -751,6 +769,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.state = $state + $current )"; } @@ -763,6 +782,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.zip LIKE $zip + $current )"; } @@ -775,6 +795,7 @@ sub search { SELECT 1 FROM cust_location WHERE cust_location.custnum = cust_main.custnum AND cust_location.country = '$country' + $current )"; } diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 714d29259..4e9ede303 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -5072,6 +5072,17 @@ sub cancel_sql { "cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0"; } +=item ncancelled_recurring_sql + +Returns an SQL expression identifying un-cancelled, recurring packages. + +=cut + +sub ncancelled_recurring_sql { + $_[0]->recurring_sql(). + " AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 ) "; +} + =item status_sql Returns an SQL expression to give the package status as a string. diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html index 672c20174..1aa3390cb 100755 --- a/httemplate/search/cust_main.html +++ b/httemplate/search/cust_main.html @@ -41,7 +41,8 @@ my %search_hash = (); #scalars my @scalars = qw ( - agentnum salesnum status address city county state zip country + agentnum salesnum status + address city county state zip country location_history invoice_terms no_censustract with_geocode with_email tax no_tax POST no_POST custbatch usernum diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html index b6be023f6..69bbe8538 100755 --- a/httemplate/search/report_cust_main.html +++ b/httemplate/search/report_cust_main.html @@ -197,6 +197,10 @@ + + <% mt('Search historical addresses') %> + +
-- cgit v1.2.1 From 4090933e1de8cae6ed89794a5bbacf3b3ed434d5 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 16 Nov 2016 17:10:07 -0800 Subject: oops, necessary for recent UI work --- httemplate/elements/popup-topreload.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 httemplate/elements/popup-topreload.html diff --git a/httemplate/elements/popup-topreload.html b/httemplate/elements/popup-topreload.html new file mode 100644 index 000000000..00d5cdf50 --- /dev/null +++ b/httemplate/elements/popup-topreload.html @@ -0,0 +1,21 @@ +<%doc> + +Example: + + <& /elements/popup-topreload, mt('Action completed') &> + + +<& /elements/header-popup.html, encode_entities($message) &> + + +<& /elements/footer-popup.html &> +<%init> + +my $message = shift; + + -- cgit v1.2.1 From 0d8b20aa0e6c7c372e7f0db51d9aee01472acfaa Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 16 Nov 2016 19:35:05 -0800 Subject: wipe payment history, RT#73431 --- bin/wipe-payment_history | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 bin/wipe-payment_history diff --git a/bin/wipe-payment_history b/bin/wipe-payment_history new file mode 100755 index 000000000..d5a9176c7 --- /dev/null +++ b/bin/wipe-payment_history @@ -0,0 +1,75 @@ +#!/usr/bin/perl + +use FS::Record; +use FS::UID qw( adminsuidsetup dbh ); + +adminsuidsetup shift; + +foreach $table (qw( + + cust_bill + cust_bill_pkg + cust_bill_pkg_detail + cust_bill_pkg_display + cust_bill_pkg_fee + cust_bill_pkg_tax_location + cust_bill_pkg_tax_rate_location + cust_bill_pkg_discount + + cust_bill_void + cust_bill_pkg_void + cust_bill_pkg_detail_void + cust_bill_pkg_display_void + cust_bill_pkg_fee_void + cust_bill_pkg_tax_location_void + cust_bill_pkg_tax_rate_location_void + cust_bill_pkg_discount_void + + cust_statement + + cust_pay + cust_bill_pay + cust_bill_pay_batch + cust_bill_pay_pkg + cust_pay_refund + + cust_pay_void + cust_bill_pay + + cust_credit + cust_credit_bill + cust_credit_bill_pkg + cust_credit_source_bill_pkg + + cust_credit_void + + cust_refund + cust_credit_refund + + cust_pay_pending + + pay_batch + cust_pay_batch + + bill_batch + cust_bill_batch + cust_bill_batch_option + + cust_tax_exempt_pkg + cust_tax_exempt_pkg_void + +)) { + foreach $t ( $table, "h_$table" ) { + my $sql = "DELETE FROM $t"; + print "$sql;\n"; #dbh->do($sql); + } +} + +foreach my $e ( 'cust_event', 'h_cust_event' ) { + my $sql = "DELETE FROM cust_event WHERE 'cust_bill' = ( SELECT eventtable FROM part_event WHERE part_event.eventpart = cust_event.eventpart )"; # and not exists ( select 1 from cust_bill where cust_event.tablenum = cust_bill.invnum )"; + print "$sql;\n"; #dbh->do($sql); +} + +#cust_event_fee??? + +1; -- cgit v1.2.1 From f7b5454b52807d21d563db95a5da3a6ed0bddb25 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 16 Nov 2016 21:02:41 -0800 Subject: add date to quick payment entry, RT#73382 --- httemplate/elements/customer-table.html | 26 ++++++++++++++++++++++++-- httemplate/misc/batch-cust_pay.html | 18 +++++++++--------- httemplate/misc/process/batch-cust_pay.cgi | 1 + 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html index 0aa792d33..25c26b584 100644 --- a/httemplate/elements/customer-table.html +++ b/httemplate/elements/customer-table.html @@ -25,7 +25,7 @@ Example: 'custnum_update_callback' => 'name_of_js_callback' #passed a rownum #listrefs - 'types' => ['immutable', ''], # immutable or ''/text + 'type' => ['immutable', ''], # immutable, checkbox, date or ''/text 'align' => [ 'c', 'l', 'r', '' ], 'size' => [], # sizes ignored for immutable 'color' => [], @@ -66,7 +66,10 @@ This mason element is currently only used by misc/batch-cust_pay.html, and probably should be cleaned up more before being used by anything else. - + + + +