fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6947] property:more on documents


From: Sigurd Nes
Subject: [Fmsystem-commits] [6947] property:more on documents
Date: Mon, 07 Feb 2011 08:02:19 +0000

Revision: 6947
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6947
Author:   sigurdne
Date:     2011-02-07 08:02:19 +0000 (Mon, 07 Feb 2011)
Log Message:
-----------
property:more on documents

Modified Paths:
--------------
    trunk/property/inc/class.socommon.inc.php
    trunk/property/inc/class.uientity.inc.php

Modified: trunk/property/inc/class.socommon.inc.php
===================================================================
--- trunk/property/inc/class.socommon.inc.php   2011-02-06 21:20:40 UTC (rev 
6946)
+++ trunk/property/inc/class.socommon.inc.php   2011-02-07 08:02:19 UTC (rev 
6947)
@@ -277,35 +277,33 @@
                }
                function get_lookup_entity($location)
                {
-                       $this->db->query("SELECT entity_id,name FROM 
fm_entity_lookup $this->join fm_entity on 
fm_entity_lookup.entity_id=fm_entity.id WHERE type='lookup' AND 
location='$location'  ");
-
-                       $i = 0;
-
+                       $this->db->query("SELECT entity_id,name FROM 
fm_entity_lookup {$this->join} fm_entity on 
fm_entity_lookup.entity_id=fm_entity.id WHERE type='lookup' AND 
location='{$location}'  ");
+                       $entity = array();
                        while ($this->db->next_record())
                        {
-                               $entity[$i]['id']                               
= $this->db->f('entity_id');
-                               $entity[$i]['name']                             
= $this->db->f('name');
-                               $i++;
+                               $entity[] = array
+                               (
+                                       'id'    => $this->db->f('entity_id'),
+                                       'name'  => $this->db->f('name',true)
+                               );
                        }
                        return $entity;
                }
 
                function get_start_entity($location)
                {
-                       $this->db->query("SELECT entity_id,name FROM 
fm_entity_lookup $this->join fm_entity on 
fm_entity_lookup.entity_id=fm_entity.id WHERE type='start' AND 
location='$location'  ");
+                       $this->db->query("SELECT entity_id,name FROM 
fm_entity_lookup {$this->join} fm_entity on 
fm_entity_lookup.entity_id=fm_entity.id WHERE type='start' AND 
location='{$location}'  ");
 
-                       $i = 0;
+                       $entity = array();
                        while ($this->db->next_record())
                        {
-                               $entity[$i]['id']                               
= $this->db->f('entity_id');
-                               $entity[$i]['name']                             
= $this->db->f('name');
-                               $i++;
+                               $entity[] = array
+                               (
+                                       'id'    => $this->db->f('entity_id'),
+                                       'name'  => $this->db->f('name',true)
+                               );
                        }
-
-                       if (isset($entity))
-                       {
-                               return $entity;
-                       }
+                       return $entity;
                }
 
                function increment_id($name)

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2011-02-06 21:20:40 UTC (rev 
6946)
+++ trunk/property/inc/class.uientity.inc.php   2011-02-07 08:02:19 UTC (rev 
6947)
@@ -1750,14 +1750,27 @@
  */                    
                        if ($id)
                        {
+                               $get_docs = false;
+                               $check_doc = 
$this->bocommon->get_lookup_entity('document');
+                               foreach ($check_doc as $_check)
+                               {
+                                       if ($_check['id'] == $this->entity_id)
+                                       {
+                                               $get_docs = true;
+                                               break;
+                                       }
+                               }
 
-                               $document = CreateObject('property.sodocument');
-                               $documents = 
$document->get_files_at_location(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'num'=>$values['num']));
+                               if($get_docs)
+                               {
+                                       $document = 
CreateObject('property.sodocument');
+                                       $documents = 
$document->get_files_at_location(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'num'=>$values['num']));
 
-                               if($documents)
-                               {
-                                       $tabs['document']       = array('label' 
=> lang('document'), 'link' => '#document');
-                                       $documents = json_encode($documents);   
                        
+                                       if($documents)
+                                       {
+                                               $tabs['document']       = 
array('label' => lang('document'), 'link' => '#document');
+                                               $documents = 
json_encode($documents);                           
+                                       }
                                }
 
                                $related = 
$this->bo->read_entity_to_link(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$values['num']));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]