Skip to content

Commit

Permalink
Task techjoomla#199 feat: Save process optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush-maherwal committed Oct 4, 2019
1 parent cc624c5 commit 2020a9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 21 deletions.
2 changes: 1 addition & 1 deletion administrator/helpers/tjfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function changeNameIfNotUnique($data_same_name,$id)
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->update('#__tjfields_fields');
$query->set('name="' . $data_same_name . '_' . $id . '"');
$query->set('name="' . $data_same_name . '-' . $id . '"');

$query->where('id=' . $id);
$db->setQuery($query);
Expand Down
18 changes: 1 addition & 17 deletions site/filterFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,24 +421,8 @@ public function getDataExtra($data, $id = null)
*/
public function saveExtraFields($data)
{
if (empty($data['client']))
if (empty($data['client']) || empty($data['content_id']) || empty($data['fieldsvalue']))
{
$this->setError(JText::_('COM_TJFIELDS_FORM_SAVE_FAILED_CLIENT_REQUIRED'));

return false;
}

if (empty($data['content_id']))
{
$this->setError(JText::_('COM_TJFIELDS_FORM_SAVE_FAILED_CLIENT_REQUIRED'));

return false;
}

if (empty($data['fieldsvalue']))
{
$this->setError(JText::_('COM_TJFIELDS_FORM_SAVE_FAILED_CLIENT_REQUIRED'));

return false;
}

Expand Down
5 changes: 5 additions & 0 deletions site/helpers/tjfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,11 @@ private function saveSingleValuedFieldData($fieldValue, $client, $contentId, $fi
return false;
}

if ($fieldValue == '' && empty($fieldStoredValues))
{
return false;
}

JLoader::import('components.com_tjfields.tables.fieldsvalue', JPATH_ADMINISTRATOR);
$fieldsValueTable = JTable::getInstance('FieldsValue', 'TjfieldsTable', array('dbo', JFactory::getDbo()));

Expand Down
6 changes: 3 additions & 3 deletions tjfields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<author>TechJoomla</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>www.techjoomla.com</authorUrl>
<copyright>Copyright(C)2012-13 TechJoomla</copyright>
<copyright>Copyright(C)2012-19 TechJoomla</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<creationDate>5th Nov 2016</creationDate>
<version>1.3</version>
<creationDate>4th Nov 2019</creationDate>
<version>1.4.2</version>
<description>TJFields - Common code for TJ Fields Manager and TJ Geo Manager!</description>
<install>
<sql>
Expand Down

0 comments on commit 2020a9b

Please sign in to comment.