X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fradius_group.pm;h=8adf9231beb47d2a392410126d225eba7ece51f4;hb=7f5e32275a5a2674fd1d220cd651b222b9831476;hp=eeb291b4bb5982b49832112aac6c4c14dac602a9;hpb=4665d5af02f915679207a369222472a25e137c9d;p=freeside.git diff --git a/FS/FS/radius_group.pm b/FS/FS/radius_group.pm index eeb291b4b..8adf9231b 100644 --- a/FS/FS/radius_group.pm +++ b/FS/FS/radius_group.pm @@ -1,8 +1,9 @@ package FS::radius_group; use strict; -use base qw( FS::Record ); +use base qw( FS::o2m_Common FS::Record ); use FS::Record qw( qsearch qsearchs ); +use FS::radius_attr; =head1 NAME @@ -42,6 +43,10 @@ groupname description +=item priority + +priority - for export + =back @@ -77,7 +82,9 @@ Delete this record from the database. =cut -# the delete method can be inherited from FS::Record +# I'd delete any linked attributes here but we don't really support group +# deletion. We would also have to delete linked records from +# radius_usergroup and part_svc_column... =item replace OLD_RECORD @@ -86,7 +93,28 @@ returns the error, otherwise returns false. =cut -# the replace method can be inherited from FS::Record +# To keep these things from proliferating, we will follow the same +# export/noexport switches that radius_attr uses. If you _don't_ use +# Freeside to maintain your RADIUS group attributes, then it probably +# shouldn't try to rename groups either. + +sub replace { + my ($self, $old) = @_; + $old ||= $self->replace_old; + + my $error = $self->check; + return $error if $error; + + if ( !$FS::radius_attr::noexport_hack ) { + foreach ( qsearch('part_export', {}) ) { + next if !$_->option('export_attrs',1); + $error = $_->export_group_replace($self, $old); + return $error if $error; + } + } + + $self->SUPER::replace($old); +} =item check @@ -106,6 +134,7 @@ sub check { $self->ut_numbern('groupnum') || $self->ut_text('groupname') || $self->ut_textn('description') + || $self->ut_numbern('priority') ; return $error if $error; @@ -125,6 +154,22 @@ sub long_description { : $self->groupname; } +=item radius_attr + +Returns all L objects (check and reply attributes) for +this group. + +=cut + +sub radius_attr { + my $self = shift; + qsearch({ + table => 'radius_attr', + hashref => {'groupnum' => $self->groupnum }, + order_by => 'ORDER BY attrtype, attrname', + }) +} + =back =head1 BUGS