From 1f84c0de49f43967d666a1d3eab3f85c20e3c792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cankush=5Fm=E2=80=9D?= Date: Fri, 18 Oct 2019 15:42:18 +0530 Subject: [PATCH] Bug #205 fix: For list type of field, value is shown on list and details view instead of label --- admin_language/en-GB/en-GB.com_tjfields.ini | 2 +- administrator/models/fields.php | 2 +- .../models/forms/types/forms/text.xml | 2 +- site/layouts/fields/sql.php | 8 +++- site/layouts/fields/subform.php | 43 ++++++++++--------- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/admin_language/en-GB/en-GB.com_tjfields.ini b/admin_language/en-GB/en-GB.com_tjfields.ini index e5c071ce..8820d0e6 100755 --- a/admin_language/en-GB/en-GB.com_tjfields.ini +++ b/admin_language/en-GB/en-GB.com_tjfields.ini @@ -135,7 +135,7 @@ COM_TJFIELDS_FORM_DESC_EDITOR_WIDTH="Set width" COM_TJFIELDS_FORM_LBL_EDITOR_HEIGHT="Height" COM_TJFIELDS_FORM_DESC_EDITOR_HEIGHT="Set height" COM_TJFIELDS_FORM_LBL_FIELD_SIZE="Size" -COM_TJFIELDS_FORM_DESC_FIELD_SIZE="Set maximum allowed file size (In MB) e.g 10, 20" +COM_TJFIELDS_FORM_DESC_FIELD_SIZE="Set size" COM_TJFIELDS_FORM_LBL_FIELD_MAXLENGTH="Max Length" COM_TJFIELDS_FORM_LBL_FIELD_MIN="Min Value" COM_TJFIELDS_FORM_DESC_FIELD_MIN="Min Value" diff --git a/administrator/models/fields.php b/administrator/models/fields.php index f257a822..519d9007 100755 --- a/administrator/models/fields.php +++ b/administrator/models/fields.php @@ -184,7 +184,7 @@ protected function getListQuery() else { $search = $db->Quote('%' . $db->escape($search, true) . '%'); - $query->where('( a.type LIKE ' . $search . ' )'); + $query->where('( a.label LIKE ' . $search . ' )'); } } diff --git a/administrator/models/forms/types/forms/text.xml b/administrator/models/forms/types/forms/text.xml index c799805e..bc29b504 100755 --- a/administrator/models/forms/types/forms/text.xml +++ b/administrator/models/forms/types/forms/text.xml @@ -4,7 +4,7 @@
- +
diff --git a/site/layouts/fields/sql.php b/site/layouts/fields/sql.php index e967fcac..3a5075a3 100644 --- a/site/layouts/fields/sql.php +++ b/site/layouts/fields/sql.php @@ -24,6 +24,12 @@ } $options = $field->getOptions(); + +if (empty($options)) +{ + return; +} + $fieldOptions = array(); foreach ($options as $option) @@ -51,4 +57,4 @@ echo "
"; } } -} \ No newline at end of file +} diff --git a/site/layouts/fields/subform.php b/site/layouts/fields/subform.php index a8d57a03..4e4e435d 100644 --- a/site/layouts/fields/subform.php +++ b/site/layouts/fields/subform.php @@ -44,33 +44,36 @@
type == 'List' || $field->type == 'Radio') + if (isset($subformData[$field->getAttribute('name')])) { - $fieldXml = $form->getFieldXml($field->getAttribute('name')); - $field->value = $subformData[$field->getAttribute('name')]; + if ($field->type == 'List' || $field->type == 'Radio') + { + $fieldXml = $form->getFieldXml($field->getAttribute('name')); + $field->value = $subformData[$field->getAttribute('name')]; - $layout = new JLayoutFile('list', JPATH_ROOT . '/components/com_tjfields/layouts/fields'); - echo $layout->render(array('fieldXml' => $fieldXml, 'field' => $field)); - } - elseif ($field->type == 'Checkbox') - { - if ($subformData[$field->getAttribute('name')]) + $layout = new JLayoutFile('list', JPATH_ROOT . '/components/com_tjfields/layouts/fields'); + echo $layout->render(array('fieldXml' => $fieldXml, 'field' => $field)); + } + elseif ($field->type == 'Checkbox') { - ?> - - getAttribute('name')]) + { + ?> + + + + - - getAttribute('name')]; } } - else - { - echo $subformData[$field->getAttribute('name')]; - } ?>