phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/class.soactor.inc.php, 1.1.2.3


From: nomail
Subject: [Phpgroupware-cvs] property/inc/class.soactor.inc.php, 1.1.2.3
Date: Sun, 30 May 2004 14:28:42 +0200

Update of /property/inc
Modified Files:
        Branch: sigurd-2
          class.soactor.inc.php

date: 2004/05/30 12:28:42;  author: sigurdne;  state: Exp;  lines: +36 -10

Log Message:
no message
=====================================================================
Index: property/inc/class.soactor.inc.php
diff -u property/inc/class.soactor.inc.php:1.1.2.2 
property/inc/class.soactor.inc.php:1.1.2.3
--- property/inc/class.soactor.inc.php:1.1.2.2  Fri May 28 21:53:42 2004
+++ property/inc/class.soactor.inc.php  Sun May 30 12:28:42 2004
@@ -56,7 +56,8 @@
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $member_id      = 
(isset($data['member_id'])?$data['member_id']:0);
                        }
 
                        $sql = $this->bocommon->fm_cache('sql_actor_' . 
$this->role . $lookup);
@@ -181,6 +182,12 @@
                                $where= 'AND';
                        }
 
+                       if ($member_id>0)
+                       {
+                               $filtermethod .= " $where 
$entity_table.member_of LIKE '%,$member_id,%' ";
+                               $where= 'AND';
+                       }
+
                        if ($status)
                        {
                                $filtermethod .= " $where 
$entity_table.status='$status' ";
@@ -193,8 +200,18 @@
                                $query = ereg_replace("'",'',$query);
                                $query = ereg_replace('"','',$query);
 
-                               $querymethod = " $where ( 
$entity_table.first_name LIKE '%$query%' OR $entity_table.last_name LIKE 
'%$query%')";
-                               $where = 'AND';
+                               $this->db->query("SELECT * FROM 
$attribute_table where search='1'");
+
+                               while ($this->db->next_record())
+                               {
+                                       $querymethod[]= "$entity_table." . 
$this->db->f('column_name') . " LIKE '%$query%'";
+                               }
+
+                               if (isset($querymethod) AND 
is_array($querymethod))
+                               {
+                                       $querymethod = " $where (" . implode (' 
OR ',$querymethod) . ')';
+                                       $where = 'AND';
+                               }
                        }
 
                        $sql .= " $filtermethod $querymethod";
@@ -310,6 +327,7 @@
                                        $actor['id']                    = 
(int)$this->db->f('id');
                                        $actor['entry_date']            = 
$this->db->f('entry_date');
                                        $actor['cat_id']                        
= (int)$this->db->f('category');
+                                       $actor['member_of']                     
= explode(',',$this->db->f('member_of'));
 
                                        for 
($i=0;$i<count($actor['attributes']);$i++)
                                        {
@@ -319,7 +337,6 @@
 
                                }
                        }
-
                        return $actor;
                }
 
@@ -327,6 +344,8 @@
                {
                        $table = 'fm_' . $this->role;
 
+                       $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
+
                        while (is_array($actor['extra']) && 
list($input_name,$value) = each($actor['extra']))
                        {
                                if($value)
@@ -355,11 +374,12 @@
                        }
 
                        $this->db->transaction_begin();
+                       $id = $this->bocommon->next_id($table);
 
-                       $this->db->query("INSERT INTO $table 
(entry_date,category $cols) "
-                               . "VALUES ('" . time() . "','" . 
$actor['cat_id'] . "' $vals)");
+                       $this->db->query("INSERT INTO $table 
(id,entry_date,category,member_of $cols) "
+                               . "VALUES ($id,'" . time() . "','" . 
$actor['cat_id'] . "','" . $actor['member_of'] . "' $vals)");
 
-                       $receipt['actor_id']= 
$this->db->get_last_insert_id($table,'id');
+                       $receipt['actor_id']= 
$id;//$this->db->get_last_insert_id($table,'id');
 
                        $receipt['message'][] = array('msg'=>lang('actor %1 has 
been saved',$receipt['actor_id']));
 
@@ -373,6 +393,8 @@
 //_debug_array($values_attribute);
                        $table = 'fm_' . $this->role;
 
+                       $actor['member_of']=',' . 
implode(',',$actor['member_of']) . ',';
+
                        while (is_array($actor['extra']) && 
list($column,$value) = each($actor['extra']))
                        {
                                $value_set[$column]     = $value;
@@ -395,7 +417,7 @@
                        }
 
                        $this->db->query("UPDATE $table set entry_date='" . 
time() . "', category='"
-                                                       . $actor['cat_id'] . "' 
$value_set WHERE id=" . intval($actor['actor_id']));
+                                                       . $actor['cat_id'] . 
"', member_of='" . $actor['member_of'] . "'$value_set WHERE id=" . 
intval($actor['actor_id']));
 
                        $receipt['actor_id']= $actor['actor_id'];
                        $receipt['message'][] = array('msg'=>lang('actor %1 has 
been edited',$actor['actor_id']));
@@ -474,7 +496,8 @@
                                        'statustext'    => 
$this->db->f('statustext'),
                                        'input_text'    => 
$this->db->f('input_text'),
                                        'type_name'             => 
$this->db->f('type'),
-                                       'datatype'              => 
$this->db->f('datatype')
+                                       'datatype'              => 
$this->db->f('datatype'),
+                                       'search'                => 
$this->db->f('search')
                                );
                        }
                        return $attrib;
@@ -502,6 +525,7 @@
                                $attrib['type_name']                            
= $this->db->f('type_name');
                                $attrib['lookup_form']                          
= $this->db->f('lookup_form');
                                $attrib['list']                                 
        = $this->db->f('list');
+                               $attrib['search']                               
        = $this->db->f('search');
                                if($this->db->f('datatype')=='R' || 
$this->db->f('datatype')=='CH' || $this->db->f('datatype')=='LB')
                                {
                                        $attrib['choice'] = 
$this->read_attrib_choice($id);
@@ -550,6 +574,7 @@
                                $attrib['input_text'],
                                $attrib['statustext'],
                                $attrib['lookup_form'],
+                               $attrib['search'],
                                $attrib['list'],
                                $attrib_sort,
                                $attrib['column_info']['type'],
@@ -563,7 +588,7 @@
 
                        $this->db->transaction_begin();
 
-                       $this->db->query("INSERT INTO $attribute_table 
(id,column_name, input_text, 
statustext,lookup_form,list,attrib_sort,datatype,precision_,scale,default_value,nullable)
 "
+                       $this->db->query("INSERT INTO $attribute_table 
(id,column_name, input_text, 
statustext,lookup_form,search,list,attrib_sort,datatype,precision_,scale,default_value,nullable)
 "
                                . "VALUES ($values)");
 
                        $receipt['id']= $attrib['id'];
@@ -639,6 +664,7 @@
                                        'input_text'            => 
$attrib['input_text'],
                                        'statustext'            => 
$attrib['statustext'],
                                        'lookup_form'           => 
$attrib['lookup_form'],
+                                       'search'                        => 
$attrib['search'],
                                        'list'                          => 
$attrib['list'],
                                        'datatype'                      => 
$attrib['column_info']['type'],
                                        'precision_'            => 
$attrib['column_info']['precision'],




reply via email to

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