aAdds/removes user chosen article to/from his noticelist
or wishlist (oxuserbasket::addItemToBasket()).

@param array  $aArticleList basket products
@param object $oUser        user object
424788
protected function _updateWishlist($aArticleList, $oUser)
    {

        foreach ($aArticleList as $oContent) {
            if (($sWishId = $oContent->getWishId())) {
                // checking which wishlist user uses ..
                if ($sWishId == $oUser->getId()) {
                    $oUserBasket = $oUser->getBasket('wishlist');
                } else {
                    $aWhere = ['oxuserbaskets.oxuserid' => $sWishId, 'oxuserbaskets.oxtitle' => 'wishlist'];
                    $oUserBasket = oxNew(\OxidEsales\Eshop\Application\Model\UserBasket::class);
                    $oUserBasket->assignRecord($oUserBasket->buildSelectString($aWhere));
                }

                // updating users wish list
                if ($oUserBasket) {
                    if (!($sProdId = $oContent->getWishArticleId())) {
                        $sProdId = $oContent->getProductId();
                    }
                    $oUserBasketItem = $oUserBasket->getItem($sProdId, $oContent->getSelList());
                    $dNewAmount = $oUserBasketItem->oxuserbasketitems__oxamount->value - $oContent->getAmount();
                    if ($dNewAmount < 0) {
                        $dNewAmount = 0;
                    }
                    $oUserBasket->addItemToBasket($sProdId, $dNewAmount, $oContent->getSelList(), true);
                }
            }
        }
    }
1168240
public function removeCustomerRelations(int $idProductList, array $customerIds): void
    {
        if (count($customerIds) === 0) {
            return;
        }

        $productListCustomerEntities = $this->getFactory()
            ->createProductListCustomerQuery()
            ->filterByFkProductList($idProductList)
            ->filterByFkCustomer_In($customerIds)
            ->find();

        foreach ($productListCustomerEntities as $productListCustomer) {
            $productListCustomer->delete();
        }
    }
484029
public static function delete_data_for_users(approved_userlist $userlist) {
        $context = $userlist->get_context();

        if ($context instanceof \context_user) {
            static::delete_data($context->instanceid);
        }
    }
440812
protected function checkUserGroup(TdbDataExtranetUser $oUser)
    {
        $bIsValidGroup = false;
        $aUserGroups = $this->getPaymentMethodDataAccess()->getPermittedUserGroupIds($this->id);
        if (!is_array($aUserGroups) || count($aUserGroups) < 1) {
            $bIsValidGroup = true;
        } elseif ($oUser->IsLoggedIn()) {
            $bIsValidGroup = $oUser->InUserGroups($aUserGroups);
        }

        return $bIsValidGroup;
    }
206307
public static function delete_data_for_users(approved_userlist $userlist) {
        global $DB;

        $context = $userlist->get_context();
        $recordstobedeleted = [];
        list($userinsql, $userinparams) = $DB->get_in_or_equal($userlist->get_userids(), SQL_PARAMS_NAMED);

        $sql = "SELECT " . self::sql_fields() . "
                  FROM {context} ctx
                  JOIN {course_modules} cm ON cm.id = ctx.instanceid
                  JOIN {modules} m ON m.id = cm.module AND m.name = :modname
                  JOIN {data} d ON d.id = cm.instance
                  JOIN {data_records} dr ON dr.dataid = d.id AND dr.userid {$userinsql}
             LEFT JOIN {data_content} dc ON dc.recordid = dr.id
             LEFT JOIN {data_fields} df ON df.id = dc.fieldid
                 WHERE ctx.id = :ctxid AND ctx.contextlevel = :contextlevel
              ORDER BY dr.id";

        $params = [
            'ctxid' => $context->id,
            'contextlevel' => CONTEXT_MODULE,
            'modname' => 'data',
        ];
        $params += $userinparams;

        $rs = $DB->get_recordset_sql($sql, $params);
        foreach ($rs as $row) {
            self::mark_data_content_for_deletion($context, $row);
            $recordstobedeleted[$row->recordid] = $row->recordid;
        }
        $rs->close();

        self::delete_data_records($context, $recordstobedeleted);

        // Additionally remove comments these users made on other entries.
        \core_comment\privacy\provider::delete_comments_for_users($userlist, 'mod_data', 'database_entry');

        // We do not delete ratings made by users on other records because it may change grades.
    }
493787
public static function delete_data_for_users(approved_userlist $userlist) {
        global $DB;

        // Questions are considered to be 'owned' by the institution, even if they were originally written by a specific
        // user. They are still exported in the list of a users data, but they are not removed.
        // The userid is instead anonymised.

        $context = $userlist->get_context();
        $userids = $userlist->get_userids();

        list($createdbysql, $createdbyparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);
        list($modifiedbysql, $modifiedbyparams) = $DB->get_in_or_equal($userids, SQL_PARAMS_NAMED);

        $params = ['contextid' => $context->id];

        $DB->set_field_select('question', 'createdby', 0, "
                category IN (SELECT id FROM {question_categories} WHERE contextid = :contextid)
            AND createdby {$createdbysql}", $params + $createdbyparams);

        $DB->set_field_select('question', 'modifiedby', 0, "
                category IN (SELECT id FROM {question_categories} WHERE contextid = :contextid)
            AND modifiedby {$modifiedbysql}", $params + $modifiedbyparams);
    }
747870
public static function delete_data_for_users(\core_privacy\local\request\approved_userlist $userlist) {
        global $DB;
        $context = $userlist->get_context();
        if ($context->contextlevel != CONTEXT_BLOCK) {
            return;
        }

        list($insql, $params) = $DB->get_in_or_equal($userlist->get_userids(), SQL_PARAMS_NAMED);
        $params['hidden'] = 'block' . $context->instanceid . 'hidden';
        $params['docked'] = 'docked_block_instance_' . $context->instanceid;

        $DB->delete_records_select('user_preferences', "(name = :hidden OR name = :docked) AND userid $insql", $params);
    }
839101
public static function removeByIDs( $idList )
    {
        if ( !is_array( $idList ) )
            return;

        while ( count( $idList ) > 0 )
        {
            // remove by portion of 100 rows.
            $ids = array_splice( $idList, 0, 100 );

            $conditions = array( 'id' => array( $ids ) );

            eZPersistentObject::removeObject( self::definition(),
                                              $conditions );
        }
    }
387467
public static function delete_data_for_users(approved_userlist $userlist) {

        $context = $userlist->get_context();

        if ($context instanceof \context_user) {
            \core_userkey\privacy\provider::delete_userkeys('rss', $context->instanceid);
        }
    }
779105
public function removeContributors(Site $site, $userIdList)
    {
        $this->removeUsersWithRole($site, $userIdList, Access::ROLE_CONTRIB);
    }
1085743
protected function _setOrderArticles($aArticleList)
    {
        // reset articles list
        $this->_oArticles = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
        $iCurrLang = $this->getOrderLanguage();

        // add all the products we have on basket to the order
        foreach ($aArticleList as $oContent) {
            //$oContent->oProduct = $oContent->getArticle();
            // #M773 Do not use article lazy loading on order save
            $oProduct = $oContent->getArticle(true, null, true);

            // copy only if object is oxarticle type
            if ($oProduct->isOrderArticle()) {
                $oOrderArticle = $oProduct;
            } else {
                // if order language does not match product language article must be reloaded in order language
                if ($iCurrLang != $oProduct->getLanguage()) {
                    $oProduct->loadInLang($iCurrLang, $oProduct->getProductId());
                }

                // set chosen select list
                $sSelList = '';
                if (count($aChosenSelList = $oContent->getChosenSelList())) {
                    foreach ($aChosenSelList as $oItem) {
                        if ($sSelList) {
                            $sSelList .= ", ";
                        }
                        $sSelList .= "{$oItem->name} : {$oItem->value}";
                    }
                    if ($sSelList !== '' && $oContent->getVarSelect() !== '') {
                        $sSelList .= ' ||';
                    }
                }

                $oOrderArticle = oxNew(\OxidEsales\Eshop\Application\Model\OrderArticle::class);
                $oOrderArticle->setIsNewOrderItem(true);
                $oOrderArticle->copyThis($oProduct);
                $oOrderArticle->setId();

                $oOrderArticle->oxorderarticles__oxartnum = clone $oProduct->oxarticles__oxartnum;
                $oOrderArticle->oxorderarticles__oxselvariant = new \OxidEsales\Eshop\Core\Field(trim($sSelList . ' ' . $oContent->getVarSelect()), \OxidEsales\Eshop\Core\Field::T_RAW);
                $oOrderArticle->oxorderarticles__oxshortdesc = new \OxidEsales\Eshop\Core\Field($oProduct->oxarticles__oxshortdesc->getRawValue(), \OxidEsales\Eshop\Core\Field::T_RAW);
                // #M974: duplicated entries for the name of variants in orders
                $oOrderArticle->oxorderarticles__oxtitle = new \OxidEsales\Eshop\Core\Field(trim($oProduct->oxarticles__oxtitle->getRawValue()), \OxidEsales\Eshop\Core\Field::T_RAW);

                // copying persistent parameters ...
                if (!is_array($aPersParams = $oProduct->getPersParams())) {
                    $aPersParams = $oContent->getPersParams();
                }
                if (is_array($aPersParams) && count($aPersParams)) {
                    $oOrderArticle->oxorderarticles__oxpersparam = new \OxidEsales\Eshop\Core\Field(serialize($aPersParams), \OxidEsales\Eshop\Core\Field::T_RAW);
                }
            }

            // ids, titles, numbers ...
            $oOrderArticle->oxorderarticles__oxorderid = new \OxidEsales\Eshop\Core\Field($this->getId());
            $oOrderArticle->oxorderarticles__oxartid = new \OxidEsales\Eshop\Core\Field($oContent->getProductId());
            $oOrderArticle->oxorderarticles__oxamount = new \OxidEsales\Eshop\Core\Field($oContent->getAmount());

            // prices
            $oPrice = $oContent->getPrice();
            $oOrderArticle->oxorderarticles__oxnetprice = new \OxidEsales\Eshop\Core\Field($oPrice->getNettoPrice(), \OxidEsales\Eshop\Core\Field::T_RAW);
            $oOrderArticle->oxorderarticles__oxvatprice = new \OxidEsales\Eshop\Core\Field($oPrice->getVatValue(), \OxidEsales\Eshop\Core\Field::T_RAW);
            $oOrderArticle->oxorderarticles__oxbrutprice = new \OxidEsales\Eshop\Core\Field($oPrice->getBruttoPrice(), \OxidEsales\Eshop\Core\Field::T_RAW);
            $oOrderArticle->oxorderarticles__oxvat = new \OxidEsales\Eshop\Core\Field($oPrice->getVat(), \OxidEsales\Eshop\Core\Field::T_RAW);

            $oUnitPrice = $oContent->getUnitPrice();
            $oOrderArticle->oxorderarticles__oxnprice = new \OxidEsales\Eshop\Core\Field($oUnitPrice->getNettoPrice(), \OxidEsales\Eshop\Core\Field::T_RAW);
            $oOrderArticle->oxorderarticles__oxbprice = new \OxidEsales\Eshop\Core\Field($oUnitPrice->getBruttoPrice(), \OxidEsales\Eshop\Core\Field::T_RAW);

            // wrap id
            $oOrderArticle->oxorderarticles__oxwrapid = new \OxidEsales\Eshop\Core\Field($oContent->getWrappingId(), \OxidEsales\Eshop\Core\Field::T_RAW);

            // items shop id
            $oOrderArticle->oxorderarticles__oxordershopid = new \OxidEsales\Eshop\Core\Field($oContent->getShopId(), \OxidEsales\Eshop\Core\Field::T_RAW);

            // bundle?
            $oOrderArticle->oxorderarticles__oxisbundle = new \OxidEsales\Eshop\Core\Field($oContent->isBundle());

            // add information for eMail
            //P
            //TODO: check if this assign is needed at all
            $oOrderArticle->oProduct = $oProduct;

            $oOrderArticle->setArticle($oProduct);

            // simulation order article list
            $this->_oArticles->offsetSet($oOrderArticle->getId(), $oOrderArticle);
        }
    }
524553
public function setActiveUser($oUser)
    {
        $this->activeUser = $oUser;
        $oDateTimeService = Factory::service('DateTime');

        //  Set the user's date/time formats
        $sFormatDate = $this->activeUser('pref_date_format');
        $sFormatDate = $sFormatDate ? $sFormatDate : $oDateTimeService->getDateFormatDefaultSlug();

        $sFormatTime = $this->activeUser('pref_time_format');
        $sFormatTime = $sFormatTime ? $sFormatTime : $oDateTimeService->getTimeFormatDefaultSlug();

        $oDateTimeService->setFormats($sFormatDate, $sFormatTime);
    }
466647
public function deleteSubscriptionsFor($userId, $chanIdList = null)
    {
        $conditions = [
            Field::SUBER_NAME => $this
                ->notificationService
                ->getSubscriberName($userId),
        ];

        if ($chanIdList) {
            $conditions[Field::CHAN_ID] = $chanIdList;
        }

        $this
            ->notificationService
            ->getBackend()
            ->fetchSubscriptions($conditions)
            ->delete()
        ;
    }
406731
public function removeVoucher($sVoucherId)
    {
        // removing if it exists
        if (isset($this->_aVouchers[$sVoucherId])) {
            $oVoucher = oxNew(\OxidEsales\Eshop\Application\Model\Voucher::class);
            $oVoucher->load($sVoucherId);

            $oVoucher->unMarkAsReserved();

            // unset it if exists this voucher in DB or not
            unset($this->_aVouchers[$sVoucherId]);
            $this->onUpdate();
        }
    }
330211
public function getArticleDiscounts($oArticle, $oUser = null)
    {
        $aList = [];
        $aDiscList = $this->_getList($oUser)->getArray();
        foreach ($aDiscList as $oDiscount) {
            if ($oDiscount->isForArticle($oArticle)) {
                $aList[$oDiscount->getId()] = $oDiscount;
            }
        }

        return $aList;
    }
1242488
protected function _parentFinalizeOrder(Basket $oBasket, $oUser, $blRecalculatingOrder = false)
    {
        return parent::finalizeOrder($oBasket, $oUser, $blRecalculatingOrder);
    }
282573
public function filterList(ItemList $list)
    {
        if ($this->attributeKey !== null) {
            $type = $this->attributeKey->getAttributeType();
            $cnt = $type->getController();
            $cnt->setRequestArray($this->data);
            $cnt->setAttributeKey($this->attributeKey);
            $cnt->searchForm($list);
        }
    }