Jump to content

Add dedicated IP or hostname to the invoice.php page .


TimRef

Recommended Posts

  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

  • 1 year later...
On 1/1/2022 at 9:02 PM, andrezzz said:

Check this out :D!

<?php
/**
 *	Invoice with Primary/Dedicated IP WHMCS Hook version 1.0
 *
 *	@package     WHMCS
 *	@copyright   Andrezzz
 *	@link        https://www.andrezzz.pt
 *	@author      André Antunes <andreantunes@andrezzz.pt>
 */

if (!defined('WHMCS')) {
    exit(header('Location: https://www.andrezzz.pt'));
}

use WHMCS\Database\Capsule;

add_hook('InvoiceCreation', 1, function($vars) {
    global $_LANG;
    $invoiceItems = Capsule::table('tblinvoiceitems')->where('invoiceid', $vars['invoiceid'])->get();

    foreach ($invoiceItems as $invoiceItem) {
        if ($invoiceItem->relid === 0) return;
        
        $dedicatedIP = Capsule::table('tblhosting')->where('id', $invoiceItem->relid)->value('dedicatedip');
        if ($dedicatedIP === '') return;

        Capsule::table('tblinvoiceitems')->where('id', $invoiceItem->id)->update(array(
            'description' => $invoiceItem->description . "\n" . $_LANG['primaryIP'] . ': ' . $dedicatedIP
        ));
    }
});

It also have Language support, so that the client can understand what is that line.

It didn't work for me. Do I need to modify name of the file or inside this code?

Link to comment
Share on other sites

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