Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Enable overwriting of the body text for certain queue entries #199

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Classes/Domain/Model/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Queue extends AbstractEntity

protected ?DateTime $datetime = null;
protected ?Newsletter $newsletter = null;
protected string $bodytext = '';
protected ?User $user = null;

public function getEmail(): string
Expand All @@ -42,6 +43,17 @@ public function setNewsletter(Newsletter $newsletter): self
return $this;
}

public function getBodytext(): string
{
return $this->bodytext;
}

public function setBodytext(string $bodytext): self
{
$this->bodytext = $bodytext;
return $this;
}

public function getUser(): ?User
{
return $this->user;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Mail/ProgressQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ protected function getSubject(Queue $queue): string
protected function getBodyText(Queue $queue): string
{
$bodytext = $this->parseService->parseBodytext(
$queue->getNewsletter()->getBodytext(),
$queue->getBodytext() !== '' ? $queue->getBodytext() : $queue->getNewsletter()->getBodytext(),
[
'user' => $queue->getUser(),
'newsletter' => $queue->getNewsletter(),
Expand Down
14 changes: 13 additions & 1 deletion Configuration/TCA/tx_luxletter_domain_model_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
'hideTable' => 1,
],
'types' => [
'1' => ['showitem' => 'email,newsletter,user,datetime,sent,failures'],
'1' => ['showitem' => 'email,newsletter,bodytext,user,datetime,sent,failures'],
],
'columns' => [
'email' => [
Expand All @@ -52,6 +52,18 @@
'readOnly' => true,
],
],
'bodytext' => [
'exclude' => true,
'label' => 'LLL:EXT:luxletter/Resources/Private/Language/locallang_db.xlf:'
. Newsletter::TABLE_NAME . '.bodytext',
'config' => [
'type' => 'text',
'cols' => 800,
'rows' => 3,
'readOnly' => true,
'default' => '',
],
],
'user' => [
'exclude' => true,
'label' => 'LLL:EXT:luxletter/Resources/Private/Language/locallang_db.xlf:'
Expand Down
4 changes: 4 additions & 0 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@
<source>Failures</source>
<target state="translated">Fehlschläge</target>
</trans-unit>
<trans-unit id="tx_luxletter_domain_model_queue.bodytext">
<source>Bodytext</source>
<target state="translated">E-Mail Inhalt</target>
</trans-unit>

<trans-unit id="tx_luxletter_domain_model_log">
<source>Log</source>
Expand Down
3 changes: 3 additions & 0 deletions Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
<trans-unit id="tx_luxletter_domain_model_queue.failures">
<source>Failures</source>
</trans-unit>
<trans-unit id="tx_luxletter_domain_model_queue.bodytext">
<source>Bodytext</source>
</trans-unit>

<trans-unit id="tx_luxletter_domain_model_log">
<source>Log</source>
Expand Down
1 change: 1 addition & 0 deletions ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ CREATE TABLE tx_luxletter_domain_model_queue (

email varchar(255) DEFAULT '' NOT NULL,
newsletter int(11) DEFAULT '0' NOT NULL,
bodytext mediumtext,
user int(11) DEFAULT '0' NOT NULL,
datetime int(11) DEFAULT '0' NOT NULL,
sent tinyint(4) unsigned DEFAULT '0' NOT NULL,
Expand Down
Loading