fix: Expose done done state through CalDAV
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
||||||
*
|
*
|
||||||
@@ -37,6 +40,8 @@ use Sabre\VObject\Component\VCalendar;
|
|||||||
* @method int getCreatedAt()
|
* @method int getCreatedAt()
|
||||||
* @method bool getArchived()
|
* @method bool getArchived()
|
||||||
* @method bool getNotified()
|
* @method bool getNotified()
|
||||||
|
* @method ?DateTime getDone()
|
||||||
|
* @method void setDone(?DateTime $done)
|
||||||
*
|
*
|
||||||
* @method void setLabels(Label[] $labels)
|
* @method void setLabels(Label[] $labels)
|
||||||
* @method null|Label[] getLabels()
|
* @method null|Label[] getLabels()
|
||||||
@@ -141,19 +146,22 @@ class Card extends RelationalEntity {
|
|||||||
$event->add('RELATED-TO', 'deck-stack-' . $this->getStackId());
|
$event->add('RELATED-TO', 'deck-stack-' . $this->getStackId());
|
||||||
|
|
||||||
// FIXME: For write support: CANCELLED / IN-PROCESS handling
|
// FIXME: For write support: CANCELLED / IN-PROCESS handling
|
||||||
$event->STATUS = $this->getArchived() ? "COMPLETED" : "NEEDS-ACTION";
|
if ($this->getDone() || $this->getArchived()) {
|
||||||
if ($this->getArchived()) {
|
|
||||||
$date = new DateTime();
|
$date = new DateTime();
|
||||||
$date->setTimestamp($this->getLastModified());
|
$date->setTimestamp($this->getLastModified());
|
||||||
$event->COMPLETED = $date;
|
$event->STATUS = 'COMPLETED';
|
||||||
//$event->add('PERCENT-COMPLETE', 100);
|
$event->COMPLETED = $this->getDone() ? $this->$this->getDone() : $this->getArchived();
|
||||||
}
|
} else {
|
||||||
if (count($this->getLabels()) > 0) {
|
$event->STATUS = 'NEEDS-ACTION';
|
||||||
$event->CATEGORIES = array_map(function ($label) {
|
|
||||||
return $label->getTitle();
|
|
||||||
}, $this->getLabels());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $event->add('PERCENT-COMPLETE', 100);
|
||||||
|
|
||||||
|
$labels = $this->getLabels() ?? [];
|
||||||
|
$event->CATEGORIES = array_map(function ($label): string {
|
||||||
|
return $label->getTitle();
|
||||||
|
}, $labels);
|
||||||
|
|
||||||
$event->SUMMARY = $this->getTitle();
|
$event->SUMMARY = $this->getTitle();
|
||||||
$event->DESCRIPTION = $this->getDescription();
|
$event->DESCRIPTION = $this->getDescription();
|
||||||
$calendar->add($event);
|
$calendar->add($event);
|
||||||
@@ -179,7 +187,7 @@ class Card extends RelationalEntity {
|
|||||||
return 'card';
|
return 'card';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getETag() {
|
public function getETag(): string {
|
||||||
return md5((string)$this->getLastModified());
|
return md5((string)$this->getLastModified());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user