[freeside-devel] putting the balance_due value in templates

Ivan Kohler ivan at freeside.biz
Mon May 19 21:45:24 PDT 2008


On Tue, May 13, 2008 at 04:38:40AM -0400, Luke S Crawford wrote:
> 
> I'm setting up a new system using freeside 1.7.3 -
> 
> I've been trying to get the balance_due in my invoice template
> (because I'm trying to send a paypal url, and I need the amount)  
> 
> After reading up on the templating stuff, it seems that the  balance due
> isn't in scope for the template.  I have a simple diff for cust_bill.pm 
> that puts it in scope below.  Is this the correct way to do it?

Seems like it would be more reasonable to add "balance_due" to the 
%invoice_data hash that's used by T:T fill_in() rather than shoving it 
directly in the FS::cust_bill::_template package.

Also, there are two other kinds of invoices to make the variable 
available in... 99% of folks never see the plaintext invoices.  :)

If you wanted to be even MORE correct, And if you wanted to be super 
correct, you could submit a patch (diff -u) against both HEAD and 
FREESIDE_1_7_BRANCH which implemented the change.

> 
> debian64:~/freeside/FS/FS$ diff cust_bill.pm cust_bill.pm.lsc
> 1661a1662
> >   $FS::cust_bill::_template::balance_due = $self->owed + $pr_total;
> 
> 
> this works with a billing template that includes the string:
> 
> teststring{$balance_due;}endteststring  -  it now inserts the balance due
> where you would expect.
> 
> 
> I think this might be useful for many of the 'push' billing types (like
> paypal, e-gold, etc...)  

There's work that could be done to support the "push"/"third-party" 
billing types better.

-- 
_ivan


More information about the freeside-devel mailing list