combine ticket notification scrips, #15353
[freeside.git] / httemplate / search / prospect_main.html
1 <% include('elements/search.html',
2              'title'         => 'Prospect Search Results',
3              'name_singular' => 'prospect',
4              'query'         => $query,
5              'count_query'   => $count_query,
6              'header'        => [ '#',
7                                   'Prospect',
8                                   'Contact(s)',
9                                 ],
10              'fields'        => [ 'prospectnum',
11                                   'name',
12                                   sub {
13                                     my $pm = shift;
14                                     [ map {
15                                             [ { 'data' => $_->line, }, ];
16                                           }
17                                           $pm->contact
18                                     ];
19                                   },
20                                 ],
21              'links'         => [ '',
22                                   $link,
23                                   '', #link to contact edit???
24                                 ],
25              'agent_virt'    => 1,
26           )
27 %>
28 <%init>
29
30 die "access denied"
31   unless $FS::CurrentUser::CurrentUser->access_right('List prospects');
32
33 my %search_hash = ();
34
35 #$search_hash{'query'} = $cgi->keywords;
36
37 #scalars
38 my @scalars = qw (
39   agentnum 
40 );
41
42 for my $param ( @scalars ) {
43   $search_hash{$param} = scalar( $cgi->param($param) )
44     if $cgi->param($param);
45 }
46
47 #lists
48 #for my $param () {
49 #  $search_hash{$param} = [ $cgi->param($param) ];
50 #}
51
52 # parse dates
53 #foreach my $field (qw( signupdate )) {
54 #
55 #  my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
56 #
57 #  next if $beginning == 0 && $ending == 4294967295;
58 #       #or $disable{$cgi->param('status')}->{$field};
59 #
60 #  $search_hash{$field} = [ $beginning, $ending ];
61 #
62 #}
63
64 my $query = FS::prospect_main->search(\%search_hash);
65 my $count_query   = delete($query->{'count_query'});
66 #my @extra_headers = @{ delete($query->{'extra_headers'}) };
67 #my @extra_fields  = @{ delete($query->{'extra_fields'})  };
68
69 my $link = sub {
70   my $prospect_main = shift;
71   [ "${p}view/prospect_main.html?", 'prospectnum' ];
72 };
73
74 </%init>