Jump to content

Date paid bug


Go to solution Solved by WHMCS John,

Recommended Posts

Hi. After upgrading yesterday to last version (8.9.0), all invoices are showing 00:00:00 time as datepaid column in DDBB.

Before upgrading (8.8.0), in tblinvoices table, datepaid column, was saving date + correct time, when invoice was created. After upgrading, it's writing date + 00:00:00 in all new records.

Is it a bug? We use that table for more processes, and we need that value to be correct, too, as it was until now.

Thanks.

Edited by donostiarra
Link to comment
Share on other sites

Inside WHMCS, in transaction history, also showing today's date, and 00:00 time.

But trying more today, it's happening only when I manually assign a payment to the invoice, that's when it happens. It doesn't send the confirmation email (another bug detected in another community thread, not sure if it's related), and it doesn't store the time correctly. Invoices generated with payments through Stripe save the time correctly (and sending confirmation e-mail well too).

Link to comment
Share on other sites

  • WHMCS Support Manager
  • Solution

Hi @donostiarra,

Thank you for this report. Case #CORE-19178 is open with our developers in order to have this reviewed for future releases. Once we resolve cases and push features they are available at our change log, here:

https://changelog.whmcs.com/

I apologize for the inconvenience, and appreciate your patience as we work to resolve this.

Thanks again for taking the time to report your findings.

Link to comment
Share on other sites

This is definitely a bug. Since updating no transactions appear on the dashboard graphs either, except for Refunds to Credit Balances. There needs to be an urgent bug fix relased for this to address the regression in functionality.

Link to comment
Share on other sites

For everyone having this issue, I've created the following script that checks if the time paid is equal to 00:00:00. If it is, it updates the time for the transaction.
When an invoices goes to "Paid" status, it also updates the time.

<?php
use WHMCS\Billing\Invoice;
use WHMCS\Database\Capsule;
use WHMCS\Carbon;
add_hook('AddTransaction', 1, function($vars) {
    $now = Carbon::now();
    $transactionDate = Carbon::parse($vars['date']);
    if($transactionDate->toTimeString() === '00:00:00')
    {
        $transaction = Capsule::table('tblaccounts')
        ->where('id', $vars['id'])
        ->update(
            [
                'date' => $now,
            ]);
    }
});

add_hook('InvoicePaidPreEmail', 1, function($vars) {
    $now = Carbon::now();
    $invoice = Invoice::find($vars['invoiceid']);
    if($invoice->datepaid->toTimeString() === '00:00:00')
    {
        $invoice->datepaid = $now;
        $invoice->save();
    }
});

Create a new PHP file in /includes/hooks/ and paste the contents into the new file.

Edited by DennisHermannsen
Link to comment
Share on other sites

  • 2 weeks later...

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