a lot of session fixes... I'm sure this breaks something somewhere though.

This commit is contained in:
Matthew Wilson 2006-03-10 19:59:43 +00:00
parent 279233b367
commit 0c177bacb1
10 changed files with 38 additions and 24 deletions

View file

@ -192,6 +192,19 @@ sub price {
#-------------------------------------------------------------------
=head2 session ( )
Returns a reference to the current session.
=cut
sub session {
my $self = shift;
return $self->{_session};
}
#-------------------------------------------------------------------
=head2 type ( )
Returns the type (namespace) of the item.

View file

@ -58,7 +58,7 @@ sub new {
from EventManagementSystem_products as e, products as p
where p.productId = e.productId and p.productId=".$session->db->quote($eventId));
bless {_event => $eventData}, $class;
bless {_event => $eventData, _session => $session }, $class;
}
#-------------------------------------------------------------------

View file

@ -68,7 +68,7 @@ sub new {
my %parameters = map {split(/\./, $_)} split(/,/, $variant->{composition});
my $composition = join(', ',map {$product->getParameter($_)->{name} .': '. $product->getOption($parameters{$_})->{value}} keys (%parameters));
bless {_product => $product, _composition => $composition, _variant => $variant}, $class;
bless {_product => $product, _composition => $composition, _variant => $variant, _session => $session }, $class;
}
#-------------------------------------------------------------------

View file

@ -62,7 +62,7 @@ sub new {
$type = shift;
$subscription = WebGUI::Subscription->new($session,$subscriptionId);
bless {_subscription => $subscription, _subscriptionId => $subscriptionId}, $class;
bless {_session => $session, _subscription => $subscription, _subscriptionId => $subscriptionId}, $class;
}
#-------------------------------------------------------------------

View file

@ -21,7 +21,7 @@ An abstract class for all payment plugins to extend.
Invoking goes as follows:
$plugin = WebGUI::Commerce::Payment->init('MyPlugin');
$plugin = WebGUI::Commerce::Payment->init($session,'MyPlugin');
=head1 METHODS
@ -291,7 +291,8 @@ sub load {
$load = "use $cmd";
eval($load);
$session->errorHandler->warn("Payment plugin failed to compile: $cmd.".$@) if($@);
$plugin = eval($cmd."->init");
$plugin = eval($cmd.'->init($session)');
$session->errorHandler->warn("Couldn't instantiate payment plugin: $cmd.".$@) if($@);
return $plugin;
}

View file

@ -588,8 +588,8 @@ sub errorCode {
#-------------------------------------------------------------------
sub name {
my ($session) = @_;
my $i18n = WebGUI::International->new($session, "CommercePaymentITransact");
my ($self) = shift;
my $i18n = WebGUI::International->new($self->session, "CommercePaymentITransact");
return $i18n->get('module name');
}

View file

@ -215,7 +215,7 @@ sub load {
$load = "use $cmd";
eval($load);
$session->errorHandler->warn("Shipping plugin failed to compile: $cmd.".$@) if($@);
$plugin = eval($cmd."->init");
$plugin = eval($cmd.'->init($session)');
$session->errorHandler->warn("Couldn't instantiate shipping plugin: $cmd.".$@) if($@);
return $plugin;
}
@ -229,8 +229,8 @@ Returns the (display) name of the plugin. You must override this method.
=cut
sub name {
my ($session) = @_;
return $session->errorHandler->fatal("You must override the name method in the shipping plugin.");
my ($self) = @_;
return $self->session->errorHandler->fatal("You must override the name method in the shipping plugin.");
}
#-------------------------------------------------------------------

View file

@ -62,8 +62,8 @@ sub configurationForm {
sub init {
my ($class, $self);
$class = shift;
$self = $class->SUPER::init('ByPrice');
my $session = shift;
$self = $class->SUPER::init($session,'ByPrice');
return $self;
}
@ -77,8 +77,8 @@ Returns the internationalized name for this shipping plugin.
=cut
sub name {
my ($session) = @_;
my $i18n = WebGUI::International->new($session, 'CommerceShippingByPrice');
my ($self) = @_;
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByPrice');
return $i18n->get('title');
}

View file

@ -70,8 +70,8 @@ Constructor
sub init {
my ($class, $self);
$class = shift;
$self = $class->SUPER::init('ByWeight');
my $session = shift;
$self = $class->SUPER::init($session,'ByWeight');
return $self;
}
@ -85,8 +85,8 @@ Returns the internationalized name for this shipping plugin.
=cut
sub name {
my ($session) = @_;
my $i18n = WebGUI::International->new($session, 'CommerceShippingByWeight');
my $self = shift;
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingByWeight');
return $i18n->get('title');
}

View file

@ -16,7 +16,7 @@ use strict;
#-------------------------------------------------------------------
=head2 calc ( $session )
=head2 calc ( $self )
Calculate the shipping price for this plugin.
@ -33,7 +33,7 @@ sub calc {
#-------------------------------------------------------------------
=head2 configurationForm ( $session )
=head2 configurationForm ( $self )
Configuration form for this shipping method.
@ -65,8 +65,8 @@ Constructor
sub init {
my ($class, $self);
$class = shift;
$self = $class->SUPER::init('PerTransaction');
my $session = shift;
$self = $class->SUPER::init($session,'PerTransaction');
return $self;
}
@ -80,8 +80,8 @@ Returns the internationalized name for this shipping plugin.
=cut
sub name {
my ($session) = @_;
my $i18n = WebGUI::International->new($session, 'CommerceShippingPerTransaction');
my ($self) = shift;
my $i18n = WebGUI::International->new($self->session, 'CommerceShippingPerTransaction');
return $i18n->get('title');
}