Skip to content

Commit

Permalink
edit roles in automatic shifts
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrodevog committed Oct 23, 2023
1 parent 073999f commit b4df856
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function addAction()

public function templateAction()
{
$form = $this->getForm('calendar_event_add');
$form = $this->getForm('calendar_event_schedule');
$shiftForm = $this->getForm('shift_shift_add');

if ($this->getRequest()->isPost()) {
Expand All @@ -104,6 +104,7 @@ public function templateAction()
$data = array(
'manager' => false,
'unit' => 3,
'edit_roles' => array('activiteiten',),
'event' => $event->getId(),
'location' => 2,
'nb_responsibles' => 0,
Expand Down
23 changes: 23 additions & 0 deletions module/CalendarBundle/Form/Admin/Event/Schedule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace CalendarBundle\Form\Admin\Event;

/**
* Add multiple standardized shifts at once; simplified version of add
*
* @author Pedro Devogelaere <[email protected]>
*/
class Schedule extends \CalendarBundle\Form\Admin\Event\Add
{
protected $hydrator = 'CalendarBundle\Hydrator\Node\Event';

public function init()
{
parent::init();

$this->remove('is_hidden')
->remove('is_career')
->remove('is_international');
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public function editAction()
public function scheduleAction()
{
$form = $this->getForm('cudi_sale_session_opening-hour_schedule');
$shiftForm = $this->getForm('shift_shift_schedule');
$registrationForm = $this->getForm('shift_registration-shift_schedule');
$shiftForm = $this->getForm('shift_shift_add');
$registrationForm = $this->getForm('shift_registration-shift_add');

$now = (new DateTime())->format('d/m/Y H:i');

Expand Down Expand Up @@ -160,6 +160,7 @@ public function scheduleAction()
(Er is altijd begeleiding dus wees niet bang als je voor de eerste keer komt ;))',
'manager' => false,
'unit' => 1,
'edit_roles' => array('cursusdienst',),
'event' => '',
'location' => 1,
'nb_responsibles' => 0,
Expand Down
4 changes: 2 additions & 2 deletions module/ShiftBundle/Entity/Shift.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ class Shift
private $points;

/**
* @var boolean Wheter or not the reward is payed at the event itself
* @var boolean Whether the reward is payed at the event itself
*
* @ORM\Column(name="handled_on_event", type="boolean")
*/
private $handledOnEvent;

/**
* @var boolean wheter or not a ticket is needed to do the shift
* @var boolean whether a ticket is needed to do the shift
*
* @ORM\Column(name="ticket_needed", type="boolean",options={"default" = false})
*/
Expand Down
14 changes: 0 additions & 14 deletions module/ShiftBundle/Form/Admin/RegistrationShift/Schedule.php

This file was deleted.

14 changes: 0 additions & 14 deletions module/ShiftBundle/Form/Admin/Shift/Schedule.php

This file was deleted.

2 changes: 2 additions & 0 deletions module/ShiftBundle/Hydrator/Shift.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ protected function doHydrate(array $data, $object = null)

$editRoles = array();
if (isset($data['edit_roles'])) {

Check failure on line 82 in module/ShiftBundle/Hydrator/Shift.php

View workflow job for this annotation

GitHub Actions / Lint

Blank line found at start of control structure

$roleRepository = $this->getEntityManager()
->getRepository('CommonBundle\Entity\Acl\Role');

foreach ($data['edit_roles'] as $editRole) {

Check failure on line 87 in module/ShiftBundle/Hydrator/Shift.php

View workflow job for this annotation

GitHub Actions / Lint

Blank line found at start of control structure

$editRoles[] = $roleRepository->findOneByName($editRole);
}
}
Expand Down
3 changes: 2 additions & 1 deletion module/ShopBundle/Controller/Admin/OpeningHourController.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function editAction()
public function scheduleAction()
{
$form = $this->getForm('shop_admin_session_opening-hour_schedule');
$shiftForm = $this->getForm('shift_shift_schedule');
$shiftForm = $this->getForm('shift_shift_add');

$monday = new DateTime(); // create DateTime object with current time
$monday->setISODate($monday->format('o'), $monday->format('W') + 1); // set object to Monday on next week
Expand All @@ -152,6 +152,7 @@ public function scheduleAction()
'description' => '',
'manager' => false,
'unit' => 2,
'edit_roles' => array('theokot',),
'event' => '',
'location' => 1,
'nb_responsibles' => 0,
Expand Down

0 comments on commit b4df856

Please sign in to comment.