X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_forward.pm;h=91e251fa0a67710ef5f50be58868ca737efa6df1;hp=ab24d3277d8cc455d286dcead19d92b436ff9a80;hb=633c48448d9468690b7ad77eb6ff7c660a286658;hpb=6cb5c702b17b98be46adea4539e15d5f312e5be1 diff --git a/FS/FS/svc_forward.pm b/FS/FS/svc_forward.pm index ab24d3277..91e251fa0 100644 --- a/FS/FS/svc_forward.pm +++ b/FS/FS/svc_forward.pm @@ -66,8 +66,67 @@ database, see L<"insert">. =cut + +sub table_info { + { + 'name' => 'Forward', + 'name_plural' => 'Mail forwards', + 'display_weight' => 30, + 'cancel_weight' => 30, + 'fields' => { + 'srcsvc' => 'service from which mail is to be forwarded', + 'dstsvc' => 'service to which mail is to be forwarded', + 'dst' => 'someone@another.domain.com to use when dstsvc is 0', + }, + }; +} + sub table { 'svc_forward'; } +=item search_sql STRING + +Class method which returns an SQL fragment to search for the given string. + +=cut + +sub search_sql { + my( $class, $string ) = @_; + $class->search_sql_field('src', $string); +} + +=item label [ END_TIMESTAMP [ START_TIMESTAMP ] ] + +Returns a text string representing this forward. + +END_TIMESTAMP and START_TIMESTAMP can optionally be passed when dealing with +history records. + +=cut + +sub label { + my $self = shift; + my $tag = ''; + + if ( $self->srcsvc ) { + my $svc_acct = $self->srcsvc_acct(@_); + $tag = $svc_acct->email(@_); + } else { + $tag = $self->src; + } + + $tag .= ' -> '; + + if ( $self->dstsvc ) { + my $svc_acct = $self->dstsvc_acct(@_); + $tag .= $svc_acct->email(@_); + } else { + $tag .= $self->dst; + } + + $tag; +} + + =item insert [ , OPTION => VALUE ... ] Adds this mail forwarding alias to the database. If there is an error, returns