Update workflow.function.php

add one condition to update the task status,  this will make update more effectively