RT#8224: allow user to disable HTML editor
[freeside.git] / httemplate / edit / process / cust_main_note.cgi
index 9689ca6..5ba8b60 100755 (executable)
@@ -2,17 +2,11 @@
 %  $cgi->param('error', $error);
 <% $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string ) %>
 %} else {
-%    
 <% header('Note ' . ($notenum ? 'updated' : 'added') ) %>
     <SCRIPT TYPE="text/javascript">
-      parent.cust_main_notes.location.reload();
-      try{parent.cust_main_notes.cClick()}
-      catch(err){}
-      try{parent.cClick()}
-      catch(err){}
+      window.top.location.reload();
     </SCRIPT>
     </BODY></HTML>
-%
 % }
 <%init>
 
@@ -24,6 +18,11 @@ $cgi->param('notenum') =~ /^(\d*)$/
   or die "Illegal notenum: ". $cgi->param('notenum');
 my $notenum = $1;
 
+my $comment = $cgi->param('comment_html') || 
+              join("<br />\n", 
+                split "(?:\r|\n)+", $cgi->param('comment_plain')
+              );
+
 my $otaker = $FS::CurrentUser::CurrentUser->name;
 $otaker = $FS::CurrentUser::CurrentUser->username
   if ($otaker eq "User, Legacy");
@@ -33,7 +32,7 @@ my $new = new FS::cust_main_note ( {
   custnum  => $custnum,
   _date    => time,
   otaker   => $otaker,
-  comments =>  $cgi->param('comment'),
+  comments => $comment,
 } );
 
 my $error;