Jump to content

LosBooom

Regular Collector
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

1 Neutral

About LosBooom

  • Rank
    Junior Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hello. When I assign an employee to a ticket through the admin ticket viewing form, to my employee comes email from Email templates > Admin messages > Support Ticket Change Notification. But when i use WHMCS API like so: $assignTicket = localAPI('UpdateTicket', [ 'ticketid' => $tickeid, 'flag' => $adminid, ]); there is no notification. 1. I regard this as an API bug. Are there any ways to fix this? 2. How can I manually send an email to only the employee to whom the ticket is assigned? It seems that SendEmail and SendAdminEmail not suitable for me.
  2. LosBooom

    Need help with hook

    Check this out: https://developers.whmcs.com/hooks-reference/ticket/#ticketopen <?php add_hook('TicketOpen', 1, function($vars) { // $vars['ticketed']; }); https://developers.whmcs.com/hooks/hook-index/
  3. LosBooom

    DailyCronJob hook

    Yes, this completely solved our problem. WHMCS Support was able to determine at what stage of the hooks there was a problem and we were able to find a module that behaved inappropriately and did break "Cron Job: Running Usage Stats Update for Server".
  4. LosBooom

    DailyCronJob hook

    The problem was in 3rd party module, which was breaking automation tasks by whmcs.
  5. LosBooom

    Bug in hook+api ?

    Hello. Can someone explain why this is happening? I have this code in includes/hooks: <?php if (!defined("WHMCS")) { die("This file cannot be accessed directly"); } add_hook('TicketOpen', 1, function($vars){ $ticketid = 111115; // use this ticket for testing $result = localAPI('AddTicketReply', [ 'ticketid' => $ticketid, 'message' => 'Text message', 'adminusername' => 'Robot admin', ]); }); ?> My idea is this: the user opens a ticket, a hook is triggered, a message from Robot Admin is sent to the test ticket. The problem is that if the user attaches files to the ticket, the robot will repeat it in my test ticket.
  6. 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?
  7. 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.
  8. 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;
  9. 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?
  10. 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?
  11. 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