1 <% include('/elements/header-popup.html', "$action Customer Note") %>
3 <% include('/elements/error.html') %>
5 <FORM ACTION="<% popurl(1) %>process/cust_main_note.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
7 <INPUT TYPE="hidden" NAME="notenum" VALUE="<% $notenum %>">
9 % if (my @noteclasses = qsearch('cust_note_class',{ 'disabled' => '' })) {
10 % my %noteclassopts = $conf->exists('cust_main_note-require_class')
11 % ? ('disable_empty' => 1)
12 % : ('empty_label' => '(unclassified)');
14 <% include( '/elements/select-table.html',
15 'table' => 'cust_note_class',
16 'records' => \@noteclasses,
17 'name_col' => 'classname',
18 'curr_value' => $classnum,
24 % if ( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
25 <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><%
26 join '', split /<br \/>| /, $comment
29 <& /elements/htmlarea.html, 'field' => 'comment_html',
30 'curr_value' => $comment
36 <& /elements/checkbox.html, 'field' => 'sticky',
38 'curr_value' => $sticky,
42 <INPUT TYPE="submit" VALUE="<% $notenum ? emt("Apply changes") : emt("Add Note") %>">
50 my $conf = new FS::Conf;
56 if ( $cgi->param('error') ) {
57 $comment = $cgi->param('comment');
58 $classnum = $cgi->param('classnum');
59 } elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) {
61 die "illegal query ". $cgi->keywords unless $notenum;
62 my $note = qsearchs('cust_main_note', { 'notenum' => $notenum });
63 die "no such note: ". $notenum unless $note;
64 $comment = $note->comments;
65 $classnum = $note->classnum;
66 $sticky = $note->sticky;
69 $comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
71 $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";
74 my $action = $notenum ? 'Edit' : 'Add';
77 unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");