Loading module/Oscar/src/Oscar/Controller/ActivityDateController.php +22 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,25 @@ class ActivityDateController extends AbstractOscarController implements UseServi } } protected function milestonesPutFlow( array $datas, Activity $activity ): Response { try { foreach ($datas['elements'] as $element) { $this->getMilestoneService()->createFromArray( [ 'type_id' => $element['datetype_id'], 'comment' => "", 'dateStart' => $element['date'], 'activity_id' => $activity->getId() ] ); } return $this->getResponseOk(); }catch (\Exception $exception){ return $this->jsonError($exception->getMessage()); } } protected function milestonesActivityPut(Activity $activity): JsonModel|Response { $this->getLoggerService()->debug(__METHOD__); Loading Loading @@ -169,6 +188,9 @@ class ActivityDateController extends AbstractOscarController implements UseServi $this->getOscarUserContextService()->check(Privileges::ACTIVITY_MILESTONE_MANAGE, $activity); try { $datas = $this->getJsonREST(); if( $datas['action'] == 'flow' ){ return $this->milestonesPutFlow($datas['datas'], $activity); } $this->getMilestoneService()->createFromArray( [ 'type_id' => $datas['type']['id'], Loading module/Oscar/src/Oscar/Controller/ProjectGrantController.php +10 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ namespace Oscar\Controller; use BjyAuthorize\Exception\UnAuthorizedException; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\NoResultException; use Elasticsearch\Common\Exceptions\BadRequest400Exception; Loading Loading @@ -80,6 +81,8 @@ use Laminas\Mvc\Console\View\Renderer; use Laminas\View\Model\JsonModel; use Laminas\View\Model\ViewModel; use Laminas\View\Renderer\PhpRenderer; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenSignature\Provider\SignaturePrivileges; use UnicaenSignature\Service\SignatureService; use UnicaenSignature\Service\SignatureServiceAwareTrait; Loading Loading @@ -841,6 +844,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif public function editAction() { $id = $this->params()->fromRoute('id'); $numerotationKeys = $this->getEditableConfKey('numerotation', []); $numerotationEditable = $this->getOscarConfigurationService()->getNumerotationEditable(); Loading Loading @@ -1803,6 +1807,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } /** * @throws NotFoundExceptionInterface * @throws OscarException * @throws ContainerExceptionInterface * @throws NotSupported */ public function show2Action() { $method = $this->getHttpXMethod(); Loading module/Oscar/src/Oscar/Entity/ActivityDateFlow.php +3 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ class ActivityDateFlow $this->description = $description; } /** * @return Collection<ActivityDateFlowElement> */ public function getElements(): Collection { return $this->elements; Loading module/Oscar/src/Oscar/Entity/DateType.php +1 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ class DateType implements ITrackable 'id' => $this->getId(), 'label' => $this->getLabel(), 'facet' => $this->getFacet(), 'finishable' => $this->isFinishable(), 'description' => $this->getDescription(), 'recursivity' => $this->getRecursivityArray() ]; Loading module/Oscar/src/Oscar/Entity/Repository/ActivityDateFlowRepository.php +26 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Oscar\Entity\Repository; use Doctrine\ORM\EntityRepository; use Oscar\Entity\ActivityDateFlow; class ActivityDateFlowRepository extends EntityRepository { Loading @@ -21,6 +22,7 @@ class ActivityDateFlowRepository extends EntityRepository */ public function getAuthFlow( ?int $authId = null ) { $out = []; $query = $this->createQueryBuilder('f'); $query->where('f.public = TRUE'); Loading @@ -29,6 +31,29 @@ class ActivityDateFlowRepository extends EntityRepository $query->setParameter('authId', $authId); } return $query->getQuery()->getArrayResult(); $datas = $query->getQuery()->getResult(); /** @var ActivityDateFlow $flow */ foreach ($datas as $flow) { $elements = []; foreach ($flow->getElements() as $element) { $elements[] = [ 'id' => $element->getId(), 'interval' => $element->getDaysInterval(), 'datetype_id' => $element->getDateType()->getId(), 'datetype' => $element->getDateType()->toArray(), ]; } $out[] = [ 'id' => $flow->getId(), 'mine' => $flow->getCreatedBy() == $authId, 'label' => $flow->getLabel(), 'description' => $flow->getDescription(), 'createdBy' => $flow->getCreatedBy(), 'public' => $flow->getPublic(), 'datetypes' => $elements ]; } return $out; } } Loading
module/Oscar/src/Oscar/Controller/ActivityDateController.php +22 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,25 @@ class ActivityDateController extends AbstractOscarController implements UseServi } } protected function milestonesPutFlow( array $datas, Activity $activity ): Response { try { foreach ($datas['elements'] as $element) { $this->getMilestoneService()->createFromArray( [ 'type_id' => $element['datetype_id'], 'comment' => "", 'dateStart' => $element['date'], 'activity_id' => $activity->getId() ] ); } return $this->getResponseOk(); }catch (\Exception $exception){ return $this->jsonError($exception->getMessage()); } } protected function milestonesActivityPut(Activity $activity): JsonModel|Response { $this->getLoggerService()->debug(__METHOD__); Loading Loading @@ -169,6 +188,9 @@ class ActivityDateController extends AbstractOscarController implements UseServi $this->getOscarUserContextService()->check(Privileges::ACTIVITY_MILESTONE_MANAGE, $activity); try { $datas = $this->getJsonREST(); if( $datas['action'] == 'flow' ){ return $this->milestonesPutFlow($datas['datas'], $activity); } $this->getMilestoneService()->createFromArray( [ 'type_id' => $datas['type']['id'], Loading
module/Oscar/src/Oscar/Controller/ProjectGrantController.php +10 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ namespace Oscar\Controller; use BjyAuthorize\Exception\UnAuthorizedException; use Doctrine\ORM\Exception\NotSupported; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\NoResultException; use Elasticsearch\Common\Exceptions\BadRequest400Exception; Loading Loading @@ -80,6 +81,8 @@ use Laminas\Mvc\Console\View\Renderer; use Laminas\View\Model\JsonModel; use Laminas\View\Model\ViewModel; use Laminas\View\Renderer\PhpRenderer; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenSignature\Provider\SignaturePrivileges; use UnicaenSignature\Service\SignatureService; use UnicaenSignature\Service\SignatureServiceAwareTrait; Loading Loading @@ -841,6 +844,7 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif public function editAction() { $id = $this->params()->fromRoute('id'); $numerotationKeys = $this->getEditableConfKey('numerotation', []); $numerotationEditable = $this->getOscarConfigurationService()->getNumerotationEditable(); Loading Loading @@ -1803,6 +1807,12 @@ class ProjectGrantController extends AbstractOscarController implements UseNotif ]; } /** * @throws NotFoundExceptionInterface * @throws OscarException * @throws ContainerExceptionInterface * @throws NotSupported */ public function show2Action() { $method = $this->getHttpXMethod(); Loading
module/Oscar/src/Oscar/Entity/ActivityDateFlow.php +3 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ class ActivityDateFlow $this->description = $description; } /** * @return Collection<ActivityDateFlowElement> */ public function getElements(): Collection { return $this->elements; Loading
module/Oscar/src/Oscar/Entity/DateType.php +1 −0 Original line number Diff line number Diff line Loading @@ -188,6 +188,7 @@ class DateType implements ITrackable 'id' => $this->getId(), 'label' => $this->getLabel(), 'facet' => $this->getFacet(), 'finishable' => $this->isFinishable(), 'description' => $this->getDescription(), 'recursivity' => $this->getRecursivityArray() ]; Loading
module/Oscar/src/Oscar/Entity/Repository/ActivityDateFlowRepository.php +26 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Oscar\Entity\Repository; use Doctrine\ORM\EntityRepository; use Oscar\Entity\ActivityDateFlow; class ActivityDateFlowRepository extends EntityRepository { Loading @@ -21,6 +22,7 @@ class ActivityDateFlowRepository extends EntityRepository */ public function getAuthFlow( ?int $authId = null ) { $out = []; $query = $this->createQueryBuilder('f'); $query->where('f.public = TRUE'); Loading @@ -29,6 +31,29 @@ class ActivityDateFlowRepository extends EntityRepository $query->setParameter('authId', $authId); } return $query->getQuery()->getArrayResult(); $datas = $query->getQuery()->getResult(); /** @var ActivityDateFlow $flow */ foreach ($datas as $flow) { $elements = []; foreach ($flow->getElements() as $element) { $elements[] = [ 'id' => $element->getId(), 'interval' => $element->getDaysInterval(), 'datetype_id' => $element->getDateType()->getId(), 'datetype' => $element->getDateType()->toArray(), ]; } $out[] = [ 'id' => $flow->getId(), 'mine' => $flow->getCreatedBy() == $authId, 'label' => $flow->getLabel(), 'description' => $flow->getDescription(), 'createdBy' => $flow->getCreatedBy(), 'public' => $flow->getPublic(), 'datetypes' => $elements ]; } return $out; } }