From 7c2e37568823941b026b990c4db3bccd413d2d6e Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 12 Jan 2018 15:36:13 -0500 Subject: RT# 78617 - fixed preference field customer_view_emails to only except whole numbers, also added redirection back to preference page after edit. --- httemplate/pref/pref-process.html | 1 + httemplate/pref/pref.html | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'httemplate/pref') diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 75e57958f..96d301815 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -4,6 +4,7 @@ % } else { <% include('/elements/header.html', mt('Preferences updated')) %> <% include('/elements/footer.html') %> +<% $cgi->redirect(popurl(1). "pref.html?alert=Preferences updated" ) %> % } <%init> diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index abd1ea57f..c50f5ca3c 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -1,9 +1,13 @@ <& /elements/header.html, mt('Preferences for [_1]', $FS::CurrentUser::CurrentUser->username) &> +% my $js_form_validate = { 'pref_form' => { 'name' => 'pref_form' } }; +
<& /elements/error.html &> +<& /elements/alert.html &> + % if ( FS::Auth->auth_class->can('change_password') ) { <% emt('Change password (leave blank for no change)') %> @@ -143,10 +147,14 @@ +% my $validate_field_cve = 'customer_view_emails'; +% $js_form_validate->{pref_form}->{validate_fields}{$validate_field_cve} = 'digits: true'; +% $js_form_validate->{pref_form}->{error_message}{$validate_field_cve} = 'Please only enter numbers here.'; + <% emt("How many recent outbound emails to show in customer view") %> - + @@ -260,7 +268,13 @@ "> -<&/elements/footer.html &> +% my %footerdata = ( +% 'formvalidation' => $js_form_validate, +% ); +<% include("/elements/footer.html", %footerdata) %> + +%#<&/elements/footer.html &> + <%init> my $curuser = $FS::CurrentUser::CurrentUser; -- cgit v1.2.1 From 354d94625f6bd4a484c52c89774ad53b3b1c50ea Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 12 Jan 2018 16:20:20 -0500 Subject: RT# 78617 - removed some test code --- httemplate/pref/pref.html | 2 -- 1 file changed, 2 deletions(-) (limited to 'httemplate/pref') diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index c50f5ca3c..ceafa9850 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -273,8 +273,6 @@ % ); <% include("/elements/footer.html", %footerdata) %> -%#<&/elements/footer.html &> - <%init> my $curuser = $FS::CurrentUser::CurrentUser; -- cgit v1.2.1 From 234cbf5b650cfd5616a81b55d86b8bbd0b23c558 Mon Sep 17 00:00:00 2001 From: Christopher Burger Date: Fri, 12 Jan 2018 16:52:28 -0500 Subject: RT# 78617 - updated redirect to freeside_status to show update message --- httemplate/pref/pref-process.html | 13 +++++++++---- httemplate/pref/pref.html | 2 -- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'httemplate/pref') diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html index 96d301815..1b18d2ec8 100644 --- a/httemplate/pref/pref-process.html +++ b/httemplate/pref/pref-process.html @@ -1,10 +1,15 @@ % if ( $error ) { % $cgi->param('error', $error); -<% $cgi->redirect(popurl(1). "pref.html?". $cgi->query_string ) %> + <% $cgi->redirect(popurl(1). "pref.html?". $cgi->query_string ) %> % } else { -<% include('/elements/header.html', mt('Preferences updated')) %> -<% include('/elements/footer.html') %> -<% $cgi->redirect(popurl(1). "pref.html?alert=Preferences updated" ) %> + <% $cgi->redirect( -uri => popurl(1). "pref.html", + -cookie => CGI::Cookie->new( + -name => 'freeside_status', + -value => mt('Preferences updated'), + -expires => '+5m', + ), + ) + %> % } <%init> diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html index ceafa9850..56fde6d44 100644 --- a/httemplate/pref/pref.html +++ b/httemplate/pref/pref.html @@ -6,8 +6,6 @@ <& /elements/error.html &> -<& /elements/alert.html &> - % if ( FS::Auth->auth_class->can('change_password') ) { <% emt('Change password (leave blank for no change)') %> -- cgit v1.2.1