fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8278] property: more generic responsibilities, filte


From: Sigurd Nes
Subject: [Fmsystem-commits] [8278] property: more generic responsibilities, filter on appname
Date: Tue, 13 Dec 2011 08:46:50 +0000

Revision: 8278
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8278
Author:   sigurdne
Date:     2011-12-13 08:46:49 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
property: more generic responsibilities, filter on appname

Modified Paths:
--------------
    trunk/property/inc/class.bogeneric.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.uigeneric.inc.php
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php

Modified: trunk/property/inc/class.bogeneric.inc.php
===================================================================
--- trunk/property/inc/class.bogeneric.inc.php  2011-12-13 08:43:24 UTC (rev 
8277)
+++ trunk/property/inc/class.bogeneric.inc.php  2011-12-13 08:46:49 UTC (rev 
8278)
@@ -41,6 +41,7 @@
                var $order;
                var $cat_id;
                var $location_info = array();
+               var $appname;
 
 
                function __construct($session=false)
@@ -56,9 +57,16 @@
                        $filter                         = 
phpgw::get_var('filter', 'int');
                        $cat_id                         = 
phpgw::get_var('cat_id', 'int');
                        $allrows                        = 
phpgw::get_var('allrows', 'bool');
+                       $appname                        = 
phpgw::get_var('appname', 'string');
+
+                       if($appname)
+                       {
+                               $this->appname          = $appname;
+                               $this->so->appname      = $appname;
+                       }
+
                        $type                           = 
phpgw::get_var('type');
                        $type_id                        = 
phpgw::get_var('type_id', 'int', 'REQUEST', 0);
-
                        $this->type             = $type;
                        $this->type_id          = $type_id;
 

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2011-12-13 08:43:24 UTC (rev 
8277)
+++ trunk/property/inc/class.sogeneric.inc.php  2011-12-13 08:46:49 UTC (rev 
8278)
@@ -39,6 +39,7 @@
                var $location_info = array();
                var $tree = array();
                protected $table;
+               var $appname = 'property';
 
                function __construct()
                {
@@ -178,6 +179,33 @@
                                $where = 'AND';
                        }
 
+                       if(isset($this->location_info['filter']) && 
$this->location_info['filter'] && is_array($this->location_info['filter']))
+                       {
+                               $_filtermethod = array();
+                               foreach($this->location_info['filter'] as 
$_argument => $_argument_value)
+                               {
+                                       if(preg_match('/^##/', 
$_argument_value))
+                                       {
+                                               $_argument_value_name = 
trim($_argument_value,'#');
+                                               $_argument_value = 
$values[$_argument_value_name];
+                                       }
+                                       if(preg_match('/^\$this->/', 
$_argument_value))
+                                       {
+                                               $_argument_value_name = 
ltrim($_argument_value,'$this->');
+                                               $_argument_value = 
$this->$_argument_value_name;
+                                       }                                       
                        
+                                       
+                                       $_filtermethod[] = "{$_argument} = 
'{$_argument_value}'";
+                               }
+
+
+                               if($_filtermethod)
+                               {
+                                       $filtermethod = "{$where} " . implode(' 
AND ', $_filtermethod);
+                                       $where = 'AND';
+                               }
+                       }
+
                        if($_filter_array)
                        {
                                $filtermethod .= " $where " . implode(' AND ', 
$_filter_array);
@@ -1940,11 +1968,13 @@
                                                'menu_selection'        => 
'admin::property::responsibility_role',
                                                'default'                       
=> array
                                                (
+                                                       'appname'               
=> array('add'  => '$this->appname'),
                                                        'user_id'               
=> array('add'  => '$this->account'),
                                                        'entry_date'    => 
array('add'  => 'time()'),
                                                        'modified_date' => 
array('edit' => 'time()'),
                                                ),
-                                               'check_grant'           => false
+                                               'check_grant'           => 
false,
+                                               'filter'                        
=> array('appname' => '$this->appname')
                                        );
 
                                break;

Modified: trunk/property/inc/class.uigeneric.inc.php
===================================================================
--- trunk/property/inc/class.uigeneric.inc.php  2011-12-13 08:43:24 UTC (rev 
8277)
+++ trunk/property/inc/class.uigeneric.inc.php  2011-12-13 08:46:49 UTC (rev 
8278)
@@ -82,8 +82,7 @@
                        $this->type             = $this->bo->type;
                        $this->type_id          = $this->bo->type_id;
 
-                       $appname = phpgw::get_var('appname', 'string');
-                       if($appname)
+                       if($appname = $this->bo->appname)
                        {
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] = str_replace('property', 
$appname, $GLOBALS['phpgw_info']['flags']['menu_selection']);
                                $this->appname = $appname;

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2011-12-13 08:43:24 UTC (rev 8277)
+++ trunk/property/setup/setup.inc.php  2011-12-13 08:46:49 UTC (rev 8278)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.628';
+       $setup_info['property']['version']              = '0.9.17.629';
        $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 2011-12-13 08:43:24 UTC (rev 
8277)
+++ trunk/property/setup/tables_current.inc.php 2011-12-13 08:46:49 UTC (rev 
8278)
@@ -2131,6 +2131,7 @@
                                'remark' => array('type' => 'text','nullable' 
=> True),
                                'location' => array('type' => 'varchar', 
'precision' => 200,'nullable' => False),
                                'responsibility_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
+                               'appname' => array('type' => 'varchar', 
'precision' => 25,'nullable' => False),
                                'user_id' => array('type' => 'int', 'precision' 
=> 4,'nullable' => True),
                                'entry_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'modified_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2011-12-13 08:43:24 UTC (rev 
8277)
+++ trunk/property/setup/tables_update.inc.php  2011-12-13 08:46:49 UTC (rev 
8278)
@@ -5540,7 +5540,7 @@
 
        /**
        * Update property version from 0.9.17.626 to 0.9.17.627
-       * Add assign voucher id on export from system
+       * Alter primary key
        */
        $test[] = '0.9.17.627';
        function property_upgrade0_9_17_627()
@@ -5558,10 +5558,26 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.627 to 0.9.17.628
+       * Add appname to responsibility_role in order to filter by defining app.
+       */
+       $test[] = '0.9.17.628';
+       function property_upgrade0_9_17_628()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_responsibility_role', 
'appname',array('type' => 'varchar','precision' => 25,'nullable' => True));
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_responsibility_role SET appname = 'property'",__LINE__,__FILE__);
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_responsibility_role','appname',array('type'
 => 'varchar','precision' => '25','nullable' => false));
 
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.629';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
 
-
        /**
        * Update property version from 0.9.17.607 to 0.9.17.608
        * Add more room for address at tickets




reply via email to

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