Community Forums

Discuss, share and get help from our community of friendly WHMCS users

Close
Login to Your Account
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,175

    Default Re: Open Invoices widget - Updated for 7.1

    if it helps, the version below is the one I have working in a v7.2beta dev, but it worked fine when it was v7.1 too...

    PHP Code:
     <?php
    //open invoices widget , rewritten for 7.1
    //courtesy of https://www.whmcs.guru
    //version 1.0.1

    use Illuminate\Database\Capsule\Manager as Capsule;
    add_hook('AdminHomeWidgets'1, function() {
        return new 
    InvoiceWidget();
    });

    /**
    * Updated invoices widget
    */
    class InvoiceWidget extends \WHMCS\Module\AbstractWidget
    {
        protected 
    $title 'Open Invoices <a href="invoices.php?status=Unpaid" class="btn btn-link btn-xs">View All &raquo;</a>';
        protected 
    $description 'An overview of Open Invoices.';
        protected 
    $weight 150;
        protected 
    $columns 1;
        protected 
    $cache false;
        protected 
    $cacheExpiry 120;
        protected 
    $requiredPermission 'View Income Totals';

        public function 
    getData()
        {
            return array();
        }

        public function 
    generateOutput($data)
        {


            foreach (
    Capsule::table('tblinvoices') ->WHERE ('status''=' 'Unpaid')->get() as $invoice) {
                
    $invowner $invoice->userid;
                
    $invid $invoice->id;
                
    $invgenerated $invoice->date;
                
    $invoicedue $invoice->duedate;
                
    $invoiceamt $invoice->total;
                
    $invoicemethod $invoice->paymentmethod;
                
    $invlink "invoices.php?action=edit&id=$invid";
                
    $userlink "clientssummary.php?userid=$invowner";
                
    $invgenerated $date fromMySQLDate($invgenerated);
                
    $invoicedue $date fromMySQLDate($invoicedue);
                
    $invoicemethod ucwords($invoicemethod);
                foreach(
    Capsule::table('tblclients')->WHERE ('id''='$invowner)->get() as $whoami)
                {
                    
    $fname $whoami->firstname;
                    
    $lname $whoami->lastname;
                    
    $cname $whoami->companyname;
                    
    $theuser "$fname $lname";
                    
    $currencyid $whoami->currency;
                }
                if (empty(
    $currencyid))
                {
                    
    //set to default currency
                    
    $currencyid '1';
                }
                foreach(
    Capsule::table('tblcurrencies')->WHERE ('id''='$currencyid)->get() as $currency)
                {
                    
    $prefix $currency->prefix;
                    
    $suffix $currency->suffix;

                }

                
    $theoutput  .= "
                <div class=\"row\">
                <div class=\"col-xs-1\">
                <div class=\"item\">
                <a href=\"
    $invlink\">$invid</a>
                </div>
                </div>
                <div class=\"col-sm-2\">
                <div class=\"item\">
                <a href=\"
    $userlink\">$theuser</a>
                </div>
                </div>
                <div class=\"col-xs-3\">
                <div class=\"item\">
                
    $invgenerated&nbsp;
                </div>
                </div>

                <div class=\"col-xs-3\">
                <div class=\"item\">
                
    $invoicedue&nbsp;
                </div>
                </div>

                <div class=\"col-xs-2\">
                <div class=\"item\">
                
    $prefix$invoiceamt $suffix
                </div>
                </div>

                <div class=\"col-sm-1\">
                <div class=\"item\">
                
    $invoicemethod
                </div>
                </div>

                </div>"
    ;
            }

    if (!empty(
    $theoutput)) {
     return <<<EOF
    <div class="widget-content-padded">
         
            <div class="row">
            
                <div class="col-xs-1">
                <div class="item">
                <strong>ID</strong>
                </div>
                </div>
            
                <div class="col-sm-2">
                <div class="item">
                <strong>User</strong>
                </div>
                </div>
            
                <div class="col-xs-3">
                <div class="item">
                <strong>Generated</strong>
                </div>
                </div>
            
                <div class="col-xs-3">
                <div class="item">
                <strong>Due Date</strong>
                </div>
                </div>

                <div class="col-xs-2">
                <div class="item">
                <strong>Amount</strong>
                </div>
                </div>

                <div class="col-sm-1">
                <div class="item">
                <strong>Method</strong>
                </div>
                </div>
            </div>
            
    $theoutput
    </div>
    EOF;
    }
    }
    }

  2. #17
    Join Date
    Nov 2007
    Posts
    6

    Default Re: Open Invoices widget - Updated for 7.1

    Widget is showing, but still when I try access Setup > Staff Management > Administrator Roles > ex. full administrator > edit i got

    Code:
    Catchable fatal error: Object of class Closure could not be converted to string in /home/admin/domains/domain/public_html/whmcs/admin/configadminroles.php on line 0
    when I remove widget file from server I can edit admin roles, so there is some issue with widget code I guess.

  3. #18
    Join Date
    Feb 2013
    Location
    UK
    Posts
    7,175

    Default Re: Open Invoices widget - Updated for 7.1

    hmm, it's not something i'm seeing on v7.2b - what I am seeing is that I can't disable it by changing permissions... i'm sure that worked in v7.1

    as a temporary fix, the v6 widget should still work in v7 - you'd just need to upload it and enable it for your admin role.

  4. #19
    Join Date
    May 2008
    Location
    Washington State
    Posts
    57

    Default Re: Open Invoices widget - Updated for 7.1

    WHMCS 7.2.3

    I created and uploaded OpenInvoices.php but it doesn't appear.
    Is there something more I need to do? Or is 7.2.3 not supported?

    Thanks
    ONeilOnline.com
    Performance & Quality Dedicated Servers & Virtual Private Servers

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Admin Homepage - Open Invoices Widget - Client Name Linked
    By servetas in forum Third Party Add-ons
    Replies: 0
    Last Post: 01-27-16, 10:12 AM
  2. Recurring invoices are not getting updated on whmcs
    By Ambarella in forum Using WHMCS
    Replies: 0
    Last Post: 09-18-15, 07:25 AM
  3. [Confirmed] Unpaid Invoices bar not showing up (widget)
    By autumnwalker in forum Troubleshooting Issues
    Replies: 1
    Last Post: 08-18-15, 01:44 AM
  4. [Unconfirmed] Unable to open PDF invoices. No logo appears
    By mstorman in forum Troubleshooting Issues
    Replies: 7
    Last Post: 07-21-15, 07:27 PM
  5. Unpaid invoices not updated
    By raeyo in forum Using WHMCS
    Replies: 1
    Last Post: 09-15-14, 09:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •