Fix EZP-20601: Permission checking when using object states

https://jira.ez.no/browse/EZP-20601

Using object states caused a fatal error in the sql query.
Used the previous query from the 4.6 : http://pubsvn.ez.no/doxygen/4.6.0/html/ezcontentobjecttreenode_8php_source.html#l01633

This is update to PR #477