'cust_main_note' => {
'columns' => [
- 'notenum', 'serial', '', '', '', '',
- 'custnum', 'int', '', '', '', '',
- 'classnum', 'int', 'NULL', '', '', '',
- '_date', @date_type, '', '',
- 'otaker', 'varchar', 'NULL', 32, '', '',
- 'usernum', 'int', 'NULL', '', '', '',
- 'comments', 'text', 'NULL', '', '', '',
+ 'notenum', 'serial', '', '', '', '',
+ 'custnum', 'int', '', '', '', '',
+ 'classnum', 'int', 'NULL', '', '', '',
+ '_date', @date_type, '', '',
+ 'otaker', 'varchar', 'NULL', 32, '', '',
+ 'usernum', 'int', 'NULL', '', '', '',
+ 'comments', 'text', 'NULL', '', '', '',
+ 'sticky', 'int', '', '', 0, '',
],
'primary_key' => 'notenum',
'unique' => [],
sub notes {
my($self,$orderby_classnum) = (shift,shift);
- my $orderby = "_DATE DESC";
- $orderby = "CLASSNUM ASC, $orderby" if $orderby_classnum;
+ my $orderby = "sticky DESC, _date DESC";
+ $orderby = "classnum ASC, $orderby" if $orderby_classnum;
qsearch( 'cust_main_note',
{ 'custnum' => $self->custnum },
'',
|| $self->ut_numbern('_date')
|| $self->ut_textn('otaker')
|| $self->ut_anything('comments')
+ || $self->ut_numbern('sticky')
;
return $error if $error;
<BR>
% }
-% if( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
- <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><%
- join '', split /<br \/>| /, $comment
- %></TEXTAREA>
-% }
-% else {
-<% include('/elements/htmlarea.html', 'field' => 'comment_html',
- 'curr_value' => $comment) %>
+% if ( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
+ <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><%
+ join '', split /<br \/>| /, $comment
+ %></TEXTAREA>
+% } else {
+ <& /elements/htmlarea.html, 'field' => 'comment_html',
+ 'curr_value' => $comment
+ &>
% }
-<BR><BR>
+<BR>
+
+<& /elements/checkbox.html, 'field' => 'sticky',
+ 'value' => 1,
+ 'curr_value' => $sticky,
+&>
+Sticky note<BR><BR>
+
<INPUT TYPE="submit" VALUE="<% $notenum ? emt("Apply changes") : emt("Add Note") %>">
</FORM>
my $comment;
my $notenum = '';
my $classnum;
+my $sticky = 0;
if ( $cgi->param('error') ) {
$comment = $cgi->param('comment');
$classnum = $cgi->param('classnum');
die "no such note: ". $notenum unless $note;
$comment = $note->comments;
$classnum = $note->classnum;
+ $sticky = $note->sticky;
}
$comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
_date => time,
usernum => $FS::CurrentUser::CurrentUser->usernum,
comments => $comment,
+ sticky => scalar( $cgi->param('sticky') ),
} );
my $error;
% my $bgcolor1 = '#eeeeee';
% my $bgcolor2 = '#ffffff';
+% my %sticky_color = ( '#eeeeee' => '#ffff66',
+% '#ffffff' => '#ffffb8',
+% );
+%
% my $bgcolor = '';
% my $last_classnum = -1;
% my $skipheader = 0;
% ";notenum=$notenum",
% 'actionlabel' => emt('Edit customer note'),
% 'width' => 616,
-% 'height' => 538, #575
+% 'height' => 575,
% 'frame' => 'top',
% );
% my $clickjs = qq!onclick="$onclick"!;
% $last_classnum = $note->classnum;
% }
+% my $color = $note->sticky ? $sticky_color{$bgcolor} : $bgcolor;
+
<TR>
- <% note_datestr($note,$conf,$bgcolor) %>
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <% note_datestr($note,$conf,$color) %>
+ <TD CLASS="grid" BGCOLOR="<% $color %>">
<% $note->usernum ? $note->access_user->name : $note->otaker %>
</TD>
% if ($conf->exists('note-classes') && $conf->config('note-classes') == 1) {
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD CLASS="grid" BGCOLOR="<% $color %>">
<% $note->classname %>
</TD>
% }
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD CLASS="grid" BGCOLOR="<% $color %>">
<% $note->comments | defang %>
</TD>
% if($edit) {
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $edit %></TD>
+ <TD CLASS="grid" BGCOLOR="<% $color %>"><% $edit %></TD>
% }
</TR>