Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/15/23 in all areas

  1. Its awful and misleading as the updated time just shows the time you visited the product details page in the client area. You can hook on to the cron (which theoretically should run every 5 minutes or so) to automatically update these more frequently. use WHMCS\Service\Service; use Illuminate\Database\Eloquent\Relations\BelongsTo; add_hook( 'AfterCronJob', 1, function () { try { Service::active() ->with( [ 'serverModel' => function ( BelongsTo $query ) { $query->where( 'type', 'cpanel' ); } ] ) ->each( function ( Service $service ) { $service->serverModel->syncTenantUsage( $service->domain ); } ); } catch ( \Exception $e ) {} } );
    1 point
  2. As the module is no longer free I'm closing this thread. Feel free to start a new thread.
    1 point
  3. Here's a sql query we run daily, which will set a customer to inactive if they have no services, domains, open invoices, and are not affiliates. You can change 'Inactive' to 'Closed'. update tblclients c set status = 'Inactive' where status = 'Active' and not exists (select 1 from tblhosting where userid = c.id and domainstatus in ('Active', 'Pending', 'Suspended')) and not exists (select 1 from tbldomains where userid = c.id and status in ('Active', 'Pending', 'Pending Transfer')) and not exists (select 1 from tblinvoices where userid = c.id and status = 'Unpaid') and not exists (select 1 from tblaffiliates where clientid = c.id);
    1 point
  4. Just in case anyone uses this, I figured I should post one modification - the addition of "Suspended" to the list of hosting statuses which should be disregarded in closing accounts. update tblclients c set status = 'Closed' where not exists (select 1 from tblhosting where userid = c.id and domainstatus in ('Active', 'Pending', 'Suspended')) and not exists (select 1 from tbldomains where userid = c.id and status in ('Active', 'Pending', 'Pending Transfer')) and not exists (select 1 from tblinvoices where userid = c.id and status = 'Unpaid') and not exists (select 1 from tblaffiliates where clientid = c.id)
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated