...
 
Commits (13)
Branch master
Version 1.5.1
=============
- fix bug in filter task form: allow to show the list of users, which was hidden when the user had access to multiple centers;
......@@ -7,10 +7,36 @@ Branch master
- add a filtering by center on list;
- add color in boxes for task statuses;
Version 1.5.4
=============
- adding indexes on place event and task
Version 1.5.5
=============
PrivacyEvent branch
===================
- Fix error on the "see more" link which was not showed
- Layout of the task list
Version 1.5.6
=============
- fix: validation error on warning date interval is not shown
- add privacy events to task show / list;
- add privacy events to task edit / update;
Version 1.5.7
==============
- fix error when showing task list without person in context (issue #3) ;
Version 1.5.8
=============
- add returnPath to page Show and List for Single tasks ;
Master branch
=============
- better exception description when task workflow is not found ;
......@@ -88,7 +88,7 @@ class SingleTaskController extends Controller
$form = $this->setCreateForm($task, new Role(TaskVoter::CREATE));
$form->handleRequest($request);
if ($form->isSubmitted()) {
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
......@@ -425,7 +425,7 @@ class SingleTaskController extends Controller
$params['person'] = $person;
} elseif (!empty($request->query->get('center_id', NULL))) {
$center = $centerRepository->find($request->query->getInt('center_id'));
dump($center);
if ($center === null) {
throw $this->createNotFoundException('center not found');
}
......@@ -540,11 +540,13 @@ class SingleTaskController extends Controller
$form->handleRequest($request);
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'action' => 'list'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
if (isset($person)) {
$event = new PrivacyEvent($person, array(
'element_class' => SingleTask::class,
'action' => 'list'
));
$this->eventDispatcher->dispatch(PrivacyEvent::PERSON_PRIVACY_EVENT, $event);
}
return $this->render('ChillTaskBundle:SingleTask:index.html.twig',
\array_merge($viewParams, [ 'form' => $form->createView() ]));
......
......@@ -9,7 +9,19 @@ use Doctrine\Common\Collections\Collection;
/**
* SingleTask
*
* @ORM\Table("chill_task.single_task")
* @ORM\Table(
* "chill_task.single_task",
* indexes={
* @ORM\Index(
* name="by_type",
* columns={ "type" }
* ),
* @ORM\Index(
* name="by_current_state",
* columns={ "current_states" }
* )
* }
* )
* @ORM\Entity(repositoryClass="Chill\TaskBundle\Repository\SingleTaskRepository")
*/
class SingleTask extends AbstractTask
......
......@@ -23,7 +23,18 @@ use Chill\TaskBundle\Entity\SingleTask;
/**
*
*
* @ORM\Table("chill_task.single_task_place_event")
* @ORM\Table(
* "chill_task.single_task_place_event",
* indexes={
* @ORM\Index(
* name="transition_task_date",
* columns={"task_id", "transition", "datetime"}
* ),
* @ORM\Index(
* name="transition_task",
* columns={"task_id", "transition"}
* )
* })
* @ORM\Entity()
*
* @author Julien Fastré <julien.fastre@champs-libres.coop>
......
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add index on single_task_place_events
*/
final class Version20181113161925 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE INDEX transition_task_date ON chill_task.single_task_place_event (task_id, transition, datetime)');
$this->addSql('CREATE INDEX transition_task ON chill_task.single_task_place_event (task_id, transition)');
}
public function down(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP INDEX transition_task_date');
$this->addSql('DROP INDEX transition_task');
}
}
<?php declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Add index on single task
*/
final class Version20181113164108 extends AbstractMigration
{
public function up(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('CREATE INDEX by_type ON chill_task.single_task (type)');
$this->addSql('CREATE INDEX by_current_state ON chill_task.single_task USING GIN (current_states)');
}
public function down(Schema $schema) : void
{
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'postgresql', 'Migration can only be executed safely on \'postgresql\'.');
$this->addSql('DROP INDEX by_type');
$this->addSql('DROP INDEX by_current_state');
}
}
table.chill-task-list {
.chill-task-list__row > div {
margin-bottom: 0.50rem;
}
.chill-task-list__row__title {
font-weight: bold;
font-size: 1.40rem;
}
.chill-task-list__row__type {
font-variant: small-caps;
display: inline;
padding: 0.05rem .15rem;
font-size: 0.88rem;
font-weight: light;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border: 1px solid var(--chill-dark-gray);
color: var(--chill-dark-gray);
}
.chill-task-list__row__person-for {
display: inline;
font-weight: bold;
}
.chill-task-list__row__assignee {
display: inline;
}
.chill_task-list__row__assignee_by {
display: inline;
font-weight: bold;
}
.chill-task-list__row__dates {
& > ul {
display: inline;
list-style: none;
& > li {
display: inline;
margin-right: 0.25rem;
}
}
}
}
@import '../../../../main/Resources/public/sass/custom/config/colors';
@import "_task-statuses.scss";
@import "_task-list.scss";
div#single_task_warningInterval {
display: flex;
......
......@@ -60,6 +60,8 @@ Unassigned: Non assigné
Associated person: Personne associée
Default task: Tâche par défaut
Not assigned: Aucun utilisateur assigné
For person: Pour
By: Par
# transitions - default task definition
'new': 'nouvelle'
......
......@@ -2,61 +2,61 @@
{% if tasks|length > 0 %}
<h3>{{ title|trans }}</h3>
<table class="records_list">
<thead>
<tr>
<th class="chill-red">{{ 'Title'|trans }}</th>
<th class="chill-green">{{ 'Task type'|trans }}</th>
{% if person is null %}
<th>{{ 'Person'|trans }}</th>
{% endif %}
<th class="chill-orange">{{ 'Task status'|trans }}</th>
<th>{{ 'Dates'|trans }}</th>
</tr>
</thead>
<table class="records_list chill-task-list">
<tbody>
{% for task in tasks %}
<tr>
<td>{{ task.title }}</td>
<td>{{ task_workflow_metadata(task, 'definition.name')|trans }}</td>
{% if person is null %}
<td><a href="{{ path('chill_person_view', {person_id : task.person.Id}) }}">{{ task.person}}</a></td>
{% endif %}
<td>
{% for place in workflow_marked_places(task) %}
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
{% endfor %}
<td class="chill-task-list__row">
<div>
<span class="chill-task-list__row__title">{{ task.title }}</span>
</div>
{% if task.assignee is not null %}
<dl>
<dt>{{ 'Assignee'|trans }}</dt>
<dd>{{ task.assignee.username }}</dd>
</dl>
{% if person is null %}
<div>
<span class="chill-task-list__row__person-for">{{ 'For person'|trans }}&nbsp;:</span> <span class="chill-task-list__row__person"><a href="{{ path('chill_person_view', {person_id : task.person.Id}) }}">{{ task.person}}</a></span>
</div>
{% endif %}
<div>
<span class="chill-task-list__row__type">{{ task_workflow_metadata(task, 'definition.name')|trans }}</span>
</div>
</td>
<td>
{% if task.startDate is null and task.warningDate is null and task.endDate is null %}
{{'No dates specified'|trans}}
{% else %}
<ul class="record_actions_column">
{% if task.startDate is not null %}
<li>
{{'Start'|trans}}&nbsp;: {{ task.startDate|localizeddate('medium', 'none') }}
</li>
{% endif %}
{% if task.warningDate is not null %}
<li>
{{'Warning'|trans}}&nbsp;: {{ task.warningDate|localizeddate('medium', 'none') }}
</li>
<div>
{% for place in workflow_marked_places(task) %}
<span class="task-status box type-{{ task.type }} place-{{ place }}">{{ place|trans }}</span>
{% endfor %}
{% if task.assignee is not null %}
<div class="chill-task-list__row__assignee"><span class="chill_task-list__row__assignee_by">{{ 'By'|trans }}&nbsp;:</span> {{ task.assignee.username }}</div>
{% endif %}
{% if task.endDate is not null %}
<li>
{{'End'|trans}}&nbsp;: {{ task.endDate|localizeddate('medium', 'none') }}
</li>
{% endif %}
</ul>
</div>
{% if task.startDate is not null or task.warningDate is not null or task.endDate is not null %}
<div class="chill-task-list__row__dates">
<ul class="record_actions_column">
{% if task.startDate is not null %}
<li title="{{ 'Start'|trans|escape('html_attr') }}">
<i class="fa fa-play" ></i> {{ task.startDate|localizeddate('medium', 'none') }}
</li>
{% endif %}
{% if task.warningDate is not null %}
<li title="{{ 'Warning'|trans|escape('html_attr') }}">
<i class="fa fa-exclamation-triangle"></i> {{ task.warningDate|localizeddate('medium', 'none') }}
</li>
{% endif %}
{% if task.endDate is not null %}
<li title="{{ 'End'|trans|escape('html_attr') }}">
<i class="fa fa-hourglass-end"></i> {{ task.endDate|localizeddate('medium', 'none') }}
</li>
{% endif %}
</ul>
</div>
{% endif %}
</td>
<td>
<ul class="record_actions">
......@@ -92,7 +92,6 @@
</tbody>
</table>
{% if isSingleStatus %}
{% if tasks|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
......@@ -128,16 +127,9 @@
{% else %}
<ul class="record_actions">
<li>
{% if person is not null %}
<a href="{{ path('chill_task_singletask_list', {'person_id': person.id, 'status' : [ status ] }) }}" class="sc-button">
<a href="{{ path('chill_task_singletask_list', app.request.query.all|merge({ 'status': [ status ] })) }}" class="sc-button">
{{ 'See more' | trans }}
</a>
{% endif %}
{% if user is not null %}
<a href="{{ path('chill_task_singletask_list', {'status' : [ status ] }) }}" class="sc-button">
{{ 'See more' | trans }}
</a>
{% endif %}
</li>
</ul>
......@@ -212,7 +204,7 @@
</li>
</ul>
{% endif %}
{% if single_task_ended_tasks is defined %}
{{ helper.date_status('Tasks with expired deadline', single_task_ended_tasks, single_task_ended_count, single_task_ended_paginator, 'ended', isSingleStatus, person) }}
{% endif %}
......
......@@ -36,13 +36,12 @@
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a class="sc-button bt-cancel" href="{{ path('chill_task_singletask_list', { 'person_id': person.id } ) }}">
{{ 'Back to the list'|trans }}
</a>
</li>
<li class="cancel">
<a href="{{ path('chill_task_single_task_show', { 'id': task.id, 'list_params': app.request.query.get('list_params', { } )} ) }}" class="sc-button">
{{ 'Cancel'|trans }}
<a class="sc-button bt-cancel" href="{% if app.request.query.has('returnPath') %}
{{ app.request.query.get('returnPath')|escape('html_attr') }}">
{% else %}
{{ path('chill_task_single_task_show', { 'id': task.id, 'list_params': app.request.query.get('list_params', { } )} ) }}" class="sc-button">
{% endif %}
{{ app.request.query.get('returnLabel')|default('Cancel'|trans) }}
</a>
</li>
<li>
......
......@@ -25,6 +25,8 @@
<h1 class="chill-red">{{ 'New task'|trans }}</h1>
{{ form_start(form) }}
{{ form_errors(form) }}
{{ form_row(form.title) }}
{{ form_row(form.description) }}
......
......@@ -85,8 +85,12 @@
<ul class="record_actions">
<li class="cancel">
<a class="sc-button bt-cancel" href="{{ path('chill_task_singletask_list', app.request.query.get('list_params', {}) ) }}">
{{ 'Back to the list'|trans }}
<a class="sc-button bt-cancel" href="{%- if app.request.query.has('returnPath') -%}
{{ app.request.query.get('returnPath')|escape('html_attr') }}
{%- else -%}
{{ path('chill_task_singletask_list', app.request.query.get('list_params', {}) ) }}
{%- endif -%}">
{{ app.request.query.get('returnLabel')|default('Back to the list'|trans) }}
</a>
</li>
{% if workflow_transitions(task)|length > 0 %}
......
......@@ -60,7 +60,7 @@ class TaskWorkflowManager implements SupportStrategyInterface
throw new \LogicException("More than one TaskWorkflowDefinition supports "
. "this task. This should not happens.");
} elseif ($count === 0) {
throw new \LogicException("No taskWorkflowDefinition supports this task.");
throw new \LogicException(\sprintf("No taskWorkflowDefinition supports this task type: %s (task id: %s).", $task->getType(), $task->getId()));
}
return $definitions[0];
......