View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001989 | OXID eShop (all versions) | 1. ----- eShop frontend ----- | public | 2010-07-20 15:48 | 2012-12-10 14:38 |
Reporter | dominik_ziegler | Assigned To | |||
Priority | high | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 4.4.0 revision 28699 | ||||
Summary | 0001989: oxBase::_getUpdateFieldValue() does not respect database default value | ||||
Description | The method _getUpdateFieldValue in oxBase class sets the value for a database field if it is not set via the object for example $oArticle->oxarticle__oxactive->value. If the field value is not set, the value gets a) "null" if the column is not configured with NOT NULL or b) 0 due to quoting an empty variable. At this point OXID have to check if the requested column has a default value and return its value instead of returning 0. If you create an article in an backend module and don't set oxarticles.OXACTIVE to 1 the save() operation of the article object results in saving the article with oxarticles.OXACTIVE = 0 even the database default value is 1. Please provide a fallback to the default value. With the default ADODB database table definition data this information is still provided and simply must be read out (has_default and default_value) in this method. | ||||
Steps To Reproduce | $oArticle = oxNew('oxArticle'); $oArticle->setId(); $oArticle->oxarticles__oxtitle = new oxField('Test article'); $oArticle->save(); Saving this in admin environment (isAdmin() must be true) results in saving the article with oxarticles.OXACTIVE = 0 even its column default value is 1. | ||||
Tags | No tags attached. | ||||
Theme | |||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
related to | 0002434 | resolved | Linas Kukulskis | oxbase::_insert ignores database-default-values |
|
This fix needs important DB changes, so can be implemented only in some Upgrades (i.e. 5th version eShop). Until then this entry is suspended. |
|
I thought this is a minor change in the described method in oxBase. |
|
It's a nice idea, there are a few ways to solve this problem. 1. Init empty object and use only set fields when saving. 2. Load default DB values on oxbase object init. |
|
(sorry, note about DB change was my mistake). It's very good idea and would be good to have it implemented in the eShop. But as we talked inside the team - to have this working properly - need some wider changes in the core functionality of eShop (i.e. improve lazy loading in entire eShop). So such changes can be implemented only in some major eShop version, like 5th. For now it's is moved to the list of improvements for implementing in future version. Here the entry is closed. Thank you for suggestion. |