discard one article reservation
return the reserved stock to article

@param string $sArticleId article id
436320
public function discardArticleReservation($sArticleId)
    {
        $dReserved = $this->getReservedAmount($sArticleId);
        if ($dReserved) {
            $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            if ($oArticle->load($sArticleId)) {
                $oArticle->reduceStock(-$dReserved, true);
                $this->getReservations()->addItemToBasket($sArticleId, 0, null, true);
                $this->_aCurrentlyReserved = null;
            }
        }
    }
763108
private function getStockItemId($prodId, $stockId)
    {
        $query = $this->qbGetStockItem->build();
        $conn = $query->getConnection();
        $bind = [
            OwnQbGetStockItem::BND_PROD_ID => $prodId,
            OwnQbGetStockItem::BND_STOCK_ID => $stockId
        ];
        $result = $conn->fetchOne($query, $bind);
        return $result;
    }
1066404
protected function AddToWishlist($sArticleId = null, $dAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
    {
        $oGlobal = TGlobal::instance();
        $aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
        if (is_null($sArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
            $sArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
            if (empty($sArticleId)) {
                $sArticleId = null;
            }
        }
        if (is_null($dAmount) && array_key_exists(self::URL_ITEM_AMOUNT_NAME, $aRequestData)) {
            $dAmount = $aRequestData[self::URL_ITEM_AMOUNT_NAME];
            if (empty($dAmount)) {
                $dAmount = 1;
            }
        }

        if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
            $sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
            if (empty($sMessageHandler)) {
                $sMessageHandler = null;
            }
        }
        if (is_null($sMessageHandler)) {
            $sMessageHandler = self::MSG_CONSUMER_NAME;
        }

        $oMsgManager = TCMSMessageManager::GetInstance();
        if (is_null($sArticleId)) {
            $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-WISHLIST-ADD-ITEM-NO-ID-GIVEN');
        } else {
            $oItem = TdbShopArticle::GetNewInstance();
            /** @var $oItem TdbShopArticle */
            if ($oItem->Load($sArticleId)) {
                $oShop = TdbShop::GetInstance();
                $oExtranet = &TdbDataExtranet::GetInstance();
                $aInfoData = array('sLinkLoginStart' => '<a href="'.$oExtranet->GetLinkLoginPage().'">', 'sLinkLoginEnd' => '</a>', 'sLinkWishlistStart' => '<a href="'.$oShop->GetLinkToSystemPage('wishlist').'">', 'sLinkWishlistEnd' => '</a>', 'sLinkArticleStart' => '<a href="'.$oItem->GetDetailLink().'">', 'sLinkArticleEnd' => '</a>', 'sArticleName' => TGlobal::OutHTML($oItem->GetName()), 'dAddedAmount' => $dAmount);
                $oUser = TdbDataExtranetUser::GetInstance();
                if (!$oUser->IsLoggedIn()) {
                    $oMsgManager->AddMessage($sMessageHandler, 'WISHLIST-USER-NOT-LOGGED-IN', $aInfoData);
                } else {
                    // add item to list
                    $dNewAmountOnList = $oUser->AddArticleIdToWishlist($sArticleId, $dAmount);

                    $aInfoData['dNewAmount'] = $dNewAmountOnList;
                    if (false === $dNewAmountOnList) {
                        // article was already on notice list...
                        $oMsgManager->AddMessage($sMessageHandler, 'WISHLIST-ITEM-ALREADY-ON-LIST', $aInfoData);
                    } else {
                        $oMsgManager->AddMessage($sMessageHandler, 'WISHLIST-ADDED-ITEM', $aInfoData);
                    }
                }
            } else {
                $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-WISHLIST-INVALID-ITEM-ID');
            }
        }

        // now redirect either to requested page, or to calling page
        $iRedirectNodeId = null;
        if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
            $iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
            if (empty($iRedirectNodeId)) {
                $iRedirectNodeId = null;
            }
        }

        if (!$bIsInternalCall) {
            $this->RedirectAfterEvent($iRedirectNodeId);
        }
    }
823545
public function copyArticle($sOldId = null, $sNewId = null, $sParentId = null)
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        $sOldId = $sOldId ? $sOldId : $this->getEditObjectId();
        $sNewId = $sNewId ? $sNewId : \OxidEsales\Eshop\Core\Registry::getUtilsObject()->generateUID();

        $oArticle = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
        $oArticle->init('oxarticles');
        if ($oArticle->load($sOldId)) {
            if ($myConfig->getConfigParam('blDisableDublArtOnCopy')) {
                $oArticle->oxarticles__oxactive->setValue(0);
                $oArticle->oxarticles__oxactivefrom->setValue(0);
                $oArticle->oxarticles__oxactiveto->setValue(0);
            }

            // setting parent id
            if ($sParentId) {
                $oArticle->oxarticles__oxparentid->setValue($sParentId);
            }

            // setting oxinsert/oxtimestamp
            $iNow = date('Y-m-d H:i:s', \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime());
            $oArticle->oxarticles__oxinsert = new \OxidEsales\Eshop\Core\Field($iNow);

            // mantis#0001590: OXRATING and OXRATINGCNT not set to 0 when copying article
            $oArticle->oxarticles__oxrating = new \OxidEsales\Eshop\Core\Field(0);
            $oArticle->oxarticles__oxratingcnt = new \OxidEsales\Eshop\Core\Field(0);

            $oArticle->setId($sNewId);
            $oArticle->save();

            //copy categories
            $this->_copyCategories($sOldId, $sNewId);

            //atributes
            $this->_copyAttributes($sOldId, $sNewId);

            //sellist
            $this->_copySelectlists($sOldId, $sNewId);

            //crossseling
            $this->_copyCrossseling($sOldId, $sNewId);

            //accessoire
            $this->_copyAccessoires($sOldId, $sNewId);

            // #983A copying staffelpreis info
            $this->_copyStaffelpreis($sOldId, $sNewId);

            //copy article extends (longdescription)
            $this->_copyArtExtends($sOldId, $sNewId);

            //files
            $this->_copyFiles($sOldId, $sNewId);

            $this->resetContentCache();

            $myUtilsObject = \OxidEsales\Eshop\Core\Registry::getUtilsObject();
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

            //copy variants
            $sQ = "select oxid from oxarticles where oxparentid = " . $oDb->quote($sOldId);
            $oRs = $oDb->select($sQ);
            if ($oRs !== false && $oRs->count() > 0) {
                while (!$oRs->EOF) {
                    $this->copyArticle($oRs->fields[0], $myUtilsObject->generateUid(), $sNewId);
                    $oRs->fetchRow();
                }
            }

            // only for top articles
            if (!$sParentId) {
                $this->setEditObjectId($oArticle->getId());

                //article number handling, warns for artnum duplicates
                $sFncParameter = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('fnc');
                $sArtNumField = 'oxarticles__oxartnum';
                if ($myConfig->getConfigParam('blWarnOnSameArtNums') &&
                    $oArticle->$sArtNumField->value && $sFncParameter == 'copyArticle'
                ) {
                    $sSelect = "select oxid from " . $oArticle->getCoreTableName() .
                               " where oxartnum = " . $oDb->quote($oArticle->$sArtNumField->value) .
                               " and oxid != " . $oDb->quote($sNewId);

                    if ($oArticle->assignRecord($sSelect)) {
                        $this->_aViewData["errorsavingatricle"] = 1;
                    }
                }
            }
        }
    }
311604
protected function _updateArticleVarName($sUpdate, $sArtId)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sUpdate = "update oxarticles set " . $sUpdate . " where oxid = " . $oDb->quote($sArtId);
        $oDb->Execute($sUpdate);
    }
1052206
public function loadTop5Articles($iLimit = null)
    {
        //has module?
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
            $this->getBaseObject()->disablePriceLoad();
        }

        switch ($myConfig->getConfigParam('iTop5Mode')) {
            case 0:
                // switched off, do nothing
                break;
            case 1:
                // manually entered
                $this->loadActionArticles('oxtop5', $iLimit);
                break;
            case 2:
                $sArticleTable = getViewName('oxarticles');

                //by default limit 5
                $sLimit = ($iLimit > 0) ? "limit " . $iLimit : 'limit 5';

                $sSelect = "select * from $sArticleTable ";
                $sSelect .= "where " . $this->getBaseObject()->getSqlActiveSnippet() . " and $sArticleTable.oxissearch = 1 ";
                $sSelect .= "and $sArticleTable.oxparentid = '' and $sArticleTable.oxsoldamount>0 ";
                $sSelect .= "order by $sArticleTable.oxsoldamount desc $sLimit";

                $this->selectString($sSelect);
                break;
        }
    }
709824
public function aroundGetStockItem(
        \Magento\CatalogInventory\Model\StockRegistryProvider $subject,
        \Closure $proceed,
        $productId,
        $scopeId
    ) {
        // $result = $proceed($productId, $scopeId); // original method will create empty item for stock registry
        $result = $this->storeStockRegistry->getStockItem($productId, $scopeId);
        if (null === $result) {
            $criteria = $this->factStockItemCrit->create();
            $criteria->setProductsFilter($productId);
            $stockId = $this->manStock->getCurrentStockId();
            $criteria->setStockFilter($stockId);
            $collection = $this->daoStockItem->getList($criteria);
            $result = current($collection->getItems());
            if ($result && $result->getItemId()) {
                $this->storeStockRegistry->setStockItem($productId, $scopeId, $result);
            } else {
                $result = $this->factStockItem->create();
            }
        }
        return $result;
    }
41312
protected function _getArticleSelect($sRecommId, $sArticlesFilter = null)
    {
        $sRecommId = \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quote($sRecommId);

        $sArtView = getViewName('oxarticles');
        $sSelect = "select distinct $sArtView.*, oxobject2list.oxdesc from oxobject2list ";
        $sSelect .= "left join $sArtView on oxobject2list.oxobjectid = $sArtView.oxid ";
        $sSelect .= "where (oxobject2list.oxlistid = $sRecommId) " . $sArticlesFilter;

        return $sSelect;
    }
442107
public function delete($orderId = null)
    {
        if (empty($orderId)) {
            $orderId = $this->getOrderId();
        }
        
        /** @var QueueHandler $handler */
        $handler = $this->requestHandler();
        return $handler->delete($orderId);
    }
1206187
public function getById($id, $srid = null)
    {
        $rows = $this->getSelectQueryBuilder($srid)
            ->where($this->getUniqueId() . " = :id")
            ->setParameter('id', $id)
            ->execute()
            ->fetchAll();
        $this->prepareResults($rows, $srid);
        return reset($rows);
    }
958572
def CancelarAnticipo(self, pto_emision=None, nro_orden=None, coe=None, 
                               pdf=None):
        ""
        
        # llamo al webservice:
        ret = self.client.lpgCancelarAnticipo(
                        auth={
                            'token': self.Token, 'sign': self.Sign,
                            'cuit': self.Cuit, },
                        coe=coe,
                        ptoEmision=pto_emision,
                        nroOrden=nro_orden,
                        pdf="S" if pdf else "N",
                        )

        # analizo la respusta
        ret = ret['liqConsReturn']
        self.__analizar_errores(ret)
        if 'liquidacion' in ret:
            aut = ret['autorizacion']
            liq = ret['liquidacion']
            self.AnalizarLiquidacion(aut, liq)
        # guardo el PDF si se indico archivo y vino en la respuesta:
        if pdf and 'pdf' in ret:
            open(pdf, "wb").write(ret['pdf'])
        return True
885438
public function removeArticleBundle()
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sQuotedChosenArt = $oDb->quote(\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid'));

        $sQ = "update oxarticles set oxarticles.oxbundleid = '' where oxarticles.oxid  =  {$sQuotedChosenArt} ";
        $oDb->Execute($sQ);
    }
222598
private function deleteForm($bID, $qsID)
    {
        $db = Loader::db();
        $this->deleteFormAnswers($qsID);

        $v = [intval($bID)];
        $q = 'DELETE FROM btFormQuestions WHERE bID = ?';
        $r = $db->query($q, $v);

        $q = 'DELETE FROM btForm WHERE bID = ?';
        $r = $db->query($q, $v);

        $q = 'DELETE FROM Blocks WHERE bID = ?';
        $r = $db->query($q, $v);
    }
181880
public function delete($identifier = null) {
		if ($this->get($identifier) === null) return;
		$this->arrayDelete(self::$_data, '_session_class._standard.' . $this->section . ($identifier !== null ? '.' . $identifier : ''));
	}
693835
public function reserve(StockUnit $unit): void
    {
        if ($unit->isReserved()) {
            throw new \DomainException('The StockUnit is already reserved');
        }
        $unit->beReservedByMovement($this);
        $this->setSrcLocation($unit->getLocation());
        $this->reservedStockUnits->add($unit);
    }
1328967
protected function DeleteNotExecutedOrder($sUniqId)
    {
        $oNotExecutedOrder = TdbShopOrder::GetNewInstance();
        if ($oNotExecutedOrder->LoadFromField('order_ident', $sUniqId)) {
            $oNotExecutedOrder->AllowEditByAll(true);
            $oNotExecutedOrder->Delete();
            $oNotExecutedOrder->AllowEditByAll(false);
            unset($_SESSION[TShopBasket::SESSION_KEY_PROCESSING_BASKET]);
        }
    }
777972
protected function emptyFinal($count)
    {
        $returnValue = array();

        while ($count > 0) {
            $returnValue[] = array_pop($this->final);
            $count--;
        }

        return array_reverse($returnValue);
    }