From e791caf622b26018fadbd05ccbdb6f41b7f5b208 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 21 Sep 2015 21:41:54 +0000 Subject: [PATCH] Fix admin changing their columns set the default for all users --- .../inc/class.etemplate_widget_nextmatch.inc.php | 12 +++++++++++- etemplate/js/et2_extension_nextmatch.js | 12 +++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php index 5f71cafff8..10a955c22c 100644 --- a/etemplate/inc/class.etemplate_widget_nextmatch.inc.php +++ b/etemplate/inc/class.etemplate_widget_nextmatch.inc.php @@ -1043,7 +1043,17 @@ class etemplate_widget_nextmatch extends etemplate_widget { $pref_name = 'nextmatch-' . (isset($content_value['columnselection_pref']) ? $content_value['columnselection_pref'] : $this->attrs['template']); $refresh_pref_name = $pref_name.'-autorefresh'; - $pref_level = $value['nm_col_preference'] == 'force' ? 'forced' : 'default'; + switch($value['nm_col_preference']) { + case 'force': + $pref_level = 'forced'; + break; + case 'reset': + case 'default': + $pref_level = 'default'; + break; + default: + $pref_level = 'user'; + } // Clear forced pref before setting default if($pref_level != 'forced') diff --git a/etemplate/js/et2_extension_nextmatch.js b/etemplate/js/et2_extension_nextmatch.js index 9c37e4762e..a1bb1334d3 100644 --- a/etemplate/js/et2_extension_nextmatch.js +++ b/etemplate/js/et2_extension_nextmatch.js @@ -1421,15 +1421,13 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin // Auto refresh self._set_autorefresh(autoRefresh.get_value()); - // Set default or clear forced? - if(defaultCheck.get_value()) + // Set default or clear forced + if(show_letters) { - if(show_letters) - { - self.activeFilters.selectcols.push('lettersearch'); - } - self.getInstanceManager().submit(); + self.activeFilters.selectcols.push('lettersearch'); } + self.getInstanceManager().submit(); + self.selectPopup = null; };