fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10194] display of list in admin


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [10194] display of list in admin
Date: Wed, 10 Oct 2012 11:08:15 +0000

Revision: 10194
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10194
Author:   erikhl
Date:     2012-10-10 11:08:14 +0000 (Wed, 10 Oct 2012)
Log Message:
-----------
display of list in admin

Modified Paths:
--------------
    trunk/logistic/inc/class.soresource_type_requirement.inc.php
    trunk/logistic/inc/class.uiresource_type_requirement.inc.php
    trunk/logistic/inc/model/class.resource_type_requirement.inc.php

Modified: trunk/logistic/inc/class.soresource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.soresource_type_requirement.inc.php        
2012-10-10 10:24:54 UTC (rev 10193)
+++ trunk/logistic/inc/class.soresource_type_requirement.inc.php        
2012-10-10 11:08:14 UTC (rev 10194)
@@ -121,13 +121,27 @@
 
                        $tables = "lg_resource_type_requirement 
type_requirement";
 
-                       if($return_count) // We should only return a count
+                       if($search_type && $search_type == 
'resource_type_requirement_list')
                        {
-                               $cols = 'COUNT(DISTINCT(type_requirement.id)) 
AS count';
+                               if($return_count) // We should only return a 
count
+                               {
+                                       $cols = 
'COUNT(DISTINCT(type_requirement.location_id, 
type_requirement.project_type_id)) AS count';
+                               }
+                               else
+                               {
+                                       $cols .= 
"DISTINCT(type_requirement.location_id, type_requirement.project_type_id) as 
id, (type_requirement.location_id * type_requirement.project_type_id) as id, 
type_requirement.location_id, type_requirement.project_type_id ";
+                               }
                        }
                        else
                        {
-                               $cols .= "type_requirement.* ";
+                               if($return_count) // We should only return a 
count
+                               {
+                                       $cols = 
'COUNT(DISTINCT(type_requirement.id)) AS count';
+                               }
+                               else
+                               {
+                                       $cols .= "type_requirement.* ";
+                               }
                        }
 
                        $dir = $ascending ? 'ASC' : 'DESC';

Modified: trunk/logistic/inc/class.uiresource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uiresource_type_requirement.inc.php        
2012-10-10 10:24:54 UTC (rev 10193)
+++ trunk/logistic/inc/class.uiresource_type_requirement.inc.php        
2012-10-10 11:08:14 UTC (rev 10194)
@@ -111,6 +111,12 @@
                        //var_dump($query_type);
                        switch ($query_type)
                        {
+                               case 'resource_type_requirement_list':
+                                       $search_type = 
'resource_type_requirement_list';
+                                       $sort_field = 
'type_requirement.location_id';
+                                       $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
+                                       $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
+                                       break;
                                default: // ... all composites, filters (active 
and vacant)
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
@@ -188,11 +194,18 @@
                                        ),
                                ),
                                'datatable' => array(
-                                       'source' => 
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.index', 
'phpgw_return_as' => 'json')),
+                                       'source' => 
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.index', 
'phpgw_return_as' => 'json', 'type' => 'resource_type_requirement_list')),
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
                                                        'label' => lang('ID'),
+                                                       'sortable' => false,
+                                                       'hidden' => true,
+                                                       'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'location_id',
+                                                       'label' => lang('ID'),
                                                        'sortable' => true,
                                                        'formatter' => 
'YAHOO.portico.formatLink'
                                                ),
@@ -349,8 +362,19 @@
                {
                        $entity_so      = 
CreateObject('property.soadmin_entity');
                        $custom = createObject('phpgwapi.custom_fields');
-                       $location_id = phpgw::get_var('location_id');
-                       $project_type_id = phpgw::get_var('project_type_id');
+                       $id_fields = phpgw::get_var('id');
+                       if($id_fields && $id_fields != '')
+                       {
+                               $id_array = explode('-', $id_fields);
+                               $location_id = $id_array[0];
+                               $project_type_id = $id_array[1];
+                       }
+                       else
+                       {
+                               $location_id = phpgw::get_var('location_id');
+                               $project_type_id = 
phpgw::get_var('project_type_id');
+                       }
+
                        if(isset($_POST['edit']))
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiresource_type_requirement.edit', 
'location_id' => $location_id, 'project_type_id' => $project_type_id));

Modified: trunk/logistic/inc/model/class.resource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/model/class.resource_type_requirement.inc.php    
2012-10-10 10:24:54 UTC (rev 10193)
+++ trunk/logistic/inc/model/class.resource_type_requirement.inc.php    
2012-10-10 11:08:14 UTC (rev 10194)
@@ -107,7 +107,6 @@
                {
                        $entity_so      = 
CreateObject('property.soadmin_entity');
                        $project_so = CreateObject('logistic.soproject');
-               //      $l_loc =  
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$this->get_entity_id()}.{$this->get_category_id()}");
                        $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($this->get_location_id());
                        $entity_arr = explode('.',$loc_arr['location']);
 
@@ -118,7 +117,8 @@
                        $project_type_label  = 
$project_so->get_project_type_label($this->get_project_type_id());
 
                        return array(
-                               'id' => $l_loc,
+                               'id' => 
$this->get_location_id().'-'.$this->get_project_type_id(),
+                               'location_id' => $this->get_location_id(),
                                'entity_label' => $entity_label,
                                'category_label' => $category_label,
                                'project_type_label' => $project_type_label




reply via email to

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