34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace Kanboard\Plugin\OrganonTweaks\Controller;
|
||
|
|
|
||
|
|
use Kanboard\Controller\TaskModificationController;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* "Save & Close": the exact core task update, but on success it redirects to the BOARD instead of
|
||
|
|
* reopening the card view. The plugin's "Save & Close" button repoints the edit form here (via JS),
|
||
|
|
* so everything else -- validation, permission checks, CSRF, and the modal error re-render -- is
|
||
|
|
* inherited unchanged from core TaskModificationController. This mirrors core update() line for line
|
||
|
|
* except the one redirect target (kept in sync on Kanboard upgrades).
|
||
|
|
*/
|
||
|
|
class TaskSaveCloseController extends TaskModificationController
|
||
|
|
{
|
||
|
|
public function update()
|
||
|
|
{
|
||
|
|
$task = $this->getTask();
|
||
|
|
$values = $this->request->getValues();
|
||
|
|
$values['id'] = $task['id'];
|
||
|
|
$values['project_id'] = $task['project_id'];
|
||
|
|
|
||
|
|
list($valid, $errors) = $this->taskValidator->validateModification($values);
|
||
|
|
|
||
|
|
if ($valid && $this->updateTask($task, $values, $errors)) {
|
||
|
|
$this->flash->success(t('Task updated successfully.'));
|
||
|
|
$this->response->redirect($this->helper->url->to('BoardViewController', 'show', array('project_id' => $task['project_id'])), true);
|
||
|
|
} else {
|
||
|
|
$this->flash->failure(t('Unable to update your task.'));
|
||
|
|
$this->edit($values, $errors);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|