From 3d260ea987c7ea8d4ecdae660edebbf0a2c97b66 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Mon, 17 Apr 2006 09:42:47 +0000 Subject: [PATCH] commerce scratch fixes. --- lib/WebGUI/Asset/Wobject/EventManagementSystem.pm | 9 ++------- lib/WebGUI/Operation/Commerce.pm | 10 +++++----- lib/WebGUI/Operation/ProductManager.pm | 2 +- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm index f7d894cd1..d98be5739 100644 --- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm +++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm @@ -1968,12 +1968,7 @@ sub www_viewPurchase { =head2 www_addEventsToBadge ( ) -Method to display a purchase. From this screen, admins can -return the whole purchase, return a whole badge (registration, -a.k.a itinerary for a single person), or return a single event -from an itinerary. The purchaser can just add events to -individual registrations that have at least one event that -hasn't occurred yet. +Method to go into badge-addition mode. =cut @@ -1984,7 +1979,7 @@ sub www_addEventsToBadge { my $bid = $self->session->form->process('bid'); $self->session->scratch->delete('EMS_add_purchase_badgeId'); $self->session->scratch->set('EMS_add_purchase_badgeId',$bid); - my @pastEvents = $self->session->db->buildArray("select productId from EventManagementSystem_registrations where badgeId=?",[$bid]); + my @pastEvents = $self->session->db->buildArray("select productId from EventManagementSystem_registrations where returned=0 and badgeId=?",[$bid]); $self->session->scratch->delete('EMS_add_purchase_events'); $self->session->scratch->set('EMS_add_purchase_events',join("\n",@pastEvents)); $self->session->scratch->delete('EMS_scratch_cart'); diff --git a/lib/WebGUI/Operation/Commerce.pm b/lib/WebGUI/Operation/Commerce.pm index 046aae93f..79623b8d4 100644 --- a/lib/WebGUI/Operation/Commerce.pm +++ b/lib/WebGUI/Operation/Commerce.pm @@ -83,7 +83,7 @@ Clears the C scratch variable. sub _clearPaymentScratch { my $session = shift; - $session->scratch->set('paymentGateway', '-delete-'); + $session->scratch->delete('paymentGateway'); } #------------------------------------------------------------------- @@ -96,8 +96,8 @@ Clear the C and C scratch variables. sub _clearShippingScratch { my $session = shift; - $session->scratch->set('shippingMethod', '-delete-'); - $session->scratch->set('shippingOptions', '-delete-'); + $session->scratch->delete('shippingMethod'); + $session->scratch->delete('shippingOptions'); } #------------------------------------------------------------------- @@ -948,7 +948,7 @@ sub www_selectPaymentGatewaySave { if (WebGUI::Commerce::Payment->load($session, $paymentGateway)->enabled) { $session->scratch->set('paymentGateway', $paymentGateway); } else { - $session->scratch->set('paymentGateway', '-delete-'); + $session->scratch->delete('paymentGateway'); } return WebGUI::Operation::execute($session,'checkout'); @@ -1024,7 +1024,7 @@ sub www_selectShippingMethodSave { $session->scratch->set('shippingMethod', $shipping->namespace); $session->scratch->set('shippingOptions', Storable::freeze($shipping->getOptions)); } else { - $session->scratch->set('shippingMethod', '-delete-'); + $session->scratch->delete('shippingMethod'); } return WebGUI::Operation::execute($session,'checkout'); diff --git a/lib/WebGUI/Operation/ProductManager.pm b/lib/WebGUI/Operation/ProductManager.pm index 8dae737fb..38524b166 100755 --- a/lib/WebGUI/Operation/ProductManager.pm +++ b/lib/WebGUI/Operation/ProductManager.pm @@ -666,7 +666,7 @@ sub www_listProducts { $i18n = WebGUI::International->new($session, 'ProductManager'); - $session->scratch->set('managingProduct', '-delete-'); + $session->scratch->delete('managingProduct'); $sth = $session->db->read('select * from products order by title');