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