Add fields: task creator and modification date
This commit is contained in:
parent
7a64053cb8
commit
ba93061f4d
|
|
@ -108,6 +108,8 @@ class Task extends Base
|
|||
public function save()
|
||||
{
|
||||
$values = $this->request->getValues();
|
||||
$values['creator_id'] = $this->acl->getUserId();
|
||||
|
||||
$this->checkProjectPermissions($values['project_id']);
|
||||
|
||||
list($valid, $errors) = $this->task->validateCreation($values);
|
||||
|
|
|
|||
|
|
@ -384,4 +384,14 @@ return array(
|
|||
// 'Maximum size: ' => '',
|
||||
// 'Unable to upload the file.' => '',
|
||||
// 'Display another project' => '',
|
||||
// 'Your GitHub account was successfully linked to your profile.' => '',
|
||||
// 'Unable to link your GitHub Account.' => '',
|
||||
// 'GitHub authentication failed' => '',
|
||||
// 'Your GitHub account is no longer linked to your profile.' => '',
|
||||
// 'Unable to unlink your GitHub Account.' => '',
|
||||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -384,4 +384,6 @@ return array(
|
|||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -382,4 +382,6 @@ return array(
|
|||
'Login with my GitHub Account' => 'Se connecter avec mon compte Github',
|
||||
'Link my GitHub Account' => 'Lier mon compte Github',
|
||||
'Unlink my GitHub Account' => 'Ne plus utiliser mon compte Github',
|
||||
'Created by %s' => 'Créé par %s',
|
||||
'Last modified on %B %e, %G at %k:%M %p' => 'Modifié le %d/%m/%Y à %H:%M',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -385,4 +385,6 @@ return array(
|
|||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -382,4 +382,6 @@ return array(
|
|||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -384,4 +384,6 @@ return array(
|
|||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -390,4 +390,6 @@ return array(
|
|||
// 'Login with my GitHub Account' => '',
|
||||
// 'Link my GitHub Account' => '',
|
||||
// 'Unlink my GitHub Account' => '',
|
||||
// 'Created by %s' => 'Créé par %s',
|
||||
// 'Last modified on %B %e, %G at %k:%M %p' => '',
|
||||
);
|
||||
|
|
|
|||
|
|
@ -73,34 +73,40 @@ class Task extends Base
|
|||
{
|
||||
if ($more) {
|
||||
|
||||
return $this->db
|
||||
->table(self::TABLE)
|
||||
->columns(
|
||||
self::TABLE.'.id',
|
||||
self::TABLE.'.title',
|
||||
self::TABLE.'.description',
|
||||
self::TABLE.'.date_creation',
|
||||
self::TABLE.'.date_completed',
|
||||
self::TABLE.'.date_due',
|
||||
self::TABLE.'.color_id',
|
||||
self::TABLE.'.project_id',
|
||||
self::TABLE.'.column_id',
|
||||
self::TABLE.'.owner_id',
|
||||
self::TABLE.'.position',
|
||||
self::TABLE.'.is_active',
|
||||
self::TABLE.'.score',
|
||||
self::TABLE.'.category_id',
|
||||
Category::TABLE.'.name AS category_name',
|
||||
Project::TABLE.'.name AS project_name',
|
||||
Board::TABLE.'.title AS column_title',
|
||||
User::TABLE.'.username'
|
||||
)
|
||||
->join(Category::TABLE, 'id', 'category_id')
|
||||
->join(Project::TABLE, 'id', 'project_id')
|
||||
->join(Board::TABLE, 'id', 'column_id')
|
||||
->join(User::TABLE, 'id', 'owner_id')
|
||||
->eq(self::TABLE.'.id', $task_id)
|
||||
->findOne();
|
||||
$sql = '
|
||||
SELECT
|
||||
tasks.id,
|
||||
tasks.title,
|
||||
tasks.description,
|
||||
tasks.date_creation,
|
||||
tasks.date_completed,
|
||||
tasks.date_modification,
|
||||
tasks.date_due,
|
||||
tasks.color_id,
|
||||
tasks.project_id,
|
||||
tasks.column_id,
|
||||
tasks.owner_id,
|
||||
tasks.creator_id,
|
||||
tasks.position,
|
||||
tasks.is_active,
|
||||
tasks.score,
|
||||
tasks.category_id,
|
||||
project_has_categories.name AS category_name,
|
||||
projects.name AS project_name,
|
||||
columns.title AS column_title,
|
||||
users.username AS assignee_username,
|
||||
creators.username AS creator_username
|
||||
FROM tasks
|
||||
LEFT JOIN users ON users.id = tasks.owner_id
|
||||
LEFT JOIN users AS creators ON creators.id = tasks.creator_id
|
||||
LEFT JOIN project_has_categories ON project_has_categories.id = tasks.category_id
|
||||
LEFT JOIN projects ON projects.id = tasks.project_id
|
||||
LEFT JOIN columns ON columns.id = tasks.column_id
|
||||
WHERE tasks.id = ?
|
||||
';
|
||||
|
||||
$rq = $this->db->execute($sql, array($task_id));
|
||||
return $rq->fetch(\PDO::FETCH_ASSOC);
|
||||
}
|
||||
else {
|
||||
|
||||
|
|
@ -385,6 +391,7 @@ class Task extends Base
|
|||
}
|
||||
|
||||
$updated_task = $values;
|
||||
$updated_task['date_modification'] = time();
|
||||
unset($updated_task['id']);
|
||||
|
||||
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($updated_task);
|
||||
|
|
@ -514,6 +521,7 @@ class Task extends Base
|
|||
new Validators\Required('column_id', t('The column is required')),
|
||||
new Validators\Integer('column_id', t('This value must be an integer')),
|
||||
new Validators\Integer('owner_id', t('This value must be an integer')),
|
||||
new Validators\Integer('creator_id', t('This value must be an integer')),
|
||||
new Validators\Integer('score', t('This value must be an integer')),
|
||||
new Validators\Required('title', t('The title is required')),
|
||||
new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ namespace Schema;
|
|||
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 20;
|
||||
const VERSION = 21;
|
||||
|
||||
function version_21($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'");
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'");
|
||||
}
|
||||
|
||||
function version_20($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ namespace Schema;
|
|||
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 1;
|
||||
const VERSION = 2;
|
||||
|
||||
function version_2($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT 0");
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT 0");
|
||||
}
|
||||
|
||||
function version_1($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ namespace Schema;
|
|||
|
||||
use Core\Security;
|
||||
|
||||
const VERSION = 20;
|
||||
const VERSION = 21;
|
||||
|
||||
function version_21($pdo)
|
||||
{
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'");
|
||||
$pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'");
|
||||
}
|
||||
|
||||
function version_20($pdo)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
<li>
|
||||
<?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?>
|
||||
</li>
|
||||
<?php if ($task['date_modification']): ?>
|
||||
<li>
|
||||
<?= dt('Last modified on %B %e, %G at %k:%M %p', $task['date_modification']) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($task['date_completed']): ?>
|
||||
<li>
|
||||
<?= dt('Completed on %B %e, %G at %k:%M %p', $task['date_completed']) ?>
|
||||
|
|
@ -17,10 +22,15 @@
|
|||
<strong><?= dt('Must be done before %B %e, %G', $task['date_due']) ?></strong>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($task['creator_username']): ?>
|
||||
<li>
|
||||
<?= t('Created by %s', $task['creator_username']) ?>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li>
|
||||
<strong>
|
||||
<?php if ($task['username']): ?>
|
||||
<?= t('Assigned to %s', $task['username']) ?>
|
||||
<?php if ($task['assignee_username']): ?>
|
||||
<?= t('Assigned to %s', $task['assignee_username']) ?>
|
||||
<?php else: ?>
|
||||
<?= t('There is nobody assigned') ?>
|
||||
<?php endif ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue