Merge branch 'master' into VSR-issues

This commit is contained in:
2023-01-24 15:36:22 +01:00
201 changed files with 2768 additions and 708 deletions

View File

@@ -13,12 +13,13 @@ namespace Chill\PersonBundle\Controller;
use Chill\MainBundle\CRUD\Controller\ApiController;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Chill\PersonBundle\Security\AuthorizedCenterOnPersonCreationInterface;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@@ -26,16 +27,37 @@ use function in_array;
class PersonApiController extends ApiController
{
private AuthorizationHelper $authorizationHelper;
private AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation;
private ConfigPersonAltNamesHelper $configPersonAltNameHelper;
private bool $showCenters;
public function __construct(
AuthorizationHelper $authorizationHelper,
ConfigPersonAltNamesHelper $configPersonAltNameHelper
AuthorizedCenterOnPersonCreationInterface $authorizedCenterOnPersonCreation,
ConfigPersonAltNamesHelper $configPersonAltNameHelper,
ParameterBagInterface $parameterBag
) {
$this->authorizationHelper = $authorizationHelper;
$this->authorizedCenterOnPersonCreation = $authorizedCenterOnPersonCreation;
$this->configPersonAltNameHelper = $configPersonAltNameHelper;
$this->showCenters = $parameterBag->get('chill_main')['acl']['form_show_centers'];
}
/**
* @Route("/api/1.0/person/creation/authorized-centers",
* name="chill_person_person_creation_authorized_centers"
* )
*/
public function authorizedCentersForCreation(): Response
{
$centers = $this->authorizedCenterOnPersonCreation->getCenters();
return $this->json(
['showCenters' => $this->showCenters, 'centers' => $centers],
Response::HTTP_OK,
[],
['gropus' => ['read']]
);
}
/**

View File

@@ -13,10 +13,25 @@ namespace Chill\PersonBundle\Controller\SocialWork;
use Chill\MainBundle\CRUD\Controller\CRUDController;
use Chill\MainBundle\Pagination\PaginatorInterface;
use LogicException;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\Request;
class SocialIssueController extends CRUDController
{
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{
if ('new' === $action) {
return parent::createFormFor($action, $entity, $formClass, ['step' => 'create']);
}
if ('edit' === $action) {
return parent::createFormFor($action, $entity, $formClass, ['step' => 'edit']);
}
throw new LogicException('action is not supported: ' . $action);
}
protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
{
$query->addOrderBy('e.ordering', 'ASC');