SUPER handling for Sku/*.pm

This commit is contained in:
Colin Kuskie 2010-04-08 16:23:04 -07:00
parent 87b5eed18b
commit 593d02d68b
6 changed files with 34 additions and 34 deletions

View file

@ -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;
}
};
#-------------------------------------------------------------------

View file

@ -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});
};
#-------------------------------------------------------------------

View file

@ -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);
}
}
};
#-------------------------------------------------------------------

View file

@ -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();
}
}
};
#-------------------------------------------------------------------

View file

@ -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;

View file

@ -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')} );
</script>
EOSCRIPT
return $self->SUPER::getEditForm;
} ## end sub getEditForm
return super();
}; ## end sub getEditForm
#----------------------------------------------------------------------------
@ -253,10 +253,10 @@ it is purchased. C<item> 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;
}
};
#----------------------------------------------------------------------------