View Issue Details

IDProjectCategoryView StatusLast Update
0007049OXID eShop (all versions)4.01. Database handlingpublic2019-11-19 08:12
Reportertimwetter Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionunable to reproduce 
Product Version6.2.0-beta.1 
Summary0007049: DB 'NULL' value for DB float/double types not possible
Descriptionalways '0' is saved to DB instead of 'NULL'
- create an extra field 'OXNIX' as 'float' DEFAULT NULL in DB table (e.g. oxcountry)
- init all 'OXNIX' with 'NULL'
- add to /Apllication/Controller/Admin/CountryMain.php:
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---
public function save()
{ ...
-- $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
++ $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
++ $aParams[oxcountry__oxnix] = null;
....}
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---
- go to the backend
- select a country
- press 'save' button
- value of OXNIX is set to '0' in DB

possible solution:
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---
- file: /Core/Model/BaseModel.php
protected function _setFieldData(...)
{...
-- if ($isPropertyLoaded
            && isset($this->$longFieldName->fldtype)
            && $this->$longFieldName->fldtype == 'double'
        ) {
++ if ($isPropertyLoaded
            && isset($this->$longFieldName->fldtype)
            && $this->$longFieldName->fldtype == 'double'
            && $fieldValue !== null
        ) {
...}
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---

I think the following str_replace function inside the if-statement causes this?!
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP Version7.1
Database VersionNot defined

Relationships

related to 0007052 acknowledgedbenjamin.joerger DB 'NULL' value for DB float/double types not possible 

Activities

QA

2019-11-18 18:12

administrator   ~0013046

Can‘t reproduce the behavior.

If I add a new column with type float NULL and add as described:

\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("editval");
$aParams[oxcountry__oxnix] = 2;

Then I have OXINIX 2 in the field. If I changed the line to save with null afterwards, I also get NULL in the database field.

It seems to be more of a DB problem/configuration/non-supported DB.

Can you reproduce that with 6.1.x?

-MF