Fix issue: custom fields not getting saved in mysql v5.7

This commit is contained in:
gamonoid
2017-11-26 20:47:39 +01:00
parent 6e74832798
commit 1ddf6ffbb6
2 changed files with 10 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
namespace Classes; namespace Classes;
use Metadata\Common\Model\CustomFieldValue; use Metadata\Common\Model\CustomFieldValue;
use Utils\LogManager;
class CustomFieldManager class CustomFieldManager
{ {
@@ -28,12 +29,17 @@ class CustomFieldManager
$customFieldValue->name = $name; $customFieldValue->name = $name;
$customFieldValue->object_id = $id; $customFieldValue->object_id = $id;
$customFieldValue->type = $type; $customFieldValue->type = $type;
$customFieldValue->created = date("Y-md-d H:i:s"); $customFieldValue->created = date("Y-m-d H:i:s");
} }
$customFieldValue->value = $value; $customFieldValue->value = $value;
$customFieldValue->updated = date("Y-md-d H:i:s"); $customFieldValue->updated = date("Y-m-d H:i:s");
$customFieldValue->Save(); $ok = $customFieldValue->Save();
if (!$ok) {
LogManager::getInstance()->error("Error saving custom field: " . $customFieldValue->ErrorMsg());
return false;
}
return true;
} }
public function getCustomFields($type, $id) public function getCustomFields($type, $id)

View File

@@ -154,7 +154,7 @@ class BaseModel extends \ADOdb_Active_Record
continue; continue;
} }
$keys[$k] = $k; $keys[$k] = $v;
} }
return $keys; return $keys;