Closed raimund-schluessler closed 9 years ago
I'm able to reproduce this. This can probably be fixed similarly to these changes: https://github.com/owncloud/tasks/pull/164#discussion-diff-30459929
The priority has to be fixed at this point in the code: https://github.com/owncloud/tasks/blob/master/controller/helper.php#L158
I don't like the idea of casting the priority to a string as the priority is an integer.
But neither casting to an Integer ((int) $vtodo->PRIORITY
) nor calling getValue() ($vtodo->PRIORITY->getValue()
) works.
If I change the code to call getValue() it returns an PHP error:
Call to a member function getValue() on a non-object at \/[...]\/apps\/tasks\/controller\/helper.php#158
Even though $vtodo->PRIORITY
should be a VObject-Property-Integer Object which has such a function. Any idea why this happens?
This probably happens as it might not be set at all and then it doesn't have a getValue()
function. So we always have to check if it is set or not. This bothered me a bit when upgrading to sabre 2.1 as the behaviour was different before. In #185 you check if it is set and there shouldnt be an error. Casting to int
or string
implicitly checks if it is set, so there is no problem.
@raimund-schluessler thanks, took me a while to find this out ;)
Currently new tasks are given high priority and an empty category when added. This is due to wrong initial values given at https://github.com/owncloud/tasks/blob/master/controller/taskscontroller.php#L285-L293.