bug #8368
problems in compose_cdm_specimen_or_observation_tree_entry()
100%
Description
Hallo Katja,
ich leite das mal an dich weiter, denn es gibt hier ein Problem mit deinem Kode in compose_cdm_specimen_or_observation_tree_entry():
// collect typeStatus as label
if (isset($specimen_or_observation->specimenTypeDesignations)) {
$type_status = array();
foreach ($specimen_or_observation->specimenTypeDesignations as $typeDesignation) {
if (isset($typeDesignation->typeStatus->representation_L10n)) {
$type_status[] = $typeDesignation->typeStatus->representation_L10n;
}
}
if (count($type_status) > 0) {
$type_label = implode(', ', $type_status);
}
}
if (isset($typeDesignation)){ // <-- dies müsste doch innerhalb der foreach-Schleife oben passieren?
$title = $type_label . ' for: ' . $typeDesignation->typifiedNames; // <-- das ist ein array
}else{
$title = $type_label;
}
Du könntest statt dieses code auch einfach die Funktion compose_specimen_type_designations() verwenden
Viele Grüße
Andreas
Related issues
Associated revisions
ref #8368 fixing check for exitance of property
History
#1 Updated by Andreas Kohlbecker over 1 year ago
- Description updated (diff)
#2 Updated by Andreas Kohlbecker over 1 year ago
- Description updated (diff)
#3 Updated by Andreas Kohlbecker over 1 year ago
- Status changed from New to In Progress
- Assignee changed from Katja Luther to Andreas Kohlbecker
- Priority changed from New to Highest
#4 Updated by Andreas Kohlbecker over 1 year ago
working on this issue I found another issue: #8369
#5 Updated by Andreas Kohlbecker over 1 year ago
- Related to bug #8369: SpecimenTypeDesignationDTO can not be serialized to JSON added
#6 Updated by Andreas Kohlbecker over 1 year ago
After fixing the problems in this code i noticed that this code is not generating any output at all.
I attempted to base the code on existing functions and wrote the following lines:
if(isset($specimen_or_observation->specimenTypeDesignations) && count($specimen_or_observation->specimenTypeDesignations) > 0){
// $specimen_or_observation->specimenTypeDesignations are DTOs
$specimen_type_designation_map = array();
foreach($specimen_or_observation->specimenTypeDesignations as $stdDTO){
if(!isset($specimen_type_designation_map[$stdDTO->typeStatus])){
$specimen_type_designation_map[$stdDTO->typeStatus] = array();
}
$specimen_type_designation_map[$stdDTO->typeStatus][] = $stdDTO;
}
$items['data'] = compose_specimen_type_designations($specimen_type_designation_map);
}
I removed them again and felt the original code as it is. This code was introduced in cdm-dataportal|b3ac03bf
#7 Updated by Andreas Kohlbecker over 1 year ago
- Status changed from In Progress to Feedback
- Assignee changed from Andreas Kohlbecker to Katja Luther
- % Done changed from 0 to 10
Katja, please help disentangling the situation.
#8 Updated by Andreas Kohlbecker over 1 year ago
- Copied to report #8379: Review strange specimen implementations added
#9 Updated by Andreas Kohlbecker over 1 year ago
- Status changed from Feedback to Closed
- Assignee changed from Katja Luther to Andreas Kohlbecker
- % Done changed from 10 to 100
error message suppressed and visible effect of the problem solved, the further discussion and post release review task is copied to #8379