fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [12946] property: more on controller integration


From: Sigurd Nes
Subject: [Fmsystem-commits] [12946] property: more on controller integration
Date: Mon, 06 Apr 2015 17:27:05 +0000

Revision: 12946
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12946
Author:   sigurdne
Date:     2015-04-06 17:27:05 +0000 (Mon, 06 Apr 2015)
Log Message:
-----------
property: more on controller integration

Modified Paths:
--------------
    trunk/catch/setup/setup.inc.php
    trunk/catch/setup/tables_current.inc.php
    trunk/catch/setup/tables_update.inc.php
    trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
    trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
    trunk/property/inc/class.boadmin_entity.inc.php
    trunk/property/inc/class.soadmin_entity.inc.php
    trunk/property/inc/class.sodocument.inc.php
    trunk/property/inc/class.soentity.inc.php
    trunk/property/inc/class.uiadmin_entity.inc.php
    trunk/property/inc/class.uidocument.inc.php
    trunk/property/inc/class.uientity.inc.php
    
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
    trunk/property/inc/soap_client/bra5/soap.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/admin_entity.xsl

Modified: trunk/catch/setup/setup.inc.php
===================================================================
--- trunk/catch/setup/setup.inc.php     2015-04-06 17:25:53 UTC (rev 12945)
+++ trunk/catch/setup/setup.inc.php     2015-04-06 17:27:05 UTC (rev 12946)
@@ -27,7 +27,7 @@
         */
 
        $setup_info['catch']['name']                    = 'catch';
-       $setup_info['catch']['version']                 = '0.9.17.518';
+       $setup_info['catch']['version']                 = '0.9.17.519';
        $setup_info['catch']['app_order']               = 20;
        $setup_info['catch']['enable']                  = 1;
        $setup_info['catch']['globals_checked'] = True;

Modified: trunk/catch/setup/tables_current.inc.php
===================================================================
--- trunk/catch/setup/tables_current.inc.php    2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/catch/setup/tables_current.inc.php    2015-04-06 17:27:05 UTC (rev 
12946)
@@ -60,6 +60,7 @@
                                'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'is_eav' => array('type' => 'int','precision' 
=> '2','nullable' => True),
                                'enable_bulk' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'enable_controller' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'jasperupload' => array('type' => 
'int','precision' => 2,'nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True),

Modified: trunk/catch/setup/tables_update.inc.php
===================================================================
--- trunk/catch/setup/tables_update.inc.php     2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/catch/setup/tables_update.inc.php     2015-04-06 17:27:05 UTC (rev 
12946)
@@ -587,4 +587,23 @@
                        $GLOBALS['setup_info']['catch']['currentver'] = 
'0.9.17.518';
                        return $GLOBALS['setup_info']['catch']['currentver'];
                }
-       }
\ No newline at end of file
+       }
+
+       /**
+       * Update catch version from 0.9.17.518 to 0.9.17.519
+       * Add controller-flag to entities
+       */
+
+       $test[] = '0.9.17.518';
+       function catch_upgrade0_9_17_518()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch_category','enable_controller',array('type'
 => 'int','precision' => 2,'nullable' => True));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['catch']['currentver'] = 
'0.9.17.519';
+                       return $GLOBALS['setup_info']['catch']['currentver'];
+               }
+       }

Modified: trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php
===================================================================
--- trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php      2015-04-06 
17:25:53 UTC (rev 12945)
+++ trunk/phpgwapi/inc/accounts/class.accounts_sql.inc.php      2015-04-06 
17:27:05 UTC (rev 12946)
@@ -335,7 +335,14 @@
                {
                        $id = (int) $id;
                        $account = null;
+                       static $cache = array();
 
+
+                       if(isset($cache[$id]))
+                       {
+                               return $cache[$id];
+                       }
+
                        if ( $use_cache )
                        {
                                $account = 
phpgwapi_cache::system_get('phpgwapi', "account_{$id}");
@@ -377,6 +384,7 @@
 
                                phpgwapi_cache::system_set('phpgwapi', 
"account_{$id}", $account);
                        }
+                       $cache[$id] = $account;
                        return $account;
                }
 

Modified: trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php 2015-04-06 
17:25:53 UTC (rev 12945)
+++ trunk/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php 2015-04-06 
17:27:05 UTC (rev 12946)
@@ -175,10 +175,17 @@
                        if($fileid)
                        {
                                $bra5ServiceGet = new Bra5ServiceGet();
+                               $debug = false;
+                               if($debug)
+                               {
+                                       $bra5ServiceGet->getDocument(new 
Bra5StructGetDocument($this->secKey, $fileid));
+                                       
_debug_array($bra5ServiceGet->getResult());
+                                       $GLOBALS['phpgw']->common->phpgw_exit();
 
+                               }
                                if($bra5ServiceGet->getFileAsByteArray(new 
Bra5StructGetFileAsByteArray($this->secKey, $fileid)))
                                {
-//                                     
_debug_array($bra5ServiceGet->getResult());
+                                       
_debug_array($bra5ServiceGet->getResult());
                                        $file_result = 
$bra5ServiceGet->getResult()->getFileAsByteArrayResult;
                                        $file = 
base64_decode($file_result->getFileAsByteArrayResult);
                                }
@@ -188,7 +195,6 @@
                                        $GLOBALS['phpgw']->common->phpgw_exit();
                                }
                        }
-//die();
                        return $file;
                }
 
@@ -382,10 +388,13 @@
                        $att4->setUsesLookupValues(false);
                        
$att4->setAttribType(Bra5EnumBraArkivAttributeType::VALUE_BRAARKIVSTRING);
                        $att4->setName("Byggnr");
-               //      $att4->setValue(new 
Bra5StructArrayOfAnyType(array('139276655')));
-                       $att4->setValue(array('139276655'));
+//                     $att4->setValue(new 
Bra5StructArrayOfAnyType(array('139276655')));
+//                     $att4->setValue(new Bra5StructArrayOfAnyType(new 
Bra5StructArrayOfString('139276655')));
+//                     $att4->setValue(new Bra5StructArrayOfAnyType(new 
Bra5StructArrayOfString(array('139276655'))));
+//                     $att4->setValue(array('139276655'));
+                       $att4->setValue('139276655');
 
-                       //$att4->setValue("139276655");
+               //      $att4->setValue(new 
Bra5StructArrayOfString('139276655'));
                        $attributter[] = $att4;
 
                        $att5 = new Bra5StructAttribute();

Modified: trunk/property/inc/class.boadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.boadmin_entity.inc.php     2015-04-06 17:25:53 UTC 
(rev 12945)
+++ trunk/property/inc/class.boadmin_entity.inc.php     2015-04-06 17:27:05 UTC 
(rev 12946)
@@ -89,11 +89,7 @@
                        'get_category_list'     => true,
                        'get_attrib_list'       => true
                );
-               var $type_app            = array
-                       (
-                       'entity' => 'property',
-                       'catch'  => 'catch'
-               );
+               var $type_app;
 
                function __construct( $session = false )
                {
@@ -125,8 +121,8 @@
                        $this->allrows           = phpgw::get_var( 'allrows', 
'bool' );
                        $this->so                        = CreateObject( 
'property.soadmin_entity', '', '',
                                                                $this->bocommon 
);
-                       $this->so->type          = $this->type;
-                       $this->so->type_app      = $this->type_app;
+                       $this->so->type         = $this->type;
+                       $this->type_app         = $this->so->get_type_app();
                }
 
                function save_sessiondata( $data )

Modified: trunk/property/inc/class.soadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.soadmin_entity.inc.php     2015-04-06 17:25:53 UTC 
(rev 12945)
+++ trunk/property/inc/class.soadmin_entity.inc.php     2015-04-06 17:27:05 UTC 
(rev 12946)
@@ -36,7 +36,13 @@
        {
                var $grants;
                var $type = 'entity';
-               var $type_app;
+
+               var $type_app            = array
+                       (
+                       'entity' => 'property',
+                       'catch'  => 'catch'
+               );
+
                var $bocommon;
                private $move_child = array();
                public $category_tree = array();
@@ -65,6 +71,11 @@
                        }
                }
 
+               function get_type_app()
+               {
+                       return $this->type_app;
+               }
+
                function read($data)
                {
                        if(is_array($data))
@@ -127,14 +138,15 @@
 
                function read_category($data)
                {
-                       $start          = isset($data['start'])&& 
$data['start'] ? $data['start'] : 0;
-                       $query          = 
isset($data['query'])?$data['query']:'';
-                       $sort           = 
isset($data['sort'])?$data['sort']:'DESC';
-                       $order          = 
isset($data['order'])?$data['order']:'';
-                       $allrows        = 
isset($data['allrows'])?$data['allrows']:'';
-                       $entity_id      = isset($data['entity_id'])? 
(int)$data['entity_id']:0;
-                       $type           = isset($data['type']) && $data['type'] 
? $data['type'] : $this->type;
-                       $required       = 
isset($data['required'])?$data['required']:'';
+                       $start                          = 
isset($data['start'])&& $data['start'] ? $data['start'] : 0;
+                       $query                          = 
isset($data['query'])?$data['query']:'';
+                       $sort                           = 
isset($data['sort'])?$data['sort']:'DESC';
+                       $order                          = 
isset($data['order'])?$data['order']:'';
+                       $allrows                        = 
isset($data['allrows'])?$data['allrows']:'';
+                       $entity_id                      = 
isset($data['entity_id'])? (int)$data['entity_id']:0;
+                       $type                           = isset($data['type']) 
&& $data['type'] ? $data['type'] : $this->type;
+                       $required                       = 
isset($data['required'])?$data['required']:'';
+                       $enable_controller      = 
isset($data['enable_controller'])?$data['enable_controller']:'';
 
                        if ($order)
                        {
@@ -153,8 +165,12 @@
                                $query = $this->db->db_addslashes($query);
                                $querymethod = " AND name {$this->like} 
'%{$query}%' OR descr {$this->like} '%{$query}%'";
                        }
+                       if($enable_controller)
+                       {
+                               $querymethod .= " AND (enable_controller = 1 OR 
parent_id IS NOT NULL)";
+                       }
 
-                       $sql = "SELECT * FROM {$table} WHERE 
entity_id={$entity_id} {$querymethod}";
+                       $sql = "SELECT id FROM {$table} WHERE 
entity_id={$entity_id} {$querymethod}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db->num_rows();
@@ -169,40 +185,28 @@
                        }
 
                        $values = array();
+                       $ids = array();
                        while ($this->db2->next_record())
                        {
-                               $id     = $this->db2->f('id');
-                               $category = array
-                               (
-                                       'entity_id'             => $entity_id,
-                                       'id'                    => $id,
-                                       'name'                  => 
$this->db2->f('name'),
-                                       'prefix'                => 
$this->db2->f('prefix'),
-                                       'descr'                 => 
$this->db2->f('descr'),
-                                       'level'                 => 
$this->db2->f('level'),
-                                       'parent_id'             => 
$this->db2->f('parent_id'),
-                                       'is_eav'                => 
$this->db2->f('is_eav'),
-                                       'enable_bulk'   => 
$this->db2->f('enable_bulk'),
-                               );
+                               $ids[]  = $this->db2->f('id');
+                       }
 
-                               if($required)
+                       if($enable_controller)
+                       {
+                               $bypass = false;
+                       }
+                       else
+                       {
+                               $bypass = true;
+                       }
+                       foreach($ids as $id)
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$type], 
".{$type}.{$entity_id}.{$id}");
+                               if(!$required || ($required && 
$GLOBALS['phpgw']->acl->check(".{$type}.{$entity_id}.{$id}", $required, 
$this->type_app[$type])))
                                {
-                                       
if($GLOBALS['phpgw']->acl->check(".{$type}.{$entity_id}.{$id}", $required, 
$this->type_app[$type]))
-                                       {
-                                               $values[] = $category;
-                                       }
+                                       $values[] = 
$this->get_single_category($location_id, $bypass); //don't look for bulk / 
controller flags
                                }
-                               else
-                               {
-                                       $values[] = $category;
-                               }
                        }
-
-                       foreach ($values as &$entry)
-                       {
-                               $entry['location_id'] = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$type], 
".{$type}.{$entity_id}.{$entry['id']}");
-                       }
-
                        return $values;
                }
 
@@ -384,6 +388,24 @@
                        return $path;
                }
 
+               public function get_path_location_id($entity_id, $node)
+               {
+                       $table = "fm_{$this->type}_category";
+                       $sql = "SELECT location_id, parent_id FROM {$table} 
WHERE entity_id = {$entity_id} AND id = {$node}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $parent_id = $this->db->f('parent_id');
+                       $location_id = $this->db->f('location_id');
+                       $path = array($location_id);
+                       if ($parent_id)
+                       {
+                               $path = 
array_merge($this->get_path_location_id($entity_id, $parent_id), $path);
+                       }
+                       return $path;
+               }
+
                function read_single($id)
                {
 
@@ -426,53 +448,32 @@
 
                function read_single_category($entity_id, $cat_id)
                {
-                       $sql = "SELECT * FROM fm_{$this->type}_category WHERE 
entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $category = array();
-                       if ($this->db->next_record())
-                       {
-                               $category = array
-                               (
-                                       'id'                                    
        => $this->db->f('id'),
-                                       'name'                                  
        => $this->db->f('name',true),
-                                       'descr'                                 
        => $this->db->f('descr',true),
-                                       'prefix'                                
        => $this->db->f('prefix',true),
-                                       'lookup_tenant'                         
=> $this->db->f('lookup_tenant'),
-                                       'tracking'                              
        => $this->db->f('tracking'),
-                                       'location_level'                        
=> $this->db->f('location_level'),
-                                       'location_link_level'           => 
$this->db->f('location_link_level'),
-                                       'fileupload'                            
=> $this->db->f('fileupload'),
-                                       'loc_link'                              
        => $this->db->f('loc_link'),
-                                       'start_project'                         
=> $this->db->f('start_project'),
-                                       'start_ticket'                          
=> $this->db->f('start_ticket'),
-                                       'is_eav'                                
        => $this->db->f('is_eav'),
-                                       'enable_bulk'                           
=> $this->db->f('enable_bulk'),
-                                       'jasperupload'                          
=> $this->db->f('jasperupload'),
-                                       'parent_id'                             
        => $this->db->f('parent_id'),
-                                       'level'                                 
        => $this->db->f('level'),
-                                       'location_id'                           
=> $this->db->f('location_id'),
-                                       'org_unit'                              
=> $this->db->f('org_unit')
-                                       );
-                       }
-
-
-                       return $category;
+                       $location_id = $GLOBALS['phpgw']->locations->get_id( 
$this->type_app[$this->type], ".{$this->type}.{$entity_id}.{$cat_id}");
+                       return $this->get_single_category($location_id);
                }
 
                /**
                * Get entity category based on location_id
                * @param int $location_id the system location id
+               * @param bool $bypass  //don't look for bulk / controller flags
                * @return array info about the entity category
                */
-               function get_single_category($location_id)
+               function get_single_category($location_id, $bypass = false)
                {
+                       static $map = array();
+
+                       if ( isset($map[$location_id]) )
+                       {
+                               return $map[$location_id];
+                       }
+
+                       $map[$location_id] = array();
+
                        $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
                        
                        $type_arr = explode('.',  $loc_arr['location']);
-                       
-                       if(!count($type_arr) == 3)
+
+                       if(count($type_arr) != 4)
                        {
                                return array();
                        }
@@ -502,14 +503,34 @@
                                        'start_project'                         
=> $this->db->f('start_project'),
                                        'start_ticket'                          
=> $this->db->f('start_ticket'),
                                        'is_eav'                                
        => $this->db->f('is_eav'),
-                                       'enable_bulk'                           
=> $this->db->f('enable_bulk'),
+                                       'enable_bulk'                           
=> (int) $this->db->f('enable_bulk'),
+                                       'enable_controller'                     
=> (int) $this->db->f('enable_controller'),
                                        'jasperupload'                          
=> $this->db->f('jasperupload'),
                                        'parent_id'                             
        => $this->db->f('parent_id'),
                                        'level'                                 
        => $this->db->f('level'),
+                                       'org_unit'                              
        => $this->db->f('org_unit'),
                                        'location_id'                           
=> $location_id
-                                       );
+                               );
+                       }
+                       if(!$bypass) //inherited settings
+                       {
+                               $path = 
$this->get_path_location_id($category['entity_id'], $category['id']);
 
+                               if(count($path) > 1)
+                               {
+                                       array_pop($path); // only check for 
inherited values
+                                       $sql = "SELECT sum(enable_controller) 
AS enable_controller, sum(enable_bulk) AS enable_bulk FROM fm_{$type}_category 
WHERE location_id IN (" . implode(',', $path) . ')';
+
+                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       while($this->db->next_record())
+                                       {
+                                               //values > 2 indicate iherited 
values
+                                               $category['enable_bulk']        
        += 2 * (int)$this->db->f('enable_bulk');
+                                               $category['enable_controller']  
+= 2 * (int)$this->db->f('enable_controller');
+                                       }
+                               }
                        }
+                       $map[$location_id] = $category;
 
                        return $category;
                }
@@ -517,7 +538,7 @@
 
                function read_category_name($entity_id,$cat_id)
                {
-                       $sql = "SELECT * FROM fm_{$this->type}_category WHERE 
entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;
+                       $sql = "SELECT name FROM fm_{$this->type}_category 
WHERE entity_id =" . (int)$entity_id . ' AND id = ' . (int)$cat_id;
                        $this->db->query($sql,__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f('name', true);
@@ -628,6 +649,7 @@
                                        $values['start_ticket'],
                                        $values['is_eav'],
                                        $values['enable_bulk'],
+                                       $values['enable_controller'],
                                        $values['jasperupload'],
                                        $values['parent_id'],
                                        $values['org_unit'],
@@ -636,7 +658,7 @@
 
                        $values_insert  = 
$this->db->validate_insert($values_insert);
 
-                       $this->db->query("INSERT INTO {$table} 
(location_id,entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,enable_bulk,jasperupload,parent_id,org_unit,level
 ) "
+                       $this->db->query("INSERT INTO {$table} 
(location_id,entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,enable_bulk,enable_controller,jasperupload,parent_id,org_unit,level
 ) "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);
 
 
@@ -850,6 +872,7 @@
                                                'start_ticket'                  
        => $entity['start_ticket'],
                                                'is_eav'                        
                => $entity['is_eav'],
                                                'enable_bulk'                   
        => $entity['enable_bulk'],
+                                               'enable_controller'             
        => $entity['enable_controller'],
                                                'jasperupload'                  
        => $entity['jasperupload'],
                                                'parent_id'                     
                => $entity['parent_id'],
                                                'level'                         
                => $level,

Modified: trunk/property/inc/class.sodocument.inc.php
===================================================================
--- trunk/property/inc/class.sodocument.inc.php 2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/inc/class.sodocument.inc.php 2015-04-06 17:27:05 UTC (rev 
12946)
@@ -326,12 +326,13 @@
                                $filter                 = 
isset($data['filter']) && $data['filter'] ? (int) $data['filter']: 0;
                                $entity_id              = 
isset($data['entity_id']) && $data['entity_id'] ? (int)$data['entity_id']:0;
                                $cat_id                 = 
isset($data['cat_id']) && $data['cat_id'] ? (int)$data['cat_id']: 0;
+                               $id                             = 
isset($data['id']) && $data['id'] ? (int)$data['id']: 0;
                                $doc_type               = 
isset($data['doc_type']) && $data['doc_type'] ? $data['doc_type']: 0;
                                $allrows                = 
isset($data['allrows'])?$data['allrows']:'';
                                $location_code  = 
isset($data['location_code'])?$data['location_code']:'';
                        }
 
-                       if( !$location_code )
+                       if( !$location_code && !($entity_id && $cat_id ))
                        {
                                return array();
                        }
@@ -362,10 +363,16 @@
                        }
                        if ($cat_id > 0)
                        {
-                               $filtermethod .= " $where 
fm_document.p_cat_id={$cat_id} AND fm_document.p_entity_id={$entity_id} ";
+                               $filtermethod .= " $where 
fm_document.p_cat_id={$cat_id} AND fm_document.p_entity_id={$entity_id}";
                                $where = 'AND';
                        }
 
+                       if ($id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_document.p_num='{$id}'";
+                               $where = 'AND';
+                       }
+
                        if ($filter > 0)
                        {
                                $filtermethod .= "  $where 
fm_document.user_id='$filter' ";

Modified: trunk/property/inc/class.soentity.inc.php
===================================================================
--- trunk/property/inc/class.soentity.inc.php   2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/inc/class.soentity.inc.php   2015-04-06 17:27:05 UTC (rev 
12946)
@@ -443,12 +443,32 @@
                        $control_registered= isset($data['control_registered']) 
? $data['control_registered'] : '';
                        $control_id             = isset($data['control_id']) && 
$data['control_id'] ? $data['control_id'] : 0;
                        $org_units              = isset($data['org_units']) && 
is_array($data['org_units']) ? $data['org_units'] : array();
+                       $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
 
+                       if($location_id)
+                       {
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $type_arr = explode('.',  $loc_arr['location']);
+                               if(count($type_arr) != 4)
+                               {
+                                       return array();
+                               }
+
+                               $this->type     = $type_arr[1];
+                               $entity_id      = $type_arr[2];
+                               $cat_id         = $type_arr[3];
+
+                       }
                        if(!$entity_id || !$cat_id)
                        {
                                return array();
                        }
 
+                       if(!$location_id)
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
+                       }
+
                        $grants         = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}",$this->type_app[$this->type]);
 
                        if(!$grants)
@@ -464,7 +484,6 @@
 
                        $category = 
$admin_entity->read_single_category($entity_id,$cat_id);
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        $entity_table = 'fm_bim_item';
                        $choice_table = 'phpgw_cust_choice';
                        $attribute_table = 'phpgw_cust_attribute';
@@ -1185,12 +1204,32 @@
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
                        $custom_condition= isset($data['custom_condition']) ? 
$data['custom_condition'] : '';
                        $org_units              = isset($data['org_units']) && 
is_array($data['org_units']) ? $data['org_units'] : array();
+                       $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
 
+                       if($location_id)
+                       {
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $type_arr = explode('.',  $loc_arr['location']);
+                               if(count($type_arr) != 4)
+                               {
+                                       return array();
+                               }
+
+                               $this->type     = $type_arr[1];
+                               $entity_id      = $type_arr[2];
+                               $cat_id         = $type_arr[3];
+
+                       }
                        if(!$entity_id || !$cat_id)
                        {
                                return array();
                        }
 
+                       if(!$location_id)
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
+                       }
+
                        $grants         = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}",$this->type_app[$this->type]);
 
                        if(!$grants)
@@ -1206,7 +1245,6 @@
 
                        $category = 
$admin_entity->read_single_category($entity_id,$cat_id);
 
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
                        
$this->get_cols($category,$entity_id,$cat_id,$lookup,$location_id);
 

Modified: trunk/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- trunk/property/inc/class.uiadmin_entity.inc.php     2015-04-06 17:25:53 UTC 
(rev 12945)
+++ trunk/property/inc/class.uiadmin_entity.inc.php     2015-04-06 17:27:05 UTC 
(rev 12946)
@@ -557,6 +557,8 @@
                        $uicols['descr'][6]     = lang('is_eav');
                        $uicols['name'][6]      = 'enable_bulk';
                        $uicols['descr'][6]     = lang('enable bulk');
+                       $uicols['name'][7]      = 'enable_controller';
+                       $uicols['descr'][7]     = lang('enable controller');
                        $j = 0;
                        $count_uicols_name = count($uicols['name']);
 
@@ -1199,6 +1201,7 @@
                                        'value_start_ticket'                    
        => $values['start_ticket'],
                                        'value_is_eav'                          
                => $values['is_eav'],
                                        'value_enable_bulk'                     
                => $values['enable_bulk'],
+                                       'value_enable_controller'               
        => $values['enable_controller'],
                                        'jasperupload'                          
                => true,
                                        'category_list'                         
                => $category_list,
                                        'parent_list'                           
                => $parent_list

Modified: trunk/property/inc/class.uidocument.inc.php
===================================================================
--- trunk/property/inc/class.uidocument.inc.php 2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/inc/class.uidocument.inc.php 2015-04-06 17:27:05 UTC (rev 
12946)
@@ -1114,8 +1114,7 @@
 
                                if(phpgw::get_var('p_num'))
                                {
-                                       $_values        = 
execMethod('property.soentity.read_single',array('entity_id'=>$p_entity_id,'cat_id'=>$p_cat_id,
 'num' => phpgw::get_var('p_num')));
-       
+                                       $_values        = 
execMethod('property.soentity.read_single',array('entity_id'=>$p_entity_id,'cat_id'=>$p_cat_id,
 'id' => phpgw::get_var('p_num')));
                                        $location = 
$this->bo->read_location_data($_values['location_code']);
                                        $location_code = 
$_values['location_code'];
                                        unset($_values);

Modified: trunk/property/inc/class.uientity.inc.php
===================================================================
--- trunk/property/inc/class.uientity.inc.php   2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/inc/class.uientity.inc.php   2015-04-06 17:27:05 UTC (rev 
12946)
@@ -73,7 +73,7 @@
                        'get_controls_at_component'=>true
                        );
 
-               function property_uientity()
+               function __construct()
                {
                //      $GLOBALS['phpgw_info']['flags']['nonavbar'] = true; // 
menus added where needed via bocommon::get_menu
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
@@ -1956,7 +1956,7 @@
                                        $active_tab = $active_tab ? $active_tab 
: 'location';
                                }
 
-                               $_enable_controller = false;
+                               $_enable_controller = 
!!$category['enable_controller'];
                                if($_enable_controller)
                                {
                                        $tabs['controller']     = array('label' 
=> lang('controller'), 'link' => '#controller', 'function' => 
"set_tab('controller')");
@@ -2201,7 +2201,7 @@
                        (
                                'name'          => "0",
                                'values'        =>      json_encode(array(      
array('key' => 
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
-                               array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
+                               array('key' => 
'delete_file','label'=>lang('Delete 
file'),'sortable'=>false,'resizeable'=>true))) 
//,'formatter'=>'FormatterCenter')))
                        );
 
 
@@ -2388,6 +2388,7 @@
 
                        
if(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
                        {
+                               $location_id            = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
                                $_controls = 
$this->get_controls_at_component($location_id, $id);
 
                                $datavalues[4] = array
@@ -2404,7 +2405,9 @@
                                (
                                        'name'          => "4",
                                        'values'        =>      
json_encode(array(
-                                                       array('key' => 
'control_id','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
+
+                                                       array('key' => 
'serie_id','label'=>'serie','sortable'=>false,'resizeable'=>true),
+                                                       array('key' => 
'control_id','label'=>lang('controller'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'assigned_to_name','label'=>lang('user'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'start_date','label'=>lang('start date'),'sortable'=>false,'resizeable'=>true),
@@ -2413,7 +2416,7 @@
                                                        array('key' => 
'controle_time','label'=>lang('controle 
time'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'service_time','label'=>lang('service 
time'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'total_time','label'=>lang('total time'),'sortable'=>false,'resizeable'=>true),
-       //                                              array('key' => 
'enabled','label'=>lang('enabled'),'sortable'=>false,'resizeable'=>true),
+                                                       array('key' => 
'relation_enabled','label'=>lang('enabled'),'sortable'=>false,'resizeable'=>true),
                                                        array('key' => 
'location_id','hidden'=>true),
                                                        array('key' => 
'component_id','hidden'=>true),
                                                        array('key' => 
'id','hidden'=>true),
@@ -2423,7 +2426,6 @@
                                );
 
                                $lang_controller = 
$GLOBALS['phpgw']->translation->translate('controller', array(),false , 
'controller');
-                               $location_id            = 
$GLOBALS['phpgw']->locations->get_id('property', $this->acl_location);
                                $socase                         = 
CreateObject('controller.socase');
                                $controller_cases       = 
$socase->get_cases_by_component($location_id, $id);
                                $_statustext = array();
@@ -3554,14 +3556,6 @@
                                        "3"=> lang('year')
                                );
 
-                       $control_link_data = array
-                               (
-                                       'menuaction'    => 
'controller.uicalendar.view_calendar_year_for_locations',
-                                       'control_id'    => $entry['control_id'],
-                                       'location_id'   => $location_id,
-                                       'component_id'  => $id,
-                               );
-
                        $controls = 
execMethod('controller.socontrol.get_controls_at_component', 
array('location_id' => $location_id, 'component_id' => $id));
                        foreach($controls as &$entry)
                        {
@@ -3577,6 +3571,7 @@
                                        'control_id'    => $entry['control_id'],
                                        'location_id'   => $location_id,
                                        'component_id'  => $id,
+                                       'serie_id'              => 
$entry['serie_id']
                                );
                                $entry['title'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$control_link_data).'" 
target="_blank">'.$entry['title'].'</a>';
 

Modified: 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
===================================================================
--- 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
        2015-04-06 17:25:53 UTC (rev 12945)
+++ 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
        2015-04-06 17:27:05 UTC (rev 12946)
@@ -240,7 +240,11 @@
                                }
                                else if( preg_match('/^STATUS/i', $file_name) )
                                {
-                                       $ok = $this->update_status($data);
+                                       $ok = true;
+                                       if(trim($data[2]))//check for order_id
+                                       {
+                                               $ok = 
$this->update_status($data);
+                                       }
                                }
                        }
 

Modified: trunk/property/inc/soap_client/bra5/soap.php
===================================================================
--- trunk/property/inc/soap_client/bra5/soap.php        2015-04-06 17:25:53 UTC 
(rev 12945)
+++ trunk/property/inc/soap_client/bra5/soap.php        2015-04-06 17:27:05 UTC 
(rev 12946)
@@ -190,6 +190,7 @@
 */
        if($bra5ServiceSearch->searchAndGetDocuments(new 
Bra5StructSearchAndGetDocuments($secKey,$_baseclassname = 
'Eiendomsarkiver',$classname,$_where = "Byggnr = {$bygningsnr}",$_maxhits = 
-1)))
        {
+//             _debug_array($bra5ServiceSearch->getResult());die();
                $_result = 
$bra5ServiceSearch->getResult()->getsearchAndGetDocumentsResult()->getExtendedDocument()->getsearchAndGetDocumentsResult()->ExtendedDocument;
        }
 

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2015-04-06 17:25:53 UTC (rev 12945)
+++ trunk/property/setup/phpgw_no.lang  2015-04-06 17:27:05 UTC (rev 12946)
@@ -2039,4 +2039,6 @@
 tender received        property        no      Mottatt tilbud
 inspection on completion       property        no      Ferdigbefaring
 end date delay property        no      Forsinket utførelse
-tender delay   property        no      Forsinket tilbud
\ No newline at end of file
+tender delay   property        no      Forsinket tilbud
+enable bulk    common  no      Aktiver bulk
+enable controller      common  no      Aktiver Kontroll
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2015-04-06 17:25:53 UTC (rev 12945)
+++ trunk/property/setup/setup.inc.php  2015-04-06 17:27:05 UTC (rev 12946)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.685';
+       $setup_info['property']['version']              = '0.9.17.686';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/setup/tables_current.inc.php 2015-04-06 17:27:05 UTC (rev 
12946)
@@ -1936,6 +1936,7 @@
                                'start_ticket' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'is_eav' => array('type' => 'int','precision' 
=> '2','nullable' => True),
                                'enable_bulk' => array('type' => 
'int','precision' => '2','nullable' => True),
+                               'enable_controller' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'jasperupload' => array('type' => 
'int','precision' => '2','nullable' => True),
                                'parent_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'level' => array('type' => 'int','precision' => 
'4','nullable' => True),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2015-04-06 17:25:53 UTC (rev 
12945)
+++ trunk/property/setup/tables_update.inc.php  2015-04-06 17:27:05 UTC (rev 
12946)
@@ -8166,3 +8166,26 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.685 to 0.9.17.686
+       * Add controller-flag to entities
+       */
+       $test[] = '0.9.17.685';
+       function property_upgrade0_9_17_685()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_entity_category','enable_controller',array(
+                               'type' =>       'int',
+                               'precision' => 2,
+                               'nullable' => true
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.686';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/admin_entity.xsl
===================================================================
--- trunk/property/templates/base/admin_entity.xsl      2015-04-06 17:25:53 UTC 
(rev 12945)
+++ trunk/property/templates/base/admin_entity.xsl      2015-04-06 17:27:05 UTC 
(rev 12946)
@@ -838,6 +838,29 @@
                                                        </input>
                                                </td>
                                        </tr>
+                                       <tr>
+                                               <td>
+                                                       <xsl:value-of 
select="php:function('lang', 'enable controller')"/>
+                                               </td>
+                                               <td>
+                                                       <input type="checkbox" 
name="values[enable_controller]" value="1">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="php:function('lang', 'This category is allowed to link to 
controller')"/>
+                                                               </xsl:attribute>
+                                                               <xsl:if 
test="value_enable_controller > '0'">
+                                                                       
<xsl:attribute name="checked">
+                                                                               
<xsl:text>checked</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+                                                               <xsl:if 
test="value_enable_controller > '1'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+
+                                                       </input>
+                                               </td>
+                                       </tr>
                                        <xsl:choose>
                                                <xsl:when 
test="lang_location_level != ''">
                                                        <tr>




reply via email to

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