add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / svc_CGPRule_Mixin.pm
1 package FS::svc_CGPRule_Mixin;
2
3 use strict;
4 use FS::Record qw(qsearch);
5 use FS::cgp_rule;
6
7 =head1 NAME
8
9 FS::svc_CGPRule_Mixin - Mixin class for svc_classes which can be related to cgp_rule
10
11 =head1 SYNOPSIS
12
13 package FS::svc_table;
14 use base qw( FS::svc_CGPRule_Mixin FS::svc_Common );
15
16 =head1 DESCRIPTION
17
18 This is a mixin class for svc_ classes that can have Communigate Pro rules
19 (currently, domains and accounts).
20
21 =head1 METHODS
22
23 =over 4
24
25 =item cgp_rule
26
27 Returns the rules associated with this service, as FS::cgp_rule objects.
28
29 =cut
30
31 sub cgp_rule {
32   my $self = shift;
33   qsearch({
34     'table'    => 'cgp_rule',
35     'hashref'  => { 'svcnum' => $self->svcnum },
36     'order_by' => 'ORDER BY priority ASC',
37   });
38 }
39
40 =item cgp_rule_arrayref
41
42 Returns an arrayref of rules suitable for Communigate Pro API commands.
43
44 =cut
45
46 sub cgp_rule_arrayref {
47   my $self = shift;
48   [ map $_->arrayref, $self->cgp_rule ];
49 }
50
51 =back
52
53 =head1 BUGS
54
55 =head1 SEE ALSO
56
57 L<FS::cgp_rule>
58
59 =cut
60
61 1;