Commit c44bcd8d authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fix bug duplicata

parent a35eea3e
Loading
Loading
Loading
Loading
Loading
+23 −3
Original line number Diff line number Diff line
@@ -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;
    }

+1 −0
Original line number Diff line number Diff line
@@ -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;