diff --git a/lib/WebGUI/Asset/Sku/Donation.pm b/lib/WebGUI/Asset/Sku/Donation.pm index 24475b81f..d2611eee8 100644 --- a/lib/WebGUI/Asset/Sku/Donation.pm +++ b/lib/WebGUI/Asset/Sku/Donation.pm @@ -134,14 +134,14 @@ Prepares the template. =cut -sub prepareView { +override prepareView => sub { my $self = shift; - $self->SUPER::prepareView(); + super(); my $templateId = $self->templateId; my $template = WebGUI::Asset::Template->newById($self->session, $templateId); $template->prepare($self->getMetaDataAsTemplateVariables); $self->{_viewTemplate} = $template; -} +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Sku/EMSBadge.pm b/lib/WebGUI/Asset/Sku/EMSBadge.pm index 138880602..1de2a7b26 100644 --- a/lib/WebGUI/Asset/Sku/EMSBadge.pm +++ b/lib/WebGUI/Asset/Sku/EMSBadge.pm @@ -113,17 +113,17 @@ Adds this badge as configured for an individual to the cart. =cut -sub addToCart { - my ($self, $badgeInfo) = @_; +around addToCart => sub { + my ($orig, $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; - my $badgeId = $self->session->db->setRow("EMSRegistrant","badgeId", $badgeInfo); - $self->SUPER::addToCart({badgeId=>$badgeId}); -} + $badgeInfo->{badgeId} = "new"; + $badgeInfo->{badgeAssetId} = $self->getId; + $badgeInfo->{emsAssetId} = $self->getParent->getId; + my $badgeId = $self->session->db->setRow("EMSRegistrant","badgeId", $badgeInfo); + $self->$orig({badgeId=>$badgeId}); +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Sku/EMSTicket.pm b/lib/WebGUI/Asset/Sku/EMSTicket.pm index f3fa4efe5..5b7dd8411 100644 --- a/lib/WebGUI/Asset/Sku/EMSTicket.pm +++ b/lib/WebGUI/Asset/Sku/EMSTicket.pm @@ -120,16 +120,16 @@ Does some bookkeeping to keep track of limited quantities of tickets that are av =cut -sub addToCart { - my ($self, $badgeInfo) = @_; +around addToCart => sub { + my ($orig, $self, $badgeInfo) = @_; my $db = $self->session->db; my @params = ($badgeInfo->{badgeId},$self->getId); # don't let them add a ticket they already have unless ($db->quickScalar("select count(*) from EMSRegistrantTicket where badgeId=? and ticketAssetId=?",\@params)) { $db->write("insert into EMSRegistrantTicket (badgeId, ticketAssetId) values (?,?)", \@params); - $self->SUPER::addToCart($badgeInfo); + $self->$orig($badgeInfo); } -} +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Sku/FlatDiscount.pm b/lib/WebGUI/Asset/Sku/FlatDiscount.pm index fdb130b44..770119c4a 100644 --- a/lib/WebGUI/Asset/Sku/FlatDiscount.pm +++ b/lib/WebGUI/Asset/Sku/FlatDiscount.pm @@ -98,14 +98,14 @@ Checks to make sure there isn't already a coupon of this type in the cart. =cut -sub addToCart { - my ($self, $options) = @_; +override addToCart => sub { + my ($self) = @_; my $found = $self->hasCoupon(); unless ($found) { $self->{_hasAddedToCart} = 1; - $self->SUPER::addToCart($options); + super(); } -} +}; #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Sku/Product.pm b/lib/WebGUI/Asset/Sku/Product.pm index 169dc3ef1..1a1be6888 100644 --- a/lib/WebGUI/Asset/Sku/Product.pm +++ b/lib/WebGUI/Asset/Sku/Product.pm @@ -233,9 +233,9 @@ Override the duplicate method so uploaded files and images also get copied. =cut -sub duplicate { +override duplicate => sub { my $self = shift; - my $newAsset = $self->SUPER::duplicate(@_); + my $newAsset = super; foreach my $file ('image1', 'image2', 'image3', 'manual', 'brochure', 'warranty') { $self->_duplicateFile($newAsset, $file); @@ -243,7 +243,7 @@ sub duplicate { return $newAsset; -} +}; #------------------------------------------------------------------- @@ -646,10 +646,10 @@ The WebGUI::Shop::CartItem that will be refunded. =cut -sub onRefund { +override onRefund => sub { my $self = shift; my $item = shift; - $self->SUPER::onRefund($item); + super(); my $amount = $item->get('quantity'); ##Update myself, as options $self->getOptions->{quantity} += $amount; @@ -658,7 +658,7 @@ sub onRefund { my $collateral = $self->getCollateral('variantsJSON', 'variantId', $vid); $collateral->{quantity} += $amount; $self->setCollateral('variantsJSON', 'variantId', $vid, $collateral); -} +}; #------------------------------------------------------------------- @@ -1872,11 +1872,11 @@ Extend the base method to handle caching. =cut -sub www_view { +override www_view => sub { my $self = shift; $self->session->http->setCacheControl($self->cacheTimeout); - $self->SUPER::www_view(@_); -} + super(); +}; 1; diff --git a/lib/WebGUI/Asset/Sku/ThingyRecord.pm b/lib/WebGUI/Asset/Sku/ThingyRecord.pm index 8789d669b..a87725a21 100644 --- a/lib/WebGUI/Asset/Sku/ThingyRecord.pm +++ b/lib/WebGUI/Asset/Sku/ThingyRecord.pm @@ -205,7 +205,7 @@ Add the javascript needed for the edit form =cut -sub getEditForm { +override getEditForm => sub { my ($self) = @_; $self->session->style->setScript( $self->session->url->extras('yui/build/yahoo-dom-event/yahoo-dom-event.js'), @@ -228,8 +228,8 @@ sub getEditForm { YAHOO.util.Event.onDOMReady( function () { var thingForm = YAHOO.util.Dom.get('thingId_formId'); WebGUI.ThingyRecord.getThingFields(thingForm.options[thingForm.selectedIndex].value,'thingFields_formId')} ); EOSCRIPT - return $self->SUPER::getEditForm; -} ## end sub getEditForm + return super(); +}; ## end sub getEditForm #---------------------------------------------------------------------------- @@ -253,10 +253,10 @@ it is purchased. C is the WebGUI::Shop::TransactionItem for this item =cut -sub getPostPurchaseActions { +override getPostPurchaseActions => sub { my ( $self, $item ) = @_; my $session = $self->session; - my $opts = $self->SUPER::getPostPurchaseActions(); + my $opts = super(); my $i18n = WebGUI::International->new( $session, "Asset_ThingyRecord" ); my $recordId = $item->get('options')->{recordId}; @@ -265,7 +265,7 @@ sub getPostPurchaseActions { = $self->getUrl( 'func=editRecord;recordid=' . $recordId ); return $opts; -} +}; #----------------------------------------------------------------------------