1 package FS::svc_Parent_Mixin;
5 use FS::Record qw(qsearch qsearchs);
10 FS::svc_Parent_Mixin - Mixin class for svc_ classes with a parent_svcnum field
14 package FS::svc_table;
16 @ISA = qw( FS::svc_Parent_Mixin FS::svc_Common );
20 This is a mixin class for svc_ classes that contain a parent_svcnum field.
30 Returns the parent FS::cust_svc object.
36 qsearchs('cust_svc', { 'svcnum' => $self->parent_svcnum } );
41 Returns the corresponding parent FS::svc_ object.
47 $self->parent_cust_svc->svc_x;
50 =item children_cust_svc
52 Returns a list of any child FS::cust_svc objects.
54 Note: This is not recursive; it only returns direct children.
58 sub children_cust_svc {
60 qsearch('cust_svc', { 'parent_svcnum' => $self->svcnum } );
65 Returns the corresponding list of child FS::svc_ objects.
71 map { $_->svc_x } $self->children_cust_svc;
76 This class provides a check subroutine which takes care of checking the
77 parent_svcnum field. The svc_ class which uses it will call SUPER::check at
78 the end of its own checks, and this class will call NEXT::check to pass
79 the check "up the chain" (see L<NEXT>).
86 $self->ut_foreign_keyn('parent_svcnum', 'cust_svc', 'svcnum')
87 || $self->NEXT::check;
95 Do we need a recursive child finder for multi-layered children?
99 L<FS::svc_Common>, L<FS::Record>