Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / prospect_main.html
1 <& 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 <%init>
28
29 die "access denied"
30   unless $FS::CurrentUser::CurrentUser->access_right('List prospects');
31
32 my %search_hash = ();
33
34 #$search_hash{'query'} = $cgi->keywords;
35
36 #scalars
37 my @scalars = qw (
38   agentnum 
39 );
40
41 for my $param ( @scalars ) {
42   $search_hash{$param} = scalar( $cgi->param($param) )
43     if $cgi->param($param);
44 }
45
46 #lists
47 #for my $param () {
48 #  $search_hash{$param} = [ $cgi->param($param) ];
49 #}
50
51 # parse dates
52 #foreach my $field (qw( signupdate )) {
53 #
54 #  my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
55 #
56 #  next if $beginning == 0 && $ending == 4294967295;
57 #       #or $disable{$cgi->param('status')}->{$field};
58 #
59 #  $search_hash{$field} = [ $beginning, $ending ];
60 #
61 #}
62
63 my $query = FS::prospect_main->search(\%search_hash);
64 my $count_query   = delete($query->{'count_query'});
65 #my @extra_headers = @{ delete($query->{'extra_headers'}) };
66 #my @extra_fields  = @{ delete($query->{'extra_fields'})  };
67
68 my $link = sub {
69   my $prospect_main = shift;
70   [ "${p}view/prospect_main.html?", 'prospectnum' ];
71 };
72
73 </%init>