From f6474295d4734232d1e9aa99079affbaae408c0e Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 3 Jun 2020 08:54:48 +0200 Subject: [PATCH] =?UTF-8?q?Fomr=202.3=20bug=20r=C3=A9pondre=20=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/form/form.php | 45 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/module/form/form.php b/module/form/form.php index bb0eb16a..2784ebdf 100755 --- a/module/form/form.php +++ b/module/form/form.php @@ -29,10 +29,10 @@ class form extends common { public static $data = []; public static $pages = []; - + public static $pagination; - - const FORM_VERSION = '2.2'; + + const FORM_VERSION = '2.3'; // Objets const TYPE_MAIL = 'mail'; @@ -45,12 +45,12 @@ class form extends common { public static $types = [ - self::TYPE_LABEL => 'Etiquette', + self::TYPE_LABEL => 'Etiquette', self::TYPE_TEXT => 'Champ texte', self::TYPE_TEXTAREA => 'Grand champ texte', self::TYPE_MAIL => 'Champ mail', self::TYPE_SELECT => 'Sélection', - self::TYPE_CHECKBOX => 'Case à cocher', + self::TYPE_CHECKBOX => 'Case à cocher', self::TYPE_DATETIME => 'Date' ]; @@ -61,22 +61,22 @@ class form extends common { * Configuration */ public function config() { - // Liste des utilisateurs + // Liste des utilisateurs $userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname'); ksort($userIdsFirstnames); - self::$listUsers [] = ''; + self::$listUsers [] = ''; foreach($userIdsFirstnames as $userId => $userFirstname) { self::$listUsers [] = $userId; } // Soumission du formulaire if($this->isPost()) { // Configuration - // Option sélectionnée sans page choisie - $pageId = ''; - if ($this->getInput('formConfigPageId') !== "") { + // Option sélectionnée sans page choisie + $pageId = ''; + if ($this->getInput('formConfigPageId') !== "") { // Option désactivée, réinitialiser l'id de la page sélectionnée. $pageId = $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : ''; - } + } $this->setData([ 'module', $this->getUrl(0), @@ -93,7 +93,7 @@ class form extends common { ] ]); // Génération des données vides - $this->setData(['module', $this->getUrl(0), 'data', []]); + $this->setData(['module', $this->getUrl(0), 'data', []]); // Génération des champs $inputs = []; foreach($this->getInput('formConfigPosition', null) as $index => $position) { @@ -220,7 +220,7 @@ class form extends common { 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data', 'notification' => 'Action non autorisée' ]); - } else { + } else { $data = ($this->getData(['module', $this->getUrl(0), 'data'])); if (count($data) > 0 ) { // Suppression multiple @@ -243,7 +243,7 @@ class form extends common { } } - + /** * Suppression */ @@ -291,12 +291,12 @@ class form extends common { AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT)) { self::$inputNotices['formCapcha'] = 'Incorrect'; - + } // Préparation le contenu du mail $data = []; - $content = ''; $replyTo = null; + $content = ''; foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) { // Filtre la valeur switch($input['type']) { @@ -306,20 +306,19 @@ class form extends common { case self::TYPE_TEXTAREA: $filter = helper::FILTER_STRING_LONG; break; - case self::TYPE_DATETIME: + case self::TYPE_DATETIME: $filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP break; - case self::TYPE_CHECKBOX: + case self::TYPE_CHECKBOX: $filter = helper::FILTER_BOOLEAN; break; default: $filter = helper::FILTER_STRING_SHORT; } $value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']); - // premier chalmp email ajouté au mail en reply si option active - if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true && - $input['type'] === 'mail' && - $replyTo !== null) { + // premier champ email ajouté au mail en reply si option active + if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true && + $input['type'] === 'mail') { $replyTo = $value; } // Préparation des données pour la création dans la base @@ -352,7 +351,7 @@ class form extends common { $to[] = $user['mail']; } } - } + } // Utilisateur désigné if (!empty($singleuser)) { $to[] = $singleuser;