Add check to prevent duplicate work in NodaValidationHelper
This commit is contained in:
@@ -161,14 +161,19 @@ final class NodaValidationHelper {
|
|||||||
throw new MDBlacklistedInputException("Term is blacklisted");
|
throw new MDBlacklistedInputException("Term is blacklisted");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check rewrites
|
||||||
|
|
||||||
if ($existingPersinstId = NodaIDGetter::getPersinstIDByNamesAndRewrites($mysqli_noda, $lang, $persinst_name_en, $persinst_geburtsjahr, $persinst_sterbejahr, $context_identifier, $institution_id)) {
|
if ($existingPersinstId = NodaIDGetter::getPersinstIDByNamesAndRewrites($mysqli_noda, $lang, $persinst_name_en, $persinst_geburtsjahr, $persinst_sterbejahr, $context_identifier, $institution_id)) {
|
||||||
return $existingPersinstId;
|
return $existingPersinstId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($existingPersinstId = NodaIDGetter::getPersinstIDByNamesAndRewrites($mysqli_noda, $lang, $persinst_name, $persinst_geburtsjahr, $persinst_sterbejahr, $context_identifier, $institution_id)) {
|
if ($persinst_name_en !== $persinst_name) {
|
||||||
return $existingPersinstId;
|
if ($existingPersinstId = NodaIDGetter::getPersinstIDByNamesAndRewrites($mysqli_noda, $lang, $persinst_name, $persinst_geburtsjahr, $persinst_sterbejahr, $context_identifier, $institution_id)) {
|
||||||
|
return $existingPersinstId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return 0, no ID found
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user