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,
30 'field' => 'comment_html',
31 'curr_value' => $comment,
32 'config' => { toolbarStartupExpanded => Cpanel::JSON::XS::false,
40 <& /elements/checkbox.html, 'field' => 'sticky',
42 'curr_value' => $sticky,
46 <INPUT TYPE="submit" VALUE="<% $notenum ? emt("Apply changes") : emt("Add Note") %>">
54 my $conf = new FS::Conf;
60 if ( $cgi->param('error') ) {
61 $comment = $cgi->param('comment');
62 $classnum = $cgi->param('classnum');
63 } elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) {
65 die "illegal query ". $cgi->keywords unless $notenum;
66 my $note = qsearchs('cust_main_note', { 'notenum' => $notenum });
67 die "no such note: ". $notenum unless $note;
68 $comment = $note->comments;
69 $classnum = $note->classnum;
70 $sticky = $note->sticky;
73 $comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
75 $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";
78 my $action = $notenum ? 'Edit' : 'Add';
81 unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");