[Koha-patches] [PATCH] bug 2287: use defaults when needed even if CSV has correct number of columns

MJ Ray mjr at phonecoop.coop
Thu May 21 16:27:20 CEST 2009


---
 tools/import_borrowers.pl |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl
index 9738f19..5d477ef 100755
--- a/tools/import_borrowers.pl
+++ b/tools/import_borrowers.pl
@@ -143,6 +143,12 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
             push @missing_criticals, {badparse=>1, line=>$., lineraw=>$borrowerline};
         } elsif (@columns == @columnkeys) {
             @borrower{@columnkeys} = @columns;
+            # MJR: try to fill blanks gracefully by using default values
+            foreach my $key (@criticals) {
+                if ($borrower{$key} !~ /\S/) {
+                    $borrower{$key} = $defaults{$key};
+                }
+            } 
         } else {
             # MJR: try to recover gracefully by using default values
             foreach my $key (@columnkeys) {
-- 
1.5.3.7




More information about the Koha-patches mailing list