Commit c8998c9d authored by Elias Villiger's avatar Elias Villiger
Browse files

Support #5309 (min/max) - Fix unit tests, add SQL update statements

parent 6f2007d2
......@@ -58,7 +58,6 @@ Features
* New CSS class 'qfq-full-width-left': especially for buttons to become full width.
* New CSS class 'qfq-table-100' - 100% width, with auto width per column. FE.subrecord changed to 'qfq-table-100'.
* #5302 / remove CSS class 'internal / external'
* #5309: checkTypes "min|max" and "min|max date" are now deprecated. Instead, use notation "min = " / "max = " in parameter field of FormElement. Usages of deprecated checktypes were automatically transferred to the new notation.
Bug Fixes
^^^^^^^^^
......
......@@ -96,9 +96,12 @@ $UPDATE_ARRAY = array(
'0.25.10' => [
"ALTER TABLE `FormElement` CHANGE `type` `type` ENUM( 'checkbox', 'date', 'datetime', 'dateJQW', 'datetimeJQW', 'extra', 'gridJQW', 'text', 'editor', 'annotate', 'imageCut', 'time', 'note', 'password', 'radio', 'select', 'subrecord', 'upload', 'fieldset', 'pill', 'templateGroup', 'beforeLoad', 'beforeSave', 'beforeInsert', 'beforeUpdate', 'beforeDelete', 'afterLoad', 'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendMail', 'paste' ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'text';",
"UPDATE FormElement SET parameter = CONCAT(parameter, '\nmin = ', SUBSTRING_INDEX(checkPattern, '|', 1), '\nmax = ', SUBSTRING_INDEX(checkPattern, '|', -1)) WHERE checkType LIKE 'min|max%' AND checkPattern <> ''",
],
'0.25.11' => [
"UPDATE FormElement SET parameter = CONCAT(parameter, '\nmin = ', SUBSTRING_INDEX(checkPattern, '|', 1), '\nmax = ', SUBSTRING_INDEX(checkPattern, '|', -1)) WHERE checkType LIKE 'min|max%' AND checkPattern <> ''",
"ALTER TABLE `FormElement` CHANGE `checkType` `checkType` ENUM('alnumx','digit','numerical','email','pattern','allbut','all') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'alnumx';",
],
);
......
......@@ -73,7 +73,7 @@ class Sanitize {
throw new UserFormException($errorText, $errorCode);
}
return '';
return SANITIZE_VIOLATE . $sanitizeClass . SANITIZE_VIOLATE;
}
/**
......
......@@ -83,7 +83,7 @@ CREATE TABLE IF NOT EXISTS `FormElement` (
'afterSave', 'afterInsert', 'afterUpdate', 'afterDelete', 'sendMail', 'paste') NOT NULL DEFAULT 'text',
`subrecordOption` SET('edit', 'delete', 'new') NOT NULL DEFAULT '',
`encode` ENUM('none', 'specialchar') NOT NULL DEFAULT 'specialchar',
`checkType` ENUM('alnumx', 'digit', 'numerical', 'email', 'min|max', 'min|max date', 'pattern', 'allbut', 'all') NOT NULL DEFAULT 'alnumx',
`checkType` ENUM('alnumx', 'digit', 'numerical', 'email', 'pattern', 'allbut', 'all') NOT NULL DEFAULT 'alnumx',
`checkPattern` VARCHAR(255) NOT NULL DEFAULT '',
`onChange` VARCHAR(255) NOT NULL DEFAULT '',
......
......@@ -102,6 +102,9 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$result = $build->buildInput($formElement, 'name:1', '', $json);
$this->assertEquals('<input id="123" name="name:1" class="form-control" maxlength="255" type="input" value="" max="10" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result);
$this->assertEquals(['disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', 'disabled' => false, API_ELEMENT_UPDATE => $label], $json);
// reset so they don't interfere with next tests
$formElement[FE_MIN] = '';
$formElement[FE_MAX] = '';
// CheckType
$formElement[FE_CHECK_TYPE] = SANITIZE_ALLOW_PATTERN;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment