3 %$cgi->param('custnum') =~ /^(\d+)$/
4 % or die "Illegal custnum: ". $cgi->param('custnum');
7 %$cgi->param('notenum') =~ /^(\d*)$/
8 % or die "Illegal notenum: ". $cgi->param('notenum');
11 %my $otaker = $FS::CurrentUser::CurrentUser->name;
12 %$otaker = $FS::CurrentUser::CurrentUser->username
13 % if ($otaker eq "User, Legacy");
15 %my $new = new FS::cust_main_note ( {
16 % notenum => $notenum,
17 % custnum => $custnum,
20 % comments => $cgi->param('comment'),
25 % my $old = qsearchs('cust_main_note', { 'notenum' => $notenum });
26 % $error = "No such note: $notenum" unless $old;
28 % map { $new->$_($old->$_) } ('_date', 'otaker');
29 % $error = $new->replace($old);
32 % $error = $new->insert;
36 % $cgi->param('error', $error);
37 % print $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string );
41 <% header('Note ' . ($notenum ? 'updated' : 'added') ) %>
42 <SCRIPT TYPE="text/javascript">
43 parent.cust_main_notes.location.reload();
44 try{parent.cust_main_notes.cClick()}