1 % if ( scalar(@notes) ) {
3 <SCRIPT TYPE="text/javascript">
5 function display_notes_classnum(classnum){
6 document.getElementById('notes_'+classnum).style.display = 'block';
7 document.getElementById('notes_tablink_'+classnum).style.fontWeight = 'bold';
9 var divs = document.getElementsByTagName("div");
11 for(i=0; i < divs.length; i++){
13 if(d.id.length > 6 && d.id.substring(0,6) == 'notes_') {
14 if(divs[i].id != 'notes_'+classnum) {
15 divs[i].style.display = 'none';
20 var as = document.getElementsByTagName("a");
21 for(i=0; i < as.length; i++){
23 if(a.id.length > 14 && a.id.substring(0,14) == 'notes_tablink_') {
24 if(as[i].id != 'notes_tablink_'+classnum) {
25 as[i].style.fontWeight = 'normal';
33 <& /elements/init_overlib.html &>
35 % my $bgcolor1 = '#eeeeee';
36 % my $bgcolor2 = '#ffffff';
38 % my $last_classnum = -1;
42 % foreach my $note (@notes) {
44 % if ( $bgcolor eq $bgcolor1 ) {
45 % $bgcolor = $bgcolor2;
47 % $bgcolor = $bgcolor1;
50 % my $pop = popurl(3);
51 % my $notenum = $note->notenum;
52 % my $onclick = include( '/elements/popup_link_onclick.html',
53 % 'action' => popurl(2).
54 % 'edit/cust_main_note.cgi'.
55 % "?custnum=$custnum".
56 % ";notenum=$notenum",
57 % 'actionlabel' => emt('Edit customer note'),
59 % 'height' => 538, #575
62 % my $clickjs = qq!onclick="$onclick"!;
65 % if ($curuser->access_right('Edit customer note') ) {
66 % $edit = qq! <A HREF="javascript:void(0);" $clickjs>(!.emt('edit').')</A>';
69 % if ( $last_classnum != $note->classnum && !$skipheader ) {
70 % my $tmp_classnum = $note->classnum ? $note->classnum : 0;
71 % $classes{$tmp_classnum} = $note->classname ne '' ? $note->classname
73 % if ( $last_classnum != -1 ) {
77 % my $display = ($tmp_classnum == 0 || !$conf->exists('note-classes')
78 % || $conf->config('note-classes') < 2)
80 <DIV id="notes_<% $tmp_classnum %>"
81 style="display:<% $display %>"
83 <& /elements/table-grid.html &>
85 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
86 % if ( $conf->exists('cust_main_note-display_times') ) {
87 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Time') |h %></TH>
89 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Person') |h %></TH>
90 % if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
91 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Class') |h %></TH>
93 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Note') |h %></TH>
94 % if ($curuser->access_right('Edit customer note') ) {
95 <TH CLASS="grid" BGCOLOR="#cccccc"> </TH>
98 % $skipheader = (!$conf->exists('note-classes') || $conf->config('note-classes') < 2);
99 % $last_classnum = $note->classnum;
103 <% note_datestr($note,$conf,$bgcolor) %>
104 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
105 <% $note->usernum ? $note->access_user->name : $note->otaker %>
107 % if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
108 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
109 <% $note->classname %>
112 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
113 <% $note->comments | defang %>
116 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $edit %></TD>
120 % } #end display notes
125 % if ( $conf->exists('note-classes') && $conf->config('note-classes') == 2 ) {
126 % my($classnum,$classname);
127 <% mt('Show notes of class:') |h %>
128 % foreach my $classnum ( sort { $b <=> $a } (keys %classes) ) {
129 <A id="notes_tablink_<% $classnum %>"
130 HREF="javascript:display_notes_classnum(<% $classnum %>)"
131 style="font-weight: <% $classnum == 0 ? 'bold' : 'normal' %>"
132 ><% $classes{$classnum} %></A>
142 my $conf = new FS::Conf;
143 my $curuser = $FS::CurrentUser::CurrentUser;
147 my $custnum = $opt{'custnum'};
149 my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} );
150 die "Customer not found!" unless $cust_main;
152 my (@notes) = $cust_main->notes($conf->exists('note-classes') && $conf->config('note-classes') == 2);
157 my($note, $conf, $bgcolor) = @_ or return '';
158 my $td = qq{<TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">};
159 my $format = "$td%b %o, %Y</TD>";
160 $format .= "$td%l:%M%P</TD>"
161 if $conf->exists('cust_main_note-display_times');
162 ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;