2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string ) %>
5 <% header('Note ' . ($notenum ? 'updated' : 'added') ) %>
6 <SCRIPT TYPE="text/javascript">
7 window.top.location.reload();
13 $cgi->param('custnum') =~ /^(\d+)$/
14 or die "Illegal custnum: ". $cgi->param('custnum');
17 $cgi->param('notenum') =~ /^(\d*)$/
18 or die "Illegal notenum: ". $cgi->param('notenum');
21 my $comment = $cgi->param('comment_html') ||
23 split "(?:\r|\n)+", $cgi->param('comment_plain')
26 my $new = new FS::cust_main_note ( {
30 usernum => $FS::CurrentUser::CurrentUser->usernum,
38 unless $FS::CurrentUser::CurrentUser->access_right('Edit customer note');
40 my $old = qsearchs('cust_main_note', { 'notenum' => $notenum });
41 $error = "No such note: $notenum" unless $old;
43 map { $new->$_($old->$_) } ('_date', 'otaker');
44 $error = $new->replace($old);
50 unless $FS::CurrentUser::CurrentUser->access_right('Add customer note');
52 $error = $new->insert;