Adding Service Types

Ivan Kohler ivan at sisd.com
Mon Oct 5 11:14:37 PDT 1998


On Fri, 2 Oct 1998 cerkit at skyfire.net wrote:

> 
> 	I've asked you before for this Ivam, however, I lost it. :)
> I figured it definetly maybe of interest to people on the list.

Yes, it will hopefully get cleaned up and make it into the programmers'
guide, which is right now just the manpages.

> "Could you please provide me with a clear means by which to add service
> types to Freeside."  
> 
> Database tables to alter, and where how, what and when to do in the
> interface, if anything.  Thanks.

Ok...

If you need to add/edit services that go into an existing table (svc_acct,
svc_domain, svc_acct_sm), the web interface should be sufficient/complete
- tell me if you don't understand anything.  I've pretty much depriciated
svc_charge and svc_wo at this point.

Now the interesting bit comes when you want to add things that don't fit
in an existing table.  Make _sure_ that it doesn't belong in svc_acct -
shell, pop, radius/SLIP/PPP all do, and so would _anything_ else with a
unique username that shouldn't conflict with those (like, for example,
/etc/aliases - type aliases).

When you make new service tables, make sure they start with 'svc_'.  There
are actually some bits of code which look for that (or will be, as soon as
s/svc_acct_pop/part_pop/;).  All of your non-UI-specific stuff goes in
site_perl/svc_somename.pm as method calls on objects of that type.  That
way UI writers have a very simple job (there is supposedly someone working
on a Java interface).  You can look at the other for examples of course.
You should support all the methods that those do even if they are stubs
(such as suspend, unsuspend, and so on) as they will get called.

All svc_* tables have svcnum as their primary key.

Don't forget to add the correct meta-data for your table to
bin/fs-setup.

Next, take a close look at part_svc - you'll need to edit this to add
the fields for your table:

tablename__columname <same type as columname plus NULL>
and
tablename__columname_flag char(1)

If you have the luxury of wiping and recreating your database, you can
just add svc_somename to this bit of fs-setup:

#make part_svc table
foreach $table (qw(
  svc_acct svc_acct_sm svc_charge svc_domain svc_wo
)) {

and part_svc will get created for you.  This is also the place where the
hook for svc_* will go when s/svc_acct_pop/part_pop/.

If you couldn't wipe and recreate your database, you will need to run
bin/dbdef-create once you are done adding/modifying tables.

For the web interface, you'll need to write (at least) 
view/svc_somename.cgi, edit/svc_somename.cgi and
edit/process/svc_somename.cgi, and perhaps also
search/process/svc_somename.cgi

Hopefully this will help or at least get you to the point where you've
broken things to the point where it is obvious what I forgot to tell you.

Oh, and backup your data before you do anything.  ;>>

Finally, if you've gotten this far, you may actually be interested in
doing this.  Please announce your intentions here on the list so we don't
have two people (for example) working on the same service.  Also,
fs-current has been pretty much unchanged since Sep. 24 or so, and will
remain so for the next week-ish, at which time I hope to have CVS setup to
help everybody coordinate.  Sorry it is taking so long.

> cerkit-------  --- -   + -- --  : --   '    \   / ------- -  +   +   
> "The difference between the internet and a cactus plant is that the
> cactus has the pricks on the outside."
> -------  --- -   + -- --  : --   '    \   / ------- -  + at skyfire.net
> 			  ` icq 12416036 /		

-- 
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