Jump to content

I need When Accept a Domain Order Need set NextDueDate to Expired date = same date 


Recommended Posts

I need When Accept a Domain Order Need set Next Due Date to Expired date = same date 

I make a Hook not working 

<?php

use WHMCS\Database\Capsule;

// Define the hook function
function setDomainExpiryDate($params)
{
    // Check if the service is a domain
    if ($params['params']['domainid']) {
        $domainId = $params['params']['domainid'];

        // Retrieve the Next Due Date for the domain
        $domainData = Capsule::table('tbldomains')
            ->where('id', $domainId)
            ->first();

        if ($domainData) {
            $nextDueDate = $domainData->nextduedate;

            // Update the Expiry Date to match the Next Due Date
            Capsule::table('tbldomains')
                ->where('id', $domainId)
                ->update([
                    'expirydate' => $nextDueDate,
                ]);
        }
    }
}

// Register the hook with WHMCS
add_hook('AfterModuleCreate', 1, 'setDomainExpiryDate');

?>

 

Link to comment
Share on other sites

5 hours ago, DennisHermannsen said:

I need Manully Accept order and my registrar API have not more date 

SO Can help me to When I accept order and Order invoice status paid then all domain from the order/invoice will  be set the order date to domain expired date 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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