Fix master regression on inactive contact types
Removing the WHERE type.name = NULL here makes sense
https://github.com/civicrm/civicrm-core/commit/
351e8d470a95e1a610280731706c816033fb79fa#diff-ae3cfb8afd3fe1ab8f471b3a069563cdL244
but a few lines later an extra condition is added - we need the WHERE there to prevent it being
added to the join clause.
Note that I did something a bit yuck with the static. I want to properly re-write the function
with consistent caching but after it's under testing, hence a quick fix