Create the Timezone if we need to

Detected now due to a change from a few years ago to use a clean database
for each set of tests.
This commit is contained in:
Andrew Ruthven 2024-03-31 01:40:38 +13:00
parent ec9159fd69
commit d2d36399d3
2 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,6 @@
2024-03-31 Andrew Ruthven <andrew@etc.gen.nz>
* Ensure that we have the timezone for invites received via iSchedule.
2024-03-30 Andrew Ruthven <andrew@etc.gen.nz>
* Many more changes for PHP 8.2 support.

View File

@ -198,6 +198,18 @@ class WritableCollection extends DAVResource {
$qry->QDo('SET TIMEZONE TO \''.$olson."'" );
$last_olson = $olson;
}
$params = array( ':tzid' => $tzid);
$qry = new AwlQuery('SELECT 1 FROM timezones WHERE tzid = :tzid', $params );
if ( $qry->Exec('PUT',__LINE__,__FILE__) && $qry->rows() == 0 ) {
$params[':olson_name'] = $olson;
$params[':vtimezone'] = (isset($tz) ? $tz->Render() : null );
$params[':last_modified'] = (isset($tz) ? $tz->GetPValue('LAST-MODIFIED') : null );
if ( empty($params[':last_modified']) ) {
$params[':last_modified'] = gmdate('Ymd\THis\Z');
}
$qry->QDo('INSERT INTO timezones (tzid, olson_name, active, vtimezone, last_modified) VALUES(:tzid,:olson_name,false,:vtimezone,:last_modified)', $params );
}
}
$created = $first->GetPValue('CREATED');
@ -239,7 +251,8 @@ EOSQL;
}
else {
$sql = <<<EOSQL
UPDATE calendar_item SET dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
UPDATE calendar_item
SET dav_etag=:etag, uid=:uid, dtstamp=:dtstamp,
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,