diff --git a/lib/WebGUI/Operation/Commerce.pm b/lib/WebGUI/Operation/Commerce.pm index 1a856045e..e2d4c25d4 100644 --- a/lib/WebGUI/Operation/Commerce.pm +++ b/lib/WebGUI/Operation/Commerce.pm @@ -53,21 +53,21 @@ sub _clearCheckoutScratch { #------------------------------------------------------------------- sub _clearPaymentScratch { my $session = shift; - WebGUI::Session::setScratch('paymentGateway', '-delete-'); + $session->scratch->set('paymentGateway', '-delete-'); } #------------------------------------------------------------------- sub _clearShippingScratch { my $session = shift; - WebGUI::Session::setScratch('shippingMethod', '-delete-'); - WebGUI::Session::setScratch('shippingOptions', '-delete-'); + $session->scratch->set('shippingMethod', '-delete-'); + $session->scratch->set('shippingOptions', '-delete-'); } #------------------------------------------------------------------- sub _paymentSelected { my $session = shift; - return 0 unless (WebGUI::Session::getScratch('paymentGateway')); - my $plugin = WebGUI::Commerce::Payment->load(WebGUI::Session::getScratch('paymentGateway')); + return 0 unless ($session->scratch->get('paymentGateway')); + my $plugin = WebGUI::Commerce::Payment->load($session->scratch->get('paymentGateway')); return 1 if ($plugin && $plugin->enabled); return 0; } @@ -75,11 +75,11 @@ sub _paymentSelected { #------------------------------------------------------------------- sub _shippingSelected { my $session = shift; - return 0 unless (WebGUI::Session::getScratch('shippingMethod')); + return 0 unless ($session->scratch->get('shippingMethod')); - my $plugin = WebGUI::Commerce::Shipping->load(WebGUI::Session::getScratch('shippingMethod')); + my $plugin = WebGUI::Commerce::Shipping->load($session->scratch->get('shippingMethod')); if ($plugin) { - $plugin->setOptions(Storable::thaw(WebGUI::Session::getScratch('shippingOptions'))) if (WebGUI::Session::getScratch('shippingOptions')); + $plugin->setOptions(Storable::thaw($session->scratch->get('shippingOptions'))) if ($session->scratch->get('shippingOptions')); return 1 if ($plugin->enabled && $plugin->optionsOk); } @@ -130,7 +130,7 @@ sub www_checkoutConfirm { # If the user isn't logged in yet, let him do so or have him create an account if ($session->user->profileField("userId") == 1) { - WebGUI::Session::setScratch('redirectAfterLogin', $session->url->page('op=checkout')); + $session->scratch->set('redirectAfterLogin', $session->url->page('op=checkout')); return WebGUI::Operation::execute('auth'); } @@ -169,15 +169,15 @@ sub www_checkoutConfirm { $var{subTotal} = sprintf('%.2f', $total); - $shipping = WebGUI::Commerce::Shipping->load(WebGUI::Session::getScratch('shippingMethod')); - $shipping->setOptions(Storable::thaw(WebGUI::Session::getScratch('shippingOptions'))) if (WebGUI::Session::getScratch('shippingOptions')); + $shipping = WebGUI::Commerce::Shipping->load($session->scratch->get('shippingMethod')); + $shipping->setOptions(Storable::thaw($session->scratch->get('shippingOptions'))) if ($session->scratch->get('shippingOptions')); $var{shippingName} = $shipping->name; $var{shippingCost} = sprintf('%.2f', $shipping->calc); $var{total} = sprintf('%.2f', $total + $shipping->calc); - $plugin = WebGUI::Commerce::Payment->load(WebGUI::Session::getScratch('paymentGateway')); + $plugin = WebGUI::Commerce::Payment->load($session->scratch->get('paymentGateway')); $f = WebGUI::HTMLForm->new; $f->hidden( @@ -211,7 +211,7 @@ sub www_checkoutSubmit { # check if user has already logged in if ($session->user->profileField("userId") == 1) { - WebGUI::Session::setScratch('redirectAfterLogin', $session->url->page('op=checkout')); + $session->scratch->set('redirectAfterLogin', $session->url->page('op=checkout')); return WebGUI::Operation::execute('displayLogin'); } @@ -219,11 +219,11 @@ sub www_checkoutSubmit { return WebGUI::Operation::execute('checkout') unless (_paymentSelected && _shippingSelected); # Load shipping plugin. - $shipping = WebGUI::Commerce::Shipping->load(WebGUI::Session::getScratch('shippingMethod')); - $shipping->setOptions(Storable::thaw(WebGUI::Session::getScratch('shippingOptions'))) if (WebGUI::Session::getScratch('shippingOptions')); + $shipping = WebGUI::Commerce::Shipping->load($session->scratch->get('shippingMethod')); + $shipping->setOptions(Storable::thaw($session->scratch->get('shippingOptions'))) if ($session->scratch->get('shippingOptions')); # Load payment plugin. - $plugin = WebGUI::Commerce::Payment->load(WebGUI::Session::getScratch('paymentGateway')); + $plugin = WebGUI::Commerce::Payment->load($session->scratch->get('paymentGateway')); $shoppingCart = WebGUI::Commerce::ShoppingCart->new; ($normal, $recurring) = $shoppingCart->getItems; @@ -703,9 +703,9 @@ sub www_selectPaymentGateway { sub www_selectPaymentGatewaySave { my $session = shift; if (WebGUI::Commerce::Payment->load($session->form->process("paymentGateway"))->enabled) { - WebGUI::Session::setScratch('paymentGateway', $session->form->process("paymentGateway")); + $session->scratch->set('paymentGateway', $session->form->process("paymentGateway")); } else { - WebGUI::Session::setScratch('paymentGateway', '-delete-'); + $session->scratch->set('paymentGateway', '-delete-'); } return WebGUI::Operation::execute('checkout'); @@ -754,10 +754,10 @@ sub www_selectShippingMethodSave { return WebGUI::Operation::execute('selectShipping') unless ($shipping->optionsOk); if ($shipping->enabled) { - WebGUI::Session::setScratch('shippingMethod', $shipping->namespace); - WebGUI::Session::setScratch('shippingOptions', Storable::freeze($shipping->getOptions)); + $session->scratch->set('shippingMethod', $shipping->namespace); + $session->scratch->set('shippingOptions', Storable::freeze($shipping->getOptions)); } else { - WebGUI::Session::setScratch('shippingMethod', '-delete-'); + $session->scratch->set('shippingMethod', '-delete-'); } return WebGUI::Operation::execute('checkout'); diff --git a/lib/WebGUI/Operation/Group.pm b/lib/WebGUI/Operation/Group.pm index ccc9896f7..6252cc78e 100644 --- a/lib/WebGUI/Operation/Group.pm +++ b/lib/WebGUI/Operation/Group.pm @@ -76,10 +76,10 @@ sub doGroupSearch { my $returnPaginator = shift; my $groupFilter = shift; push(@{$groupFilter},0); - my $keyword = $session{scratch}{groupSearchKeyword}; - if ($session{scratch}{groupSearchModifier} eq "startsWith") { + my $keyword = $session->scratch->get("groupSearchKeyword"); + if ($session->scratch->get("groupSearchModifier") eq "startsWith") { $keyword .= "%"; - } elsif ($session{scratch}{groupSearchModifier} eq "contains") { + } elsif ($session->scratch->get("groupSearchModifier") eq "contains") { $keyword = "%".$keyword."%"; } else { $keyword = "%".$keyword; @@ -103,8 +103,8 @@ sub getGroupSearchForm { my $session = shift; my $op = shift; my $params = shift; - WebGUI::Session::setScratch("groupSearchKeyword",$session->form->process("keyword")); - WebGUI::Session::setScratch("groupSearchModifier",$session->form->process("modifier")); + $session->scratch->set("groupSearchKeyword",$session->form->process("keyword")); + $session->scratch->set("groupSearchModifier",$session->form->process("modifier")); my $output = '