Author: david
Date: Fri Oct  9 16:51:35 2009
New Revision: 3713

Log:
Try and match broad term on typed string.  Fixes issue #1004.

Modified:
   trunk/apps/qubit/modules/term/actions/editAction.class.php

Modified: trunk/apps/qubit/modules/term/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/editAction.class.php  Fri Oct  9 
16:08:04 2009        (r3712)
+++ trunk/apps/qubit/modules/term/actions/editAction.class.php  Fri Oct  9 
16:51:35 2009        (r3713)
@@ -233,6 +233,23 @@
     {
       $this->term->parentId = $parentTerm->id;
     }
+    else if (0 < strlen($broadTerm = 
trim($this->getRequestParameter('broadTerm'))))
+    {
+      // If user types in a term name, but doesn't chose from the autocomplete
+      // list, then try and match an existing term
+      $c = new Criteria;
+      $c->add(QubitTermI18n::NAME, $broadTerm);
+      $c->add(QubitTermI18n::CULTURE, $this->getUser()->getCulture());
+
+      if (null !== ($existingTerm = QubitTermI18n::getOne($c)))
+      {
+        $this->term->parentId = $existingTerm->id;
+      }
+      else
+      {
+        $this->term->parentId = QubitTerm::ROOT_ID;
+      }
+    }
 
     return $this;
   }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to