From 0875be8b32456f17b5e472d912ce0e2aae1f9684 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Fri, 7 Feb 2014 11:02:53 -0600 Subject: [PATCH] Allow searching for *any* priority --- include/class.dynamic_forms.php | 6 +++--- include/class.forms.php | 25 ++++++++++++++++--------- include/staff/tickets.inc.php | 3 ++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php index 9705d54d4..427420a82 100644 --- a/include/class.dynamic_forms.php +++ b/include/class.dynamic_forms.php @@ -941,7 +941,7 @@ class SelectionField extends FormField { } class SelectionWidget extends ChoicesWidget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); $value = false; if ($this->value instanceof DynamicListItem) { @@ -953,9 +953,9 @@ class SelectionWidget extends ChoicesWidget { $value = $this->value; $name = $this->getEnteredValue(); } - if (!$config['typeahead']) { + if (!$config['typeahead'] || $mode=='search') { $this->value = $value; - return parent::render(); + return parent::render($mode); } $source = array(); diff --git a/include/class.forms.php b/include/class.forms.php index 07860b996..58e250d49 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -967,20 +967,27 @@ class PhoneNumberWidget extends Widget { } class ChoicesWidget extends Widget { - function render() { + function render($mode=false) { $config = $this->field->getConfiguration(); // Determine the value for the default (the one listed if nothing is // selected) $choices = $this->field->getChoices(); - $def_key = $this->field->get('default'); - if (!$def_key && $config['default']) - $def_key = $config['default']; - $have_def = isset($choices[$def_key]); - if (!$have_def) + // We don't consider the 'default' when rendering in 'search' mode + $have_def = false; + if ($mode != 'search') { + $def_key = $this->field->get('default'); + if (!$def_key && $config['default']) + $def_key = $config['default']; + $have_def = isset($choices[$def_key]); + if (!$have_def) + $def_val = ($config['prompt']) + ? $config['prompt'] : 'Select'; + else + $def_val = $choices[$def_key]; + } else { $def_val = ($config['prompt']) - ? $config['prompt'] : 'Select'; - else - $def_val = $choices[$def_key]; + ? $config['prompt'] : 'Select'; + } $value = $this->value; if ($value === null && $have_def) $value = $def_key; diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 6435451b9..a48f15256 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -617,7 +617,8 @@ if ($results) { elseif (!$f->hasData()) continue; ?><label><?php echo $f->getLabel(); ?>:</label> - <div style="display:inline-block;width: 12.5em;"><?php $f->render(); ?></div> + <div style="display:inline-block;width: 12.5em;"><?php + $f->render('search'); ?></div> <?php } ?> </fieldset> <p> -- GitLab