diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt
index fbe5c1a34..17b65f3d7 100644
--- a/docs/changelog/7.x.x.txt
+++ b/docs/changelog/7.x.x.txt
@@ -25,6 +25,7 @@
- fixed: Shop: Variants in dropdown and on page
- fixed: OLD subscription table still hanging around?
- fixed: Shelf
+ - fixed: Subscriptions and redemption
7.5.12
- skipping this release
diff --git a/lib/WebGUI/Asset/Sku/Subscription.pm b/lib/WebGUI/Asset/Sku/Subscription.pm
index ce7d8cc7e..a8fdaddbe 100644
--- a/lib/WebGUI/Asset/Sku/Subscription.pm
+++ b/lib/WebGUI/Asset/Sku/Subscription.pm
@@ -465,7 +465,7 @@ sub redeemCode {
my $self = shift;
my $code = shift;
my $session = $self->session;
- my $i18n = my $i18n = WebGUI::International->new($session, "Asset_Subscription");
+ my $i18n = WebGUI::International->new($session, "Asset_Subscription");
my $properties = $self->getCode( $code );
@@ -509,9 +509,13 @@ sub view {
''.$i18n->get('manage codes').'',
''.$i18n->get('manage batches').'',
)),
- redeemCodeLabel => $i18n->get('redeem code'),
- redeemCodeUrl => $self->getUrl('func=redeemSubscriptionCode'),
);
+ my $hasCodes = $self->session->db->quickScalar('select count(*) from Subscription_code as t1, Subscription_codeBatch as t2 where t1.batchId = t2.batchId and t2.subscriptionId=?', [$self->getId]);
+ if ($hasCodes) {
+ $var{redeemCodeLabel} = $i18n->get('redeem code');
+ $var{redeemCodeUrl} = $self->getUrl('func=redeemSubscriptionCode');
+
+ }
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
}
diff --git a/lib/WebGUI/i18n/English/Asset_Subscription.pm b/lib/WebGUI/i18n/English/Asset_Subscription.pm
index ebe036082..9051b5837 100755
--- a/lib/WebGUI/i18n/English/Asset_Subscription.pm
+++ b/lib/WebGUI/i18n/English/Asset_Subscription.pm
@@ -473,14 +473,14 @@ The form in which the user can enter his subscription code.
|,
},
'redeemCodeLabel' => {
- message => q|An internationalized label for the link to redeem a subscription code.|,
- lastUpdated => 0,
+ message => q|An internationalized label for the link to redeem a subscription code. If there are no subscription codes, this will be blank|,
+ lastUpdated => 1213936319,
context => q|template variable|
},
'redeemCodeUrl' => {
- message => q|The URL to redeem a subscription code.|,
- lastUpdated => 0,
+ message => q|The URL to redeem a subscription code. If there are no subscription codes, this will be blank.|,
+ lastUpdated => 1213936341,
context => q|template variable|
},
diff --git a/t/Shop/Transaction.t b/t/Shop/Transaction.t
index 6d7a2674b..5ac666c40 100644
--- a/t/Shop/Transaction.t
+++ b/t/Shop/Transaction.t
@@ -159,17 +159,17 @@ is($item->get("price"), 33, "set and get price");
$item->update({
shippingTrackingNumber => 'adfs',
- shippingStatus => 'BackOrdered',
+ orderStatus => 'BackOrdered',
});
is($item->get("shippingTrackingNumber"), 'adfs', "update and get shipping tracking number");
-is($item->get("shippingStatus"), 'BackOrdered', "update and get shipping status");
+is($item->get("orderStatus"), 'BackOrdered', "update and get shipping status");
# make sure shipping date is updated when shipping status is changed
like($item->get("shippingDate"), qr/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d/, "shipping date is set");
my $dateNow = $item->get('shippingDate');
sleep(1);
-$item->update({shippingStatus=>'Cancelled'});
+$item->update({orderStatus=>'Cancelled'});
isnt($item->get('shippingDate'), $dateNow, 'shipping date is updated');
# make sure new() works