public function preProcess() {
parent::preProcess();
+ $this->setContext();
CRM_Utils_System::setTitle(ts('Manage - Scheduled Jobs'));
}
if ($this->_action & CRM_Core_Action::VIEW) {
- $this->assign('jobName', self::getJobName($this->_id));
+ $this->assign('jobName', self::getJobName($this->_id));
$this->addButtons([
[
'type' => 'submit',
]);
return;
}
-
$attributes = CRM_Core_DAO::getAttribute('CRM_Core_DAO_Job');
$this->add('select', 'run_frequency', ts('Run frequency'), CRM_Core_SelectValues::getJobFrequency());
// CRM-17686
- $this->add('datepicker', 'scheduled_run_date', ts('Scheduled Run Date'), NULL, FALSE, ['minDate' => time()]);
+ $this->add('datepicker', 'scheduled_run_date', ts('Scheduled Run Date'), NULL, FALSE, ['minDate' => date('Y-m-d')]);
$this->add('textarea', 'parameters', ts('Command parameters'),
"cols=50 rows=6"
$jm->executeJobById($this->_id);
$jobName = self::getJobName($this->_id);
CRM_Core_Session::setStatus(ts('%1 Scheduled Job has been executed. See the log for details.', [1 => $jobName]), ts("Executed"), "success");
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/job', 'reset=1'));
+
+ if ($this->getContext() === 'joblog') {
+ // If we were triggered via the joblog form redirect back there when we finish
+ $redirectUrl = CRM_Utils_System::url('civicrm/admin/joblog', 'reset=1&jid=' . $this->_id);
+ }
+ else {
+ $redirectUrl = CRM_Utils_System::url('civicrm/admin/job', 'reset=1');
+ }
+ CRM_Utils_System::redirect($redirectUrl);
return;
}
// CRM-11143 - Give warning message if update_greetings is Enabled (is_active) since it generally should not be run automatically via execute action or runjobs url.
if ($values['api_action'] == 'update_greeting' && CRM_Utils_Array::value('is_active', $values) == 1) {
- // pass "wiki" as 6th param to docURL2 if you are linking to a page in wiki.civicrm.org
- $docLink = CRM_Utils_System::docURL2("Managing Scheduled Jobs", NULL, NULL, NULL, NULL, "wiki");
+ $docLink = CRM_Utils_System::docURL2("user/initial-set-up/scheduled-jobs/#job_update_greeting");
$msg = ts('The update greeting job can be very resource intensive and is typically not necessary to run on a regular basis. If you do choose to enable the job, we recommend you do not run it with the force=1 option, which would rebuild greetings on all records. Leaving that option absent, or setting it to force=0, will only rebuild greetings for contacts that do not currently have a value stored. %1', [1 => $docLink]);
CRM_Core_Session::setStatus($msg, ts('Warning: Update Greeting job enabled'), 'alert');
}