cs: Enable a couple of risky rules.

This commit is contained in:
Pol Dellaiera
2021-11-24 12:38:18 +01:00
parent acc4647346
commit f531cdc0ec
51 changed files with 130 additions and 132 deletions

View File

@@ -310,7 +310,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
foreach ($this->getCustomFields() as $cf) {
$cfType = $this->customFieldProvider->getCustomFieldByType($cf->getType());
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
foreach ($cfType->getChoices($cf) as $choiceSlug => $label) {
$slug = $this->slugToDQL($cf->getSlug(), 'choice', ['choiceSlug' => $choiceSlug]);
$qb->addSelect(
@@ -426,7 +426,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
->render(json_decode($value, true), $cf, 'csv');
};
if ($cfType instanceof CustomFieldChoice and $cfType->isMultiple($cf)) {
if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) {
return function ($value) use ($cf, $cfType, $key) {
$slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug'];
$decoded = \json_decode($value, true);
@@ -438,7 +438,7 @@ class ListPerson implements ListInterface, ExportElementValidatedInterface
. ' | ' . $label;
}
if ('_other' === $slugChoice and $cfType->isChecked($cf, $choiceSlug, $decoded)) {
if ('_other' === $slugChoice && $cfType->isChecked($cf, $choiceSlug, $decoded)) {
return $cfType->extractOtherValue($cf, $decoded);
}

View File

@@ -167,23 +167,23 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat
SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) AS "similarity nom + prenom",
SIMILARITY(p.lastname, p2.lastname) AS "similarity nom",
SIMILARITY(p.firstname, p2.firstname) AS "similarity prenom"
FROM chill_person_person AS p
JOIN chill_person_person AS p2
ON p.id != p2.id
AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
FROM chill_person_person AS p
JOIN chill_person_person AS p2
ON p.id != p2.id
AND (SIMILARITY(p.fullnamecanonical, p2.fullnamecanonical) > :precision
AND p.id < p2.id)
OR (UNACCENT(LOWER(p.firstname)) = UNACCENT(LOWER(p2.lastname))
AND UNACCENT(LOWER(p.lastname)) = UNACCENT(LOWER(p2.firstname)))
JOIN centers AS p1center
JOIN centers AS p1center
ON p1center.id = p.center_id
JOIN centers AS p2center
JOIN centers AS p2center
ON p2center.id = p2.center_id
WHERE NOT EXISTS (
SELECT id
FROM chill_person_not_duplicate as pnd
WHERE (pnd.person1_id = p.id
SELECT id
FROM chill_person_not_duplicate as pnd
WHERE (pnd.person1_id = p.id
AND pnd.person2_id = p2.id)
OR (pnd.person2_id = p.id
OR (pnd.person2_id = p.id
AND pnd.person1_id = p2.id)
)
ORDER BY p.fullnamecanonical, p.id, p2.id';