Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles

This commit is contained in:
2021-12-20 12:58:35 +01:00
22 changed files with 128 additions and 73 deletions

View File

@@ -17,7 +17,9 @@ use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity
* @ORM\Table(name="chill_main_address_reference")
* @ORM\Table(name="chill_main_address_reference", indexes={
* @ORM\Index(name="address_refid", columns={"refId"}, options={"where": "refid != ''"})
* })
* @ORM\HasLifecycleCallbacks
*/
class AddressReference

View File

@@ -80,7 +80,7 @@ class ScopePickerType extends AbstractType
{
$items = $this->authorizationHelper->getReachableScopes(
$this->security->getUser(),
$options['role']->getRole(),
$options['role'] instanceof Role ? $options['role']->getRole() : $options['role'],
$options['center']
);

View File

@@ -35,6 +35,7 @@ ul.record_actions {
}
ul.dropdown-menu {
z-index: 2000;
li {
display: block;
margin-right: 0;

View File

@@ -17,6 +17,7 @@ use DateTimeInterface;
use IntlDateFormatter;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use function array_key_exists;
@@ -36,15 +37,20 @@ class DateNormalizer implements ContextAwareNormalizerInterface, DenormalizerInt
public function denormalize($data, string $type, ?string $format = null, array $context = [])
{
if (null === $data) {
return null;
}
switch ($type) {
case DateTime::class:
return DateTime::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']);
case DateTimeInterface::class:
case DateTimeImmutable::class:
default:
return DateTimeImmutable::createFromFormat(DateTimeInterface::ISO8601, $data['datetime']);
}
throw new UnexpectedValueException();
}
public function normalize($date, ?string $format = null, array $context = [])

View File

@@ -0,0 +1,33 @@
<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Chill\Migrations\Main;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
final class Version20211216213649 extends AbstractMigration
{
public function down(Schema $schema): void
{
$this->addSql('DROP INDEX address_refid');
}
public function getDescription(): string
{
return 'add an index on address reference refid';
}
public function up(Schema $schema): void
{
$this->addSql('CREATE INDEX address_refid ON chill_main_address_reference (refId) WHERE refid != \'\'');
}
}