[LON-CAPA-cvs] cvs: loncom /metadata_database/LONCAPA lonmetadata.pm

www lon-capa-cvs@mail.lon-capa.org
Tue, 29 Nov 2005 19:56:45 -0000


www		Tue Nov 29 14:56:45 2005 EDT

  Modified files:              
    /loncom/metadata_database/LONCAPA	lonmetadata.pm 
  Log:
  Bug #4486: set fields to appropriate "empty" values if nothing is set
  
  
Index: loncom/metadata_database/LONCAPA/lonmetadata.pm
diff -u loncom/metadata_database/LONCAPA/lonmetadata.pm:1.12 loncom/metadata_database/LONCAPA/lonmetadata.pm:1.13
--- loncom/metadata_database/LONCAPA/lonmetadata.pm:1.12	Thu Mar 10 22:25:18 2005
+++ loncom/metadata_database/LONCAPA/lonmetadata.pm	Tue Nov 29 14:56:42 2005
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonmetadata.pm,v 1.12 2005/03/11 03:25:18 matthew Exp $
+# $Id: lonmetadata.pm,v 1.13 2005/11/29 19:56:42 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -483,6 +483,15 @@
     my %hash=();
     for (my $i=0; $i<=$#Metadata_Table_Description;$i++) {
         $hash{$Metadata_Table_Description[$i]->{'name'}}=$cols[$i];
+	unless ($hash{$Metadata_Table_Description[$i]->{'name'}}) {
+	    if ($Metadata_Table_Description[$i]->{'type'} eq 'TEXT') {
+		$hash{$Metadata_Table_Description[$i]->{'name'}}='';
+	    } elsif ($Metadata_Table_Description[$i]->{'type'} eq 'DATETIME') {
+		$hash{$Metadata_Table_Description[$i]->{'name'}}='0000-00-00 00:00:00';
+	    } else {
+		$hash{$Metadata_Table_Description[$i]->{'name'}}=0;
+	    }
+	}
     }
     return %hash;
 }