returns the number of review mails that should be send out. this is relevant
if only a specified percentages of all orders should get a mail.

@param $iSendForShippingDateNewerThan

@return int
339572
public function GetMaxNumberOfShopReviewMailsToSend($iSendForShippingDateNewerThan)
    {
        if ($this->bDebug) {
            echo '<br><br>';
        }

        $query = "SELECT *
                  FROM `shop_order`
                 WHERE `shop_order`.`pkg_shop_rating_service_order_completely_shipped` > '0000-00-00 00:00:00'
                   AND `shop_order`.`shop_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sShopID)."'
                   AND `shop_order`.`cms_language_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sLanguageID)."'
                   AND `shop_order`.`pkg_shop_rating_service_order_completely_shipped` <= '".MySqlLegacySupport::getInstance()->real_escape_string(date('Y-m-d H:i:s', $iSendForShippingDateNewerThan))."'
                   AND `shop_order`.`pkg_shop_rating_service_rating_processed_on` = '0000-00-00 00:00:00'
                   AND `shop_order`.`pkg_shop_rating_service_mail_processed` = '0'
                   AND `shop_order`.`adr_billing_country_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($this->sUserCountryID)."'
               ";
        if ($this->SendCustomersMailOnlyOnce()) {
            $query .= 'GROUP BY `shop_order`.`customer_number`';
        }

        if ($this->bDebug) {
            echo __LINE__.': '.$query."\n<br />\n";
        }

        $rRow = MySqlLegacySupport::getInstance()->query($query);
        $iNumberOfCompletedOrders = MySqlLegacySupport::getInstance()->num_rows($rRow);

        $query = ' SELECT * FROM `pkg_shop_rating_service_history` ';
        if ($this->SendCustomersMailOnlyOnce()) {
            $query .= 'GROUP BY `pkg_shop_rating_service_history`.`data_extranet_user_id`';
        }

        if ($this->bDebug) {
            echo __LINE__.': '.$query."\n<br />\n";
        }

        $rRow = MySqlLegacySupport::getInstance()->query($query);
        $iNumberOfReviewMailsSend = MySqlLegacySupport::getInstance()->num_rows($rRow);
        $iPercentageToBeSend = $this->Shopreviewmail_PercentOfCustomers; //$this->GetConfigValue('shopreviewmail_percent_of_customers');;
        $iPercentageMailSend = 100;

        if (0 == $iNumberOfCompletedOrders && 0 == $iNumberOfReviewMailsSend) {
            $iPercentageMailSend = 100;
        } elseif ($iNumberOfCompletedOrders > 0) {
            $iPercentageMailSend = ($iNumberOfReviewMailsSend / $iNumberOfCompletedOrders) * 100;
        } else {
            $iPercentageMailSend = 0;
        }

        if ($this->bDebug) {
            echo '<br />';
        }
        if ($this->bDebug) {
            echo __LINE__.'iPercentageToBeSend: '.$iPercentageToBeSend."\n<br />\n";
        }
        if ($this->bDebug) {
            echo __LINE__.'iNumberOfCompletedOrders: '.$iNumberOfCompletedOrders."\n<br />\n";
        }

        $iNumberOfReviewMailsToBeSend = ceil(($iPercentageToBeSend / 100) * $iNumberOfCompletedOrders);

        if ($this->bDebug) {
            echo __LINE__.'iNumberOfReviewMailsToBeSend: '.$iNumberOfReviewMailsToBeSend."\n<br />\n";
        }
        if ($this->bDebug) {
            echo __LINE__.'iNumberOfReviewMailsSend: '.$iNumberOfReviewMailsSend."\n<br />\n";
        }
        echo '<br><br>';

        // NOTE: the total possible mails covers all orders that have been send out
        // (so it includes orders which had their expected order date passed - Frau sommer 25.11.08)
        return $iNumberOfReviewMailsToBeSend;
    }
1066311
public function canResetShippingDate()
    {
        $oOrder = oxNew(\OxidEsales\Eshop\Application\Model\Order::class);
        $blCan = false;
        if ($oOrder->load($this->getEditObjectId())) {
            $blCan = $oOrder->oxorder__oxstorno->value == "0" &&
                     !($oOrder->oxorder__oxsenddate->value == "0000-00-00 00:00:00" || $oOrder->oxorder__oxsenddate->value == "-");
        }

        return $blCan;
    }
950626
public function getDataBetween($from = null, $to = null)
    {
        $answerPosts = $this->getAnswerPosts($from, $to);

        $yesno = array('yes' => 0, 'no' => 0);
        $pending = array();

        foreach ($answerPosts as $post) {
            $topics = wp_get_post_terms($post->ID, 'feedback_topic');
            $feedback_topics = array();
            if (!empty($topics)) {
                foreach ($topics as $topic) {
                    $feedback_topics[] = $topic->name;
                }
            }

            $post->answer = array(
                'post_id' => get_post_meta($post->ID, 'customer_feedback_page_reference', true),
                'answer' => get_post_meta($post->ID, 'customer_feedback_answer', true),
                'comment' => get_post_meta($post->ID, 'customer_feedback_comment', true),
                'topics' => $feedback_topics
            );

            // Count yes/no
            switch ($post->answer['answer']) {
                case 'yes':
                    $yesno['yes']++;
                    break;

                case 'no':
                    $yesno['no']++;
                    break;
            }

            if ($post->post_status === 'pending') {
                $pending[] = $post;
            }
        }

        // Get the percentage ratio for $yesno
        $totalAnswers = array_sum($yesno);
        $yesnoPercent = array_map(function ($item) use ($totalAnswers) {
            if ($totalAnswers === 0) {
                return 0;
            }

            return ($item / $totalAnswers) * 100;
        }, $yesno);

        // Return array
        $data = array(
            'count' => $yesno,
            'percent' => $yesnoPercent,
            'pending' => $pending
        );

        return $data;
    }
1055122
public function getOutAmount($forAddress)
    {
        if (isset($this->data['vout']) && is_array($this->data['vout'])) {
            foreach ($this->data['vout'] as $vout) {

                if (isset($vout['scriptPubKey']['addresses']) && is_array($vout['scriptPubKey']['addresses'])) {
                    foreach ($vout['scriptPubKey']['addresses'] as $address) {

                        if ($forAddress === $address && isset($vout['value'])) {
                            return (float) $vout['value'];
                        }
                    }
                }

            }
        }

        return false;
    }
47915
private function getArticleType(Mage_Sales_Model_Order $order)
    {
        if ($order->getShippingAddress()->getCountry() == Fontis_Australia_Helper_Data::AUSTRALIA_COUNTRY_CODE) {
            return 7;
        } else {
            $shippingMethod = $this->getShippingConfiguration($order);
            if (isset($shippingMethod[4]) && $shippingMethod[4] == 'D') {
                return 1;
            }
            return 2;
        }
    }
1310382
public function getSender()
    {
        $sender = $this->createSender();

        $sender->setFrom($this->fromEmail, $this->fromName);

        if ($this->replyToEmail) {
            $sender->setReplyTo($this->replyToEmail);
        }

        return $sender;
    }
293855
public function postage()
    {
        // If no estimate found, generate error
        if (!$this->hasEstimate()) {
            return $this->redirect($this->Link("noestimate"));
        }
        
        $config = SiteConfig::current_site_config();
        $member = Security::getCurrentUser();
        $estimate = $this->getEstimate();
        
        // Check permissions for guest checkout
        if (!$member && !$config->CheckoutAllowGuest) {
            return $this->redirect($this->Link());
        }

        if (!$estimate->isDeliverable()) {
            return $this->redirect($this->Link('payment'));
        }

        $this->customise([
            'Form' => $this->PostageForm()
        ]);

        $this->extend("onBeforePostage");

        return $this->render();
    }
813195
public function getSendStatistics() {
		$rest = new SimpleEmailServiceRequest($this, 'GET');
		$rest->setParameter('Action', 'GetSendStatistics');

		$rest = $rest->getResponse();
		if($rest->error === false && $rest->code !== 200) {
			$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
		}
		if($rest->error !== false) {
			$this->__triggerError('getSendStatistics', $rest->error);
			return false;
		}

		$response = array();
		if(!isset($rest->body)) {
			return $response;
		}

		$datapoints = array();
		foreach($rest->body->GetSendStatisticsResult->SendDataPoints->member as $datapoint) {
			$p = array();
			$p['Bounces'] = (string)$datapoint->Bounces;
			$p['Complaints'] = (string)$datapoint->Complaints;
			$p['DeliveryAttempts'] = (string)$datapoint->DeliveryAttempts;
			$p['Rejects'] = (string)$datapoint->Rejects;
			$p['Timestamp'] = (string)$datapoint->Timestamp;

			$datapoints[] = $p;
		}

		$response['SendDataPoints'] = $datapoints;
		$response['RequestId'] = (string)$rest->body->ResponseMetadata->RequestId;

		return $response;
	}
1167828
public function getPercentShipped(){
        if (isset($this->data['NumberOfItemsShipped']) && isset($this->data['NumberOfItemsUnshipped'])){
            $total = $this->data['NumberOfItemsShipped'] + $this->data['NumberOfItemsUnshipped'];
            
            if ($total == 0){
                return 0;
            }
            
            $ratio = $this->data['NumberOfItemsShipped'] / $total;
            return $ratio;
        } else {
            return false;
        }
    }
717594
protected function getListReportShipping($count = false)
    {
        $list = $this->shipping->getList();
        $allowed = $this->getAllowedFiltersReportShipping();

        $this->filterList($list, $allowed, $this->query_filter);
        $this->sortList($list, $allowed, $this->query_filter, array('id' => 'asc'));

        if ($count) {
            return count($list);
        }

        $this->limitList($list, $this->data_limit);
        return $list;
    }
396143
public function getReviewAndRatingItemsCount()
    {
        $user = $this->getUser();
        $count = 0;
        if ($user) {
            $count = $this
                ->getContainer()
                ->get(UserReviewAndRatingBridgeInterface::class)
                ->getReviewAndRatingListCount($user->getId());
        }

        return $count;
    }
957217
protected function countNewsItems($begin, $end)
    {
        if (($criteria = $this->getSearchCriteria($begin, $end)) === null) {
            return 0;
        }

        return NewsModel::countBy($criteria->getColumns(), $criteria->getValues());
	}
436676
protected function getPaymentStatusOrder()
    {
        return Number::isZero($this->source->getBaseTotalDue())
            ? Api::PaymentStatus_Paid
            : Api::PaymentStatus_Due;
    }
599531
public static function GetReviewsForArticleSortedByRate($iShopArticleId)
    {
        $sQuery = "SELECT * FROM `shop_article_review`
                       WHERE `shop_article_review`.`shop_article_id` = '".MySqlLegacySupport::getInstance()->real_escape_string($iShopArticleId)."'
                         AND `shop_article_review`.`publish` = '1'
                    ORDER BY `shop_article_review`.`helpful_count` DESC , `shop_article_review`.`datecreated` DESC";
        $oList = &TdbShopArticleReviewList::GetList($sQuery);

        return $oList;
    }
1089698
public static function &GetShippingGroupsThatAllowPaymentWith($sPaymentInternalName)
    {
        $oList = &TdbShopShippingGroupList::GetAvailableShippingGroups();
        $bFound = false;
        $oShippingGroup = null;
        while (!$bFound && ($oShippingGroup = &$oList->Next())) {
            $oPaymentMethods = &$oShippingGroup->GetValidPaymentMethods();
            $oPayPal = $oPaymentMethods->FindItemWithProperty('fieldNameInternal', $sPaymentInternalName);
            if ($oPayPal) {
                $bFound = true;
            }
        }

        if (!$bFound) {
            $oShippingGroup = false;
        }

        return $oShippingGroup;
    }
932757
public function getSellerOrderNote(\TdbShopOrder $order)
    {
        $text = $this->getValue('sellerNote');
        $data = $this->getTemplateDataFromOrder($order);

        return mb_substr($this->render($text, $data), 0, 1024);
    }
518437
public function getItemCount() : int
    {
        if($this->lastResponse && $this->lastResponse->getHeaderLine('X-Total-Count')) {
            return (int)$this->lastResponse->getHeaderLine('X-Total-Count');
        }

        return 0;
    }