Skip to content

Instantly share code, notes, and snippets.

@colemanw
Last active January 16, 2016 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colemanw/a43c75e10ba65ee16cad to your computer and use it in GitHub Desktop.
Save colemanw/a43c75e10ba65ee16cad to your computer and use it in GitHub Desktop.
diff --git a/CRM/Core/BAO/Note.php b/CRM/Core/BAO/Note.php
index ef7dff8..da06824 100644
--- a/CRM/Core/BAO/Note.php
+++ b/CRM/Core/BAO/Note.php
@@ -574,4 +574,19 @@ WHERE participant.contact_id = %1 AND note.entity_table = 'civicr
m_participant'
}
}
+ /**
+ * Whitelist of possible values for the entity_table field
+ * @return array
+ */
+ public static function entityTables() {
+ $tables = array(
+ 'civicrm_relationship',
+ 'civicrm_contact',
+ 'civicrm_participant',
+ 'civicrm_contribution',
+ );
+ // Identical keys & values
+ return array_combine($tables, $tables);
+ }
+
}
diff --git a/xml/schema/Core/Note.xml b/xml/schema/Core/Note.xml
index 128da77..b6e60df 100644
--- a/xml/schema/Core/Note.xml
+++ b/xml/schema/Core/Note.xml
@@ -26,6 +26,9 @@
<length>64</length>
<required>true</required>
<comment>Name of table where item being referenced is stored.</comment>
+ <pseudoconstant>
+ <callback>CRM_Core_BAO_Note::entityTables</callback>
+ </pseudoconstant>
<add>1.1</add>
</field>
<field>
diff --git a/xml/schema/Core/EntityTag.xml b/xml/schema/Core/EntityTag.xml
index 0539e4e..1f3543d 100644
--- a/xml/schema/Core/EntityTag.xml
+++ b/xml/schema/Core/EntityTag.xml
@@ -40,6 +40,9 @@
<title>Entity Table</title>
<length>64</length>
<comment>physical tablename for entity being joined to file, e.g. civicrm_contact</comment>
+ <pseudoconstant>
+ <optionGroupName>tag_used_for</optionGroupName>
+ </pseudoconstant>
<add>3.2</add>
</field>
<field>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment