Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e9fc5df763 | |||
| d790c73ab5 |
@@ -83,10 +83,19 @@ class RecoRecoModel extends Base
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native wins: if the card became native-recurring, RecoReco yields (decision 13).
|
// Native wins: if the card became native-recurring, RecoReco yields (decision 13). Leave a
|
||||||
|
// visible trail in the task's activity stream, attributed to the card's owner (creator_id has
|
||||||
|
// a FK to users, so a system id like 0 would make the insert fail silently -- no user 0).
|
||||||
if ($task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE) {
|
if ($task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE) {
|
||||||
$this->taskMetadataModel->save($task_id, array('recoreco_enabled' => 0));
|
$this->taskMetadataModel->save($task_id, array('recoreco_enabled' => 0));
|
||||||
$this->logger->info('RecoReco: disabled on task '.$task_id.' (now native-recurring)');
|
$this->logger->info('RecoReco: disabled on task '.$task_id.' (now native-recurring)');
|
||||||
|
$this->projectActivityModel->createEvent(
|
||||||
|
(int) $task['project_id'],
|
||||||
|
$task_id,
|
||||||
|
(int) $task['creator_id'],
|
||||||
|
'recoreco.task.disable',
|
||||||
|
array('task' => array('id' => $task_id, 'title' => $task['title']))
|
||||||
|
);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,6 +261,20 @@ class RecoRecoModel extends Base
|
|||||||
$payload = array('source_task_id' => (int) $template['id'], 'new_task_id' => (int) $newId);
|
$payload = array('source_task_id' => (int) $template['id'], 'new_task_id' => (int) $newId);
|
||||||
$this->hook->reference('recoreco:task:spawned', $payload);
|
$this->hook->reference('recoreco:task:spawned', $payload);
|
||||||
|
|
||||||
|
// Record the spawn in the clone's activity stream, attributed to the template's owner
|
||||||
|
// (creator_id has a FK to users, so a system id like 0 would silently fail the insert).
|
||||||
|
$this->projectActivityModel->createEvent(
|
||||||
|
(int) $template['project_id'],
|
||||||
|
$newId,
|
||||||
|
(int) $template['creator_id'],
|
||||||
|
'recoreco.task.spawn',
|
||||||
|
array(
|
||||||
|
'task' => array('id' => $newId, 'title' => $template['title']),
|
||||||
|
'template_id' => (int) $template['id'],
|
||||||
|
'template_title' => $template['title'],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return $newId;
|
return $newId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,12 @@ class Plugin extends Base
|
|||||||
// the same scheduler pass as cron. Admin-only for free via the shared 'ConfigController' ACL.
|
// the same scheduler pass as cron. Admin-only for free via the shared 'ConfigController' ACL.
|
||||||
$this->template->hook->attach('template:config:sidebar', 'recoReco:config/sidebar');
|
$this->template->hook->attach('template:config:sidebar', 'recoReco:config/sidebar');
|
||||||
|
|
||||||
|
// Activity-stream entries. The feed renders each event via event/<name-with-underscores>, so
|
||||||
|
// map our two event names to the plugin templates (a spawn on the new card, and the yield to
|
||||||
|
// native recurrence on the template). createEvent() writes the rows directly from the model.
|
||||||
|
$this->template->setTemplateOverride('event/recoreco_task_spawn', 'recoReco:event/recoreco_task_spawn');
|
||||||
|
$this->template->setTemplateOverride('event/recoreco_task_disable', 'recoReco:event/recoreco_task_disable');
|
||||||
|
|
||||||
// The scheduling engine runs from the CLI (cron). Registered CLI-only so web requests do
|
// The scheduling engine runs from the CLI (cron). Registered CLI-only so web requests do
|
||||||
// not build the console app.
|
// not build the console app.
|
||||||
if (php_sapi_name() === 'cli') {
|
if (php_sapi_name() === 'cli') {
|
||||||
@@ -55,7 +61,7 @@ class Plugin extends Base
|
|||||||
|
|
||||||
public function getPluginVersion()
|
public function getPluginVersion()
|
||||||
{
|
{
|
||||||
return '1.4.0';
|
return '1.5.0';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPluginHomepage()
|
public function getPluginHomepage()
|
||||||
|
|||||||
9
Template/event/recoreco_task_disable.php
Normal file
9
Template/event/recoreco_task_disable.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<p class="activity-title">
|
||||||
|
<?= e('RecoReco disabled recurrence on %s -- the card now uses Kanboard built-in recurrence',
|
||||||
|
$this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id']))
|
||||||
|
) ?>
|
||||||
|
<small class="activity-date"><?= $this->dt->datetime($date_creation) ?></small>
|
||||||
|
</p>
|
||||||
|
<div class="activity-description">
|
||||||
|
<p class="activity-task-title"><?= $this->text->e($task['title']) ?></p>
|
||||||
|
</div>
|
||||||
10
Template/event/recoreco_task_spawn.php
Normal file
10
Template/event/recoreco_task_spawn.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<p class="activity-title">
|
||||||
|
<?= e('RecoReco created %s from the recurring template %s',
|
||||||
|
$this->url->link(t('#%d', $task['id']), 'TaskViewController', 'show', array('task_id' => $task['id'])),
|
||||||
|
$this->url->link($this->text->e($template_title), 'TaskViewController', 'show', array('task_id' => $template_id))
|
||||||
|
) ?>
|
||||||
|
<small class="activity-date"><?= $this->dt->datetime($date_creation) ?></small>
|
||||||
|
</p>
|
||||||
|
<div class="activity-description">
|
||||||
|
<p class="activity-task-title"><?= $this->text->e($task['title']) ?></p>
|
||||||
|
</div>
|
||||||
Reference in New Issue
Block a user