Merge branch 'master' into upgrade-php82

This commit is contained in:
2023-02-09 18:37:30 +01:00
43 changed files with 1152 additions and 122 deletions

View File

@@ -19,7 +19,7 @@ use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
final class JobAggregator implements AggregatorInterface
final class UserJobAggregator implements AggregatorInterface
{
private UserJobRepository $jobRepository;
@@ -40,11 +40,11 @@ final class JobAggregator implements AggregatorInterface
public function alterQuery(QueryBuilder $qb, $data)
{
if (!in_array('acpjob', $qb->getAllAliases(), true)) {
$qb->leftJoin('acp.job', 'acpjob');
if (!in_array('acpuser', $qb->getAllAliases(), true)) {
$qb->leftJoin('acp.user', 'acpuser');
}
$qb->addSelect('IDENTITY(acp.job) AS job_aggregator');
$qb->addSelect('IDENTITY(acpuser.userJob) AS job_aggregator');
$qb->addGroupBy('job_aggregator');
}

View File

@@ -72,6 +72,7 @@ class HasTemporaryLocationFilter implements FilterInterface
{
$builder
->add('having_temporarily', ChoiceType::class, [
'label' => 'export.filter.course.having_temporarily.label',
'choices' => [
'export.filter.course.having_temporarily.Having a temporarily location' => true,
'export.filter.course.having_temporarily.Having a person\'s location' => false,

View File

@@ -126,12 +126,4 @@ class UserJobFilter implements FilterInterface
{
return 'Filter by user job';
}
private function getUserJob(): UserJob
{
/** @var User $user */
$user = $this->security->getUser();
return $user->getUserJob();
}
}

View File

@@ -11,13 +11,12 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters;
use Chill\MainBundle\Entity\User;
use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\PickUserDynamicType;
use Chill\MainBundle\Templating\Entity\UserRender;
use Chill\PersonBundle\Export\Declarations;
use Doctrine\ORM\Query\Expr\Andx;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use function in_array;
@@ -61,13 +60,8 @@ class ReferrerFilter implements FilterInterface
public function buildForm(FormBuilderInterface $builder)
{
$builder->add('accepted_agents', EntityType::class, [
'class' => User::class,
'choice_label' => function (User $u) {
return $this->userRender->renderString($u, []);
},
$builder->add('accepted_agents', PickUserDynamicType::class, [
'multiple' => true,
'expanded' => true,
]);
}

View File

@@ -34,7 +34,7 @@
<script>
import VueMultiselect from 'vue-multiselect';
import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods';
import { fetchResults } from 'ChillMainAssets/lib/api/apiMethods';
import { mapState, mapGetters } from 'vuex';
export default {
@@ -58,23 +58,17 @@ export default {
},
methods: {
getOptions() {
const url = `/api/1.0/main/location.json`;
makeFetch('GET', url)
fetchResults(`/api/1.0/main/location.json`)
.then(response => {
let options = response.results;
let uniqueLocationTypeId = [...new Set(options.map(o => o.locationType.id))];
let uniqueLocationTypeId = [...new Set(response.map(o => o.locationType.id))];
let results = [];
for (let id of uniqueLocationTypeId) {
results.push({
locationCategories: options.filter(o => o.locationType.id === id)[0].locationType.title.fr,
locations: options.filter(o => o.locationType.id === id)
locationCategories: response.filter(o => o.locationType.id === id)[0].locationType.title.fr,
locations: response.filter(o => o.locationType.id === id)
})
}
this.options = results;
return response;
})
.catch((error) => {
this.$toast.open({message: error.txt})
})
},
updateAdminLocation(value) {

View File

@@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Serializer\Normalizer;
use Chill\BudgetBundle\Service\Summary\SummaryBudgetInterface;
use Chill\DocGeneratorBundle\Serializer\Helper\NormalizeNullValueHelper;
use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\Center;
use Chill\MainBundle\Entity\Civility;
use Chill\MainBundle\Templating\TranslatableStringHelper;
use Chill\PersonBundle\Entity\Household\Household;
@@ -87,6 +88,7 @@ class PersonDocGenNormalizer implements
$dateContext['docgen:expects'] = DateTimeInterface::class;
$addressContext = array_merge($context, ['docgen:expects' => Address::class]);
$phonenumberContext = array_merge($context, ['docgen:expects' => PhoneNumber::class]);
$centerContext = array_merge($context, ['docgen:expects' => Center::class]);
$personResourceContext = array_merge($context, [
'docgen:expects' => Person\PersonResource::class,
// we simplify the list of attributes for the embedded persons
@@ -139,6 +141,7 @@ class PersonDocGenNormalizer implements
'numberOfChildren' => (string) $person->getNumberOfChildren(),
'address' => $this->normalizer->normalize($person->getCurrentPersonAddress(), $format, $addressContext),
'resources' => $this->normalizer->normalize($person->getResources(), $format, $personResourceContext),
'center' => $this->normalizer->normalize($person->getCenter(), $format, $centerContext),
];
if ($context['docgen:person:with-household'] ?? false) {
@@ -240,6 +243,7 @@ class PersonDocGenNormalizer implements
$attributes = [
'id', 'firstName', 'lastName', 'age', 'altNames', 'text',
'center' => Center::class,
'civility' => Civility::class,
'birthdate' => DateTimeInterface::class,
'deathdate' => DateTimeInterface::class,

View File

@@ -13,16 +13,16 @@ namespace Chill\PersonBundle\Tests\Export\Aggregator\AccompanyingCourseAggregato
use Chill\MainBundle\Test\Export\AbstractAggregatorTest;
use Chill\PersonBundle\Entity\AccompanyingPeriod;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator;
use Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator;
use Doctrine\ORM\EntityManagerInterface;
/**
* @internal
* @coversNothing
*/
final class JobAggregatorTest extends AbstractAggregatorTest
final class UserJobAggregatorTest extends AbstractAggregatorTest
{
private JobAggregator $aggregator;
private UserJobAggregator $aggregator;
protected function setUp(): void
{

View File

@@ -40,6 +40,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
private const BLANK = [
'id' => '',
'center' => '',
'firstName' => '',
'lastName' => '',
'altNames' => '',
@@ -64,6 +65,7 @@ final class PersonDocGenNormalizerTest extends KernelTestCase
'numberOfChildren' => '',
'age' => '@ignored',
'resources' => [],
'center' => '@ignored',
];
private NormalizerInterface $normalizer;

View File

@@ -136,7 +136,7 @@ services:
- { name: chill.export_aggregator, alias: accompanyingcourse_scope_aggregator }
chill.person.export.aggregator_referrer_job:
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator
class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator
tags:
- { name: chill.export_aggregator, alias: accompanyingcourse_referrer_job_aggregator }

View File

@@ -1068,6 +1068,7 @@ export:
by_referrer:
Computation date for referrer: Date à laquelle le référent était actif
having_temporarily:
label: Qualité de la localisation
Having a temporarily location: Ayant une localisation temporaire
Having a person's location: Ayant une localisation auprès d'un usager
Calculation date: Date de la localisation