Mail Domain form allows duplicate domains

The getDomainModuleDomains function has an argument $not_used_in_table = null, but it fails to filter domains that already exist for the for when creating a new entry.

Selecting such a domain then gives me an error 'Duplicate Domain.'

This seems to be caused by a null value that we pass to queryAllRecords via $selected_domain, converting that to an empty string solves it.