projects
/
civicrm-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f2ec3ed
)
Add an 'Execute Now' button to the job log
author
Matthew Wire
<mjw@mjwconsult.co.uk>
Fri, 17 Jan 2020 19:04:00 +0000
(19:04 +0000)
committer
Matthew Wire
<mjw@mjwconsult.co.uk>
Sat, 26 Sep 2020 18:15:39 +0000
(19:15 +0100)
CRM/Admin/Form/Job.php
patch
|
blob
|
blame
|
history
CRM/Admin/Page/Job.php
patch
|
blob
|
blame
|
history
CRM/Admin/Page/JobLog.php
patch
|
blob
|
blame
|
history
templates/CRM/Admin/Page/JobLog.tpl
patch
|
blob
|
blame
|
history
diff --git
a/CRM/Admin/Form/Job.php
b/CRM/Admin/Form/Job.php
index 65bb09710e2ab6b2609258c8bada34cbe870435a..dec88aeeab13b922f399719a639cdceaf0b44866 100644
(file)
--- a/
CRM/Admin/Form/Job.php
+++ b/
CRM/Admin/Form/Job.php
@@
-24,6
+24,7
@@
class CRM_Admin_Form_Job extends CRM_Admin_Form {
public function preProcess() {
parent::preProcess();
public function preProcess() {
parent::preProcess();
+ $this->setContext();
CRM_Utils_System::setTitle(ts('Manage - Scheduled Jobs'));
CRM_Utils_System::setTitle(ts('Manage - Scheduled Jobs'));
@@
-194,7
+195,15
@@
class CRM_Admin_Form_Job extends CRM_Admin_Form {
$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");
$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;
}
return;
}
diff --git
a/CRM/Admin/Page/Job.php
b/CRM/Admin/Page/Job.php
index 2164d2b7cefa57fd7c6531b9b6243d2933abf7cd..5a8d30767c570fcbc86885b991cd37f9abb7dfaf 100644
(file)
--- a/
CRM/Admin/Page/Job.php
+++ b/
CRM/Admin/Page/Job.php
@@
-117,6
+117,9
@@
class CRM_Admin_Page_Job extends CRM_Core_Page_Basic {
$this->_action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 0
);
$this->_action = CRM_Utils_Request::retrieve('action', 'String',
$this, FALSE, 0
);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'String',
+ $this, FALSE, 0
+ );
if (($this->_action & CRM_Core_Action::COPY) && (!empty($this->_id))) {
try {
if (($this->_action & CRM_Core_Action::COPY) && (!empty($this->_id))) {
try {
diff --git
a/CRM/Admin/Page/JobLog.php
b/CRM/Admin/Page/JobLog.php
index c7b1226535f9274e0f4b7a328b529b5773e371eb..e31a52558d6fd66fbf18688adf44c0d25554f813 100644
(file)
--- a/
CRM/Admin/Page/JobLog.php
+++ b/
CRM/Admin/Page/JobLog.php
@@
-73,17
+73,17
@@
class CRM_Admin_Page_JobLog extends CRM_Core_Page_Basic {
* Browse all jobs.
*/
public function browse() {
* Browse all jobs.
*/
public function browse() {
- $jid = CRM_Utils_Request::retrieve('jid', 'Positive'
, $this
);
+ $jid = CRM_Utils_Request::retrieve('jid', 'Positive');
$sj = new CRM_Core_JobManager();
$sj = new CRM_Core_JobManager();
- $jobName = NULL;
if ($jid) {
$jobName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Job', $jid);
if ($jid) {
$jobName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Job', $jid);
+ $this->assign('jobName', $jobName);
+ $jobRunUrl = CRM_Utils_System::url('civicrm/admin/job', 'action=view&reset=1&context=joblog&id=' . $jid);
+ $this->assign('jobRunUrl', $jobRunUrl);
}
}
- $this->assign('jobName', $jobName);
-
$dao = new CRM_Core_DAO_JobLog();
$dao->orderBy('id desc');
$dao = new CRM_Core_DAO_JobLog();
$dao->orderBy('id desc');
diff --git
a/templates/CRM/Admin/Page/JobLog.tpl
b/templates/CRM/Admin/Page/JobLog.tpl
index 367b0f5b1b113bd9d63029dcd56bc8dcb12cd4da..ca3bac9e5566ed4cc7032440f1396009fb6004a8 100644
(file)
--- a/
templates/CRM/Admin/Page/JobLog.tpl
+++ b/
templates/CRM/Admin/Page/JobLog.tpl
@@
-19,6
+19,9
@@
<div class="action-link">
<a href="{crmURL p='civicrm/admin/job' q="reset=1"}" id="jobsList-top" class="button"><span><i class="crm-i fa-chevron-left" aria-hidden="true"></i> {ts}Back to Scheduled Jobs Listing{/ts}</span></a>
<div class="action-link">
<a href="{crmURL p='civicrm/admin/job' q="reset=1"}" id="jobsList-top" class="button"><span><i class="crm-i fa-chevron-left" aria-hidden="true"></i> {ts}Back to Scheduled Jobs Listing{/ts}</span></a>
+ {if $jobRunUrl}
+ <a href="{$jobRunUrl}" id="jobsList-run-top" class="button"><span><i class="crm-i fa-play" aria-hidden="true"></i> {ts}Execute Now{/ts}</span></a>
+ {/if}
</div>
{if $rows}
</div>
{if $rows}
@@
-60,5
+63,8
@@
<div class="action-link">
<a href="{crmURL p='civicrm/admin/job' q="reset=1"}" id="jobsList-bottom" class="button"><span><i class="crm-i fa-chevron-left" aria-hidden="true"></i> {ts}Back to Scheduled Jobs Listing{/ts}</span></a>
<div class="action-link">
<a href="{crmURL p='civicrm/admin/job' q="reset=1"}" id="jobsList-bottom" class="button"><span><i class="crm-i fa-chevron-left" aria-hidden="true"></i> {ts}Back to Scheduled Jobs Listing{/ts}</span></a>
+ {if $jobRunUrl}
+ <a href="{$jobRunUrl}" id="jobsList-run-bottom" class="button"><span><i class="crm-i fa-play" aria-hidden="true"></i> {ts}Execute Now{/ts}</span></a>
+ {/if}
</div>
</div>
</div>
</div>