[freeside] 0$ invoices
ivan
ivan at 420.am
Tue Feb 5 00:20:43 PST 2002
On Sat, Feb 02, 2002 at 04:12:06PM -0500, Jeff Finucane wrote:
> ivan <ivan at 420.am> wrote on Fri, 1 Feb 2002 18:14:23 -0800....
>
> +----------
> | Message-ID: <20020201181422.A31134 at cleanwhisker.420.am>
> | References: <011301c1aac4$e6638bc0$2b60c818 at STEVE> <20020201200606.EB36732E47 at cmheleu.cmh.net>
> | In-Reply-To: <20020201200606.EB36732E47 at cmheleu.cmh.net>; from jeff at cmh.net on Fri, Feb 01, 2002 at 03:06:06PM -0500
> | Subject: Re: [freeside] Troubles with cust_pay_batch
> |
> | On Fri, Feb 01, 2002 at 03:06:06PM -0500, Jeff Finucane wrote:
> | >
> | > I use the cust_pay_batch table regularly and have not experienced this.
> | > Often I see $0 invoices created by freeside-bill,
> |
> | With $0 line items? That doesn't seem right. Tell me more.
> +----------
>
> Yes. With my 1.3.xpre code :/ it appears that cust_pkg records with
> related setup and recur of 0 and frequency > 0 inspire FS::cust_main::bill
> to generate correpsonding cust_bill_pkg records of zero value. If on each
> of this customer's cust_pkg record with an appropriate 'bill' value the
> related package is zero dollar and more frequent than zero, then the result
> is that FS::cust_main::bill also generates a cust_bill record with a value
> of zero.
Hmm, I think I'm okay with that. It doesn't make a lot of sense in the
case where recur is the literal string `0', but when it is a usage-based
calculation, you *do* want it to show up. You can set the frequency to
0 if you don't want recurring invoices, of course.
> I believe that zero dollar invoices are largely avoidable by ensuring that
> no package has both no cost and recurrance. I have not pursued this
> through the code, however.
>
> The collect routines appropriately ignore these as not worth attempting
> to collect (or already paid),
Yes: next unless $cust_bill->owed > 0;
> but more interesting is that the
> FS::cust_bill::print_text routine also ignores the $0 items. Instead
> printing them could be an interesting feature, and less surprising.
Hmm... I think i agree with you, but it looks like the implementation
wouldn't be trivial. FS::cust_main::bill uses a 0 setup or 0 recur to
represent a non-existant charge, and that's why FS::cust_bill::print_text
doesn't display line items with 0 setup or 0 recur. Just taking the
if ( $_->setup != 0 ) {
and
if ( $_->recur != 0 ) {
conditionals out of FS::cust_bill::print_text wouldn't have the desired
effect; that would print a large number of extraneous "0" charges. Hmm,
we'd have to come up with a way to differentiate between nonexistant
charges and $0 charges, and also make sure the solution didn't break
things badly for old data.
Hmmmmmmm.... maybe use the `0e0' notation (evaluates to zero but is true)
for $0 charges, modify FS::cust_main::bill to generate charges like that,
and change the checks in FS::cust_bill::print_text to be
if ( $_->setup ) {
and
if ( $_->recur ) {
Oh, and cust_bill_pkg.setup and cust_bill_pkg.recur would have to be
changed from decimal(10,2) to varchar() or something. Ick...
--
_ivan
More information about the freeside-users
mailing list