Freeside 1.2.1

Ivan Kohler ivan at sisd.com
Wed May 12 01:57:12 PDT 1999


On Mon, May 03, 1999 at 07:17:30AM -0400, John Vozza wrote:
>
> I am interested in setting up Freeside but I am unable to find an answer
> to 1 question in reviewing the documentation.
> 
> We currently have a fairly simple system that considers a "month" to be 30
> days. When a customer signs up they receive a credit for 30 days of
> service and email invoices are sent when they have 30, 15, 10, 5, 4, 3,
> 2, 1 days remaining.
> 
> This system eliminates pro-rating someone that signs up on days other then
> the first of the month and helps spread cash flow throughout the month as
> well.
> 
> Can a package be setup in Freeside that is based on days as opposed to
> months? (Pointers as to how to do it are welcome! ;)

Right now Freeside uses the `freq' field of a package definition as a
number of months.  The specific section of code you're looking for is in
FS::cust_main::bill:

        #change this bit to use Date::Manip?
        #$sdate=$cust_pkg->bill || time;
        #$sdate=$cust_pkg->bill || $time;
        $sdate = $cust_pkg->bill || $cust_pkg->setup || $time;
        my ($sec,$min,$hour,$mday,$mon,$year) =
          (localtime($sdate) )[0,1,2,3,4,5];
        $mon += $part_pkg->getfield('freq');
        until ( $mon < 12 ) { $mon -= 12; $year++; }
        $cust_pkg->setfield('bill',
          timelocal($sec,$min,$hour,$mday,$mon,$year));
        $cust_pkg_mod_flag = 1; 

..and when I went poking for this, looks like it tells us just what needs
to be done!  Hehehe... 

Date::Manip can handle cool things like "+ 1 month" (actually the current
case of /^(\d+)$/ would have to be added as a special case of "+ $1
month") and "+ 30 days" (what you need) and even "+ 5 business days" !

(yes, months range from 0 to 11.  man localtime.)

-- 
Ivan Kohler <ivan at sisd.com> - finger for PGP key - <moc.dsis at navi> Relhok Navi
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