Skip to content
Snippets Groups Projects
Commit c44bcd8d authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fix bug duplicata

parent a35eea3e
Branches
Tags 6.2.7
No related merge requests found
Pipeline #38430 passed
......@@ -125,12 +125,32 @@ class FormulaireInstance implements HistoriqueAwareInterface {
$responses = $this->getReponses();
usort($responses, function (FormulaireReponse $a, FormulaireReponse $b) { return $a->getChamp()->getOrdre() <=> $b->getChamp()->getOrdre();});
//TODO :: faire mieux voir comment appeler le partial qui va bien ...
foreach ($responses as $reponse) {
if ($reponse->getChamp()->hasMotsClefs($mots) AND $reponse->estNonHistorise()) {
if ($reponse->getChamp()->hasMotsClefs($mots) and $reponse->estNonHistorise()) {
if ($reponse->getChamp()->getType()->getCode() === Champ::TYPE_PLUS_CUSTOM) {
$texte .= $reponse->getChamp()->getLibelle() . " : ";
if (str_replace([Champ::SEPARATOR_PLUS_CUSTOM_FIELD, Champ::SEPARATOR_PLUS_CUSTOM_GROUP], ['', ''], $reponse->getReponse()) === '') $texte .= "aucun·e" . "<br>";
else {
$items = explode(Champ::SEPARATOR_PLUS_CUSTOM_GROUP, $reponse->getReponse());
$texte .= "<ol>";
foreach ($items as $item) {
$texte .= "<br>";
$elements = explode(Champ::SEPARATOR_PLUS_CUSTOM_FIELD, $item);
foreach ($elements as $element) {
$texte .= $element . "<br>";
}
}
$texte .= "</ol>";
}
} else {
// $texte .= $reponse->getChamp()->getType()."<br>";
if ($texte !== "") $texte .= "<br/>";
$texte .= $reponse->getReponse();
}
}
}
return $texte;
}
......
......@@ -18,6 +18,7 @@ trait HasMotsClefsAwareTrait {
public function hasMotsClefs(array $mots) : bool
{
if ($this->getMotsClefs() === null) return false;
$motsClefs = explode(';', $this->getMotsClefs());
foreach ($mots as $mot) {
if (!in_array($mot, $motsClefs)) return false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment