return true if the voucher may be used for the article.

@param TShopBasketArticle $oArticle

@return bool
437153
public function AllowVoucherForArticle(TShopBasketArticle $oArticle)
    {
        $bMayBeUsed = true;

        $oVoucherDef = &$this->GetFieldShopVoucherSeries();

        if ($oArticle->fieldExcludeFromVouchers && empty($oVoucherDef->fieldShopVoucherSeriesSponsorId)) {
            $bMayBeUsed = false;
        }

        // check article restrictions
        if ($bMayBeUsed) {
            $aArticleRestrictons = $oVoucherDef->GetMLTIdList('shop_article_mlt');
            if (count($aArticleRestrictons) > 0 && !in_array($oArticle->id, $aArticleRestrictons)) {
                $bMayBeUsed = false;
            }
        }

        // check manufacturer restrictions
        if ($bMayBeUsed) {
            $aManufacturerRestrictons = $oVoucherDef->GetMLTIdList('shop_manufacturer_mlt');
            if (count($aManufacturerRestrictons) > 0 && !in_array($oArticle->fieldShopManufacturerId, $aManufacturerRestrictons)) {
                $bMayBeUsed = false;
            }
        }

        // check category restrictions
        if ($bMayBeUsed) {
            $aCategoryRestrictons = $oVoucherDef->GetMLTIdList('shop_category_mlt');
            if (count($aCategoryRestrictons) > 0) {
                if (!$oArticle->IsInCategory($aCategoryRestrictons)) {
                    $bMayBeUsed = false;
                }
            }
        }

        // check product group restrictions
        if ($bMayBeUsed) {
            $aArticleGroupRestrictons = $oVoucherDef->GetMLTIdList('shop_article_group_mlt');
            if (count($aArticleGroupRestrictons) > 0) {
                $aGroups = $oArticle->GetMLTIdList('shop_article_group_mlt');
                $aMatches = array_intersect($aGroups, $aArticleGroupRestrictons);
                if (0 == count($aMatches)) {
                    $bMayBeUsed = false;
                }
            }
        }

        return $bMayBeUsed;
    }
1025197
public function isAvailable( MShop_Order_Item_Base_Interface $basket )
	{
		$addresses = $basket->getAddresses();

		$paymentType = MShop_Order_Item_Base_Address_Abstract::TYPE_PAYMENT;
		$deliveryType = MShop_Order_Item_Base_Address_Abstract::TYPE_DELIVERY;


		if( isset( $addresses[$deliveryType] ) )
		{
			$code = strtoupper( $addresses[$deliveryType]->getCountryId() );

			if( $this->_checkCountryCode( $code, 'country.delivery-include' ) === false
				|| $this->_checkCountryCode( $code, 'country.delivery-exclude' ) === true
			) {
				return false;
			}
		}
		else if( isset( $addresses[$paymentType] ) ) // use billing address if no delivery address is available
		{
			$code = strtoupper( $addresses[$paymentType]->getCountryId() );

			if( $this->_checkCountryCode( $code, 'country.delivery-include' ) === false
				|| $this->_checkCountryCode( $code, 'country.delivery-exclude' ) === true
			) {
				return false;
			}
		}

		if( isset( $addresses[$paymentType] ) )
		{
			$code = strtoupper( $addresses[$paymentType]->getCountryId() );

			if( $this->_checkCountryCode( $code, 'country.billing-include' ) === false
				|| $this->_checkCountryCode( $code, 'country.billing-exclude' ) === true
			) {
				return false;
			}
		}

		return $this->_getProvider()->isAvailable( $basket );
	}
1247212
public function GetBasketQuantityForVoucher(TdbShopVoucher &$oVoucher)
    {
        $iCurrentPosition = $this->getItemPointer();
        $this->GoToStart();
        $iAmount = 0;
        while ($oItem = &$this->Next()) {
            $bIncludeProduct = $oVoucher->AllowVoucherForArticle($oItem);
            if ($bIncludeProduct) {
                $iAmount = $iAmount + $oItem->dAmount;
            }
        }
        $this->setItemPointer($iCurrentPosition);

        return $iAmount;
    }
705789
public function hasArticlesWithIntangibleAgreement()
    {
        $blHasArticlesWithIntangibleAgreement = false;

        /** @var \OxidEsales\Eshop\Application\Model\BasketItem $oBasketItem */
        foreach ($this->_aBasketContents as $oBasketItem) {
            if ($oBasketItem->getArticle(false) && $oBasketItem->getArticle(false)->hasIntangibleAgreement()) {
                $blHasArticlesWithIntangibleAgreement = true;
                break;
            }
        }

        return $blHasArticlesWithIntangibleAgreement;
    }
298597
protected function _getVatForArticleCategory(\OxidEsales\Eshop\Application\Model\Article $oArticle)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sCatT = getViewName('oxcategories');

        if ($this->_blCatVatSet === null) {
            $sSelect = "SELECT oxid FROM $sCatT WHERE oxvat IS NOT NULL LIMIT 1";

            //no category specific vats in shop?
            //then for performance reasons we just return false
            $this->_blCatVatSet = (bool) $oDb->getOne($sSelect);
        }

        if (!$this->_blCatVatSet) {
            return false;
        }

        $sO2C = getViewName('oxobject2category');
        $sSql = "SELECT c.oxvat
                 FROM $sCatT AS c, $sO2C AS o2c
                 WHERE c.oxid=o2c.oxcatnid AND
                       o2c.oxobjectid = " . $oDb->quote($oArticle->getId()) . " AND
                       c.oxvat IS NOT NULL
                 ORDER BY o2c.oxtime ";

        $fVat = $oDb->getOne($sSql);
        if ($fVat !== false && $fVat !== null) {
            return $fVat;
        }

        return false;
    }
337333
public function setActionArticle()
    {
        $sArticleId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxarticleid');
        $sActionId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $oDb->Execute(
            'delete from oxobject2action '
            . 'where oxactionid=' . $oDb->quote($sActionId)
            . ' and oxclass = "oxarticle"'
        );

        $oObject2Promotion = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
        $oObject2Promotion->init('oxobject2action');
        $oObject2Promotion->oxobject2action__oxactionid = new \OxidEsales\Eshop\Core\Field($sActionId);
        $oObject2Promotion->oxobject2action__oxobjectid = new \OxidEsales\Eshop\Core\Field($sArticleId);
        $oObject2Promotion->oxobject2action__oxclass = new \OxidEsales\Eshop\Core\Field("oxarticle");
        $oObject2Promotion->save();
    }
353751
public function exportVouchers($iStart)
    {
        $iExported = false;

        if ($oSerie = $this->_getVoucherSerie()) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb(\OxidEsales\Eshop\Core\DatabaseProvider::FETCH_MODE_ASSOC);

            $sSelect = "select oxvouchernr from oxvouchers where oxvoucherserieid = " . $oDb->quote($oSerie->getId());
            $rs = $oDb->selectLimit($sSelect, $this->iExportPerTick, $iStart);

            if (!$rs->EOF) {
                $iExported = 0;

                // writing header text
                if ($iStart == 0) {
                    $this->write(\OxidEsales\Eshop\Core\Registry::getLang()->translateString("VOUCHERSERIE_MAIN_VOUCHERSTATISTICS", \OxidEsales\Eshop\Core\Registry::getLang()->getTplLanguage(), true));
                }
            }

            // writing vouchers..
            while (!$rs->EOF) {
                $this->write(current($rs->fields));
                $iExported++;
                $rs->fetchRow();
            }
        }

        return $iExported;
    }
186181
public function IsValidForBasket()
    {
        $bValidForBasket = false;
        $oArticles = &$this->GetAffectedBasketArticles();
        $bValidForBasket = ($oArticles->Length() > 0);

        return $bValidForBasket;
    }
185607
protected function ViewArticleHook()
    {
        $this->SetTemplate('MTShopArticleCatalog', 'system/article');

        // add review item and fill with user data
        $oReviewItem = TdbShopArticleReview::GetNewInstance();
        /** @var $oReviewItem TdbShopArticleReview */
        $oGlobal = TGlobal::instance();
        $aReviewData = array();
        if ($oGlobal->UserDataExists(TdbShopArticleReview::INPUT_BASE_NAME)) {
            $aReviewData = $oGlobal->GetUserData(TdbShopArticleReview::INPUT_BASE_NAME);
        } else {
            $oUser = TdbDataExtranetUser::GetInstance();
            if ($oUser->IsLoggedIn()) {
                $aReviewData['author_name'] = $oUser->GetUserAlias();
                $aReviewData['author_email'] = $oUser->GetUserEMail();
            }
        }
        $aReviewData['captcha-question'] = $this->GenerateCaptcha();

        if (is_array($aReviewData)) {
            $oReviewItem->LoadFromRowProtected($aReviewData);
        }
        $this->data['oReviewEntryItem'] = &$oReviewItem;
    }
1074808
protected function _deleteMainIcon($oArticle)
    {
        if ($this->canDeleteMainIcon($oArticle)) {
            if (!$oArticle->isDerived()) {
                $oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
                $oPicHandler->deleteMainIcon($oArticle);
            }

            //reseting field
            $oArticle->oxarticles__oxicon = new \OxidEsales\Eshop\Core\Field();
        }
    }
452633
public function isConfirmedByPayPal($basket)
    {
        $oldBasketAmount = $this->getSession()->getVariable("oepaypal-basketAmount");
        if (!$oldBasketAmount) {
            return false;
        }

        $payPalCheckValidator = oxNew(\OxidEsales\PayPalModule\Core\PayPalCheckValidator::class);
        $payPalCheckValidator->setNewBasketAmount($basket->getPrice()->getBruttoPrice());
        $payPalCheckValidator->setOldBasketAmount($oldBasketAmount);

        return $payPalCheckValidator->isPayPalCheckValid();
    }
416664
protected function _validateBasket(\OxidEsales\Eshop\Application\Model\Basket $oBasket)
    {
        $aCurrContent = $oBasket->getContents();
        if (empty($aCurrContent)) {
            return;
        }

        $iCurrLang = \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage();
        foreach ($aCurrContent as $oContent) {
            if ($oContent->getLanguageId() != $iCurrLang) {
                $oContent->setLanguageId($iCurrLang);
            }
        }
    }
687090
protected function _getArticleItems(\OxidEsales\Eshop\Application\Model\ArticleList $oList)
    {
        $myUtilsUrl = Registry::getUtilsUrl();
        $aItems = [];
        $oLang = Registry::getLang();
        $oStr = getStr();

        foreach ($oList as $oArticle) {
            $oItem = new stdClass();
            $oActCur = \OxidEsales\Eshop\Core\Registry::getConfig()->getActShopCurrencyObject();
            $sPrice = '';

            // check if article is a variant
            if ($oArticle->isParentNotBuyable()) {
                $oPrice = $oArticle->getVarMinPrice();
            } else {
                $oPrice = $oArticle->getPrice();
            }

            if ($oPrice) {
                $sFrom = ($oArticle->isRangePrice()) ? Registry::getLang()->translateString('PRICE_FROM') . ' ' : '';
                $sPrice .= ' ' . $sFrom . $oLang->formatCurrency($oPrice->getBruttoPrice(), $oActCur) . ' ' . $oActCur->sign;
            }

            $oItem->title = strip_tags($oArticle->oxarticles__oxtitle->value . $sPrice);
            $oItem->guid = $oItem->link = $myUtilsUrl->prepareUrlForNoSession($oArticle->getLink());
            $oItem->isGuidPermalink = true;
            // $oItem->description             = $oArticle->getLongDescription()->value; //oxarticles__oxshortdesc->value;
            //#4038: Smarty not parsed in RSS, although smarty parsing activated for longdescriptions
            if (Registry::getConfig()->getConfigParam('bl_perfParseLongDescinSmarty')) {
                $oItem->description = $oArticle->getLongDesc();
            } else {
                $oItem->description = $oArticle->getLongDescription()->value;
            }

            if (trim(str_replace('&nbsp;', '', (strip_tags($oItem->description)))) == '') {
                $oItem->description = $oArticle->oxarticles__oxshortdesc->value;
            }

            $oItem->description = trim($oItem->description);
            if ($sThumb = $oArticle->getThumbnailUrl()) {
                $oItem->description = "<img src='$sThumb' border=0 align='left' hspace=5>" . $oItem->description;
            }
            $oItem->description = $oStr->htmlspecialchars($oItem->description);

            if ($oArticle->oxarticles__oxtimestamp->value) {
                list($date, $time) = explode(' ', $oArticle->oxarticles__oxtimestamp->value);
                $date = explode('-', $date);
                $time = explode(':', $time);
                $oItem->date = date('D, d M Y H:i:s O', mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]));
            } else {
                $oItem->date = date('D, d M Y H:i:s O', time());
            }

            $aItems[] = $oItem;
        }

        return $aItems;
    }
507391
protected function _deleteThumbnail($oArticle)
    {
        if ($this->canDeleteThumbnail($oArticle)) {
            if (!$oArticle->isDerived()) {
                $oPicHandler = \OxidEsales\Eshop\Core\Registry::getPictureHandler();
                $oPicHandler->deleteThumbnail($oArticle);
            }

            //reseting field
            $oArticle->oxarticles__oxthumb = new \OxidEsales\Eshop\Core\Field();
        }
    }
241182
public function onDeleteArticle($oArticle)
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sIdQuoted = $oDb->quote($oArticle->getId());
        $oDb->execute("delete from oxseo where oxobjectid = $sIdQuoted and oxtype = 'oxarticle'");
        $oDb->execute("delete from oxobject2seodata where oxobjectid = $sIdQuoted");
        $oDb->execute("delete from oxseohistory where oxobjectid = $sIdQuoted");
    }
1298205
protected function _getArticleBundles($oBasketItem)
    {
        $aBundles = [];

        if ($oBasketItem->isBundle()) {
            return $aBundles;
        }

        $oArticle = $oBasketItem->getArticle(true);
        if ($oArticle && $oArticle->oxarticles__oxbundleid->value) {
            $aBundles[$oArticle->oxarticles__oxbundleid->value] = 1;
        }

        return $aBundles;
    }
844723
protected function _getCategory($oArticle, $iLang)
    {
        $oCat = null;
        $oView = \OxidEsales\Eshop\Core\Registry::getConfig()->getActiveView();
        if ($oView instanceof \OxidEsales\Eshop\Application\Controller\FrontendController) {
            $oCat = $oView->getActiveCategory();
        } elseif ($oView instanceof \OxidEsales\Eshop\Core\Controller\BaseController) {
            $oCat = $oView->getActCategory();
        }

        return $oCat;
    }