Adding a HAS condition to WHERE statements

I needed a 'HAS' condition for some of my queries, so I added it. The condition `HAS "foobar"' succeeds if the item has a field named foobar. I'm happy to make my code comply to whatever coding standards you wish, just let me know.