Get referral group data instead of anonymous group.

@param \Magento\Customer\Model\GroupManagement $subject
@param \Closure $proceed
@return \Magento\Customer\Api\Data\GroupInterface
@throws \Magento\Framework\Exception\LocalizedException
163912
public function aroundGetNotLoggedInGroup(
        \Magento\Customer\Model\GroupManagement $subject,
        \Closure $proceed
    )
    {
        /* call parent to process other around-plugins */
        $result = $proceed();
        /* check referral code in registry */
        $code = $this->hlpReferral->getReferralCode();
        if ($code) {
            /* and return referral group if code exists */
            $groupId = $this->hlpConfig->getReferralsGroupReferrals();
            $result = $this->daoCustGroup->getById($groupId);
        }
        return $result;
    }
1122612
public function get(int $groupId, int $begin, int $count)
    {
        $params = [
            'group_id' => $groupId,
            'begin' => $begin,
            'count' => $count,
        ];

        return $this->httpPostJson('shakearound/device/group/getdetail', $params);
    }
1018798
public function aroundSendNewAccountEmail(
        \Magento\Customer\Model\Customer $customer,
        callable $proceed,
        $type = 'registered',
        $backUrl = '',
        $storeId = '0'
    ) {
        $storeId = $customer->getStoreId();

        if (! $this->scopeConfig->getValue(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_DISABLE_CUSTOMER_SUCCESS,
            'store',
            $storeId
        )
        ) {
            return $proceed($type, $backUrl, $storeId);
        }
    }
1179180
static function &group($name, $priority = null) {
        if(!is_null($priority)) {
            static::$groups_priority[$name] = $priority;
        }
        if(!in_array($name, static::$groups)) {
            static::$groups[$name] = new SidebarMenuGroup();
        }

        return static::$groups[$name];
    }
637779
public function aroundSave(
        \Magento\Quote\Model\ResourceModel\Quote\Item $subject,
        \Closure $proceed,
        \Magento\Quote\Model\Quote\Item $object
    ) {
        $result = $proceed($object);
        $isDeleted = $object->isDeleted();
        if (!$isDeleted) {
            $id = $object->getId();
            $qty = $object->getQty();
            $product = $object->getProduct();
            $productId = $product->getId();
            $pvWrhs = $this->hlpGetPv->product($productId);
            $subtotal = $this->hlpFormat->toNumber($pvWrhs * $qty);
            /* create/update PV values for quote item (if changed) */
            $pk = [EPvQuoteItem::A_ITEM_REF => $id];
            $found = $this->daoPvQuoteItem->getById($pk);
            if ($found) {
                /* update PV data if subtotals are different */
                if ($found->getSubtotal() != $subtotal) {
                    /* we don't know discount for the item */
                    $found->setSubtotal($subtotal);
                    $found->setDiscount(0);
                    $found->setTotal($subtotal);
                    $this->daoPvQuoteItem->updateById($pk, $found);
                }
            } else {
                /* create new record */
                $entity = new EPvQuoteItem();
                $entity->setItemRef($id);
                /* we don't know discount for the item */
                $entity->setSubtotal($subtotal);
                $entity->setDiscount(0);
                $entity->setTotal($subtotal);
                $this->daoPvQuoteItem->create($entity);
            }
        }
        return $result;
    }
559433
public function aroundGetProductPrice(
        \Magento\Catalog\Block\Product\ListProduct $subject,
        \Closure $proceed,
        \Magento\Catalog\Model\Product $product
    ) {
        $result = $proceed($product);
        $canSeePv = $this->hlpCust->canSeePv();
        if ($canSeePv) {
            $domId = "prxgt_pv_" . $product->getId();
            $pvProd = $product->getData(AProdCollFactory::A_PV_PRODUCT);
            $pvProd = $this->hlpFormat->toNumber($pvProd);
            $html = "<div id=\"$domId\"><span>$pvProd</span> PV</div>";
            $result = $html . $result;
        }
        return $result;
    }
373704
public function aroundAfterSave(\Magento\Quote\Model\Quote $subject, callable $proceed)
    {
        if ($subject->getIsActive()) {
            return $proceed();
        }
        return $subject;
    }
726825
protected function getRedisKey(ComponentInterface $subject, $type, $context)
    {
        return sprintf('%s:%s:%s:%s', $this->prefix, $subject->getHash(), $type, $context);
    }
893974
protected function getItems(Paginator $subject)
    {
        $object = new ReflectionObject($subject);

        $items = $object->getProperty('items');
        $items->setAccessible(true);

        return $items->getValue($subject);
    }
460201
public function aroundGetData(CategoryDataProvider $dataProvider, \Closure $proceed)
    {
        $data = $proceed();

        $currentCategory = $dataProvider->getCurrentCategory();

        if ($currentCategory->getId() !== null && $currentCategory->getLevel() >= 2) {
            $data[$currentCategory->getId()]['facet_config'] = $this->getFilterableAttributeList($currentCategory);
        }

        return $data;
    }
863583
public function aroundSendConfirmationSuccessEmail(
        Subscriber $subscriber,
        callable $proceed
    ) {
        if (!$this->handleConfirmation($subscriber, self::EVENT_NEWSLETTER_SEND_CONFIRMATION_SUCCESS_EMAIL)) {
            return $proceed($subscriber);
        }
    }
360574
public function deleteSubjectAction(Subject $subject)
    {
        if ($this->authorization->isGranted('moderate', new ResourceCollection(array($subject->getCategory()->getForum()->getResourceNode())))) {

            $this->manager->deleteSubject($subject);

            return new RedirectResponse(
                $this->generateUrl('claro_forum_subjects', array('category' => $subject->getCategory()->getId()))
            );
        }

        throw new AccessDeniedException();
    }
225219
public function createMessageAction(Subject $subject)
    {
        $form = $this->container->get('form.factory')->create(new MessageType, new Message());
        $form->handleRequest($this->get('request'));


        if ($form->isValid()) {
            $message = $form->getData();
            $this->manager->createMessage($message, $subject);
        }

        return new RedirectResponse(
            $this->generateUrl('claro_forum_messages', array('subject' => $subject->getId()))
        );
    }
330548
public function roleFetchSubjectRoles(SubjectInterface $subject, $permissions = true)
    {
        $query = "
            SELECT
                role_id
            FROM
                auth_subject_role
            WHERE
                subject_id = :subject_id
        ";
        $roles = [];
        $cur = $this->db->prepare($query);
        $cur->bindValue(":subject_id", $subject->id(), PDO::PARAM_INT);
        try {
            $cur->execute();
            $res = $cur->fetchAll(PDO::FETCH_OBJ);
            if (!$res) {
                return [];
            } else {
                $role_ids = array_map(
                    function ($row) {
                        return $row->role_id;
                    },
                    $res
                );
                $roles = $this->roleFetchById($role_ids);
            }
        } catch (PDOException $db_err) {
            if ($this->logger) {
                $this->logger->error("Failed to fetch roles for subject", ['exception' => $db_err]);
            }
        }
        return $roles;
    }
497988
public function decorate($subject)
    {
        if (is_object($subject)) {
            $subject = clone $subject;
        }

        if ($subject instanceof Model) {
            foreach ($subject->getRelations() as $relationName => $model) {
                $subject->setRelation($relationName, $this->autoPresenter->decorate($model));
            }
        }

        if (!$subject instanceof HasPresenter) {
            return $subject;
        }

        if (!class_exists($presenter = $subject->getPresenterClass())) {
            throw new PresenterNotFoundException($presenter);
        }

        return $this->container->make($presenter)->setWrappedObject($subject);
    }
627241
public function aroundExecute(
        CategoryView $subject,
        \Closure $proceed
    ) {
        if (!$subject->getRequest()->isAjax()) {
            return $proceed();
        }

        try {
            // Remove query parameters added for AJAX requests
            $this->cleanRequestUri();
            $this->removeAjaxQueryParams();

            $page = $proceed();
            if (!$page) {
                throw new \Exception('No page result.');
            }

            if ($this->response->isRedirect()) {
                throw new \Exception('Unable to process page result, redirect detected.');
            }

            $className = '\Magento\Framework\View\Result\Page';
            if (!($page instanceof $className)) {
                throw new \Exception(
                    sprintf(
                        'Unable to process page result. Instance of %s expected, instance of %s got.',
                        $className,
                        get_class($page)
                    )
                );
            }

            $layout = $page->getLayout();
            /** @var $layout \Magento\Framework\View\LayoutInterface */

            $block = $layout->getBlock('category.products.list');
            if (!$block) {
                throw new \Exception('Unable to load block content.');
            }

            $pager = $layout->getBlock('product_list_toolbar_pager');
            if (!$pager) {
                throw new \Exception('Unable to load pager block.');
            }

            // Generate page content to initialize toolbar
            $htmlContent = $layout->renderElement('content');

            $response = [
                'success'           => true,
                'current_page_url'  => $this->getCurrentPageUrl($pager), // e.g. "womens.html?p=3"
                'previous_page_url' => $this->getPreviousPageUrl($pager), // e.g. "womens.html?p=2"
                'next_page_url'     => $this->getNextPageUrl($pager), // e.g. "womens.html?p=4"
                'html'              => [
                    'content'       => $htmlContent,
                    'sidebar_main'  => $layout->renderElement('sidebar.main')
                ]
            ];
        } catch (\Exception $e) {
            $this->logger->critical($e);
            $response = [
                'success'       => false,
                'error_message' => 'Sorry, something went wrong. Please try again later.'
            ];
        }
        return $this->jsonResponse($response);
    }
198889
public function aroundSetForm(Front $subject, \Closure $proceed, Form $form)
    {
        $block = $proceed($form);

        $fieldset = $this->createFieldset($form, $subject);

        $this->moveOrginalFields($form);
        $this->addSearchFields($fieldset);
        $this->addAutocompleteFields($fieldset);
        $this->addFacetFields($fieldset);
        $this->addSortFields($fieldset);
        $this->appendSliderDisplayRelatedFields($form, $subject);

        if ($this->getAttribute()->getAttributeCode() == 'name') {
            $form->getElement('is_searchable')->setDisabled(1);
        }

        $this->appendFieldsDependency($subject);

        return $block;
    }