Skip to content

Commit

Permalink
Fix array generation for select
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Aug 26, 2016
1 parent 537ad28 commit 4dff58e
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions app/Models/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,32 @@ public function setFormatAttribute($value)
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;
}




}

0 comments on commit 4dff58e

Please sign in to comment.