[freeside-commits] branch FREESIDE_4_BRANCH updated. f1675daf6b326dfedf0cab80d9c9683a0db5c820

Ivan ivan at 420.am
Fri Nov 18 14:35:23 PST 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  f1675daf6b326dfedf0cab80d9c9683a0db5c820 (commit)
      from  2f8878cdc7df9966574d8e304c0513fc39c35c61 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f1675daf6b326dfedf0cab80d9c9683a0db5c820
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 18 14:35:22 2016 -0800

    notes import with class, RT#73455

diff --git a/httemplate/misc/cust_main_note-import.html b/httemplate/misc/cust_main_note-import.html
index cc1645d..003fc07 100644
--- a/httemplate/misc/cust_main_note-import.html
+++ b/httemplate/misc/cust_main_note-import.html
@@ -8,7 +8,9 @@ Import a CSV file containing customer notes records.
 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") %>
diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi
index 6625e00..945689f 100644
--- a/httemplate/misc/process/cust_main_note-import.cgi
+++ b/httemplate/misc/process/cust_main_note-import.cgi
@@ -40,7 +40,8 @@ my @uninserted = ();
 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"} }
                               );
@@ -53,12 +54,21 @@ for ( my $row = 0; exists($param->{"custnum$row"}); $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"},

-----------------------------------------------------------------------

Summary of changes:
 httemplate/misc/cust_main_note-import.html        |    4 +++-
 httemplate/misc/process/cust_main_note-import.cgi |   22 +++++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list