deba956ae544d3b2d1e6ec1a2d51246052789fe1
[freeside.git] / httemplate / view / cust_main / notes.html
1 % # Customer comments
2 % if ( $cust_main->comments =~ /[^\s\n\r]/ ) {
3 <BR><% mt('Comments') |h %>
4 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
5 <TR>
6   <TD BGCOLOR="#ffffff">
7     <PRE><% encode_entities($cust_main->comments) %></PRE>
8   </TD>
9 </TR>
10 </TABLE></TABLE>
11 <BR><BR>
12 % }
13
14 % # Notes, if any
15 <A NAME="notes">
16 % my $notecount = scalar($cust_main->notes(0));
17 % if ( ! $conf->exists('cust_main-disable_notes') || $notecount) {
18
19 %   unless ( $view eq 'notes' && $cust_main->comments !~ /[^\s\n\r]/ ) {
20 <P>
21   <A NAME="cust_main_note"><FONT SIZE="+2"><% mt('Notes') |h %></FONT></A>
22 </P>
23
24 %   }
25
26 %   if ( $curuser->access_right('Add customer note') &&
27 %        ! $conf->exists('cust_main-disable_notes')
28 %      ) {
29
30   <& /elements/popup_link-cust_main.html,
31                 'label'       => emt('Add customer note'),
32                 'action'      => $p. 'edit/cust_main_note.cgi',
33                 'actionlabel' => emt('Enter customer note'),
34                 'cust_main'   => $cust_main,
35                 'width'       => 616,
36                 'height'      => 538, #575
37   &>
38
39 %   }
40 <BR>
41
42 % # actually display notes
43 <& notes/notes.html, 'cust_main' => $cust_main &>
44 <BR>
45 % } # end of notes
46
47 % # Attachments
48 % # XXX at some point move all of this into notes/attachments.html
49 % if( $curuser->access_right('View attachments') ) {
50 % # List attachments
51 <& notes/attachments.html, 'cust_main' => $cust_main &>
52 % # "Attach file" link
53 % if(! $conf->config('disable_cust_attachment')
54 %  and $curuser->access_right('Add attachment')) {
55 <& /elements/popup_link-cust_main.html,
56               'label'       => emt('Attach file'),
57               'action'      => $p.'edit/cust_main_attach.cgi',
58               'actionlabel' => emt('Upload file'),
59               'cust_main'   => $cust_main,
60               'width'       => 480,
61               'height'      => 296,
62 &>
63 % }
64
65 %   if ($cgi->param('show_deleted')) {
66 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
67            ($view ? ";show=$view" : '') . '#notes' 
68            %>"><I>(<% mt('Show active attachments') |h %>)</I></A>
69 %   } elsif($curuser->access_right('View deleted attachments')) {
70 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
71            ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
72            %>"><I>(<% mt('Show deleted attachments') |h %>)</I></A>
73 %   }
74 % }
75
76 <BR>
77 % if ( $curuser->access_right('View email logs')
78 %      and FS::cust_msg->count("custnum = $custnum")) {
79 <BR>
80 <& notes/email.html, 'cust_main' => $cust_main &>
81 <BR>
82 % }
83 <%init>
84
85 use HTML::Defang;
86
87 my $conf = new FS::Conf;
88 my $curuser = $FS::CurrentUser::CurrentUser;
89
90 my(%opt) = @_;
91
92 my $cust_main = $opt{'cust_main'};
93 my $custnum = $cust_main->custnum;
94
95 my $view =  $cgi->param('show') || $curuser->default_customer_view;
96
97 </%init>