1 % if ( scalar(@attachments) ) {
3 <% include('/elements/init_overlib.html') %>
5 <% include("/elements/table-grid.html") %>
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>
12 <TH CLASS="grid" BGCOLOR="#cccccc">Person</TH>
13 <TH CLASS="grid" BGCOLOR="#cccccc">Filename</TH>
14 <TH CLASS="grid" BGCOLOR="#cccccc">Type</TH>
15 <TH CLASS="grid" BGCOLOR="#cccccc">Size</TH>
16 <TH CLASS="grid" BGCOLOR="#cccccc"></TH>
19 % my $bgcolor1 = '#eeeeee';
20 % my $bgcolor2 = '#ffffff';
23 % foreach my $attach ((grep { $_->disabled } @attachments),
24 % (grep { ! $_->disabled } @attachments)) {
26 % if ( $bgcolor eq $bgcolor1 ) {
27 % $bgcolor = $bgcolor2;
29 % $bgcolor = $bgcolor1;
32 % my $pop = popurl(3);
33 % my $attachnum = $attach->attachnum;
36 % if($attach->disabled) {
37 % my $onclick = include('/elements/popup_link_onclick.html',
38 % 'action' => popurl(2).
39 % 'edit/process/cust_main_attach.cgi'.
40 % "?custnum=$custnum;".
41 % "attachnum=$attachnum;".
43 % 'actionlabel' => 'Undelete attachment',
48 % my $clickjs = qq!onclick="$onclick"!;
49 % if($curuser->access_right('Edit attachment')) {
50 % $edit = qq! <A HREF="javascript:void(0);" $clickjs>(undelete)</A>!;
54 % my $onclick = include( '/elements/popup_link_onclick.html',
55 % 'action' => popurl(2).
56 % 'edit/cust_main_attach.cgi'.
57 % "?custnum=$custnum".
58 % ";attachnum=$attachnum",
59 % 'actionlabel' => 'Edit customer note',
64 % my $clickjs = qq!onclick="$onclick"!;
66 % if ($curuser->access_right('Edit attachment') ) {
67 % $edit = qq! <A HREF="javascript:void(0);" $clickjs>(edit)</A>!;
69 % if ($curuser->access_right('Download attachment') ) {
70 % $download = qq! <A HREF="!.popurl(1).'attachment.html?'.$attachnum.qq!">(download)</A>!;
75 <% note_datestr($attach,$conf,$bgcolor) %>
76 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
77 <% $attach->otaker%>
79 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
80 <% $attach->filename %>
82 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
83 <% $attach->mime_type %>
85 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
86 <% size_units( $attach->size ) %>
88 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
92 <% $attach->disabled ? '</I>' : '' %>
95 % } #end display notes
102 my $conf = new FS::Conf;
103 my $curuser = $FS::CurrentUser::CurrentUser;
107 my $custnum = $opt{'custnum'};
109 my $cust_main = qsearchs('cust_main', {'custnum' => $custnum} );
110 die "Customer not found!" unless $cust_main;
112 my (@attachments) = qsearch('cust_attachment', {'custnum' => $custnum});
117 my($note, $conf, $bgcolor) = @_ or return '';
118 my $td = qq{<TD CLASS="grid" BGCOLOR="$bgcolor" ALIGN="right">};
119 my $format = "$td%b %o, %Y</TD>";
120 $format .= "$td%l:%M%P</TD>"
121 if $conf->exists('cust_main_note-display_times');
122 ( my $strip = time2str($format, $note->_date) ) =~ s/ (\d)/$1/g;
128 return $bytes if $bytes < 1024;
129 return int($bytes / 1024)."K" if $bytes < 1048576;
130 return int($bytes / 1048576)."M";