public function applyDateRange(array $dateRange)
 {
     $used = DateRangeParameter::getMonthsUsed($dateRange);
     $months = array('', 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
     $this->month_fields = "";
     for ($m = 1; $m <= 12; ++$m) {
         if (isset($used[$m])) {
             $this->month_fields .= "sum(IF(month={$m},IFNULL(overrideUsageCount,usageCount),null)) `{$months[$m]}`,";
         }
     }
 }
Exemplo n.º 2
0
 public function __construct($reportID, $db, $dbData, $value = null)
 {
     parent::__construct($reportID, $db, $dbData, $value);
     if ($this->value['y0'] === $this->value['y1']) {
         $this->addWhereClause = "(mus.year={$this->value['y0']} AND " . DateRangeParameter::monthRangeSameYearSQL($this->value['m0'], $this->value['m1']) . ")";
     } else {
         $this->addWhereClause = "((mus.year={$this->value['y0']} AND month BETWEEN {$this->value['m0']} AND 12)";
         for ($y = $this->value['y0'] + 1; $y < $this->value['y1']; ++$y) {
             $this->addWhereClause .= " OR mus.year={$y}";
         }
         $this->addWhereClause .= " OR (mus.year={$this->value['y1']} AND " . DateRangeParameter::monthRangeSameYearSQL(1, $this->value['m1']) . "))";
     }
 }
 public function applyDateRange(array $dateRange)
 {
     $used = DateRangeParameter::getMonthsUsed($dateRange);
     $months = array('', 'JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
     $this->month_fields = "";
     $this->month_fields_override = "";
     $this->month_fields_outlier = "";
     for ($m = 1; $m <= 12; ++$m) {
         if (isset($used[$m])) {
             $this->month_fields .= "MAX(IF(month={$m},usageCount,null)) `{$months[$m]}`,";
             $this->month_fields_override .= "MAX(IF(month={$m},overrideUsageCount,null)) {$months[$m]}_OVERRIDE,";
             $this->month_fields_outlier .= "MAX(IF(month={$m},outlierID,null)) {$months[$m]}_OUTLIER,";
         }
     }
 }
Exemplo n.º 4
0
 /**
  * @depends testEncode
  * @depends testDecode
  * @expectedException InvalidArgumentException
  * @dataProvider decodeBadParamProvider
  */
 public function testDecodeFailOnBadParam($data)
 {
     $param = new DateRangeParameter(null, null, null);
     $param->decode($data);
 }