This commit is contained in:
Matthew Wilson 2006-05-10 08:09:14 +00:00
parent ace5f5dc63
commit 77179e6069

View file

@ -1841,12 +1841,12 @@ sub www_viewPurchase {
$var{canReturnTransaction} = 0;
my $sql2 = "select r.registrationId, p.title, p.description, p.price, p.templateId, r.returned, e.approved, e.maximumAttendees, e.startDate, e.endDate, b.userId, b.createdByUserId, e.productId from EventManagementSystem_registrations as r, EventManagementSystem_badges as b, EventManagementSystem_products as e, EventManagementSystem_purchases as z, products as p, transaction where p.productId = r.productId and p.productId = e.productId and r.badgeId=b.badgeId and r.purchaseId=z.purchaseId and r.badgeId=? and transaction.transactionId=z.transactionId and transaction.status='Completed' group by r.registrationId order by b.lastName";
my $sth2 = $self->session->db->read($sql2,[$badgeId]);
my $purchase = {};
$purchase->{regLoop} = [];
$purchase->{canReturnItinerary} = 0;
while (my $reg = $sth2->hashRef) {
$reg->{startDateHuman} = $self->session->datetime->epochToHuman($reg->{'startDate'});
$reg->{endDateHuman} = $self->session->datetime->epochToHuman($reg->{'endDate'});
$purchase->{canReturnItinerary} = 1 unless $reg->{'returned'};
$purchase->{canAddEvents} = 1 if ($isAdmin || ($userId eq $self->session->var->get('userId')) || ($reg->{userId} eq $self->session->var->get('userId')) || ($reg->{createdByUserId} eq $self->session->var->get('userId')));
my ($isMainEvent) = $self->session->db->quickArray("select productId from EventManagementSystem_products where productId = ? and (prerequisiteId is NULL or prerequisiteId = '')",[$reg->{productId}]);
$purchase->{purchaseEventId} = $reg->{productId} if $isMainEvent;