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

[SFT-1706]: Builder and Notifications giving error: Setting read-only property: Solspace\Freeform\Records\NotificationTemplateRecord::pdfTemplateIds #1712

Merged
merged 2 commits into from
Jan 15, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static function fromRecord(NotificationTemplateRecord $record): self

$template->id = $record->id ?? $record->filepath;
$template->uid = $record->uid ?? $record->filepath;
$template->pdfTemplateIds = $record->getPdfTemplateIds();
$template->pdfTemplateIds = $record->getPdfTemplateIdList();
$template->handle = $record->handle;
$template->name = $record->name;
$template->description = $record->description;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/Records/NotificationTemplateRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function getPresetAssets(): null|array|string
return null;
}

public function getPdfTemplateIds(): array
public function getPdfTemplateIdList(): array
{
if (\is_array($this->pdfTemplateIds)) {
return $this->pdfTemplateIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ public function save(NotificationTemplateRecord $record): bool
$presetAssets = '';
}

$pdfTemplateIds = $record->getPdfTemplateIds();
if (\is_array($pdfTemplateIds)) {
$pdfTemplateIds = implode(',', $pdfTemplateIds);
} else {
$pdfTemplateIds = '';
}
$pdfTemplateIds = $record->getPdfTemplateIdList();
$pdfTemplateIds = implode(',', $pdfTemplateIds);

$output = "{# subject: {$record->getSubject()} #}".\PHP_EOL;
$output .= "{# fromEmail: {$record->getFromEmail()} #}".\PHP_EOL;
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin/src/templates/notifications/edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
label: "PDF Templates"|t('freeform'),
instructions: "Select any PDF Templates you wish to generate and include as attachments on all email notifications using this template."|t('freeform'),
options: pdfTemplateOptions,
values: notification.getPdfTemplateIds(),
values: notification.getPdfTemplateIdList(),
}) }}

{% endif %}
Expand Down
Loading