diff --git a/module/CudiBundle/Controller/Admin/Sale/Session/OpeningHourController.php b/module/CudiBundle/Controller/Admin/Sale/Session/OpeningHourController.php index 0310b623ed..3ce35e17a3 100644 --- a/module/CudiBundle/Controller/Admin/Sale/Session/OpeningHourController.php +++ b/module/CudiBundle/Controller/Admin/Sale/Session/OpeningHourController.php @@ -148,19 +148,14 @@ public function scheduleAction() $startDate = $split[2] . ' ' . $startHour; $endDate = $split[2] . ' ' . $endHour; - // OPENING HOURS - $data = array(); - $data["start_date"] = $startDate; - $data["end_date"] = $endDate; - - $this->getEntityManager()->persist( - $form->getHydrator()->hydrate($data) - ); - - // SHIFTS $reward = $startHour == '12:30'? 2: 1; + $signoutDate = (DateTime::createFromFormat('d/m/Y', $split[2]))->modify('+1 day')->format('d/m/Y') . ' 00:00'; - $shift = array( + $data = array( + // OPENING HOURS + 'start_date' => $startDate, + 'end_date' => $endDate, + // SHIFTS 'name' => 'Boekjes verkopen', 'description' => 'Kom helpen met boeken verkopen. Leer nieuwe mensen kennen en kom de sfeer opsnuiven. (Er is altijd begeleiding dus wees niet bang als je voor de eerste keer komt ;))', @@ -168,46 +163,45 @@ public function scheduleAction() 'unit' => 1, 'event' => '', 'location' => 1, - 'start_date' => $startDate, - 'end_date' => $endDate, - 'nb_responsibles' => 1, + 'nb_responsibles' => 0, 'nb_volunteers' => $formData['volunteers_' . $startHour . '-' . $endHour . '_' . $split[2]], 'nb_volunteers_min' => $formData['volunteers-min_' . $startHour . '-' . $endHour . '_' . $split[2]], 'reward' => $reward, 'handled_on_event' => false, 'ticket_needed' => false, 'points' => 0, + // REGISTRATION SHIFTS + 'visible_date' => $now, + 'signout_date' => $signoutDate, + 'nb_registered' => 50, + 'members_only' => false, + 'members_visible' => true, + 'final_signin_date' => $startDate, + 'is_cudi_timeslot' => true, + ); + + // OPENING HOURS + $this->getEntityManager()->persist( + $form->getHydrator()->hydrate($data) ); + // SHIFTS $this->getEntityManager()->persist( - $shiftForm->getHydrator()->hydrate($shift) + $shiftForm->getHydrator()->hydrate($data) ); // REGISTRATION SHIFTS + $data['name'] = 'Boekenverkoop'; + $data['description'] = 'Kom je boeken ophalen ;)'; + $data['ticket_needed'] = true; $count = 0; $startHour_ = $startHour; // creating dummy variable that is updated - $signoutDate = (DateTime::createFromFormat('d/m/Y', $split[2]))->modify('+1 day')->format('d/m/Y') . ' 00:00'; - while ($count != 5 && $startHour_ != $endHour) { $nextTime = $this->calculateNextTime($startHour_); - $registration = array( - 'unit' => 1, - 'event' => '', - 'location' => 1, - 'start_date' => $split[2] . ' ' . $startHour_, - 'end_date' => $split[2] . ' ' . $nextTime, - 'visible_date' => $now, - 'signout_date' => $signoutDate, - 'nb_registered' => 50, - 'name' => 'Boekenverkoop', - 'description' => 'Kom je boeken ophalen ;)', - 'ticket_needed' => true, - 'members_only' => false, - 'members_visible' => true, - 'final_signin_date' => $startDate, - 'is_cudi_timeslot' => true, - ); + $data['start_date'] = $split[2] . ' ' . $startHour_; + $data['end_date'] = $split[2] . ' ' . $nextTime; + $this->getEntityManager()->persist( - $registrationForm->getHydrator()->hydrate($registration) + $registrationForm->getHydrator()->hydrate($data) ); $startHour_ = $nextTime; diff --git a/module/CudiBundle/Hydrator/Sale/Session/OpeningHour.php b/module/CudiBundle/Hydrator/Sale/Session/OpeningHour.php index 2476aa1ec0..fa5bd50ea1 100644 --- a/module/CudiBundle/Hydrator/Sale/Session/OpeningHour.php +++ b/module/CudiBundle/Hydrator/Sale/Session/OpeningHour.php @@ -32,7 +32,6 @@ protected function doHydrate(array $data, $object = null) if ($object === null) { $object = new OpeningHourEntity($this->getPersonEntity()); } - error_log(json_encode($data)); $object->setStart(self::loadDateTime($data['start_date'])) ->setEnd(self::loadDateTime($data['end_date']));