add advanced phone number search, RT#21054
[freeside.git] / httemplate / search / elements / report_svc_Common.html
1 <%doc>
2
3 Example:
4
5   <& elements/report_svc_Common.html,
6
7     #required
8     'table' => 'svc_something',
9     'title'  => 'Page title',
10
11     #optional
12     'action' => 'svc_tablename.html', #defaults to svc_tablename.html
13
14   &>
15
16 </%doc>
17 <& /elements/header.html, $title &>
18
19 <FORM ACTION="<% $opt{'action'} || $opt{'table'}. '.html' %>" METHOD="GET">
20 <INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
21 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
22
23   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
24
25     <TR>
26       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Search options') |h %></FONT></TH>
27     </TR>
28
29 % unless ( $custnum ) {
30     <& /elements/tr-select-agent.html,
31                    'curr_value'    => scalar( $cgi->param('agentnum') ),
32                    'disable_empty' => 0,
33     &>
34
35 %   # just this customer's domains?
36 %#    <& /elements/tr-select-domain.html,
37 %#                   'element_name'  => 'domsvc',
38 %#                   'curr_value'    => scalar( $cgi->param('domsvc') ),
39 %#                   'disable_empty' => 0,
40 %#    &>
41 % }
42
43     <& /elements/tr-selectmultiple-part_pkg.html &> 
44
45     <& /elements/tr-select-part_svc.html, 'svcdb'=>$svcdb &> 
46
47     <TR>
48       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
49     </TR>
50  
51     <TR>
52       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
53     </TR>
54
55 %   #"package fields" ala advanced svc_acct search?
56 %   #move to /elements/tr-select-cust_pkg-fields and use it from there if so...
57
58     <& /elements/tr-select-cust-fields.html &>
59                        
60   </TABLE>
61
62 <BR>
63 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
64
65 </FORM>
66
67 <& /elements/footer.html &>
68 <%init>
69
70 my(%opt) = @_;
71
72 my $svcdb = $opt{'table'};
73
74 my $name =        "FS::$svcdb"->table_info->{'name_plural'}
75            || PL( "FS::$svcdb"->table_info->{'name'}        );
76
77 die "access denied"
78   unless $FS::CurrentUser::CurrentUser->access_right("Services: $name: Advanced search");
79
80 my $title = $opt{'title'};
81
82 #false laziness w/report_cust_pkg.html
83 my $custnum = '';
84 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
85   $custnum = $1;
86   my $cust_main = qsearchs({
87     'table'     => 'cust_main', 
88     'hashref'   => { 'custnum' => $custnum },
89     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
90   }) or die "unknown custnum $custnum";
91   $title = mt("$title: [_1]", $cust_main->name);
92 }
93
94 </%init>