diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php index 79ccc0d..d477cad 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/EventController.php @@ -156,16 +156,17 @@ class EventController extends Controller { $entity = new Event(); - $em = $this->saveEvent($request, $entity); - - - $errors = $entity->isValid(); - if ($errors === true) { - $em = $this->getDoctrine()->getManager(); - $em->persist($entity); - $em->flush(); - - return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug))); + if (! $request->get('origin')) { + $em = $this->saveEvent($request, $entity); + $errors = $entity->isValid(); + if ( $errors === true ) { + $em = $this->getDoctrine()->getManager(); + $em->persist($entity); + $em->flush(); + return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug))); + } + } else { + return $this->redirect($this->generateUrl('')); } return array( @@ -284,16 +285,18 @@ class EventController extends Controller throw $this->createNotFoundException('Unable to find Event entity.'); } - $em = $this->saveEvent($request, $entity); $errors = $entity->isValid(); - if ($errors === true) { + if ($errors === true && (! $request->get('origin'))) { + $em = $this->saveEvent($request, $entity); $em = $this->getDoctrine()->getManager(); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('_show', array('slug' => $entity->slug))); + } else { + return $this->redirect($this->generateUrl('')); } return array( diff --git a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php index 28b1341..50ad4fb 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php +++ b/src/Hackspace/Bundle/CalciferBundle/Controller/RepeatingEventController.php @@ -178,6 +178,9 @@ class RepeatingEventController extends Controller private function saveRepeatingEvent(Request $request, RepeatingEvent $entity) { + if ( $request->get('origin')) { + return false; + } $location = $request->get('location'); $location_lat = $request->get('location_lat'); $location_lon = $request->get('location_lon'); diff --git a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig index e584fe3..c502296 100755 --- a/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig +++ b/src/Hackspace/Bundle/CalciferBundle/Resources/views/Event/event_form.html.twig @@ -147,7 +147,22 @@ +