plesk / whmcs-plugin

Other
16 stars 33 forks source link

Get usage statistics on resellers without a domain name fails #12

Closed n8whnp closed 7 years ago

n8whnp commented 7 years ago

With Plesk it is possible to create resellers without a domain name, so when the getWebspacesUsage function in comes to get the usage statistics, it fails with the following in the module log: Request: <?xml version="1.0" encoding="UTF-8"?>

Response: <?xml version="1.0" encoding="UTF-8"?>

error1013Domain with name '' does not exist

Requisites:

  1. A client configured in WHMCS
  2. A Plesk server " Reproduction steps:
  3. Login to WHMCS admin, navigate to Setup > Products/Services > Products/Services
  4. Create a Reseller Hosting product
  5. Set any name, description and price.
  6. UNtick the Require Domain option
  7. Assign to the Plesk module and configure a plan and reseller plan name
  8. Save Changes
  9. Navigate to Setup > General Settings > Ordering tab and tick "Enable Random Usernames"
  10. Save Changes
  11. Navigate to Orders > Add New Order and place an order for the newly created product. Take care to leave the "Domain" field empty.
  12. Provision the account on the server.
  13. Navigate to Reports > Disk Usage Summary > Update Now
  14. Assert: The usage statistics for the new Plesk reseller account are not updated.
jas8522 commented 7 years ago

Connected to this is the fact that reseller plans (with associated domains) only show usage stats for the subscription connected to the primary domain. In other words, the usage stats showing in WHMCS are completely wrong.

For example, one reseller of ours is at 88GB of 120GB storage usage, however in WHMCS it only shows 11GB of "Unlimited" because that's what the subscription associated with their 'primary' domain in WHMCS is configured to.

I'm working on modifying the plesk_UsageUpdate() hook such that it detects hosting plans of type 'reselleraccount' in WHMCS and, instead of grabbing webspace (subscription) stats for those plans, it will grab reseller account stats. Once implemented, this should resolve both of our issues with usage stats not updating properly.

jas8522 commented 7 years ago

I've now got some code in place for this that should work to resolve both of these issues in that it will grab reseller stats based on username for all resellers on the server that WHMCS sends to _UsageUpdate. It hasn't yet been tested. See here: https://github.com/jas8522/whmcs-plugin/tree/reseller-plan-stats-update

jas8522 commented 7 years ago

This is now confirmed tested and fixed with #19 as referenced above.

jas8522 commented 7 years ago

This can be closed now.