File format is CSV, with the following field order: <i>[custnum,] last, first, notefield1, notefield2, notefield3...</i>
<BR>
The optional custnum field is identified by being numeric.
-Anything after the character sequence #! is ignored.
+Anything after the character sequence #! is ignored. If a notefield starts
+like <i>classnum|</i>, with a number followed by the pipe symbol (|), then it
+the note will be imported into that note class.
<BR><BR>
<% &ntable("#cccccc") %>
for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
if ( $param->{"custnum$row"} ) {
my $error = '';
- if ( $param->{use_comments} ) { # why? notes are sexier
+ if ( $param->{use_comments} ) { # why? notes are sexier (i think this can
+ # come out now? UI doesn't let you set it
my $cust_main = qsearchs('cust_main',
{ 'custnum' => $param->{"custnum$row"} }
);
$error = "Can't find customer " . $param->{"custnum$row"};
}
} else {
+
+ my $comments = $param->{"note$row"};
+ my $classnum = '';
+ if ( $comments =~ /^\s*(\d+)\s*\|\s*(.+)$/ ) {
+ $classnum = $1;
+ $comments = $2;
+ }
+
my $cust_main_note = new FS::cust_main_note {
- 'custnum' => $param->{"custnum$row"},
- '_date' => $date,
- 'otaker' => $otaker,
- 'comments' => $param->{"note$row"},
- };
+ 'custnum' => $param->{"custnum$row"},
+ '_date' => $date,
+ 'otaker' => $otaker,
+ 'comments' => $comments,
+ 'classnum' => $classnum,
+ };
$error = $cust_main_note->insert unless ($op eq "Preview");
}
my $result = { 'custnum' => $param->{"custnum$row"},