Skip to content

Commit

Permalink
fix subcollection load - use abbrev for convinience
Browse files Browse the repository at this point in the history
  • Loading branch information
krkabol committed Jan 29, 2025
1 parent ff7992a commit 7204a46
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 3 additions & 3 deletions htdocs/src/Controller/Front/SearchFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function database(Request $request, #[MapQueryParameter] bool $reset = fa
{
if ($reset) {
$this->sessionService->reset();
return $this->redirectToRoute($request->get('_route'));
// return $this->redirectToRoute($request->get('_route'));
}
$getData = $request->query->all();
if (!empty($getData)) {
Expand Down Expand Up @@ -95,9 +95,9 @@ public function databaseSearchSettings(#[MapQueryParameter] string $feature, #[M
}

#[Route('/collectionsSelectOptions', name: 'app_front_collectionsSelectOptions', methods: ['GET'])]
public function collectionsSelectOptions(#[MapQueryParameter] int $herbariumID): Response
public function collectionsSelectOptions(#[MapQueryParameter] string $herbariumID): Response
{
$result = $this->collectionService->getAllFromHerbariumAsPairs($herbariumID);
$result = $this->collectionService->getAllFromHerbariumAsPairsByAbbrev($herbariumID);

return new JsonResponse($result);
}
Expand Down
11 changes: 11 additions & 0 deletions htdocs/src/Service/CollectionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,15 @@ public function getAllFromHerbariumAsPairs(int $herbariumID): array
return $this->query($sql, ['herbariumID' => $herbariumID])->fetchAllKeyValue();
}

public function getAllFromHerbariumAsPairsByAbbrev(string $herbariumAbbreviation): array
{
$sql = "SELECT col.collectionID, col.collection
FROM tbl_management_collections as col
JOIN metadata AS institution ON col.source_id = institution.MetadataID
WHERE institution.OwnerOrganizationAbbrev = :herbarium
ORDER BY col.collection";

return $this->query($sql, ['herbarium' => $herbariumAbbreviation])->fetchAllKeyValue();
}

}
2 changes: 1 addition & 1 deletion htdocs/templates/front/home/searchRecord.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</td>
<td>
<a href='{{ path('app_front_specimenDetail', {'specimenId': specimen.getId() }) }}'>{{ specimen | scientificName }}</a>
{{ specimen.getSpecies().getId() | taxonAuthority | raw }}
{{ specimen.getSpecies() | taxonAuthority | raw }}
</td>
<td>{{ specimen | collector | raw }}</td>
<td>{{ specimen.getDate() }}</td>
Expand Down

0 comments on commit 7204a46

Please sign in to comment.