[freeside] Send invoices even when balances are zero

Matthew Draper matthew at development.mindvision.com.au
Sun Feb 1 16:22:57 PST 2004


Anthony Paras wrote:
> I'm using version 1.4.1 with linkpoint.
> 
> From what I can tell, FS won't send an invoice if its balance is zero.
> 
> Has anyone else needed to get around this?  Since I'm not very familiar with
> the code, I'm was thinking of creating a separate script to email unsent
> invoices using cron.  Is there an easier way?  Thanks.

Running on HEAD, we've done this by creating a new invoice event action 
(a trivial change: http://trebex.net/freeside/custom-bill-event), and 
then setting invoice events for each relevant payby type (CARD, COMP) to 
use this action instead of the default.

For example, for CARD, after 0 seconds, we use action "custom", with 
arbitrarycode set to:
	$cust_bill->realtime_card() . $cust_bill->send();

... which is a combination of the "realtime-card" action and the "send" 
action. Set up like this, freeside will always send an invoice... if the 
card succeeds, it'll be $0, and if the card fails, it'll be for the 
amount they owe.

Caveat: As listed above, the code will concatenate the error messages 
from the two routines. I don't know what Badness this would create if 
the card succeeded, and the sending failed; I don't expect it'd be 
desirable. Easiest way to work around that'd be to set it to:
	my $a = $cust_bill->realtime_card(); $cust_bill->send(); $a;

... but that completely ignores any error from the invoice sending.

I hope this is of some assistance; I believe it should apply equally to 1.4.

Matthew



More information about the freeside-users mailing list