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