[freeside-commits] branch master updated. 7c2e37568823941b026b990c4db3bccd413d2d6e

Christopher Burger burgerc at freeside.biz
Fri Jan 12 12:36:58 PST 2018


The branch, master has been updated
       via  7c2e37568823941b026b990c4db3bccd413d2d6e (commit)
      from  75b56ebe174c4703270670a33e1b248cf641f92c (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 7c2e37568823941b026b990c4db3bccd413d2d6e
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Fri Jan 12 15:36:13 2018 -0500

    RT# 78617 - fixed preference field customer_view_emails to only except whole numbers, also added redirection back to preference page after edit.

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' } };
+
 <FORM METHOD="POST" NAME="pref_form" ACTION="pref-process.html">
 
 <& /elements/error.html &>
 
+<& /elements/alert.html &>
+
 % if ( FS::Auth->auth_class->can('change_password') ) {
 
     <FONT CLASS="fsinnerbox-title"><% emt('Change password (leave blank for no change)') %></FONT>
@@ -143,10 +147,14 @@
     </TD>
   </TR>
 
+% 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.';
+
   <TR>
     <TH ALIGN="right"><% emt("How many recent outbound emails to show in customer view") %></TH>
     <TD ALIGN="left" COLSPAN=2>
-      <INPUT TYPE="text" NAME="customer_view_emails" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
+      <INPUT TYPE="text" ID="<% $validate_field_cve %>" NAME="<% $validate_field_cve %>" VALUE="<% $curuser->option('customer_view_emails') %>"></TD>
     </TD>
   </TR>
 
@@ -260,7 +268,13 @@
 
 <INPUT TYPE="submit" VALUE="<% emt("Update preferences") %>">
 
-<&/elements/footer.html &>
+% my %footerdata = (
+%   'formvalidation' => $js_form_validate,
+% );
+<% include("/elements/footer.html", %footerdata) %>
+
+%#<&/elements/footer.html &>
+
 <%init>
 
 my $curuser = $FS::CurrentUser::CurrentUser;

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

Summary of changes:
 httemplate/pref/pref-process.html |  1 +
 httemplate/pref/pref.html         | 18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list