type fixes

This commit is contained in:
Yuri Kuznetsov
2022-03-21 14:19:04 +02:00
parent f70e1bd38e
commit 5fa73b2581
5 changed files with 23 additions and 29 deletions
@@ -29,23 +29,7 @@
namespace Espo\Entities;
use Espo\Core\Utils\Json;
class LayoutRecord extends \Espo\Core\ORM\Entity
{
public const ENTITY_TYPE = 'LayoutRecord';
/*protected function _getData()
{
$data = $this->getFromContainer('data');
return Json::decode($data);
}
protected function _setData($value)
{
$data = Json::encode($value);
$this->setInContainer('data', $data);
}*/
}
+11 -8
View File
@@ -117,14 +117,17 @@ class Layout
$layout = $this->getRecordFromSet($scope, $name, $setId, true);
if ($layout && $layout->get('data') !== null) {
$result = Json::decode($layout->get('data'));
/** @var string */
$data = $layout->get('data');
$result = Json::decode($data);
}
}
if (!$result) {
$result = Json::decode(
$this->layout->get($scope, $name)
);
$data = $this->layout->get($scope, $name) ?? 'false';
$result = Json::decode($data);
}
if ($result === false) {
@@ -205,12 +208,12 @@ class Layout
}
if (!$data) {
$dataString = $this->layout->get($scope, $name);
$dataString = $this->layout->get($scope, $name) ?? 'null';
$data = json_decode($dataString);
$data = Json::decode($dataString);
}
else {
$dataString = json_encode($data);
$dataString = Json::encode($data);
}
if (is_null($data)) {
@@ -302,7 +305,7 @@ class Layout
$layout = $this->getRecordFromSet($scope, $name, $setId);
if (!$layout) {
$layout = $this->entityManager->getEntity('LayoutRecord');
$layout = $this->entityManager->getNewEntity('LayoutRecord');
$layout->set([
'layoutSetId' => $setId,
+1 -1
View File
@@ -88,7 +88,7 @@ class LeadCapture extends Record
}
}
$seed = $this->getEntityManager()->getEntity('Lead');
$seed = $this->getEntityManager()->getNewEntity('Lead');
foreach ($attributeList as $i => $attribute) {
$value = strtoupper(Util::camelCaseToUnderscore($attribute));
+3
View File
@@ -214,8 +214,11 @@ class Note extends Record
$userTeamIdList = $this->user->getTeamIdList();
/** @var string[] */
$userIdList = $entity->getLinkMultipleIdList('users');
/** @var string[] */
$portalIdList = $entity->getLinkMultipleIdList('portals');
/** @var string[] */
$teamIdList = $entity->getLinkMultipleIdList('teams');
/** @var iterable<UserEntity> $targetUserList */
+8 -4
View File
@@ -156,7 +156,7 @@ class Pdf
$filename = Util::sanitizeFileName($name) . '.pdf';
$attachment = $this->entityManager->getEntity('Attachment');
$attachment = $this->entityManager->getNewEntity('Attachment');
$attachment->set([
'name' => $filename,
@@ -260,7 +260,7 @@ class Pdf
$filename = Util::sanitizeFileName($entityTypeTranslated) . '.pdf';
$attachment = $this->entityManager->getEntity('Attachment');
$attachment = $this->entityManager->getNewEntity('Attachment');
$attachment->set([
'name' => $filename,
@@ -271,7 +271,7 @@ class Pdf
$this->entityManager->saveEntity($attachment);
$job = $this->entityManager->getEntity('Job');
$job = $this->entityManager->getNewEntity('Job');
$job->set([
'serviceName' => 'Pdf',
@@ -316,7 +316,11 @@ class Pdf
$params = Params::create()->withAcl();
}
return $this->buildFromTemplateInternal($entity, $template, false, null, $params, $data);
$result = $this->buildFromTemplateInternal($entity, $template, false, null, $params, $data);
assert($result !== null);
return $result;
}
/**