RT#6226: fckeditor for customer notes
[freeside.git] / httemplate / view / cust_main / notes.html
1 % if ( scalar(@notes) ) {
2
3   <% include('/elements/init_overlib.html') %>
4
5   <% include("/elements/table-grid.html") %>
6
7   <TR>
8     <TH CLASS="grid" BGCOLOR="#cccccc">Date</TH>
9 %   if ( $conf->exists('cust_main_note-display_times') ) {
10       <TH CLASS="grid" BGCOLOR="#cccccc">Time</TH>
11 %   }
12     <TH CLASS="grid" BGCOLOR="#cccccc">Person</TH>
13     <TH CLASS="grid" BGCOLOR="#cccccc">Note</TH>
14 %   if ($curuser->access_right('Edit customer note') ) {
15     <TH CLASS="grid" BGCOLOR="#cccccc">&nbsp;</TH>
16 %   }
17   </TR>
18
19 % my $bgcolor1 = '#eeeeee';
20 % my $bgcolor2 = '#ffffff';
21 % my $bgcolor = '';
22 %
23 % foreach my $note (@notes) {
24 %
25 %   if ( $bgcolor eq $bgcolor1 ) {
26 %     $bgcolor = $bgcolor2;
27 %   } else {
28 %     $bgcolor = $bgcolor1;
29 %   }
30 %
31 %   my $pop = popurl(3);
32 %   my $notenum = $note->notenum;
33 %   my $onclick = include( '/elements/popup_link_onclick.html',
34 %                            'action'      => popurl(2).
35 %                                             'edit/cust_main_note.cgi'.
36 %                                             "?custnum=$custnum".
37 %                                             ";notenum=$notenum",
38 %                            'actionlabel' => 'Edit customer note',
39 %                            'width'       => 616,
40 %                            'height'      => 580,
41 %                            'frame'       => 'top',
42 %                        );
43 %   my $clickjs = qq!onclick="$onclick"!;
44 %
45 %   my $edit = '';
46 %   if ($curuser->access_right('Edit customer note') ) {
47 %     $edit = qq! <A HREF="javascript:void(0);" $clickjs>(edit)</A>!;
48 %   }
49
50     <TR>
51       <% note_datestr($note,$conf,$bgcolor) %>
52       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
53         &nbsp;<% $note->otaker%>
54       </TD>
55       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
56         &nbsp;<%$note->comments%>
57       </TD>
58 % if($edit) {
59       <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $edit %></TD>
60 % }
61     </TR>
62
63 % } #end display notes
64
65 </TABLE>
66
67 % }
68 <%init>
69
70 my $conf = new FS::Conf;
71 my $curuser = $FS::CurrentUser::CurrentUser;
72
73 my(%opt) = @_;
74
75 my $custnum = $opt{'custnum'};
76
77 my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} );
78 die "Custimer not found!" unless $cust_main;
79
80 my (@notes) = $cust_main->notes();
81
82 #subroutines
83
84 sub note_datestr {
85   my($note, $conf, $bgcolor) = @_ or return '';
86   my $td = qq{<TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">};
87   my $format = "$td%b&nbsp;%o,&nbsp;%Y</TD>";
88   $format .= "$td%l:%M%P</TD>"
89     if $conf->exists('cust_main_note-display_times');
90   ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;
91   $strip;
92 }
93
94 </%init>