Jump to content

[UNCONFIRMED] 7.1 Dashboard pending order count is inaccurate


Recommended Posts

DESCRIPTION

 

Dashboard pending orders show as 1 in the new green box in the dashboard when there are no actual pending orders. It shows correctly as 0 at the top of the page but not the green box.

 

STEPS

 

Upgrade to 7.1

 

ADDITIONAL INFORMATION

 

I was on 7.0.1 and everything was working fine. I had 0 pending orders at the time of upgrade. After upgrade to 7.1, there was 1 pending order in the green box however 0 actual pending orders.

Link to comment
Share on other sites

  • 1 month later...

Hi there

 

Ok, I had this and a kind whmcs support guy worked it out :)

 

SO I had to login to the mysql database and there was an order in there that had somehow become adrift

 

>>>>>>>

 

It appears that a client who had a pending order has been deleted directly from the WHMCS database:

 

https:// my info here then clientssummary.php?userid=297

 

So to resolve this, you would need to delete the erroneous pending order too:

 

.`tblorders` WHERE `tblorders`.`id` = 455;

 

I am not sure how the tech guy found the order but when I deleted the tblorders with id 455 it FIXED IT !

 

SO not sure how you track the order down and be careful in your DB backup first !

 

Hope this helps others, it was bugging my need it fixed tendencies lol

Link to comment
Share on other sites

  • 8 months later...

It's still inaccurate on v7.2.3

 

I have 3 open orders. Two of them are pending, the other one uses a custom status I created to show service has been scheduled. The badge widget only shows 2 pending orders. But the count in the top of the page is showing 3 pending orders correctly.

Why this difference and how to make the widget show the correct order count?

Link to comment
Share on other sites

Patty,

I can reproduce this locally in v7.2.3, so i'd be inclined to think that it's a bug within widgets/Badges.php - I think the header template is (correctly) calculating the total number of orders that have statuses marked as "include as Pending" in setup -> other -> order statuses... whereas the code within Badges.php just seems to be checking for order status = "Pending". 9_9

there's a quick temporary fix which is to use a Capsule query within Badges itself... hopefully that should give you matching totals! :idea:

<?php

namespace WHMCS\Module\Widget;

use Carbon\Carbon;
use WHMCS\Clients;
use WHMCS\Module\AbstractWidget;
use WHMCS\Module\Queue as ModuleQueue;
use WHMCS\Orders;
use Illuminate\Database\Capsule\Manager as Capsule;

/**
 * Badges Widget.
 *
 * @copyright Copyright (c) WHMCS Limited 2005-2016
 * @license http://www.whmcs.com/license/ WHMCS Eula
 */
class Badges extends AbstractWidget
{
    protected $title = 'Badges';
    protected $description = '';
    protected $columns = 3;
    protected $weight = 0;
    protected $wrapper = false;
    protected $cache = true;
    protected $cacheExpiry = 120;

    public function getData()
    {
        $clients = new Clients();
        $orders = new Orders();

        $ticketCounts = localApi('GetTicketCounts', array());

        return array(
            'pendingOrders' => $orders->getPendingCount(),
            'ticketsAwaitingReply' => $ticketCounts['awaitingReply'],
            'cancellations' => $clients->getNumberOfOpenCancellationRequests(),
            'moduleQueueCount' => ModuleQueue::incomplete()->count(),
        );
    }

    public function generateOutput($data)
    {
		
        $pendingOrders = Capsule::table('tblorders')->whereIn('status', ['Pending','Scheduled'])->count();
        $awaitingReply = (int) $data['ticketsAwaitingReply'];
        $pendingCancellations = (int) $data['cancellations'];
        $moduleQueueCount = (int) $data['moduleQueueCount'];

        return <<<EOF
<div class="row home-status-badge-row">
    <div class="col-sm-3">

        <div class="health-status-block status-badge-green clearfix">
            <div class="icon">
                <a href="orders.php">
                    <i class="fa fa-shopping-cart"></i>
                </a>
            </div>
            <div class="detail">
                <a href="orders.php?status=Pending">
                    <span class="count">{$pendingOrders}</span>
                    <span class="desc">Pending Orders</span>
                </a>
            </div>
        </div>

    </div>
    <div class="col-sm-3">

        <div class="health-status-block status-badge-pink clearfix">
            <div class="icon">
                <a href="supporttickets.php">
                    <i class="fa fa-comment"></i>
                </a>
            </div>
            <div class="detail">
                <a href="supporttickets.php">
                    <span class="count">{$awaitingReply}</span>
                    <span class="desc">Tickets Waiting</span>
                </a>
            </div>
        </div>

    </div>
    <div class="col-sm-3">

        <div class="health-status-block status-badge-orange clearfix">
            <div class="icon">
                <a href="cancelrequests.php">
                    <i class="fa fa-ban"></i>
                </a>
            </div>
            <div class="detail">
                <a href="cancelrequests.php">
                    <span class="count">{$pendingCancellations}</span>
                    <span class="desc">Pending Cancellations</span>
                </a>
            </div>
        </div>

    </div>
    <div class="col-sm-3">

        <div class="health-status-block status-badge-cyan clearfix">
            <div class="icon">
                <a href="modulequeue.php">
                    <i class="fa fa-warning"></i>
                </a>
            </div>
            <div class="detail">
                <a href="modulequeue.php">
                    <span class="count">{$moduleQueueCount}</span>
                    <span class="desc">Pending Module Actions</span>
                </a>
            </div>
        </div>

    </div>
</div>
EOF;
    }
}

I don't know if this was fixed in v7.3 (nothing seems to be mentioned in the changelog), but if not, it might be worth either @WHMCS ChrisD or @WHMCS John giving it a CORE number and marking it as a bug in either the widget or the API function that it uses.

Link to comment
Share on other sites

28 minutes ago, Patty said:

I had to add all custom status to the badge (I have 3 custom status)

aahh, I was originally going to use a primary query that would have got all the pending order statuses custom titles from tblorderstatuses, and then use that in the count query, but I didn't think it was necessary if you only had 2 - plus it's only a temporary fix until WHMCS resolve the bug. orc.gif.771ed824fd6dff3616231976f838812b.gif

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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