This commit was generated by cvs2svn to compensate for changes in r11022,
[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 % if ($conf->exists('note-classes') && $conf->config('note-classes') > 0) {
10     Class &nbsp;
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' => '' },
17          ) %>
18     <BR>
19 % }
20
21 % if( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) {
22   <TEXTAREA NAME="comment_plain" ROWS="12" COLS="60"><% 
23   join '', split /<br \/>|&nbsp;/, $comment 
24   %></TEXTAREA>
25 % }
26 % else {
27 <% include('/elements/htmlarea.html', 'field' => 'comment_html',
28                                       'curr_value' => $comment) %>
29 % }
30
31 <BR><BR>
32 <INPUT TYPE="submit" VALUE="<% $notenum ? "Apply Changes" : "Add Note" %>">
33
34 </FORM>
35 </BODY>
36 </HTML>
37
38 <%init>
39
40 my $conf = new FS::Conf;
41
42 my $comment;
43 my $notenum = '';
44 my $classnum;
45 if ( $cgi->param('error') ) {
46   $comment     = $cgi->param('comment');
47   $classnum = $cgi->param('classnum');
48 } elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) {
49   $notenum = $1;
50   die "illegal query ". $cgi->keywords unless $notenum;
51   my $note = qsearchs('cust_main_note', { 'notenum' => $notenum });
52   die "no such note: ". $notenum unless $note;
53   $comment = $note->comments;
54   $classnum = $note->classnum;
55 }
56
57 $comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor
58
59 $cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum";
60 my $custnum = $1;
61
62 my $action = $notenum ? 'Edit' : 'Add';
63
64 die "access denied"
65   unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");
66
67 </%init>
68