tvplanit: read/write Event.ResourceID to/from file

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8170 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-12-06 09:19:50 +00:00
parent 2cecea18c8
commit 128de8bce3
3 changed files with 6 additions and 0 deletions

View File

@ -323,6 +323,7 @@ begin
try try
L.AddDateTimeField('StartTime', AEvent.StartTime, 'c'); // short date + long time L.AddDateTimeField('StartTime', AEvent.StartTime, 'c'); // short date + long time
L.AddDateTimeField('EndTime', AEvent.EndTime, 'c'); // 1 L.AddDateTimeField('EndTime', AEvent.EndTime, 'c'); // 1
L.AddField('ResourceID', IntToStr(AEvent.ResourceID));
L.AddField('Description', AEvent.Description); L.AddField('Description', AEvent.Description);
L.AddField('Location', AEvent.Location); L.AddField('Location', AEvent.Location);
L.AddField('Notes', EncodeLineEndings(AEvent.Notes)); L.AddField('Notes', EncodeLineEndings(AEvent.Notes));
@ -1201,6 +1202,7 @@ begin
StrToEventTimes(s, tStart, tEnd); StrToEventTimes(s, tStart, tEnd);
event := res.Schedule.AddEvent(id, tStart, tEnd); event := res.Schedule.AddEvent(id, tStart, tEnd);
StrToEvent(s, event); StrToEvent(s, event);
event.ResourceID := event.Owner.Owner.ResourceID;
end; end;
key := Format('Tasks of resource %d', [resID]); key := Format('Tasks of resource %d', [resID]);

View File

@ -188,6 +188,7 @@ function TVpJSONDatastore.EventToJSON(AEvent: TVpEvent): TJSONObject;
begin begin
Result := TJSONObject.Create; Result := TJSONObject.Create;
Result.Add('RecordID', AEvent.RecordID); Result.Add('RecordID', AEvent.RecordID);
Result.Add('ResourceID', AEvent.ResourceID);
Result.Add('Description', AEvent.Description); Result.Add('Description', AEvent.Description);
Result.Add('Notes', AEvent.Notes); Result.Add('Notes', AEvent.Notes);
Result.Add('Location', AEvent.Location); Result.Add('Location', AEvent.Location);
@ -333,6 +334,7 @@ begin
endDate := StrToDateTime(s, FFormatSettings) else endDate := StrToDateTime(s, FFormatSettings) else
endDate := 0; endDate := 0;
Result := AResource.Schedule.AddEvent(evID, startDate, endDate); Result := AResource.Schedule.AddEvent(evID, startDate, endDate);
Result.ResourceID := AResource.ResourceID;
Result.Description := AObj.Get('Description', ''); Result.Description := AObj.Get('Description', '');
Result.Notes := AObj.Get('Notes', ''); Result.Notes := AObj.Get('Notes', '');
Result.Location := AObj.Get('Location', ''); Result.Location := AObj.Get('Location', '');

View File

@ -731,6 +731,7 @@ begin
t2 := GetDateTimeAttrValue(ANode, 'EndTime', FXmlSettings); t2 := GetDateTimeAttrValue(ANode, 'EndTime', FXmlSettings);
ev := ASchedule.AddEvent(id, t1, t2); ev := ASchedule.AddEvent(id, t1, t2);
ev.ResourceID := ASchedule.Owner.ResourceID;
ev.AlarmAdvance := GetIntAttrValue(ANode, 'AlarmAdvance'); ev.AlarmAdvance := GetIntAttrValue(ANode, 'AlarmAdvance');
ev.AlarmSet := GetBoolAttrValue(ANode, 'AlarmSet'); ev.AlarmSet := GetBoolAttrValue(ANode, 'AlarmSet');
ev.AlertDisplayed := GetBoolAttrValue(ANode, 'AlertDisplayed'); ev.AlertDisplayed := GetBoolAttrValue(ANode, 'AlertDisplayed');
@ -1317,6 +1318,7 @@ var
begin begin
with TDOMElement(AEventNode) do begin with TDOMElement(AEventNode) do begin
SetAttribute('RecordID', IntToStr(AEvent.RecordID)); SetAttribute('RecordID', IntToStr(AEvent.RecordID));
SetAttribute('ResourceID', IntToStr(AEvent.ResourceID));
SetAttribute('Category', IntToStr(AEvent.Category)); SetAttribute('Category', IntToStr(AEvent.Category));
if AEvent.StartTime <> 0 then if AEvent.StartTime <> 0 then
SetAttribute('StartTime', DateTimeToStr(AEvent.StartTime, FXmlSettings)); SetAttribute('StartTime', DateTimeToStr(AEvent.StartTime, FXmlSettings));