72901: OFM Freeside Note Classes [additional v3 tweaks]
[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 <P>
31   <& /elements/popup_link-cust_main.html,
32                 'label'       => emt('Add customer note'),
33                 'action'      => $p. 'edit/cust_main_note.cgi',
34                 'actionlabel' => emt('Enter customer note'),
35                 'cust_main'   => $cust_main,
36                 'width'       => 616,
37                 'height'      => 538, #575
38   &>
39 </P>
40
41 %   }
42
43 % # actually display notes
44 <& notes/notes.html, 'cust_main' => $cust_main &>
45 <BR>
46 % } # end of notes
47
48 % # Attachments
49 % # XXX at some point move all of this into notes/attachments.html
50 % if( $curuser->access_right('View attachments') ) {
51 % # List attachments
52 <& notes/attachments.html, 'cust_main' => $cust_main &>
53 % # "Attach file" link
54 % if(! $conf->config('disable_cust_attachment')
55 %  and $curuser->access_right('Add attachment')) {
56 <& /elements/popup_link-cust_main.html,
57               'label'       => emt('Attach file'),
58               'action'      => $p.'edit/cust_main_attach.cgi',
59               'actionlabel' => emt('Upload file'),
60               'cust_main'   => $cust_main,
61               'width'       => 480,
62               'height'      => 296,
63 &>
64 % }
65
66 %   if ($cgi->param('show_deleted')) {
67 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
68            ($view ? ";show=$view" : '') . '#notes' 
69            %>"><I>(<% mt('Show active attachments') |h %>)</I></A>
70 %   } elsif($curuser->access_right('View deleted attachments')) {
71 <A HREF="<% $p.'view/cust_main.cgi?custnum=' . $cust_main->custnum .
72            ($view ? ";show=$view" : '') . ';show_deleted=1#notes'
73            %>"><I>(<% mt('Show deleted attachments') |h %>)</I></A>
74 %   }
75 % }
76
77 <BR>
78 % if ( $curuser->access_right('View email logs')
79 %      and FS::cust_msg->count("custnum = $custnum")) {
80 <BR>
81 <& notes/email.html, 'cust_main' => $cust_main &>
82 <BR>
83 % }
84 <%init>
85
86 use HTML::Defang;
87
88 my $conf = new FS::Conf;
89 my $curuser = $FS::CurrentUser::CurrentUser;
90
91 my(%opt) = @_;
92
93 my $cust_main = $opt{'cust_main'};
94 my $custnum = $cust_main->custnum;
95
96 my $view =  $cgi->param('show') || $curuser->default_customer_view;
97
98 </%init>