fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9298] property: custom fields


From: Sigurd Nes
Subject: [Fmsystem-commits] [9298] property: custom fields
Date: Mon, 07 May 2012 19:03:03 +0000

Revision: 9298
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9298
Author:   sigurdne
Date:     2012-05-07 19:03:02 +0000 (Mon, 07 May 2012)
Log Message:
-----------
property: custom fields

Modified Paths:
--------------
    trunk/property/inc/class.custom_fields.inc.php

Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php      2012-05-07 17:33:50 UTC 
(rev 9297)
+++ trunk/property/inc/class.custom_fields.inc.php      2012-05-07 19:03:02 UTC 
(rev 9298)
@@ -52,6 +52,7 @@
                {
                        parent::__construct($appname);
                        $this->_db2 = clone($this->_db);                        
+                       $this->contacts = CreateObject('phpgwapi.contacts');
                }
 
                /**
@@ -66,7 +67,6 @@
                 */
                public function prepare($values, $appname, $location, 
$view_only='')
                {
-                       $contacts               = 
CreateObject('phpgwapi.contacts');
                        $vendor                 = 
CreateObject('property.sogeneric');
                        $vendor->get_location_info('vendor',false);
 
@@ -149,7 +149,7 @@
                                {
                                        if($attributes['value'])
                                        {
-                                               $contact_data                   
                = 
$contacts->read_single_entry($attributes['value'],array('fn','tel_work','email'));
+                                               $contact_data                   
                = 
$this->contacts->read_single_entry($attributes['value'],array('fn','tel_work','email'));
                                                $attributes['contact_name']     
        = $contact_data[0]['fn'];
                                                $attributes['contact_email']    
= $contact_data[0]['email'];
                                                $attributes['contact_tel']      
        = $contact_data[0]['tel_work'];
@@ -176,10 +176,10 @@
                                {
                                        if($attributes['value'])
                                        {
-                                               $contact_data                   
        = $contacts->get_principal_organizations_data($attributes['value']);
+                                               $contact_data                   
        = 
$this->contacts->get_principal_organizations_data($attributes['value']);
                                                $attributes['org_name']         
= $contact_data[0]['org_name'];
 
-                                               $comms = 
$contacts->get_comm_contact_data($attributes['value'], $fields_comms='', 
$simple=false);
+                                               $comms = 
$this->contacts->get_comm_contact_data($attributes['value'], $fields_comms='', 
$simple=false);
 
                                                $comm_data = array();
                                                if(is_array($comms))
@@ -475,6 +475,11 @@
                        }
 
                        $ret = '';
+
+                       $choice_table = 'phpgw_cust_choice';
+                       $attribute_table = 'phpgw_cust_attribute';
+                       $attribute_filter = " location_id = {$location_id}";
+
                        switch($data['datatype'])
                        {
                                case 'R':
@@ -488,11 +493,11 @@
                                        }
                                        break;
                                case 'AB':
-                                       $contact_data   = 
$contacts->read_single_entry($data['value'],array('fn'));
+                                       $contact_data   = 
$this->contacts->read_single_entry($data['value'],array('fn'));
                                        $ret =  $contact_data[0]['fn'];
                                        break;
                                case 'ABO':
-                                       $contact_data   = 
$contacts->get_principal_organizations_data($data['value']);
+                                       $contact_data   = 
$this->contacts->get_principal_organizations_data($data['value']);
                                        $ret = $contact_data[0]['org_name'];
                                        break;
                                case 'VENDOR':
@@ -552,10 +557,6 @@
 
                function translate_value($values, $location_id, $location_count 
= 0)
                {
-                       $choice_table = 'phpgw_cust_choice';
-                       $attribute_table = 'phpgw_cust_attribute';
-                       $attribute_filter = " location_id = {$location_id}";
-                       $contacts = CreateObject('phpgwapi.contacts');
 //                     _debug_array($values);die();
                        $location = array();
                        $ret = array();




reply via email to

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