Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/25/19 in all areas

  1. I simply can't comprehend why WHMCS doesn't do this automatically. Dealing with multiple transfers each day, the To Do list becomes cluttered really fast. The following hook will execute on 'DomainTransferCompleted', look for Pending Domain Transfers that are In Progress containing the domain name and set all of them to Completed (in case there are multiple entries). <?php use WHMCS\Database\Capsule; add_hook('DomainTransferCompleted', 1, function($vars) { //This hook will complete to do items for transfers when the transfer is completed. $toDoID = Capsule::table('tbltodolist') ->where('status', 'In Progress') ->where('title', 'Domain Pending Transfer') ->where('description', 'LIKE', '% ' . $vars["domain"] . ' %') ->get(); //Loop through the ID's and set them as completed. foreach ($toDoID as $entry) { $command = 'UpdateToDoItem'; $postData = array( 'itemid' => $entry->id, 'adminid' => '1', 'status' => 'Completed', ); $results = localAPI($command, $postData); print_r($results); } }); Place the file in /includes/hooks/. UpdateToDo.php
    1 point
  2. You might have noticed that while exporting client list (to import in Mailchimp or any other email marketing tool you might be using), there is no way to filter the client list on the basis of their "Email Optout Status" as there is no filter for this service. As the report php files are not encoded, you can always modify them to suit your needs. Here, I have modified the file `/modules/reports/clients.php` to add the Email Opt Out filter so you can export only the clients who have opted in for marketing emails. To do this, just copy the clients.php file and rename it to something like "clients-marketing.php". Then edit the following code on line 8 : $filterfields = array("id"=>"ID","firstname"=>"First Name","lastname"=>"Last Name","companyname"=>"Company Name","email"=>"Email","address1"=>"Address 1","address2"=>"Address 2","city"=>"City","state"=>"State","postcode"=>"Postcode","country"=>"Country","phonenumber"=>"Phone Number","currency"=>"Currency","groupid"=>"Client Group ID","credit"=>"Credit","datecreated"=>"Creation Date","notes"=>"Notes","status"=>"Status"); to $filterfields = array("id"=>"ID","firstname"=>"First Name","lastname"=>"Last Name","companyname"=>"Company Name","email"=>"Email","address1"=>"Address 1","address2"=>"Address 2","city"=>"City","state"=>"State","postcode"=>"Postcode","country"=>"Country","phonenumber"=>"Phone Number","currency"=>"Currency","groupid"=>"Client Group ID","credit"=>"Credit","datecreated"=>"Creation Date","notes"=>"Notes","status"=>"Status","emailoptout"=>"Email Optout"); That is it. Do not forget to update the report title (on line 6) to a title of your liking. Once the changes are saved, you will see a new report on the Reports page with the title you selected on line 6. Hope it helps. If required, feel free to customize it as you need.
    1 point
  3. For those concerned, this is how we fixed the error. Older WHMCS custom merchant gateway module documentation suggested that module should implement one of functions: modulename_3dsecure() or modulename_capture(), depending on which one the payment gateway supports. Now, since version 7.8.2, it appears that WHMCS has been calling modulename_capture() in first place regardless of it's existance in the module code. So adding the following code to our custom module fixed the issue: function modulename_capture($params) { modulename_3dsecure($params); }
    1 point
  4. https://www.avalara.com/us/en/products/integrations/whmcs.html ... or there's a free addon in Marketplace - though i'd suggest checking that it's compatible with your WHMCS version before trying it. https://marketplace.whmcs.com/product/4821
    1 point
  5. Add as many state-based tax rules you need as described here. P.s. I could be wrong but years ago I was in the process of implementing US taxation system in WHMCS and I discovered that here were street-based tax rules. If you need that you'll need to find a third-party solution.
    1 point
  6. I've expanded this hook a bit to also cover failed transfers and log everything it does to the activity log. <?php use WHMCS\Database\Capsule; add_hook('DomainTransferCompleted', 1, function($vars) { //This hook will complete to-do items for transfers when the transfer is completed. $toDoID = Capsule::table('tbltodolist') ->where('status', 'In Progress') ->where('title', 'Domain Pending Transfer') ->where('description', 'LIKE', '% ' . $vars['domain'] . '%') ->get(); //Loop through the ID's and set them as completed. foreach ($toDoID as $entry) { $command = 'UpdateToDoItem'; $postData = array( 'itemid' => $entry->id, 'adminid' => '1', //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' => '1', //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']); } });
    1 point
  7. Made a very small typo in the first. Use this instead: <?php use WHMCS\Database\Capsule; add_hook('DomainTransferCompleted', 1, function($vars) { //This hook will complete to do items for transfers when the transfer is completed. $toDoID = Capsule::table('tbltodolist') ->where('status', 'In Progress') ->where('title', 'Domain Pending Transfer') ->where('description', 'LIKE', '% ' . $vars["domain"] . '%') ->get(); //Loop through the ID's and set them as completed. foreach ($toDoID as $entry) { $command = 'UpdateToDoItem'; $postData = array( 'itemid' => $entry->id, 'adminid' => '1', 'status' => 'Completed', ); $results = localAPI($command, $postData); } }); Remember to update 'adminid' with the actual ID of an admin. UpdateToDo.php
    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