Add function for getting time IDs by their logged import concordances
This commit is contained in:
parent
2912b4a206
commit
f7e49e67a0
@ -430,4 +430,38 @@ final class NodaIDGetter {
|
||||
return $output;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns time ID by entry in time 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 time to search for.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function getTimeIDByImportLog(MDMysqli $mysqli_noda, string $instance, int $institution_id, string $name):int {
|
||||
|
||||
if (empty($name)) return 0;
|
||||
|
||||
$timeByImportLogResult = $mysqli_noda->query_by_stmt("
|
||||
SELECT `zeit_id`
|
||||
FROM `zeiten_logged_imports`
|
||||
WHERE `instance` = ?
|
||||
AND `institution_id` = ?
|
||||
AND `input_string` = ?
|
||||
LIMIT 2", "sis", $instance, $institution_id, $name);
|
||||
|
||||
if ($timeByImportLogData = $timeByImportLogResult->fetch_row()) {
|
||||
$output = $timeByImportLogData[0];
|
||||
}
|
||||
else $output = 0;
|
||||
|
||||
$timeByImportLogResult->close();
|
||||
$timeByImportLogResult = null;
|
||||
|
||||
return $output;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user