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));
+ if ($lastRun < $dayAgo and $nowDayOfWeek=='Monday') {
+ return TRUE;
+ }
+
+ case '1stOfMth':
+ $now = CRM_Utils_Date::currentDBDate();
+ $dayAgo = strtotime('-1 day', strtotime($now));
+ $lastRun = strtotime($this->last_run);
+ $nowDayOfMonth = date('j',strtotime($now));
+ if ($lastRun < $dayAgo and $nowDayOfMonth=='1') {
+ return TRUE;
+ }
+
+ 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');
+ if ($lastRun < $dayAgo and $nowDayOfMonth=='13' and in_array($nowMonth,$qtrMonths)) {
+ return TRUE;
+ }
+
}
$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'),