From 940401c77b8455dd47b57e06dcfedd7514c24a7c Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 23 May 2010 01:59:19 +0000 Subject: communigate pro rules, RT#7515 --- FS/FS/svc_CGPRule_Mixin.pm | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 FS/FS/svc_CGPRule_Mixin.pm (limited to 'FS/FS/svc_CGPRule_Mixin.pm') diff --git a/FS/FS/svc_CGPRule_Mixin.pm b/FS/FS/svc_CGPRule_Mixin.pm new file mode 100644 index 0000000..4501580 --- /dev/null +++ b/FS/FS/svc_CGPRule_Mixin.pm @@ -0,0 +1,61 @@ +package FS::svc_CGPRule_Mixin; + +use strict; +use FS::Record qw(qsearch); +use FS::cgp_rule; + +=head1 NAME + +FS::svc_CGPRule_Mixin - Mixin class for svc_classes which can be related to cgp_rule + +=head1 SYNOPSIS + +package FS::svc_table; +use base qw( FS::svc_CGPRule_Mixin FS::svc_Common ); + +=head1 DESCRIPTION + +This is a mixin class for svc_ classes that can have Communigate Pro rules +(currently, domains and accounts). + +=head1 METHODS + +=over 4 + +=item + +Returns the rules associated with this service, as FS::cgp_rule objects. + +=cut + +sub cgp_rule { + my $self = shift; + qsearch({ + 'table' => 'cgp_rule', + 'hashref' => { 'svcnum' => $self->svcnum }, + 'order_by' => 'ORDER BY priority ASC', + }); +} + +=item cgp_rule_arrayref + +Returns an arrayref of rules suitable for Communigate Pro API commands. + +=cut + +sub cgp_rule_arrayref { + my $self = shift; + [ map $_->arrayref, $self->cgp_rule ]; +} + +=back + +=head1 BUGS + +=head1 SEE ALSO + +L + +=cut + +1; -- cgit v1.1