summaryrefslogtreecommitdiff
path: root/FS/FS/UI/agent.pm
blob: ce9744a55837c066fbb0de1a3e121c87b51b993f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package FS::UI::agent;

use strict;
use vars qw ( @ISA );
use FS::UI::Base;
use FS::Record qw( qsearchs );
use FS::agent;
use FS::agent_type;

@ISA = qw ( FS::UI::Base );

sub db_table { 'agent' };

sub db_name { 'Agent' };

sub db_description { <<END;
Agents are resellers of your service. Agents may be limited to a subset of your
full offerings (via their type).
END
}

sub list_fields {
  'agentnum',
  'typenum',
#  'freq',
#  'prog',
; }

sub list_header {
  'Agent',
  'Type',
#  'Freq (n/a)',
#  'Prog (n/a)',
; }

sub db_callback { 
  'agentnum' =>
    sub {
      my ( $agentnum, $record ) = @_;
      my $agent = $record->agent;
      new FS::UI::_Link (
        'table'  => 'agent',
        'method' => 'edit',
        'arg'    => [ $agentnum ],
        'text'   => "$agentnum: $agent",
      );
    },
  'typenum' =>
    sub {
      my $typenum = shift;
      my $agent_type = qsearchs( 'agent_type', { 'typenum' => $typenum } );
      my $atype = $agent_type->atype;
      new FS::UI::_Link (
        'table'  => 'agent_type',
        'method' => 'edit',
        'arg'    => [ $typenum ],
        'text'   => "$typenum: $atype"
      );
    },
}

1;