summaryrefslogtreecommitdiff
path: root/httemplate/search/prospect_main.html
blob: ab37b908958d030ec0d69536926447972b27eaf1 (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
63
64
65
66
67
68
69
70
71
72
73
<& elements/search.html,
             'title'         => 'Prospect Search Results',
             'name_singular' => 'prospect',
             'query'         => $query,
             'count_query'   => $count_query,
             'header'        => [ '#',
                                  'Prospect',
                                  'Contact(s)',
                                ],
             'fields'        => [ 'prospectnum',
                                  'name',
                                  sub {
                                    my $pm = shift;
                                    [ map {
                                            [ { 'data' => $_->line, }, ];
                                          }
                                          $pm->contact
                                    ];
                                  },
                                ],
             'links'         => [ '',
                                  $link,
                                  '', #link to contact edit???
                                ],
             'agent_virt'    => 1,
&>
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('List prospects');

my %search_hash = ();

#$search_hash{'query'} = $cgi->keywords;

#scalars
my @scalars = qw (
  agentnum 
);

for my $param ( @scalars ) {
  $search_hash{$param} = scalar( $cgi->param($param) )
    if $cgi->param($param);
}

#lists
#for my $param () {
#  $search_hash{$param} = [ $cgi->param($param) ];
#}

# parse dates
#foreach my $field (qw( signupdate )) {
#
#  my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
#
#  next if $beginning == 0 && $ending == 4294967295;
#       #or $disable{$cgi->param('status')}->{$field};
#
#  $search_hash{$field} = [ $beginning, $ending ];
#
#}

my $query = FS::prospect_main->search(\%search_hash);
my $count_query   = delete($query->{'count_query'});
#my @extra_headers = @{ delete($query->{'extra_headers'}) };
#my @extra_fields  = @{ delete($query->{'extra_fields'})  };

my $link = sub {
  my $prospect_main = shift;
  [ "${p}view/prospect_main.html?", 'prospectnum' ];
};

</%init>