Browse Source

Added Publication Type to the list of properties (it was missed)

spficklin 12 years ago
parent
commit
ad5c587668

+ 3 - 2
tripal_pub/includes/pub_form.inc

@@ -69,12 +69,13 @@ function chado_pub_form($node, $form_state) {
   $properties_select[] = 'Select a Property';
   $properties_list = array();
   $sql = "
-    SELECT CVTS.cvterm_id, CVTS.name, CVTS.definition
+    SELECT DISTINCT CVTS.cvterm_id, CVTS.name, CVTS.definition
     FROM {cvtermpath} CVTP
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Details' and 
+    WHERE CV.name = 'tripal_pub' and 
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
       NOT CVTS.is_obsolete = 1
     ORDER BY CVTS.name ASC 
   ";

+ 3 - 2
tripal_pub/includes/pub_search.inc

@@ -122,12 +122,13 @@ function tripal_pub_search_form(&$form_state = NULL) {
   $properties = array();
   $properties[] = 'Any Field';
   $sql = "
-    SELECT CVTS.cvterm_id, CVTS.name, CVTS.definition
+    SELECT DISTINCT CVTS.cvterm_id, CVTS.name, CVTS.definition
     FROM {cvtermpath} CVTP
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Details' and 
+    WHERE CV.name = 'tripal_pub' and 
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
       NOT CVTS.is_obsolete = 1
     ORDER BY CVTS.name ASC 
   ";

+ 1 - 1
tripal_pub/tpub.obo

@@ -83,7 +83,7 @@ is_a: TPUB:0000015 ! Publication Type
 [Term]
 id: TPUB:0000015
 name: Publication Type
-relationship: part_of TPUB:0000037 ! Publication Details
+relationship: part_of TPUB:0000002 ! Publication
 
 [Term]
 id: TPUB:0000016

+ 4 - 3
tripal_pub/tripal_pub.module

@@ -478,13 +478,14 @@ function chado_pub_update($node) {
   // get the list of properties for easy lookup (without doing lots of database queries
   $properties_list = array();
   $sql = "
-    SELECT CVTS.cvterm_id, CVTS.name, CVTS.definition
+    SELECT DISTINCT CVTS.cvterm_id, CVTS.name, CVTS.definition
     FROM {cvtermpath} CVTP
       INNER JOIN {cvterm} CVTS ON CVTP.subject_id = CVTS.cvterm_id
       INNER JOIN {cvterm} CVTO ON CVTP.object_id = CVTO.cvterm_id
       INNER JOIN {cv} ON CVTO.cv_id = CV.cv_id
-    WHERE CV.name = 'tripal_pub' and CVTO.name = 'Publication Details'  and 
-      NOT CVTS.is_obsolete = 1    
+    WHERE CV.name = 'tripal_pub' and 
+      (CVTO.name = 'Publication Details' or CVTS.name = 'Publication Type') and 
+      NOT CVTS.is_obsolete = 1
     ORDER BY CVTS.name ASC 
   ";
   $prop_types = chado_query($sql);