Fix NULL wrongly checked on field change

When a field was requested to be changed, the "null" field was compared to its previous value. Unfortunately, both fields don't have the same value, so a change was always identified.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
Hugues Peccatte 2019-08-19 18:00:18 +02:00
parent a0bf9b50d1
commit 98a7479174
3 changed files with 5 additions and 5 deletions

View File

@ -883,7 +883,7 @@ class TableStructureController extends TableController
$_POST['field_length'][$i],
$_POST['field_attribute'][$i],
Util::getValueByKey($_POST, "field_collation.${i}", ''),
Util::getValueByKey($_POST, "field_null.${i}", 'NOT NULL'),
Util::getValueByKey($_POST, "field_null.${i}", 'NO'),
$_POST['field_default_type'][$i],
$_POST['field_default_value'][$i],
Util::getValueByKey($_POST, "field_extra.${i}", false),
@ -1030,7 +1030,7 @@ class TableStructureController extends TableController
$_POST['field_length_orig'][$i],
$_POST['field_attribute_orig'][$i],
Util::getValueByKey($_POST, "field_collation_orig.${i}", ''),
Util::getValueByKey($_POST, "field_null_orig.${i}", 'NOT NULL'),
Util::getValueByKey($_POST, "field_null_orig.${i}", 'NO'),
$_POST['field_default_type_orig'][$i],
$_POST['field_default_value_orig'][$i],
Util::getValueByKey($_POST, "field_extra_orig.${i}", false),

View File

@ -534,7 +534,7 @@ class Table
if (! $virtuality || $isVirtualColMysql) {
if ($null !== false) {
if ($null == 'NULL') {
if ($null == 'YES') {
$query .= ' NULL';
} else {
$query .= ' NOT NULL';
@ -573,7 +573,7 @@ class Table
case 'NULL' :
// If user uncheck null checkbox and not change default value null,
// default value will be ignored.
if ($null !== false && $null !== 'NULL') {
if ($null !== false && $null !== 'YES') {
break;
}
// else fall-through intended, no break here

View File

@ -4,5 +4,5 @@
checked="checked"
{%- endif %}
type="checkbox"
value="NULL"
value="YES"
class="allow_null" />