[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15964] generic functions
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15964] generic functions |
Date: |
Tue, 8 Nov 2016 15:44:19 +0000 (UTC) |
Revision: 15964
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15964
Author: sigurdne
Date: 2016-11-08 15:44:19 +0000 (Tue, 08 Nov 2016)
Log Message:
-----------
generic functions
Modified Paths:
--------------
trunk/property/inc/class.bolookup.inc.php
trunk/property/inc/class.custom_fields.inc.php
trunk/property/inc/class.notify.inc.php
trunk/property/inc/class.sogeneric_.inc.php
trunk/property/inc/class.uilookup.inc.php
Modified: trunk/property/inc/class.bolookup.inc.php
===================================================================
--- trunk/property/inc/class.bolookup.inc.php 2016-11-08 15:43:40 UTC (rev
15963)
+++ trunk/property/inc/class.bolookup.inc.php 2016-11-08 15:44:19 UTC (rev
15964)
@@ -100,7 +100,7 @@
*
* @return array of contacts
*/
- function read_addressbook( $data = array() )
+ function read_addressbook_old( $data = array() )
{
if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
{
@@ -176,7 +176,58 @@
return $contacts;
}
+ function read_addressbook( $data = array() )
+ {
+ $accounts = & $GLOBALS['phpgw']->accounts;
+ $users = $accounts->get_list('accounts',
$data['start'], $data['sort'], $data['order'], $data['query'], $data['offset']);
+ $values = array();
+ $addressbook =
CreateObject('addressbook.boaddressbook');
+ $socommon = CreateObject('property.socommon');
+ foreach ($users as $account_id => $user)
+ {
+
+ $comms =
$addressbook->get_comm_contact_data($user->person_id, $fields_comms = '',
$simple = false);
+
+ if(!empty($comms[$user->person_id]['work
email']))
+ {
+ $email = $comms[$user->person_id]['work
email'];
+ }
+ else
+ {
+ $prefs =
$socommon->create_preferences('property', $user->id);
+ $email = $prefs['email'];
+ }
+ if(!empty($comms[$user->person_id]['mobile
(cell) phone']))
+ {
+ $mobile =
$comms[$user->person_id]['mobile (cell) phone'];
+ }
+ else
+ {
+ $prefs =
$socommon->create_preferences('property', $user->id);
+ $mobile = $prefs['cellphone'];
+ }
+
+ $values[] = array(
+ 'id' => $user->id,
+ 'lid' => $user->lid,
+ 'fullname' =>
$user->__toString(),
+ 'firstname' =>
$user->firstname,
+ 'lastname' =>
$user->lastname,
+ 'enabled' =>
$user->enabled,
+ 'contact_id' => $user->person_id,
+ 'email' => $email,
+ 'mobile' => $mobile
+ );
+
+ }
+
+
+ $this->total_records = $accounts->total;
+
+ return $values;
+ }
+
/**
* Read list of organisation from the addressbook
*
Modified: trunk/property/inc/class.custom_fields.inc.php
===================================================================
--- trunk/property/inc/class.custom_fields.inc.php 2016-11-08 15:43:40 UTC
(rev 15963)
+++ trunk/property/inc/class.custom_fields.inc.php 2016-11-08 15:44:19 UTC
(rev 15964)
@@ -329,17 +329,17 @@
}
else if ($attributes['datatype'] == 'user')
{
+ $attributes['value'] =
empty($attributes['value']) ? $GLOBALS['phpgw_info']['user']['account_id'] :
$attributes['value'];
if ($attributes['value'])
{
$attributes['user_name'] =
$GLOBALS['phpgw']->accounts->id2name($attributes['value']);
}
$insert_record_values[] =
$attributes['name'];
- $lookup_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => $this->_appname .
'.uilookup.phpgw_user',
- 'column' =>
$attributes['name']));
+ $lookup_link =
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uilookup.phpgw_user',
+ 'column' =>
$attributes['name'],'clear_state'=> 1));
$lookup_functions[$m]['name'] =
'lookup_' . $attributes['name'] . '()';
- //$lookup_functions[$m]['action']
= 'Window1=window.open('."'" . $lookup_link ."'"
.',"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");';
$lookup_functions[$m]['action'] =
'TINY.box.show({iframe:"' . $lookup_link . '",
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
mask:true, animate:true, close: true});';
$m++;
}
Modified: trunk/property/inc/class.notify.inc.php
===================================================================
--- trunk/property/inc/class.notify.inc.php 2016-11-08 15:43:40 UTC (rev
15963)
+++ trunk/property/inc/class.notify.inc.php 2016-11-08 15:44:19 UTC (rev
15964)
@@ -125,6 +125,7 @@
$entry['email'] =
isset($entry['email']) && $entry['email'] ? $entry['email'] : $prefs['email'];
$entry['sms'] = isset($entry['sms']) &&
$entry['sms'] ? $entry['sms'] : $prefs['cellphone'];
+ $entry['account_id'] = $account_id;
}
}
Modified: trunk/property/inc/class.sogeneric_.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric_.inc.php 2016-11-08 15:43:40 UTC (rev
15963)
+++ trunk/property/inc/class.sogeneric_.inc.php 2016-11-08 15:44:19 UTC (rev
15964)
@@ -168,7 +168,7 @@
$filtermethod = '';
if (isset($this->location_info['check_grant']) &&
$this->location_info['check_grant'])
{
- $filtermethod = "{$where} user_id =
{$this->account} OR public = 1";
+ $filtermethod = "{$where} (user_id =
{$this->account} OR public = 1)";
$where = 'AND';
}
Modified: trunk/property/inc/class.uilookup.inc.php
===================================================================
--- trunk/property/inc/class.uilookup.inc.php 2016-11-08 15:43:40 UTC (rev
15963)
+++ trunk/property/inc/class.uilookup.inc.php 2016-11-08 15:44:19 UTC (rev
15964)
@@ -112,14 +112,14 @@
switch ($columns[$order[0]['column']]['data'])
{
- case 'contact_id':
- $order_field = 'person_id';
+ case 'lastname':
+ $order_field =
'account_lastname';
break;
- case 'contact_name':
- $order_field = 'last_name';
+ case 'firstname':
+ $order_field =
'account_firstname';
break;
default:
- $order_field =
$columns[$order[0]['column']]['data'];
+ $order_field =
"account_lastname";
}
$params = array(
@@ -127,22 +127,13 @@
'results' => phpgw::get_var('length',
'int', 'REQUEST', 0),
'query' => $search['value'],
'order' => $order_field,
- 'sort' => $order[0]['dir'],
+ 'sort' => strtoupper($order[0]['dir']),
'dir' => $order[0]['dir'],
'allrows' => phpgw::get_var('length',
'int') == -1,
'filter' => ''
);
- $values = $this->bo->read_addressbook($params);
- /**
- * Sigurd: For some reason - this one starts on
1 - not 0 as it is supposed to.
- */
- $results = array();
- foreach ($values as $entry)
- {
- $results[] = $entry;
- }
- $result_data = array('results' => $results);
+ $result_data = array('results' =>
$this->bo->read_addressbook($params));
$result_data['total_records'] =
$this->bo->total_records;
$result_data['draw'] = $draw;
@@ -164,8 +155,6 @@
$this->cat_id = $default_category;
}
- self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.jeditable.js');
- self::add_javascript('phpgwapi', 'jquery',
'editable/jquery.dataTables.editable.js');
if ($column)
{
@@ -182,7 +171,7 @@
$action .= 'parent.document.getElementsByName("' .
$contact_id . '")[0].value = "";' . "\r\n";
$action .= 'parent.document.getElementsByName("' .
$contact_name . '")[0].value = "";' . "\r\n";
$action .= 'parent.document.getElementsByName("' .
$contact_id . '")[0].value = aData["contact_id"];' . "\r\n";
- $action .= 'parent.document.getElementsByName("' .
$contact_name . '")[0].value = aData["contact_name"];' . "\r\n";
+ $action .= 'parent.document.getElementsByName("' .
$contact_name . '")[0].value = aData["fullname"];' . "\r\n";
//trigger ajax-call
$action .=
"parent.document.getElementsByName('{$contact_id}')[0].setAttribute('{$contact_id}','{$contact_id}',0);\r\n";
@@ -211,31 +200,12 @@
)
);
- $values_combo_box =
$this->cats->formatted_xslt_list(array('selected' => $this->cat_id,
- 'globals' => true));
- foreach ($values_combo_box['cat_list'] as &$val)
- {
- $val['id'] = $val['cat_id'];
- }
- $default_value = array('id' => '', 'name' => lang('no
category'));
- array_unshift($values_combo_box['cat_list'],
$default_value);
-
- $filter = array('type' => 'filter',
- 'name' => 'cat_id',
- 'text' => lang('Category'),
- 'list' => $values_combo_box['cat_list']
- );
-
- array_unshift($data['form']['toolbar']['item'],
$filter);
-
$uicols = array(
- 'name' => array('contact_id', 'contact_name',
'email', 'wphone', 'mobile',
- 'is_user'),
- 'sort_field' => array('person_id', 'last_name',
'', '', '', ''),
- 'sortable' => array(true, true, false, false,
false, false),
- 'formatter' => array('', '', '', '', '', ''),
- 'descr' => array(lang('ID'), lang('Name'),
lang('email'), lang('phone'), lang('mobile'),
- lang('is user'))
+ 'name' => array('id', 'lid',
'lastname','firstname' ,'email', 'mobile','enabled'),
+ 'sort_field' => array('id', 'lid',
'lastname','firstname' ,'email', 'mobile','enabled'),
+ 'sortable' => array(false, true, true, true,
false, false, false),
+ 'formatter' => array('', '', '', '', '', '',
''),
+ 'descr' => array(lang('ID'), lang('lid'),
lang('lastname'),lang('firstname'), lang('email'),
lang('mobile'),lang('enabled'))
);
$count_uicols_name = count($uicols['name']);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15964] generic functions,
sigurdne <=