1 <% include("/elements/header.html", "Batch Customer Note Import $op") %>
3 The following items <% $op eq 'Preview' ? 'would not be' : 'were not' %> imported. (See below for imported items)
5 % foreach my $row (@uninserted) {
6 % $csv->combine( (map{ $row->{$_} } qw(last first note) ),
7 % $row->{error} ? ('#!', $row->{error}) : (),
13 The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See above for unimported items)
16 % foreach my $row (@inserted) {
17 % $csv->combine( (map{ $row->{$_} } qw(custnum last first note) ),
18 % ('#!', $row->{name}),
26 my $otaker = $FS::CurrentUser::CurrentUser->username;
27 my $csv = new Text::CSV_XS;
29 my $param = $cgi->Vars;
31 my $op = $param->{preview} ? "Preview" : "Results";
35 for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) {
36 if ( $param->{"custnum$row"} ) {
37 my $cust_main_note = new FS::cust_main_note {
38 'custnum' => $param->{"custnum$row"},
41 'comments' => $param->{"note$row"},
44 $error = $cust_main_note->insert unless ($op eq "Preview");
45 my $result = { 'custnum' => $param->{"custnum$row"},
46 'last' => $param->{"last$row"},
47 'first' => $param->{"first$row"},
48 'note' => $param->{"note$row"},
49 'name' => $param->{"name$row"},
53 push @uninserted, $result;
55 push @inserted, $result;
58 push @uninserted, { 'custnum' => '',
59 'last' => $param->{"last$row"},
60 'first' => $param->{"first$row"},
61 'note' => $param->{"note$row"},