case 'Daily':
$format = 'Ymd';
break;
+
+ case 'Mondays':
+ $now = CRM_Utils_Date::currentDBDate();
+ $dayAgo = strtotime('-1 day', strtotime($now));
+ $lastRun = strtotime($this->last_run);
+ $nowDayOfWeek = date('l', strtotime($now));
+ return ($lastRun < $dayAgo && $nowDayOfWeek == 'Monday');
+
+ case '1stOfMth':
+ $now = CRM_Utils_Date::currentDBDate();
+ $dayAgo = strtotime('-1 day', strtotime($now));
+ $lastRun = strtotime($this->last_run);
+ $nowDayOfMonth = date('j', strtotime($now));
+ return ($lastRun < $dayAgo && $nowDayOfMonth == '1');
+
+ case '1stOfQtr':
+ $now = CRM_Utils_Date::currentDBDate();
+ $dayAgo = strtotime('-1 day', strtotime($now));
+ $lastRun = strtotime($this->last_run);
+ $nowDayOfMonth = date('j', strtotime($now));
+ $nowMonth = date('n', strtotime($now));
+ $qtrMonths = array('1', '4', '7', '10');
+ return ($lastRun < $dayAgo && $nowDayOfMonth == '13' && in_array($nowMonth, $qtrMonths));
}
$now = CRM_Utils_Date::currentDBDate();
*/
public static function getJobFrequency() {
return array(
+ '1stOfQtr' => ts('1st day of every quarter'),
+ '1stOfMth' => ts('1st day of every month'),
+ 'Mondays' => ts('Monday of every week'),
'Daily' => ts('Daily'),
'Hourly' => ts('Hourly'),
'Always' => ts('Every time cron job is run'),
$result = civicrm_api($this->_entity, $this->_action, $this->_params);
}
- if ($result['is_error'] != 0) {
+ if (!empty($result['is_error'])) {
$this->_log($result['error_message']);
return FALSE;
}