Merge branch 'hotfix/7.0.9'

This commit is contained in:
Yuri Kuznetsov
2022-01-05 17:14:33 +02:00
5 changed files with 35 additions and 4 deletions
+3 -1
View File
@@ -52,8 +52,10 @@ class Email extends Record
}
$id = $data->id;
$parentType = $data->parentType ?? null;
$field = $data->field ?? null;
return $this->getEmailService()->getCopiedAttachments($id);
return $this->getEmailService()->getCopiedAttachments($id, $parentType, null, $field);
}
/**
@@ -77,12 +77,18 @@ class SendType extends BaseFunction implements
try {
$this->createSender()->send($sms);
$this->entityManager->saveEntity($sms);
}
catch (Exception $e) {
$message = $e->getMessage();
$this->log("Error while sending SMS. Message: {$message}." , 'error');
$sms->setStatus(Sms::STATUS_FAILED);
$this->entityManager->saveEntity($sms);
return false;
}
+9
View File
@@ -47,6 +47,8 @@ class Sms extends Entity implements SmsInterface
public const STATUS_DRAFT = 'Draft';
public const STATUS_FAILED = 'Failed';
public function getDateSent(): ?DateTime
{
return $this->getValueObject('dateTime');
@@ -135,6 +137,13 @@ class Sms extends Entity implements SmsInterface
return $this;
}
public function setStatus(string $status): self
{
$this->set('status', $status);
return $this;
}
private function getSmsRepository(): SmsRepository
{
/** @var SmsRepository */
+15 -3
View File
@@ -767,8 +767,13 @@ class Email extends Record implements
return $fromAddress;
}
public function getCopiedAttachments(string $id, ?string $parentType = null, ?string $parentId = null): stdClass
{
public function getCopiedAttachments(
string $id,
?string $parentType = null,
?string $parentId = null,
?string $field = null
): stdClass {
$ids = [];
$names = (object) [];
@@ -806,8 +811,15 @@ class Email extends Record implements
$attachment->set('sourceId', $source->getSourceId());
$attachment->set('storage', $source->get('storage'));
if (!empty($parentType) && !empty($parentId)) {
if ($field) {
$attachment->set('field', $field);
}
if ($parentType) {
$attachment->set('parentType', $parentType);
}
if ($parentType && $parentType) {
$attachment->set('parentId', $parentId);
}
+2
View File
@@ -255,6 +255,8 @@ define('views/email/detail', ['views/detail', 'email-helper'], function (Dep, Em
this.ajaxPostRequest('Email/action/getCopiedAttachments', {
id: this.model.id,
parentType: 'Case',
field: 'attachments',
}).then(data => {
attributes.attachmentsIds = data.ids;
attributes.attachmentsNames = data.names;