diff --git a/UPGRADE.md b/UPGRADE.md index 6d98ec3c..3e1f94fc 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,3 +1,7 @@ +### UPGRADE FROM 1.0.0-RC.2 TO 1.0.0-RC.3 + +1. `Sylius\RefundPlugin\Entity\RefundPaymentInterface` state constants values were changed to lowercase. Backward compatibility provided by migration. + ### UPGRADE FROM 1.0.0-RC.1 TO 1.0.0-RC.2 1. `Sylius\RefundPlugin\Entity\CreditMemoUnit` was changed to `Sylius\RefundPlugin\Entity\LineItem` which is a resource entity now. @@ -10,7 +14,7 @@ 5. `Sylius\RefundPlugin\Entity\TaxItem` became a resource entity. -There are no migrations that provide backward compatibility, save current credit memos before upgrading the version of plugin. +There are no migrations that provide backward compatibility, save current credit memos before upgrading the version of plugin. ### UPGRADE FROM 0.10.1 TO 1.0.0-RC.1 diff --git a/migrations/Version20200304172851.php b/migrations/Version20200304172851.php new file mode 100644 index 00000000..1cef5a32 --- /dev/null +++ b/migrations/Version20200304172851.php @@ -0,0 +1,32 @@ +abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('UPDATE sylius_refund_payment SET state = "new" WHERE state = "New"'); + $this->addSql('UPDATE sylius_refund_payment SET state = "completed" WHERE state = "Completed"'); + } + + public function down(Schema $schema): void + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); + + $this->addSql('UPDATE sylius_refund_payment SET state = "New" WHERE state = "new"'); + $this->addSql('UPDATE sylius_refund_payment SET state = "Completed" WHERE state = "completed"'); + } +} diff --git a/src/Entity/RefundPaymentInterface.php b/src/Entity/RefundPaymentInterface.php index a95ddd60..65226b53 100644 --- a/src/Entity/RefundPaymentInterface.php +++ b/src/Entity/RefundPaymentInterface.php @@ -9,9 +9,9 @@ interface RefundPaymentInterface extends ResourceInterface { - public const STATE_NEW = 'New'; + public const STATE_NEW = 'new'; - public const STATE_COMPLETED = 'Completed'; + public const STATE_COMPLETED = 'completed'; public function getOrderNumber(): string; diff --git a/src/Resources/config/app/config.yml b/src/Resources/config/app/config.yml index d3470652..61a7babf 100644 --- a/src/Resources/config/app/config.yml +++ b/src/Resources/config/app/config.yml @@ -46,12 +46,12 @@ winzou_state_machine: graph: sylius_refund_refund_payment state_machine_class: "%sylius.state_machine.class%" states: - New: ~ - Completed: ~ + new: ~ + completed: ~ transitions: complete: - from: [New] - to: Completed + from: [new] + to: completed sylius_grid: templates: diff --git a/src/Resources/translations/messages.en.yml b/src/Resources/translations/messages.en.yml index e166f9dc..7b02f8fe 100644 --- a/src/Resources/translations/messages.en.yml +++ b/src/Resources/translations/messages.en.yml @@ -2,6 +2,7 @@ sylius_refund: ui: buyer: Buyer clear_refunds: Clear all + new: New completed: Completed credit_memo: Credit memo credit_memos: Credit memos @@ -31,5 +32,5 @@ sylius_refund: sylius: ui: - original_payment_method: "Original Payment Method" - partially_refunded: 'Partially refunded' + original_payment_method: Original Payment Method + partially_refunded: Partially refunded diff --git a/src/Resources/translations/messages.fr.yml b/src/Resources/translations/messages.fr.yml index 3c1b76e3..3960fc4f 100644 --- a/src/Resources/translations/messages.fr.yml +++ b/src/Resources/translations/messages.fr.yml @@ -25,5 +25,5 @@ sylius_refund: sylius: ui: - original_payment_method: "Moyen de paiement d'origine" - partially_refunded: 'Partiellement remboursé' + original_payment_method: Moyen de paiement d'origine + partially_refunded: Partiellement remboursé diff --git a/src/Resources/views/Common/Label/refundPaymentState.html.twig b/src/Resources/views/Common/Label/refundPaymentState.html.twig new file mode 100644 index 00000000..882ed1c9 --- /dev/null +++ b/src/Resources/views/Common/Label/refundPaymentState.html.twig @@ -0,0 +1,13 @@ +{% + set viewOptions = { + completed: { icon: 'adjust', color: 'green' }, + new: { icon: 'clock', color: 'olive' }, + } +%} + +{% set value = 'sylius_refund.ui.' ~ data %} + + + + {{ value|trans }} + diff --git a/src/Resources/views/Order/Admin/RefundPayment/list.html.twig b/src/Resources/views/Order/Admin/RefundPayment/list.html.twig index e0e01fba..cbec05e5 100644 --- a/src/Resources/views/Order/Admin/RefundPayment/list.html.twig +++ b/src/Resources/views/Order/Admin/RefundPayment/list.html.twig @@ -1,5 +1,4 @@ -{% import "@SyliusAdmin/Common/Macro/money.html.twig" as money %} -{% import "@SyliusUi/Macro/buttons.html.twig" as buttons %} +{% import '@SyliusAdmin/Common/Macro/money.html.twig' as money %} {% if refund_payments|length > 0 %}