Hi,
when editing an individual event in a series of a recurring event, it is supposed to save the event_id of the original recurring event as the event_pid, but instead it is saving some huge number which is seemingly random. Pls help me!
By any chance, are you eding instance of event while the master event was created but not saved yet?
The “huge number” is a temporary ID, which is assinged for newly created events. And will be changed with actual Id after event saving in DB.
Hi,
the sequence of what happens:
- I create a recuring event.
- I reload the calendar page completely in new browser. Recurring event is correctly displayed.
- I edit an instance of the recurring event. It immediately displays correctly, BUT in databse it saves event_pid as the temporary id, not the recurring event master event_id.
- I reload the calendar in new browser. Recurring event is now showing two entries on that day. This is because the pid i not the same as rec event master event_id.
I found some code elsewhere on thye forum:
[code]scheduler.attachEvent(“onEventIdChange”, function(event_id,event_object){
if(event_id!='' && scheduler.getEvent(event_id).rec_type){
var eventText = event_object.text;
var repeatArray = new Array();
var repeatArray = scheduler.getRecDates(event_id);
var repeatCount = repeatArray.length;
var new_id = scheduler.uid();
for (var i = 0; i < repeatCount; i++){
var start_date = repeatArray[i]['start_date'];
var end_date = repeatArray[i]['end_date'];
scheduler._add_rec_marker(scheduler.getEvent(new_id),start_date);
scheduler.addEvent({
start_date: start_date,
end_date: end_date,
text:eventText,
event_pid:event_id,
event_length:start_date.valueOf()/1000,
rec_type:""
}
);
}
if (new_id!=event_id); //added
dp.setUpdated(new_id, true, "inserted"); //added
new_id = scheduler.uid(); //added
}
else return true;
});[/code]
but this does not change the pid in the db at all. No difference. Any ideas pls?
Hello,
Please enable log in your events.php file, repeat steps to reproduce this issue and post logs here.
$scheduler->enable_log("recurring_log.txt",true);
Best regards,
Ilya
Hi Ilya,
I would if I could, but as I am using ASP and ot php, that might be tricky. I can try to explain a bit more what I have as logic in my data processor (I might be completely wrong in my insert/update/delete logic!):
[code]<%
response.expires=-1
On Error Resume Next
Dim strCount
Dim formName
Dim formValue
Dim strContent
Dim newxml
Dim eventID, evid
dim eventAction
dim rectype
dim recpattern
dim eventlength
dim eventpid
dim territoryid
dim custid
dim addressloc
dim outcomes
dim cusid
dim cusloc
dim evtype
eventID = Request.Form("ids")
evid = request.Form(eventID&"_event_id")
eventAction = request.Form(eventID&"_!nativeeditor_status")
eventText = request.Form(eventID&"_text")
eventDetails = request.Form(eventID&"_details")
startDate = request.Form(eventID&"_start_date")
endDate = request.Form(eventID&"_end_date")
rectype = request.Form(eventID&"_rec_type")
recpattern = request.Form(eventID&"_rec_pattern")
eventlength = request.Form(eventID&"_event_length")
territoryid = request.Form(eventID&"_section_id")
custid = request.Form(eventID&"_customer_drop")
addressloc = request.Form(eventID&"_address_drop")
cusid = request.Form(eventID&"_cusid")
cusloc = request.Form(eventID&"_cusloc")
outcomes = request.Form(eventID&"_outcomes")
evtype = request.Form(eventID&"_eventtype")
'if recpattern="none" then
eventpid = request.Form(eventID&"_event_pid")
'else
'eventpid = request.Form(eventID&"_event_pid")
'end if
if outcomes = "undefined" then
outcomes = 0
end if
if len(eventlength)=0 then
eventlength="''"
end if
if len(territoryid)=0 then
territoryid="0"
end if
if len(cusid) = 0 then
custid =0
end if
if len(cusloc) = 0 then
addressloc =0
end if
if len(request.querystring("terr"))>0 then
territoryid = request.querystring("terr")
end if
if len(eventpid) = 0 then
eventpid =0
end if
'request.Form(eventID&"_event_pid")
const connectionString= “connection string here removed for posting to forum”
dim CRMConn,sql,SQLString
Set CRMConn = Server.CreateObject(“adodb.connection”)
CRMConn.Open(connectionString)
SELECT CASE eventAction
Case “updated”
if len(rectype) > 0 then
SQLString = "UPDATE compiledEvents SET [deleted]=1 WHERE [event_pid]="&evid
CRMConn.Execute(SQLString)
newxml = "<data><action type='deleted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
else
SQLString = "UPDATE compiledEvents SET [start_date]='"&startdate&"',[end_date]='"&enddate&"',[text]='"&eventText&"',[details]='"&eventDetails&"',[TERRITORYID]='"&territoryid&"',addressloc='"&addressloc&"',[CUS_ID]='"&custid&"',[event_location]='"&addressloc&"',[rYear]="&Year(startDate)&",[rMonth]="&Month(startdate)&",[rec_type]='"&rectype&"',[event_length]="&eventlength& ",[event_pid]="&eventpid&",outcome="&outcomes&",[rec_pattern]='"&recpattern&"'"
if isnumeric(cusid)=True then
SQLString = SQLString & ",[cusid]='"&cusid&"'"
end if
if isnumeric(cusloc)=True then
SQLString = SQLString & ",[cusloc]='"&cusloc&"'"
end if
SQLString = SQLString & ",[eventtype]='"& evtype &"' WHERE [ID]="&evid
CRMConn.Execute(SQLString)
newxml = "<data><action type='inserted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
end if
Case “deleted”
if len(rectype) > 0 then
SQLString = "UPDATE compiledEvents SET [deleted]=1 WHERE [event_pid]="&eventpid
CRMConn.Execute(SQLString)
newxml = "<data><action type='deleted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
else
if eventpid <> 0 then
SQLString = "UPDATE compiledEvents SET [rec_type]='none', [rec_pattern]='none' WHERE [ID]="&evid
CRMConn.Execute(SQLString)
newxml = "<data><action type='deleted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
else
SQLString = "UPDATE compiledEvents SET [deleted]=1 WHERE [ID]="&evid
CRMConn.Execute(SQLString)
newxml = "<data><action type='deleted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
end if
end if
Case “inserted”
SQLString = “INSERT INTO compiledEvents ([start_date], [end_date], [text], [details], [TERRITORYID],addressloc,[CUS_ID],[event_location],[lat],[lng],[rYear],[rMonth],[rec_type],[event_length],[event_pid],outcome,[rec_pattern],[cusid],[cusloc],[eventtype],[event_id]) VALUES (’” &startdate&"’,’"&enddate&"’,’"&eventText&"’,’"&eventDetails&"’,’"&territoryid&"’,’"&addressloc&"’,’"&custid&"’,’"&addressloc&"’,67,67,"&Year(startDate)&","&Month(startdate)&",’"&rectype&"’,"&eventlength&","&eventpid&","&outcomes&",’"&recpattern&"’,’"&cusid&"’,’"&cusloc&"’,"& evtype &","&eventID&" )"
CRMConn.Execute(SQLString)
dim rsTabl,tabl
SQLString = "SELECT [ID] from compiledEvents where [event_id] = "&eventID
SET rsTabl = CRMConn.Execute(SQLString)
tabl = rsTabl(“ID”)
if rectype = "none" then
newxml = "<data><action type='deleted' sid='"&eventID&"' tid='"&eventID&"' ></action></data>"
else
newxml = "<data><action type='inserted' sid='"&eventID&"' tid='"&tabl&"' ></action></data>"
end if
end select
CRMConn.Close
response.write(newxml)
'response.write(SQLString)
%>[/code]
Hello,
To narrow the root of the problem a bit can you please reproduce the same steps with Firefox and Firebug enabled?
We are interested in what is sent to the server – if correct event_pid is sent then the problem is somewhere in the server side script.
Check screenshot.
Best regards,
Ilya
firebug is not allowed install on my pc ;( so I ran fiddler2 to get same info from IE:
1294675531543_dummy=undefined
1294675531543_cusloc=null
1294675531543_cusid=null
1294675531543_address_drop=
1294675531543_customer_drop=
1294675531543_details=
1294675531543_outcomes=1
1294675531543_eventtype=1
1294675531543_event_id=743913
1294675531543_event_name=Exec%20Visit
1294675531543_event_location=
1294675531543_lat=52.595553930000000
1294675531543_lng=-1.625172736000000
1294675531543_start_date=25%2F01%2F2011%2007%3A00
1294675531543_end_date=25%2F01%2F2011%2008%3A00
1294675531543_rec_type=
1294675531543_rec_pattern=
1294675531543_event_pid=1294675531504
1294675531543_event_length=1295938800
1294675531543_id=1294675531543
1294675531543_text=Exec%20Visit%202
1294675531543_!nativeeditor_status=inserted
ids=1294675531543
it seems that the master event is randomly serialized when displayed. I use multisource, mapview and I have to have scheduler.config.prevent_cache = true; or the calendar fails to load recurring events and generally screws up.
I DO read in the database event id correctly:
SQLString = "SELECT [ID]" _
& ",[start_date]" _
& ",[end_date]" _
& ",[text]" _
& ",[details]" _
& ",[rYear]" _
& ",[TERRITORYID]" _
& ",[CUS_ID]" _
& ",[event_location]" _
& ",[lat]" _
& ",[lng]" _
& ",[rMonth]" _
& ",[Expr1]" _
& ",[rec_type]" _
& ",[event_length]" _
& ",[event_pid]" _
& ",[addressloc]" _
& ",[eventtype]" _
& ",[outcome]" _
& " FROM [dbo].[geolocEvents_view] where TERRITORYID = '"&tID&"' AND rYear=year(getdate()) AND rMonth=month(getdate()) AND deleted<>1"
which is then turned into xml like so:
[code]objRS.Open SQLString, CRMConn
response.write("")
'Loop through the Recordset
Do While Not objRS.EOF
response.write("")
response.write("<event_id></event_id>")
response.write("<start_date></start_date>")
response.write("<end_date></end_date>")
response.write("")
response.write("<event_name></event_name>")
response.write("<customer_drop></customer_drop>")
response.write("
response.write("<event_location></event_location>")
response.write("")
response.write("")
response.write("<rec_type></rec_type>")
response.write("<event_length></event_length>")
response.write("<address_drop></address_drop>")
response.write("")
response.write("")
response.write("<event_pid></event_pid>")
response.write("")
objRS.MoveNext
Loop
CRMConn.Close
Set CRMConn= Nothing
response.write("")[/code]
also, having checked the inner html of the data divs they look like this:
<div class="dhx_cal_event_clear" style="position: absolute; width: 114px; top: 587px; left: 258px;" event_id="1294677757838">
That event_id SHOULD be the actual event_id I retrieve from the database; not this long weird number.
Scheduler will generate unique ids during data loading - only if datasource has not native IDs
Double check , that data generated by your server side script has valid IDs
umm, yeah, found it. the id for each event was padded in the xml. not an easy one to spot when you don’t know where to look.
Again thanks so much for your patience and insights!
I may come back with some further issues later… trying to use the help you have given others as a first resort.
Thanks!