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';
37 % my %sticky_color = ( '#eeeeee' => '#ffff66',
38 % '#ffffff' => '#ffffb8',
42 % my $last_classnum = -1;
46 % foreach my $note (@notes) {
48 % if ( $bgcolor eq $bgcolor1 ) {
49 % $bgcolor = $bgcolor2;
51 % $bgcolor = $bgcolor1;
54 % my $pop = popurl(3);
55 % my $notenum = $note->notenum;
56 % my $onclick = include( '/elements/popup_link_onclick.html',
57 % 'action' => popurl(2).
58 % 'edit/cust_main_note.cgi'.
59 % "?custnum=$custnum".
60 % ";notenum=$notenum",
61 % 'actionlabel' => emt('Edit customer note'),
66 % my $clickjs = qq!onclick="$onclick"!;
69 % if ($curuser->access_right('Edit customer note') ) {
70 % my $delete_url = $fsurl.'misc/delete-note.html?'.$notenum;
71 % $edit = qq! <A HREF="javascript:void(0);" $clickjs>(!.emt('edit').')</A>'.
72 % qq! <A HREF="$delete_url" !.
73 % qq! onclick="return confirm('Delete this note?')">!.
74 % '('.emt('delete').')</A>';
77 % if ( $last_classnum != $note->classnum && !$skipheader ) {
78 % my $tmp_classnum = $note->classnum ? $note->classnum : 0;
79 % $classes{$tmp_classnum} = $note->classname ne '' ? $note->classname
81 % if ( $last_classnum != -1 ) {
85 % my $display = ($tmp_classnum == 0 || !$conf->exists('note-classes')
86 % || $conf->config('note-classes') < 2)
88 <DIV id="notes_<% $tmp_classnum %>"
89 style="display:<% $display %>"
91 <& /elements/table-grid.html &>
94 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
95 % if ( $conf->exists('cust_main_note-display_times') ) {
96 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Time') |h %></TH>
98 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Employee') |h %></TH>
99 % if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
100 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Class') |h %></TH>
102 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Note') |h %></TH>
103 % if ($curuser->access_right('Edit customer note') ) {
104 <TH CLASS="grid" BGCOLOR="#cccccc"> </TH>
108 % $skipheader = (!$conf->exists('note-classes') || $conf->config('note-classes') < 2);
109 % $last_classnum = $note->classnum;
112 % my $color = $note->sticky ? $sticky_color{$bgcolor} : $bgcolor;
115 <% note_datestr($note,$conf,$color) %>
116 <TD CLASS="grid" BGCOLOR="<% $color %>">
117 <% $note->usernum ? $note->access_user->name : $note->otaker %>
119 % if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
120 <TD CLASS="grid" BGCOLOR="<% $color %>">
121 <% $note->classname %>
124 <TD CLASS="grid" BGCOLOR="<% $color %>">
125 <% $note->comments | defang %>
128 <TD CLASS="grid" BGCOLOR="<% $color %>"><% $edit %></TD>
132 % } #end display notes
137 % if ( $conf->exists('note-classes') && $conf->config('note-classes') == 2 ) {
138 % my($classnum,$classname);
139 <% mt('Show notes of class:') |h %>
140 % foreach my $classnum ( sort { $b <=> $a } (keys %classes) ) {
141 <A id="notes_tablink_<% $classnum %>"
142 HREF="javascript:display_notes_classnum(<% $classnum %>)"
143 style="font-weight: <% $classnum == 0 ? 'bold' : 'normal' %>"
144 ><% $classes{$classnum} %></A>
154 my $conf = new FS::Conf;
155 my $curuser = $FS::CurrentUser::CurrentUser;
159 my $cust_main = $opt{'cust_main'};
160 my $custnum = $cust_main->custnum;
162 my (@notes) = $cust_main->notes($conf->exists('note-classes') && $conf->config('note-classes') == 2);
167 my($note, $conf, $bgcolor) = @_ or return '';
168 my $td = qq{<TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">};
169 my $format = "$td%b %o, %Y</TD>";
170 $format .= "$td%l:%M%P</TD>"
171 if $conf->exists('cust_main_note-display_times');
172 ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;