Jump to content

Editing invoice descripition before invoice gets generated


Sfed

Recommended Posts

I've noticed for domain transfer invoice generated adds note '1 Year/s' to end of order description.

Case is sometimes with some domain registrar domain is not being renewed for 1 year.

 

Would like to remove from invoice description that 1 year/s notification if this domain extension is used for transfer.

 

1. Client makes an order with transfer to .COM domain. Now lets say if that extension wouldn't renew domain for one year..

2. Client gets invoice for amount 0 USD. Due domain is not renewed. In description is written 'Domain Renewal example.com - 1 Year/s'.

3. Now since domain is not actually renewed, would prefer to remove that 1 Year/s from description line {if} domain name is using in this case extension .COM and order is Transfer.

 

In language file that is taken from,

$_LANG['orderyears'] = "Year/s";

 

However in

/public_html/templates/mycustomtemplate

There is no such file that would consist that line which takes from language file that description. Any ideas how to change what I'm expecting to? Whmcs support said it might be possible with action hook, but they had lack of intrest on it.

 

looked into invoicepdf.tpl aswell but nothing caught my attention that I could change there. Possibly that file is decrypted what I'm looking for.

Link to comment
Share on other sites

using a hook would probably be the better solution as you're modifying the description as it's being created...

 

you could modify invoicepdf.tpl to remove the text you specify, e.g by replacing the following in invoicepdf.tpl...

 

foreach ($invoiceitems AS $item) {
   $tblhtml .= '
   <tr bgcolor="#fff">
       <td align="left">'.nl2br($item['description']).'<!br /></td>
       <td align="center">'.$item['amount'].'</td>
   </tr>';
}

with...

 

foreach ($invoiceitems AS $item) {

unset ($moddesc);
if ((strpos($item['description'],$_LANG['domaintransfer']) !== false) && (strpos($item['description'],'.com') !== false))
{
$moddesc = str_replace("- 1 Year/s", "", $item['description']);
}

if ($moddesc)
{
   $tblhtml .= '
   <tr bgcolor="#fff">
       <td align="left">'.nl2br($moddesc).'<!br /></td>
       <td align="center">'.$item['amount'].'</td>
   </tr>';
}
else
{
   $tblhtml .= '
   <tr bgcolor="#fff">
       <td align="left">'.$item['description'].'<!br /></td>
       <td align="center">'.$item['amount'].'</td>
   </tr>';
}
}

this will work, though if you were using multiple languages, it would get more complicated by also requiring additional regex in your string replacements... if you need to check more tlds (which you probably will), then you'd either need multiple strpos statements, or perhaps use an array... and then you'd probably also need to modify viewinvoice.tpl to do the same replaces...

 

as I said, if you can get someone to write a hook, that might be a cleaner, simpler solution.

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