fix elements/ links here too
[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 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws.js"></SCRIPT>
26 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_iframe.js"></SCRIPT>
27 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/overlibmws_crossframe.js"></SCRIPT>
28 <SCRIPT TYPE="text/javascript" SRC="<%$fsurl%>elements/iframecontentmws.js"></SCRIPT>
29
30 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0 BORDER=0 >
31
32 %   my $bgcolor1 = '#eeeeee';
33 %   my $bgcolor2 = '#ffffff';
34 %   my $bgcolor = '';
35 %
36 %   foreach my $note (@notes) {
37 %
38 %   if ( $bgcolor eq $bgcolor1 ) {
39 %     $bgcolor = $bgcolor2;
40 %   } else {
41 %     $bgcolor = $bgcolor1;
42 %   }
43 %
44 %   my $pop = popurl(3);
45 %   my $notenum = $note->notenum;
46 %   my $clickjs = qq!onclick="overlib( OLiframeContent('${pop}edit/! .
47 %                 qq!cust_main_note.cgi?custnum=$custnum&! .
48 %                 qq!notenum=$notenum', 616, ! .
49 %                 qq!386, 'cust_main_note_popup' ), CAPTION, 'Edit customer ! .
50 %                 qq!note', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ! .
51 %                 qq!CLOSECLICK, FRAME, top); return false;"!;
52 %
53 %   my ($el, $eel);
54 %   if ($curuser->access_right('Edit customer note') ) {
55 %     $el  = qq!<A HREF="javascript:void(0);" $clickjs>!;
56 %     $eel = qq!</A>!;
57 %   }else{
58 %     $el = $eel = '';
59 %   }
60
61 <TR>
62   <% note_datestr($note,$conf,$bgcolor, $el, $eel) %>
63   <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
64     <% $el %> &nbsp;<%$note->otaker%>&nbsp; <% $eel %>
65   </TD>
66   <TD CLASS="inv" BGCOLOR="<% $bgcolor %>">
67     &nbsp;<%$note->comments%>
68   </TD>
69 </TR>
70
71 % } #end display notes
72
73 </TABLE>
74
75 % } 
76 %
77 %#subroutines
78 %
79 %sub note_datestr {
80 % my($note, $conf, $bgcolor, $el, $eel) = @_ or return '';
81 % my $format=qq{<TD class="inv" bgcolor="$bgcolor" align="left">$el<B>%b</B>$eel</TD>}.
82 %            qq{<TD class="inv" bgcolor="$bgcolor" align="right">$el<B>&nbsp;%o,</B>$eel</TD>}.
83 %            qq{<TD class="inv" bgcolor="$bgcolor" align="right">$el<B>&nbsp;%Y&nbsp;</B>$eel</TD>};
84 % $format .= qq{<TD class="inv" bgcolor="$bgcolor" ALIGN="right">$el<B>&nbsp;%l$eel</TD>}.
85 %            qq{<TD class="inv" bgcolor="$bgcolor" ALIGN="center">$el<B>:</B>$eel</TD>}.
86 %            qq{<TD class="inv" bgcolor="$bgcolor" ALIGN="left">$el<B>%M</B>$eel</TD>}.
87 %            qq{<TD class="inv" bgcolor="$bgcolor" ALIGN="left">$el<B>&nbsp;%P&nbsp;</B>$eel</TD>}
88 %     if $conf->exists('cust_main_note-display_times');
89 %   ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;
90 %   $strip;
91 % }
92 %
93