mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-11-29 08:56:03 +00:00
Add a primary key to calendar_alarm table.
Also fixed a bug in scripts/refresh-alarms.php if there was an alarm with a duplicate trigger. This is part of the fix for #276.
This commit is contained in:
1 parent
6819d6d7d1
commit
e3b5c331be
5 files changed
+25
-9
No files matched your search
@@ -326,10 +326,11 @@ EOSQL;
|
||||
|
||||
$components = $vcal->GetComponents();
|
||||
|
||||
$qry->SetSql('INSERT INTO calendar_alarm ( dav_id, action, trigger, summary, description, component, next_trigger )
|
||||
VALUES( '.$dav_id.', :action, :trigger, :summary, :description, :component,
|
||||
$qry->SetSql('INSERT INTO calendar_alarm ( dav_id, count, action, trigger, summary, description, component, next_trigger )
|
||||
VALUES( '.$dav_id.', :count, :action, :trigger, :summary, :description, :component,
|
||||
:related::timestamp with time zone + :related_trigger::interval )' );
|
||||
$qry->Prepare();
|
||||
$count = 0;
|
||||
foreach( $components AS $component ) {
|
||||
if ( $component->GetType() == 'VTIMEZONE' ) continue;
|
||||
$alarms = $component->GetComponents('VALARM');
|
||||
@@ -370,6 +371,7 @@ EOSQL;
|
||||
$qry->Bind(':component', $v->Render());
|
||||
$qry->Bind(':related', $related );
|
||||
$qry->Bind(':related_trigger', $related_trigger );
|
||||
$qry->Bind(':count', $count++ );
|
||||
$qry->Exec('PUT',__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1270,10 +1270,11 @@ function write_alarms( $dav_id, vComponent $ical ) {
|
||||
$alarms = $ical->GetComponents('VALARM');
|
||||
if ( count($alarms) < 1 ) return;
|
||||
|
||||
$qry->SetSql('INSERT INTO calendar_alarm ( dav_id, action, trigger, summary, description, component, next_trigger )
|
||||
VALUES( '.$dav_id.', :action, :trigger, :summary, :description, :component,
|
||||
$qry->SetSql('INSERT INTO calendar_alarm ( dav_id, count, action, trigger, summary, description, component, next_trigger )
|
||||
VALUES( '.$dav_id.', :count, :action, :trigger, :summary, :description, :component,
|
||||
:related::timestamp with time zone + :related_trigger::interval )' );
|
||||
$qry->Prepare();
|
||||
$count = 0;
|
||||
foreach( $alarms AS $v ) {
|
||||
$trigger = array_merge($v->GetProperties('TRIGGER'));
|
||||
if ( $trigger == null ) continue; // Bogus data.
|
||||
@@ -1314,6 +1315,7 @@ function write_alarms( $dav_id, vComponent $ical ) {
|
||||
$qry->Bind(':component', $v->Render());
|
||||
$qry->Bind(':related', $related_date->UTC() );
|
||||
$qry->Bind(':related_trigger', $related_trigger );
|
||||
$qry->Bind(':count', $count++ );
|
||||
$qry->Exec('PUT',__LINE__,__FILE__);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user