BILLmanager 6 Startup, Advanced

How to delete a client

ISPSystem

The billing platform stem administrator can delete a client via the web-interface provided that: 

  • The client didn't make payments.  
  • The client doesn't have due expenses. 
  • The client doesn't have active services.   

In all other cases he needs to execute the following requests in the 'billmgr' database to delete a client:

set @account_id = <CLIENT_ID>;
DELETE FROM expense WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
DELETE FROM payment WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
DELETE FROM billorder WHERE subaccount IN (SELECT id FROM subaccount WHERE account = @account_id);
UPDATE ip SET item = NULL WHERE item IN (SELECT id FROM item WHERE account = @account_id OR parent IN (SELECT id FROM item WHERE account = @account_id));
DELETE FROM invoiceitem where invoice in (SELECT id FROM invoice WHERE customer IN (SELECT id FROM profile WHERE account = @account_id));
DELETE FROM item WHERE parent IN (SELECT id FROM (SELECT id FROM item WHERE account = @account_id) itm);
DELETE FROM item WHERE account = @account_id;
DELETE FROM service_profile WHERE account = @account_id;
DELETE FROM invoice WHERE customer IN (SELECT id FROM profile WHERE account = @account_id);
DELETE FROM profile WHERE account = @account_id;
DELETE FROM ticket WHERE account_client = @account_id;
DELETE FROM user WHERE account = @account_id;
DELETE FROM affiliatereward WHERE account = @account_id OR referal = @account_id;
DELETE FROM account WHERE id = @account_id;

The billing platform will delete all the information associated with that client, his billing information, and support ticket history. However, the system doesn't delete the client files, such as the configuration files, avatars, and ticket attachments. 

Restart BILLmanager:

/usr/local/mgr5/sbin/mgrctl -m billmgr exit
Thank you for your feedback!
Was the article useful?
Tell us why not:

it does not match the title

it was hard to understand

I didn't find the answer

recommendations from the article did not help

other

Tell us what you didn't like in the article: