From c6785295892af20125ecfc393e2255bf49ad3893 Mon Sep 17 00:00:00 2001 From: Kaleb Murphy Date: Fri, 12 Sep 2008 16:02:09 +0000 Subject: [PATCH] Can no longer buy badges from receipt or direct link page if quantity is empty --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Asset/Sku/EMSBadge.pm | 7 ++++++- lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm | 5 +++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 31fbcffa4..56d6644a3 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -36,6 +36,8 @@ - fixed: If a user clicks on an unsubscribe link in an email and they are not logged into WebGUI, they are now prompted to log in so that they can then unsbscribe. - fixed: Using a password recovery token a second time informs the user of the reuse instead of having a style inside a style with a login form. - fixed: Thingy Things can now have no fields and still be functional. + - fixed: Can no longer buy badges from receipt or direct link page if quantity is empty + 7.5.22 - fixed: Layout template now gets prepared correctly - fixed: When user does not have permissions to search/edit a thing a proper error is shown. diff --git a/lib/WebGUI/Asset/Sku/EMSBadge.pm b/lib/WebGUI/Asset/Sku/EMSBadge.pm index dd5441aec..cab929f2d 100644 --- a/lib/WebGUI/Asset/Sku/EMSBadge.pm +++ b/lib/WebGUI/Asset/Sku/EMSBadge.pm @@ -51,6 +51,9 @@ Adds this badge as configured for an individual to the cart. sub addToCart { my ($self, $badgeInfo) = @_; + if($self->getQuantityAvailable() < 1){ + return WebGUI::International->new($self->session, "Asset_EventManagementSystem")->get('no more available'); + } $badgeInfo->{badgeId} = "new"; $badgeInfo->{badgeAssetId} = $self->getId; $badgeInfo->{emsAssetId} = $self->getParent->getId; @@ -397,7 +400,9 @@ sub view { name => 'email', defaultValue => $form->get('email','email'), }); - $vars{submitAddress} = WebGUI::Form::submit($session, {value => $i18n->get('add to cart'),}); + if($self->getQuantityAvailable() > 0){ + $vars{submitAddress} = WebGUI::Form::submit($session, {value => $i18n->get('add to cart'),}); + } $vars{title} = $self->getTitle; $vars{description} = $self->get('description'); diff --git a/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm b/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm index 3821d7ac6..5fa0834eb 100644 --- a/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm +++ b/lib/WebGUI/i18n/English/Asset_EventManagementSystem.pm @@ -895,6 +895,11 @@ our $I18N = { context => q|heading on add badge to cart screen|, }, + 'no more available' => { + message => q|Error: No more items available for purcahse.|, + lastUpdated => 0, + }, + 'add to cart' => { message => q|Add To Cart|, lastUpdated => 0,