source/Application/Model/OrderArticle.php
protected function _getArtStock($dAddAmount = 0, $blAllowNegativeStock = false)
    {
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();

        // #1592A. must take real value
        $sQ = 'select oxstock from oxarticles where oxid = ' . $masterDb->quote($this->oxorderarticles__oxartid->value);
        $iStockCount = ( float ) $masterDb->getOne($sQ);

        $iStockCount += $dAddAmount;

        // #1592A. calculating according new stock option
        if (!$blAllowNegativeStock && $iStockCount < 0) {
            $iStockCount = 0;
        }

        return $iStockCount;
    }
protected function _getArtStock($dAddAmount = 0, $blAllowNegativeStock = false)
    {
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();

        // #1592A. must take real value
        $sQ = 'select oxstock from oxarticles where oxid = ' . $masterDb->quote($this->oxorderarticles__oxartid->value);
        $iStockCount = ( float ) $masterDb->getOne($sQ);

        $iStockCount += $dAddAmount;

        // #1592A. calculating according new stock option
        if (!$blAllowNegativeStock && $iStockCount < 0) {
            $iStockCount = 0;
        }

        return $iStockCount;
    }
protected function _getArtStock ( $ dAddAmount = 0 , $ blAllowNegativeStock = false ) { // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). $ masterDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; // #1592A. must take real value $ sQ = 'select oxstock from oxarticles where oxid = ' . $ masterDb -> quote ( $ this -> oxorderarticles__oxartid -> value ) ; $ iStockCount = ( float ) $ masterDb -> getOne ( $ sQ ) ; $ iStockCount += $ dAddAmount ; // #1592A. calculating according new stock option if ( ! $ blAllowNegativeStock && $ iStockCount < 0 ) { $ iStockCount = 0 ; } return $ iStockCount ; }
Adds or substracts defined amount passed by param from arcticle stock

@param double $dAddAmount           amount which will be added/substracled from value in db
@param bool   $blAllowNegativeStock allow/disallow negative stock value

@return double
Adds or substracts defined amount passed by param from arcticle stock