Displays degree on profile edition even if university is missing.
authorStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 22:17:05 +0000 (23:17 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 1 Nov 2010 22:17:05 +0000 (23:17 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
htdocs/javascript/profile.js

index ef2c7ef..7e6b683 100644 (file)
@@ -161,7 +161,11 @@ function prepareType(id)
     var edu    = $('.edu_' + id).find("[name='edus[" + id + "][eduid]']").val() - 1;
     var sel    = $('.edu_' + id).find('[name=edu_' + id + '_tmp]').val();
     var html   = '';
-    var length = educationDegree[edu].length;
+    if (educationDegree[edu]) {
+        var length = educationDegree[edu].length;
+    } else {
+        var length = 0;
+    }
     for (i = 0; i < length; ++i) {
         html += '<option value="' + educationDegree[edu][i] + '"';
         if (sel == educationDegree[edu][i]) {
@@ -169,6 +173,10 @@ function prepareType(id)
         }
         html += '>' + educationDegreeName[educationDegree[edu][i] - 1] + '</option>';
     }
+    // XXX: to be removed once SQL table profile_merge_issues is.
+    if (sel != '' && html == '') {
+        html += '<option value="' + sel + '" selected="selected">' + educationDegreeName[sel - 1] + '</option>';
+    }
     $('.edu_' + id).find("[name='edus[" + id + "][degreeid]']").html(html);
 }