Préparer la version 1.0.0-rc.4
This commit is contained in:
parent
0a482afe9d
commit
6e3beea211
38 changed files with 388 additions and 56 deletions
|
|
@ -33,4 +33,23 @@ final class LabReferenceService
|
|||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
public static function copySpecies(string $source, string $target, ?int $userId): int
|
||||
{
|
||||
$source = SpeciesService::normalize($source);
|
||||
$target = SpeciesService::normalize($target);
|
||||
if ($source === $target || !SpeciesService::exists($source, false) || !SpeciesService::exists($target, false)) {
|
||||
throw new RuntimeException(t('lab_reference.invalid_species'));
|
||||
}
|
||||
$stmt = DB::pdo()->prepare(
|
||||
"INSERT OR IGNORE INTO lab_reference_ranges(analyzer_code,analyzer_name,species_code,parameter_code,parameter_name,unit,reference_min,reference_max,source_note,active,sort_order,updated_by,updated_at)
|
||||
SELECT analyzer_code,analyzer_name,:target,parameter_code,parameter_name,unit,reference_min,reference_max,source_note,active,sort_order,:user,datetime('now')
|
||||
FROM lab_reference_ranges WHERE species_code=:source",
|
||||
);
|
||||
$stmt->execute([':source' => $source, ':target' => $target, ':user' => $userId]);
|
||||
if ($stmt->rowCount() === 0) {
|
||||
throw new RuntimeException(t('lab_reference.nothing_copied'));
|
||||
}
|
||||
return $stmt->rowCount();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue