Project

General

Profile

« Previous | Next » 

Revision 3049fdcd

Added by Andreas Kohlbecker almost 4 years ago

ref #9102 convering both cases for taxon in current classification test: TaxonNode and TaxonNodeDto

View differences:

modules/cdm_dataportal/cdm_dataportal.module
2703 2703
 */
2704 2704
function _cdm_dataportal_acceptedByCurrentView($taxon) {
2705 2705

  
2706
  $defaultTreeUuid = get_current_classification_uuid();
2706
  $default_classification_uuid = get_current_classification_uuid();
2707 2707

  
2708 2708
  if (isset($taxon->taxonNodes)) {
2709
    $taxonNodes = $taxon->taxonNodes;
2709
    $taxon_nodes = $taxon->taxonNodes;
2710 2710
  }
2711 2711
  else {
2712
    $taxonNodes = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODES, $taxon->uuid);
2712
    $taxon_nodes = cdm_ws_get(CDM_WS_PORTAL_TAXON_TAXONNODES, $taxon->uuid);
2713 2713
  }
2714 2714

  
2715
  if ($taxon->class == "Taxon" && isset($taxonNodes)) {
2716
    foreach ($taxonNodes as $node) {
2717
      if (isset($node->classificationUUID)){
2718
        if ($node->classificationUUID == $defaultTreeUuid) {
2719
          return TRUE;
2720
        }
2721
      }
2722
      else {
2723
        if ($node->classification == $defaultTreeUuid) {
2724
          return TRUE;
2725
        }
2715
  if ($taxon->class == "Taxon" && isset($taxon_nodes)) {
2716
    foreach ($taxon_nodes as $node) {
2717
      if($node->class == 'TaxonNodeDto' && isset($node->classificationUUID)){
2718
        // case of TaxonNodeDto
2719
        return $node->classificationUUID == $default_classification_uuid;
2720
      } else if($node->class == 'TaxonNode' && isset($node->classification->uuid)) {
2721
         return $node->classification->uuid == $default_classification_uuid;
2726 2722
      }
2727 2723
    }
2728 2724
  }
2729

  
2730 2725
  return FALSE;
2731 2726
}
2732 2727

  
modules/cdm_dataportal/includes/taxon.inc
484 484

  
485 485
  // .. Well, for sure not as performant as before, but better than nothing.
486 486
  $synonym_uuids = array();
487
  $misappied_uuids = array();
487
  $misapplied_uuids = array();
488 488
  foreach ($taxon_list as $taxon) {
489 489
    if ($taxon->class == "Synonym") {
490 490
      if (!array_key_exists($taxon->uuid, $synonym_uuids)) {
......
492 492
      }
493 493
    }
494 494
    elseif (!_cdm_dataportal_acceptedByCurrentView($taxon)) {
495
      // Assuming that it is a misappied name, will be further examined below.
496
      $misappied_uuids[$taxon->uuid] = $taxon->uuid;
495
      // Assuming that it is a misapplied name, will be further examined below.
496
      $misapplied_uuids[$taxon->uuid] = $taxon->uuid;
497 497
    }
498 498
  }
499 499

  
......
515 515
    );
516 516
  }
517 517

  
518
  foreach ($misappied_uuids as $relatedUuid) {
518
  foreach ($misapplied_uuids as $relatedUuid) {
519 519
    $taxonRelations = cdm_ws_get(CDM_WS_PORTAL_TAXON_RELATIONS, array(
520 520
      $relatedUuid,
521 521
    ));

Also available in: Unified diff