[freeside] trying to write a report script, could use a little help

ivan at 420.am ivan at 420.am
Fri Aug 30 13:29:00 PDT 2002


On Thu, Aug 29, 2002 at 10:53:04AM -0500, Vlad Sedov wrote:
> hello - 
> 
> i'm trying to write a script that generates a report that shows a number
> of customers per agent.
> 
> i have one question - 
> 
> what would be the easiest way to find all the customers with a specific
> agentnum (stick them in an array maybe) using the FS API?...

See the FS::Record and FS::cust_main manpages.  Something not unlike:

	use FS::cust_main;

	@cust_main = qsearch( 'cust_main', { 'agentnum' => $agentnum } );


But unfortunately, that actually turns out to be pretty worthless as soon
as you have more than a handful of customers in the database.  For a
useful web report, you need to display a limited number of records on each
page.  Take a look at, say, httemplate/search/cust_bill.cgi for an example 
of that.

> all i need is a simple example. i have already started on it, but the
> API functions reference is kinda dry....
> 
> once i polish this thing out, maybe it could eventually be added to the
> distro?....

Sure, but it would have to be paged as per above.

-- 
_ivan



More information about the freeside-users mailing list