diff options
author | jeff <jeff> | 2010-09-24 22:07:11 +0000 |
---|---|---|
committer | jeff <jeff> | 2010-09-24 22:07:11 +0000 |
commit | f8d8c84ace077c33cb889db5013145802bb7ed70 (patch) | |
tree | 5cbf9a489b45e3fbb21e4b5f54db610cae3a7f19 /httemplate/misc | |
parent | ca6c79c8b9d29c09155485ac65dffee549bd74ee (diff) |
import to notes
Diffstat (limited to 'httemplate/misc')
-rw-r--r-- | httemplate/misc/process/cust_main_note-import.cgi | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi index ec96f2349..6625e0029 100644 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -39,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"}, |