From 4dff58ec26ddaa22a75d30b98e18d629abec693e Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 25 Aug 2016 21:04:10 -0700 Subject: [PATCH] Fix array generation for select --- app/Models/CustomField.php | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php index fdf3f2671..1037760ea 100644 --- a/app/Models/CustomField.php +++ b/app/Models/CustomField.php @@ -120,16 +120,32 @@ class CustomField extends Model public function formatFieldValuesAsArray() { $arr = preg_split("/\\r\\n|\\r|\\n/", $this->field_values); + $result[''] = 'Select '.strtolower($this->format); + for ($x = 0; $x < count($arr); $x++) { $arr_parts = explode('|', $arr[$x]); - - if (key_exists('1',$arr_parts)) { - $result[$arr_parts[0]] = $arr_parts[1]; - } else { - $result[$arr_parts[0]] = $arr_parts[0]; + if ($arr_parts[0]!='') { + if (key_exists('1',$arr_parts)) { + $result[$arr_parts[0]] = $arr_parts[1]; + } else { + $result[$arr_parts[0]] = $arr_parts[0]; + } } + } + return $result; } + + public function isFieldDecryptable($string) { + if (($this->field_encrypted=='1') && ($string!='')) { + return true; + } + return false; + } + + + + }