View Issue Details

IDProjectCategoryView StatusLast Update
0005216OXID eShop (all versions)1.01. Products (product, categories, manufacturer, promotions etc.)public2013-11-13 09:10
ReporterChrisMillar Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionduplicate 
Product Version4.5.11 revision 46050 
Summary0005216: incorrect date in oxinsert column in oxorderarticles
Descriptionin oxid 4.5.11 EE

incorrect date is saved in oxinsert column in oxorderticles on order.

cause:
1)
oxorder->execute calls oxorder::_setOrderArticles which calls oxOrderArticles::copyThis($oProduct)

oxOrderArticles::copyThis appears to copy oxarticle__oxinsert to oxorderarticle_oxinsert, which it should not do.

oxorderarticle_oxinsert should be current date

2)
date in oxarticle__oxinsert is in t.m.Y format when loaded with german locale
but on save date needs to be in Y-m-t format.

this happens because oxarticle::load() gets oxarticles__oxinsert with current locale

$this->oxarticles__oxinsert = new oxField(oxUtilsDate::getInstance()->formatDBDate( $this->oxarticles__oxinsert->value));

when this information is copied to oxorderarticles it is not converted back to US format before save.

therefore we get dates in the future, dates in the past... lots of strange stuff...

I've included a fix for this bug as a module




 

 
Steps To ReproduceMake an order with German locale

MySql with US locale

Additional Informationfix as module:

<?php
/**
 * CM
 * fix for incorrect date in oxinsert column in oxorderarticles
 *
 *
 */
class soloxOrderArticle extends soloxOrderArticle_parent
{
    
    
    public function save(){
        
        //oxinsert should not be modified on update
        if(!$this->exists()){
            $simpleDateFormat = oxLang::getInstance()->translateString(
                        'simpleDateFormat'
                    );
            $simpleDate = oxUtilsDate::getInstance()->formatDBDate(
                        date($simpleDateFormat),
                        true
                    );
            $this->oxorderarticles__oxinsert = new oxField(
                        $simpleDate,
                        oxField::T_RAW
                    );
        }

        $blRet = parent::save();
        return $blRet;
    }
}
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Version5.3
Database Versionany

Relationships

related to 0000704 resolvedrimvydas_paskevicius OXINSERT is zero 

Activities

ChrisMillar

2013-06-19 16:13

reporter   ~0008798

this bug appears to be related to issue 0000704

How exactly was this bug fixed way back when? There appears to be no change log for 4.1.0 revision 17976

as far as i can tell oxinsert values are correct in oxarticles but i don't really understand why.

saulius.stasiukaitis

2013-11-13 09:10

reporter   ~0009264

From quick look to code, currently fix is in method - copyThis()

if ( $sFieldName == "oxorderarticles__oxinsert" ) {
 oxDb::getInstance()->convertDBDate( $this->$sFieldName, true );
}