Jump to content

Cancel Invoice Upon Product Termination


Lawrence

Recommended Posts

Hi guys,

 

I know someone else posted a similar addon here not long ago, but I decided to cook up my own and release it.

 

Just a few notes:

- It currently only cancels invoices that have either just a hosting product, or a hosting product with a late fee. An invoice with any other services is left untouched.

- All you need to do is unzip the attached file, and upload the .php file to the includes/hooks folder to get it working.

 

Works only with v4.

Link to comment
Share on other sites

Hi guys,

 

I know someone else posted a similar addon here not long ago, but I decided to cook up my own and release it.

 

Just a few notes:

- It currently only cancels invoices that have either just a hosting product, or a hosting product with a late fee. An invoice with any other services is left untouched.

- All you need to do is unzip the attached file, and upload the .php file to the includes/hooks folder to get it working.

 

Works only with v4.

 

whats the difference to mine?

Link to comment
Share on other sites

-cannot edit above post-

 

Besides taking my idea and changing it ever so slightly just enough so you can put your own up. Your good at this aren't you Lar? First Sparkys comparison mod and now mine good thing I encode my modules the most you can steal is the idea! In my case it was a free module but it still does not give you the right to steal someones idea. You could have contacted me first about your suggestion or contacted me checking if I was ok for you to create your own mod using my idea, before just stealing it with no reference at all. You are the first to complain when someone encodes a module and its people like you that cause programmers like me to encrypt our work.

 

Lar's previous attempt at stealing someones idea:

http://forum.whmcs.com/showthread.php?t=21116

Link to comment
Share on other sites

OK then I'll report my above question to Rob who sounds like he works in an ethical way unlike Lars ;)

 

How does it work if say the invoice has two items, one of which is the one you want to cancel and the other is one you want to invoice?

 

Will it just remove the cancelled product line and adjust rather than cancel the whole invoice?

Link to comment
Share on other sites

Hi Phill,

 

If you are using my mod then if there are 2 items on the one bill it wont automatically cancel it. Instead it will list this as an error in the cron report letting you know that you will need to correct it manually (ie adjusting the invoice amount yourself to remove the cancelled product).

Link to comment
Share on other sites

lol I am unethical because I made open code that does the same thing as yours? Give me a break. If that's the case, then OpenOffice is unethical because MS Office does the same thing (but slightly differently). Linux is unethical because it is an OS, and Windows and Mac already exist.

 

As for copying Sparky's mod, our 2 mods both work differently. They achieve a similar result, but have entirely different guts.

 

In both cases, I had the idea well before either mod was released. If anything, we both copied WHMCS (who have had this feature on their Dev Tracker for ages).

 

I simply do not like dealing with encoded addons from untrusted sources. At least with my mod, it can be updated to work with new WHMCS versions if need be. With yours, the user is at your mercy and screwed if it is not updated to work with a new version of WHMCS if needed.

Link to comment
Share on other sites

Hardly a unique idea though, we've been doing this for domains 30 days after expiry (setting them to cancelled, voiding the invoice) hosting after termination and on client cancellation, and 7 days after ssl expiry for ~18 months ...

 

Exactly, and this "idea" has been on the WHMCS Dev Tracker since before either of us made an addon for it, so it's hardly my idea or Operator's.

Link to comment
Share on other sites

  • 5 weeks later...

Here is a bug fix release. It takes care of a condition where an invoice with 2 hosting accounts would be marked as Canceled if only one was actually being canceled.

 

I also added admin e-mail notifications of Successful and Failed attempts to automatically cancel an invoice. Thanks to the WHMCS guys for pointing me to the correct function to use to do this.

 

Cheers!

Link to comment
Share on other sites

  • 1 month later...
Sometimes is necessary to terminate/create account from a customer, to clean up account for example. What happen if you perform this action?

 

Unfortunately, there is no way for the addon to know what your intentions are. In your case, I would simply do the work outside of WHMCS.

Link to comment
Share on other sites

That is right. But, when running via crontab or auto-terminate accounts I think that _SESSION['admin'] is not available, so this can be used as variable to identify automatic actions or not and can fix this issue. :-)

 

Except it cannot rely on this variable. This addon is designed to work WITH the automatic termination functionality in WHMCS, which is handled by the daily cron job and doesn't have a $_SESSION variable.

 

It is intended to work with the "Terminate" button as well, to make hosts lives easier when removing accounts.

 

If you are terminating and recreating an account from within WHMCS, simply check to see if there is an Unpaid invoice for it, set it to Canceled. When you recreate the account, you can set the invoice back to Unpaid. This will cause the addon to leave it alone (as it looks only at invoices set to Unpaid).

 

I hope this helps!

Link to comment
Share on other sites

This is easy to perform when you are the only person to operate whmcs... :-) But instruct other I really think that someone will forget to do this.. Hehehe... ;-)

 

I will try to think a way to only cancel invoice when terminate action come called from cron. :-)

Link to comment
Share on other sites

This is easy to perform when you are the only person to operate whmcs... :-) But instruct other I really think that someone will forget to do this.. Hehehe... ;-)

 

I will try to think a way to only cancel invoice when terminate action come called from cron. :-)

 

If you want to hack it to do this, it is possible.

 

Simply replace this:

 

TerminateAccountInvoice_MarkCancelled($myinvoiceid, $TerminateAccountNote);
sendAdminNotification("system","Auto Invoice Cancellation - Success","Invoice $myinvoiceid was cancelled automatically. Nothing needs to be done with it.");

 

with this:

 

if($_SESSION['adminloggedinstatus'] != 'true'){
TerminateAccountInvoice_MarkCancelled($myinvoiceid, $TerminateAccountNote);
sendAdminNotification("system","Auto Invoice Cancellation - Success","Invoice $myinvoiceid was cancelled automatically. Nothing needs to be done with it.");
}

 

The code above SHOULD work, but I have not tested it (so no promises). Also, I cannot provide any support once you do this change.

Edited by Lawrence
edited to fix 2nd bit of code
Link to comment
Share on other sites

  • 4 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