/**
	 * @return boolean
	 */
	private function isRecurrenceMonth() {
		if ($this->plannedTask->isPrimaryKeyEmpty()) {
			return false;
		}
		$lastSendDate = $this->plannedTask->getParams();
		if (is_null($lastSendDate) || $lastSendDate == '') {
			return true;
		}
		$dateTime = new Gpf_DateTime();
		if (Gpf_Common_DateUtils::getDifference($lastSendDate, $dateTime->toDateTime(), Gpf_Common_DateUtils::MONTH) > $this->accountSettings->get(Pap_Settings::NOTIFICATION_PAY_DAY_REMINDER_RECURRENCE_MONTH)) {
			return true;			
		}
		return false;
	}
Example #2
0
 /**
  * @param Pap_Contexts_Tracking $context
  * @return boolean
  */
 private function isInCookieLifetimeLimit(Pap_Contexts_Tracking $context) {
     $select = new Gpf_SqlBuilder_SelectBuilder();
     $select->select->add(Pap_Db_Table_Transactions::DATE_INSERTED);
     $select->from->add(Pap_Db_Table_Transactions::getName());
     $select->where->add(Pap_Db_Table_Transactions::DATA1, '=', $this->getIdentifier($context));
     $select->where->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Db_Transaction::TYPE_SALE);
     $select->orderBy->add(Pap_Db_Table_Transactions::DATE_INSERTED);
     $select->limit->set(0, 1);
     try {
         $firstSale = $select->getOneRow()->get(Pap_Db_Table_Transactions::DATE_INSERTED);
         $cookieLifeTime = Pap_Tracking_Cookie::getCookieLifeTimeInDays($context);
         if (Gpf_Common_DateUtils::getDifference($firstSale, Gpf_Common_DateUtils::getDateTime(time()), 'day') > $cookieLifeTime) {
             $context->debug('    Transaction is not in cookie limit. Date of first transaction: ' . $firstSale . ' is not in cookie limit: ' . $cookieLifeTime . ' days.');
             return false;
         }
     } catch (Gpf_DbEngine_NoRowException $e) {
     }
     return true;
 }