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

trim sur le code de formulaire

parent 8f3495ec
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ class FormulaireController extends AbstractActionController
        if ($formulaire !== null) {
            $texte = "";
            if (!empty($instances)) {
                $texte .= "<p><strong>Attention ce type de formulaire est utilisé par ".count($instances)." instances qui seront supprimées si vous supprimez ce type de formulaire.</strong></p>";
                $texte .= "<p><strong>Attention ce type de formulaire est utilisé par ".count($instances)." instance·s qui seront supprimées si vous supprimez ce type de formulaire.</strong></p>";
            }
            $texte .= "La suppression est définitive êtes-vous sûr&middot;e de vouloir continuer ?";
            $vm->setTemplate('unicaen-autoform/default/confirmation');
+2 −2
Original line number Diff line number Diff line
@@ -85,8 +85,8 @@ class FormulaireForm extends Form {
                        'callback' => function ($value, $context = []) {
                            /** @var Formulaire $object */
                            $object = $this->getObject();
                            if ($object AND $object->getCode() == $value) return true;
                            return ($this->getFormulaireService()->getFormulaireByCode($value) === null);
                            if ($object AND $object->getCode() == trim($value)) return true;
                            return ($this->getFormulaireService()->getFormulaireByCode(trim($value)) === null);
                        },
                    ],
                ]],
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class FormulaireHydrator implements HydratorInterface {
        $data = [
            'libelle' => $object->getLibelle(),
            'description' => $object->getDescription(),
            'code' => $object->getCode(),
            'code' => $object->getCode()?trim($object->getCode()):null,
        ];
        return $data;
    }
@@ -30,7 +30,7 @@ class FormulaireHydrator implements HydratorInterface {
    {
        $object->setLibelle($data['libelle']);
        $object->setDescription($data['description']?:null);
        $object->setCode($data['code']?:null);
        $object->setCode((isset($data['code']) AND trim($data['code']) !== '')?trim($data['code']):null);
        return $object;
    }