X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fnotes%2Fnotes.html;h=f998ba4c01882d82a0f8d37548a1e267dba44ad3;hb=f675734f1eda5b39f891a6fc8f2f29cbd2e36c35;hp=6a7a06a025b1bfc4dc2b83a7a223daa206a3c5d9;hpb=c16ef0145a0049c3f20377e2c5076087e999cde0;p=freeside.git diff --git a/httemplate/view/cust_main/notes/notes.html b/httemplate/view/cust_main/notes/notes.html index 6a7a06a02..f998ba4c0 100644 --- a/httemplate/view/cust_main/notes/notes.html +++ b/httemplate/view/cust_main/notes/notes.html @@ -1,51 +1,65 @@ % if ( scalar(@notes) ) { - <& /elements/init_overlib.html &> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% 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 ( $use_class_tabs ) { +<% 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 ($use_classes) { + <% 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; @@ -56,7 +70,7 @@ % ";notenum=$notenum", % 'actionlabel' => emt('Edit customer note'), % 'width' => 616, -% 'height' => 538, #575 +% 'height' => 575, % 'frame' => 'top', % ); % my $clickjs = qq!onclick="$onclick"!; @@ -70,75 +84,35 @@ % '('.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; -% } + > - - <% note_datestr($note,$conf,$bgcolor) %> - + <% note_datestr($note,$conf) %> +  <% $note->usernum ? $note->access_user->name : $note->otaker %> -% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) { - +% if ($use_classes) { + <% $note->classname %> -% } - +% } + <% $note->comments | defang %> -% if($edit) { - <% $edit %> -% } +% if ($edit) { + <% $edit %> +% } +% } #end foreach note -% } #end display notes - +% if (@notes) { -
-% 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} %> -% } -
+ +% } else { +

<% emt('No notes for this customer') %>

% } -% } <%init> use HTML::Defang; @@ -151,13 +125,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 (@notes) = $cust_main->notes(); + +my %classes = map { ($_->classnum || 0) => ( $_->classname ne '' ? $_->classname : '('.emt('unclassified').')' ) } @notes; +my $use_classes = grep { $_ > 0 } keys %classes; # show class column +my $use_class_tabs = (keys %classes > 1) ? 1 : 0; # use class tabs +$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');