2 % $cgi->param('error', $error);
3 <% $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string ) %>
5 <& /elements/popup-topreload.html, mt( 'Note '. ($notenum ? 'updated' : 'added') ) &>
9 $cgi->param('custnum') =~ /^(\d+)$/
10 or die "Illegal custnum: ". $cgi->param('custnum');
13 $cgi->param('notenum') =~ /^(\d*)$/
14 or die "Illegal notenum: ". $cgi->param('notenum');
17 $cgi->param('classnum') =~ /^(\d*)$/;
20 my $comment = $cgi->param('comment_html') ||
22 split "(?:\r|\n)+", $cgi->param('comment_plain')
25 my $new = new FS::cust_main_note ( {
28 classnum => $classnum ? $classnum : undef,
30 usernum => $FS::CurrentUser::CurrentUser->usernum,
32 sticky => scalar( $cgi->param('sticky') ),
39 unless $FS::CurrentUser::CurrentUser->access_right('Edit customer note');
41 my $old = qsearchs('cust_main_note', { 'notenum' => $notenum });
42 $error = "No such note: $notenum" unless $old;
44 map { $new->$_($old->$_) } ('_date', 'otaker');
45 $error = $new->replace($old);
51 unless $FS::CurrentUser::CurrentUser->access_right('Add customer note');
53 $error = $new->insert;