Skip to content

Commit

Permalink
Bugfixes:
Browse files Browse the repository at this point in the history
- check if boardId is set
- added status to integer-rule + cast to int
- define action in update-task-form, so it doesn't change when deleting an attachment
  • Loading branch information
Sandritsch91 committed Jul 29, 2021
1 parent 713f4ee commit b731433
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/models/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static function tableName()
public function rules()
{
return [
[['id', 'bucket_id', 'ticket_id'], 'integer'],
[['id', 'bucket_id', 'ticket_id', 'status'], 'integer'],
['subject', 'string', 'max' => 255],
['status', 'in', 'range' => [self::STATUS_DONE, self::STATUS_IN_PROGRESS, self::STATUS_NOT_BEGUN]],
['start_date', 'date', 'timestampAttribute' => 'start_date'],
Expand Down Expand Up @@ -169,7 +169,7 @@ public function attributeLabels()
*/
public function beforeSave($insert)
{
if ($this->isAttributeChanged('status') && $this->status === self::STATUS_DONE) {
if ($this->isAttributeChanged('status') && (int)$this->status === self::STATUS_DONE) {
if (!$this->beforeFinish()) {
return false;
}
Expand All @@ -183,7 +183,7 @@ public function beforeSave($insert)
*/
public function afterSave($insert, $changedAttributes)
{
if (isset($changedAttributes['status']) && $this->status === self::STATUS_DONE) {
if (isset($changedAttributes['status']) && (int)$this->status === self::STATUS_DONE) {
$this->afterFinish($changedAttributes);
}

Expand Down
2 changes: 1 addition & 1 deletion src/views/task/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class="dropdown-toggle text-decoration-none text-reset">
'linkOptions' => [
'onclick' => 'window.sa.kanban.copyTextToClipboard(\'' . Url::to([
'plan/view',
'id' => $boardId ?: $model->board->id,
'id' => isset($boardId) ? $boardId : $model->board->id,
'showTask' => $model->id,
'group' => Yii::$app->request->getQueryParam('group', 'bucket')
], true) . '\')'
Expand Down
1 change: 1 addition & 0 deletions src/views/task/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<div class="kanban-task-modal">
<?php $form = ActiveForm::begin([
'id' => 'taskModalForm',
'action' => ['task/update', 'id' => $model->id],
'fieldConfig' => [
'labelOptions' => [
'class' => ['col-form-label-sm', 'py-0']
Expand Down

0 comments on commit b731433

Please sign in to comment.