[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15455] Property: generic
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15455] Property: generic |
Date: |
Fri, 12 Aug 2016 14:56:36 +0000 (UTC) |
Revision: 15455
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15455
Author: sigurdne
Date: 2016-08-12 14:56:35 +0000 (Fri, 12 Aug 2016)
Log Message:
-----------
Property: generic
Modified Paths:
--------------
trunk/property/inc/class.bogeneric.inc.php
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/class.soresponsible.inc.php
Modified: trunk/property/inc/class.bogeneric.inc.php
===================================================================
--- trunk/property/inc/class.bogeneric.inc.php 2016-08-12 14:54:46 UTC (rev
15454)
+++ trunk/property/inc/class.bogeneric.inc.php 2016-08-12 14:56:35 UTC (rev
15455)
@@ -138,32 +138,30 @@
public function read( $data = array() )
{
-
- /* $values = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
- 'allrows'=>$this->allrows),$filter); */
-
$values = $this->so->read($data);
- foreach ($this->location_info['fields'] as $field)
+ foreach ($values as &$entry)
{
- if (isset($field['role']) && $field['role'] ==
'parent')
+ foreach ($this->location_info['fields'] as
$field)
{
- foreach ($values as &$entry)
+ if (isset($entry[$field['name']]) &&
$entry[$field['name']])
{
- if
(isset($entry[$field['name']]) && $entry[$field['name']])
+ if
(isset($field['values_def']['get_single_value']) &&
$field['values_def']['get_single_value'] == 'get_user')
{
+ $entry[$field['name']]
= $GLOBALS['phpgw']->accounts->get($entry[$field['name']])->__toString();
+ }
+ else if (isset($field['role'])
&& $field['role'] == 'parent')
+ {
$path =
$this->so->get_path(array('type' => $this->type, 'id' =>
$entry[$field['name']]));
$entry[$field['name']]
= implode(' > ', $path);
}
+ else if
(isset($field['values_def']['get_single_value']) &&
$field['values_def']['get_single_value'])
+ {
+ $entry[$field['name']]
= execMethod($field['values_def']['get_single_value'], array_merge(array('id'
=> $entry[$field['name']]),$field['values_def']['method_input'] ));
+ }
}
+
}
- if
(isset($field['values_def']['get_single_value']) &&
$field['values_def']['get_single_value'])
- {
- foreach ($values as &$entry)
- {
- $entry[$field['name']] =
execMethod($field['values_def']['get_single_value'], $entry[$field['name']]);
- }
- }
}
$this->total_records = $this->so->total_records;
@@ -256,7 +254,7 @@
{
foreach ($values as &$entry)
{
- $entry['selected'] =
isset($data['selected']) && trim($data['selected']) == trim($entry['id']) ? 1 :
0;
+ $entry['selected'] =
isset($data['selected']) && trim($data['selected']) === trim($entry['id']) ? 1
: 0;
}
}
return $values;
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2016-08-12 14:54:46 UTC (rev
15454)
+++ trunk/property/inc/class.sogeneric.inc.php 2016-08-12 14:56:35 UTC (rev
15455)
@@ -92,36 +92,6 @@
}
}
- /*
- $valid_order = false;
-
- if($order)
- {
- if($this->location_info['id']['name'] != $order)
- {
-
- foreach ($this->location_info['fields'] as $field)
- {
- if($field['name'] == $order)
- {
- $valid_order = true;
- break;
- }
- }
- }
- else
- {
- $valid_order = true;
- }
-
- if(!$valid_order)
- {
- // $order = '';
- }
- }
- */
-
- $get_single = array();
foreach ($this->location_info['fields'] as $field)
{
if (isset($field['filter']) && $field['filter'])
@@ -135,10 +105,6 @@
$_filter_array[] =
"{$field['name']} = '{$filter[$field['name']]}'";
}
}
- if (isset($field['get_single']) &&
$field['get_single'])
- {
- $get_single[$field['name']] =
$field['get_single'];
- }
}
$uicols = array();
@@ -371,32 +337,6 @@
$values = $this->custom->translate_value($dataset,
$location_id);
- if ($get_single)
- {
- foreach ($values as $set => &$entry)
- {
- foreach ($entry as $field => &$value)
- {
- foreach ($get_single as $key =>
$method)
- {
- if ($field == $key)
- {
- switch ($method)
- {
- case
'get_user':
-
if ($value)
-
{
-
$value = $GLOBALS['phpgw']->accounts->get($value)->__toString();
-
}
-
break;
- default:
- //
nothing
- }
- }
- }
- }
- }
- }
return $values;
}
@@ -441,6 +381,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'district', 'selected' => '##district_id##')
)
),
@@ -489,6 +430,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'org_unit', 'selected' => '##org_unit_id##')
)
)
@@ -777,6 +719,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'vendor_cats', 'selected' => '##category##')
)
),
@@ -838,6 +781,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'owner_cats', 'selected' => '##category##')
)
),
@@ -882,6 +826,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'tenant_cats', 'selected' => '##category##')
)
)
@@ -1559,6 +1504,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'ns3420', 'role' => 'parent', 'selected' =>
'##parent_id##',
'id_in_name' => 'num', 'mapping' => array('name' => 'tekst1')
)
@@ -1674,6 +1620,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'b_account', 'selected' =>
'##category##')//b_account_category
)
),
@@ -1692,10 +1639,10 @@
'descr' =>
lang('responsible'),
'type' =>
'select',
'filter' =>
true,
- 'get_single' =>
'get_user',
'values_def' =>
array
(
'valueset' => false,
+
'get_single_value' => 'get_user',
'method' => 'property.bocommon.get_user_list_right2',
'method_input' => array('selected' => '##responsible##', 'right' => 128,
'acl_location' => '.invoice')
@@ -1878,6 +1825,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'dimb_role', 'selected' => '##role_id##')
)
),
@@ -1887,10 +1835,10 @@
'descr' =>
lang('user'),
'type' =>
'select',
'filter' =>
true,
- 'get_single' =>
'get_user',
'values_def' =>
array
(
'valueset' => false,
+
'get_single_value' => 'get_user',
'method' => 'property.bocommon.get_user_list_right2',
'method_input' => array('selected' => '##user_id##', 'right' => 1,
'acl_location' => '.invoice')
)
@@ -2614,6 +2562,7 @@
(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'periodization', 'selected' =>
'##periodization_id##')
)
),
@@ -2867,18 +2816,16 @@
(
'table' => 'bb_office_user',
'id' => array('name' => 'id',
'type' => 'auto'),
- 'fields' => array
- (
- array
- (
+ 'fields' => array(
+ array(
'name' =>
'office',
'descr' =>
$GLOBALS['phpgw']->translation->translate('office', array(), false, 'booking'),
'type' =>
'select',
'filter' =>
true,
- 'values_def' =>
array
- (
+ 'values_def' =>
array(
'valueset' => false,
'method' => 'property.bogeneric.get_list',
+
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'bb_office', 'selected' => '##office##')
)
)
@@ -2952,6 +2899,52 @@
// END CONTROLLER TABLES
// START RENTAL TABLES
+ case 'location_factor':
+ $info = array
+ (
+ 'table' =>
'rental_location_factor',
+ 'id' => array('name' => 'id',
'type' => 'auto'),
+ 'fields' => array(
+ array(
+ 'name' =>
'part_of_town_id',
+ 'descr' =>
lang('location'),
+ 'type' =>
'select',
+ 'nullable' =>
false,
+ 'filter' =>
true,
+ 'values_def' =>
array(
+
'valueset' => false,
+
'get_single_value' => 'property.sogeneric.get_name',
+
'method' => 'property.bogeneric.get_list',
+
'method_input' => array('type' => 'part_of_town', 'selected' =>
'##part_of_town_id##')
+ )
+ ),
+ array(
+ 'name' =>
'factor',
+ 'descr' =>
lang('factor'),
+ 'type' =>
'numeric',
+ 'nullable' =>
false,
+ 'size' => 4,
+ 'sortable' =>
true
+ ),
+ array(
+ 'name' =>
'remark',
+ 'descr' =>
lang('remark'),
+ 'type' => 'text'
+ )
+ ),
+ 'edit_msg' => lang('edit unit'),
+ 'add_msg' => lang('add unit'),
+ 'name' => lang('unit'),
+ 'acl_app' => 'rental',
+ 'acl_location' => '.admin',
+ 'menu_selection' =>
'admin::rental::location_factor',
+ 'default' => array(
+ 'user_id' =>
array('add' => '$this->account'),
+ 'entry_date' =>
array('add' => 'time()'),
+ 'modified_date' =>
array('edit' => 'time()'),
+ )
+ );
+ break;
case 'composite_standard':
$info = array
(
@@ -3017,6 +3010,16 @@
return $info;
}
+ public function get_name( $data )
+ {
+ if (isset($data['type']) && $data['type'] && !
$this->location_info)
+ {
+ $this->get_location_info($data['type']);
+ }
+ $values = $this->read_single($data);
+ return isset($values['name']) ? $values['name'] :
$values['descr'];
+ }
+
function read_single( $data, $values = array() )
{
if (!isset($this->location_info['table']) || !$table =
$this->location_info['table'])
Modified: trunk/property/inc/class.soresponsible.inc.php
===================================================================
--- trunk/property/inc/class.soresponsible.inc.php 2016-08-12 14:54:46 UTC
(rev 15454)
+++ trunk/property/inc/class.soresponsible.inc.php 2016-08-12 14:56:35 UTC
(rev 15455)
@@ -434,21 +434,28 @@
* @param type $id responsibility id
* @return string responsibility name
*/
- public function get_responsibility_name( $id )
+ public function get_responsibility_name( $data )
{
static $names = array();
- $i = (int)$id;
+ if(is_array($data))
+ {
+ $id = (int)$data['id'];
+ }
+ else
+ {
+ $id = (int)$data;
+ }
- if ($names[$i])
+ if ($names[$id])
{
- return $names[$i];
+ return $names[$id];
}
$sql = "SELECT * FROM fm_responsibility WHERE id=
{$id}";
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
$name = $this->db->f('name', true);
- $names[$i] = $name;
+ $names[$id] = $name;
return $name;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15455] Property: generic,
sigurdne <=