mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Merge remote-tracking branch 'origin/master' into issue185_ACCent_createdBy_updatedBy
This commit is contained in:
@@ -104,6 +104,9 @@ class Configuration implements ConfigurationInterface
|
||||
->booleanNode('form_show_scopes')
|
||||
->defaultTrue()
|
||||
->end()
|
||||
->booleanNode('form_show_centers')
|
||||
->defaultTrue()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('redis')
|
||||
|
@@ -6,12 +6,12 @@ import App from './App.vue';
|
||||
const i18n = _createI18n(addressMessages);
|
||||
|
||||
const addAddressInput = (inputs) => {
|
||||
|
||||
console.log(inputs)
|
||||
inputs.forEach(el => {
|
||||
let
|
||||
addressId = el.value,
|
||||
uniqid = el.dataset.inputAddress,
|
||||
container = document.querySelector('div[data-input-address-container="' + uniqid + '"]'),
|
||||
container = el.parentNode.querySelector('div[data-input-address-container="' + uniqid + '"]'),
|
||||
isEdit = addressId !== '',
|
||||
addressIdInt = addressId !== '' ? parseInt(addressId) : null
|
||||
;
|
||||
|
@@ -45,7 +45,8 @@ const messages = {
|
||||
redirect: {
|
||||
person: "Quitter la page et ouvrir la fiche de l'usager",
|
||||
thirdparty: "Quitter la page et voir le tiers",
|
||||
}
|
||||
},
|
||||
refresh: 'Rafraîchir'
|
||||
},
|
||||
nav: {
|
||||
next: "Suivant",
|
||||
|
@@ -58,6 +58,13 @@
|
||||
|
||||
{% macro inline(address, options) %}
|
||||
{% if options['has_no_address'] == true and address.isNoAddress == true %}
|
||||
{% if address.postCode is not empty %}
|
||||
<p class="postcode">
|
||||
<span class="code">{{ address.postCode.code }}</span>
|
||||
<span class="name">{{ address.postCode.name }}</span>
|
||||
</p>
|
||||
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
|
||||
{% endif %}
|
||||
<span class="noaddress">
|
||||
{{ 'address.consider homeless'|trans }}
|
||||
</span>
|
||||
@@ -108,9 +115,19 @@
|
||||
{%- if render == 'bloc' -%}
|
||||
<div class="chill-entity entity-address">
|
||||
{% if options['has_no_address'] == true and address.isNoAddress == true %}
|
||||
{% if address.postCode is not empty %}
|
||||
<div class="address{% if options['multiline'] %} multiline{% endif %}{% if options['with_delimiter'] %} delimiter{% endif %}">
|
||||
<p class="postcode">
|
||||
<span class="code">{{ address.postCode.code }}</span>
|
||||
<span class="name">{{ address.postCode.name }}</span>
|
||||
</p>
|
||||
<p class="country">{{ address.postCode.country.name|localize_translatable_string }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="noaddress">
|
||||
{{ 'address.consider homeless'|trans }}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<div class="address{% if options['multiline'] %} multiline{% endif %}{% if options['with_delimiter'] %} delimiter{% endif %}">
|
||||
{% if options['with_picto'] %}
|
||||
|
@@ -10,30 +10,32 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if form.checkboxes|length > 0 %}
|
||||
{% for checkbox_name, options in form.checkboxes %}
|
||||
<div class="row gx-0">
|
||||
<div class="col-md-12">
|
||||
{% for c in form['checkboxes'][checkbox_name].children %}
|
||||
<div class="form-check form-check-inline">
|
||||
{{ form_widget(c) }}
|
||||
{{ form_label(c) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% if loop.last %}
|
||||
{% if form.checkboxes is defined %}
|
||||
{% if form.checkboxes|length > 0 %}
|
||||
{% for checkbox_name, options in form.checkboxes %}
|
||||
<div class="row gx-0">
|
||||
<div class="col-md-12">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-misc"><i class="fa fa-filter"></i></button>
|
||||
</li>
|
||||
</ul>
|
||||
{% for c in form['checkboxes'][checkbox_name].children %}
|
||||
<div class="form-check form-check-inline">
|
||||
{{ form_widget(c) }}
|
||||
{{ form_label(c) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if loop.last %}
|
||||
<div class="row gx-0">
|
||||
<div class="col-md-12">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-misc"><i class="fa fa-filter"></i></button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{{ form_end(form) }}
|
||||
|
@@ -88,13 +88,13 @@ class SearchApi
|
||||
|
||||
private function buildCountQuery(array $queries, $types, $parameters)
|
||||
{
|
||||
$query = "SELECT COUNT(sq.key) AS count FROM ({union_unordered}) AS sq";
|
||||
$query = "SELECT COUNT(*) AS count FROM ({union_unordered}) AS sq";
|
||||
$unions = [];
|
||||
$parameters = [];
|
||||
|
||||
foreach ($queries as $q) {
|
||||
$unions[] = $q->buildQuery();
|
||||
$parameters = \array_merge($parameters, $q->buildParameters());
|
||||
$unions[] = $q->buildQuery(true);
|
||||
$parameters = \array_merge($parameters, $q->buildParameters(true));
|
||||
}
|
||||
|
||||
$unionUnordered = \implode(" UNION ", $unions);
|
||||
|
@@ -76,33 +76,58 @@ class SearchApiQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function buildQuery(): string
|
||||
public function buildQuery(bool $countOnly = false): string
|
||||
{
|
||||
$where = \implode(' AND ', $this->whereClauses);
|
||||
$isMultiple = count($this->whereClauses);
|
||||
$where =
|
||||
($isMultiple ? '(' : '').
|
||||
\implode(
|
||||
($isMultiple ? ')' : '').' AND '.($isMultiple ? '(' : '')
|
||||
, $this->whereClauses).
|
||||
($isMultiple ? ')' : '')
|
||||
;
|
||||
|
||||
return \strtr("SELECT
|
||||
if (!$countOnly) {
|
||||
$select = \strtr("
|
||||
'{key}' AS key,
|
||||
{metadata} AS metadata,
|
||||
{pertinence} AS pertinence
|
||||
FROM {from}
|
||||
WHERE {where}
|
||||
", [
|
||||
'{key}' => $this->selectKey,
|
||||
'{metadata}' => $this->jsonbMetadata,
|
||||
'{pertinence}' => $this->pertinence,
|
||||
]);
|
||||
} else {
|
||||
$select = "1 AS c";
|
||||
}
|
||||
|
||||
return \strtr("SELECT
|
||||
{select}
|
||||
FROM {from}
|
||||
WHERE {where}
|
||||
", [
|
||||
'{key}' => $this->selectKey,
|
||||
'{metadata}' => $this->jsonbMetadata,
|
||||
'{pertinence}' => $this->pertinence,
|
||||
'{select}' => $select,
|
||||
'{from}' => $this->fromClause,
|
||||
'{where}' => $where,
|
||||
]);
|
||||
}
|
||||
|
||||
public function buildParameters(): array
|
||||
|
||||
public function buildParameters(bool $countOnly = false): array
|
||||
{
|
||||
return \array_merge(
|
||||
$this->selectKeyParams,
|
||||
$this->jsonbMetadataParams,
|
||||
$this->pertinenceParams,
|
||||
$this->fromClauseParams,
|
||||
\array_merge([], ...$this->whereClausesParams),
|
||||
);
|
||||
if (!$countOnly) {
|
||||
return \array_merge(
|
||||
$this->selectKeyParams,
|
||||
$this->jsonbMetadataParams,
|
||||
$this->pertinenceParams,
|
||||
$this->fromClauseParams,
|
||||
\array_merge([], ...$this->whereClausesParams),
|
||||
);
|
||||
} else {
|
||||
return \array_merge(
|
||||
$this->fromClauseParams,
|
||||
\array_merge([], ...$this->whereClausesParams),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,7 +30,6 @@ trait PrepareClientTrait
|
||||
*
|
||||
* @param string $username the username (default 'center a_social')
|
||||
* @param string $password the password (default 'password')
|
||||
* @return \Symfony\Component\BrowserKit\Client
|
||||
* @throws \LogicException
|
||||
*/
|
||||
public function getClientAuthenticated(
|
||||
|
@@ -20,7 +20,12 @@ class SearchApiQueryTest extends TestCase
|
||||
|
||||
$query = $q->buildQuery();
|
||||
|
||||
$this->assertStringContainsString('foo AND bar', $query);
|
||||
$this->assertStringContainsString('(foo) AND (bar)', $query);
|
||||
$this->assertEquals(['alpha', 'beta'], $q->buildParameters());
|
||||
|
||||
$query = $q->buildQuery(true);
|
||||
|
||||
$this->assertStringContainsString('(foo) AND (bar)', $query);
|
||||
$this->assertEquals(['alpha', 'beta'], $q->buildParameters());
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,18 @@ class DateRangeCoveringTest extends TestCase
|
||||
$this->assertNotContains(3, $cover->getIntersections()[0][2]);
|
||||
}
|
||||
|
||||
public function testCoveringWithMinCover1_NoCoveringWithNullDates()
|
||||
{
|
||||
$cover = new DateRangeCovering(1, new \DateTimeZone('Europe/Brussels'));
|
||||
$cover
|
||||
->add(new \DateTime('2021-10-05'), new \DateTime('2021-10-18'), 521)
|
||||
->add(new \DateTime('2021-10-26'), null, 663)
|
||||
->compute()
|
||||
;
|
||||
|
||||
$this->assertFalse($cover->hasIntersections());
|
||||
}
|
||||
|
||||
public function testCoveringWithMinCover1WithTwoIntersections()
|
||||
{
|
||||
$cover = new DateRangeCovering(1, new \DateTimeZone('Europe/Brussels'));
|
||||
|
@@ -140,67 +140,6 @@ class DateRangeCovering
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function process(array $intersections): array
|
||||
{
|
||||
$result = [];
|
||||
$starts = [];
|
||||
$ends = [];
|
||||
$metadatas = [];
|
||||
|
||||
while (null !== ($current = \array_pop($intersections))) {
|
||||
list($cStart, $cEnd, $cMetadata) = $current;
|
||||
$n = count($cMetadata);
|
||||
|
||||
foreach ($intersections as list($iStart, $iEnd, $iMetadata)) {
|
||||
$start = max($cStart, $iStart);
|
||||
$end = min($cEnd, $iEnd);
|
||||
|
||||
if ($start <= $end) {
|
||||
if (FALSE !== ($key = \array_search($start, $starts))) {
|
||||
if ($ends[$key] === $end) {
|
||||
$metadatas[$key] = \array_unique(\array_merge($metadatas[$key], $iMetadata));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$starts[] = $start;
|
||||
$ends[] = $end;
|
||||
$metadatas[] = \array_unique(\array_merge($iMetadata, $cMetadata));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// recompose results
|
||||
foreach ($starts as $k => $start) {
|
||||
$result[] = [$start, $ends[$k], \array_unique($metadatas[$k])];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function addToIntersections(array $intersections, array $intersection)
|
||||
{
|
||||
$foundExisting = false;
|
||||
list($nStart, $nEnd, $nMetadata) = $intersection;
|
||||
|
||||
\array_walk($intersections,
|
||||
function(&$i, $key) use ($nStart, $nEnd, $nMetadata, $foundExisting) {
|
||||
if ($foundExisting) {
|
||||
return;
|
||||
};
|
||||
if ($i[0] === $nStart && $i[1] === $nEnd) {
|
||||
$foundExisting = true;
|
||||
$i[2] = \array_merge($i[2], $nMetadata);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
if (!$foundExisting) {
|
||||
$intersections[] = $intersection;
|
||||
}
|
||||
|
||||
return $intersections;
|
||||
}
|
||||
|
||||
public function hasIntersections(): bool
|
||||
{
|
||||
if (!$this->computed) {
|
||||
|
@@ -74,7 +74,7 @@ Choose a postal code: Choisir un code postal
|
||||
address:
|
||||
address_homeless: L'adresse est-elle celle d'un domicile fixe ?
|
||||
real address: Adresse d'un domicile
|
||||
consider homeless: N'est pas l'adresse d'un domicile (SDF)
|
||||
consider homeless: Cette adresse est incomplète
|
||||
address more:
|
||||
floor: ét
|
||||
corridor: coul
|
||||
|
Reference in New Issue
Block a user