View Issue Details

IDProjectCategoryView StatusLast Update
0006071OXID eShop (all versions)2.6. Administer orderspublic2015-12-01 12:27
Reportertimwetter 
PrioritylowSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version4.9.3 / 5.2.3 
Target VersionFixed in Version 
Summary0006071: oxorderarticles->setNewAmount
DescriptionYou can change article amout in oxid backend in order_article, even if the stock 'would' get negative -> prevent 'set amount' and 'save' for oxorderarticle, if negative stock is not allowed
Steps To Reproduce- set allownegativeamount to false
- navigate in backend to orders,
- select one order
- got to tab order articles
- change amount of one or more order article heigher then stock of article
- submit via update button

you get an error message, but the 'error' amount is saved to order article(s)
Additional InformationFIX:

/**
* Ordered article stock setter. Before setting new stock value additionally checks for
* original article stock value. Is stock values <= preferred, adjusts order stock according
* to it
*
* @param int $iNewAmount new ordered items amount
*
* @return null
*/
public function setNewAmount( $iNewAmount )
{
if ( $iNewAmount >= 0 ) {
// to update stock we must first check if it is possible - article exists?
$oArticle = oxNew( "oxarticle" );
if ( $oArticle->load( $this->oxorderarticles__oxartid->value ) ) {

// updating stock info
$iStockChange = $iNewAmount - $this->oxorderarticles__oxamount->value;
$iOnStock = $oArticle->checkForStock( $iStockChange );
if ( $iStockChange > 0 && $iOnStock !== false ) {
if ( $iOnStock !== true ) {
$iStockChange = $iOnStock;
$iNewAmount = $this->oxorderarticles__oxamount->value + $iStockChange;
}
}

$this->updateArticleStock( $iStockChange * -1, $this->getConfig()->getConfigParam( 'blAllowNegativeStock' ) );

if ($this->getConfig()->getConfigParam( 'blAllowNegativeStock' ) || $iOnStock !== false) {
// updating self
$this->oxorderarticles__oxamount = new oxField ($iNewAmount, oxField::T_RAW);
$this->save();
}
}
}
}
TagsNo tags attached.
ThemeAll
BrowserAll
PHP Versionany
MySQL Versionany

Activities

QA

2015-03-05 17:01

administrator   ~0010761

is reproducible in current shop (EE 5.2.3.).

martinwegele

2015-03-18 09:27

reporter   ~0010808

http://forum.oxid-esales.com/showthread.php?t=26141