fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15436] Custom filter on autocomplete for custom fiel


From: sigurdne
Subject: [Fmsystem-commits] [15436] Custom filter on autocomplete for custom fields
Date: Tue, 9 Aug 2016 12:32:36 +0000 (UTC)

Revision: 15436
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15436
Author:   sigurdne
Date:     2016-08-09 12:32:36 +0000 (Tue, 09 Aug 2016)
Log Message:
-----------
Custom filter on autocomplete for custom fields

Modified Paths:
--------------
    trunk/property/inc/class.bogeneric.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
    trunk/property/setup/default_records.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  2016-08-09 01:03:02 UTC (rev 
15435)
+++ trunk/property/inc/class.bogeneric.inc.php  2016-08-09 12:32:36 UTC (rev 
15436)
@@ -344,8 +344,33 @@
                                'query' => $query,
                        );
 
+                       foreach ($this->location_info['fields'] as $field)
+                       {
+                               if (isset($field['filter']) && $field['filter'])
+                               {
+                                       $params['filter'][$field['name']] = 
phpgw::get_var($field['name']);
+                               }
+                       }
+
+                       $attributes = 
$this->custom->find($this->location_info['acl_app'], 
$this->location_info['acl_location'], 0, '', 'ASC', 'attrib_sort', true, true);
+
+                       $custom_filter = array();
+                       foreach ($attributes as $attribute_id => $attribute)
+                       {
+                               switch(phpgw::get_var($attribute['name']))
+                               {
+                                       case 'ISNOTNULL':
+                                               $custom_filter[] = 
"{$attribute['name']} IS NOT NULL";
+                                               break;
+                                       case 'ISNULL':
+                                               $custom_filter[] = 
"{$attribute['name']} IS NULL";
+                                               break;
+                                       default:
+                               }
+                       }
+                       $params['custom_filter'] = $custom_filter;
                        $values = $this->read($params);
-
+/*
                        foreach ($values as &$entry)
                        {
                                if ($entry['parent_id'])
@@ -353,6 +378,7 @@
                                        $entry['name'] = "[{$entry['name']}] :: 
 {$entry['parent_id']}";
                                }
                        }
+*/
                        return array('ResultSet' => array('Result' => $values));
                }
 

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2016-08-09 01:03:02 UTC (rev 
15435)
+++ trunk/property/inc/class.sogeneric.inc.php  2016-08-09 12:32:36 UTC (rev 
15436)
@@ -64,6 +64,7 @@
                        $order = isset($data['order']) ? $data['order'] : '';
                        $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
                        $custom_criteria = isset($data['custom_criteria']) && 
$data['custom_criteria'] ? $data['custom_criteria'] : array();
+                       $custom_filter = isset($data['custom_filter']) && 
$data['custom_filter'] ? $data['custom_filter'] : array();
                        $filter = isset($data['filter']) && $data['filter'] ? 
$data['filter'] : array();
                        $results = isset($data['results']) ? 
(int)$data['results'] : 0;
 
@@ -238,6 +239,12 @@
                                $where = 'AND';
                        }
 
+                       if ($custom_filter)
+                       {
+                               $filtermethod .= " $where " . implode(' AND ', 
$custom_filter);
+                               $where = 'AND';
+                       }
+
                        $this->uicols = $uicols;
 
                        if ($order)
@@ -1753,10 +1760,8 @@
                                                (
                                                'table' => 'fm_org_unit',
                                                'id' => array('name' => 'id', 
'type' => 'int'),
-                                               'fields' => array
-                                                       (
-                                                       array
-                                                               (
+                                               'fields' => array(
+                                                       array(
                                                                'name' => 
'name',
                                                                'descr' => 
lang('name'),
                                                                'type' => 
'varchar',
@@ -1764,8 +1769,7 @@
                                                                'size' => 60,
                                                                'sortable' => 
true
                                                        ),
-                                                       array
-                                                               (
+                                                       array(
                                                                'name' => 
'parent_id',
                                                                'descr' => 
lang('parent'),
                                                                'type' => 
'select',
@@ -1779,13 +1783,24 @@
                                                                        
'method' => 'property.bogeneric.get_list',
                                                                        
'method_input' => array('type' => 'org_unit', 'role' => 'parent', 'selected' => 
'##parent_id##')
                                                                )
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked',
+                                                               'filter' => 
true,
+                                                               'sortable' => 
true,
+                                                               'values_def' => 
array(
+                                                                       
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+                                                               )
                                                        )
                                                ),
                                                'edit_msg' => lang('edit'),
                                                'add_msg' => lang('add'),
                                                'name' => lang('department'),
                                                'acl_app' => 'property',
-                                               'acl_location' => '.admin',
+                                               'acl_location' => '.org_unit',
                                                'menu_selection' => 
'admin::property::accounting::org_unit',
                                                'default' => array
                                                        (

Modified: 
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
===================================================================
--- trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-08-09 01:03:02 UTC (rev 15435)
+++ trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-08-09 12:32:36 UTC (rev 15436)
@@ -273,26 +273,26 @@
 
                public function insert_values()
                {
+                       $table = 'fm_org_unit';
 
                        $db = & $GLOBALS['phpgw']->db;
                        $db->transaction_begin();
-
+                       $db->query("UPDATE {$table} SET active = 0", __LINE__, 
__FILE__);
                        $units = $this->unit_ids;
 //                     _debug_array($units);
                        foreach ($units as $unit)
                        {
-                               $value_set = array
-                                       (
+                               $value_set = array(
                                        'id' => $unit['id'],
                                        'parent_id' => $unit['parent'],
                                        'name' => 
$db->db_addslashes($unit['name']),
+                                       'arbeidssted' => $unit['arbeidssted'],
                                        'created_on' => time(),
                                        'created_by' => 
$GLOBALS['phpgw_info']['user']['account_id'],
                                        'modified_by' => 
$GLOBALS['phpgw_info']['user']['account_id'],
                                        'modified_on' => time()
                                );
 
-                               $table = 'fm_org_unit';
                                $db->query("SELECT count(*) as cnt FROM 
{$table} WHERE id =" . (int)$unit['id'], __LINE__, __FILE__);
                                $db->next_record();
 
@@ -304,6 +304,7 @@
                                        {
                                                $this->messages[] = "ID finnes 
fra før: {$unit['id']}, oppdaterer: {$unit['name']}";
                                        }
+                                       $value_set['active'] = 1;
                                        $value_set = 
$db->validate_update($value_set);
                                        $sql = "UPDATE {$table} SET 
{$value_set} WHERE id =" . (int)$unit['id'];
                                }
@@ -369,17 +370,15 @@
                        $db = clone($this->db);
 
                        $sql = "SELECT V_ORG_KNYTNING.*, 
ANT_ENHETER_UNDER,V_ORG_ENHET.ORG_NAVN, V_ORG_ENHET.TJENESTESTED, ORG_NIVAA 
FROM V_ORG_KNYTNING"
-                               . " JOIN V_ORG_ENHET ON 
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_KNYTNING.ORG_ENHET_ID_KNYTNING ) WHERE 
V_ORG_KNYTNING.ORG_ENHET_ID_KNYTNING={$org_unit_id}";
+                               . " JOIN V_ORG_ENHET ON 
(V_ORG_ENHET.ORG_ENHET_ID = V_ORG_KNYTNING.ORG_ENHET_ID ) WHERE 
V_ORG_KNYTNING.ORG_ENHET_ID_KNYTNING={$org_unit_id}";
 
                        $db->query($sql);
 
                        while ($db->next_record())
                        {
-//                             _debug_array($db->Record);
                                $child_org_unit_id = $db->f('ORG_ENHET_ID');
                                $arbeidssted = $db->f('TJENESTESTED');
-                               $this->unit_ids[] = array
-                                       (
+                               $this->unit_ids[] = array(
                                        'id' => $child_org_unit_id,
                                        'name' => 
$this->names[$child_org_unit_id],
                                        'parent' => $org_unit_id,

Modified: trunk/property/setup/default_records.inc.php
===================================================================
--- trunk/property/setup/default_records.inc.php        2016-08-09 01:03:02 UTC 
(rev 15435)
+++ trunk/property/setup/default_records.inc.php        2016-08-09 12:32:36 UTC 
(rev 15436)
@@ -72,6 +72,7 @@
        $GLOBALS['phpgw']->locations->add('.invoice.dimb', 'A dimension for 
accounting', 'property');
        $GLOBALS['phpgw']->locations->add('.scheduled_events', 'Scheduled 
events', 'property');
        $GLOBALS['phpgw']->locations->add('.project.condition_survey', 
'Condition Survey', 'property', true, 'fm_condition_survey', true);
+       $GLOBALS['phpgw']->locations->add('.org_unit', 'Org unit', 'property', 
false, 'fm_org_unit', false, true);
 
        $locations = array(
                'property.ticket' => '.ticket',

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2016-08-09 01:03:02 UTC (rev 15435)
+++ trunk/property/setup/setup.inc.php  2016-08-09 12:32:36 UTC (rev 15436)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.702';
+       $setup_info['property']['version']              = '0.9.17.703';
        $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 2016-08-09 01:03:02 UTC (rev 
15435)
+++ trunk/property/setup/tables_current.inc.php 2016-08-09 12:32:36 UTC (rev 
15436)
@@ -1222,6 +1222,7 @@
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
                                'parent_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => true),
                                'name' => array('type' => 'varchar', 
'precision' => '200', 'nullable' => False),
+                               'active' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True, 'default' => 1),
                                'created_on' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
                                'created_by' => array('type' => 'int', 
'precision' => 4, 'nullable' => False),
                                'modified_by' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-08-09 01:03:02 UTC (rev 
15435)
+++ trunk/property/setup/tables_update.inc.php  2016-08-09 12:32:36 UTC (rev 
15436)
@@ -9203,3 +9203,30 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.702 to 0.9.17.703
+       *
+       */
+       $test[] = '0.9.17.702';
+
+       function property_upgrade0_9_17_702()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw']->locations->add('.org_unit', 'Org unit', 
'property', false, 'fm_org_unit', false, true);
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_org_unit", 
'active', array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => True,
+                       'default' => 1
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.703';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }




reply via email to

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