[freeside] Custom Import Script (custnum)

Adam Rose adamr at eaze.net
Tue May 22 06:33:18 PDT 2001



On Fri, 18 May 2001, Wes Weems wrote:

> Ok,
> 
> A little history, I work for an existing ISP using some fairly decrepid
> accounting software. We've FINALLY decided to move away from that, to
> something much better (kudos to ivan). Between my co-workers, and I, we've
> come up with a script that will insert the services (more or less what the
> import script Ivan wrote that parses up the passwd file). In addition to
> that, we've got it pulling name/address/billing info, and are ready to
> insert that into cust_main. My question is this:
> 
> I dont wanna corrupt data... and I can see custnum is a pkey, however, as
> I've noticed as per the database itself, there is no auto incrementation. I
> wanted to loop through this list inserting data into cust_main inserting
> data.

The autoincrement is done using File::CounterFile which is incremented in
ivan's source.  This is a very good idea, you can edit/create the
counterfile in DBI.datasrc and start with whatever number suits your ISP.
Ex: cust_main.custnum 
    #COUNTER-1.0
    505

> 
> I looked at Record.pm and cust_main.cgi, but as of yet, I havent seen where
> the actual sql statements are issued for that (to see how ivan accomplished
> this feat). I suspect its using a nextval statement, but as I said, I'd like
> to avoid corruption as much as possible.
> 
> THanks so much
> Wes Weems
> 
> Network Operations Engineer
> The Fix Network.
> 
> 

--Adam Rose




More information about the freeside-users mailing list