Beispiel #1
0
 public function apply()
 {
     if ($this->getResource()->apply()) {
         OnlineShop_Framework_VoucherService_Statistic::increaseUsageStatistic($this->getVoucherSeriesId());
         return true;
     }
     return false;
 }
Beispiel #2
0
 /**
  * @return array
  */
 public function getStatistics($usagePeriod = null)
 {
     $overallCount = $this->configuration->getUsages();
     $usageCount = OnlineShop_Framework_VoucherService_Token::getByCode($this->configuration->getToken())->getUsages();
     $reservedTokenCount = OnlineShop_Framework_VoucherService_Token_List::getCountByReservation($this->seriesId);
     $usage = OnlineShop_Framework_VoucherService_Statistic::getBySeriesId($this->seriesId, $usagePeriod);
     $this->prepareUsageStatisticData($usage, $usagePeriod);
     return ['overallCount' => $overallCount, 'usageCount' => $usageCount, 'freeCount' => $overallCount - $usageCount - $reservedTokenCount, 'reservedCount' => $reservedTokenCount, 'usage' => $usage];
 }
Beispiel #3
0
 /**
  * @param null|string $seriesId
  * @return bool
  */
 public function cleanUpStatistics($seriesId = null)
 {
     if (isset($seriesId)) {
         return OnlineShop_Framework_VoucherService_Statistic::cleanUpStatistics($this->sysConfig->statistics->duration, $seriesId);
     } else {
         return OnlineShop_Framework_VoucherService_Statistic::cleanUpStatistics($this->sysConfig->statistics->duration);
     }
 }
Beispiel #4
0
 /**
  * @return array
  */
 public function getStatistics($usagePeriod = null)
 {
     $overallCount = OnlineShop_Framework_VoucherService_Token_List::getCountBySeriesId($this->seriesId);
     $usageCount = OnlineShop_Framework_VoucherService_Token_List::getCountByUsages(1, $this->seriesId);
     $reservedTokenCount = OnlineShop_Framework_VoucherService_Token_List::getCountByReservation($this->seriesId);
     $usage = OnlineShop_Framework_VoucherService_Statistic::getBySeriesId($this->seriesId, $usagePeriod);
     if (is_array($usage)) {
         $this->prepareUsageStatisticData($usage, $usagePeriod);
     }
     return ['overallCount' => $overallCount, 'usageCount' => $usageCount, 'freeCount' => $overallCount - $usageCount - $reservedTokenCount, 'reservedCount' => $reservedTokenCount, 'usage' => $usage];
 }