Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use WHMCS\Database\Capsule;
- function getToDoID($vars) {
- return Capsule::table('tbltodolist')
- ->where('status', 'In Progress')
- ->where('title', 'Domain Pending Transfer')
- ->where('description', 'LIKE', '% ' . $vars['domain'] . '%')
- ->get();
- }
- add_hook('DomainTransferCompleted', 1, function($vars) {
- $toDoID = getToDoID($vars)
- //Loop through the ID's and set them as completed.
- foreach ($toDoID as $entry) {
- $command = 'UpdateToDoItem';
- $postData = array(
- 'itemid' => $entry->id,
- 'adminid' => '11', //Update this ID to an admin ID
- 'status' => 'Completed',
- );
- localAPI($command, $postData);
- logActivity('Clean-up To-do List: ID ' . $entry->id . ' has been set as complete as the transfer completed successfully - Domain ID: ' . $vars['domainid'] . ' - Domain: ' . $vars['domain']);
- }
- });
- add_hook('DomainTransferFailed', 1, function($vars) {
- //This hook will update to-do items for ttransfer that fails.
- $toDoID = Capsule::table('tbltodolist')
- ->where('status', 'In Progress')
- ->where('title', 'Domain Pending Transfer')
- ->where('description', 'LIKE', '% ' . $vars['domain'] . '%')
- ->get();
- foreach ($toDoID as $entry) {
- $description = Capsule::table('tbltodolist')
- ->where('id', $entry->id)
- ->value('description');
- $command = 'UpdateToDoItem';
- $postData = array(
- 'itemid' => $entry->id,
- 'adminid' => '11', //Update this ID to an admin ID
- 'status' => 'Incomplete',
- 'description' => '*FAILED* '.$description,
- );
- localAPI($command, $postData);
- logActivity('Clean-up To-do List: ID ' . $entry->id . ' has been set as incomplete as the transfer has failed - Domain ID: ' . $vars['domainid'] . ' - Domain: ' . $vars['domain']);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment