Prevent the Subscription from showing the redeem code label and URL unless there are codes
This commit is contained in:
parent
68db4f8e46
commit
8be5eeb5f6
4 changed files with 15 additions and 10 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
- fixed: Shop: Variants in dropdown and on page
|
- fixed: Shop: Variants in dropdown and on page
|
||||||
- fixed: OLD subscription table still hanging around?
|
- fixed: OLD subscription table still hanging around?
|
||||||
- fixed: Shelf
|
- fixed: Shelf
|
||||||
|
- fixed: Subscriptions and redemption
|
||||||
|
|
||||||
7.5.12
|
7.5.12
|
||||||
- skipping this release
|
- skipping this release
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ sub redeemCode {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $code = shift;
|
my $code = shift;
|
||||||
my $session = $self->session;
|
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 );
|
my $properties = $self->getCode( $code );
|
||||||
|
|
||||||
|
|
@ -509,9 +509,13 @@ sub view {
|
||||||
'<a href="'.$self->getUrl('func=listSubscriptionCodes') .'">'.$i18n->get('manage codes').'</a>',
|
'<a href="'.$self->getUrl('func=listSubscriptionCodes') .'">'.$i18n->get('manage codes').'</a>',
|
||||||
'<a href="'.$self->getUrl('func=listSubscriptionCodeBatches') .'">'.$i18n->get('manage batches').'</a>',
|
'<a href="'.$self->getUrl('func=listSubscriptionCodeBatches') .'">'.$i18n->get('manage batches').'</a>',
|
||||||
)),
|
)),
|
||||||
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});
|
return $self->processTemplate(\%var,undef,$self->{_viewTemplate});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -473,14 +473,14 @@ The form in which the user can enter his subscription code.<br />|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'redeemCodeLabel' => {
|
'redeemCodeLabel' => {
|
||||||
message => q|An internationalized label for the link to redeem a subscription code.|,
|
message => q|An internationalized label for the link to redeem a subscription code. If there are no subscription codes, this will be blank|,
|
||||||
lastUpdated => 0,
|
lastUpdated => 1213936319,
|
||||||
context => q|template variable|
|
context => q|template variable|
|
||||||
},
|
},
|
||||||
|
|
||||||
'redeemCodeUrl' => {
|
'redeemCodeUrl' => {
|
||||||
message => q|The URL to redeem a subscription code.|,
|
message => q|The URL to redeem a subscription code. If there are no subscription codes, this will be blank.|,
|
||||||
lastUpdated => 0,
|
lastUpdated => 1213936341,
|
||||||
context => q|template variable|
|
context => q|template variable|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,17 +159,17 @@ is($item->get("price"), 33, "set and get price");
|
||||||
|
|
||||||
$item->update({
|
$item->update({
|
||||||
shippingTrackingNumber => 'adfs',
|
shippingTrackingNumber => 'adfs',
|
||||||
shippingStatus => 'BackOrdered',
|
orderStatus => 'BackOrdered',
|
||||||
});
|
});
|
||||||
|
|
||||||
is($item->get("shippingTrackingNumber"), 'adfs', "update and get shipping tracking number");
|
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
|
# 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");
|
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');
|
my $dateNow = $item->get('shippingDate');
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$item->update({shippingStatus=>'Cancelled'});
|
$item->update({orderStatus=>'Cancelled'});
|
||||||
isnt($item->get('shippingDate'), $dateNow, 'shipping date is updated');
|
isnt($item->get('shippingDate'), $dateNow, 'shipping date is updated');
|
||||||
|
|
||||||
# make sure new() works
|
# make sure new() works
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue