View Issue Details

IDProjectCategoryView StatusLast Update
0007049OXID eShop (all versions)4.01. Database handlingpublic2019-11-08 16:41
Reportertimwetter 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version6.2.0-beta.1 
Target VersionFixed in Version 
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
MySQL VersionNot defined

Activities

There are no notes attached to this issue.