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