X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fnotes%2Fnotes.html;h=f36d7d8789d521fb175a3be89346a257204b3bd1;hp=fa45a68f242f33742d5364828547b05a14444688;hb=932a41248987b59d271994a209545280ef38498e;hpb=bec799dce8edac137ad9b124629132afa94ef07c
diff --git a/httemplate/view/cust_main/notes/notes.html b/httemplate/view/cust_main/notes/notes.html
index fa45a68f2..f36d7d878 100644
--- a/httemplate/view/cust_main/notes/notes.html
+++ b/httemplate/view/cust_main/notes/notes.html
@@ -1,55 +1,81 @@
% if ( scalar(@notes) ) {
-
<& /elements/init_overlib.html &>
-% my $bgcolor1 = '#eeeeee';
-% my $bgcolor2 = '#ffffff';
-% my %sticky_color = ( '#eeeeee' => '#ffff66',
-% '#ffffff' => '#ffffb8',
-% );
-%
-% my $bgcolor = '';
-% my $last_classnum = -1;
-% my $skipheader = 0;
-% my %classes = ();
-%
-% foreach my $note (@notes) {
-%
-% if ( $bgcolor eq $bgcolor1 ) {
-% $bgcolor = $bgcolor2;
-% } else {
-% $bgcolor = $bgcolor1;
+% if ( $note_classes_conf ) {
+<% mt('Show notes of class:') |h %>
+% # list unclassified last
+% foreach my $classnum ( (grep { $_ != 0} sort { $a <=> $b } (keys %classes)), '0' ) {
+ <% $classes{$classnum} %>
+% }
+
+% }
+
+<& /elements/table-grid.html &>
+
+ <% mt('Date') |h %> |
+% if ( $conf->exists('cust_main_note-display_times') ) {
+ <% mt('Time') |h %> |
+% }
+ <% mt('Employee') |h %> |
+% if ($note_classes_conf) {
+ <% mt('Class') |h %> |
% }
+ <% mt('Note') |h %> |
+% if ($curuser->access_right('Edit customer note') ) {
+ |
+% }
+
+
+% } # end if @notes
+
+% foreach my $note (@notes) {
%
% my $pop = popurl(3);
% my $notenum = $note->notenum;
@@ -74,77 +100,32 @@
% '('.emt('delete').')';
% }
%
-% if ( $last_classnum != $note->classnum && !$skipheader ) {
-% my $tmp_classnum = $note->classnum ? $note->classnum : 0;
-% $classes{$tmp_classnum} = $note->classname ne '' ? $note->classname
-% : emt('Other');
-% if ( $last_classnum != -1 ) {
-
-
-% }
-% my $display = ($tmp_classnum == 0 || !$conf->exists('note-classes')
-% || $conf->config('note-classes') < 2)
-% ? 'block' : 'none';
-
- <& /elements/table-grid.html &>
-
- <% mt('Date') |h %> |
-% if ( $conf->exists('cust_main_note-display_times') ) {
- <% mt('Time') |h %> |
-% }
- <% mt('Person') |h %> |
-% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
- <% mt('Class') |h %> |
-% }
- <% mt('Note') |h %> |
-% if ($curuser->access_right('Edit customer note') ) {
- |
-% }
-
-% $skipheader = (!$conf->exists('note-classes') || $conf->config('note-classes') < 2);
-% $last_classnum = $note->classnum;
-% }
-
-% my $color = $note->sticky ? $sticky_color{$bgcolor} : $bgcolor;
+ >
-
- <% note_datestr($note,$conf,$color) %>
-
+ <% note_datestr($note,$conf) %>
+ |
<% $note->usernum ? $note->access_user->name : $note->otaker %>
|
-% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
-
+% if ($note_classes_conf) {
+ |
<% $note->classname %>
|
-% }
-
+% }
+ |
<% $note->comments | defang %>
|
-% if($edit) {
- <% $edit %> |
-% }
+% if ($edit) {
+ <% $edit %> |
+% }
-
-% } #end display notes
+% } #end foreach note
-
-% if ( $conf->exists('note-classes') && $conf->config('note-classes') == 2 ) {
-% my($classnum,$classname);
-<% mt('Show notes of class:') |h %>
-% foreach my $classnum ( sort { $b <=> $a } (keys %classes) ) {
- <% $classes{$classnum} %>
-% }
-
-% }
+
-% }
<%init>
use HTML::Defang;
@@ -157,13 +138,18 @@ my(%opt) = @_;
my $cust_main = $opt{'cust_main'};
my $custnum = $cust_main->custnum;
-my (@notes) = $cust_main->notes($conf->exists('note-classes') && $conf->config('note-classes') == 2);
+my $note_classes_conf = $conf->exists('note-classes') ? $conf->config('note-classes') : '';
+
+my (@notes) = $cust_main->notes();
+
+my %classes = map { ($_->classnum || 0) => ( $_->classname ne '' ? $_->classname : '('.emt('unclassified').')' ) } @notes;
+$classes{'-1'} = 'All';
#subroutines
sub note_datestr {
- my($note, $conf, $bgcolor) = @_ or return '';
- my $td = qq{};
+ my($note, $conf) = @_ or return '';
+ my $td = qq{ | };
my $format = "$td%b %o, %Y | ";
$format .= "$td%l:%M%P"
if $conf->exists('cust_main_note-display_times');