diff --git a/CHANGELOG.md b/CHANGELOG.md index de4d1180..9cce8c1f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Improved the status colours of element types. - Improved the French translation ([#484](https://github.com/putyourlightson/craft-campaign/issues/484)). - Improved the German translation. +- Renamed the “draft” sendout status to “unsent”. ### Fixed diff --git a/composer.json b/composer.json index 7282972d..cd4cc095 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "putyourlightson/craft-campaign", "description": "Send and manage email campaigns, contacts and mailing lists.", - "version": "3.4.4", + "version": "3.5.0", "type": "craft-plugin", "homepage": "https://putyourlightson.com/plugins/campaign", "license": "proprietary", diff --git a/src/Campaign.php b/src/Campaign.php index cefbe090..cead1539 100644 --- a/src/Campaign.php +++ b/src/Campaign.php @@ -184,7 +184,7 @@ public static function editions(): array /** * @inheritdoc */ - public string $schemaVersion = '3.1.2'; + public string $schemaVersion = '3.5.0'; /** * @inheritdoc diff --git a/src/elements/SendoutElement.php b/src/elements/SendoutElement.php index ee904aea..3bf18c83 100755 --- a/src/elements/SendoutElement.php +++ b/src/elements/SendoutElement.php @@ -68,34 +68,41 @@ class SendoutElement extends Element * @const string */ public const STATUS_SENT = 'sent'; + /** * @const string */ public const STATUS_SENDING = 'sending'; + /** * @const string */ public const STATUS_QUEUED = 'queued'; + /** * @const string */ public const STATUS_PENDING = 'pending'; + /** * @const string */ public const STATUS_PAUSED = 'paused'; + /** * @const string */ public const STATUS_CANCELLED = 'cancelled'; + /** * @const string */ public const STATUS_FAILED = 'failed'; + /** * @const string */ - public const STATUS_DRAFT = 'draft'; + public const STATUS_UNSENT = 'unsent'; /** * Returns the sendout types. @@ -221,6 +228,10 @@ public static function statuses(): array 'label' => Craft::t('campaign', 'Failed'), 'color' => Color::Black, ], + self::STATUS_UNSENT => [ + 'label' => Craft::t('campaign', 'Unsent'), + 'color' => Color::Gray, + ], ]; } @@ -410,7 +421,7 @@ protected static function defineSearchableAttributes(): array /** * @var string Send status */ - public string $sendStatus = self::STATUS_DRAFT; + public string $sendStatus = self::STATUS_UNSENT; /** * @var string|null Send from name/email/reply combo, used for posted params @@ -809,7 +820,7 @@ public function getProgressFraction(): float */ public function getProgress(): string { - if ($this->sendStatus == self::STATUS_DRAFT || $this->sendoutType == 'automated' || $this->sendoutType == 'recurring') { + if ($this->sendStatus == self::STATUS_UNSENT || $this->sendoutType == 'automated' || $this->sendoutType == 'recurring') { return ''; } @@ -1078,7 +1089,7 @@ public function getStatus(): ?string */ public function getIsModifiable(): bool { - return ($this->getStatus() == self::STATUS_DRAFT || $this->getStatus() == self::STATUS_PAUSED); + return ($this->getStatus() == self::STATUS_UNSENT || $this->getStatus() == self::STATUS_PAUSED); } /** @@ -1122,7 +1133,7 @@ public function getIsResumable(): bool */ public function getIsCancellable(): bool { - return ($this->getStatus() != self::STATUS_DRAFT && $this->getStatus() != self::STATUS_CANCELLED && $this->getStatus() != self::STATUS_SENT); + return ($this->getStatus() != self::STATUS_UNSENT && $this->getStatus() != self::STATUS_CANCELLED && $this->getStatus() != self::STATUS_SENT); } /** @@ -1217,7 +1228,7 @@ public function beforeSave(bool $isNew): bool // Reset stats if this is a duplicate of a non-draft sendout. if ($this->firstSave && $this->duplicateOf !== null) { $this->senderId = null; - $this->sendStatus = self::STATUS_DRAFT; + $this->sendStatus = self::STATUS_UNSENT; $this->recipients = 0; $this->failures = 0; $this->failedContactIds = null; diff --git a/src/migrations/m240915_120000_convert_draft_status.php b/src/migrations/m240915_120000_convert_draft_status.php new file mode 100644 index 00000000..8308b901 --- /dev/null +++ b/src/migrations/m240915_120000_convert_draft_status.php @@ -0,0 +1,29 @@ +update(SendoutRecord::tableName(), ['sendStatus' => 'unsent'], ['sendStatus' => 'draft']); + + return true; + } + + /** + * @inheritdoc + */ + public function safeDown(): bool + { + echo self::class . " cannot be reverted.\n"; + + return false; + } +} diff --git a/src/templates/sendouts/_preview.twig b/src/templates/sendouts/_preview.twig index f2f20f2a..20ed31a7 100644 --- a/src/templates/sendouts/_preview.twig +++ b/src/templates/sendouts/_preview.twig @@ -98,7 +98,7 @@ - {% if sendout.status == 'draft' and sendout.sendoutType != 'automated' %} + {% if sendout.status == 'unsent' and sendout.sendoutType != 'automated' %}
{{ "Expected Recipients"|t('campaign') }}
diff --git a/src/translations/de/campaign.php b/src/translations/de/campaign.php index 6e1ab428..95988564 100644 --- a/src/translations/de/campaign.php +++ b/src/translations/de/campaign.php @@ -242,7 +242,6 @@ 'does not end with' => 'ended nicht mit', 'does not equal' => 'entspricht nicht', 'does not start with' => 'beginnt nicht mit', - 'Draft' => 'Entwurf', 'Edit campaign' => 'Kampagne bearbeiten', 'Edit contact' => 'Kontakt bearbeiten', 'Edit mailing list' => 'Mailing-Liste bearbeiten', @@ -662,6 +661,7 @@ 'Unmark contact as blocked' => 'Kontakt nicht mehr als `blockiert` markieren', 'Unmark contact as bounced' => 'Kontakt nicht mehr als `bounced` markieren', 'Unmark contact as complained' => 'Kontakt nicht mehr als `complained` markieren', + 'Unsent' => 'Ungesendet', 'Unsubscribe' => 'Abmelden', 'Unsubscribe Form Allowed' => 'Abmeldeformular erlauben', 'Unsubscribe from “{mailingList}”' => 'Mailing-Liste “{mailingList}” abmelden', diff --git a/src/translations/en/campaign.php b/src/translations/en/campaign.php index f0c97475..3ff0f987 100644 --- a/src/translations/en/campaign.php +++ b/src/translations/en/campaign.php @@ -241,7 +241,6 @@ 'does not end with' => '', 'does not equal' => '', 'does not start with' => '', - 'Draft' => '', 'Edit campaign' => '', 'Edit contact' => '', 'Edit mailing list' => '', @@ -661,6 +660,7 @@ 'Unmark contact as blocked' => '', 'Unmark contact as bounced' => '', 'Unmark contact as complained' => '', + 'Unsent' => '', 'Unsubscribe' => '', 'Unsubscribe Form Allowed' => '', 'Unsubscribe from “{mailingList}”' => '', diff --git a/src/translations/fr/campaign.php b/src/translations/fr/campaign.php index a35722eb..0b0703c0 100644 --- a/src/translations/fr/campaign.php +++ b/src/translations/fr/campaign.php @@ -242,7 +242,6 @@ 'does not end with' => 'ne se terminant pas avec', 'does not equal' => 'n’est pas égale à', 'does not start with' => 'ne commençant pas par', - 'Draft' => 'Brouillon', 'Edit campaign' => 'Éditer newsletter', 'Edit contact' => 'Éditer contact', 'Edit mailing list' => 'Éditer liste de diffusion', @@ -662,6 +661,7 @@ 'Unmark contact as blocked' => 'Ne plus marquer le contact comme bloqué', 'Unmark contact as bounced' => 'Ne plus marquer le contact comme rejeté', 'Unmark contact as complained' => 'Ne plus marquer le contact comme plaignant', + 'Unsent' => 'Non envoyé', 'Unsubscribe' => 'Désabonné', 'Unsubscribe Form Allowed' => 'Formulaire de désabonnement autorisé', 'Unsubscribe from “{mailingList}”' => 'Désabonné de “{mailingList}”',