Fomr 2.3 bug répondre à
This commit is contained in:
parent
4641fcf3d1
commit
f6474295d4
@ -29,10 +29,10 @@ class form extends common {
|
|||||||
public static $data = [];
|
public static $data = [];
|
||||||
|
|
||||||
public static $pages = [];
|
public static $pages = [];
|
||||||
|
|
||||||
public static $pagination;
|
public static $pagination;
|
||||||
|
|
||||||
const FORM_VERSION = '2.2';
|
const FORM_VERSION = '2.3';
|
||||||
|
|
||||||
// Objets
|
// Objets
|
||||||
const TYPE_MAIL = 'mail';
|
const TYPE_MAIL = 'mail';
|
||||||
@ -45,12 +45,12 @@ class form extends common {
|
|||||||
|
|
||||||
|
|
||||||
public static $types = [
|
public static $types = [
|
||||||
self::TYPE_LABEL => 'Etiquette',
|
self::TYPE_LABEL => 'Etiquette',
|
||||||
self::TYPE_TEXT => 'Champ texte',
|
self::TYPE_TEXT => 'Champ texte',
|
||||||
self::TYPE_TEXTAREA => 'Grand champ texte',
|
self::TYPE_TEXTAREA => 'Grand champ texte',
|
||||||
self::TYPE_MAIL => 'Champ mail',
|
self::TYPE_MAIL => 'Champ mail',
|
||||||
self::TYPE_SELECT => 'Sélection',
|
self::TYPE_SELECT => 'Sélection',
|
||||||
self::TYPE_CHECKBOX => 'Case à cocher',
|
self::TYPE_CHECKBOX => 'Case à cocher',
|
||||||
self::TYPE_DATETIME => 'Date'
|
self::TYPE_DATETIME => 'Date'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -61,22 +61,22 @@ class form extends common {
|
|||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config() {
|
||||||
// Liste des utilisateurs
|
// Liste des utilisateurs
|
||||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||||
ksort($userIdsFirstnames);
|
ksort($userIdsFirstnames);
|
||||||
self::$listUsers [] = '';
|
self::$listUsers [] = '';
|
||||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||||
self::$listUsers [] = $userId;
|
self::$listUsers [] = $userId;
|
||||||
}
|
}
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
// Configuration
|
// Configuration
|
||||||
// Option sélectionnée sans page choisie
|
// Option sélectionnée sans page choisie
|
||||||
$pageId = '';
|
$pageId = '';
|
||||||
if ($this->getInput('formConfigPageId') !== "") {
|
if ($this->getInput('formConfigPageId') !== "") {
|
||||||
// Option désactivée, réinitialiser l'id de la page sélectionnée.
|
// 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) : '';
|
$pageId = $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '';
|
||||||
}
|
}
|
||||||
$this->setData([
|
$this->setData([
|
||||||
'module',
|
'module',
|
||||||
$this->getUrl(0),
|
$this->getUrl(0),
|
||||||
@ -93,7 +93,7 @@ class form extends common {
|
|||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
// Génération des données vides
|
// 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
|
// Génération des champs
|
||||||
$inputs = [];
|
$inputs = [];
|
||||||
foreach($this->getInput('formConfigPosition', null) as $index => $position) {
|
foreach($this->getInput('formConfigPosition', null) as $index => $position) {
|
||||||
@ -220,7 +220,7 @@ class form extends common {
|
|||||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||||
'notification' => 'Action non autorisée'
|
'notification' => 'Action non autorisée'
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$data = ($this->getData(['module', $this->getUrl(0), 'data']));
|
$data = ($this->getData(['module', $this->getUrl(0), 'data']));
|
||||||
if (count($data) > 0 ) {
|
if (count($data) > 0 ) {
|
||||||
// Suppression multiple
|
// Suppression multiple
|
||||||
@ -243,7 +243,7 @@ class form extends common {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppression
|
* 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))
|
AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT))
|
||||||
{
|
{
|
||||||
self::$inputNotices['formCapcha'] = 'Incorrect';
|
self::$inputNotices['formCapcha'] = 'Incorrect';
|
||||||
|
|
||||||
}
|
}
|
||||||
// Préparation le contenu du mail
|
// Préparation le contenu du mail
|
||||||
$data = [];
|
$data = [];
|
||||||
$content = '';
|
|
||||||
$replyTo = null;
|
$replyTo = null;
|
||||||
|
$content = '';
|
||||||
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
|
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
|
||||||
// Filtre la valeur
|
// Filtre la valeur
|
||||||
switch($input['type']) {
|
switch($input['type']) {
|
||||||
@ -306,20 +306,19 @@ class form extends common {
|
|||||||
case self::TYPE_TEXTAREA:
|
case self::TYPE_TEXTAREA:
|
||||||
$filter = helper::FILTER_STRING_LONG;
|
$filter = helper::FILTER_STRING_LONG;
|
||||||
break;
|
break;
|
||||||
case self::TYPE_DATETIME:
|
case self::TYPE_DATETIME:
|
||||||
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
||||||
break;
|
break;
|
||||||
case self::TYPE_CHECKBOX:
|
case self::TYPE_CHECKBOX:
|
||||||
$filter = helper::FILTER_BOOLEAN;
|
$filter = helper::FILTER_BOOLEAN;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$filter = helper::FILTER_STRING_SHORT;
|
$filter = helper::FILTER_STRING_SHORT;
|
||||||
}
|
}
|
||||||
$value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']);
|
$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
|
// premier champ email ajouté au mail en reply si option active
|
||||||
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
|
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
|
||||||
$input['type'] === 'mail' &&
|
$input['type'] === 'mail') {
|
||||||
$replyTo !== null) {
|
|
||||||
$replyTo = $value;
|
$replyTo = $value;
|
||||||
}
|
}
|
||||||
// Préparation des données pour la création dans la base
|
// Préparation des données pour la création dans la base
|
||||||
@ -352,7 +351,7 @@ class form extends common {
|
|||||||
$to[] = $user['mail'];
|
$to[] = $user['mail'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Utilisateur désigné
|
// Utilisateur désigné
|
||||||
if (!empty($singleuser)) {
|
if (!empty($singleuser)) {
|
||||||
$to[] = $singleuser;
|
$to[] = $singleuser;
|
||||||
|
Loading…
Reference in New Issue
Block a user