card icons + clone message-modal + re-recur guard (v1.2)

This commit is contained in:
2026-07-08 00:07:25 -03:00
parent 85432401ea
commit d02f49e293
6 changed files with 124 additions and 47 deletions

View File

@@ -19,9 +19,10 @@ class RecurrenceController extends BaseController
{
$task = $this->getTask();
$columns = $this->targetColumns($task);
$meta = $this->taskMetadataModel->getAll($task['id']);
if (empty($values)) {
$values = $this->getStoredValues($task, $columns);
$values = $this->getStoredValues($meta, $task, $columns);
}
$this->response->html($this->template->render('recoReco:recurrence/edit', array(
@@ -33,6 +34,8 @@ class RecurrenceController extends BaseController
'has_due_date' => ! empty($task['date_due']),
'is_native' => $task['recurrence_status'] != TaskModel::RECURRING_STATUS_NONE,
'has_target' => ! empty($columns),
'is_clone' => isset($meta['recoreco_clone']) && $meta['recoreco_clone'] == 1,
'source_id' => isset($meta['recoreco_source']) ? (int) $meta['recoreco_source'] : 0,
)));
}
@@ -42,9 +45,14 @@ class RecurrenceController extends BaseController
$input = $this->request->getValues();
$columns = $this->targetColumns($task);
// Only a plain card (a due date, not native-recurring, and a valid target) may be enabled.
// A clone can never be made recurring (that would recurse). Guard even though the modal
// hides the form for clones.
$is_clone = (int) $this->taskMetadataModel->get($task['id'], 'recoreco_clone', 0) === 1;
// Only a plain card (a due date, not native-recurring, not a clone, a valid target) may enable.
$can_recur = ! empty($task['date_due'])
&& $task['recurrence_status'] == TaskModel::RECURRING_STATUS_NONE
&& ! $is_clone
&& ! empty($columns);
$enabled = ($can_recur && isset($input['recoreco_enabled']) && $input['recoreco_enabled'] == 1) ? 1 : 0;
@@ -104,10 +112,8 @@ class RecurrenceController extends BaseController
return empty($keys) ? 0 : (int) $keys[0];
}
private function getStoredValues(array $task, array $columns)
private function getStoredValues(array $meta, array $task, array $columns)
{
$meta = $this->taskMetadataModel->getAll($task['id']);
return array(
'recoreco_enabled' => isset($meta['recoreco_enabled']) ? (int) $meta['recoreco_enabled'] : 0,
'recoreco_target_column' => $this->resolveTarget(isset($meta['recoreco_target_column']) ? $meta['recoreco_target_column'] : 0, $columns),