[freeside] New customer acct setup.

ivan ivan at 420.am
Sat Jan 29 22:37:48 PST 2000


On Thu, Dec 30, 1999 at 10:33:33AM -0500, Dale Hege wrote:
> 
> Where in the code does edit/cust_main.cgi check to see if there is more
> than one svc_acct in a package?

Lines 375-376:

  my @part_pkg = grep { $_->svcpart('svc_acct') && $pkgpart->{ $_->pkgpart } }
    qsearch( 'part_pkg', {} );

The actual logic is in the
  $_->svcpart('svc_acct')
bit, which is calling the svcpart method on an FS::part_pkg object.  The
man page for FS::part_pkg says:

       svcpart [ SVCDB ]
           Returns the svcpart of a single service definition
           (see the FS::part_svc manpage) associated with this
           billing item definition (see the FS::pkg_svc manpage).
           Returns false if there not exactly one service
           definition with quantity 1, or if SVCDB is specified
           and does not match the svcdb of the service
           definition,

And the code:

  sub svcpart {
    my $self = shift;
    my $svcdb = shift;
    my @pkg_svc = $self->pkg_svc;
    return '' if scalar(@pkg_svc) != 1
                 || $pkg_svc[0]->quantity != 1
                 || ( $svcdb && $pkg_svc[0]->part_svc->svcdb ne $svcdb );
    $pkg_svc[0]->svcpart;
  }


-- 
_ivan



More information about the freeside-users mailing list