Skip to content

Commit

Permalink
Исправление ошибок с пустыми значениями
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriitux committed Oct 21, 2018
1 parent f83b8dd commit bfbe866
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions radicalmultifield.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<authorUrl>https://delo-design.ru</authorUrl>
<copyright>Copyright (C) 2018 "Delo Design". All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>1.1</version>
<version>1.2</version>
<description>PLG_RADICAL_MULTI_FIELD_XML_DESCRIPTION</description>

<scriptfile>script.php</scriptfile>
Expand All @@ -31,7 +31,6 @@
<filename>LICENSE.txt</filename>
<folder>elements</folder>
<folder>fields</folder>
<folder>language</folder>
<folder>libs</folder>
<folder>params</folder>
<folder>tmpl</folder>
Expand Down
7 changes: 7 additions & 0 deletions radicalmultifieldhelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ private static function getFieldAndValue($field_id, $item_id)
$db->setQuery($query);
$fieldAndValue->value = $db->loadObject();

if(empty($fieldAndValue->value) || is_null($fieldAndValue->value))
{
$fieldAndValue->value = new stdClass();
$fieldAndValue->value->value = '';
}

return $fieldAndValue;
}

Expand Down Expand Up @@ -251,6 +257,7 @@ public static function delete($field_id, $item_id, $data = [])
public static function check($field_id, $item_id, $data = [], $column_find_all = true)
{
$fieldAndValue = self::getFieldAndValue($field_id, $item_id);

$value = json_decode($fieldAndValue->value->value, JSON_OBJECT_AS_ARRAY);
$find = false;
$countFind = 0;
Expand Down

0 comments on commit bfbe866

Please sign in to comment.