SSP-2733 Fix reg/not-reg directory search

This involved:

 - Fixing the CURRENT_TERM_CODE() and CURRENT_REGISTRATION_STATUS() in
   both db platforms to:
    - use the same logic as the app for handling overlapping terms
      and term gaps, and
    - stop cartesian joining with person (caused incorrect counts
      in mv_directory_person.current_registration_status)
 - Fixing the predicate building logic in PersonDirectorySearchDao.
   buildCurrentlyRegistered() to correctly handle the 'false'
   filter option

Note that for SQLServer the CURRENT_TERM_CODE() function was also
modified to compare *date* rather than date+*time* values, so it
now matches the Postgres logic. This is less important now that
we're testing end- rather than start dates, but the consistency
is a good thing.