Allow delete of server if all hosting accounts are terminated or cancelled
At present (July 2017) it's not possible to delete a server in WHMCS if there are still hosting accounts associated with that server, even if they are all terminated or cancelled.
WHMCS > Setup > Products/Services > Servers > Delete (a server)
So even if the number of 'Active Accounts' in the above list is reporting 0, an attempt to delete a server where non-active (cancelled or terminated) accounts are still associated with that server will return the error message:
"An Error Occurred. You cannot delete a server while hosting accounts are still assigned to it"
Immediate cosmetic improvements to the above would be:
1. Change this error message to: "An Error Occurred. You cannot delete a server while hosting accounts are still assigned to it, even if they are cancelled or terminated".
2. As well as the existing "Active Accounts" column in the above configservers.php page, add another column that lists how many cancelled or terminated accounts are still associated with this server. Additional, make this information available as a clickable link to a report that lists out exactly which these accounts are. (This would just be a shortcut to a pre-filtered report in the clientshostinglist.php script).
I've contacted WHMCS support people about this, and their response was:
"The best workaround as you have found, would be to assign terminated and cancelled accounts to a different server, even if they are not provisioned there. If you add a false server, this can cause other problems as WHMCS will try to run the usage update part of the cron and hang on any servers it can't actually connect to."
While accepting the above as the best currently available workaround, it's not very satisfactory.
Another workaround would be to completely delete the accounts in question, but this is not ideal from an historical record-keeping perspective.
I don't have a best suggestion for this. Bottom line is that I should be able to delete a server (not just 'disable' it) when it no longer exists, and I shouldn't have to delete hosting accounts to achieve this if they've been cancelled or terminated.
If I'm missing something, or anyone has any better workarounds, I'm all ears! :-)
Thanks for your consideration,