MT#5929 More external_id fixes.

Set external_id to NULL in db if it's empty.
Properly clear ext_xxx_id preferences if external_id gets unset.