X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpart_tag.pm;h=b5295bed110e1e968c6f7f938cb23f0b1196f79e;hp=0229e3aaa5d02eb1f2b455195907feb4f790d7e8;hb=HEAD;hpb=130c7801e718d55c500e9f777112f51905cad060 diff --git a/FS/FS/part_tag.pm b/FS/FS/part_tag.pm index 0229e3aaa..b5295bed1 100644 --- a/FS/FS/part_tag.pm +++ b/FS/FS/part_tag.pm @@ -1,8 +1,8 @@ package FS::part_tag; +use base qw( FS::Record ); use strict; -use base qw( FS::Record ); -use FS::Record qw( qsearch qsearchs ); +use FS::Record qw( qsearch ); #qsearchs ); =head1 NAME @@ -30,22 +30,17 @@ FS::Record. The following fields are currently supported: =over 4 -=item tagnum - -primary key - -=item tagname +=item tagnum - primary key -tagname +=item tagname - tag name -=item tagdesc +=item tagdesc - description (can be longer than name) -tagdesc +=item tagcolor - HTML-style color to display this tag -=item tagcolor - -tagcolor +=item by_default - 'Y' to enable this tag on new customers +=item disabled =back @@ -111,6 +106,7 @@ sub check { || $self->ut_text('tagname') || $self->ut_textn('tagdesc') || $self->ut_textn('tagcolor') + || $self->ut_enum('by_default', [ '', 'Y' ] ) || $self->ut_enum('disabled', [ '', 'Y' ] ) ; return $error if $error; @@ -120,6 +116,21 @@ sub check { =back +=head1 CLASS METHODS + +=over 4 + +=item default_tags + +Returns the tagnums of all tags that have 'by_default' enabled. + +=cut + +sub default_tags { + my $class = shift; + map { $_->tagnum } qsearch('part_tag', { disabled => '', by_default => 'Y' }); +} + =head1 BUGS =head1 SEE ALSO