Skip to content

Commit

Permalink
Merge branch 'craft-4' of https://github.com/verbb/gift-voucher into …
Browse files Browse the repository at this point in the history
…craft-5

# Conflicts:
#	CHANGELOG.md
#	composer.json
#	src/GiftVoucher.php
  • Loading branch information
engram-design committed Sep 7, 2024
2 parents 62ddb4c + 6d70a90 commit 8ed3a16
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 7 deletions.
20 changes: 17 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

## Unreleased
## 4.0.3 - 2024-09-07

### Fixed
### Changed
- Change “Share” button to “View” for vouchers, for consistency with Craft/Commerce.

- Fixed saving a code with a decimal value being cast to an int ([#131](https://github.com/verbb/gift-voucher/issues/131))
### Fixed
- Fix missing `product` variable when previewing a voucher.
- Fix an error when duplicating a voucher.
- Fix saving a code with a decimal value being cast to an int.

## 4.0.2 - 2024-07-21

Expand Down Expand Up @@ -32,6 +36,16 @@
- Now requires Craft `5.0.0+`.
- Now requires Craft Commerce `5.0.0+`.

## 3.0.14 - 2024-09-07

### Changed
- Change “Share” button to “View” for vouchers, for consistency with Craft/Commerce.

### Fixed
- Fix missing `product` variable when previewing a voucher.
- Fix an error when duplicating a voucher.
- Fix saving a code with a decimal value being cast to an int.

## 3.0.13 - 2024-07-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "verbb/gift-voucher",
"description": "Sell and redeem digital gift vouchers for Craft Commerce.",
"type": "craft-plugin",
"version": "4.0.2",
"version": "4.0.3",
"keywords": [
"craft",
"cms",
Expand Down
2 changes: 1 addition & 1 deletion src/GiftVoucher.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class GiftVoucher extends Plugin

public bool $hasCpSection = true;
public bool $hasCpSettings = true;
public string $schemaVersion = '3.0.0';
public string $schemaVersion = '3.0.1';
public string $minVersionRequired = '2.4.1';


Expand Down
1 change: 1 addition & 0 deletions src/controllers/VouchersPreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private function _showVoucher(Voucher $voucher): Response

return $this->renderTemplate($siteSettings[$voucher->siteId]->template, [
'voucher' => $voucher,
'product' => $voucher,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function createIndexes(): void
$this->createIndex(null, '{{%giftvoucher_redemptions}}', 'codeId', false);
$this->createIndex(null, '{{%giftvoucher_redemptions}}', 'orderId', false);

$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'sku', true);
$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'sku', false);
$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'typeId', false);
$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'taxCategoryId', false);
$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'shippingCategoryId', false);
Expand Down
23 changes: 23 additions & 0 deletions src/migrations/m240814_000000_sku_index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace verbb\giftvoucher\migrations;

use craft\db\Migration;
use craft\helpers\MigrationHelper;

class m240814_000000_sku_index extends Migration
{
public function safeUp(): bool
{
$this->dropIndexIfExists('{{%giftvoucher_vouchers}}', 'sku', true);
$this->createIndex(null, '{{%giftvoucher_vouchers}}', 'sku', false);

return true;
}

public function safeDown(): bool
{
echo "m240814_000000_sku_index cannot be reverted.\n";
return false;
}
}

2 changes: 1 addition & 1 deletion src/templates/vouchers/_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% endif %}

{% if shareUrl is defined %}
<a id="share-btn" href="{{ shareUrl }}" class="btn sharebtn" target="_blank">{{ 'Share' | t('app') }}</a>
<a id="share-btn" href="{{ shareUrl }}" class="btn sharebtn" target="_blank">{{ 'View' | t('app') }}</a>
{% endif %}
</div>
{% endif %}
Expand Down

0 comments on commit 8ed3a16

Please sign in to comment.