X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fmisc%2Fprocess%2Fcust_main_note-import.cgi;h=6625e00296f1a7901a1518ffdc4079994d103bad;hb=2756019bdb10fe144debfc8d6436468a89954eb3;hp=6aa8b1d37eb2158b038de7d563a68cbcb436b45a;hpb=5e05724a635a22776f1b973f5d7e77989da4e048;p=freeside.git diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi index 6aa8b1d37..6625e0029 100644 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -26,6 +26,7 @@ The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Import'); +$FS::cust_main::import=1; # the customer records are already in the database my $date = time; my $otaker = $FS::CurrentUser::CurrentUser->username; my $csv = new Text::CSV_XS; @@ -38,25 +39,27 @@ my @inserted = (); my @uninserted = (); for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { if ( $param->{"custnum$row"} ) { -# my $cust_main_note = new FS::cust_main_note { -# 'custnum' => $param->{"custnum$row"}, -# '_date' => $date, -# 'otaker' => $otaker, -# 'comments' => $param->{"note$row"}, -# }; -# my $error = ''; -# $error = $cust_main_note->insert unless ($op eq "Preview"); - my $cust_main = qsearchs('cust_main', - { 'custnum' => $param->{"custnum$row"} } - ); - my $error; - if ($cust_main) { - $cust_main->comments - ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"}) - : $cust_main->comments($param->{"note$row"}); - $error = $cust_main->replace; - }else{ - $error = "Can't find customer " . $param->{"custnum$row"}; + my $error = ''; + if ( $param->{use_comments} ) { # why? notes are sexier + my $cust_main = qsearchs('cust_main', + { 'custnum' => $param->{"custnum$row"} } + ); + if ($cust_main) { + $cust_main->comments + ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"}) + : $cust_main->comments($param->{"note$row"}); + $error = $cust_main->replace; + }else{ + $error = "Can't find customer " . $param->{"custnum$row"}; + } + } else { + my $cust_main_note = new FS::cust_main_note { + 'custnum' => $param->{"custnum$row"}, + '_date' => $date, + 'otaker' => $otaker, + 'comments' => $param->{"note$row"}, + }; + $error = $cust_main_note->insert unless ($op eq "Preview"); } my $result = { 'custnum' => $param->{"custnum$row"}, 'last' => $param->{"last$row"},