DTSTART on VTODO is optional, don't force it to be set.

If we force setting DTSTART, then you can't use prop-filter to find VTODOs
with a DUE set and DTSTART unset. And, well, why should DTSTART be set to DUE?

This was introduced in 18150d702d91fa1a687801baa582d967e79fff8d .
This commit is contained in:
Andrew Ruthven 2023-02-05 14:20:42 +13:00 committed by Florian Schlichting
parent badeca53c7
commit 5a73991496
6 changed files with 21 additions and 31 deletions

View File

@ -124,15 +124,9 @@ class WritableCollection extends DAVResource {
return false;
}
$dtstart = $first->GetPValue('DTSTART');
$calitem_params[':dtstart'] = $dtstart;
if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) {
$dtstart = $first->GetPValue('DUE');
}
$dtend = $first->GetPValue('DTEND');
if ( isset($dtend) && $dtend != '' ) {
dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $dtstart, $first->GetPValue('DURATION') );
dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $first->GetPValue('DTSTART'), $first->GetPValue('DURATION') );
$calitem_params[':dtend'] = $dtend;
$dtend = ':dtend';
}
@ -203,22 +197,23 @@ class WritableCollection extends DAVResource {
if ( $created == '00001231T000000Z' ) $created = '20001231T000000Z';
$calitem_params[':created'] = $created;
$calitem_params[':tzid'] = $tzid;
$calitem_params[':uid'] = $uid;
$calitem_params[':summary'] = $first->GetPValue('SUMMARY');
$calitem_params[':location'] = $first->GetPValue('LOCATION');
$calitem_params[':transp'] = $first->GetPValue('TRANSP');
$calitem_params[':description'] = $first->GetPValue('DESCRIPTION');
$calitem_params[':tzid'] = $tzid;
$calitem_params[':uid'] = $uid;
$calitem_params[':url'] = $first->GetPValue('URL');
$calitem_params[':due'] = $first->GetPValue('DUE');
$calitem_params[':rrule'] = $first->GetPValue('RRULE');
$calitem_params[':url'] = $first->GetPValue('URL');
$calitem_params[':dtstart'] = $first->GetPValue('DTSTART');
$calitem_params[':summary'] = $first->GetPValue('SUMMARY');
$calitem_params[':location'] = $first->GetPValue('LOCATION');
$calitem_params[':transp'] = $first->GetPValue('TRANSP');
$calitem_params[':status'] = $first->GetPValue('STATUS');
$calitem_params[':priority'] = $first->GetPValue('PRIORITY');
$calitem_params[':due'] = $first->GetPValue('DUE');
$calitem_params[':description'] = $first->GetPValue('DESCRIPTION');
$calitem_params[':percent_complete'] = $first->GetPValue('PERCENT-COMPLETE');
$calitem_params[':status'] = $first->GetPValue('STATUS');
$range = getVCalendarRange($vcal, $this->timezone_name());
$calitem_params[':first_instance_start'] = isset($range->from) ? $range->from->UTC() : null;
$calitem_params[':last_instance_end'] = isset($range->until) ? $range->until->UTC() : null;
$calitem_params[':first_instance_start'] = isset($range->from) ? $range->from->UTC() : null;
$calitem_params[':last_instance_end'] = isset($range->until) ? $range->until->UTC() : null;
if ( $create_resource ) {
$sql = <<<EOSQL

View File

@ -16,7 +16,6 @@ END:VTODO
BEGIN:VTODO
UID:19920901T130000Z-123407@host.com
DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
SUMMARY:Status is set to COMPLETED, empty URL, CLASS set
CLASS:PUBLIC

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "5a6c3c652a6122411879e9bd1563b9a9"
Content-Length: 1359
ETag: "e13eac7fed1103177aa17ad7379ea098"
Content-Length: 1333
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -19,7 +19,6 @@ CALSCALE:GREGORIAN
BEGIN:VTODO
UID:19920901T130000Z-123407@host.com
DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
SUMMARY:Status is set to COMPLETED, empty URL, CLASS set
CLASS:PUBLIC

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "c073b3f2dd8d609971aaafee83aa4002"
Content-Length: 1321
ETag: "50cac5fed58d0f6d00abd3453b758f25"
Content-Length: 1295
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -43,7 +43,6 @@ CALSCALE:GREGORIAN
BEGIN:VTODO
UID:19920901T130000Z-123407@host.com
DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
SUMMARY:Status is set to COMPLETED, empty URL, CLASS set
CLASS:PUBLIC

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "c073b3f2dd8d609971aaafee83aa4002"
Content-Length: 1321
ETag: "50cac5fed58d0f6d00abd3453b758f25"
Content-Length: 1295
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -43,7 +43,6 @@ CALSCALE:GREGORIAN
BEGIN:VTODO
UID:19920901T130000Z-123407@host.com
DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
SUMMARY:Status is set to COMPLETED, empty URL, CLASS set
CLASS:PUBLIC

View File

@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
ETag: "c073b3f2dd8d609971aaafee83aa4002"
Content-Length: 1321
ETag: "50cac5fed58d0f6d00abd3453b758f25"
Content-Length: 1295
Content-Type: text/xml; charset="utf-8"
<?xml version="1.0" encoding="utf-8" ?>
@ -43,7 +43,6 @@ CALSCALE:GREGORIAN
BEGIN:VTODO
UID:19920901T130000Z-123407@host.com
DTSTAMP:19920901T130000Z
DTSTART:19920415T133000Z
DUE:19920516T045959Z
SUMMARY:Status is set to COMPLETED, empty URL, CLASS set
CLASS:PUBLIC