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