This commit is contained in:
Yuri Kuznetsov
2021-11-05 11:31:49 +02:00
parent 7081440121
commit b466f91f8a
6 changed files with 27 additions and 28 deletions
@@ -820,7 +820,7 @@ class Activities implements
$unionBuilder->query($subQuery);
}
if ($order && count($order)) {
if ($order !== null && count($order)) {
$unionBuilder->order(
$order[0]->getExpression()->getValue(),
$order[0]->getDirection()
@@ -1712,11 +1712,9 @@ class Activities implements
continue;
}
$subItem = $this->getCalendarQuery($scope, $userId, $from, $to, $skipAcl);
if (!is_array($subItem)) {
$subItem = [$subItem];
}
$subItem = [
$this->getCalendarQuery($scope, $userId, $from, $to, $skipAcl)
];
$queryList = array_merge($queryList, $subItem);
}
@@ -77,7 +77,7 @@ class Campaign extends \Espo\Services\Record implements
string $campaignId,
?string $queueItemId,
Entity $target,
Entity $emailOrEmailTemplate,
?Entity $emailOrEmailTemplate,
$emailAddress,
$actionDate = null,
$isTest = false
@@ -87,6 +87,7 @@ class Campaign extends \Espo\Services\Record implements
}
$logRecord = $this->getEntityManager()->getEntity('CampaignLogRecord');
$logRecord->set([
'campaignId' => $campaignId,
'actionDate' => $actionDate,
@@ -104,6 +105,7 @@ class Campaign extends \Espo\Services\Record implements
'objectType' => $emailOrEmailTemplate->getEntityType()
]);
}
$this->getEntityManager()->saveEntity($logRecord);
}
@@ -75,7 +75,7 @@ class KnowledgeBaseArticle extends \Espo\Services\Record implements
throw new BadRequest();
}
/** @var KnowledgeBaseArticleEntity $entity */
/** @var KnowledgeBaseArticleEntity|null $entity */
$entity = $this->getEntityManager()->getEntity('KnowledgeBaseArticle', $id);
if (!$entity) {
@@ -91,7 +91,7 @@ class KnowledgeBaseArticle extends \Espo\Services\Record implements
$attachmentsIds = $entity->get('attachmentsIds');
foreach ($attachmentsIds as $attachmentId) {
/** @var Attachment $source */
/** @var Attachment|null $source */
$source = $this->getEntityManager()->getEntity('Attachment', $attachmentId);
if ($source) {
+10 -9
View File
@@ -46,6 +46,8 @@ use Espo\Modules\Crm\Entities\Contact;
use Espo\Core\Di;
use stdClass;
class Lead extends Record implements
Di\FieldUtilAware
@@ -150,10 +152,8 @@ class Lead extends Record implements
$idAttribute = $field . 'Id';
$nameAttribute = $field . 'Name';
if ($attachment) {
$attributes[$idAttribute] = $attachment->getId();
$attributes[$nameAttribute] = $attachment->get('name');
}
$attributes[$idAttribute] = $attachment->getId();
$attributes[$nameAttribute] = $attachment->get('name');
}
continue;
@@ -169,12 +169,10 @@ class Lead extends Record implements
foreach ($attachmentList as $attachment) {
$attachment = $this->getAttachmentRepository()->getCopiedAttachment($attachment);
if ($attachment) {
$idList[] = $attachment->getId();
$idList[] = $attachment->getId();
$nameHash->{$attachment->getId()} = $attachment->get('name');
$typeHash->{$attachment->getId()} = $attachment->get('type');
}
$nameHash->{$attachment->getId()} = $attachment->get('name');
$typeHash->{$attachment->getId()} = $attachment->get('type');
}
$attributes[$field . 'Ids'] = $idList;
@@ -221,6 +219,9 @@ class Lead extends Record implements
return $data;
}
/**
* @param stdClass|null $additionalData
*/
public function convert(string $id, object $recordsData, ?object $additionalData = null): LeadEntity
{
/** @var LeadEntity */
@@ -371,18 +371,16 @@ class Opportunity extends Record
$dtTo->setDate($dtTo->format('Y'), $dtTo->format('m'), 1);
}
if ($dt && $dtTo) {
$interval = new DateInterval('P1M');
$interval = new DateInterval('P1M');
while ($dt->getTimestamp() < $dtTo->getTimestamp()) {
$month = $dt->format('Y-m');
while ($dt->getTimestamp() < $dtTo->getTimestamp()) {
$month = $dt->format('Y-m');
if (!array_key_exists($month, $result)) {
$result[$month] = 0;
}
$dt->add($interval);
if (!array_key_exists($month, $result)) {
$result[$month] = 0;
}
$dt->add($interval);
}
$keyList = array_keys($result);
@@ -185,7 +185,7 @@ class TargetList extends \Espo\Services\Record implements
public function unlinkAll(string $id, string $link)
{
/** @var TargetListEntity $entity */
/** @var TargetListEntity|null $entity */
$entity = $this->getRepository()->get($id);
if (!$entity) {