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