The file cannot be included into sources in current form for a couple of reasons:
1. Some fields in database are not updated leaving it in inconsistent state:
recurrent_invoices.debtor_no
sales_orders.debtor_no, sales_orders.branch_code
gl_trans.person_id - for some transaction where person_type_id is set to PT_CUSTOMER
2. For security reasons additional access to this feature should be restricted to users with special rights (company admin), so additional access level have to be defined in access_levels.inc and included in sql files. If the file is to be distributed as extension module, this can be defined in module.
3. Due to potentially disastrous effects, the warning displayed on the page is not enough. Additional confirmation step should be used before customer merging is done. this mechanism is used e.g. in Setup|Void Transaction page, and can be reused here.
4. The code should be at least roughly consistent with those used in the rest of application (e.g. using defined output helpers instead of raw html echo, or sanitizing sql with db_escape() function). These requirements have kept the code maintainable so far, and we want to continue this in near future.
Beside that, the feature looks interesting indeed, especially for novice users or in multi-salesman setup, where multiply customer records are not so rare.
Janusz