Jump to content

LosBooom

Members
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

1 Neutral

About LosBooom

  • Rank
    Junior Member
  1. LosBooom

    DailyCronJob hook

    I found out that its floating error. 2 days ago DailyCronJob hook was triggered normally, but today it wasn't. Most likely some script that works on this hook is broken. How can I identify a weak spot in the system?
  2. Hello. I think that in some updates DailyCronJob hook was broken. I have some modules and scripts which use DailyCronJob hook and some of scripts stop working. I added this code to my hooks will post results tomorrow. Maybe there are more options how to find and fix the problem? Thank you.
  3. So i managed it myself. If anyone in future will need something similar to this: there is my solution: <?php $whmcsRoot = realpath(dirname(__FILE__)."/../").DIRECTORY_SEPARATOR; require_once($whmcsRoot."init.php"); $today = date('Y-m-d'); $unpaid_invoices = localAPI('GetInvoices', array( 'status' => 'Unpaid', 'limitnum' => 5000, 'orderby' => 'duedate', )); $unpaid_invoices_result = $unpaid_invoices['result']; // get array of all unpaid invoices if ($unpaid_invoices_result == 'success') { foreach ($unpaid_invoices['invoices']['invoice'] as $invoice) { $invoice_id = $invoice['id']; $invoice_total = $invoice['total']; // last day of payment invoice if ($invoice['duedate'] == $today) { // try to pay invoice from user balance $apply_invoice = localAPI('ApplyCredit', array( 'invoiceid' => $invoice_id, 'amount' => $invoice_total, )); if ($apply_invoice['result'] == 'success') { $apply_invoice_id = $apply_invoice['invoiceid']; logActivity("Automatic Invoice Closure: Invoice automatically $apply_invoice_id paid"); } else { $error_msg = $apply_invoice['message']; logActivity("Automatic Invoice Closure: ERROR: $invoice_id: $error_msg"); } } } } else { logActivity("Automatic Invoice Closure: ERROR: $unpaid_invoices_result"); } exit;
  4. So my idea: Go through the list of all unpaid invoice whose duedate = today. The code: $ command = 'GetInvoices'; $ postData = array ( 'status' => 'Unpaid', 'limitnum' => 25, ‘duedate’ => $ today; 'orderby' => 'invoicenumber', ); $ results = localAPI ($ command, $ postData); if ($ results ['result'] == 'success') { $ total_unpaid_invoices = $ results ['totalresults']; echo "Total number of unpaid invoices". $ total_unpaid_invoices. "<br>"; foreach ($ results ['invoices'] ['invoice'] as $ invoice) { echo $ invoice ['userid']; echo $ invoice ['duedate']; echo $ invoice ['total']; } } Is there an api call to automatically pay invoice and debit from the user's balance or do I need to write my own code?
  5. Hello. Is it possible to automatically repay invoice on the last day of the service, if there are funds on the account? Customers complain about this situation: invoice to pay for the service comes on the 15th. The client does not have funds on the balance, therefore, automatic payment does not work. Before the end of the service, the client replenishes his balance but does not manually pay the bill. As a result, at the end of the month the service is suspended, although there were funds on the account. Maybe there is a standard solution, or can someone help with writing such a script?
  6. Welcome to WHMCS.Community LosBooom! We're glad you're here please take some time to familiarise yourself with the Community Rules & Guidelines and take a moment to introduce yourself to other WHMCS.Community members in the Introduce Yourself Board.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated