Files
nextcloud-workflow-deck-aut…/lib/Db/Workflow.php
T
Patrick Niebeling 8268f1068d
Build package / xml-lint (push) Successful in 3m32s
Build package / unit-tests (push) Successful in 4m49s
Build package / php-lint (8.5) (push) Successful in 4m52s
Build package / php-lint (8.4) (push) Successful in 4m56s
Build package / package (push) Successful in 2m28s
Let workflows move cards by start date instead of due date
Each workflow now has a trigger date (due or start): the runner compares
either the card's due date or its start date against now, read straight
from Deck's Card entity. Mails and Nextcloud notifications say whether
the card was overdue or reached its start date. Cards without the chosen
date stay put.

Deck only has a start date since 1.18 and Entity getters are magic, so
DeckIntegrationService::supportsStartdate() checks the property; without
it the form rejects start-date workflows and the runner skips them
without disabling them.

WorkflowRunner::isOverdue() becomes hasPassed(), as it now covers both
dates. Existing workflows keep the due date (migration Version1005).
Bumps to 35.4.0 so the migration runs.
2026-10-01 13:19:32 +02:00

74 lines
2.3 KiB
PHP

<?php
declare(strict_types=1);
namespace OCA\WorkflowDeckAutomation\Db;
use OCP\AppFramework\Db\Entity;
use OCP\DB\Types;
/**
* @method string getUserId()
* @method void setUserId(string $userId)
* @method string getTitle()
* @method void setTitle(string $title)
* @method int getBoardId()
* @method void setBoardId(int $boardId)
* @method int getSourceStackId()
* @method void setSourceStackId(int $sourceStackId)
* @method int getTargetStackId()
* @method void setTargetStackId(int $targetStackId)
* @method string getTriggerDate()
* @method void setTriggerDate(string $triggerDate)
* @method string getNotifyMode()
* @method void setNotifyMode(string $notifyMode)
* @method string getNotifyChannel()
* @method void setNotifyChannel(string $notifyChannel)
* @method bool getEnabled()
* @method void setEnabled(bool $enabled)
* @method \DateTime|null getLastRun()
* @method void setLastRun(?\DateTime $lastRun)
*/
class Workflow extends Entity implements \JsonSerializable {
protected $userId;
protected $title;
protected $boardId;
protected $sourceStackId;
protected $targetStackId;
protected $triggerDate;
protected $notifyMode;
protected $notifyChannel;
protected $enabled;
protected $lastRun;
public function __construct() {
$this->addType('id', Types::INTEGER);
$this->addType('userId', Types::STRING);
$this->addType('title', Types::STRING);
$this->addType('boardId', Types::INTEGER);
$this->addType('sourceStackId', Types::INTEGER);
$this->addType('targetStackId', Types::INTEGER);
$this->addType('triggerDate', Types::STRING);
$this->addType('notifyMode', Types::STRING);
$this->addType('notifyChannel', Types::STRING);
$this->addType('enabled', Types::BOOLEAN);
$this->addType('lastRun', Types::DATETIME);
}
public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'userId' => $this->getUserId(),
'title' => $this->getTitle(),
'boardId' => $this->getBoardId(),
'sourceStackId' => $this->getSourceStackId(),
'targetStackId' => $this->getTargetStackId(),
'triggerDate' => (string)$this->getTriggerDate(),
'notifyMode' => (string)$this->getNotifyMode(),
'notifyChannel' => (string)$this->getNotifyChannel(),
'enabled' => (bool)$this->getEnabled(),
'lastRun' => $this->getLastRun()?->format(\DateTimeInterface::ATOM),
];
}
}