diff --git a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm index 87e0c8b44..9940dc6ed 100644 --- a/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm +++ b/lib/WebGUI/Asset/Wobject/EventManagementSystem.pm @@ -418,7 +418,6 @@ sub findSubEvents { my ($prerequisiteId, $productId) = split(':', $subEvent); push (@subEvents, $productId) unless (WebGUI::Utility::isIn($productId, @failedSubEvents)); } - print "
".Dumper(@subEvents)."
"; return \@subEvents; } @@ -545,6 +544,8 @@ sub resolveConflictForm { my $event1 = shift; my $event2 = shift; my $output; + my $extrasURL = $self->session->config->get("extrasURL"); + my $deleteIcon = $extrasURL."/toolbar/bullet/delete.gif"; my $sth = $self->session->db->read(" select productId, title, price, description @@ -553,17 +554,26 @@ sub resolveConflictForm { ); my $i18n = WebGUI::International->new($self->session, 'Asset_EventManagementSystem'); - $output = sprintf "", $i18n->get('scheduling conflict message'); + $output .= sprintf "
%s
", $i18n->get('scheduling conflict message'); + $output .= "hashRef) { $output .= ""; } - + $output .= ""; $output .= "
%s
"; - $output .= $self->session->icon->delete('op=deleteCartItem;itemType=Event;itemId='.$data->{productId}, $self->getUrl); + $output .= ""; $output .= ""; $output .= $data->{title}." ".$data->{description}." ".$data->{price}; $output .= "
"; $output .= sprintf "%s", $i18n->get('scheduling conflict continue'); + + # + # This will all be templated + # + return $output; } @@ -625,12 +635,13 @@ Method that will add an event to the users shopping cart. =cut sub www_addToCart { - my ($self, @pids, $output, $errors, $conflicts, $errorMessages); + my ($self, $pid, @pids, $output, $errors, $conflicts, $errorMessages); $self = shift; $conflicts = shift; + $pid = shift; # Check if conflicts were found that the user needs to fix - $output = join '', @{ $conflicts }; + $output = join '', @{ $conflicts } if defined $conflicts; unless ($output) { #Skip this if we have errors @@ -640,7 +651,7 @@ sub www_addToCart { #@pids = split("\n", $pids[0]); } else { # A single id, i.e., a master event - push(@pids, $self->session->form->get("pid")); + push(@pids, $self->session->form->get("pid") || $pid); } my $shoppingCart = WebGUI::Commerce::ShoppingCart->new($self->session); @@ -679,6 +690,26 @@ sub www_approveEvent { return $self->www_manageEvents; } +#------------------------------------------------------------------- +sub www_deleteCartItem { + my $self = shift; + my $event1 = $self->session->form->get("event1"); + my $event2 = $self->session->form->get("event2"); + my $eventUserDeleted = $self->session->form->get("productToRemove"); + my $cart = WebGUI::Commerce::ShoppingCart->new($self->session); + + # Delete all of the subevents last added by the user + $cart->delete($event1, 'Event'); + $cart->delete($event2, 'Event'); + + # Add the subevents back to the cart except for the one the user choose to remove. + # This will re-trigger the conflict/sub-event display code correctly + + my $eventToAdd = ($event1 eq $eventUserDeleted) ? $event2 : $event1; + + return $self->www_addToCart(undef,$eventToAdd); +} + #------------------------------------------------------------------- =head2 www_deleteEvent ( )