empty taxon field when selecting name #5602
authorPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 17 Mar 2016 17:13:43 +0000 (18:13 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Thu, 17 Mar 2016 17:13:43 +0000 (18:13 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java

index 9d9c4ab5e0b1aaefcfd4b0f85a3c34dc51cba340..adff089110e40520abe8b1e5a494834575c2494b 100644 (file)
@@ -133,6 +133,12 @@ public class DeterminationEventDetailElement extends
                        getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
                } else if (eventSource == selectionTaxonNameBase) {
                    getEntity().setTaxonName(selectionTaxonNameBase.getSelection());
+                   //empty taxon field if name does not belong the taxon
+                   TaxonBase taxonBase = selection_taxonBase.getEntity();
+                       if(taxonBase!=null && taxonBase.getName()!=null 
+                                       && !taxonBase.getName().equals(selectionTaxonNameBase.getSelection())){
+                               selection_taxonBase.setEntity(null);
+                       }
                } else if (eventSource == selection_taxonBase) {
                        TaxonBase taxon = selection_taxonBase.getSelection();
             getEntity().setTaxon(taxon);