Inofficial fix for basic recurring tasks

This is an inofficial fix for problems with z-push 2.4.5 and recurring to-dos. I am not related to the Kopano company in any way, so this is community code. Use at your own risk - I accept no responsibilities for whatever happens on your site. It has been tested only with 9folders Nine, Version 4.4.1d on Android 5.1.1. The modified code works for me. It does not mean, it will work for you or solve your problem.

The issues addressed are:

  • when an recurring to-do is marked complete, the icon is not checked as done
  • when an recurring to-do is marked complete, the icon is not a simple to-do, but a recurring to do
  • problems with duplication of to-dos
  • Outlook 2016 sets a weird finished date when a recurring to-do was created in Outlook, than marked as done on Nine,
    then the newly created recurring to-do is marked as done in Outlook
  • Outlook 365 crashes when a recurring to-do was created in Outlook, than marked as done on Nine, then the newly created recurring to-do is marked as done in Outlook
  • error messag ein z-push-error.log:
09/11/2018 14:24:24 [12411] [WARN] [someuser] /usr/share/z-push/backend/kopano/mapi/class.taskrecurrence.php:103 Undefined offset: -2138701566 (8)
09/11/2018 14:24:24 [12411] [WARN] [someuser] /usr/share/z-push/backend/kopano/mapi/class.taskrecurrence.php:104 Invalid argument supplied for foreach() (2)

Unsolved problems:

  • any complex recurrency involving a start or end date. Only simple “do this every week, infinite” or “do that everyday, 15 times” seem to work.

Problems discovered and how I worked around them:

  • the original source code creates repetition information for completed tasks if the AS client sends those. This seems to be stupid to be done by the client, so I changed the code to add repetition information only on non-completed tasks. This fixed the icon issues.
  • to fix the problem with the error message, I make sure a structure has a valid information. Currently, the structure $task->recurrence->start is unset, probably due to another problem. As a result, the repetition info can’t be saved in the MAPI backend, which breaks leads to the message in the error log and breaks OL2016 and OL356.

The file patched is z-push/backend/kopano/mapiprovider.php. My modified version can be downloaded at https://www.dropbox.com/s/unqykahtofkk8mm/mapiprovider.php?dl=0

The diff of my modification against the original 2.4.5 file is like this:

root@netprobe:/usr/share/z-push/backend/kopano# diff mapiprovider.php mapiprovider.php.orig 
1728,1731c1728,1730
< // PB FIX START
<             if (!($task->complete)) { // recurrency is only processed when the task is not completed, otherwise OL gets confused
< 		// Set PR_ICON_INDEX to 1281 to show correct icon in category view
< 	        $props[$taskprops["icon"]] = 1281;
---
> 
>             // Set PR_ICON_INDEX to 1281 to show correct icon in category view
>             $props[$taskprops["icon"]] = 1281;
1741d1739
< 
1745,1750c1743
<             if (isset($task->recurrence->start)) { // for some reason, $task->recurrence->start is not always (aka never) set
< 		$recur["start"] = $task->recurrence->start;
< 	    } else {
<             	$recur["start"] = $task->duedate; 
< 	    }
< 
---
>             $recur["start"] = $task->recurrence->start;
1763,1766c1756
< 
<             $recurrence->setRecurrence($recur);	
< 		}
< // PB FIX END
---
>             $recurrence->setRecurrence($recur);

Maybe this helps somebody to get at least simple recurrent tasks to work.

I’m happy to hear from Kopano what they think about these fixes, especially the fact I simply do not create recurrence data if a task that is completed.

I would’nt wonder if Kopano warns about using my code. So, again: use on your own risk.

@Kopano: if you have problems with having me parked my version of the file on Dropbox, please tell me. I will remove it immediately if you want me to. I clearly accept every right you have on the source code.

Hi itserv,

while your fix solves the issues you’re having with recurring tasks in Nine in Outlook now, I doubt it will work properly once webapp implements recurring tasks support because you don’t save recurrence data when a task is completed.

if (isset($task->recurrence->start)) { // for some reason, $task->recurrence->start is not always (aka never) set

According to the ActiveSync documentation start is a required child element of the recurrence element: https://msdn.microsoft.com/en-us/library/ee204035(v=exchg.80).aspx. It also explains how to handle it if is not set. Simply setting it to due date is wrong. If I’m not completely mistaken Start is the same for all occurrences of a recurrence which allows to attribute an occurrence to the specific recurring task.

Manfred

Manfred,

I’m happily looking forward for a WebApp that supports recurrence elements. Maybe, this improves the z-push backend and makes recurring tasks working there, too. I’m happy on every update which makes my hack needless.

Of course I disconnected my z-push installation from updates through the repository, as an update would remove my modification. And I have disabled automatic updates for 9folders Nine App. Because I know THESE combination of versions works now, and future updates might no longer work. Bad luck for me, but I need working recurring tasks now and not at some time in the future.

Finally, I’ll have a test server for whenever a new version of z-push comes along, I will test any new versions coming from you if they make my modifications obsolete. I would be happy if they will become obsolete. And every new version will be tested by me for recurring tasks, and you will receive my feedback, without the expectation you’ll fix anything.

Until then: I’m happy with my patch, as it makes recurrent tasks working (except for the case I have to set an until-date. Then I get the next error message, and the tasks don’t arrive correctly on my mobile. File backend/kopano/mapiprovider.php: Line 443; $recurrence->proptags[“enddate_recurring”] is undefined, crashing the if-clause, because $recurrence->proptags[“enddate_recurring”] is undefined)

Again: I’m happy now. All I need at the moment works, and what does’nt work is what I don’t need. And holidays are near, so maybe I’ll fix more. And I’ll look if I can make my solution less invasive. My primary problem is one or two uninitialized variables/object entities or how these are called.