Merge branch 'master' of gitea:museum-digital/MDNodaHelpers
This commit is contained in:
commit
fcc63c4ea0
@ -74,6 +74,43 @@ final class NodaIDGetter {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns persinst ID by entry in persinst translations table.
|
||||
*
|
||||
* @param MDMysqli $mysqli_noda Database connection.
|
||||
* @param string $instance Instance in which the import was run.
|
||||
* @param integer $institution_id ID of the importing institution.
|
||||
* @param string $name Name of the persinst to search for.
|
||||
* @param string $birthYear Year of birth. Optional.
|
||||
* @param string $deathYear Year of death. Optional.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function getPersinstIDByImportLog(MDMysqli $mysqli_noda, string $instance, int $institution_id, string $name, string $birthYear = "", string $deathYear = ""):int {
|
||||
|
||||
if (empty($name)) return 0;
|
||||
|
||||
$lookUpName = $name . $birthYear . $deathYear;
|
||||
$persinstByImportLogResult = $mysqli_noda->query_by_stmt("
|
||||
SELECT `persinst_id`
|
||||
FROM `persinst_logged_imports`
|
||||
WHERE `instance` = ?
|
||||
AND `institution_id` = ?
|
||||
AND `input_string` = ?
|
||||
LIMIT 2", "sis", $instance, $institution_id, $lookUpName);
|
||||
|
||||
if ($persinstByImportLogData = $persinstByImportLogResult->fetch_row()) {
|
||||
$output = $persinstByImportLogData[0];
|
||||
}
|
||||
else $output = 0;
|
||||
|
||||
$persinstByImportLogResult->close();
|
||||
$persinstByImportLogResult = null;
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns place ID by entry in place name rewriting table.
|
||||
*
|
||||
@ -170,6 +207,40 @@ final class NodaIDGetter {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns place ID by entry in place translations table.
|
||||
*
|
||||
* @param MDMysqli $mysqli_noda Database connection.
|
||||
* @param string $instance Instance in which the import was run.
|
||||
* @param integer $institution_id ID of the importing institution.
|
||||
* @param string $name Name of the place to search for.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function getPlaceIDByImportLog(MDMysqli $mysqli_noda, string $instance, int $institution_id, string $name):int {
|
||||
|
||||
if (empty($name)) return 0;
|
||||
|
||||
$placeByImportLogResult = $mysqli_noda->query_by_stmt("
|
||||
SELECT `ort_id`
|
||||
FROM `orte_logged_imports`
|
||||
WHERE `instance` = ?
|
||||
AND `institution_id` = ?
|
||||
AND `input_string` = ?
|
||||
LIMIT 2", "sis", $instance, $institution_id, $name);
|
||||
|
||||
if ($placeByImportLogData = $placeByImportLogResult->fetch_row()) {
|
||||
$output = $placeByImportLogData[0];
|
||||
}
|
||||
else $output = 0;
|
||||
|
||||
$placeByImportLogResult->close();
|
||||
$placeByImportLogResult = null;
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns tag ID by entry in tag translations table.
|
||||
*
|
||||
@ -265,4 +336,38 @@ final class NodaIDGetter {
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns tag ID by entry in tag translations table.
|
||||
*
|
||||
* @param MDMysqli $mysqli_noda Database connection.
|
||||
* @param string $instance Instance in which the import was run.
|
||||
* @param integer $institution_id ID of the importing institution.
|
||||
* @param string $name Name of the tag to search for.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function getTagIDByImportLog(MDMysqli $mysqli_noda, string $instance, int $institution_id, string $name):int {
|
||||
|
||||
if (empty($name)) return 0;
|
||||
|
||||
$tagByImportLogResult = $mysqli_noda->query_by_stmt("
|
||||
SELECT `tag_id`
|
||||
FROM `tag_logged_imports`
|
||||
WHERE `instance` = ?
|
||||
AND `institution_id` = ?
|
||||
AND `input_string` = ?
|
||||
LIMIT 2", "sis", $instance, $institution_id, $name);
|
||||
|
||||
if ($tagByImportLogData = $tagByImportLogResult->fetch_row()) {
|
||||
$output = $tagByImportLogData[0];
|
||||
}
|
||||
else $output = 0;
|
||||
|
||||
$tagByImportLogResult->close();
|
||||
$tagByImportLogResult = null;
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user