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 ($conf->exists('note-classes') && $conf->config('note-classes') > 0) {
11 <% include( '/elements/select-table.html',
12 'table' => 'cust_note_class',
13 'name_col' => 'classname',
14 'curr_value' => $classnum,
15 'empty_label' => '(none)',
16 'hashref' => { 'disabled' => '' },
21 % if ( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
22 <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><%
23 join '', split /<br \/>| /, $comment
26 <& /elements/htmlarea.html, 'field' => 'comment_html',
27 'curr_value' => $comment
33 <& /elements/checkbox.html, 'field' => 'sticky',
35 'curr_value' => $sticky,
39 <INPUT TYPE="submit" VALUE="<% $notenum ? emt("Apply changes") : emt("Add Note") %>">
47 my $conf = new FS::Conf;
53 if ( $cgi->param('error') ) {
54 $comment = $cgi->param('comment');
55 $classnum = $cgi->param('classnum');
56 } elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) {
58 die "illegal query ". $cgi->keywords unless $notenum;
59 my $note = qsearchs('cust_main_note', { 'notenum' => $notenum });
60 die "no such note: ". $notenum unless $note;
61 $comment = $note->comments;
62 $classnum = $note->classnum;
63 $sticky = $note->sticky;
66 $comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
68 $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";
71 my $action = $notenum ? 'Edit' : 'Add';
74 unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");