From f056701c04ddcf553e6263430e393dcea38bb7b2 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Wed, 10 May 2006 13:38:13 +0000 Subject: [PATCH] addition to delete duplicate entries. --- lib/WebGUI/Commerce/Item/Event.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/WebGUI/Commerce/Item/Event.pm b/lib/WebGUI/Commerce/Item/Event.pm index 5fe275cd0..8b355bb1d 100644 --- a/lib/WebGUI/Commerce/Item/Event.pm +++ b/lib/WebGUI/Commerce/Item/Event.pm @@ -48,6 +48,11 @@ sub handler { my $purchaseId; if ($purchaseId = $self->session->scratch->get("purchaseId".$counter)) { $self->session->db->setRow('EventManagementSystem_purchases', 'purchaseId', {'purchaseId'=>$purchaseId, 'transactionId'=>$transactionId}, $purchaseId); + my $theseRegs = $self->session->db->buildArrayRefOfHashRefs("select * from EventManagementSystem_registrations where purchaseId=?",[$purchaseId]); + foreach (@$theseRegs) { + # clean up the duplicate registrations, if any. + $self->session->db->write("delete from EventManagementSystem_registrations where badgeId=? and productId=? and registrationId!=?,[$_->{badgeId},$_->{productId},$_->{registrationId}]); + } $self->session->scratch->delete("purchaseId".$counter); $counter++; }