forgot password?


   
 
Can’t set <Due> when adding a action
Posted: 21 June 2011 11:03 PM   [ Ignore ]  
Newbie
Rank
Total Posts:  2
Joined  2011-06-21

Hi,

For some reason I was previously able to set the Due date when adding a action with the VB code below.
However this is not working now (ps - hard coded to test).
I do not get an error (response is 201) but the due date is always being set to yesterday! (nb: when <due></due> is used it defaults to today OK)
Also this is not a timezone thing (as you will be able to tell from the date I’ve used)

Any ideas??
Thanks in advance.

environment: TRACKS2 upgraded on a TurnkeyLinux 1.72 vm / posting from Windows7/Outlook2003.

Code:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sData = “<todo>”
  sData = sData & “<description>” + objTRACKS.Util_HTMLEncode(Mid(TodoFormx.Description.Value, 1, 99)) + “</description>”
  sData = sData & “<notes>” & objTRACKS.Util_HTMLEncode(TodoFormx.Notes.Value) & “</notes>”
  sData = sData & “<context_id>” & CStr(Contexts.Item(TodoFormx.ContextListBox.Value).Id) & “</context_id>”
  If TodoFormx.NoDueDate = True Then
      sData = sData & “<due></due>”
  Else
      sData = sData & “<due>29/06/2011</due>”
  End If
  If TodoFormx.ProjectListBox.Value <> “” Then sData = sData & “” & CStr(Projects(TodoFormx.ProjectListBox.Value).Id) & “</project_id>”
  sData = sData & “<show_from>” & CStr(TodoFormx.CalShow.Value) & “</show_from>”  ‘TodoFormx.CalShow.Value replaces Now()
  sData = sData & “</todo>” & vbCrLf
  Set objWinHttpRequest = objTRACKS.Util_SendWinHttpRequest(“POST”, “todos.xml”, False, sData)
  If objWinHttpRequest.Status <> “201” Then MsgBox objWinHttpRequest.Status & ” - ” & objWinHttpRequest.StatusText
  strLocation = objWinHttpRequest.GetResponseHeader(“Location”)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Profile
 
 
Posted: 22 June 2011 05:33 PM   [ Ignore ]   [ # 1 ]  
Sr. Member
RankRankRankRank
Total Posts:  882
Joined  2006-10-05

did it work on tracks2 before or did it stop working after upgrading from 1.7 to 2.0?

I cannot see login details (http authentication or token) Is that set outside this code?

Profile
 
 
Posted: 22 June 2011 05:57 PM   [ Ignore ]   [ # 2 ]  
Sr. Member
RankRankRankRank
Total Posts:  882
Joined  2006-10-05

if I try this on v2.0

curl -u username:password -X POST -H ‘Content-Type: text/xml’ -d ‘<todo><description>test</description><notes></notes><context_id>16</context_id><due></due></project_id><show_from></show_from></todo>’ http://localhost:3000/todos.xml -i

it succeeds. Retrieving this todo I get:

curl -u username:password -X GET -H ‘Content-Type: text/xml’ http://localhost:3000/todos/7033.xml
<?xml version=“1.0” encoding=“UTF-8”?>
<todo>
  <completed-at type=“datetime” nil=“true”></completed-at>
  <context-id type=“integer”>16</context-id>
  <created-at type=“datetime”>2011-06-21T11:22:54+02:00</created-at>
  <description>test</description>
  <due type=“datetime” nil=“true”></due>
  <id type=“integer”>7033</id>
  <notes nil=“true”></notes>
  </project-id>
  <recurring-todo-id type=“integer” nil=“true”></recurring-todo-id>
  <show-from type=“datetime” nil=“true”></show-from>
  <state>active</state>
  <updated-at type=“datetime”>2011-06-21T11:22:54+02:00</updated-at>
</todo>

This means that and empty due or show_from will be saved as nil

Could it be that your VB app is using yesterday for a nil date?

Profile
 
 
Posted: 01 July 2011 09:52 AM   [ Ignore ]   [ # 3 ]  
Newbie
Rank
Total Posts:  2
Joined  2011-06-21

Hi Reinier,

Thanks for your help - I am not sure what was happening but its now excepting these dates?? (no change to the code!)

Cheers
Cy

Profile
 
 
Posted: 04 July 2011 06:51 AM   [ Ignore ]   [ # 4 ]  
Sr. Member
RankRankRankRank
Total Posts:  882
Joined  2006-10-05

sometimes bits do strange things:-)

Profile