Rename the Plan bundle to Program across config, routes, menus, and controllers (Plan -> Initiative), bump version to 0.16.0, and introduce new audience and UTM taxonomy routes and permissions to support the expanded Programs feature set.
41 lines
1003 B
PHP
41 lines
1003 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\ProgramBundle\Entity;
|
|
|
|
/**
|
|
* The kind of a task. The order of the cases is the order of the dropdown.
|
|
*/
|
|
enum TaskKind: string
|
|
{
|
|
case Task = 'task';
|
|
case Milestone = 'milestone';
|
|
case Phase = 'phase';
|
|
|
|
public function getLabelKey(): string
|
|
{
|
|
return 'mautic.program.task.kind.'.$this->value;
|
|
}
|
|
|
|
/**
|
|
* True when this kind has no status of its own: a phase is a collection of tasks, its state comes
|
|
* from them.
|
|
*/
|
|
public function hasStatus(): bool
|
|
{
|
|
return self::Phase !== $this;
|
|
}
|
|
|
|
/**
|
|
* Applies the kind's rules to the task's dates. A milestone's end date is enslaved to its start
|
|
* date: whatever is set, the end becomes the start.
|
|
*/
|
|
public function enslaveDates(Task $task): void
|
|
{
|
|
if (self::Milestone === $this && null !== $task->getStartDate()) {
|
|
$task->setEndDate(clone $task->getStartDate());
|
|
}
|
|
}
|
|
}
|