From 8ca45ec1f1ab960ee1e262ee764f05d214728d05 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 4 Sep 2018 08:30:35 -0400 Subject: RT# 75817 - Added password change link to cust main page --- httemplate/edit/cust_main-contacts.html | 20 +++++----- httemplate/elements/change_password.html | 15 +++----- httemplate/elements/contact.html | 10 ++--- httemplate/elements/validate_password.html | 55 ++-------------------------- httemplate/misc/process/change-password.html | 6 ++- httemplate/view/cust_main/contacts_new.html | 14 ++++++- 6 files changed, 42 insertions(+), 78 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html index 3783cb9e9..7c5a78209 100644 --- a/httemplate/edit/cust_main-contacts.html +++ b/httemplate/edit/cust_main-contacts.html @@ -5,18 +5,20 @@ this one isn't being maintained well. :/ - +<& '/elements/validate_password_js.html', &> + <& elements/edit.html, 'name_singular' => 'customer contacts', #yes, we're editing all of them 'table' => 'cust_main', diff --git a/httemplate/elements/change_password.html b/httemplate/elements/change_password.html index 7d95e19dc..65b7d8502 100644 --- a/httemplate/elements/change_password.html +++ b/httemplate/elements/change_password.html @@ -11,9 +11,9 @@ % if (!$opt{'no_label_display'}) { (<% emt( $change_title ) %>) % } -
+
% if (!$opt{'noformtag'}) { -
+ % } <% $change_id_input %> @@ -44,11 +44,8 @@ function <%$pre%>toggle(toggle, clear) { if (clear) { document.getElementById('<%$pre%>password').value = ''; document.getElementById('<%$pre%>password_result').innerHTML = ''; -% if ($opt{'contact_num'}) { - document.getElementById('<% $opt{'pre_pwd_field_label'} %>selfservice_access').value = 'Y'; -% } } - document.getElementById('<%$pre%>form').style.display = + document.getElementById('<%$pre%>div').style.display = toggle ? 'inline-block' : 'none'; % if (!$opt{'no_label_display'}) { document.getElementById('<%$pre%>link').style.display = @@ -56,7 +53,7 @@ function <%$pre%>toggle(toggle, clear) { % } } -function checkPasswordValidation() { +function <%$pre%>checkPasswordValidation(resultId) { var validationResult = document.getElementById('<%$pre%>password_result').innerHTML; if (validationResult.match(/Password valid!/)) { return true; @@ -83,8 +80,8 @@ if ($opt{'svc_acct'}) { } elsif ($opt{'contact_num'}) { $change_id_input = ' - - + + '; $pre .= $opt{'pre_pwd_field_label'}; } diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 7b6c853d4..5588890c8 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -76,12 +76,10 @@ placeholder = "<% $value |h %>" > % my $contactnum = $curr_value ? $curr_value : '0'; - <& '/elements/validate_password.html', - 'fieldid' => "changepw".$id."_password", - 'svcnum' => '', - 'contactnum' => $contactnum, - 'submitid' => "submit", - &> + + <%init> diff --git a/httemplate/misc/process/change-password.html b/httemplate/misc/process/change-password.html index a3e060168..37ad6d915 100644 --- a/httemplate/misc/process/change-password.html +++ b/httemplate/misc/process/change-password.html @@ -18,7 +18,7 @@ <% $cgi->redirect($fsurl.'view/svc_acct.cgi?'.$cgi->query_string) %> % } % elsif ($contactnum) { - <% $cgi->redirect($fsurl.'edit/cust_main-contacts.html?'.$cgi->param('custnum')) %> + <% $cgi->redirect($fsurl.'view/cust_main.cgi?'.$cgi->param('custnum')) %> % } % } @@ -34,6 +34,10 @@ my $curuser = $FS::CurrentUser::CurrentUser; $cgi->param('svcnum') =~ /^(\d+)$/ or die "illegal svcnum" if $cgi->param('svcnum'); my $svcnum = $1; +foreach my $prefix (grep /^(.*)(password)$/, $cgi->param) { + $cgi->param('password' => $cgi->param($prefix)); +} + $cgi->param('contactnum') =~ /^(\d+)$/ or die "illegal contactnum" if $cgi->param('contactnum'); my $contactnum = $1; diff --git a/httemplate/view/cust_main/contacts_new.html b/httemplate/view/cust_main/contacts_new.html index fe412cc00..9252b2197 100644 --- a/httemplate/view/cust_main/contacts_new.html +++ b/httemplate/view/cust_main/contacts_new.html @@ -22,6 +22,7 @@ % my $bgcolor1 = '#ffffff'; % my $bgcolor2 = '#eeeeee'; % my $bgcolor = $bgcolor2; +% my $count = 0; % foreach my $cust_contact ( @cust_contacts ) { % my $contact = $cust_contact->contact; % my $td = qq(); @@ -39,6 +40,16 @@ Enabled %# disable %# re-email + + <& /elements/change_password.html, + 'contact_num' => $cust_contact->contactnum, + 'custnum' => $cust_contact->custnum, + 'no_label_display' => '', + 'label' => 'change password', + 'curr_value' => '', + 'pre_pwd_field_label' => 'contact'.$count.'_', + &> + % } else { Disabled %# enable @@ -63,6 +74,7 @@ % } else { % $bgcolor = $bgcolor1; % } +% $count++; % } %} @@ -80,6 +92,6 @@ my @cust_contacts = $cust_main->cust_contact; # residential customers have a default "invisible" contact, but if they # somehow get more than one contact, show them -my $display = scalar(@cust_contacts) > 1; +my $display = scalar(@cust_contacts) > 0; -- cgit v1.2.1 From 0c9c9e95f2f32e7d55dd53f2903c21eb8ce7af6b Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Tue, 4 Sep 2018 08:32:21 -0400 Subject: RT# 75817 - added new file to hold javascript for password validation --- httemplate/elements/validate_password_js.html | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 httemplate/elements/validate_password_js.html (limited to 'httemplate') diff --git a/httemplate/elements/validate_password_js.html b/httemplate/elements/validate_password_js.html new file mode 100644 index 000000000..64db0a97b --- /dev/null +++ b/httemplate/elements/validate_password_js.html @@ -0,0 +1,71 @@ +<%doc> + +JavaScript to perform password validation + + <& '/elements/validate_password_js.html', + contactnum => $contactnum, + svcnum => $svcnum + &> + +The ID of the input field can be anything; the ID of the DIV in which to display results +should be the input id plus '_result'. + + + +<& '/elements/xmlhttp.html', + 'url' => $p.'misc/xmlhttp-validate_password.html', + 'subs' => [ 'validate_password' ], + 'method' => 'POST', # important not to put passwords in url +&> + + +<%init> +my %opt = @_; + \ No newline at end of file -- cgit v1.2.1 From 4e00b1e784fdb369fefd538f27c1ac465e5abc9a Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 7 Sep 2018 10:55:19 -0400 Subject: RT# 75817 - fixed saving of password for new contacts, and password validation on dynamicly created rows --- httemplate/edit/cust_main-contacts.html | 7 +++++ httemplate/edit/elements/edit.html | 2 +- httemplate/edit/process/elements/process.html | 2 +- httemplate/elements/contact.html | 37 +++++++++++++++------------ 4 files changed, 29 insertions(+), 19 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html index 7c5a78209..abef7505d 100644 --- a/httemplate/edit/cust_main-contacts.html +++ b/httemplate/edit/cust_main-contacts.html @@ -60,6 +60,13 @@ this one isn't being maintained well. :/ my $curuser = $FS::CurrentUser::CurrentUser; my $conf = new FS::Conf; +if ( $cgi->param('redirect') ) { + my $session = $cgi->param('redirect'); + my $pref = $curuser->option("redirect$session"); + die "unknown redirect session $session\n" unless length($pref); + $cgi = new CGI($pref); +} + my $custnum; if ( $cgi->param('error') ) { $custnum = scalar($cgi->param('custnum')); diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 8ba703a2f..b7f2e7adb 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -669,7 +669,7 @@ Example: var newrow = <% include(@layer_opt, html_only=>1) |js_string %>; % #until the rest have html/js_only -% if ( ($type eq 'selectlayers') || ($type eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) ) { +% if ( ($type eq 'selectlayers') || ($type eq 'selectlayersx') || ($type =~ /^select-cgp_rule_/) || ($type eq 'contact') ) { var newfunc = <% include(@layer_opt, js_only=>1) |js_string %>; % } else { var newfunc = ''; diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index d2b037053..a3ea7ee59 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -127,7 +127,7 @@ Example: % " attempting to set redirect$session to ". $cgi->query_string."\n"; % } % -<% $cgi->redirect("$error_redirect?redirect=$session") %> +<% $cgi->redirect("$error_redirect"."redirect=$session") %> % % } else { % diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 5588890c8..5fa8ae485 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -1,4 +1,6 @@ -% unless ( $opt{'js_only'} ) { +% if ( $opt{'js_only'} ) { +<% $js %> +% } else { @@ -75,23 +77,8 @@ VALUE = "" placeholder = "<% $value |h %>" > -% my $contactnum = $curr_value ? $curr_value : '0'; - - - % } elsif ( $field eq 'invoice_dest' || $field eq 'message_dest' ) { % my $curr_value = $cgi->param($name . '_' . $field); @@ -136,6 +123,7 @@ my $name = $opt{'element_name'} || $opt{'field'} || 'contactnum'; my $id = $opt{'id'} || 'contactnum'; my $curr_value = $opt{'curr_value'} || $opt{'value'}; +my $contactnum = $curr_value ? $curr_value : '0'; my $onchange = ''; if ( $opt{'onchange'} ) { @@ -203,4 +191,19 @@ $label{'comment'} = 'Comment'; my @fields = $opt{'name_only'} ? qw( first last ) : keys %label; +my $js = qq( + add_password_validation('changepw$id\_password', 'submit', '', '$contactnum'); + + var selfService = document.getElementById("$id\_selfservice_access").value; + + if (selfService !== "Y") { document.getElementById("changepw$id\_password").disabled = 'true'; } + document.getElementById("$id\_selfservice_access").onchange = function() { + if (this.value == "P" || this.value == "E" || this.value =="Y") { + document.getElementById("changepw$id\_password").disabled = ''; + } + else { document.getElementById("changepw$id\_password").disabled = 'true'; } + return false; + } +); + -- cgit v1.2.1 From 40062272379e4c32add419f839da60742719da2d Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Sun, 9 Sep 2018 16:12:23 -0400 Subject: RT# 75817 - cleaned up password validation error message --- httemplate/elements/contact.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/elements/contact.html b/httemplate/elements/contact.html index 5fa8ae485..909ff7893 100644 --- a/httemplate/elements/contact.html +++ b/httemplate/elements/contact.html @@ -103,7 +103,7 @@
<% $label{$field} %> % if ( $field eq 'password' ) { -
+
% } % } -- cgit v1.2.1 From 6edc36f4ffe2d2a53d4c8cea4318f3a95eda54b4 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Sun, 9 Sep 2018 17:34:35 -0400 Subject: RT# 75817 - fixed redirect error --- httemplate/edit/process/cust_main-contacts.html | 2 +- httemplate/edit/process/elements/process.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate') diff --git a/httemplate/edit/process/cust_main-contacts.html b/httemplate/edit/process/cust_main-contacts.html index 5b8319f5a..6b7f1c2db 100644 --- a/httemplate/edit/process/cust_main-contacts.html +++ b/httemplate/edit/process/cust_main-contacts.html @@ -8,7 +8,7 @@ <% include('elements/process.html', 'table' => 'cust_main', - 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html?', + 'error_redirect' => popurl(3). 'edit/cust_main-contacts.html', 'agent_virt' => 1, 'skip_process' => 1, #we don't want to make any changes to cust_main 'precheck_callback' => $precheck_callback, diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index a3ea7ee59..d2b037053 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -127,7 +127,7 @@ Example: % " attempting to set redirect$session to ". $cgi->query_string."\n"; % } % -<% $cgi->redirect("$error_redirect"."redirect=$session") %> +<% $cgi->redirect("$error_redirect?redirect=$session") %> % % } else { % -- cgit v1.2.1 From 3c1586b6d7ae963d7ead013ac84ad5d063741eed Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Sun, 9 Sep 2018 20:03:06 -0400 Subject: RT# 80624 Edge browser bug warning at login --- httemplate/loginout/login.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'httemplate') diff --git a/httemplate/loginout/login.html b/httemplate/loginout/login.html index b787a3eea..138c6adc1 100644 --- a/httemplate/loginout/login.html +++ b/httemplate/loginout/login.html @@ -34,8 +34,38 @@ + + + + <%init> -- cgit v1.2.1 From b89e874e8258288d15c98ed3799a9fede6515fd5 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Tue, 11 Sep 2018 03:33:33 -0400 Subject: RT# 78547 Upcoming Auto-Bill Transaction Report --- httemplate/search/future_autobill.html | 213 ++++++++++++++++---------- httemplate/search/report_future_autobill.html | 66 +++++--- 2 files changed, 180 insertions(+), 99 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/future_autobill.html b/httemplate/search/future_autobill.html index 711a25f82..d6438d9dc 100644 --- a/httemplate/search/future_autobill.html +++ b/httemplate/search/future_autobill.html @@ -2,20 +2,18 @@ Report listing upcoming auto-bill transactions -Spec requested the ability to run this report with a longer date range, -and see which charges will process on which day. Checkbox multiple_billing_dates -enables this functionality. +For every customer with a valid auto-bill payment method, +report runs bill_and_collect() for each customer, for each +day, from today through the report target date. After +recording the results, all operations are rolled back. -Performance: -This is a dynamically generated report. The time this report takes to run -will depends on the number of customers. Installations with a high number -of auto-bill customers may find themselves unable to run this report -because of browser timeout. Report could be implemented as a queued job if -necessary, to solve the performance problem. +This report relies on the ability to safely run bill_and_collect(), +with all exports and messaging disabled, and then to roll back the +results. <& elements/grid-report.html, - title => 'Upcoming auto-bill transactions', + title => $report_title, rows => \@rows, cells => \@cells, table_width => "", @@ -32,11 +30,12 @@ necessary, to solve the performance problem. &> <%init> + use FS::UID qw( dbh myconnect ); -use FS::UID qw( dbh myconnect ); + die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); + my $DEBUG = $cgi->param('DEBUG') || 0; my $target_dt; my @target_dates; @@ -45,14 +44,13 @@ die "access denied" my %noon = ( hour => 12, minute => 0, - second => 0 + second => 0, ); - my $now_dt = DateTime->now; $now_dt = DateTime->new( - month => $now_dt->month, - day => $now_dt->day, - year => $now_dt->year, + month => $now_dt->month, + day => $now_dt->day, + year => $now_dt->year, %noon, ); @@ -60,9 +58,9 @@ die "access denied" if ($cgi->param('target_date')) { my ($mm, $dd, $yy) = split /[\-\/]/,$cgi->param('target_date'); $target_dt = DateTime->new( - month => $mm, - day => $dd, - year => $yy, + month => $mm, + day => $dd, + year => $yy, %noon, ) if $mm && $dd & $yy; @@ -72,18 +70,12 @@ die "access denied" # without a target date, default to tomorrow unless ($target_dt) { - $target_dt = DateTime->from_epoch( epoch => time() + 86400) ; - $target_dt = DateTime->new( - month => $target_dt->month, - day => $target_dt->day, - year => $target_dt->year, - %noon - ); + $target_dt = $now_dt->clone->add( days => 1 ); } - # If multiple_billing_dates checkbox selected, create a range of dates - # from today until the given report date. Otherwise, use target date only. - if ($cgi->param('multiple_billing_dates')) { + # Create a range of dates from today until the given report date + # (leaving the probably useless 'quick-report' mode, but disabled) + if ( 1 || $cgi->param('multiple_billing_dates')) { my $walking_dt = DateTime->from_epoch(epoch => $now_dt->epoch); until ($walking_dt->epoch > $target_dt->epoch) { push @target_dates, $walking_dt->epoch; @@ -93,17 +85,6 @@ die "access denied" push @target_dates, $target_dt->epoch; } - # List all customers with an auto-bill method - # - # my %cust_payby = map {$_->custnum => $_} qsearch({ - # table => 'cust_payby', - # hashref => { - # weight => { op => '>', value => '0' }, - # paydate => { op => '>', value => $target_dt->ymd }, - # }, - # order_by => " ORDER BY weight DESC ", - # }); - # List all customers with an auto-bill method that's not expired my %cust_payby = map {$_->custnum => $_} qsearch({ table => 'cust_payby', @@ -111,62 +92,121 @@ die "access denied" weight => { op => '>', value => '0' }, }, order_by => " ORDER BY weight DESC ", - extra_sql => " AND ( payby = 'CHEK' OR ( paydate > '".$target_dt->ymd."')) ", + extra_sql => " + AND ( + payby IN ('CHEK','DCHK') + OR ( paydate > '".$target_dt->ymd."') + ) + ", }); + my $fakebill_time = time(); my %abreport; my @rows; local $@; local $SIG{__DIE__}; - my $temp_dbh = myconnect(); - eval { # Creating sandbox dbh where all connections are to be rolled back - local $FS::UID::dbh = $temp_dbh; + + eval { # Sandbox + + # Create new database handle and supress all COMMIT statements + my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; + local $FS::UID::ForceObeyAutoCommit = 1; + + # Suppress notices generated by billing events + local $FS::Misc::DISABLE_ALL_NOTICES = 1; - # Generate report data into @rows + # Bypass payment processing, recording a fake payment + local $FS::cust_main::Billing_Realtime::BOP_TESTING = 1; + local $FS::cust_main::Billing_Realtime::BOP_TESTING_SUCCESS = 1; + + warn sprintf "Report involves %s customers", scalar keys %cust_payby + if $DEBUG; + + # Run bill_and_collect(), for each customer with an autobill payment method, + # for each day represented in the report for my $custnum (keys %cust_payby) { my $cust_main = qsearchs('cust_main', {custnum => $custnum}); + warn "-- Processing custnum $custnum\n" + if $DEBUG; + # walk forward through billing dates for my $query_epoch (@target_dates) { + $FS::cust_main::Billing_Realtime::BOP_TESTING_TIMESTAMP = $query_epoch; my $return_bill = []; - eval { # Don't let an error on one customer crash the report - my $error = $cust_main->bill( - time => $query_epoch, - return_bill => $return_bill, - no_usage_reset => 1, - ); - die "$error (simulating future billing)" if $error; - }; - warn ("$@: (future_autobill custnum:$custnum)"); - - if (@{$return_bill}) { - my $inv = $return_bill->[0]; - push @rows,{ - name => $cust_main->name, - _date => $inv->_date, - cells => [ - { class => 'gridreport', value => $custnum }, - { class => 'gridreport', - value => ''.$cust_main->name.'', - bypass_filter => 1, - }, - { class => 'gridreport', value => $inv->charged, format => 'money' }, - { class => 'gridreport', value => DateTime->from_epoch(epoch=>$inv->_date)->ymd }, - { class => 'gridreport', value => ($cust_payby{$custnum}->payby || $cust_payby{$custnum}->paytype) }, - { class => 'gridreport', value => $cust_payby{$custnum}->paymask }, - ] - }; - } + warn "---- Set billtime to ". + DateTime->from_epoch( epoch => $query_epoch )."\n" + if $DEBUG; + + my $error = $cust_main->bill_and_collect( + time => $query_epoch, + return_bill => $return_bill, + no_usage_reset => 1, + fake => 1, + ); + warn "!!! $error (simulating future billing)\n" if $error; } - $temp_dbh->rollback; - } # /foreach $custnum + # Generate report rows from recorded payments in cust_pay + for my $cust_pay ( + qsearch( cust_pay => { + custnum => $custnum, + _date => { op => '>=', value => $fakebill_time }, + }) + ) { + push @rows,{ + name => $cust_main->name, + _date => $cust_pay->_date, + cells => [ + + # Customer number + { class => 'gridreport', value => $custnum }, + + # Customer name / customer link + { class => 'gridreport', + value => qq{} . encode_entities( $cust_main->name ). '', + bypass_filter => 1 + }, + + # Amount + { class => 'gridreport', + value => $cust_pay->paid, + format => 'money' + }, + + # Transaction Date + { class => 'gridreport', + value => DateTime->from_epoch( epoch => $cust_pay->_date )->ymd + }, + + # Payment Method + { class => 'gridreport', + value => encode_entities( $cust_pay->paycardtype || $cust_pay->payby ), + }, + + # Masked Payment Instrument + { class => 'gridreport', + value => encode_entities( $cust_pay->paymask ), + }, + ] + }; + + } # /foreach payment + + # Roll back database at the end of each customer + # Makes the report slighly slower, but ensures only one customer row + # locked at a time + + warn "-- custnum $custnum -- rollback()\n"; + dbh->rollback if $oldAutoCommit; + + } # /foreach $custnum }; # /eval - warn("$@") if $@; + warn("future_autobill.html report generated error $@") if $@; # Sort output by date, and format for output to grid-report.html my @cells = [ @@ -186,4 +226,21 @@ die "access denied" # grid-report.html requires a parallel @rows parameter to accompany @cells @rows = map { {class => 'gridreport'} } 1..scalar(@cells); + # Dynamic report title + my $title_types = ''; + my $card_count = FS::cust_payby->count_autobill_cards; + my $check_count = FS::cust_payby->count_autobill_checks; + if ( $card_count && $check_count ) { + $title_types = 'Card and Check'; + } elsif ( $card_count ) { + $title_types = 'Card'; + } elsif ( $check_count ) { + $title_types = 'Check'; + } + + my $report_title = sprintf( + 'Upcoming Auto Bill %s Transactions', + $title_types, + ); + diff --git a/httemplate/search/report_future_autobill.html b/httemplate/search/report_future_autobill.html index 1a0c9f48a..ff2f85715 100644 --- a/httemplate/search/report_future_autobill.html +++ b/httemplate/search/report_future_autobill.html @@ -3,40 +3,64 @@ Display date selector for the future_autobill.html report -<% include('/elements/header.html', 'Future Auto-Bill Transactions' ) %> +<% include('/elements/header.html', $report_title ) %> -
- -<& /elements/tr-input-date-field.html, - { - name => 'target_date', - value => $target_date, - label => emt('Target billing date').': ', - required => 1 - } -&> +% if ( FS::TaxEngine->new->info->{batch} ) { -<& /elements/tr-checkbox.html, - 'label' => emt('Multiple billing dates (slow)').': ', - 'field' => 'multiple_billing_dates', - 'value' => '1', -&> +
+ NOTE: This report is disabled due to tax engine configuration +
-
+% } else { -
- + + + <& /elements/tr-input-date-field.html, + { + name => 'target_date', + value => $target_date, + label => emt('Target billing date').': ', + required => 1 + } + &> - +
+ +
+ + + + + +% } <% include('/elements/footer.html') %> <%init> +use FS::cust_payby; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); -my $target_date = DateTime->from_epoch(epoch=>(time()+86400))->mdy('/'); +my $target_date = DateTime->now->add(days => 1)->mdy('/'); + +# Dynamic report title +my $title_types = ''; +my $card_count = FS::cust_payby->count_autobill_cards; +my $check_count = FS::cust_payby->count_autobill_checks; +if ( $card_count && $check_count ) { + $title_types = 'Card and Check'; +} elsif ( $card_count ) { + $title_types = 'Card'; +} elsif ( $check_count ) { + $title_types = 'Check'; +} + +my $report_title = sprintf( + 'Upcoming Auto Bill %s Transactions', + $title_types, +); + -- cgit v1.2.1 From 988d4dcd7e27b38f15edf00ae5b9dd75b9bd0c35 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Tue, 11 Sep 2018 05:51:11 -0400 Subject: RT# 78547 Future autobill report - agent virt, dynamic title --- httemplate/search/future_autobill.html | 45 ++++++++++----------------- httemplate/search/report_future_autobill.html | 25 +++++---------- 2 files changed, 24 insertions(+), 46 deletions(-) (limited to 'httemplate') diff --git a/httemplate/search/future_autobill.html b/httemplate/search/future_autobill.html index d6438d9dc..d4ad8e524 100644 --- a/httemplate/search/future_autobill.html +++ b/httemplate/search/future_autobill.html @@ -30,13 +30,17 @@ results. &> <%init> - use FS::UID qw( dbh myconnect ); + use FS::UID qw( dbh ); die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); my $DEBUG = $cgi->param('DEBUG') || 0; + my $report_title = FS::cust_payby->future_autobill_report_title; + my $agentnum = $cgi->param('agentnum') + if $cgi->param('agentnum') =~ /^\d+/; + my $target_dt; my @target_dates; @@ -87,17 +91,17 @@ results. # List all customers with an auto-bill method that's not expired my %cust_payby = map {$_->custnum => $_} qsearch({ - table => 'cust_payby', - hashref => { - weight => { op => '>', value => '0' }, - }, - order_by => " ORDER BY weight DESC ", - extra_sql => " - AND ( - payby IN ('CHEK','DCHK') + table => 'cust_payby', + addl_from => 'JOIN cust_main USING (custnum)', + hashref => { weight => { op => '>', value => '0' }}, + order_by => " ORDER BY weight DESC ", + extra_sql => + "AND ( + payby IN ('CHEK','DCHK','DCHEK') OR ( paydate > '".$target_dt->ymd."') ) - ", + AND " . $FS::CurrentUser::CurrentUser->agentnums_sql + . ($agentnum ? "AND cust_main.agentnum = $agentnum" : ''), }); my $fakebill_time = time(); @@ -109,7 +113,7 @@ results. eval { # Sandbox - # Create new database handle and supress all COMMIT statements + # Supress COMMIT statements my $oldAutoCommit = $FS::UID::AutoCommit; local $FS::UID::AutoCommit = 0; local $FS::UID::ForceObeyAutoCommit = 1; @@ -201,7 +205,7 @@ results. # Makes the report slighly slower, but ensures only one customer row # locked at a time - warn "-- custnum $custnum -- rollback()\n"; + warn "-- custnum $custnum -- rollback()\n" if $DEBUG; dbh->rollback if $oldAutoCommit; } # /foreach $custnum @@ -226,21 +230,4 @@ results. # grid-report.html requires a parallel @rows parameter to accompany @cells @rows = map { {class => 'gridreport'} } 1..scalar(@cells); - # Dynamic report title - my $title_types = ''; - my $card_count = FS::cust_payby->count_autobill_cards; - my $check_count = FS::cust_payby->count_autobill_checks; - if ( $card_count && $check_count ) { - $title_types = 'Card and Check'; - } elsif ( $card_count ) { - $title_types = 'Card'; - } elsif ( $check_count ) { - $title_types = 'Check'; - } - - my $report_title = sprintf( - 'Upcoming Auto Bill %s Transactions', - $title_types, - ); - diff --git a/httemplate/search/report_future_autobill.html b/httemplate/search/report_future_autobill.html index ff2f85715..ccde299e9 100644 --- a/httemplate/search/report_future_autobill.html +++ b/httemplate/search/report_future_autobill.html @@ -25,6 +25,12 @@ Display date selector for the future_autobill.html report } &> + <% include('/elements/tr-select-agent.html', + 'label' => 'For agent: ', + 'disable_empty' => 0, + ) + %> +
@@ -39,28 +45,13 @@ Display date selector for the future_autobill.html report <%init> use FS::cust_payby; +use FS::CurrentUser; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Financial reports'); my $target_date = DateTime->now->add(days => 1)->mdy('/'); - -# Dynamic report title -my $title_types = ''; -my $card_count = FS::cust_payby->count_autobill_cards; -my $check_count = FS::cust_payby->count_autobill_checks; -if ( $card_count && $check_count ) { - $title_types = 'Card and Check'; -} elsif ( $card_count ) { - $title_types = 'Card'; -} elsif ( $check_count ) { - $title_types = 'Check'; -} - -my $report_title = sprintf( - 'Upcoming Auto Bill %s Transactions', - $title_types, -); +my $report_title = FS::cust_payby->future_autobill_report_title; -- cgit v1.2.1 From dc04294e8be2526714fb652fed479d379e444a32 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Tue, 11 Sep 2018 06:06:33 -0400 Subject: RT# 78547 Future autobill report - dynamic navigation --- httemplate/elements/menu.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate') diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index eb065b668..cae0cdbfb 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -418,7 +418,9 @@ if( $curuser->access_right('Financial reports') ) { $report_financial{'Customer Accounting Summary'} = [ $fsurl.'search/report_customer_accounting_summary.html', 'Customer accounting summary report' ]; - $report_financial{'Upcoming Auto-Bill Transactions'} = [ $fsurl.'search/report_future_autobill.html', 'Upcoming auto-bill transactions' ]; + if ( my $report_title = FS::cust_payby->future_autobill_report_title ) { + $report_financial{$report_title} = [ $fsurl.'search/report_future_autobill.html', "$report_title for customers with automatic payment methods (by date)" ]; + } } elsif($curuser->access_right('Receivables report')) { -- cgit v1.2.1 From fe293dc0ca4ea3939de9c2ad28d3aaf7c8980644 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Wed, 12 Sep 2018 23:32:52 -0400 Subject: RT# 80624 Detect and warn for bad MS Edge version --- httemplate/elements/header.html | 1 + .../misc/edge_browser_check-fail_notice.html | 25 ++++++++++++++++ httemplate/misc/edge_browser_check-header.html | 32 ++++++++++++++++++++ httemplate/misc/edge_browser_check-iframe.html | 35 ++++++++++++++++++++++ 4 files changed, 93 insertions(+) create mode 100644 httemplate/misc/edge_browser_check-fail_notice.html create mode 100644 httemplate/misc/edge_browser_check-header.html create mode 100644 httemplate/misc/edge_browser_check-iframe.html (limited to 'httemplate') diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html index c6b10e301..6df45fb07 100644 --- a/httemplate/elements/header.html +++ b/httemplate/elements/header.html @@ -4,3 +4,4 @@ % } else { <& header-full.html, @_ &> % } +<& /misc/edge_browser_check-header.html &> diff --git a/httemplate/misc/edge_browser_check-fail_notice.html b/httemplate/misc/edge_browser_check-fail_notice.html new file mode 100644 index 000000000..fb42ffe8e --- /dev/null +++ b/httemplate/misc/edge_browser_check-fail_notice.html @@ -0,0 +1,25 @@ +<& /elements/header.html, "Edge browser bug" &> + +
+
+ ⚠ +
+

+ Edge Browser Bug +

+

+ Your copy of Microsoft Edge has a data corrupting bug. +

+

+ Microsoft fixed this bug with the July RS4 Windows 10 Update. + Please update your copy of Windows. +

+

+ Alternatively, you may choose to use + Mozilla Firefox + or Google Chrome. They + are not affected by this bug. +

+
+ +<& /elements/footer.html &> \ No newline at end of file diff --git a/httemplate/misc/edge_browser_check-header.html b/httemplate/misc/edge_browser_check-header.html new file mode 100644 index 000000000..e7666aec4 --- /dev/null +++ b/httemplate/misc/edge_browser_check-header.html @@ -0,0 +1,32 @@ +% if ( $force_redirect ) { + +% } elsif ( $do_check ) { + + +% } +<%init> +my $curuser = $FS::CurrentUser::CurrentUser; +my $cgi = FS::UID::cgi(); +my $DEBUG = 0; + +my $do_check = 0; +$do_check = 1 + if $curuser + && !$cgi->param('edge_browser_check') + && $curuser->get_pref('edge_bug_vulnerable') ne 'N'; + +my $force_redirect = $curuser->get_pref('edge_bug_vulnerable') eq 'Y' ? 1 : 0; + \ No newline at end of file diff --git a/httemplate/misc/edge_browser_check-iframe.html b/httemplate/misc/edge_browser_check-iframe.html new file mode 100644 index 000000000..e804fc676 --- /dev/null +++ b/httemplate/misc/edge_browser_check-iframe.html @@ -0,0 +1,35 @@ +
+ + + +
+ + + + +<%init> +my $cgi = FS::UID::cgi(); +my $curuser = $FS::CurrentUser::CurrentUser; + +if ( $curuser ) { + my $canary = $cgi->param('edge_browser_canary'); + $curuser->set_pref( + 'edge_bug_vulnerable', + + $canary eq 'test' ? 'Y' : 'Y', + + # Don't test this user's session for the next 10m + time() + 600, + ); +} + + \ No newline at end of file -- cgit v1.2.1 From 5f3b423601b5ddd7605e1eaf4bd838c0fd6f5fcf Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Wed, 12 Sep 2018 23:48:35 -0400 Subject: RT# 80624 Remove notice from login screen --- httemplate/loginout/login.html | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'httemplate') diff --git a/httemplate/loginout/login.html b/httemplate/loginout/login.html index 138c6adc1..b787a3eea 100644 --- a/httemplate/loginout/login.html +++ b/httemplate/loginout/login.html @@ -34,38 +34,8 @@ - - - - <%init> -- cgit v1.2.1 From 0682747829a56d487155e28675c133cb90f991de Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Thu, 13 Sep 2018 00:44:54 -0400 Subject: RT# 80624 Browser check repeats if session changes --- httemplate/misc/edge_browser_check-header.html | 10 +++++++--- httemplate/misc/edge_browser_check-iframe.html | 7 +++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'httemplate') diff --git a/httemplate/misc/edge_browser_check-header.html b/httemplate/misc/edge_browser_check-header.html index e7666aec4..a88962be9 100644 --- a/httemplate/misc/edge_browser_check-header.html +++ b/httemplate/misc/edge_browser_check-header.html @@ -18,7 +18,10 @@ % } <%init> -my $curuser = $FS::CurrentUser::CurrentUser; +my $curuser = $FS::CurrentUser::CurrentUser; +my $session = $FS::CurrentUser::CurrentSession; +my $sessionkey = $session->sessionkey if $session; + my $cgi = FS::UID::cgi(); my $DEBUG = 0; @@ -26,7 +29,8 @@ my $do_check = 0; $do_check = 1 if $curuser && !$cgi->param('edge_browser_check') - && $curuser->get_pref('edge_bug_vulnerable') ne 'N'; + && $sessionkey + && $curuser->get_pref('edge_bug_vulnerable') ne $sessionkey; my $force_redirect = $curuser->get_pref('edge_bug_vulnerable') eq 'Y' ? 1 : 0; - \ No newline at end of file + diff --git a/httemplate/misc/edge_browser_check-iframe.html b/httemplate/misc/edge_browser_check-iframe.html index e804fc676..61ae9a0bd 100644 --- a/httemplate/misc/edge_browser_check-iframe.html +++ b/httemplate/misc/edge_browser_check-iframe.html @@ -19,16 +19,15 @@ <%init> my $cgi = FS::UID::cgi(); my $curuser = $FS::CurrentUser::CurrentUser; +my $session = $FS::CurrentUser::CurrentSession; +my $sessionkey = $session->sessionkey if $session; if ( $curuser ) { my $canary = $cgi->param('edge_browser_canary'); $curuser->set_pref( 'edge_bug_vulnerable', - $canary eq 'test' ? 'Y' : 'Y', - - # Don't test this user's session for the next 10m - time() + 600, + $canary eq 'test' ? $sessionkey : 'Y', ); } -- cgit v1.2.1