Merge pull request #6361 from colemanw/CRM-14136
authorcolemanw <coleman@civicrm.org>
Thu, 30 Jul 2015 17:34:26 +0000 (13:34 -0400)
committercolemanw <coleman@civicrm.org>
Thu, 30 Jul 2015 17:34:26 +0000 (13:34 -0400)
CRM-14136 - Don't show deleted contacts on case dashboard

CRM/Core/ScheduledJob.php
CRM/Core/SelectValues.php
bin/cli.class.php

index 23038e48a6d05f659f05eeea707e3209e8c98cc8..dcb5ec898519437a2b24de648e73f475c3a8e059 100644 (file)
@@ -107,6 +107,29 @@ class CRM_Core_ScheduledJob {
       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();
index 0f77050577bfcaa81c015207ce4d2b0e7ca26587..6c2a9fb5380b6b31f038754d1667856b2660497a 100644 (file)
@@ -873,6 +873,9 @@ class CRM_Core_SelectValues {
    */
   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'),
index 9a569b0cc9235ab826a31304391bccab5fbb294d..5489e9d0d690b542fd047e541b3d7a36e4344b7a 100644 (file)
@@ -111,7 +111,7 @@ class civicrm_cli {
       $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;
     }