Merge remote-tracking branch 'origin/master' into issue517_extend_document_to_person_vendee

This commit is contained in:
2022-03-21 16:20:03 +01:00
39 changed files with 767 additions and 123 deletions

View File

@@ -26,6 +26,7 @@ use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Validator\Validator\ValidatorInterface;
use function count;
use function strlen;
class LoadPostalCodesCommand extends Command
{
@@ -118,6 +119,13 @@ class LoadPostalCodesCommand extends Command
private function addPostalCode($row, OutputInterface $output)
{
if ('FR' === $row[2] && strlen($row[0]) === 4) {
// CP in FRANCE are on 5 digit
// For CP starting with a zero, the starting zero can be remove if stored as number in a csv
// add a zero if CP from FR and on 4 digit
$row[0] = '0' . $row[0];
}
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
$output->writeln('handling row: ' . $row[0] . ' | ' . $row[1] . ' | ' . $row[2]);
}

View File

@@ -27,7 +27,7 @@
</a>
{% for menu in menus %}
<a class="list-group-item list-group-item-action" href="{{ menu.uri }}">
{{ menu.label|upper }}
{{ menu.label|trans|upper }}
</a>
{% endfor %}
</div>

View File

@@ -1,60 +1,62 @@
{% extends '@ChillMain/Admin/Permission/layout_crud_permission_index.html.twig' %}
{% block admin_content -%}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>{{ 'crud.admin_user.index.is_active'|trans }}</th>
<th>{{ 'crud.admin_user.index.usernames'|trans }}</th>
<th>{{ 'crud.admin_user.index.mains'|trans }}</th>
<th>&nbsp;</th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr data-username="{{ entity.username|e('html_attr') }}">
<td>
<h1>{{"Users"|trans}}</h1>
{% for entity in entities %}
<div class="flex-table">
<div class="item-bloc">
<div class="item-row">
<div class="item-col">
{{ entity.label }}
{% if entity.isEnabled %}
<i class="fa fa-check chill-green"></i>
{% else %}
<i class="fa fa-times chill-red"></i>
{% endif %}
</td>
<td>
{{ entity.username }}
<br/>
{{ entity.label }}
<br/>
{{ entity.email }}
</td>
<td>
</div>
<div class="item-col"><i>{{ entity.email }}</i></div>
</div>
<div class="item-row">
<div class="item-col">
login: {{ entity.username|e('html_attr') }}
</div>
<div class="item-col">
{% if entity.userJob %}
{{ entity.userJob.label|localize_translatable_string }}
<br/>
{{ entity.userJob.label|localize_translatable_string }}
{% endif %}
</div>
</div>
<div class="item-row">
<div class="item-col">
{% if entity.mainScope %}
{{ entity.mainScope.name|localize_translatable_string }}
<br/>
{{ entity.mainScope.name|localize_translatable_string }}
{% endif %}
{% if entity.mainCenter %}
{{ entity.mainCenter.name }}
, {{ entity.mainCenter.name }}
{% endif %}
</td>
<td>
<ul class="record_actions">
</div>
</div>
<div class="item-row">
<ul class="record_actions">
<li>
<a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
</li>
<li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li>
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li>
<a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
</li>
<li>
<a class="btn btn-chill-red" href="{{ path('admin_user_edit_password', { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
</li>
{% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
<li>
<a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% endembed %}
{% endblock %}
{% endif %}
</ul>
</div>
</div>
</div>
{% endfor %}
{{ chill_pagination(paginator) }}
{% endblock %}

View File

@@ -18,7 +18,6 @@ use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
use Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface;
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class PhonenumberNormalizer implements ContextAwareNormalizerInterface, DenormalizerInterface
{
@@ -54,7 +53,7 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
public function normalize($object, ?string $format = null, array $context = []): string
{
if ($format === 'docgen' && null === $object) {
if ('docgen' === $format && null === $object) {
return '';
}
@@ -68,13 +67,13 @@ class PhonenumberNormalizer implements ContextAwareNormalizerInterface, Denormal
public function supportsNormalization($data, ?string $format = null, array $context = []): bool
{
if ($data instanceof PhoneNumber && $format === 'json') {
if ($data instanceof PhoneNumber && 'json' === $format) {
return true;
}
if ($format === 'docgen' && (
if ('docgen' === $format && (
$data instanceof PhoneNumber || PhoneNumber::class === ($context['docgen:expects'] ?? null)
)) {
)) {
return true;
}

View File

@@ -100,10 +100,8 @@ final class UserControllerTest extends WebTestCase
$crawler = $this->client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(
0,
$crawler->filter('td:contains("Test_user")')->count(),
'Missing element td:contains("Test user")'
$this->assertStringContainsString(
"Test_user", $crawler->text(), "page contains the name of the user"
);
//test the auth of the new client
@@ -125,11 +123,7 @@ final class UserControllerTest extends WebTestCase
$this->client->submit($form);
$crawler = $this->client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(
0,
$crawler->filter('[data-username="' . $username . '"]')->count(),
'Missing element [data-username="Foo bar"]'
);
$this->assertResponseIsSuccessful();
}
/**