Add static function in NodaIDGetter to get tag ID by import log
This commit is contained in:
parent
9f67d253da
commit
7ef09db72c
|
@ -336,4 +336,38 @@ final class NodaIDGetter {
|
||||||
return $output;
|
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