improve display of ticket service links, #17067
[freeside.git] / rt / share / html / Ticket / Elements / AddCustomers
1 %# Copyright (c) 2004 Ivan Kohler <ivan-rt@420.am>
2 %# Copyright (c) 2008 Freeside Internet Services, Inc.
3 %# 
4 %# This work is made available to you under the terms of Version 2 of
5 %# the GNU General Public License. A copy of that license should have
6 %# been provided with this software, but in any event can be snarfed
7 %# from www.gnu.org.
8 %# 
9 %# This work is distributed in the hope that it will be useful, but
10 %# WITHOUT ANY WARRANTY; without even the implied warranty of
11 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 %# General Public License for more details.
13 <BR>
14 <%$msg%><br>
15
16 % if (@Customers or @Services) {
17
18 <br><i>(Check box to link)</i>
19 <table>
20 % foreach my $customer (@Customers) {
21 <tr>
22   <td>
23     <input type="checkbox" name="Ticket-AddCustomer-<% $customer->{'custnum'} %>" VALUE="1" <% scalar(@Customers) == 1 ? 'CHECKED' : '' %>>
24   </td>
25   <td>
26     <& .small_custview, $customer &>
27   </td>
28 </tr>
29 % }
30 %
31 % foreach my $service (@Services) {
32 <tr>
33   <td>
34     <input type="checkbox" name="Ticket-AddService-<% $service->{'svcnum'} %>" VALUE="1" <% scalar(@Services) == 1 ? 'CHECKED' : '' %>>
35   </td>
36   <td>
37     <& .small_custview, $service &>
38     <& .small_svcview,  $service &>
39   </td>
40 </tr>
41 % }
42 </table>
43
44 % }
45
46 <%once>
47 my $freeside_url = &RT::URI::freeside::FreesideURL();
48
49 </%once>
50 <%def .small_custview>
51 % my $cust = shift;
52 <A HREF="<%$freeside_url%>/view/cust_main.cgi?<% $cust->{'custnum'}%>"><% &RT::URI::freeside::small_custview($cust->{'custnum'}, &RT::URI::freeside::FreesideGetConfig, 1) |n %></A>
53 </%def>
54 <%def .small_svcview>
55 % my $svc = shift;
56 <A HREF="<%$freeside_url%>/view/cust_svc.cgi?<% $svc->{'svcnum'}%>"><B><% $svc->{'label'} %></B></A>
57 </%def>
58 <%INIT>
59 my ($msg);
60
61 my @Customers = ();
62 if ( $CustomerString ) {
63     @Customers = &RT::URI::freeside::smart_search(
64         'search'            => $CustomerString,
65         'no_fuzzy_on_exact' => ! $FS::CurrentUser::CurrentUser->option('enable_fuzzy_on_exact'),
66     );
67 }
68
69 my @Services = ();
70 if ( $ServiceString
71       and $RT::URI::freeside::IntegrationType eq 'Internal' ) {
72     @Services = RT::URI::freeside::service_search(
73         'search'  => $ServiceString,
74     );
75 }
76
77 </%INIT>
78
79 <%ARGS>
80 $CustomerString => undef
81 $ServiceString => undef
82 </%ARGS>