Just a few Q

Ivan Kohler ivan at sisd.com
Sat Oct 17 07:18:30 PDT 1998


Hmm... ok, first you need to update the invoice stuff.  Inside sub collect
in cust_main.pm, there is:

        open(LPR,$lpr) or die "Can't open $lpr: $!";
        print LPR $cust_bill->print_text; #( date )
        close LPR
          or die $! ? "Error closing $lpr: $!"
                       : "Exit status $? from $lpr";

Which should change to something like (off the top of my head):

    if ( $self->payname =~ /\@/ ) { #email address, could use a better regex
        my($error) = $cust_bill->email_text; #( date )
        die "Email error: $error" if $error;
    } else {
        open(LPR,$lpr) or die "Can't open $lpr: $!";
        print LPR $cust_bill->print_text; #( date )
        close LPR
          or die $! ? "Error closing $lpr: $!"
                       : "Exit status $? from $lpr";
    }

You may also want to insert that later in sub collect for customers that
have `CARD' or `COMP' as their billing type

Since the above code assumes there is an email_text method for an
FS::cust_bill object, you need to write that.  Make a new subroutine in
cust_bill.pm.

You could use sub print_text as a starting point if you like, but this
code is mostly to paginate and format fixed-width ASCII for printing.  It
might be easier to just read up on the methods in cust_bill and
cust_bill_pkg and format the email, which doesn't have "pages", and for a
good chunk of users (I wonder what percentage?) isn't fixed-width. 

I'd use Mail::Mailer (see FS:Lsvc_domain for an example) instead of a pipe
to sendmail.

Hope that helps.

On Wed, 14 Oct 1998, Desk of the Technical Director wrote:

> I have most everything running like its supposed to. It's cool.
> 
> However I need to hack in the ability to send the bills via e-mail.  I
> figured that I could use the billing name as the billing e-mail address,
> since this is in the cust record, and not in a package.  Since this field
> prints on the invoice, it seems an easy hack, just move it to the top with
> a TO: (and maybe a from ;) ) and pipe it to sendmail.
> 
> I have stared at the code (bill, bill.pm,invoice.pm) for a couple of hours
> but cant seem to figure out how to re-format the output. (I already have
> it piped to a file).  a "look at these lines in this module", or a "your
> probablly looking for this" would be OK.
> 
> Better ideas??  Advice??
> 
> 

-- 
Ivan Kohler <ivan at sisd.com> - finger for PGP key
Silicon Interactive Software Design - http://www.sisd.com/ - 888-670-SISD
Open-source billing and administration for ISPs - http://www.sisd.com/freeside
20 4,16 * * * saytime # please don't be surprised if you find me dreaming too




More information about the freeside-users mailing list