241918b98bd26f4c8df1fe8012d8a755d03a6edc
[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'=>$_->contact->line, }, ];
16                                           }
17                                           $pm->prospect_contact
18                                     ];
19                                   },
20                                 ],
21              'links'         => [ '',
22                                   $link,
23                                   '', #link to contact edit???
24                                 ],
25              'agent_virt'    => 1,
26              'disableable'   => 1,
27              'disabled_statuspos' => 2,
28 &>
29 <%init>
30
31 die "access denied"
32   unless $FS::CurrentUser::CurrentUser->access_right('List prospects');
33
34 my %search_hash = ();
35
36 #$search_hash{'query'} = $cgi->keywords;
37
38 #scalars
39 my @scalars = qw (
40   agentnum 
41 );
42
43 for my $param ( @scalars ) {
44   $search_hash{$param} = scalar( $cgi->param($param) )
45     if $cgi->param($param);
46 }
47
48 #lists
49 #for my $param () {
50 #  $search_hash{$param} = [ $cgi->param($param) ];
51 #}
52
53 # parse dates
54 #foreach my $field (qw( signupdate )) {
55 #
56 #  my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
57 #
58 #  next if $beginning == 0 && $ending == 4294967295;
59 #       #or $disable{$cgi->param('status')}->{$field};
60 #
61 #  $search_hash{$field} = [ $beginning, $ending ];
62 #
63 #}
64
65 my $query = FS::prospect_main->search(\%search_hash);
66 my $count_query   = delete($query->{'count_query'});
67 #my @extra_headers = @{ delete($query->{'extra_headers'}) };
68 #my @extra_fields  = @{ delete($query->{'extra_fields'})  };
69
70 my $link = sub {
71   my $prospect_main = shift;
72   [ "${p}view/prospect_main.html?", 'prospectnum' ];
73 };
74
75 </%init>