97ab92339890a2c48de767060aba8e714663c5cc tdreszer Mon Sep 12 16:53:24 2011 -0700 Validation of cv terms should treat 'deprecated' terms similar to terms not found. diff --git src/hg/lib/cv.c src/hg/lib/cv.c index c1788b7..f696201 100644 --- src/hg/lib/cv.c +++ src/hg/lib/cv.c @@ -437,48 +437,49 @@ if (SETTING_NOT_ON(hashFindVal(termHash,CV_TOT_CV_DEFINED))) // Known type of term but no validation to be done { if (reason != NULL) safef(reason,len,"ERROR in %s: Term '%s' says validate in cv but is not '%s'.",CV_FILE_NAME,(char *)term,CV_TOT_CV_DEFINED); return FALSE; } // cvDefined so every val should be in cv struct hash *cvHashForTerm = (struct hash *)cvTermHash((char *)term); if (cvHashForTerm == NULL) { if (reason != NULL) safef(reason,len,"ERROR in %s: Term '%s' says validate in cv but not found as a cv term.",CV_FILE_NAME,(char *)term); return FALSE; } - if (hashFindVal(cvHashForTerm,(char *)val) == NULL) // No cv definition for term so no validation can be done + struct hash *cvHashForVal = hashFindVal(cvHashForTerm,(char *)val); + if (cvHashForVal == NULL || hashFindVal(cvHashForVal, "deprecated")) // No cv definition for term so no validation can be done { if (sameString(validationRule,CV_VALIDATE_CV_OR_NONE) && sameString((char *)val,MDB_VAL_ENCODE_EDV_NONE)) return TRUE; else if (sameString(validationRule,CV_VALIDATE_CV_OR_CONTROL)) { cvHashForTerm = (struct hash *)cvTermHash(CV_TERM_CONTROL); if (cvHashForTerm == NULL) { if (reason != NULL) safef(reason,len,"ERROR in %s: Term '%s' says validate in cv but not found as a cv term.",CV_FILE_NAME,CV_TERM_CONTROL); return FALSE; } if (hashFindVal(cvHashForTerm,(char *)val) != NULL) return TRUE; } if (reason != NULL) - safef(reason,len,"INVALID cv lookup: %s = '%s'",(char *)term,(char *)val); + safef(reason,len,"INVALID cv lookup: %s = '%s' %s",(char *)term,(char *)val,(cvHashForVal?"DEPRECATED.":"not found.")); return FALSE; } } else if (startsWithWord(CV_VALIDATE_DATE,validationRule)) { if (dateToSeconds((char *)val,"%F") == 0) { if (reason != NULL) safef(reason,len,"INVALID date: %s = %s",(char *)term,(char *)val); return FALSE; } } else if (startsWithWord(CV_VALIDATE_EXISTS,validationRule)) { return TRUE; // (e.g. fileName exists) Nothing to be done at this time.