RT#6226: fckeditor for customer notes
[freeside.git] / httemplate / edit / cust_main_note.cgi
1 <% include('/elements/header-popup.html', "$action Customer Note") %>
2
3 <% include('/elements/error.html') %>
4
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 %>">
8
9
10 <BR><BR>
11 <% include('/elements/htmlarea.html', 'field' => 'comment',
12                                       'curr_value' => $comment) %>
13 % #<TEXTAREA NAME="comment" ROWS="12" COLS="60">
14 % # <% $comment %>
15 % #</TEXTAREA>
16
17 <BR><BR>
18 <INPUT TYPE="submit" VALUE="<% $notenum ? "Apply Changes" : "Add Note" %>">
19
20 </FORM>
21 </BODY>
22 </HTML>
23
24 <%init>
25
26 my $comment;
27 my $notenum = '';
28 if ( $cgi->param('error') ) {
29   $comment     = $cgi->param('comment');
30 } elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) {
31   $notenum = $1;
32   die "illegal query ". $cgi->keywords unless $notenum;
33   my $note = qsearchs('cust_main_note', { 'notenum' => $notenum });
34   die "no such note: ". $notenum unless $note;
35   $comment = $note->comments;
36 }
37
38 $comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
39
40 $cgi->param('custnum') =~ /^(\d+)$/ or die "illeagl custnum";
41 my $custnum = $1;
42
43 my $action = $notenum ? 'Edit' : 'Add';
44
45 die "access denied"
46   unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");
47
48 </%init>
49