mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-11-29 08:56:03 +00:00
Store DTSTART and DTEND from user in shadow columns
We want to store the calculated dtstart and dtend in the database so we can use SQL to fetch records. However, we also need what the user sent us so we can allow prop-filters to be used as well. So we store what the user sends us in dtstart_orig and dtend_orig and only use for relevant prop-filter reports.
This commit is contained in:
1 parent
5a73991496
commit
15d01c8bed
37 files changed
+1321
-84
No files matched your search
+24
-14
@@ -124,7 +124,14 @@ class WritableCollection extends DAVResource {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dtstart = $first->GetPValue('DTSTART');
|
||||
$calitem_params[':dtstart_orig'] = $dtstart;
|
||||
if ( (!isset($dtstart) || $dtstart == '') && $first->GetPValue('DUE') != '' ) {
|
||||
$dtstart = $first->GetPValue('DUE');
|
||||
}
|
||||
|
||||
$dtend = $first->GetPValue('DTEND');
|
||||
$calitem_params[':dtend_orig'] = $dtend;
|
||||
if ( isset($dtend) && $dtend != '' ) {
|
||||
dbg_error_log( 'PUT', ' DTEND: "%s", DTSTART: "%s", DURATION: "%s"', $dtend, $first->GetPValue('DTSTART'), $first->GetPValue('DURATION') );
|
||||
$calitem_params[':dtend'] = $dtend;
|
||||
@@ -218,26 +225,29 @@ class WritableCollection extends DAVResource {
|
||||
if ( $create_resource ) {
|
||||
$sql = <<<EOSQL
|
||||
INSERT INTO calendar_item (user_no, dav_name, dav_id, dav_etag, uid, dtstamp,
|
||||
dtstart, dtend, summary, location, class, transp,
|
||||
description, rrule, tz_id, last_modified, url, priority,
|
||||
created, due, percent_complete, status, collection_id,
|
||||
first_instance_start, last_instance_end )
|
||||
VALUES ( :user_no, :dav_name, currval('dav_id_seq'), :etag, :uid, :dtstamp,
|
||||
:dtstart, $dtend, :summary, :location, :class, :transp,
|
||||
:description, :rrule, :tzid, :modified, :url, :priority,
|
||||
:created, :due, :percent_complete, :status, $collection_id,
|
||||
:first_instance_start, :last_instance_end)
|
||||
dtstart, dtstart_orig, dtend, dtend_orig, summary, location, class, transp,
|
||||
description, rrule, tz_id, last_modified, url, priority, created, due,
|
||||
percent_complete, status, collection_id, first_instance_start,
|
||||
last_instance_end )
|
||||
VALUES ( :user_no, :dav_name, currval('dav_id_seq'), :etag, :uid, :dtstamp,
|
||||
:dtstart, :dtstart_orig, $dtend, :dtend_orig, :summary, :location, :class,
|
||||
:transp, :description, :rrule, :tzid, :modified, :url, :priority,
|
||||
:created, :due, :percent_complete, :status, $collection_id,
|
||||
:first_instance_start, :last_instance_end)
|
||||
EOSQL;
|
||||
$sync_change = 201;
|
||||
}
|
||||
else {
|
||||
$sql = <<<EOSQL
|
||||
UPDATE calendar_item SET dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
|
||||
dtstart=:dtstart, dtend=$dtend, summary=:summary, location=:location, class=:class, transp=:transp,
|
||||
description=:description, rrule=:rrule, tz_id=:tzid, last_modified=:modified, url=:url, priority=:priority,
|
||||
created=:created, due=:due, percent_complete=:percent_complete, status=:status,
|
||||
first_instance_start=:first_instance_start, last_instance_end=:last_instance_end
|
||||
WHERE user_no=:user_no AND dav_name=:dav_name
|
||||
dtstart=:dtstart, dtstart_orig=:dtstart_orig, dtend=$dtend,
|
||||
dtend_orig=:dtend_orig, summary=:summary, location=:location, class=:class,
|
||||
transp=:transp, description=:description, rrule=:rrule, tz_id=:tzid,
|
||||
last_modified=:modified, url=:url, priority=:priority, created=:created,
|
||||
due=:due, percent_complete=:percent_complete, status=:status,
|
||||
first_instance_start=:first_instance_start,
|
||||
last_instance_end=:last_instance_end
|
||||
WHERE user_no=:user_no AND dav_name=:dav_name
|
||||
EOSQL;
|
||||
$sync_change = 200;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user