View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006071 | OXID eShop (all versions) | 2.6. Administer orders | public | 2015-03-04 22:45 | 2024-01-17 14:29 |
Reporter | timwetter | Assigned To | |||
Priority | low | Severity | minor | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 4.9.3 / 5.2.3 | ||||
Summary | 0006071: oxorderarticles->setNewAmount | ||||
Description | You 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 Information | FIX: /** * 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(); } } } } | ||||
Tags | Specialized Management Apps | ||||
Theme | All | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||