CRM-17686 change database column name
authorDavid Reedy Jr <davidrjr.konadave@gmail.com>
Mon, 28 Dec 2015 23:49:10 +0000 (17:49 -0600)
committerDavid Reedy Jr <davidrjr.konadave@gmail.com>
Thu, 31 Dec 2015 23:23:27 +0000 (17:23 -0600)
CRM/Admin/Form/Job.php
CRM/Core/ScheduledJob.php
CRM/Upgrade/Incremental/sql/4.7.beta5.mysql.tpl
templates/CRM/Admin/Form/Job.tpl
xml/schema/Core/Job.xml

index 549d07855c38df3fffdf8d6b99ce321479bedf82..5830af340281e4217e22712cd54e9fcd699ae1b0 100644 (file)
@@ -97,7 +97,7 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
     $this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency());
 
     // CRM-17686
-    $this->addDateTime('next_scheduled_run', ts(($this->_id ? 'Next' : 'First') . ' Run Date / Time'), FALSE, array('formatType' => 'activityDateTime'));
+    $this->addDateTime('scheduled_run_date', ts('Scheduled Run Date'), FALSE, array('formatType' => 'activityDateTime'));
 
     $this->add('textarea', 'parameters', ts('Command parameters'),
       "cols=50 rows=6"
@@ -160,10 +160,10 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
     CRM_Core_DAO::storeValues($dao, $defaults);
 
     // CRM-17686
-    if (!empty($dao->next_scheduled_run)) {
-      $ts = strtotime($dao->next_scheduled_run);
-      $defaults['next_scheduled_run'] = date('m/d/Y', $ts);
-      $defaults['next_scheduled_run_time'] = date('h:iA', $ts);
+    if (!empty($dao->scheduled_run_date)) {
+      $ts = strtotime($dao->scheduled_run_date);
+      $defaults['scheduled_run_date'] = date('m/d/Y', $ts);
+      $defaults['scheduled_run_date_time'] = date('h:iA', $ts);
     }
 
     // CRM-10708
@@ -206,16 +206,16 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
 
     // CRM-17686
     $dt = '';
-    if (!empty($values['next_scheduled_run'])) {
-      $dt = $values['next_scheduled_run'] . ' ';;
+    if (!empty($values['scheduled_run_date'])) {
+      $dt = $values['scheduled_run_date'] . ' ';;
     }
-    if (!empty($values['next_scheduled_run_time'])) {
-      $dt .= $values['next_scheduled_run_time'];
+    if (!empty($values['scheduled_run_date_time'])) {
+      $dt .= $values['scheduled_run_date_time'];
     }
     $ts = strtotime(trim($dt));
     // if a date/time is supplied and not in the past, then set the next scheduled run...
     if ($ts > time()) {
-      $dao->next_scheduled_run = CRM_Utils_Date::currentDBDate($ts);
+      $dao->scheduled_run_date = CRM_Utils_Date::currentDBDate($ts);
       // warn about monthly/quarterly scheduling, if applicable
       if (($dao->run_frequency == 'Monthly') || ($dao->run_frequency == 'Quarter')) {
         $info = getdate($ts);
@@ -223,7 +223,7 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
           CRM_Core_Session::setStatus(
             ts('Relative month values are calculated based on the length of month(s) that they pass through.
               The result will land on the same day of the month except for days 29-31 when the target month contains fewer days.
-              For example, if a job is scheduled to run on August 31st, the following invocation will occur on October 1st.
+              For example, if a job is scheduled to run on August 31st, the following invocation will occur on October 1st, and then the 1st of every month thereafter.
               To avoid this issue, please schedule Monthly and Quarterly jobs to run within the first 28 days of the month.'),
             ts('Warning'), 'info', array('expires' => 0));
         }
@@ -232,7 +232,7 @@ class CRM_Admin_Form_Job extends CRM_Admin_Form {
     // ...otherwise, if this isn't a new scheduled job, clear the next scheduled run
     elseif ($this->_id) {
       $job = new CRM_Core_ScheduledJob(array('id' => $dao->id));
-      $job->clearNextScheduledRun();
+      $job->clearScheduledRunDate();
     }
 
     $dao->save();
index 6a616d21f1be4a9cc13c58a37661a74da4675ae9..a90d0dabc8e8707a797883fc9e50fa3d206a59ef 100644 (file)
@@ -89,8 +89,8 @@ class CRM_Core_ScheduledJob {
   /**
    * @return void
    */
-  public function clearNextScheduledRun() {
-    CRM_Core_DAO::executeQuery('UPDATE civicrm_job SET next_scheduled_run = NULL WHERE id = %1',
+  public function clearScheduledRunDate() {
+    CRM_Core_DAO::executeQuery('UPDATE civicrm_job SET scheduled_run_date = NULL WHERE id = %1',
       array(
         '1' => array($this->id, 'Integer'),
       ));
@@ -103,9 +103,9 @@ class CRM_Core_ScheduledJob {
 
     // CRM-17686
     // check if the job has a specific scheduled date/time
-    if (!empty($this->next_scheduled_run)) {
-      if (strtotime($this->next_scheduled_run) <= time()) {
-        $this->clearNextScheduledRun();
+    if (!empty($this->scheduled_run_date)) {
+      if (strtotime($this->scheduled_run_date) <= time()) {
+        $this->clearScheduledRunDate();
         return TRUE;
       }
       else {
index 99af7aeb516672cb62ef50bb3704d3a66c95b416..54b3e3e700ac47079a9ca1133b5734dd9662579e 100644 (file)
@@ -2,4 +2,4 @@
 
 -- CRM-17686
 ALTER TABLE `civicrm_job`
-ADD COLUMN `next_scheduled_run` timestamp NULL DEFAULT NULL COMMENT 'When is this cron entry scheduled to run next' AFTER `last_run`;
+ADD COLUMN `scheduled_run_date` timestamp NULL DEFAULT NULL COMMENT 'When is this cron entry scheduled to run' AFTER `last_run`;
index 2521de7859f0f414ec2e4476b59818f9905e4094..72a77da530465544a56eed0fc00f3d20b26e0ced 100644 (file)
@@ -105,12 +105,12 @@ CRM.$(function($) {
       <td class="label">{$form.parameters.label}<br />{docURL page="Managing Scheduled Jobs" resource="wiki"}</td>
       <td>{$form.parameters.html}</td>
     </tr>
-    <tr class="crm-job-form-block-next_scheduled_run">
-        <td class="label">{$form.next_scheduled_run.label}</td>
+    <tr class="crm-job-form-block-scheduled-run-date">
+        <td class="label">{$form.scheduled_run_date.label}</td>
         <td>
-            {if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=next_scheduled_run}{else}{$next_scheduled_run|crmDate}{/if}<br />
+            {if $hideCalender neq true}{include file="CRM/common/jcalendar.tpl" elementName=scheduled_run_date}{else}{$scheduled_run_date|crmDate}{/if}<br />
             <div dlass="description">{ts}Do not run this job before this date / time.
-              Leave blank to run {if $action eq 1}as soon as possible{else}at next scheduled interval{/if}.{/ts}
+              Leave blank to run {if $action eq 1}as soon as possible{else}at next run frequency{/if}.{/ts}
             </div>
         </td>
     </tr>
index 1abeeb8e0f6de2cb5470edccf5a90e95ce8ec637..3e58e9cf0c77d5f7b72d56f2b75b324990582723 100644 (file)
     <add>4.1</add>
   </field>
   <field>
-    <name>next_scheduled_run</name>
+    <name>scheduled_run_date</name>
     <type>timestamp</type>
     <default>NULL</default>
-    <comment>When is this cron entry scheduled to run next</comment>
+    <comment>When is this cron entry scheduled to run</comment>
     <add>4.7</add>
   </field>
   <field>