The manual doesn't say "always use parentheses," but the examples do. I'm not entirely sure what the parser does to your code without the test case being enclosed in parentheses.
Also, did you intend to test whether 'DESPATCHED' is true while assigning its value to $recordstatus, or did you intend to test whether $recordstatus is already equal to 'DESPATCHED'? Your example
if $recordstatus = 'DESPATCHED'
could have been intended to read
if ($recordstatus = 'DESPATCHED')
... which assigns the value and tests the result, or
or
if ($recordstatus == 'DESPATCHED')
... which tests the result of a comparison.