| 12345678910111213141516171819202122232425 |
- <?php
- // this hook sets the order status to accepted after the invoice is fully paid
- if (!defined("WHMCS"))
- die("This file cannot be accessed directly");
- use WHMCS\Database\Capsule;
- function get_order($invoiceid) {
- $order = Capsule::table('tblorders')->where('invoiceid', $invoiceid)->first();
- return $order->id;
- }
- add_hook('InvoicePaid', 1, function($vars) {
- $orderId = get_order($vars['invoiceid']);
- $api = localAPI('acceptorder', array('orderid' => $orderId));
- if ($api['result'] == 'success') {
- return true;
- } else {
- $errormessage .= $api['message'];
- return false;
- }
- });
- ?>
|