Index: openacs-4/packages/organizations/organizations.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/organizations/organizations.info,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/organizations/organizations.info	25 Jul 2004 11:26:28 -0000	1.7
+++ openacs-4/packages/organizations/organizations.info	16 Sep 2005 15:46:53 -0000	1.8
@@ -7,7 +7,7 @@
     <initial-install-p>f</initial-install-p>
     <singleton-p>f</singleton-p>
     
-    <version name="0.5d2" url="http://openacs.org/repository/download/apm/organizations-0.5d2.apm">
+    <version name="0.5d3" url="http://openacs.org/repository/download/apm/organizations-0.5d3.apm">
         <owner url="mailto:jon@mayuli.com">Jon Griffin</owner>
         <owner url="mailto:jader@bread.com">Jade Rubick</owner>
         <summary>Implementation of HR-XML organizations datamodel.</summary>
@@ -20,7 +20,7 @@
       what needs to be updated to make things work correctly [Jade Rubick].
         </description>
 
-        <provides url="organizations" version="0.5d2"/>
+        <provides url="organizations" version="0.5d3"/>
         <requires url="acs-kernel" version="5.0d13"/>
 
         <callbacks>
Index: openacs-4/packages/organizations/tcl/organizations-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/organizations/tcl/organizations-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/organizations/tcl/organizations-procs.tcl	10 Sep 2005 13:42:13 -0000	1.4
+++ openacs-4/packages/organizations/tcl/organizations-procs.tcl	16 Sep 2005 15:46:20 -0000	1.5
@@ -141,3 +141,27 @@
 }
 
 
+ad_proc -public organization::organization_p {
+    {-party_id:required}
+} {
+    is this party an organization? Cached
+} {
+    return [util_memoize [list ::organization::organization_p_not_cached -party_id $party_id]]
+}
+
+ad_proc -public organization::organization_p_not_cached {
+    {-party_id:required}
+} {
+    is this party and organization?
+} {
+    if {[person::person_p -party_id $party_id]} {
+        return 0
+    } else {
+        if {[db_0or1row contact_org_exists_p {select '1' from organizations where organization_id = :party_id}]} {
+            return 1
+        } else {
+            return 0
+        }
+    }
+}
+