source/Application/Controller/Admin/OrderArticle.php
public function storno()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $sOrderArtId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sArtID');
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\OrderArticle::class);
        $oArticle->load($sOrderArtId);

        if ($oArticle->oxorderarticles__oxstorno->value == 1) {
            $oArticle->oxorderarticles__oxstorno->setValue(0);
            $sStockSign = -1;
        } else {
            $oArticle->oxorderarticles__oxstorno->setValue(1);
            $sStockSign = 1;
        }

        // stock information
        if ($myConfig->getConfigParam('blUseStock')) {
            $oArticle->updateArticleStock($oArticle->oxorderarticles__oxamount->value * $sStockSign, $myConfig->getConfigParam('blAllowNegativeStock'));
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sQ = "update oxorderarticles set oxstorno = " . $oDb->quote($oArticle->oxorderarticles__oxstorno->value) . " where oxid = " . $oDb->quote($sOrderArtId);
        $oDb->execute($sQ);

        //get article id
        $sQ = "select oxartid from oxorderarticles where oxid = " . $oDb->quote($sOrderArtId);
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        if (($sArtId = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sQ))) {
            $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
            if ($oOrder->load($this->getEditObjectId())) {
                $oOrder->recalculateOrder();
            }
        }
    }
public function storno()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $sOrderArtId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('sArtID');
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\OrderArticle::class);
        $oArticle->load($sOrderArtId);

        if ($oArticle->oxorderarticles__oxstorno->value == 1) {
            $oArticle->oxorderarticles__oxstorno->setValue(0);
            $sStockSign = -1;
        } else {
            $oArticle->oxorderarticles__oxstorno->setValue(1);
            $sStockSign = 1;
        }

        // stock information
        if ($myConfig->getConfigParam('blUseStock')) {
            $oArticle->updateArticleStock($oArticle->oxorderarticles__oxamount->value * $sStockSign, $myConfig->getConfigParam('blAllowNegativeStock'));
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sQ = "update oxorderarticles set oxstorno = " . $oDb->quote($oArticle->oxorderarticles__oxstorno->value) . " where oxid = " . $oDb->quote($sOrderArtId);
        $oDb->execute($sQ);

        //get article id
        $sQ = "select oxartid from oxorderarticles where oxid = " . $oDb->quote($sOrderArtId);
        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        if (($sArtId = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster()->getOne($sQ))) {
            $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
            if ($oOrder->load($this->getEditObjectId())) {
                $oOrder->recalculateOrder();
            }
        }
    }
public function storno ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sOrderArtId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'sArtID' ) ; $ oArticle = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderArticle :: class ) ; $ oArticle -> load ( $ sOrderArtId ) ; if ( $ oArticle -> oxorderarticles__oxstorno -> value == 1 ) { $ oArticle -> oxorderarticles__oxstorno -> setValue ( 0 ) ; $ sStockSign = - 1 ; } else { $ oArticle -> oxorderarticles__oxstorno -> setValue ( 1 ) ; $ sStockSign = 1 ; } // stock information if ( $ myConfig -> getConfigParam ( 'blUseStock' ) ) { $ oArticle -> updateArticleStock ( $ oArticle -> oxorderarticles__oxamount -> value * $ sStockSign , $ myConfig -> getConfigParam ( 'blAllowNegativeStock' ) ) ; } $ oDb = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getDb ( ) ; $ sQ = "update oxorderarticles set oxstorno = " . $ oDb -> quote ( $ oArticle -> oxorderarticles__oxstorno -> value ) . " where oxid = " . $ oDb -> quote ( $ sOrderArtId ) ; $ oDb -> execute ( $ sQ ) ; //get article id $ sQ = "select oxartid from oxorderarticles where oxid = " . $ oDb -> quote ( $ sOrderArtId ) ; // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804). if ( ( $ sArtId = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) -> getOne ( $ sQ ) ) ) { $ oOrder = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ Order :: class ) ; if ( $ oOrder -> load ( $ this -> getEditObjectId ( ) ) ) { $ oOrder -> recalculateOrder ( ) ; } } }
Cancels order item
Cancels order item