diff options
author | Kamil Tekiela <tekiela246@gmail.com> | 2022-08-15 16:19:17 +0300 |
---|---|---|
committer | Kamil Tekiela <tekiela246@gmail.com> | 2022-08-15 16:35:21 +0300 |
commit | fc932a9a8f40cb696a6af6a098a79209a6e7aa8d (patch) | |
tree | 171f2ab7e02be5dc8143ae69fe013c2f7067183c | |
parent | 8b99611988342c12a69fab4940de47898538061b (diff) |
Allow fields to be set to NULL
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
-rw-r--r-- | libraries/classes/InsertEdit.php | 1 | ||||
-rw-r--r-- | test/classes/InsertEditTest.php | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/libraries/classes/InsertEdit.php b/libraries/classes/InsertEdit.php index 33b692777d..3301c529c5 100644 --- a/libraries/classes/InsertEdit.php +++ b/libraries/classes/InsertEdit.php @@ -1673,6 +1673,7 @@ class InsertEdit . ' = ' . $currentValueAsAnArray; } elseif ( ! (empty($multiEditFuncs[$key]) + && empty($multiEditColumnsNull[$key]) && isset($multiEditColumnsPrev[$key]) && $currentValue === $multiEditColumnsPrev[$key]) && $currentValueAsAnArray !== '' diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index 13ee204b74..590fa810d3 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -2143,6 +2143,30 @@ class InsertEditTest extends AbstractTestCase ], $result ); + + // Test to see if a field can be set to NULL + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + ['on'], + '', + [''], + [], + false, + [], + [], + 'NULL', + [], + '0', + [] + ); + + $this->assertEquals( + [ + ['`fld` = NULL'], + [], + ], + $result + ); } /** |