Remitur Posted June 22, 2020 Share Posted June 22, 2020 This simple hook adds details about services managed by the WHMCS auto-release module. Auto-release is handy, but it may be annoying because WHMCS will report in TO-DO just the service ID and a short description of action required (renew, suspend, etc.) This simple hook will add also service name, making the following job easier faster, and even more safe (it may happen that you open the service with a wrong ID, so i.e. you go on renewing the wrong service...) This hook is also available on GitHub repository: https://github.com/DomainRegister/WHMCS-enhanced-auto-release <?php // // enhanced to-do // WHMCS hook to enrich details about services managed by auto-release module // // https://domainregister.international/ // add_hook('AfterCronJob', 100, function($vars) { try { $todoitem = Capsule::table('tbltodolist') ->where('status', '!=', 'Completed') ->where('description', 'like', 'Service ID # %') ->select('id','description') ->first(); } catch (\Exception $e) { echo "error {$e->getMessage()}"; } $descr2=substr($todoitem->description,12); $serviceid=intval($descr2); $descr3=preg_replace( '/Service ID # \d+/', '', $todoitem->description ); try { $servicename = Capsule::table('tblhosting') ->where("id", $serviceid) ->select('domain') ->first(); echo "<pre>"; print_r($servicename); } catch(\Illuminate\Database\QueryException $ex){ echo $ex->getMessage(); } catch (Exception $e) { echo $e->getMessage(); } $newdescription = 'Service ID #'.$serviceid.' ( '.$servicename->domain.' ) '.$descr3.PHP_EOL; try { $update_data = [ 'description' => $newdescription ]; Capsule::table('tbltodolist') ->where('id', '=', $todoitem->id) ->update($update_data); } catch(\Illuminate\Database\QueryException $ex){ echo $ex->getMessage(); } catch (Exception $e) { echo $e->getMessage(); } }); 0 Quote Link to comment Share on other sites More sharing options...
mauwiks Posted July 21, 2020 Share Posted July 21, 2020 Thanks for this, Man! Just when I needed!!! 1 Quote Link to comment Share on other sites More sharing options...
mauwiks Posted July 21, 2020 Share Posted July 21, 2020 By the way, Man @Remitur Is there a way to add function for the Create Support Ticket? 1 Quote Link to comment Share on other sites More sharing options...
websavers Posted April 29 Share Posted April 29 On 7/20/2020 at 11:27 PM, mauwiks said: By the way, Man @Remitur Is there a way to add function for the Create Support Ticket? See our hook here: https://github.com/websavers/WHMCS-Hook-Auto-Release-Ticket-Info 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.