[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15608] Syncromind: merge 15475:15607 from trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15608] Syncromind: merge 15475:15607 from trunk |
Date: |
Wed, 7 Sep 2016 17:59:19 +0000 (UTC) |
Revision: 15608
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15608
Author: sigurdne
Date: 2016-09-07 17:59:19 +0000 (Wed, 07 Sep 2016)
Log Message:
-----------
Syncromind: merge 15475:15607 from trunk
Modified Paths:
--------------
branches/dev-syncromind-2/admin/inc/class.boaccounts.inc.php
branches/dev-syncromind-2/admin/inc/class.uiaccounts.inc.php
branches/dev-syncromind-2/admin/inc/class.uiapplications.inc.php
branches/dev-syncromind-2/admin/js/base/groups.js
branches/dev-syncromind-2/admin/setup/phpgw_no.lang
branches/dev-syncromind-2/admin/templates/base/groups.xsl
branches/dev-syncromind-2/booking/inc/class.bocommon_authorized.inc.php
branches/dev-syncromind-2/booking/inc/class.boseason.inc.php
branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
branches/dev-syncromind-2/booking/inc/class.uiallocation.inc.php
branches/dev-syncromind-2/booking/js/booking/schedule.js
branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
branches/dev-syncromind-2/controller/inc/class.uidocument.inc.php
branches/dev-syncromind-2/helpdesk/inc/class.botts.inc.php
branches/dev-syncromind-2/helpdesk/inc/class.sotts.inc.php
branches/dev-syncromind-2/helpdesk/inc/class.uitts.inc.php
branches/dev-syncromind-2/helpdesk/inc/hook_settings.inc.php
branches/dev-syncromind-2/helpdesk/js/portico/tts.add.js
branches/dev-syncromind-2/helpdesk/setup/phpgw_no.lang
branches/dev-syncromind-2/phpgwapi/inc/accounts/class.accounts_.inc.php
branches/dev-syncromind-2/phpgwapi/inc/class.contacts_sql.inc.php
branches/dev-syncromind-2/phpgwapi/inc/class.menu.inc.php
branches/dev-syncromind-2/phpgwapi/inc/class.phpgw.inc.php
branches/dev-syncromind-2/phpgwapi/templates/base/attributes_form.xsl
branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
branches/dev-syncromind-2/property/inc/class.boadmin_entity.inc.php
branches/dev-syncromind-2/property/inc/class.bocommon.inc.php
branches/dev-syncromind-2/property/inc/class.boentity.inc.php
branches/dev-syncromind-2/property/inc/class.bogeneric.inc.php
branches/dev-syncromind-2/property/inc/class.bolocation.inc.php
branches/dev-syncromind-2/property/inc/class.borequest.inc.php
branches/dev-syncromind-2/property/inc/class.botts.inc.php
branches/dev-syncromind-2/property/inc/class.soentity.inc.php
branches/dev-syncromind-2/property/inc/class.sogeneric.inc.php
branches/dev-syncromind-2/property/inc/class.solocation.inc.php
branches/dev-syncromind-2/property/inc/class.soproject.inc.php
branches/dev-syncromind-2/property/inc/class.sorequest.inc.php
branches/dev-syncromind-2/property/inc/class.sos_agreement.inc.php
branches/dev-syncromind-2/property/inc/class.sotts.inc.php
branches/dev-syncromind-2/property/inc/class.soworkorder.inc.php
branches/dev-syncromind-2/property/inc/class.uigallery.inc.php
branches/dev-syncromind-2/property/inc/class.uilocation.inc.php
branches/dev-syncromind-2/property/inc/class.uiproject.inc.php
branches/dev-syncromind-2/property/inc/class.uirequest.inc.php
branches/dev-syncromind-2/property/inc/class.uitts.inc.php
branches/dev-syncromind-2/property/inc/class.uiwo_hour.inc.php
branches/dev-syncromind-2/property/inc/class.uiworkorder.inc.php
branches/dev-syncromind-2/property/inc/cron/default/synkroniser_med_boei.php
branches/dev-syncromind-2/property/js/portico/location.edit.js
branches/dev-syncromind-2/property/js/portico/project.edit.js
branches/dev-syncromind-2/property/js/portico/tts.view.js
branches/dev-syncromind-2/property/setup/phpgw_no.lang
branches/dev-syncromind-2/property/setup/setup.inc.php
branches/dev-syncromind-2/property/setup/tables_current.inc.php
branches/dev-syncromind-2/property/setup/tables_update.inc.php
branches/dev-syncromind-2/property/templates/base/admin_entity.xsl
branches/dev-syncromind-2/property/templates/base/config.tpl
branches/dev-syncromind-2/property/templates/base/entity.xsl
branches/dev-syncromind-2/property/templates/base/project.xsl
branches/dev-syncromind-2/property/templates/base/tts.xsl
branches/dev-syncromind-2/rental/inc/class.menu.inc.php
branches/dev-syncromind-2/rental/inc/class.soapplication.inc.php
branches/dev-syncromind-2/rental/inc/class.socomposite.inc.php
branches/dev-syncromind-2/rental/inc/class.socontract_price_item.inc.php
branches/dev-syncromind-2/rental/inc/class.soprice_item.inc.php
branches/dev-syncromind-2/rental/inc/class.uiapplication.inc.php
branches/dev-syncromind-2/rental/inc/class.uibilling.inc.php
branches/dev-syncromind-2/rental/inc/class.uicomposite.inc.php
branches/dev-syncromind-2/rental/inc/class.uicontract.inc.php
branches/dev-syncromind-2/rental/inc/class.uiprice_item.inc.php
branches/dev-syncromind-2/rental/inc/class.uiproperty_location.inc.php
branches/dev-syncromind-2/rental/inc/model/class.application.inc.php
branches/dev-syncromind-2/rental/inc/model/class.composite.inc.php
branches/dev-syncromind-2/rental/inc/model/class.contract.inc.php
branches/dev-syncromind-2/rental/inc/model/class.contract_price_item.inc.php
branches/dev-syncromind-2/rental/inc/model/class.invoice.inc.php
branches/dev-syncromind-2/rental/inc/model/class.invoice_price_item.inc.php
branches/dev-syncromind-2/rental/inc/model/class.model.inc.php
branches/dev-syncromind-2/rental/inc/model/class.price_item.inc.php
branches/dev-syncromind-2/rental/js/rental/application.edit.js
branches/dev-syncromind-2/rental/setup/default_records.inc.php
branches/dev-syncromind-2/rental/setup/phpgw_no.lang
branches/dev-syncromind-2/rental/setup/setup.inc.php
branches/dev-syncromind-2/rental/setup/tables_current.inc.php
branches/dev-syncromind-2/rental/setup/tables_update.inc.php
branches/dev-syncromind-2/rental/templates/base/application.xsl
branches/dev-syncromind-2/rental/templates/base/composite.xsl
Added Paths:
-----------
branches/dev-syncromind-2/helpdesk/inc/custom/
branches/dev-syncromind-2/phpgwapi/inc/class.socommon.inc.php
branches/dev-syncromind-2/rental/inc/class.boapplication.inc.php
Property Changed:
----------------
branches/dev-syncromind-2/
branches/dev-syncromind-2/booking/
branches/dev-syncromind-2/bookingfrontend/
Property changes on: branches/dev-syncromind-2
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14934-14935,15165-15215,15218-15220,15222-15304,15306-15337,15339,15341-15398,15400-15421,15423-15474
+ /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14934-14935,15165-15215,15218-15220,15222-15304,15306-15337,15339,15341-15398,15400-15421,15423-15474,15476-15607
Modified: branches/dev-syncromind-2/admin/inc/class.boaccounts.inc.php
===================================================================
--- branches/dev-syncromind-2/admin/inc/class.boaccounts.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/admin/inc/class.boaccounts.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -186,13 +186,12 @@
if ( !$id ) // add new group?
{
$new_group->id = $id;
- $id =
$GLOBALS['phpgw']->accounts->create($new_group, $values['account_user'],
+ $id =
$GLOBALS['phpgw']->accounts->create($new_group, array(),
array(), array_keys($values['account_apps']));
}
else //edit group
{
-
$GLOBALS['phpgw']->accounts->update_group($new_group, $values['account_user'],
-
$values['account_apps']);
+
$GLOBALS['phpgw']->accounts->update_group($new_group, $values['account_apps']);
}
//Delete cached menu for members of group
Modified: branches/dev-syncromind-2/admin/inc/class.uiaccounts.inc.php
===================================================================
--- branches/dev-syncromind-2/admin/inc/class.uiaccounts.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/admin/inc/class.uiaccounts.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -27,6 +27,7 @@
*/
phpgw::import_class('phpgwapi.jquery');
+ phpgw::import_class('phpgwapi.uicommon_jquery');
/**
* phpGroupWare Administration - Accounts User Interface
@@ -39,7 +40,7 @@
* @subpackage admin
* @category accounts
*/
- class admin_uiaccounts
+ class admin_uiaccounts extends phpgwapi_uicommon_jquery
{
/**
* @var array $public_functions Publicly available methods
@@ -57,7 +58,11 @@
'clear_user_cache' => true,
'clear_cache' => true,
'global_message' => true,
- 'home_screen_message' => true
+ 'home_screen_message' => true,
+ 'query' => true,
+ 'remove_group_user' => true,
+ 'reset_group_users' => true,
+ 'add_group_users' => true,
);
/**
@@ -82,6 +87,8 @@
*/
public function __construct()
{
+ parent::__construct();
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
'admin::admin';
@@ -93,6 +100,159 @@
&&
$GLOBALS['phpgw_info']['server']['ldap_extra_attributes'];
}
+ function query( )
+ {
+ $account_id = phpgw::get_var('group_id',
'int');
+
+ if ( !$account_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return;
+ }
+
+ $type = phpgw::get_var('type');
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $dir = strtoupper($order[0]['dir']);
+ $columns = phpgw::get_var('columns');
+ $results = phpgw::get_var('length', 'int', 'REQUEST',
0);
+ $allrows = phpgw::get_var('length', 'int') == -1;
+ $query = $search['value'];
+ $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+
+
+ switch ($columns[$order[0]['column']]['data'])
+ {
+ case 'id':
+ $order = 'account_id';
+ break;
+ case 'lid':
+ $order = 'account_lid';
+ break;
+ case 'name':
+ $order = 'account_lastname';
+ break;
+ default:
+ $order = 'account_lastname';
+ break;
+ }
+
+ $accounts =& $GLOBALS['phpgw']->accounts;
+
+ $group_members = $accounts->member($account_id);
+
+ //local application admin
+ if(!$GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin'))
+ {
+ $available_apps =
$GLOBALS['phpgw_info']['apps'];
+ $valid_users = array();
+ foreach($available_apps as $_app => $dummy)
+ {
+
if($GLOBALS['phpgw']->acl->check('admin', phpgwapi_acl::ADD, $_app))
+ {
+ $_valid_users =
$GLOBALS['phpgw']->acl->get_user_list_right(phpgwapi_acl::READ, 'run', $_app);
+
+ foreach($_valid_users as $_user)
+ {
+ $valid_users[] =
$_user['account_id'];
+ }
+ unset($_user);
+ unset($_valid_users);
+ }
+ }
+
+ $valid_users = array_unique($valid_users);
+
+ $account_list =
$GLOBALS['phpgw']->accounts->get_list('accounts', -1,$dir, $order, $query);
+ foreach($account_list as $user)
+ {
+ if(!in_array($user->id, $valid_users))
+ {
+ unset($account_list[$user->id]);
+ }
+ }
+ unset($user);
+ }
+ else
+ {
+ $account_list = $accounts->get_list('accounts',
-1, $dir, $order, $query);
+ }
+
+ $lang_disabled = lang('disabled');
+ $lang_enabled = lang('enabled');
+ $members = array();
+ $user_list = array();
+ foreach ( $account_list as $id => $user )
+ {
+ if(isset($group_members[$id]))
+ {
+ $member_list[] = array
+ (
+ 'id' => $id,
+ 'lid' => $user->lid,
+ 'name' => $user->__toString(),
+ 'status' =>
$user->enabled ? $lang_enabled : $lang_disabled
+ );
+ }
+ else
+ {
+ $user_list[] = array
+ (
+ 'id' => $id,
+ 'lid' => $user->lid,
+ 'name' => $user->__toString(),
+ 'status' =>
$user->enabled ? $lang_enabled : $lang_disabled
+ );
+ }
+ }
+
+ switch ($type)
+ {
+ case 'included_users':
+ $values = $member_list;
+ break;
+ case 'not_included_users':
+ $values = $user_list;
+ break;
+ default :
+ $values = array();
+ }
+
+ $total_records = count($values);
+ if (!$allrows)
+ {
+ if ($results)
+ {
+ $num_rows = $results;
+ }
+ else
+ {
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) ?
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) :
15;
+ }
+
//_debug_array(array($start,$this->total_records,$this->total_records,$num_rows));
+ $page = ceil(( $start / $total_records ) *
($total_records / $num_rows));
+
+ $out = array_chunk($values, $num_rows);
+
+ $result_data = array('results' => $out[$page]);
+ }
+ else
+ {
+ $result_data = array('results' => $values);
+ }
+
+ $link_data = array(
+ 'menuaction' => 'admin.uiaccounts.edit_user',
+ );
+
+ $result_data['total_records'] = $total_records;
+ $result_data['draw'] = phpgw::get_var('draw', 'int');
+
+ array_walk($result_data['results'], array($this,
'_add_links'), $link_data);
+ return $this->jquery_results($result_data);
+
+ }
/**
* Render a list of groups
*
@@ -574,15 +734,7 @@
{
$values =
phpgw::get_var('values', 'string', 'POST', array());
$account_apps =
phpgw::get_var('account_apps', 'string', 'POST');
- $account_user =
phpgw::get_var('account_user', 'int', 'POST');
- $values['account_user'] = array();
- if (is_array($account_user))
- {
-
- $values['account_user'] = $account_user;
- }
-
$values['account_apps'] = array();
if ( is_array($account_apps) &&
count($account_apps) )
{
@@ -625,7 +777,7 @@
$group_members = $accounts->member($account_id);
- //local application admin
+/* //local application admin
if(!$GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin'))
{
$available_apps =
$GLOBALS['phpgw_info']['apps'];
@@ -683,7 +835,7 @@
);
}
}
-
+*/
//FIXME this needs to be provided by the app itself -
thats why we have hooks
$apps_with_acl = array
(
@@ -783,7 +935,7 @@
// this is in the api, so lets not waste loops looking
for it the app tpl dirs
$GLOBALS['phpgw']->xslttpl->add_file('msgbox',
PHPGW_TEMPLATE_DIR, 3);
- $GLOBALS['phpgw']->xslttpl->add_file('groups');
+// $GLOBALS['phpgw']->xslttpl->add_file('groups');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('edit group');
if ( $account_id )
@@ -793,6 +945,7 @@
$data = array
(
+ 'datatable_def' =>
$this->_get_tableDef_user('edit', $account_id),
'page_title' => $account_id ?
lang('edit group') : lang('add group'),
'account_id' => $account_id,
'app_list' => $app_list,
@@ -801,8 +954,8 @@
'menuaction' => 'admin.uiaccounts.edit_group',
'account_id' => $account_id
)),
- 'guser_list' => $user_list,
- 'member_list' => $member_list,
+// 'guser_list' => $user_list,
+// 'member_list' => $member_list,
'img_close' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_close', '.png', false),
'img_save' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_save', '.png', false),
'lang_cancel' => lang('cancel'),
@@ -814,9 +967,216 @@
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, 'data','group_edit_tabview')
);
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('group_edit' => $data));
+ self::render_template_xsl(array('groups',
'datatable_inline'), array('group_edit' => $data));
}
+ function remove_group_user( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = (array)phpgw::get_var('account_user',
'int');
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ $acl = createObject('phpgwapi.acl', $group_id);
+ $is_admin_group = $acl->check('run',
phpgwapi_acl::READ, 'admin');
+ $current_user =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ if($group_id && isset($_POST['account_user']))
+ {
+ foreach ($account_user as $user_id)
+ {
+ //Don't lock your self out
+ if($is_admin_group && ($current_user ==
$user_id))
+ {
+ continue;
+ }
+
$GLOBALS['phpgw']->accounts->delete_account4group($user_id, $group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $user_id);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ function reset_group_users( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = array();
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ $acl = createObject('phpgwapi.acl', $group_id);
+ $is_admin_group = $acl->check('run',
phpgwapi_acl::READ, 'admin');
+ $current_user =
$GLOBALS['phpgw_info']['user']['account_id'];
+
+ if($group_id && isset($_POST))
+ {
+ $members =
$GLOBALS['phpgw']->accounts->member($group_id);
+ foreach($members as $entry)
+ {
+ //Don't lock your self out
+ if($is_admin_group && ($current_user ==
$entry['account_id']))
+ {
+ continue;
+ }
+
$GLOBALS['phpgw']->accounts->delete_account4group($entry['account_id'],
$group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $entry['account_id']);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ function add_group_users( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = (array)phpgw::get_var('account_user',
'int');
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ if($group_id && isset($_POST['account_user']))
+ {
+ foreach ($account_user as $user_id)
+ {
+
$GLOBALS['phpgw']->accounts->add_user2group($user_id, $group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $user_id);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ private function _get_tableDef_user( $mode, $group_id )
+ {
+ $columns_def = array(
+ array('key' => 'id', 'label' => 'ID',
'className' => '','sortable' => true, 'hidden' => false,'formatter' =>
'JqueryPortico.formatLink'),
+ array('key' => 'lid', 'label' =>
lang('loginid'), 'className' => '', 'sortable' => true,'hidden' => false),
+ array('key' => 'name', 'label' => lang('name'),
'className' => '', 'sortable' => true,'hidden' => false),
+ array('key' => 'status', 'label' => 'Status',
'className' => '', 'sortable' => false,'hidden' => false),
+ );
+
+
+ if ($mode == 'edit')
+ {
+ $tabletools_user1 = array(
+ array('my_name' => 'select_all'),
+ array('my_name' => 'select_none')
+ );
+ $tabletools_user1[] = array
+ (
+ 'my_name' => 'remove',
+ 'text' => lang('remove'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.remove_group_user',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ removeUser(oArgs, parameters);
+ "
+ );
+
+ $tabletools_user1[] = array
+ (
+ 'my_name' => 'reset',
+ 'text' => lang('reset'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.reset_group_users',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ removeUser(oArgs, parameters);
+ "
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'admin.uiaccounts.query',
+ 'type' => 'included_users',
'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'))),
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'tabletools' => $tabletools_user1,
+ 'config' => array(
+ // array('disableFilter' => true),
+ )
+ );
+
+ $tabletools_user2 = array(
+ array('my_name' => 'select_all'),
+ array('my_name' => 'select_none')
+ );
+ $tabletools_user2[] = array
+ (
+ 'my_name' => 'add',
+ 'text' => lang('add'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.add_group_users',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ addUser(oArgs, parameters);
+ "
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_2',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'admin.uiaccounts.query',
+ 'type' => 'not_included_users',
'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'))),
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'tabletools' => $tabletools_user2,
+ 'config' => array(
+ // array('disableFilter' => true)
+ )
+ );
+ }
+ else
+ {
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' => "''",
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'config' => array(
+ // array('disableFilter' => true)
+ )
+ );
+ }
+
+ return $datatable_def;
+ }
+
/**
* Render a form for editing a user account
*
@@ -840,6 +1200,8 @@
}
$account_id = phpgw::get_var('account_id', 'int');
+ $id = phpgw::get_var('id', 'int');
+ $account_id = $account_id ? $account_id : $id;
if ( $account_id )
{
$user =
$GLOBALS['phpgw']->accounts->get($account_id);
Modified: branches/dev-syncromind-2/admin/inc/class.uiapplications.inc.php
===================================================================
--- branches/dev-syncromind-2/admin/inc/class.uiapplications.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/admin/inc/class.uiapplications.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -42,7 +42,7 @@
$GLOBALS['phpgw']->template->set_block('applications','list','list');
$GLOBALS['phpgw']->template->set_block('applications','row','row');
- $start = phpgw::get_var('start', 'int', 'POST');
+ $start = phpgw::get_var('start', 'int', 'GET');
$sort = phpgw::get_var('sort', 'string', 'GET');
$order = phpgw::get_var('order', 'string', 'GET');
$offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
Modified: branches/dev-syncromind-2/admin/js/base/groups.js
===================================================================
--- branches/dev-syncromind-2/admin/js/base/groups.js 2016-09-07 15:10:52 UTC
(rev 15607)
+++ branches/dev-syncromind-2/admin/js/base/groups.js 2016-09-07 17:59:19 UTC
(rev 15608)
@@ -1,25 +1,93 @@
-/** Written by & (c) Dave Hall 2006 **/
-function updateManager()
+
+get_user_data = function ()
{
- var manager = document.getElementById('group_manager');
- var curManagerVal = manager.options[manager.selectedIndex].value;
- while ( manager.childNodes.length )
+ if (set_user_data === 0)
{
- manager.removeChild(manager.firstChild);
+ oTable1.dataTableSettings[1]['oFeatures']['bServerSide'] = true;
+ JqueryPortico.updateinlineTableHelper(oTable1,
link_included_user_items);
+
+ oTable2.dataTableSettings[2]['oFeatures']['bServerSide'] = true;
+ oTable2.dataTableSettings[2]['ajax'] = {url:
link_not_included_user_items, data: {}, type: 'GET'};
+ JqueryPortico.updateinlineTableHelper(oTable2);
+
+ set_user_data = 1;
}
-
- var users = document.getElementById('account_user');
- var userOption;
- for ( i=0; i < users.options.length; ++i )
+};
+
+getRequestData = function (dataSelected, parameters)
+{
+
+ var data = {};
+
+ $.each(parameters.parameter, function (i, val)
{
- if ( users.options[i].selected )
+ data[val.name] = {};
+ });
+
+ var n = 0;
+ for (var n = 0; n < dataSelected.length; ++n)
+ {
+ $.each(parameters.parameter, function (i, val)
{
- userOption = users.options[i].cloneNode(true);
- if ( userOption.value != curManagerVal )
- {
- userOption.selected = false;
- }
- manager.appendChild(userOption);
- }
+ data[val.name][n] = dataSelected[n][val.source];
+ });
}
-}
+
+ return data;
+};
+
+
+addUser = function (oArgs, parameters)
+{
+
+ var api = $('#datatable-container_2').dataTable().api();
+ var selected = api.rows({selected: true}).data();
+ var nTable = 1;
+
+ if (selected.length == 0)
+ {
+ alert('None selected');
+ return false;
+ }
+
+ var data = getRequestData(selected, parameters);
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ JqueryPortico.execute_ajax(requestUrl, function (result)
+ {
+
+ // JqueryPortico.show_message(nTable, result);
+
+ oTable1.fnDraw();
+ oTable2.fnDraw();
+
+ }, data, 'POST', 'JSON');
+};
+
+removeUser = function (oArgs, parameters)
+{
+
+ var api = $('#datatable-container_1').dataTable().api();
+ var selected = api.rows({selected: true}).data();
+ var nTable = 1;
+
+ if (selected.length == 0)
+ {
+ alert('None selected');
+ return false;
+ }
+
+ var data = getRequestData(selected, parameters);
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ JqueryPortico.execute_ajax(requestUrl, function (result)
+ {
+
+// JqueryPortico.show_message(nTable, result);
+
+ oTable1.fnDraw();
+ oTable2.fnDraw();
+
+ }, data, 'POST', 'JSON');
+};
+
Modified: branches/dev-syncromind-2/admin/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind-2/admin/setup/phpgw_no.lang 2016-09-07 15:10:52 UTC
(rev 15607)
+++ branches/dev-syncromind-2/admin/setup/phpgw_no.lang 2016-09-07 17:59:19 UTC
(rev 15608)
@@ -39,3 +39,4 @@
home screen message admin no Melding på hjemmeskjerm
title admin no Overskrift
important message admin no Viktig informasjon
+enabled admin no Aktiv
\ No newline at end of file
Modified: branches/dev-syncromind-2/admin/templates/base/groups.xsl
===================================================================
--- branches/dev-syncromind-2/admin/templates/base/groups.xsl 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/admin/templates/base/groups.xsl 2016-09-07
17:59:19 UTC (rev 15608)
@@ -1,239 +1,303 @@
<!-- $Id$ -->
+<xsl:template match="data">
+ <xsl:choose>
+ <xsl:when test="group_edit">
+ <xsl:apply-templates select="group_edit"/>
+ </xsl:when>
+ <xsl:when test="group_list">
+ <xsl:apply-templates select="group_list"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:call-template name="jquery_phpgw_i18n"/>
+</xsl:template>
- <xsl:template name="groups">
- <xsl:choose>
- <xsl:when test="group_list">
- <xsl:apply-templates select="group_list"/>
- </xsl:when>
- <xsl:when test="group_edit">
- <xsl:apply-templates select="group_edit"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
<!-- BEGIN group_list -->
- <xsl:template match="group_list">
- <div id="admin_group_list">
- <xsl:if test="search_access = 1">
- <div class="search">
- <xsl:call-template name="search_field"/>
- </div>
- </xsl:if>
-
- <div>
- <xsl:call-template name="nextmatchs"/>
+<xsl:template match="group_list">
+ <div id="admin_group_list">
+ <xsl:if test="search_access = 1">
+ <div class="search">
+ <xsl:call-template name="search_field"/>
</div>
+ </xsl:if>
- <table class="pure-table pure-table-bordered"
border="0" cellspacing="2" cellpadding="2">
- <thead>
- <xsl:apply-templates
select="group_header"/>
- </thead>
- <tbody>
- <xsl:apply-templates
select="group_data"/>
- </tbody>
- </table>
- <xsl:apply-templates select="group_add"/>
+ <div>
+ <xsl:call-template name="nextmatchs"/>
</div>
- </xsl:template>
+ <table class="pure-table pure-table-bordered" border="0"
cellspacing="2" cellpadding="2">
+ <thead>
+ <xsl:apply-templates select="group_header"/>
+ </thead>
+ <tbody>
+ <xsl:apply-templates select="group_data"/>
+ </tbody>
+ </table>
+ <xsl:apply-templates select="group_add"/>
+ </div>
+</xsl:template>
+
<!-- BEGIN group_header -->
- <xsl:template match="group_header">
- <tr>
- <th><a href="{sort_name}"><xsl:value-of
select="lang_name"/></a></th>
- <th><xsl:value-of select="lang_edit"/></th>
- <th><xsl:value-of select="lang_delete"/></th>
- </tr>
- </xsl:template>
+<xsl:template match="group_header">
+ <tr>
+ <th>
+ <a href="{sort_name}">
+ <xsl:value-of select="lang_name"/>
+ </a>
+ </th>
+ <th>
+ <xsl:value-of select="lang_edit"/>
+ </th>
+ <th>
+ <xsl:value-of select="lang_delete"/>
+ </th>
+ </tr>
+</xsl:template>
<!-- BEGIN group_data -->
- <xsl:template match="group_data">
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="group_name"/></td>
- <td class="action">
- <xsl:variable name="edit_url"
select="edit_url"/>
- <a href="{$edit_url}"
class="th_text"><xsl:value-of select="lang_edit"/></a>
- </td>
- <td class="action">
- <xsl:variable name="delete_url"
select="delete_url"/>
- <a href="{$delete_url}"
class="th_text"><xsl:value-of select="lang_delete"/></a>
- </td>
- </tr>
- </xsl:template>
+<xsl:template match="group_data">
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td>
+ <xsl:value-of select="group_name"/>
+ </td>
+ <td class="action">
+ <xsl:variable name="edit_url" select="edit_url"/>
+ <a href="{$edit_url}" class="th_text">
+ <xsl:value-of select="lang_edit"/>
+ </a>
+ </td>
+ <td class="action">
+ <xsl:variable name="delete_url" select="delete_url"/>
+ <a href="{$delete_url}" class="th_text">
+ <xsl:value-of select="lang_delete"/>
+ </a>
+ </td>
+ </tr>
+</xsl:template>
<!-- BEGIN group_add -->
- <xsl:template match="group_add">
- <div>
- <xsl:if test="add_access = 1">
- <a href="{add_url}"><xsl:value-of
select="lang_add" /></a>
- </xsl:if>
- <a href="{done_url}"><xsl:value-of select="lang_done"
/></a>
- </div>
- </xsl:template>
+<xsl:template match="group_add">
+ <div>
+ <xsl:if test="add_access = 1">
+ <a href="{add_url}">
+ <xsl:value-of select="lang_add" />
+ </a>
+ </xsl:if>
+ <a href="{done_url}">
+ <xsl:value-of select="lang_done" />
+ </a>
+ </div>
+</xsl:template>
<!-- END group_list -->
<!-- BEGIN group_edit -->
- <xsl:template match="group_edit" xmlns:php="http://php.net/xsl">
- <div id="admin_group_edit">
- <h1><xsl:value-of select="page_title" /></h1>
- <xsl:if test="msgbox_data != ''">
- <xsl:call-template name="msgbox"/>
- </xsl:if>
+<xsl:template match="group_edit" xmlns:php="http://php.net/xsl">
+ <div id="admin_group_edit">
+ <h1>
+ <xsl:value-of select="page_title" />
+ </h1>
+ <xsl:if test="msgbox_data != ''">
+ <xsl:call-template name="msgbox"/>
+ </xsl:if>
- <form name='body_form' action="{edit_url}"
method="post" onsubmit="process_list('all_users[]', 'account_user[]')">
- <div class="yui-navset" id="group_edit_tabview">
- <xsl:value-of
disable-output-escaping="yes" select="tabs" />
+ <form name='body_form' action="{edit_url}" method="post"
onsubmit="process_list('all_users[]', 'account_user[]')">
+ <div class="yui-navset" id="group_edit_tabview">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
- <div class="yui-content">
+ <div class="yui-content">
- <div id="group">
-
<h2><xsl:value-of select="php:function('lang', 'group')" /></h2>
- <input
type="hidden" name="values[account_id]" value="{account_id}"/>
- <ul
id="admin_account_form">
- <li>
-
<label for="account_name"><xsl:value-of select="php:function('lang', 'group
name')" /></label>
-
<input name="values[account_name]" value="{value_account_name}"
id="account_name" /><br class="eol" />
- </li>
- </ul>
+ <div id="group">
+ <h2>
+ <xsl:value-of
select="php:function('lang', 'group')" />
+ </h2>
+ <input type="hidden"
name="values[account_id]" value="{account_id}"/>
+ <ul id="admin_account_form">
+ <li>
+ <label
for="account_name">
+
<xsl:value-of select="php:function('lang', 'group name')" />
+ </label>
+ <input
name="values[account_name]" value="{value_account_name}" id="account_name" />
+ <br class="eol"
/>
+ </li>
+ </ul>
- <table
border="0" align="center" width="100%">
- <tbody
align="center">
-
<tr bgcolor="">
-
<td width="45%"><xsl:value-of select="php:function('lang', 'all
users')" /></td>
-
<td width="10%"></td>
-
<td width="45%"><xsl:value-of select="php:function('lang', 'members')"
/></td>
-
</tr>
-
<tr bgcolor="">
-
<td width="45%">
-
<select multiple ='multiple' size="10" name="all_users[]"
style="width:220">
-
<xsl:apply-templates select="guser_list"/>
-
</select>
-
</td>
-
<td width="10%">
-
<table border="0" align="center">
+ <!--table border="0"
align="center" width="100%">
+ <tbody align="center">
+ <tr bgcolor="">
+ <td
width="45%">
+
<xsl:value-of select="php:function('lang', 'all users')" />
+ </td>
+ <td
width="10%"></td>
+ <td
width="45%">
+
<xsl:value-of select="php:function('lang', 'members')" />
+ </td>
+ </tr>
+ <tr bgcolor="">
+ <td
width="45%">
+
<select multiple ='multiple' size="10" name="all_users[]" style="width:220">
+
<xsl:apply-templates select="guser_list"/>
+
</select>
+ </td>
+ <td
width="10%">
+
<table border="0" align="center">
<tbody align="center">
<tr>
-
<td>
-
<input type="button"
onClick="move('all_users[]','account_user[]','','account_user[]')"
value=">>"/>
-
</td>
+
<td>
+
<input type="button"
onClick="move('all_users[]','account_user[]','','account_user[]')"
value=">>"/>
+
</td>
</tr>
<tr>
-
<td>
-
<input type="button"
onClick="move('account_user[]','all_users[]','','account_user[]')"
value="<<"/>
-
</td>
+
<td>
+
<input type="button"
onClick="move('account_user[]','all_users[]','','account_user[]')"
value="<<"/>
+
</td>
</tr>
</tbody>
-
</table>
-
</td>
-
<td width="45%">
-
<select multiple = 'multiple' size="10" name="account_user[]"
id="account_user" style="width:220">
-
<xsl:apply-templates select="member_list"/>
-
</select>
-
</td>
-
</tr>
- </tbody>
- </table>
- </div>
-
- <div id="apps">
-
<h2><xsl:value-of select="php:function('lang', 'applications')" /></h2>
- <ul
class="app_list">
-
<xsl:apply-templates select="app_list" />
- </ul>
- </div>
+
</table>
+ </td>
+ <td
width="45%">
+
<select multiple = 'multiple' size="10" name="account_user[]" id="account_user"
style="width:220">
+
<xsl:apply-templates select="member_list"/>
+
</select>
+ </td>
+ </tr>
+ </tbody>
+ </table-->
+ <div>
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_1'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl' />
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+
<xsl:with-param name="tabletools" select ='tabletools' />
+
<xsl:with-param name="data" select ='data' />
+
<xsl:with-param name="config" select ='config' />
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
</div>
+ <div>
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_2'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl' />
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+
<xsl:with-param name="tabletools" select ='tabletools' />
+
<xsl:with-param name="data" select ='data' />
+
<xsl:with-param name="config" select ='config' />
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </div>
</div>
- <div class="button_group">
- <input type="submit" name="save"
value="{lang_save}" />
- <input type="submit" name="cancel"
value="{lang_cancel}" />
+
+ <div id="apps">
+ <h2>
+ <xsl:value-of
select="php:function('lang', 'applications')" />
+ </h2>
+ <ul class="app_list">
+ <xsl:apply-templates
select="app_list" />
+ </ul>
+ </div>
</div>
- </form>
- </div>
- </xsl:template>
+ </div>
+ <div class="button_group">
+ <input type="submit" name="save"
value="{lang_save}" />
+ <input type="submit" name="cancel"
value="{lang_cancel}" />
+ </div>
+ </form>
+ </div>
+</xsl:template>
- <xsl:template match="guser_list">
- <option value="{account_id}">
- <xsl:value-of select="account_name" />
- </option>
- </xsl:template>
+<xsl:template match="guser_list">
+ <option value="{account_id}">
+ <xsl:value-of select="account_name" />
+ </option>
+</xsl:template>
- <xsl:template match="member_list">
- <option value="{account_id}">
- <xsl:value-of select="account_name" />
- </option>
- </xsl:template>
+<xsl:template match="member_list">
+ <option value="{account_id}">
+ <xsl:value-of select="account_name" />
+ </option>
+</xsl:template>
- <xsl:template match="app_list">
- <li>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
+<xsl:template match="app_list">
+ <li>
+ <xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="acl_url != ''">
- <a href="{acl_url}"><img
src="{acl_img}" title="{acl_img_name}" alt="{acl_img_name}" /></a>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
</xsl:when>
<xsl:otherwise>
- <img src="{acl_img}"
title="{acl_img_name}" alt="{acl_img_name}" />
+ <xsl:text>row_on</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:text> </xsl:text>
- <xsl:choose>
- <xsl:when test="grant_url != ''">
- <a href="{grant_url}"><img
src="{grant_img}" title="{grant_img_name}" alt="{grant_img_name}" /></a>
- </xsl:when>
- <xsl:otherwise>
+ </xsl:attribute>
+
+ <xsl:choose>
+ <xsl:when test="acl_url != ''">
+ <a href="{acl_url}">
+ <img src="{acl_img}"
title="{acl_img_name}" alt="{acl_img_name}" />
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="{acl_img}" title="{acl_img_name}"
alt="{acl_img_name}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="grant_url != ''">
+ <a href="{grant_url}">
<img src="{grant_img}"
title="{grant_img_name}" alt="{grant_img_name}" />
- </xsl:otherwise>
- </xsl:choose>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="{grant_img}" title="{grant_img_name}"
alt="{grant_img_name}" />
+ </xsl:otherwise>
+ </xsl:choose>
- <xsl:choose>
- <xsl:when test="i_am_admin = '1'">
- <input type="checkbox" id="{elmid}"
name="{checkbox_name}" value="1">
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="checked">
-
<xsl:text>checked</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input type="hidden" id="{elmid}"
name="{checkbox_name}">
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="value">
-
<xsl:text>1</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- <input type="checkbox" readonly='true'>
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="checked">
-
<xsl:text>checked</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- <label for="{elmid}">
- <xsl:value-of select="app_title" />
- </label>
- </li>
- </xsl:template>
+ <xsl:choose>
+ <xsl:when test="i_am_admin = '1'">
+ <input type="checkbox" id="{elmid}"
name="{checkbox_name}" value="1">
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="hidden" id="{elmid}"
name="{checkbox_name}">
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="value">
+ <xsl:text>1</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ <input type="checkbox" readonly='true'>
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ <label for="{elmid}">
+ <xsl:value-of select="app_title" />
+ </label>
+ </li>
+</xsl:template>
Property changes on: branches/dev-syncromind-2/booking
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14937-15027,15165-15215,15253-15304,15306-15337,15341-15398
+ /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14937-15027,15165-15215,15253-15304,15306-15337,15341-15398,15476-15607
Modified:
branches/dev-syncromind-2/booking/inc/class.bocommon_authorized.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.bocommon_authorized.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/booking/inc/class.bocommon_authorized.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -776,7 +776,14 @@
function read_single( $id )
{
$entity = parent::read_single($id);
- $this->authorize_read($entity);
- return $this->add_permission_data($entity);
+ if($entity)
+ {
+ $this->authorize_read($entity);
+ return $this->add_permission_data($entity);
+ }
+ else
+ {
+ return array();
+ }
}
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/booking/inc/class.boseason.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.boseason.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/booking/inc/class.boseason.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -149,12 +149,12 @@
{
if ($write)
{
-
$this->so->db->transaction_begin();
+ $this->so->transaction_begin();
foreach ($valid as $alloc)
{
$this->bo_allocation->add($alloc);
}
-
$this->so->db->transaction_commit();
+ $this->so->transaction_commit();
}
return array('valid' => $valid,
'invalid' => $invalid);
}
Modified: branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/booking/inc/class.socommon.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -4,6 +4,8 @@
abstract class booking_socommon
{
+ protected $db;
+ protected $db2;
protected $db_null = 'NULL';
protected $valid_field_types = array(
'date' => true,
@@ -41,10 +43,41 @@
$this->table_name = $table_name;
$this->fields = $fields;
$this->db = $GLOBALS['phpgw']->db;
+ $this->db2 = clone($GLOBALS['phpgw']->db);
$this->join = & $this->db->join;
$this->like = & $this->db->like;
}
+ /**
+ * Begin transaction
+ *
+ * @return integer|bool current transaction id
+ */
+ public function transaction_begin()
+ {
+ return $this->db->transaction_begin();
+ }
+
+ /**
+ * Complete the transaction
+ *
+ * @return bool True if sucessful, False if fails
+ */
+ public function transaction_commit()
+ {
+ return $this->db->transaction_commit();
+ }
+
+ /**
+ * Rollback the current transaction
+ *
+ * @return bool True if sucessful, False if fails
+ */
+ public function transaction_abort()
+ {
+ return $this->db->transaction_abort();
+ }
+
public function get_db()
{
return $this->db;
@@ -325,9 +358,9 @@
$order_method =
"ORDER BY {$params['manytomany']['order']['sort']}
{$params['manytomany']['order']['dir']}";
}
-
$this->db->query("SELECT {$column} FROM {$table} WHERE {$key}={$id}
{$order_method}", __LINE__, __FILE__);
+
$this->db2->query("SELECT {$column} FROM {$table} WHERE {$key}={$id}
{$order_method}", __LINE__, __FILE__);
$row[$field] = array();
- while
($this->db->next_record())
+ while
($this->db2->next_record())
{
$data = array();
foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
@@ -343,7 +376,7 @@
$type = $params['type'];
}
-
$data[$col] = $this->_unmarshal($this->db->f($col, false), $type);
+
$data[$col] = $this->_unmarshal($this->db2->f($col, false), $type);
}
$row[$field][]
= $data;
}
@@ -351,11 +384,11 @@
else
{
$column =
$params['manytomany']['column'];
-
$this->db->query("SELECT $column FROM $table WHERE $key=$id", __LINE__,
__FILE__);
+
$this->db2->query("SELECT $column FROM $table WHERE $key=$id", __LINE__,
__FILE__);
$row[$field] = array();
- while
($this->db->next_record())
+ while
($this->db2->next_record())
{
- $row[$field][]
= $this->_unmarshal($this->db->f($column, false), $params['type']);
+ $row[$field][]
= $this->_unmarshal($this->db2->f($column, false), $params['type']);
}
}
}
@@ -821,10 +854,24 @@
}
}
}
+ if ($this->db->get_transaction())
+ {
+ $this->global_lock = true;
+ }
+ else
+ {
+ $this->db->transaction_begin();
+ }
+
foreach ($update_queries as $update_query)
{
$this->db->query($update_query, __LINE__,
__FILE__);
}
+
+ if (!$this->global_lock)
+ {
+ $this->db->transaction_commit();
+ }
$receipt['id'] = $id;
$receipt['message'][] = array('msg' => lang('Entity %1
has been updated', $entry['id']));
return $receipt;
Modified: branches/dev-syncromind-2/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/dev-syncromind-2/booking/inc/class.uiallocation.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/booking/inc/class.uiallocation.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -287,7 +287,7 @@
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
- $season =
$this->season_bo->read_single($_POST['season_id']);
+ $season =
$this->season_bo->read_single(phpgw::get_var('season_id', 'int'));
array_set_default($_POST, 'resources', array());
$allocation = extract_values($_POST,
$this->fields);
if ($_POST['cost'])
@@ -301,6 +301,17 @@
$to_date = $_POST['to_'];
$from_date_arr = explode(' ', $_POST['from_']);
$to_date_arr = explode(' ', $_POST['to_']);
+ if(count($from_date_arr) == 2)
+ {
+ $from_time = $from_date_arr[1];
+ $to_time = $to_date_arr[1];
+ }
+ else
+ {
+ $from_time = $_POST['from_'];
+ $to_time = $_POST['to_'];
+ }
+
if(!isset($_POST['weekday']))
{
$_POST['weekday'] = strtolower
(date('l', phpgwapi_datetime::date_to_timestamp($_POST['from_'])));
@@ -310,8 +321,8 @@
// $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $_POST['from_']));
// $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $_POST['to_']));
- $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $from_date_arr[1]));
- $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $to_date_arr[1]));
+ $allocation['from_'] = strftime("%Y-%m-%d
%H:%M", strtotime($_POST['weekday'] . " " . $from_time));
+ $allocation['to_'] = strftime("%Y-%m-%d %H:%M",
strtotime($_POST['weekday'] . " " . $to_time));
if (($_POST['weekday'] != 'sunday' && date('w')
> date('w', strtotime($_POST['weekday']))) || (date('w') == '0' && date('w') <
date('w', strtotime($_POST['weekday']))))
{
@@ -398,14 +409,14 @@
}
else
{
- $dateTimeFrom = phpgw::get_var('from_',
'string');
- $dateTimeTo = phpgw::get_var('to_', 'string');
+ $dateTimeFrom = phpgw::get_var('from_',
'string', 'POST');
+ $dateTimeTo = phpgw::get_var('to_', 'string',
'POST');
$dateTimeFromE = explode(" ", $dateTimeFrom[0]);
$dateTimeToE = explode(" ", $dateTimeTo[0]);
if (phpgw::get_var('from_', 'string') < 14)
{
- $timeFrom[] = phpgw::get_var('from_',
'string');
- $timeTo[] = phpgw::get_var('to_',
'string');
+ $timeFrom[] = phpgw::get_var('from_',
'string', 'POST');
+ $timeTo[] = phpgw::get_var('to_',
'string', 'POST');
}
else
{
Modified: branches/dev-syncromind-2/booking/js/booking/schedule.js
===================================================================
--- branches/dev-syncromind-2/booking/js/booking/schedule.js 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/booking/js/booking/schedule.js 2016-09-07
17:59:19 UTC (rev 15608)
@@ -15,7 +15,7 @@
var detected_lang = navigator.language || navigator.userLanguage;
var lang = {};
- if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang ==
'nb')
+ if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang ==
'nb' ||detected_lang == 'nb-no' || detected_lang == 'no-no' || detected_lang ==
'nn-no')
{
lang = {
WEEKDAYS_FULL: [
Property changes on: branches/dev-syncromind-2/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14937-15027,15253-15304,15306-15337
+ /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14937-15027,15253-15304,15306-15337,15476-15607
Modified:
branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
===================================================================
--- branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/bookingfrontend/js/bookingfrontend/schedule.js
2016-09-07 17:59:19 UTC (rev 15608)
@@ -13,7 +13,7 @@
var detected_lang = navigator.language || navigator.userLanguage;
var lang = {};
- if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang ==
'nb')
+ if(detected_lang == 'no' || detected_lang == 'nn' || detected_lang ==
'nb' ||detected_lang == 'nb-no' || detected_lang == 'no-no' || detected_lang ==
'nn-no')
{
lang = {
WEEKDAYS_FULL: [
Modified: branches/dev-syncromind-2/controller/inc/class.uidocument.inc.php
===================================================================
--- branches/dev-syncromind-2/controller/inc/class.uidocument.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/controller/inc/class.uidocument.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -56,10 +56,10 @@
parent::__construct();
$this->so = controller_sodocument::get_instance();
$this->so_procedure =
controller_soprocedure::get_instance();
- $this->read = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_READ, 'controller');//1
- $this->add = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_ADD, 'controller');//2
- $this->edit = $GLOBALS['phpgw']->acl->check('.control',
PHPGW_ACL_EDIT, 'controller');//4
- $this->delete =
$GLOBALS['phpgw']->acl->check('.control', PHPGW_ACL_DELETE, 'controller');//8
+ $this->read =
$GLOBALS['phpgw']->acl->check('.procedure', PHPGW_ACL_READ, 'controller');//1
+ $this->add =
$GLOBALS['phpgw']->acl->check('.procedure', PHPGW_ACL_ADD, 'controller');//2
+ $this->edit =
$GLOBALS['phpgw']->acl->check('.procedure', PHPGW_ACL_EDIT, 'controller');//4
+ $this->delete =
$GLOBALS['phpgw']->acl->check('.procedure', PHPGW_ACL_DELETE, 'controller');//8
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/base.css');
}
@@ -349,20 +349,21 @@
return;
} */
- $result = $this->so->delete_document_from_vfs
- (
+ $result = $this->so->delete_document_from_vfs(
$document_properties['document_type'],
$document_properties['id'], $document->get_name()
);
if ($result)
{
$this->so->delete_document($document_id);
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uidocument.show',
+ }
+ else
+ {
+ phpgwapi_cache::message_set('Not deleted',
'error');
+ }
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'controller.uidocument.show',
'procedure_id' => $procedure->get_id(),
'tab' => 'documents'));
- }
- // TODO: communicate error/message to user
- return false;
}
/**
Modified: branches/dev-syncromind-2/helpdesk/inc/class.botts.inc.php
===================================================================
--- branches/dev-syncromind-2/helpdesk/inc/class.botts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/inc/class.botts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -442,7 +442,10 @@
$this->so->update_view($id);
$values['attributes'] = $this->get_custom_cols();
- $ticket = $this->so->read_single($id, $values);
+ if(!$ticket = $this->so->read_single($id, $values))
+ {
+ return array();
+ }
$ticket = $this->custom->prepare($ticket, 'helpdesk',
'.ticket', $view);
$ticket['user_lid'] =
$GLOBALS['phpgw']->accounts->id2name($ticket['user_id']);
Modified: branches/dev-syncromind-2/helpdesk/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind-2/helpdesk/inc/class.sotts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/inc/class.sotts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -430,8 +430,72 @@
function read_single($id, $values = array() )
{
$id = (int) $id;
- $sql = "SELECT * FROM phpgw_helpdesk_tickets WHERE id =
{$id}";
+
+ $GLOBALS['phpgw']->acl->set_account_id($this->account);
+ $this->grants =
$GLOBALS['phpgw']->acl->get_grants2('helpdesk','.ticket');
+
+ $acl_join = "{$this->join} phpgw_accounts ON
phpgw_helpdesk_tickets.user_id=phpgw_accounts.account_id";
+ $acl_join .= " {$this->join} phpgw_group_map ON
(phpgw_accounts.account_id = phpgw_group_map.account_id)";
+
+ $categories =
$GLOBALS['phpgw']->locations->get_subs('helpdesk', '.ticket.category');
+
+ $grant_category = array();
+ foreach ($categories as $location)
+ {
+ if ($GLOBALS['phpgw']->acl->check($location,
PHPGW_ACL_READ, 'helpdesk'))
+ {
+ $category = explode('.',$location);
+ $grant_category[] = $category[3];
+ }
+ }
+
+ $grant_category[] = -1;//If no one found - not breaking
the query
+
+
+ $GLOBALS['phpgw']->config->read();
+
+ $filtermethod = '';
+
if(isset($GLOBALS['phpgw']->config->config_data['acl_at_tts_category']) &&
$GLOBALS['phpgw']->config->config_data['acl_at_tts_category'])
+ {
+ $filtermethod = " AND
phpgw_helpdesk_tickets.cat_id IN (" . implode(",", $grant_category) . ")";
+ }
+
+
+ if (is_array($this->grants))
+ {
+ $public_user_list = array();
+ if (is_array($this->grants['accounts']) &&
$this->grants['accounts'])
+ {
+ foreach($this->grants['accounts'] as
$user => $_right)
+ {
+ $public_user_list[] = $user;
+ }
+ unset($user);
+ reset($public_user_list);
+ $filtermethod .= " AND
(phpgw_helpdesk_tickets.user_id IN(" . implode(',', $public_user_list) . ")";
+ }
+
+ $public_group_list = array();
+ if (is_array($this->grants['groups']) &&
$this->grants['groups'])
+ {
+ foreach($this->grants['groups'] as
$user => $_right)
+ {
+ $public_group_list[] = $user;
+ }
+ unset($user);
+ reset($public_group_list);
+ $where = $public_user_list ? 'OR' :
'AND';
+ $filtermethod .= " $where
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+ }
+ if($public_user_list && !$public_group_list)
+ {
+ $filtermethod .=')';
+ }
+ }
+
+ $sql = "SELECT * FROM phpgw_helpdesk_tickets
{$acl_join} WHERE id = {$id} {$filtermethod}";
+
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
@@ -505,102 +569,48 @@
}
}
- function add($ticket)
+ function add( &$ticket, $values_attribute = array() )
{
- if(isset($ticket['location']) &&
is_array($ticket['location']))
- {
- foreach ($ticket['location'] as $input_name =>
$value)
- {
- if(isset($value) && $value)
- {
- $cols[] = $input_name;
- $vals[] = $value;
- }
- }
- }
+ $table = 'phpgw_helpdesk_tickets';
- if(isset($ticket['extra']) &&
is_array($ticket['extra']))
+ $value_set = array();
+ $data_attribute = $this->custom->prepare_for_db($table,
$values_attribute);
+ if (isset($data_attribute['value_set']))
{
- foreach ($ticket['extra'] as $input_name =>
$value)
+ foreach ($data_attribute['value_set'] as
$input_name => $value)
{
- if(isset($value) && $value)
+ if (isset($value) && $value)
{
- $cols[] = $input_name;
- $vals[] = $value;
+ $value_set[$input_name] =
$value;
}
}
}
- if($cols)
- {
- $cols = "," . implode(",", $cols);
- $vals = ",'" . implode("','", $vals) . "'";
- }
+ $value_set['priority'] = isset($ticket['priority']) ?
$ticket['priority'] : 0;
+ $value_set['user_id'] =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $value_set['assignedto'] = $ticket['assignedto'];
+ $value_set['group_id'] = $ticket['group_id'];
+ $value_set['subject'] =
$this->db->db_addslashes($ticket['subject']);
+ $value_set['cat_id'] = $ticket['cat_id'];
+ $value_set['status'] = $ticket['status'];
+ $value_set['details'] =
$this->db->db_addslashes($ticket['details']);
+ $value_set['location_code'] = $ticket['location_code'];
+ $value_set['entry_date'] = time();
+ $value_set['modified_date'] = time();
+ $value_set['finnish_date'] = $ticket['finnish_date'];
+ $value_set['contact_id'] = $ticket['contact_id'];
+ $value_set['publish_note'] = 1;
- $address = '';
- if(isset($ticket['street_name']) &&
$ticket['street_name'])
- {
- $address[]= $ticket['street_name'];
- $address[]= $ticket['street_number'];
- $address =
$this->db->db_addslashes(implode(" ", $address));
- }
- if(!$address)
- {
- $address =
$this->db->db_addslashes($ticket['location_name']);
- }
-
- $values= array
- (
-
isset($ticket['priority'])?$ticket['priority']:0,
-
$GLOBALS['phpgw_info']['user']['account_id'],
- $ticket['assignedto'],
- $ticket['group_id'],
-
$this->db->db_addslashes($ticket['subject']),
- $ticket['cat_id'],
- $ticket['status'],
-
$this->db->db_addslashes($ticket['details']),
- $ticket['location_code'],
- $address,
- time(),
- time(),
- $ticket['finnish_date'],
- $ticket['contact_id'],
- 1
- );
-
- $values = $this->db->validate_insert($values);
+ $cols = implode(',', array_keys($value_set));
+ $values =
$this->db->validate_insert(array_values($value_set));
$this->db->transaction_begin();
- $this->db->query("insert into phpgw_helpdesk_tickets
(priority,user_id,"
- .
"assignedto,group_id,subject,cat_id,status,details,location_code,"
- .
"address,entry_date,modified_date,finnish_date,contact_id,publish_note $cols)"
- . "VALUES ($values $vals )",__LINE__,__FILE__);
+ $this->db->query("INSERT INTO {$table} ({$cols}) VALUES
({$values})", __LINE__, __FILE__);
- $id =
$this->db->get_last_insert_id('phpgw_helpdesk_tickets','id');
- if(isset($ticket['extra']['contact_phone']) &&
$ticket['extra']['contact_phone'] && isset($ticket['extra']['tenant_id']) &&
$ticket['extra']['tenant_id'])
- {
- $this->db->query("update fm_tenant set
contact_phone='". $ticket['extra']['contact_phone']. "' where id='".
$ticket['extra']['tenant_id']. "'",__LINE__,__FILE__);
- }
+ $id = $this->db->get_last_insert_id($table, 'id');
- if(isset($ticket['origin']) &&
is_array($ticket['origin']))
- {
- if($ticket['origin'][0]['data'][0]['id'])
- {
- $interlink_data = array
- (
- 'location1_id'
=> $GLOBALS['phpgw']->locations->get_id('helpdesk',
$ticket['origin'][0]['location']),
- 'location1_item_id' =>
$ticket['origin'][0]['data'][0]['id'],
- 'location2_id'
=> $GLOBALS['phpgw']->locations->get_id('helpdesk', '.ticket'),
- 'location2_item_id' =>
$id,
- 'account_id'
=> $this->account
- );
- $interlink =
CreateObject('helpdesk.interlink');
-
$interlink->add($interlink_data,$this->db);
- }
- }
-
if($this->db->transaction_commit())
{
$this->historylog->add('O',$id, time(),'');
Modified: branches/dev-syncromind-2/helpdesk/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind-2/helpdesk/inc/class.uitts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/inc/class.uitts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -50,13 +50,15 @@
'_print' => true,
'columns' => true,
'update_data' => true,
- 'upload_clip' => true
+ 'upload_clip' => true,
+ 'view_image' => true
);
/**
* @var boolean $_simple use simplified interface
*/
protected $_simple = false;
+ protected $_group_candidates = array();
protected $_show_finnish_date = false;
protected $_category_acl = false;
var $part_of_town_id;
@@ -105,9 +107,19 @@
$this->p_num =
$this->bo->p_num;
$user_groups =
$GLOBALS['phpgw']->accounts->membership($this->account);
$simple_group =
isset($this->bo->config->config_data['fmttssimple_group']) ?
$this->bo->config->config_data['fmttssimple_group'] : array();
+ if
(isset($this->bo->config->config_data['fmtts_assign_group_candidates']) &&
is_array($this->bo->config->config_data['fmtts_assign_group_candidates']))
+ {
+ foreach
($this->bo->config->config_data['fmtts_assign_group_candidates'] as
$group_candidate)
+ {
+ if ($group_candidate)
+ {
+ $this->_group_candidates[] =
$group_candidate;
+ }
+ }
+ }
foreach ( $user_groups as $group => $dummy)
{
- if ( in_array($group, $simple_group))
+ if ( in_array($group, $simple_group) &&
!in_array($group, $this->_group_candidates))
{
$this->_simple = true;
break;
@@ -301,13 +313,13 @@
foreach($name_temp as $_key => $_name)
{
- array_push($name,$_key);
+ array_push($name,$_key);
}
foreach($descr_temp as $_key => $_name)
{
- array_push($descr,$_name);
+ array_push($descr,$_name);
}
if($this->_show_finnish_date)
@@ -384,7 +396,7 @@
}
else
{
- return lang('delete failed');
+ return lang('delete failed');
}
}
@@ -575,7 +587,8 @@
$filter_tts_assigned_to_me =
$GLOBALS['phpgw_info']['user']['preferences']['helpdesk']['tts_assigned_to_me'];
- $values_combo_box[4] =
$this->bocommon->get_user_list_right2('filter', PHPGW_ACL_EDIT, $this->user_id,
$this->acl_location);
+ $values_combo_box[4] =
$this->_get_user_list($this->user_id);
+
array_unshift($values_combo_box[4], array(
'id' => -1 *
$GLOBALS['phpgw_info']['user']['account_id'],
'name' => lang('my assigned tickets'),
@@ -989,9 +1002,17 @@
$values =
$this->bocommon->collect_locationdata($values, $insert_record);
- if (!$values['subject'] &&
isset($this->bo->config->config_data['tts_mandatory_title']) &&
$this->bo->config->config_data['tts_mandatory_title'])
+ if (!$values['subject'])
{
- $receipt['error'][] = array('msg' =>
lang('Please enter a title !'));
+
if(isset($this->bo->config->config_data['tts_mandatory_title']) &&
$this->bo->config->config_data['tts_mandatory_title'])
+ {
+ $receipt['error'][] =
array('msg' => lang('Please enter a title !'));
+ }
+ else
+ {
+ $_cat =
$this->cats->return_single($values['cat_id']);
+ $values['subject'] =
$_cat[0]['name'];
+ }
}
if (!$values['cat_id'])
@@ -1095,8 +1116,9 @@
$bofiles->vfs->override_acl = 0;
}
}
-
- if($_POST['pasted_image'])
+ if($_POST['pasted_image'] &&
+ $_POST['pasted_image']
!='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAPklEQVR4nO3BMQEAAADCoPVPbQsvoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgKcBnKQAAaZ1lY4AAAAASUVORK5CYII='
+ )
{
$img = $_POST['pasted_image'];
$img =
str_replace('data:image/png;base64,', '', $img);
@@ -1288,6 +1310,68 @@
}
}
+ function view_image()
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ if (!$this->acl_read)
+ {
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+
+ $thumb = phpgw::get_var('thumb', 'bool');
+ $img_id = phpgw::get_var('img_id', 'int');
+
+ $bofiles = CreateObject('property.bofiles');
+
+ if($img_id)
+ {
+ $file_info = $bofiles->vfs->get_info($img_id);
+ $file =
"{$file_info['directory']}/{$file_info['name']}";
+ }
+ else
+ {
+ $file = urldecode(phpgw::get_var('file'));
+ }
+
+ $source = "{$bofiles->rootdir}{$file}";
+ $thumbfile = "$source.thumb";
+
+ // prevent path traversal
+ if (preg_match('/\.\./', $source))
+ {
+ return false;
+ }
+
+ $uigallery = CreateObject('property.uigallery');
+
+ $re_create = false;
+ if ($uigallery->is_image($source) && $thumb &&
$re_create)
+ {
+ $uigallery->create_thumb($source, $thumbfile,
$thumb_size = 50);
+ readfile($thumbfile);
+ }
+ else if ($thumb && is_file($thumbfile))
+ {
+ readfile($thumbfile);
+ }
+ else if ($uigallery->is_image($source) && $thumb)
+ {
+ $uigallery->create_thumb($source, $thumbfile,
$thumb_size = 50);
+ readfile($thumbfile);
+ }
+ else if ($img_id)
+ {
+ $bofiles->get_file($img_id);
+ }
+ else
+ {
+ $bofiles->view_file('', $file);
+ }
+ }
+
function get_files()
{
$id = phpgw::get_var('id', 'int');
@@ -1307,15 +1391,32 @@
$values = $this->bo->read_single($id);
$content_files = array();
+ $img_types = array(
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif'
+ );
+ $z = 0;
foreach ($values['files'] as $_entry)
{
- $content_files[] = array
- (
+ $content_files[] = array(
'file_name' => '<a href="' .
$link_view_file . '&file_id=' . $_entry['file_id'] . '" target="_blank"
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to delete file') . '">',
'attach_file' => '<input
type="checkbox" name="values[file_attach][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to attach file') . '">'
);
+ if ( in_array($_entry['mime_type'], $img_types))
+ {
+ $content_files[$z]['file_name'] =
$_entry['name'];
+ $content_files[$z]['img_id'] =
$_entry['file_id'];
+ $content_files[$z]['img_url'] =
self::link(array(
+ 'menuaction' =>
'helpdesk.uitts.view_image',
+ 'img_id' =>
$_entry['file_id'],
+ 'file' =>
$_entry['directory'] . '/' . $_entry['file_name']
+ ));
+ $content_files[$z]['thumbnail_flag'] =
'thumb=1';
+ }
+ $z ++;
}
if (phpgw::get_var('phpgw_return_as') == 'json')
@@ -1493,6 +1594,10 @@
$ticket = $this->bo->read_single($id, $values);
+ if(!$ticket)
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'helpdesk.uitts.index'));
+ }
if (isset($ticket['attributes']) &&
is_array($ticket['attributes']))
{
foreach ($ticket['attributes'] as & $attribute)
@@ -1611,17 +1716,41 @@
$link_view_file = $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'helpdesk.uitts.view_file'));
- for ($z = 0; $z < count($ticket['files']); $z++)
+ $img_types = array(
+ 'image/jpeg',
+ 'image/png',
+ 'image/gif'
+ );
+
+ $content_files = array();
+
+ $z = 0;
+ foreach ($ticket['files'] as $_entry)
{
- $content_files[$z]['file_name'] = '<a href="' .
$link_view_file . '&file_id=' . $ticket['files'][$z]['file_id'] . '"
target="_blank" title="' . lang('click to view file') . '">' .
$ticket['files'][$z]['name'] . '</a>';
- $content_files[$z]['delete_file'] = '<input
type="checkbox" name="values[file_action][]" value="' .
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') .
'">';
- $content_files[$z]['attach_file'] = '<input
type="checkbox" name="values[file_attach][]" value="' .
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to attach file') .
'">';
+ $content_files[] = array(
+ 'file_name' => '<a href="' .
$link_view_file . '&file_id=' . $_entry['file_id'] . '" target="_blank"
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
+ 'delete_file' => '<input
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to delete file') . '">',
+ 'attach_file' => '<input
type="checkbox" name="values[file_attach][]" value="' . $_entry['file_id'] . '"
title="' . lang('Check to attach file') . '">'
+ );
+ if ( in_array($_entry['mime_type'], $img_types))
+ {
+ $content_files[$z]['file_name'] =
$_entry['name'];
+ $content_files[$z]['img_id'] =
$_entry['file_id'];
+ $content_files[$z]['img_url'] =
self::link(array(
+ 'menuaction' =>
'helpdesk.uitts.view_image',
+ 'img_id' =>
$_entry['file_id'],
+ 'file' =>
$_entry['directory'] . '/' . $_entry['file_name']
+ ));
+ $content_files[$z]['thumbnail_flag'] =
'thumb=1';
+ }
+ $z ++;
}
-
$attach_file_def = array(
array('key' => 'file_name', 'label' =>
lang('Filename'), 'sortable' => false,
'resizeable' => true),
+ array('key' => 'picture', 'label' =>
lang('picture'), 'sortable' => false,
+ 'resizeable' => true, 'formatter' =>
'JqueryPortico.showPicture'),
array('key' => 'delete_file', 'label' =>
lang('Delete file'), 'sortable' => false,
'resizeable' => true, 'formatter' =>
'FormatterCenter'),
);
@@ -1748,7 +1877,7 @@
'lang_user_statustext' => lang('Select the user
the selection belongs to. To do not use a user select NO USER'),
'select_user_name' => 'values[assignedto]',
'value_assignedto_id' => $ticket['assignedto'],
- 'user_list' =>
$this->_get_user_list($values['assignedto']),
+ 'user_list' =>
$this->_get_user_list($ticket['assignedto']),
'lang_no_group' => lang('No group'),
'group_list' =>
$this->bo->get_group_list($ticket['group_id']),
'select_group_name' => 'values[group_id]',
@@ -1891,22 +2020,11 @@
private function _get_user_list($selected)
{
- if
(isset($this->bo->config->config_data['fmtts_assign_group_candidates']) &&
is_array($this->bo->config->config_data['fmtts_assign_group_candidates']))
- {
- foreach
($this->bo->config->config_data['fmtts_assign_group_candidates'] as
$group_candidate)
- {
- if ($group_candidate)
- {
- $_candidates[] =
$group_candidate;
- }
- }
- }
-
$xsl_rootdir = PHPGW_SERVER_ROOT .
"/property/templates/{$GLOBALS['phpgw_info']['server']['template_set']}";
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'), $xsl_rootdir);
- $users =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT,
$this->acl_location, 'helpdesk', $_candidates);
+ $users =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT,
$this->acl_location, 'helpdesk', $this->_group_candidates);
$user_list = array();
$selected_found = false;
foreach ($users as $user)
Modified: branches/dev-syncromind-2/helpdesk/inc/hook_settings.inc.php
===================================================================
--- branches/dev-syncromind-2/helpdesk/inc/hook_settings.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/inc/hook_settings.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -106,3 +106,4 @@
create_input_box('With of textarea', 'textareacols', 'With of textarea
in forms');
create_input_box('Height of textarea', 'textarearows', 'Height of
textarea in forms');
+ create_input_box('Your Email', 'email', 'Insert your email address');
Modified: branches/dev-syncromind-2/helpdesk/js/portico/tts.add.js
===================================================================
--- branches/dev-syncromind-2/helpdesk/js/portico/tts.add.js 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/js/portico/tts.add.js 2016-09-07
17:59:19 UTC (rev 15608)
@@ -81,6 +81,10 @@
errorMessageKey: ''
});
+upload_canvas = function ()
+{
+ confirm_session('apply');
+}
$(document).ready(function ()
{
@@ -247,6 +251,10 @@
ctx.drawImage(pastedImage, 0, 0);
};
pastedImage.src = source;
+ setTimeout(function ()
+ {
+ upload_canvas();
+ }, 500);
};
}
Modified: branches/dev-syncromind-2/helpdesk/setup/phpgw_no.lang
===================================================================
--- branches/dev-syncromind-2/helpdesk/setup/phpgw_no.lang 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/helpdesk/setup/phpgw_no.lang 2016-09-07
17:59:19 UTC (rev 15608)
@@ -105,11 +105,11 @@
new value helpdesk no Ny verdi
ok helpdesk no OK
about helpdesk no Om
-update subject helpdesk no Oppdater overskrift
+update subject helpdesk no Oppdater emne
failed to create directory helpdesk no Opplasting av fil feilet
organisation helpdesk no Organisasjon
-subject helpdesk no Overskrift
-subject changed helpdesk no Overskrift er endret
+subject helpdesk no Emne
+subject changed helpdesk no Emne er endret
password helpdesk no Passord
item helpdesk no Post
print view helpdesk no Print visning
@@ -125,7 +125,7 @@
send e-mail helpdesk no Send epost
sent by email to helpdesk no sendt med epost til
last helpdesk no Siste
-enter the subject of this ticket helpdesk no Skriv overskrift
+enter the subject of this ticket helpdesk no Angi emne
print helpdesk no Skriv ut
print the ticket helpdesk no Skriv ut melding
delete helpdesk no Slett
@@ -174,5 +174,6 @@
change to helpdesk no Endre til
do you really want to change the status to %1 helpdesk no Vil du
virkelig endre status til %1
do you really want to change the priority to %1 helpdesk no
Vil du virkelig endre prioritet til %1
-please enter a title! helpdesk no Angi en overskrift
-ticket has been updated helpdesk no Melding er oppdatert
\ No newline at end of file
+please enter a title! helpdesk no Angi et emne
+ticket has been updated helpdesk no Melding er oppdatert
+picture helpdesk no Bilde
\ No newline at end of file
Modified:
branches/dev-syncromind-2/phpgwapi/inc/accounts/class.accounts_.inc.php
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/accounts/class.accounts_.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/inc/accounts/class.accounts_.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -649,35 +649,16 @@
* Update the data for a group
*
* @param object $group the phpgwapi_account_group object to
use for the update
- * @param array $users the list of users who belong in the
group
* @param array $modules the list of modules the group shall
have access to
*
* @return integer the group id
*/
- public function update_group($group, $users, $modules = null)
+ public function update_group($group, $modules = null)
{
$this->account = $group;
$this->account_id = $group->id;
$this->save_repository();
- // handle group memberships
- $old_users = array_keys($this->member($group->id));
- $new_users = $users;
- $drop_users = array_diff($old_users, $new_users);
- if ( is_array($drop_users) && count($drop_users) )
- {
- foreach ( $drop_users as $user )
- {
- $this->delete_account4group($user,
$group->id);
- }
- }
- unset($old_users, $users, $drop_users);
-
- foreach ( $new_users as $user )
- {
- $this->add_user2group($user, $group->id);
- }
-
// module permissions
if ( is_array($modules) )
{
Modified: branches/dev-syncromind-2/phpgwapi/inc/class.contacts_sql.inc.php
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/class.contacts_sql.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/inc/class.contacts_sql.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -3421,7 +3421,9 @@
function get_account_id($contact_id)
{
- $account_id = 0;
+
+ return (int) $this->is_user($contact_id);
+/*
$accounts = $GLOBALS['phpgw']->accounts->get_list();
foreach($accounts as $account_data)
{
@@ -3433,6 +3435,7 @@
}
return $account_id;
+*/
}
Modified: branches/dev-syncromind-2/phpgwapi/inc/class.menu.inc.php
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/class.menu.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/inc/class.menu.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -110,6 +110,10 @@
foreach($GLOBALS['phpgw_info']['user']['apps'] as $app
=> $app_info)
// foreach ( $raw_menus as $app => $raw_menu )
{
+ if($app_info['status'] == 2) // hidden
+ {
+ continue;
+ }
$raw_menu = $raw_menus[$app];
// Ignore invalid entries
if(!is_array($raw_menu))
Modified: branches/dev-syncromind-2/phpgwapi/inc/class.phpgw.inc.php
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/class.phpgw.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/inc/class.phpgw.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -27,6 +27,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+ phpgw::import_class('phpgwapi.datetime');
+
/**
* Global ugliness class
*
@@ -572,6 +574,9 @@
case 'html':
$value =
self::clean_html($value);
break;
+ case 'date':
+ $value =
phpgwapi_datetime::date_to_timestamp($value);
+ break;
}
return $value;
}
Copied: branches/dev-syncromind-2/phpgwapi/inc/class.socommon.inc.php (from rev
15607, trunk/phpgwapi/inc/class.socommon.inc.php)
===================================================================
--- branches/dev-syncromind-2/phpgwapi/inc/class.socommon.inc.php
(rev 0)
+++ branches/dev-syncromind-2/phpgwapi/inc/class.socommon.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -0,0 +1,720 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * @author Sigurd Nes <address@hidden> and others
+ * @copyright Copyright (C) 2016 Free Software Foundation
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License v2 or later
+ * @internal
+ * @package phpgroupware
+ * @subpackage phpgwapi
+ * @version $Id: class.custom_fields.inc.php 15409 2016-08-03 11:52:23Z
sigurdne $
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ abstract class phpgwapi_socommon
+ {
+
+ protected $db;
+ protected $db2;
+ protected $db_null = 'NULL';
+ protected $like;
+ protected $join;
+ protected $left_join;
+ protected $sort_field;
+ protected $skip_limit_query;
+ protected $fields = array();
+ protected static $so;
+ protected $table_name;
+
+ public function __construct($table_name, $fields)
+ {
+ $this->db = & $GLOBALS['phpgw']->db;
+ $this->db2 = clone($GLOBALS['phpgw']->db);
+ $this->like = & $this->db->like;
+ $this->join = & $this->db->join;
+ $this->left_join = & $this->db->left_join;
+ $this->sort_field = null;
+ $this->skip_limit_query = null;
+ $this->fields = $fields;
+ $this->table_name = $table_name;
+ }
+
+ /**
+ * Begin transaction
+ *
+ * @return integer|bool current transaction id
+ */
+ public function transaction_begin()
+ {
+ return $this->db->transaction_begin();
+ }
+
+ /**
+ * Complete the transaction
+ *
+ * @return bool True if sucessful, False if fails
+ */
+ public function transaction_commit()
+ {
+ return $this->db->transaction_commit();
+ }
+
+ /**
+ * Rollback the current transaction
+ *
+ * @return bool True if sucessful, False if fails
+ */
+ public function transaction_abort()
+ {
+ return $this->db->transaction_abort();
+ }
+
+ /**
+ * Marshal values according to type
+ * @param $value the value
+ * @param $type the type of value
+ * @return database value
+ */
+ protected function marshal( $value, $type )
+ {
+ if ($value === null)
+ {
+ return 'NULL';
+ }
+ else if ($type == 'int')
+ {
+ if ($value == '')
+ {
+ return 'NULL';
+ }
+ return intval($value);
+ }
+ else if ($type == 'float')
+ {
+ return str_replace(',', '.', $value);
+ }
+ else if ($type == 'field')
+ {
+ return $this->db->db_addslashes($value);
+ }
+ return "'" . $this->db->db_addslashes($value) . "'";
+ }
+
+ /**
+ * Unmarchal database values according to type
+ * @param $value the field value
+ * @param $type a string dictating value type
+ * @return the php value
+ */
+ protected function unmarshal( $value, $type )
+ {
+ if ($type == 'bool')
+ {
+ return (bool)$value;
+ }
+ elseif ($type == 'int')
+ {
+ return (int)$value;
+ }
+ elseif ($value === null || $value == 'NULL' || ($type
!= 'string' && (strlen(trim($value)) === 0)))
+ {
+ return null;
+ }
+ elseif ($type == 'float')
+ {
+ return floatval($value);
+ }
+ else if ($type == 'json')
+ {
+ return json_decode($value, true);
+ }
+ return $value;
+ }
+
+ /**
+ * Get the count of the specified query. Query must return a
signel column
+ * called count.
+ *
+ * @param $sql the sql query
+ * @return the count value
+ */
+ protected function get_query_count( $sql )
+ {
+ $result = $this->db->query($sql);
+ if ($result && $this->db->next_record())
+ {
+ return $this->unmarshal($this->db->f('count',
true), 'int');
+ }
+ }
+
+ /**
+ * Implementing classes must return an instance of itself.
+ *
+ * @return the class instance.
+ */
+ public abstract static function get_instance();
+
+
+ /**
+ * Method for retrieving the db-object (security "forgotten")
+ */
+ public function get_db()
+ {
+ return $this->db;
+ }
+
+ /**
+ * Return all entries matching $params. Valid parameters:
+ *
+ * - $params['start']: Search result offset
+ * - $params['results']: Number of results to return
+ * - $params['sort']: Field to sort by
+ * - $params['query']: LIKE-based query string
+ * - $params['filters']: Array of custom filters
+ *
+ * @return array('total_records'=>X, 'results'=array(...))
+ */
+ function read( $params )
+ {
+ $start = isset($params['start']) && $params['start'] ?
(int)$params['start'] : 0;
+ $results = isset($params['results']) &&
$params['results'] ? (int)$params['results'] : null;
+ $sort = isset($params['sort']) && $params['sort'] ?
$params['sort'] : null;
+ $dir = isset($params['dir']) && $params['dir'] ?
$params['dir'] : 'asc';
+ $query = isset($params['query']) && $params['query'] ?
$params['query'] : null;
+ $filters = isset($params['filters']) &&
$params['filters'] ? $params['filters'] : array();
+ $cols_joins = $this->_get_cols_and_joins($filters);
+ $cols = join(',', $cols_joins[0]);
+ $joins = join(' ', $cols_joins[1]);
+ $condition = $this->_get_conditions($query, $filters);
+
+ // Calculate total number of records
+ $this->db->query("SELECT count(1) AS count FROM
$this->table_name $joins WHERE $condition", __LINE__, __FILE__);
+ $this->db->next_record();
+ $total_records = (int)$this->db->f('count');
+
+ strtolower($results) === 'all' AND $results =
$total_records; //TODO: Kept because of BC. Should be easy to remove this
dependency?
+
+ /*
+ * Due to problem on order with offset - we need to set
an additional parameter in some cases
+ *
http://stackoverflow.com/questions/13580826/postgresql-repeating-rows-from-limit-offset
+ */
+
+ if ($sort)
+ {
+ if (is_array($sort))
+ {
+ $order = "ORDER BY {$sort[0]} {$dir},
{$sort[1]}";
+ }
+ else
+ {
+ $order = "ORDER BY {$sort} {$dir}";
+ }
+ }
+
+ $base_sql = "SELECT $cols FROM $this->table_name $joins
WHERE $condition $order ";
+ if ($results)
+ {
+ $this->db->limit_query($base_sql, $start,
__LINE__, __FILE__, $results);
+ }
+ else
+ {
+ $offset = ($start > 0) ? 'OFFSET ' . $start . '
' : ' ';
+ $this->db->query($base_sql . $offset, __LINE__,
__FILE__);
+ }
+
+ $results = array();
+ while ($this->db->next_record())
+ {
+ $row = array();
+ foreach ($this->fields as $field => $params)
+ {
+ $row[$field] =
$this->unmarshal($this->db->f($field, false), $params['type']);
+ }
+ $results[] = $row;
+ }
+ if (count($results) > 0)
+ {
+ foreach ($results as $id => $result)
+ {
+ $id_map[$result['id']] = $id;
+ }
+ foreach ($this->fields as $field => $params)
+ {
+ if ($params['manytomany'])
+ {
+ $table =
$params['manytomany']['table'];
+ $key =
$params['manytomany']['key'];
+ $ids = join(',',
array_keys($id_map));
+ if
(is_array($params['manytomany']['column']))
+ {
+ $colnames = array();
+ foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+ {
+ $colnames[] =
is_array($paramsOrCol) ? $intOrCol : $paramsOrCol;
+ }
+ $colnames = join(',',
$colnames);
+
+
$this->db->query("SELECT $colnames, $key FROM $table WHERE $key IN($ids)",
__LINE__, __FILE__);
+ $row[$field] = array();
+ while
($this->db->next_record())
+ {
+ $id =
$this->unmarshal($this->db->f($key, false), 'int');
+ $data = array();
+ foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+ {
+ if
(is_array($paramsOrCol))
+ {
+
$col = $intOrCol;
+
$type = isset($paramsOrCol['type']) ? $paramsOrCol['type'] : $params['type'];
+ }
+ else
+ {
+
$col = $paramsOrCol;
+
$type = $params['type'];
+ }
+
+
$data[$col] = $this->unmarshal($this->db->f($col, false), $type);
+ }
+ $row[$field][]
= $data;
+
$results[$id_map[$id]][$field][] = $data;
+ }
+ }
+ else
+ {
+ $column =
$params['manytomany']['column'];
+
$this->db->query("SELECT $column, $key FROM $table WHERE $key IN($ids)",
__LINE__, __FILE__);
+ $row[$field] = array();
+ while
($this->db->next_record())
+ {
+ $id =
$this->unmarshal($this->db->f($key, false), 'int');
+
$results[$id_map[$id]][$field][] = $this->unmarshal($this->db->f($column,
false), $params['type']);
+ }
+ }
+ }
+ }
+ }
+ return array(
+ 'total_records' => $total_records,
+ 'results' => $results,
+ 'start' => $start,
+ 'sort' => is_array($sort) ? $sort[0] : $sort,
+ 'dir' => $dir
+ );
+ }
+
+ protected function primary_key_conditions( $id_params )
+ {
+ if (is_array($id_params))
+ {
+ return $this->_get_conditions(null, $id_params);
+ }
+
+ if (isset($this->fields['id']) &&
isset($this->fields['id']['type']))
+ {
+ $id_value = $this->marshal($id_params,
$this->fields['id']['type']);
+ }
+ else
+ {
+ $id_value = intval($id_params);
+ }
+
+ return $this->table_name . '.id=' . $id_value;
+ }
+
+ function read_single( $id, $return_object = false)
+ {
+ if (!$id && !$return_object)
+ {
+ return array();
+ }
+ $row = array();
+ $pk_params = $this->primary_key_conditions($id);
+ $cols_joins = $this->_get_cols_and_joins();
+ $cols = join(',', $cols_joins[0]);
+ $joins = join(' ', $cols_joins[1]);
+ $this->db->query("SELECT $cols FROM $this->table_name
$joins WHERE $pk_params", __LINE__, __FILE__);
+ if ($this->db->next_record())
+ {
+ foreach ($this->fields as $field => $params)
+ {
+ if ($params['manytomany'])
+ {
+ $table =
$params['manytomany']['table'];
+ $key =
$params['manytomany']['key'];
+
+ if
(is_array($params['manytomany']['column']))
+ {
+ $column = array();
+ foreach
($params['manytomany']['column'] as $fieldOrInt => $paramsOrFieldName)
+ {
+ $column[] =
is_array($paramsOrFieldName) ? $fieldOrInt : $paramsOrFieldName;
+ }
+ $column = join(',',
$column);
+ $order_method = '';
+
+ if
(is_array($params['manytomany']['order']))
+ {
+ $order_method =
"ORDER BY {$params['manytomany']['order']['sort']}
{$params['manytomany']['order']['dir']}";
+ }
+
+
$this->db2->query("SELECT {$column} FROM {$table} WHERE {$key}={$id}
{$order_method}", __LINE__, __FILE__);
+ $row[$field] = array();
+ while
($this->db2->next_record())
+ {
+ $data = array();
+ foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+ {
+ if
(is_array($paramsOrCol))
+ {
+
$col = $intOrCol;
+
$type = isset($paramsOrCol['type']) ? $paramsOrCol['type'] : $params['type'];
+ }
+ else
+ {
+
$col = $paramsOrCol;
+
$type = $params['type'];
+ }
+
+
$data[$col] = $this->unmarshal($this->db2->f($col, false), $type);
+ }
+ $row[$field][]
= $data;
+ }
+ }
+ else
+ {
+ $column =
$params['manytomany']['column'];
+
$this->db2->query("SELECT $column FROM $table WHERE $key=$id", __LINE__,
__FILE__);
+ $row[$field] = array();
+ while
($this->db2->next_record())
+ {
+ $row[$field][]
= $this->unmarshal($this->db2->f($column, false), $params['type']);
+ }
+ }
+ }
+ else
+ {
+ $row[$field] =
$this->unmarshal($this->db->f($field, false), $params['type']);
+ }
+ }
+ }
+ if($return_object)
+ {
+ return $this->populate($row);
+ }
+ else
+ {
+ return $row;
+ }
+ }
+
+
+ function _get_conditions( $query, $filters )
+ {
+ $clauses = array('1=1');
+ if ($query)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($query) . "%'";
+ $like_clauses = array();
+ foreach ($this->fields as $field => $params)
+ {
+ if ($params['query'])
+ {
+ $table = $params['join'] ?
$this->build_join_table_alias($field, $params) : $this->table_name;
+ $column = $params['join'] ?
$params['join']['column'] : $field;
+ if ($params['type'] == 'int')
+ {
+ if (!(int)$query)
+ {
+ continue;
+ }
+ $like_clauses[] =
"{$table}.{$column} = " . (int)$query;//$this->db->db_addslashes($query);
+ }
+ else
+ {
+ $like_clauses[] =
"{$table}.{$column} $this->like $like_pattern";
+ }
+ }
+ }
+ if (count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }
+ foreach ($filters as $key => $val)
+ {
+ if ($this->fields[$key])
+ {
+ $table = $this->fields[$key]['join'] ?
$this->build_join_table_alias($key, $this->fields[$key]) : $this->table_name;
+
+ if (is_array($val) && count($val) == 0)
+ {
+ $clauses[] = '1=0';
+ }
+ else if (is_array($val))
+ {
+ $vals = array();
+ foreach ($val as $v)
+ {
+ $vals[] =
$this->marshal($v, $this->fields[$key]['type']);
+ }
+ $clauses[] = "({$table}.{$key}
IN (" . join(',', $vals) . '))';
+ }
+ else if ($val == null)
+ {
+ $clauses[] = "{$table}.{$key}
IS " . $this->db_null;
+ }
+ else
+ {
+ $_column =
$this->fields[$key]['join'] ? $this->fields[$key]['join']['column'] : $key;
+ $clauses[] =
"{$table}.{$_column}=" . $this->marshal($val, $this->fields[$key]['type']);
+ }
+ }
+ else if ($key == 'where')
+ {
+ //Includes a custom where-clause as a
filter. Also replaces %%table%%
+ //tokens with actual table_name in the
clause.
+ $where_clauses = (array)$val;
+ if (count($where_clauses) == 0)
+ {
+ continue;
+ }
+ $clauses[] = strtr(join((array)$val, '
AND '), array('%%table%%' => $this->table_name));
+ }
+ }
+ return join(' AND ', $clauses);
+ }
+
+ protected function build_join_table_alias( $field, array
$params )
+ {
+ return
"{$params['join']['table']}_{$params['join']['column']}_{$field}";
+ }
+
+ public function _get_cols_and_joins( $filters = array() )
+ {
+ $cols = array();
+ $joins = array();
+
+ foreach ($this->fields as $field => $params)
+ {
+ if (isset($params['manytomany']) &&
$params['manytomany'])
+ {
+ continue;
+ }
+ if (isset($params['related']) &&
$params['related'])
+ {
+ continue;
+ }
+ else if (isset($params['join']) &&
$params['join'])
+ {
+ if ($params['join_type'] ==
'manytomany' && !isset($filters[$field]) && !$filters[$field])
+ {
+ continue;
+ }
+
+ $join_table_alias =
$this->build_join_table_alias($field, $params);
+ $cols[] =
"{$join_table_alias}.{$params['join']['column']} AS {$field}";
+ $joins[] = "LEFT JOIN
{$params['join']['table']} AS {$join_table_alias}
ON({$join_table_alias}.{$params['join']['key']}={$this->table_name}.{$params['join']['fkey']})";
+ }
+ else
+ {
+ $value_expression =
isset($params['expression']) ?
+ '(' .
strtr($params['expression'], array('%%table%%' => $this->table_name)) . ')' :
"{$this->table_name}.{$field}";
+ $cols[] = "{$value_expression} AS
{$field}";
+ }
+ }
+ return array($cols, $joins);
+ }
+
+
+ /**
+ * Implementing classes must return the name of the field used
in the query
+ * returned from get_query().
+ *
+ * @return string with name of id field.
+ */
+ protected function get_id_field_name()
+ {
+
+ }
+
+ protected abstract function populate( array $data );
+
+
+ protected function add( &$object )
+ {
+ $object->entry_date = time();
+ $value_set = array();
+
+ $fields = $object::get_fields();
+
+ foreach ($fields as $field => $field_info)
+ {
+ if(($field_info['action'] & PHPGW_ACL_ADD)
+ && empty($field_info['join'])
+ && empty($field_info['related'])
+ && empty($field_info['manytomany']))
+ {
+ $value_set[$field] = $object->$field;
+ }
+ }
+
+ $sql = "INSERT INTO {$this->table_name} (".
implode(',', array_keys($value_set))
+ . ') VALUES ('
+ .
$this->db->validate_insert(array_values($value_set))
+ . ')';
+
+ if ($this->db->get_transaction())
+ {
+ $this->global_lock = true;
+ }
+ else
+ {
+ $this->db->transaction_begin();
+ }
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $id = $this->db->get_last_insert_id($this->table_name,
'id');
+ $object->set_id($id);
+ $this->add_manytomany($object);
+ if (!$this->global_lock)
+ {
+ $this->db->transaction_commit();
+ }
+ return $object;
+ }
+
+ protected function update( $object )
+ {
+ if ($this->db->get_transaction())
+ {
+ $this->global_lock = true;
+ }
+ else
+ {
+ $this->db->transaction_begin();
+ }
+
+ $id = $object->get_id();
+ $value_set = array();
+
+ foreach ($this->fields as $field => $field_info)
+ {
+ if(($field_info['action'] & PHPGW_ACL_EDIT)
+ && empty($field_info['join'])
+ && empty($field_info['related'])
+ && empty($field_info['manytomany']))
+ {
+ $value_set[$field] = $object->$field;
+ }
+ }
+
+ $sql = "UPDATE {$this->table_name} SET "
+ . $this->db->validate_update($value_set)
+ . " WHERE id = {$id}";
+
+ $ret1 = $this->db->query($sql,__LINE__,__FILE__);
+
+ $ret2 = $this->add_manytomany($object);
+
+ if (!$this->global_lock)
+ {
+ $this->db->transaction_commit();
+ }
+ return ($ret1 && $ret2);
+ }
+
+ protected function add_manytomany( $object )
+ {
+ $id = $object->get_id();
+
+ foreach ($this->fields as $field => $params)
+ {
+ if (!empty($params['manytomany']) &&
!empty($params['manytomany']['input_field']) &&
$object->get_field($params['manytomany']['input_field']))
+ {
+ $table = $params['manytomany']['table'];
+ $key = $params['manytomany']['key'];
+
+ if
(is_array($params['manytomany']['column']))
+ {
+ $colnames = array();
+ foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+ {
+
$colnames[(is_array($paramsOrCol) ? $intOrCol : $paramsOrCol)] = true;
+ }
+ unset($colnames['id']);
+
+ $colnames = join(',',
array_keys($colnames));
+
+ $v =
$object->get_field($params['manytomany']['input_field']);
+
+ $data = array();
+ foreach
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
+ {
+ if
(is_array($paramsOrCol))
+ {
+ $col =
$intOrCol;
+ $type =
isset($paramsOrCol['type']) ? $paramsOrCol['type'] : $params['type'];
+ }
+ else
+ {
+ $col =
$paramsOrCol;
+ $type =
$params['type'];
+ }
+
+ if ($col == 'id')
+ {
+ continue;
+ }
+
+ $data[] =
$this->marshal($v[$col], $type);
+ }
+ $v = join(',', $data);
+ $update_query = "INSERT INTO
$table ($key, $colnames) VALUES($id, $v)";
+ return
$this->db->query($update_query,__LINE__,__FILE__);
+ }
+ else
+ {
+ $colname =
$params['manytomany']['column'];
+ $v =
$this->marshal($object->get_field($params['manytomany']['input_field']),
$params['type']);
+ $update_query = "INSERT INTO
$table ($key, $colname) VALUES($id, $v)";
+ return
$this->db->query($update_query,__LINE__,__FILE__);
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Store the object in the database. If the object has no ID
it is assumed to be new and
+ * inserted for the first time. The object is then updated
with the new insert id.
+ */
+ public function store( &$object )
+ {
+ if ($object->get_id() > 0)
+ {
+ // We can assume this composite came from the
database since it has an ID. Update the existing row
+ return $this->update($object);
+ }
+ else
+ {
+ // This object does not have an ID, so will be
saved as a new DB row
+ return $this->add($object);
+ }
+ }
+ }
Modified: branches/dev-syncromind-2/phpgwapi/templates/base/attributes_form.xsl
===================================================================
--- branches/dev-syncromind-2/phpgwapi/templates/base/attributes_form.xsl
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/templates/base/attributes_form.xsl
2016-09-07 17:59:19 UTC (rev 15608)
@@ -397,6 +397,14 @@
</xsl:attribute>
</xsl:when>
</xsl:choose>
+ <xsl:if
test="nullable!='1'">
+ <xsl:attribute
name="data-validation">
+
<xsl:text>required</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute
name="data-validation-error-msg">
+
<xsl:value-of select="input_text"/>
+ </xsl:attribute>
+ </xsl:if>
</input>
<div id="{$custom_container}"/>
</xsl:when>
Modified: branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/phpgwapi/templates/base/datatable_jquery.xsl
2016-09-07 17:59:19 UTC (rev 15608)
@@ -136,7 +136,7 @@
<xsl:when
test="type = 'autocomplete'">
<td
class="auto">
<div class="auto">
-
<input id="filter_{name}_name" name="filter_{name}_name" type="text">
+
<input id="filter_{name}_name" name="{name}_name" type="text">
<xsl:attribute name="value">
<xsl:value-of select="../../../filters/*[local-name() =
$filter_key_name]"/>
</xsl:attribute>
@@ -309,7 +309,7 @@
</xsl:when>
<xsl:otherwise>
<td
valign="top">
-
<input id="innertoolbar">
+
<input id="innertoolbar_{name}">
<xsl:attribute name="type">
<xsl:value-of select="phpgw:conditional(not(type), '', type)"/>
</xsl:attribute>
@@ -957,6 +957,12 @@
var table_url =
JqueryPortico.parseURL(window.location.href);
var menuaction =
table_url.searchObject.menuaction.replace(/\./g, '_');
+ //clear state
+ var clear_state = false;
+ if(typeof(table_url.searchObject.clear_state) !=
'undefined' && table_url.searchObject.clear_state == 1)
+ {
+ clear_state = true;
+ }
//uiocation
if(typeof(table_url.searchObject.type_id) !=
'undefined')
{
@@ -1038,7 +1044,10 @@
$.each(params, function(index,
value) {
if ( index ==
oControl.attr('name') )
{
- oControl.val(
value );
+ if (clear_state
!== true)
+ {
+
oControl.val( value );
+ }
}
});
});
@@ -1236,6 +1245,19 @@
}
});
</xsl:if>
+ <xsl:if test="type = 'checkbox'">
+ $("#innertoolbar_<xsl:value-of
select="name"/>").change( function()
+ {
+ if($(this).prop("checked"))
+ {
+ filterData('<xsl:value-of
select="name"/>', 1);
+ }
+ else
+ {
+ filterData('<xsl:value-of
select="name"/>', 0);
+ }
+ });
+ </xsl:if>
<xsl:if test="type = 'autocomplete'">
$(document).ready(function() {
$('input.ui-autocomplete-input#filter_<xsl:value-of
select="name"/>_name').on('autocompleteselect', function(event, ui){
Modified: branches/dev-syncromind-2/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.boadmin_entity.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.boadmin_entity.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -495,6 +495,8 @@
public function save_attrib( $attrib, $action = '' )
{
+ _debug_array($attrib);
+ die();
$receipt = array();
$attrib['appname'] = $this->type_app[$this->type];
$attrib['location'] =
".{$this->type}.{$attrib['entity_id']}.{$attrib['cat_id']}";
Modified: branches/dev-syncromind-2/property/inc/class.bocommon.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.bocommon.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.bocommon.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -1609,12 +1609,14 @@
if ($filename)
{
$filename_arr = explode('.', str_replace(' ',
'_', basename($filename)));
- $filename = $filename_arr[0] . '.xlsx';
+ $filename = $filename_arr[0];
}
else
{
- $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']) . '.xlsx';
+ $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']);
}
+ $date_time = str_replace(array(' ', '/'), '_',
$GLOBALS['phpgw']->common->show_date(time()));
+ $filename .= "_{$date_time}.xlsx";
$browser = CreateObject('phpgwapi.browser');
//
$browser->content_header($filename,'application/vnd.ms-excel');
@@ -1721,7 +1723,9 @@
function excel_out_old( $list, $name, $descr, $input_type =
array() )
{
- $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']) . '.xls';
+ $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']);
+ $date_time = str_replace(array(' ', '/'), '_',
$GLOBALS['phpgw']->common->show_date(time()));
+ $filename .= "_{$date_time}.xls";
$workbook = CreateObject('phpgwapi.excel', "-");
$browser = CreateObject('phpgwapi.browser');
@@ -1789,12 +1793,14 @@
if ($filename)
{
$filename_arr = explode('.', str_replace(' ',
'_', basename($filename)));
- $filename = $filename_arr[0] . '.csv';
+ $filename = $filename_arr[0];
}
else
{
- $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']) . '.csv';
+ $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']);
}
+ $date_time = str_replace(array(' ', '/'), '_',
$GLOBALS['phpgw']->common->show_date(time()));
+ $filename .= "_{$date_time}.csv";
$browser = CreateObject('phpgwapi.browser');
$browser->content_header($filename, 'application/csv');
@@ -1859,13 +1865,16 @@
if ($filename)
{
$filename_arr = explode('.', str_replace(' ',
'_', basename($filename)));
- $filename = $filename_arr[0] . '.ods';
+ $filename = $filename_arr[0];
}
else
{
- $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']) . '.ods';
+ $filename = str_replace(' ', '_',
$GLOBALS['phpgw_info']['user']['account_lid']);
}
+ $date_time = str_replace(array(' ', '/'), '_',
$GLOBALS['phpgw']->common->show_date(time()));
+ $filename .= "_{$date_time}'.ods'";
+
$browser = CreateObject('phpgwapi.browser');
$browser->content_header($filename, 'application/ods');
@@ -2507,13 +2516,28 @@
public function get_b_account()
{
$query = phpgw::get_var('query');
+ $role = phpgw::get_var('role');
- $sogeneric = CreateObject('property.sogeneric',
'budget_account');
+ $type = 'budget_account';
+
+ if($role == 'group')
+ {
+ $type = 'b_account_category';
+ }
+
+ $sogeneric = CreateObject('property.sogeneric', $type);
$values = $sogeneric->read(array('query' => $query));
foreach ($values as &$value)
{
- $value['name'] = "{$value['id']}
{$value['descr']}";
+ if (!preg_match("/^{$value['id']}/",
$value['descr']))
+ {
+ $value['name'] = "{$value['id']}
{$value['descr']}";
+ }
+ else
+ {
+ $value['name'] = $value['descr'];
+ }
}
return array('ResultSet' => array('Result' => $values));
Modified: branches/dev-syncromind-2/property/inc/class.boentity.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.boentity.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.boentity.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -954,6 +954,7 @@
$start_date = phpgw::get_var('control_start_date',
'string');
$repeat_type = phpgw::get_var('repeat_type', 'int');
$repeat_interval = phpgw::get_var('repeat_interval',
'int');
+ $repeat_interval = $repeat_interval ? $repeat_interval
: 1;
$controle_time = phpgw::get_var('controle_time',
'float');
$service_time = phpgw::get_var('service_time', 'float');
Modified: branches/dev-syncromind-2/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.bogeneric.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.bogeneric.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -138,6 +138,11 @@
public function read( $data = array() )
{
+ if (isset($data['location_info']) &&
$data['location_info']['type'])
+ {
+
$this->get_location_info($data['location_info']['type'],
(int)$data['location_info']['type_id']);
+ unset($data['location_info']);
+ }
$values = $this->so->read($data);
foreach ($values as &$entry)
@@ -174,7 +179,7 @@
{
if (isset($data['location_info']) &&
$data['location_info']['type'])
{
-
$this->get_location_info($data['location_info']['type'],
(int)$data['location_info']['type']);
+
$this->get_location_info($data['location_info']['type'],
(int)$data['location_info']['type_id']);
unset($data['location_info']);
}
$custom_fields = false;
Modified: branches/dev-syncromind-2/property/inc/class.bolocation.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.bolocation.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.bolocation.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -180,11 +180,26 @@
$selected =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
. $this->type_id . !!$this->lookup]) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']["location_columns_" .
$this->type_id . !!$this->lookup] : '';
}
$filter = array('list' => ''); // translates to "list
IS NULL"
- $columns = $this->custom->find('property', '.location.'
. $type_id, 0, '', '', '', true, false, $filter);
- $column_list =
$this->bocommon->select_multi_list($selected, $columns);
- return $column_list;
+ //$columns = $this->custom->find('property',
'.location.' . $type_id, 0, '', '', '', true, false, $filter);
+
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property', ".location.{$this->type_id}");
+
+ $columns = $this->so->get_column_list($location_id);
+ $columns = array_merge($columns,
$this->get_column_list());
+ return $this->bocommon->select_multi_list($selected,
$columns);
}
+ function get_column_list()
+ {
+ $columns = array();
+// $columns['category_text'] = array(
+// 'id' => 'category_text',
+// 'name' => lang('category'),
+// 'sortable' => false
+// );
+ return $columns;
+ }
+
function select_status_list( $format = '', $selected = '' )
{
switch ($format)
@@ -653,6 +668,8 @@
$lookup_functions[$j]['link']
.= ",location_code:'{$filter_location}',block_query:'{$block_query}'";
}
+ $lookup_functions[$j]['link'] .=
",clear_state:1";
+
$_lookup_functions .= <<<JS
function
{$lookup_functions[$j]['name']}
@@ -749,11 +766,39 @@
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
+ $custom_cols =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
. $this->type_id . !!$this->lookup]) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']["location_columns_" .
$this->type_id . !!$this->lookup] : '';
+
+ $column_list = $this->get_column_list();
+ $get_vendor_names = false;
+
+ foreach ($custom_cols as $col_id)
+ {
+ if (!ctype_digit($col_id))
+ {
+ $this->uicols['input_type'][] = 'text';
+ $this->uicols['name'][] = $col_id;
+ $this->uicols['descr'][] =
$column_list[$col_id]['name'];
+ $this->uicols['statustext'][] =
$column_list[$col_id]['name'];
+ $this->uicols['exchange'][] = false;
+ $this->uicols['align'][] = '';
+ $this->uicols['datatype'][] = false;
+ $this->uicols['sortable'][] =
$column_list[$col_id]['sortable'];
+ $this->uicols['formatter'][] =
$column_list[$col_id]['formatter'];
+ $this->uicols['classname'][] =
$column_list[$col_id]['classname'];
+ if ($col_id == 'vendor_names')
+ {
+ $get_vendor_names = true;
+ }
+ }
+ }
+
return $locations;
}
function get_responsible( $data = array() )
{
+ static $names = array();
+
$soresponsible = CreateObject('property.soresponsible');
$contacts = createObject('phpgwapi.contacts');
@@ -770,8 +815,29 @@
{
$responsible_item =
$soresponsible->get_active_responsible_at_location($location['location_code'],
$data['role_id']);
$location['responsible_item'] =
$responsible_item['id'];
- $location['responsible_contact'] =
$contacts->get_name_of_person_id($responsible_item['contact_id']);
- $location['responsible_contact_id'] =
$responsible_item['contact_id'];
+ if(isset($responsible_item['contact_id']))
+ {
+
if(isset($names[$responsible_item['contact_id']]))
+ {
+
$location['responsible_contact'] = $names[$responsible_item['contact_id']];
+ }
+ else
+ {
+ if( $account_id =
$GLOBALS['phpgw']->accounts->search_person($responsible_item['contact_id']))
+ {
+
$location['responsible_contact'] =
$GLOBALS['phpgw']->accounts->get($account_id)->__toString();
+ }
+ else
+ {
+
$location['responsible_contact'] =
$contacts->get_name_of_person_id($responsible_item['contact_id']);
+ }
+
$names[$responsible_item['contact_id']] = $location['responsible_contact'];
+ }
+
+ $location['responsible_contact_id'] =
$responsible_item['contact_id'];
+
+ }
+
}
//_debug_array($locations);
Modified: branches/dev-syncromind-2/property/inc/class.borequest.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.borequest.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.borequest.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -484,13 +484,6 @@
}
}
- /* $request = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
- 'filter' => $this->filter,'district_id' =>
$this->district_id,'cat_id' => $this->cat_id,'status_id' => $this->status_id,
- 'project_id' =>
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' =>
$data['list_descr'],
- 'dry_run'=>$data['dry_run'], 'p_num' =>
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date,
- 'property_cat_id' => $this->property_cat_id,
'building_part' => $this->building_part,
- 'degree_id' => $this->degree_id, 'attrib_filter' =>
$attrib_filter, 'condition_survey_id' => $this->condition_survey_id,
- 'responsible_unit' => $this->responsible_unit,
'recommended_year' => $this->recommended_year)); */
$values = $this->so->read(array
(
'start' => $data['start'],
@@ -500,7 +493,7 @@
'sort' => $data['sort'],
'allrows' => $data['allrows'],
'list_descr' => $data['list_descr'],
- 'project_id' => $data['project_id'],
+ 'make_relation' => $data['make_relation'],
'dry_run' => $data['dry_run'],
'filter' => $this->filter,
'district_id' => $this->district_id,
Modified: branches/dev-syncromind-2/property/inc/class.botts.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.botts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.botts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -56,6 +56,7 @@
public $sum_difference = 0;
public $show_finnish_date = false;
public $simple = false;
+ public $group_candidates = array(-1);
protected $custom_filters = array();
var $public_functions = array
(
@@ -86,6 +87,29 @@
$this->config->read();
+ $user_groups =
$GLOBALS['phpgw']->accounts->membership($this->account);
+ $simple_group =
isset($this->config->config_data['fmttssimple_group']) ?
$this->config->config_data['fmttssimple_group'] : array();
+
+ if
(isset($this->config->config_data['fmtts_assign_group_candidates']) &&
is_array($this->config->config_data['fmtts_assign_group_candidates']))
+ {
+ foreach
($this->config->config_data['fmtts_assign_group_candidates'] as
$group_candidate)
+ {
+ if ($group_candidate)
+ {
+ $this->group_candidates[] =
$group_candidate;
+ }
+ }
+ }
+ foreach ( $user_groups as $group => $dummy)
+ {
+ if ( in_array($group, $simple_group) &&
!in_array($group, $this->group_candidates))
+ {
+ $this->simple = true;
+ break;
+ }
+ }
+
+ reset($user_groups);
$user_groups =
$GLOBALS['phpgw']->accounts->membership($this->account);
$simple_group =
isset($this->config->config_data['fmttssimple_group']) ?
$this->config->config_data['fmttssimple_group'] : array();
foreach ($user_groups as $group => $dummy)
@@ -1760,4 +1784,11 @@
);
}
+
+ function add_relation( $add_relation, $id )
+ {
+ return $this->so->add_relation($add_relation, $id);
+ }
+
+
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/property/inc/class.soentity.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soentity.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.soentity.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -335,7 +335,7 @@
unset($sql_cnt);
$this->total_records = $this->db->f('cnt');
-
+ _debug_array($sql . $ordermethod);
$ordermethod = '';
if (!$allrows)
{
@@ -654,6 +654,18 @@
$__querymethod = array();
$_joinmethod_datatype = array();
$_joinmethod_datatype_custom = array();
+ $custom_attribs = array();
+ $this->db->query("SELECT * FROM $attribute_table WHERE
$attribute_filter AND search='1'");
+ while ($this->db->next_record())
+ {
+ $custom_attribs[$this->db->f('column_name')] =
array(
+ 'id' => $this->db->f('id'),
+ 'datatype' =>
$this->db->f('datatype'),
+ 'location_id' =>
$this->db->f('location_id'),
+ 'search' =>
$this->db->f('search'),
+ );
+ }
+
if ($query)
{
$query = $this->db->db_addslashes($query);
@@ -688,7 +700,6 @@
case 'T':
if
(!$criteria_id)
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') .
"[contains(.,''$query'')]' PASSING BY REF xml_representation)";
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."'
{$this->like} '%{$query}%'";
$__querymethod = array(); // remove block
}
@@ -707,7 +718,6 @@
$this->db2->query("SELECT phpgw_cust_choice.id FROM phpgw_cust_choice
{$_filter_choise}", __LINE__, __FILE__);
while
($this->db2->next_record())
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') .
"[contains(.,''," . $this->db2->f('id') . ",'')]' PASSING BY REF
xml_representation)";
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."'
{$this->like} '%,{$query},%'";
}
}
@@ -724,9 +734,7 @@
$__filter_choise = array();
while
($this->db2->next_record())
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$this->db2->f('id');
-
}
$__querymethod = array(); // remove block
}
@@ -734,9 +742,8 @@
case 'I':
if
(ctype_digit($query) && !$criteria_id)
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''" . (int)$query . "'']' PASSING BY REF xml_representation)";
-
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$query;
-
+//
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$query;
+
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."'
{$this->like} '" .(int)$query . "%'";
$__querymethod = array(); // remove block
}
break;
@@ -747,7 +754,6 @@
$__filter_choise = array();
while
($this->db2->next_record())
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$this->db2->f('id');
}
@@ -761,7 +767,6 @@
$__filter_choise = array();
while
($this->db2->next_record())
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$this->db2->f('id');
}
@@ -775,7 +780,6 @@
$__filter_choise = array();
while
($this->db2->next_record())
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''" . (int)$this->db2->f('id') . "'']' PASSING BY REF xml_representation)";
$_querymethod[] = "CAST( json_representation->>'". $this->db->f('column_name')
."' AS integer) = " .(int)$this->db2->f('id');
}
$__querymethod = array(); // remove block
@@ -784,7 +788,6 @@
default:
if
(!$criteria_id)
{
-//
$_querymethod[] = "xmlexists('//" . $this->db->f('column_name') . "[text() =
''$query'']' PASSING BY REF xml_representation)";
$_querymethod[] = "json_representation->>'". $this->db->f('column_name') ."' =
'{$query}'";
$__querymethod = array(); // remove block
}
@@ -817,6 +820,37 @@
if ($check_for_control && !$control_registered)
{
+ /*
+ * Filter inactive
+ */
+ static $cache_attribute_status = array();
+
+
if(!isset($cache_attribute_status[$location_id]))
+ {
+ $filters = array("column_name" =>
"status");
+ $cache_attribute_status[$location_id] =
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '', 'ASC', '', true,
true,$filters);
+ }
+
+
if(!empty($cache_attribute_status[$location_id]))
+ {
+ foreach
($cache_attribute_status[$location_id] as $attibute_id => $attibute)
+ {
+ if(!empty($attibute['choice']))
+ {
+ $_querymethod[] =
"CAST( json_representation->>'status' AS integer) < 90";
+ $__querymethod =
array(); // remove block
+// foreach
($attibute['choice'] as $choice)
+// {
+//
if($choice['id'] < 90)
+// {
+//
$_querymethod[] = "CAST( json_representation->>'status' AS integer) = "
.(int)$choice['id'];
+//
$__querymethod = array(); // remove block
+// }
+// }
+ }
+ }
+ }
+
$sql .= "{$this->left_join} {$join_control}";
$sql_custom_field .= ',count(control_id) AS
has_control';
@@ -854,6 +888,11 @@
$this->uicols['classname'][] = '';
}
+ if ($dry_run)
+ {
+ return array();
+ }
+
$_joinmethod_datatype =
array_merge($_joinmethod_datatype, $_joinmethod_datatype_custom);
foreach ($_joinmethod_datatype as $_joinmethod)
{
@@ -903,10 +942,6 @@
$this->total_records = $cache_info['total_records'];
- if ($dry_run)
- {
- return array();
- }
$ordermethod = '';
$xml_order = '';
@@ -914,9 +949,6 @@
{
switch ($order)
{
- case 'user_id':
- //
$ordermethod = " ORDER BY phpgw_accounts.account_lastname {$sort}"; // Don't
work with LDAP.
- break;
case 'loc1_name':
$ordermethod = " ORDER BY
fm_location1.loc1_name {$sort}";
break;
@@ -927,11 +959,22 @@
case 'loc1':
$ordermethod = " ORDER BY
{$entity_table}.loc1 {$sort}";
break;
+ case 'user_id';
+ case 'modified_on';
+ case 'entry_date':
+ $ordermethod = " ORDER BY
{$entity_table}.$order {$sort}";
+ $xml_order =
",fm_bim_item.{$order}";
+ break;
default:
- $ordermethod = " ORDER BY
{$entity_table}.json_representation->>'{$order}' {$sort}";
-// $xml_order = ',cast
(_order_field[1] as text) as _order_field_text';
-// $sql = str_replace('FROM
fm_bim_item', "FROM (SELECT fm_bim_item.*, xpath('$order/text()',
xml_representation) as _order_field FROM fm_bim_item", $sql);
-// $sql .= ") as fm_bim_item ORDER
BY _order_field_text {$sort}";
+ $ordermethod = " ORDER BY
{$order} {$sort}";
+
if($custom_attribs[$order]['datatype'] == 'I')
+ {
+ $xml_order =
",CAST(json_representation->>'{$order}' AS integer) AS {$order}";
+ }
+ else
+ {
+ $xml_order =
",json_representation->>'{$order}' AS {$order}";
+ }
}
}
else
@@ -953,11 +996,11 @@
// _debug_array($sql_pre_run);
if (!$allrows)
{
- $this->db->limit_query($sql_pre_run, $start,
__LINE__, __FILE__, $results);
+ $this->db->limit_query($sql_pre_run.
$ordermethod, $start, __LINE__, __FILE__, $results);
}
else
{
- $this->db->query($sql_pre_run, __LINE__,
__FILE__);
+ $this->db->query($sql_pre_run. $ordermethod,
__LINE__, __FILE__);
}
$ids = array();
Modified: branches/dev-syncromind-2/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sogeneric.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.sogeneric.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -2362,17 +2362,10 @@
'descr' =>
lang('remark'),
'type' => 'text'
),
- array
- (
+ array(
'name' =>
'location_level',
'descr' =>
lang('location level'),
- 'type' =>
'select',
- 'values_def' =>
array
- (
-
'valueset' => false,
-
'method' => 'preferences.boadmin_acl.get_locations',
-
'method_input' => array('acl_app' => 'property', 'selected' => '##location##')
- )
+ 'type' =>
'varchar'
),
array
(
Modified: branches/dev-syncromind-2/property/inc/class.solocation.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.solocation.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.solocation.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -285,6 +285,51 @@
return $this->db->next_record();
}
+ function get_column_list($location_id)
+ {
+ $sql = "SELECT * FROM phpgw_cust_attribute "
+ . " WHERE location_id = {$location_id}"
+ . " AND custom = 1 OR column_name = 'category'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ while ($this->db->next_record())
+ {
+ $attribs = array();
+ $id = $this->db->f('id');
+ $attribs[$id] = array
+ (
+ 'id'
=> $id,
+ 'group_id'
=> (int) $this->db->f('group_id'),
+ 'attrib_sort' =>
(int) $this->db->f('attrib_sort'),
+ 'list'
=> $this->db->f('list'),
+ 'lookup_form' =>
$this->db->f('lookup_form'),
+ 'entity_form' =>
$this->db->f('entity_form'),
+ 'column_name' =>
$this->db->f('column_name'),
+ 'name'
=> $this->db->f('column_name'),
+ 'size'
=> $this->db->f('size'),
+ 'precision'
=> $this->db->f('precision_'),
+ 'statustext' =>
$this->db->f('statustext', true),
+ 'input_text' =>
$this->db->f('input_text', true),
+ 'type_name'
=> $this->db->f('type'),
+ 'datatype'
=> $this->db->f('datatype'),
+ 'search'
=> $this->db->f('search'),
+ 'nullable'
=> ($this->db->f('nullable') == 'True'),
+ 'history'
=> $this->db->f('history'),
+ 'disabled'
=> $this->db->f('disabled'),
+ 'helpmsg'
=> !!$this->db->f('helpmsg'),
+ 'get_list_function' =>
$this->db->f('get_list_function'),
+ 'get_list_function_input' =>
$this->db->f('get_list_function_input') ?
unserialize($this->db->f('get_list_function_input', true)) : '',
+ 'get_single_function' =>
$this->db->f('get_single_function'),
+ 'get_single_function_input' =>
$this->db->f('get_single_function_input') ?
unserialize($this->db->f('get_single_function_input', true)) : '',
+ 'short_description'
=> $this->db->f('short_description'),
+ 'javascript_action'
=> $this->db->f('javascript_action',true),
+ 'default_value'
=> $this->db->f('default_value',true)
+ );
+ }
+ return $attribs;
+ }
+
function read( $data )
{
$start = isset($data['start']) && $data['start'] ?
$data['start'] : 0;
@@ -615,11 +660,19 @@
//---------------------start custom user cols
- $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
. $type_id . !!$lookup]) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_' .
$type_id . !!$lookup] : '';
+ $user_columns =
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_'
. $type_id . !!$lookup]) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['location_columns_' .
$type_id . !!$lookup] : array();
+ $_user_columns = array();
+ foreach ($user_columns as $user_column_id)
+ {
+ if (ctype_digit($user_column_id))
+ {
+ $_user_columns[] = $user_column_id;
+ }
+ }
$user_column_filter = '';
- if (isset($user_columns) AND is_array($user_columns)
AND $user_columns[0])
+ if ($_user_columns)
{
- $user_column_filter = " OR ($attribute_filter
AND id IN (" . implode(',', $user_columns) . '))';
+ $user_column_filter = " OR ($attribute_filter
AND id IN (" . implode(',', $_user_columns) . '))';
}
$this->db->query("SELECT DISTINCT * FROM
$attribute_table WHERE (list=1 OR lookup_form=1) AND $attribute_filter
$user_column_filter ORDER BY attrib_sort ASC");
Modified: branches/dev-syncromind-2/property/inc/class.soproject.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soproject.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.soproject.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -907,7 +907,8 @@
'contact_phone' =>
$this->db->f('contact_phone'),
'external_project_id' =>
$this->db->f('external_project_id'),
'ecodimb' => $this->db->f('ecodimb'),
- 'b_account_id' =>
$this->db->f('account_group'),
+ 'b_account_group' =>
$this->db->f('account_group'),
+ 'b_account_id' =>
$this->db->f('b_account_id'),
'contact_id' =>
$this->db->f('contact_id'),
'inherit_location' =>
$this->db->f('inherit_location'),
'periodization_id' =>
$this->db->f('periodization_id')
@@ -1237,6 +1238,7 @@
$project['key_responsible'],
$this->account,
$project['ecodimb'],
+ $project['b_account_group'],
$project['b_account_id'],
$project['contact_id'],
$project['inherit_location'],
@@ -1246,7 +1248,7 @@
$values = $this->db->validate_insert($values);
$this->db->query("INSERT INTO fm_project
(id,project_type_id,external_project_id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
- .
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,contact_id,inherit_location,periodization_id
$cols) "
+ .
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,b_account_id,contact_id,inherit_location,periodization_id
$cols) "
. "VALUES ($values $vals )", __LINE__,
__FILE__);
/**
@@ -1424,7 +1426,8 @@
'location_code' => $project['location_code'],
'address' => $address,
'ecodimb' => $project['ecodimb'],
- 'account_group' => $project['b_account_id'],
+ 'account_group' => $project['b_account_group'],
+ 'b_account_id' => $project['b_account_id'],
'contact_id' => $project['contact_id'],
'inherit_location' =>
$project['inherit_location'],
);
Modified: branches/dev-syncromind-2/property/inc/class.sorequest.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sorequest.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.sorequest.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -307,7 +307,7 @@
$property_cat_id = isset($data['property_cat_id']) ?
$data['property_cat_id'] : 0;
$status_id = isset($data['status_id']) &&
$data['status_id'] ? $data['status_id'] : 'open';
$district_id = isset($data['district_id']) &&
$data['district_id'] ? $data['district_id'] : 0;
- $project_id = isset($data['project_id']) ?
$data['project_id'] : '';
+ $make_relation = isset($data['make_relation']) ?
$data['make_relation'] : '';
$allrows = isset($data['allrows']) ? $data['allrows'] :
'';
$results = isset($data['results']) ?
(int)$data['results'] : 0;
$list_descr = isset($data['list_descr']) ?
$data['list_descr'] : '';
@@ -716,9 +716,8 @@
$where = 'AND';
}
- if ($project_id && !$status_id)// lookup requests not
already allocated to projects
+ if ($make_relation && !$status_id)// lookup requests
not already allocated to projects
{
-// $filtermethod .= " $where project_id is NULL ";
$filtermethod .= " $where
fm_request_status.closed is NULL ";
$where = 'AND';
}
Modified: branches/dev-syncromind-2/property/inc/class.sos_agreement.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sos_agreement.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.sos_agreement.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -387,6 +387,8 @@
if ($query)
{
$query = $this->db->db_addslashes($query);
+ $_querymethod[] = "fm_vendor.org_name
{$this->like} '%{$query}%'";
+ $__querymethod = array(); // remove block
if ($p_num)
{
Modified: branches/dev-syncromind-2/property/inc/class.sotts.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.sotts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.sotts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -138,6 +138,7 @@
$branch_id = isset($data['branch_id']) &&
$data['branch_id'] ? (int)$data['branch_id'] : 0;
$order_dim1 = isset($data['order_dim1']) &&
$data['order_dim1'] ? (int)$data['order_dim1'] : 0;
$custom_filtermethod =
isset($data['custom_filtermethod']) && $data['custom_filtermethod'] ?
(array)$data['custom_filtermethod'] : array();
+ $check_date_type = isset($data['check_date_type']) &&
$data['check_date_type'] ? (int)$data['check_date_type'] : 1;
$result_order_field = array();
@@ -413,7 +414,14 @@
$order_edit =
$GLOBALS['phpgw']->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
$_end_date = $end_date + 3600 * 16 +
phpgwapi_datetime::user_timezone();
$_start_date = $start_date - 3600 * 8 +
phpgwapi_datetime::user_timezone();
- $filtermethod .= " $where
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date
<= $_end_date ";
+ if($check_date_type == 1)
+ {
+ $filtermethod .= " $where
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date
<= $_end_date ";
+ }
+ else if($check_date_type == 2)
+ {
+ $filtermethod .= " $where
fm_tts_tickets.entry_date >= $_start_date AND fm_tts_tickets.entry_date <=
$_end_date ";
+ }
if ($order_add || $order_edit)
{
@@ -1971,4 +1979,49 @@
return $values;
}
+
+ function add_relation( $add_relation, $id )
+ {
+ $config = $GLOBALS['phpgw']->config->read();
+ $interlink = CreateObject('property.interlink');
+ $this->db->transaction_begin();
+
+ foreach ($add_relation['request_id'] as $relation_id)
+ {
+ $target_id = false;
+ $target =
$interlink->get_specific_relation('property', '.project.request', '.ticket',
$relation_id, 'target');
+ if ($target)
+ {
+ $target_id = $target[0];
+ }
+
+ if (!$target_id)
+ {
+ $interlink_data = array(
+ 'location1_id' =>
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),
+ 'location1_item_id' =>
$relation_id,
+ 'location2_id' =>
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'),
+ 'location2_item_id' => $id,
+ 'account_id' => $this->account
+ );
+
+ $interlink->add($interlink_data);
+
+ $request_ticket_hookup_status =
isset($config['request_ticket_hookup_status']) &&
$config['request_ticket_hookup_status'] ?
$config['request_ticket_hookup_status'] : false;
+
+ if ($request_ticket_hookup_status)
+ {
+ $this->db->query("UPDATE
fm_request SET status='{$request_ticket_hookup_status}' WHERE id='" .
$relation_id . "'", __LINE__, __FILE__);
+ }
+
+
phpgwapi_cache::message_set(lang('request %1 has been added', $relation_id),
'message');
+ }
+ else
+ {
+
phpgwapi_cache::message_set(lang('request %1 has already been added to ticket
%2', $relation_id, $target_id), 'error');
+ }
+ }
+ $this->db->transaction_commit();
+ return $receipt;
+ }
}
\ No newline at end of file
Modified: branches/dev-syncromind-2/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.soworkorder.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.soworkorder.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -2424,7 +2424,7 @@
$budget_acc = 0;
}
- if (abs($entry['actual_cost']) > 0)
+ if (abs($entry['actual_cost']) > 0 ||
$entry['period'] < date('Ym'))
{
$_diff_start = abs($entry['budget']) >
0 ? $entry['budget'] : $entry['sum_orders'];
$entry['diff'] = $_diff_start -
$entry['sum_oblications'] - $entry['actual_cost'];
Modified: branches/dev-syncromind-2/property/inc/class.uigallery.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uigallery.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uigallery.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -147,14 +147,24 @@
}
$location_info = $this->bo->get_location($directory);
-
if (!$this->acl->check($location_info['location'],
PHPGW_ACL_READ, 'property'))
{
echo 'sorry - no access';
$GLOBALS['phpgw']->common->phpgw_exit();
}
+ $img_id = phpgw::get_var('img_id', 'int');
+
$bofiles = CreateObject('property.bofiles');
+
+ if($img_id)
+ {
+ $file_info = $bofiles->vfs->get_info($img_id);
+ $file =
"{$file_info['directory']}/{$file_info['name']}";
+ }
+
+
+
$source = "{$bofiles->rootdir}{$file}";
$thumbfile = "$source.thumb";
@@ -179,6 +189,10 @@
$this->create_thumb($source, $thumbfile,
$thumb_size = 100);
readfile($thumbfile);
}
+ else if ($img_id)
+ {
+ $bofiles->get_file($img_id);
+ }
else
{
$bofiles->view_file('', $file);
Modified: branches/dev-syncromind-2/property/inc/class.uilocation.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uilocation.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uilocation.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -55,6 +55,7 @@
'get_part_of_town' => true,
'get_history_data' => true,
'get_documents' => true,
+ 'get_accounts' => true,
'download' => true,
'index' => true,
'view' => true,
@@ -522,33 +523,94 @@
'list' => $values_combo_box[4]
);
-// $values_combo_box[5] =
$this->bocommon->get_user_list_right2('filter',PHPGW_ACL_READ,$this->user_id,".location.{$type_id}");
- $_users =
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC',
'account_lastname', '', -1);
- $values_combo_box[5] = array();
- foreach ($_users as $_user)
- {
- $values_combo_box[5][] = array
- (
- 'id' => $_user->id,
- 'name' => $_user->__toString(),
+
+/**
+ *
+ *
+ */
+ $link = self::link(array(
+ 'menuaction' =>
'property.uilocation.get_accounts',
+ 'phpgw_return_as' => 'json'
+ ));
+
+ $code = '
+ var link = "' . $link . '";
+ var data = {"account_type": $(this).val()};
+ execute_ajax(link,
+ function(result){
+ var $el = $("#user_id");
+ $el.empty();
+ $.each(result, function(key,
value) {
+
$el.append($("<option></option>").attr("value", value.id).text(value.name));
+ });
+ }, data, "GET", "json"
);
- }
- unset($_users);
- unset($_user);
+ ';
- array_unshift($values_combo_box[5], array('id' => (-1 *
$GLOBALS['phpgw_info']['user']['account_id']),
- 'name' => lang('mine roles')));
- array_unshift($values_combo_box[5], array('id' => '',
'name' => lang('no user')));
+ $account_types = array();
+ $account_types[] = array('id' => '', 'name' =>
lang('Select'));
+ $account_types[] = array('id' => 'accounts', 'name' =>
lang('user'));
+ $account_types[] = array('id' => 'groups', 'name' =>
lang('group'));
+
$combos[] = array('type' => 'filter',
+ 'name' => 'account_type',
+ 'extra' => $code,
+ 'text' => lang('account type'),
+ 'list' => $account_types
+ );
+
+ $_users = $this->get_accounts();
+
+ $combos[] = array('type' => 'filter',
'name' => 'user_id',
'extra' => '',
'text' => lang('user'),
- 'list' => $values_combo_box[5]
+ 'list' => $_users
);
return $combos;
}
+
+ public function get_accounts( $account_type = '')
+ {
+ if(!$account_type)
+ {
+ $account_type = phpgw::get_var('account_type');
+ }
+ switch ($account_type)
+ {
+ case 'accounts':
+ $_accounts =
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC',
'account_lastname', '', -1);
+ break;
+ case 'groups':
+ $_accounts =
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_firstname',
'', -1);
+ break;
+ default:
+ $_accounts = array_merge(
+
$GLOBALS['phpgw']->accounts->get_list('groups', -1, 'ASC', 'account_firstname',
'', -1),
+
$GLOBALS['phpgw']->accounts->get_list('accounts', -1, 'ASC',
'account_lastname', '', -1)
+ );
+ break;
+ }
+ $values = array();
+ foreach ($_accounts as $_account)
+ {
+ $values[] = array
+ (
+ 'id' => $_account->id,
+ 'name' => $_account->__toString(),
+ );
+ }
+ if($account_type == 'accounts')
+ {
+ array_unshift($values, array('id' => (-1 *
$GLOBALS['phpgw_info']['user']['account_id']),
+ 'name' => lang('mine roles')));
+ }
+ array_unshift($values, array('id' => '', 'name' =>
lang('Select')));
+ return $values;
+ }
+
private function _get_categories_summary()
{
$values_combo_box = array();
@@ -2075,33 +2137,6 @@
);
}
- /*$_dirname = '';
-
- $_files_maxlevel = 0;
- if
(isset($_config->config_data['external_files_maxlevel']) &&
$_config->config_data['external_files_maxlevel'])
- {
- $_files_maxlevel =
$_config->config_data['external_files_maxlevel'];
- }
- $_files_filterlevel = 0;
- if
(isset($_config->config_data['external_files_filterlevel']) &&
$_config->config_data['external_files_filterlevel'])
- {
- $_files_filterlevel =
$_config->config_data['external_files_filterlevel'];
- }
- $_filter_info = explode('-', $location_code);
-
- if
(isset($_config->config_data['external_files']) &&
$_config->config_data['external_files'])
- {
- $_dirname =
$_config->config_data['external_files'];
- $file_tree =
$objDocument->read_file_tree($_dirname, $_files_maxlevel, $_files_filterlevel,
$_filter_info[0]);
- }
-
- unset($_config);
- if ($file_tree)
- {
- $tabs['file_tree'] = array('label' =>
lang('Files'), 'link' => '#file_tree');
- $file_tree = json_encode($file_tree);
- }*/
-
$_related = array();
foreach ($related as $_location_level =>
$related_info)
{
Modified: branches/dev-syncromind-2/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uiproject.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uiproject.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -734,8 +734,6 @@
$values_attribute = phpgw::get_var('values_attribute');
// $values['external_project_id'] =
phpgw::get_var('external_project_id');
// $values['ecodimb'] = phpgw::get_var('ecodimb');
- $values['b_account_id'] =
phpgw::get_var('b_account_id', 'int', 'POST');
- $values['b_account_name'] =
phpgw::get_var('b_account_name', 'string', 'POST');
$values['contact_id'] = phpgw::get_var('contact',
'int', 'POST');
$config = CreateObject('phpgwapi.config', 'property');
@@ -788,14 +786,22 @@
if (isset($values['b_account_id']) &&
$values['b_account_id'])
{
$sogeneric = CreateObject('property.sogeneric');
-
$sogeneric->get_location_info('b_account_category', false);
+ $sogeneric->get_location_info('budget_account',
false);
$status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_id']), array());
+ $values['b_account_group'] =
$status_data['category'];
+ }
+ if (isset($values['b_account_group']) &&
$values['b_account_group'])
+ {
+ $sogeneric = CreateObject('property.sogeneric');
+
$sogeneric->get_location_info('b_account_category', false);
+ $status_data =
$sogeneric->read_single(array('id' => (int)$values['b_account_group']),
array());
+
if (isset($status_data['external_project']) &&
$status_data['external_project'])//mandatory for this account group
{
if
(!isset($values['external_project_id']) || !$values['external_project_id'])
{
- $this->receipt['error'][] =
array('msg' => lang('Please select a project group!'));
+ $this->receipt['error'][] =
array('msg' => lang('Please select an external project!'));
$error_id = true;
}
}
@@ -1381,21 +1387,41 @@
$b_account_data = array();
$ecodimb_data = array();
-
if (isset($config->config_data['budget_at_project']) &&
$config->config_data['budget_at_project'])
{
- $b_account_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
+ $b_account_group_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
(
- 'b_account_id' =>
$values['b_account_id'],
- 'b_account_name' =>
$values['b_account_name'],
+ 'b_account_id' =>
$values['b_account_group'],
+ 'b_account_name' =>
$values['b_account_group_name'],
'role' => 'group',
'type' => $lookup_type
)
);
+
+ $b_account_data = array();
+
+ if
(isset($config->config_data['budget_account_at_project']) &&
$config->config_data['budget_account_at_project'])
+ {
+ $b_account_data =
$this->bocommon->initiate_ui_budget_account_lookup(array
+ (
+ 'b_account_id' =>
$values['b_account_id'],
+ 'b_account_name' =>
$values['b_account_name'],
+ 'type' => $lookup_type
+ )
+ );
+ }
+
+ $default_ecodimb =
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['dimb']) ?
$GLOBALS['phpgw_info']['user']['preferences']['property']['dimb'] : '');
+ if(isset($values['ecodimb']) &&
$values['ecodimb'] && $values['ecodimb'] != $default_ecodimb)
+ {
+
$GLOBALS['phpgw']->preferences->add('property', 'dimb', $values['ecodimb'],
'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+ }
+
$ecodimb_data =
$this->bocommon->initiate_ecodimb_lookup(array
(
- 'ecodimb' => $values['ecodimb'],
+ 'ecodimb' => $values['ecodimb'] ?
$values['ecodimb'] : $default_ecodimb,
'ecodimb_descr' =>
$values['ecodimb_descr'],
'disabled' => $mode == 'view'
));
@@ -1432,7 +1458,9 @@
(
'menuaction' => 'property.uirequest.index',
'query' =>
(isset($values['location_data']['loc1']) ? $values['location_data']['loc1'] :
''),
- 'project_id' => (isset($id) ? $id : '')
+ 'make_relation' => !!$id,
+ 'relation_id' => isset($id) ? $id : 0,
+ 'relation_type' => 'project'
);
$supervisor_email = array();
@@ -1993,7 +2021,8 @@
'suppresscoordination' => $suppresscoordination,
'custom_attributes' => array('attributes' =>
$values['attributes']),
'lookup_functions' =>
isset($values['lookup_functions']) ? $values['lookup_functions'] : '',
- 'b_account_data' => $b_account_data,
+ 'b_account_group_data' => $b_account_group_data,
+ 'b_account_data' =>
$b_account_data,
'ecodimb_data' => $ecodimb_data,
'contact_data' => $contact_data,
'tabs' => self::_generate_tabs($tabs,
$active_tab, array('documents' => $id ? false : true,
Modified: branches/dev-syncromind-2/property/inc/class.uirequest.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uirequest.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uirequest.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -120,7 +120,7 @@
*/
public function query()
{
- $project_id = phpgw::get_var('project_id', 'int');
+ $make_relation = phpgw::get_var('make_relation',
'bool');
$search = phpgw::get_var('search');
$order = phpgw::get_var('order');
$draw = phpgw::get_var('draw', 'int');
@@ -150,7 +150,7 @@
'sort' => $order[0]['dir'],
'dir' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1 || $export,
- 'project_id' => $project_id,
+ 'make_relation' => $make_relation,
'start_date' => $start_date,
'end_date' => $end_date,
'list_descr' => $list_descr
@@ -615,10 +615,27 @@
return $this->query();
}
- $project_id = phpgw::get_var('project_id', 'int'); //
lookup for maintenance planning
+ $make_relation = phpgw::get_var('make_relation',
'bool'); // lookup for maintenance planning
+ $relation_id = phpgw::get_var('relation_id', 'int');
+ $relation_type = phpgw::get_var('relation_type');
+
+ switch ($relation_type)
+ {
+ case 'ticket':
+ $update_menuaction =
'property.uitts.view';
+ $lang_update_relation = lang('update
ticket');
+ break;
+ case 'project':
+ $update_menuaction =
'property.uiproject.edit';
+ $lang_update_relation = lang('update
project');
+ break;
+ default:
+ break;
+ }
+
$query = phpgw::get_var('query');
- if ($project_id)
+ if ($make_relation)
{
$lookup = true;
}
@@ -678,7 +695,9 @@
'source' => self::link(array(
'menuaction' =>
'property.uirequest.index',
'lookup' => $lookup,
- 'project_id' => $project_id,
+ 'make_relation' =>
$make_relation,
+ 'relation_id' => $relation_id,
+ 'relation_type' =>
$relation_type,
'nonavbar' => $this->nonavbar,
'phpgw_return_as' => 'json'
)),
@@ -690,7 +709,7 @@
'menuaction' =>
'property.uirequest.add'
)),
'allrows' => true,
- 'select_all' => !!$project_id,
+ 'select_all' => $make_relation,
'editor_action' => array(),
'field' => array(),
'query' => phpgw::get_var('query')
@@ -738,7 +757,7 @@
array_unshift($data['form']['toolbar']['item'],
$filter);
}
- $this->bo->read(array('project_id' => $project_id,
'allrows' => $this->allrows,
+ $this->bo->read(array('make_relation' =>
$make_relation, 'allrows' => $this->allrows,
'dry_run' => true));
$uicols = $this->bo->uicols;
//_debug_array($uicols);die();
@@ -884,8 +903,8 @@
$data['datatable']['actions'][] = array
(
'my_name' => 'update_project',
- 'statustext' => lang('Update project'),
- 'text' => lang('Update project'),
+ 'statustext' => $lang_update_relation,
+ 'text' => $lang_update_relation,
'type' => 'custom',
'custom_code' => "
@@ -906,8 +925,8 @@
}
var path_update = new Array();
-
path_update['menuaction'] = 'property.uiproject.edit';
-
path_update['id'] = '" . $project_id . "';
+
path_update['menuaction'] = '{$update_menuaction}';
+
path_update['id'] = '{$relation_id}';
var sUrl = phpGWLink('index.php', path_update);
Modified: branches/dev-syncromind-2/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uitts.inc.php 2016-09-07
15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uitts.inc.php 2016-09-07
17:59:19 UTC (rev 15608)
@@ -63,6 +63,7 @@
* @var boolean $_simple use simplified interface
*/
protected $simple = false;
+ protected $group_candidates = array(-1);
protected $_show_finnish_date = false;
protected $_category_acl = false;
var $part_of_town_id;
@@ -112,6 +113,7 @@
$this->location_code = $this->bo->location_code;
$this->p_num = $this->bo->p_num;
$this->simple = $this->bo->simple;
+ $this->group_candidates = $this->bo->group_candidates;
$this->show_finnish_date = $this->bo->show_finnish_date;
$this->_category_acl =
isset($this->bo->config->config_data['acl_at_tts_category']) ?
$this->bo->config->config_data['acl_at_tts_category'] : false;
@@ -155,6 +157,7 @@
'ecodimb' => $this->bo->ecodimb,
'branch_id' => phpgw::get_var('branch_id'),
'order_dim1' => phpgw::get_var('order_dim1'),
+ 'check_date_type' =>
phpgw::get_var('check_date_type', 'int'),
);
$values = $this->bo->read($params);
@@ -619,9 +622,37 @@
private function _get_filters()
{
+ $order_read = $this->acl->check('.ticket.order',
PHPGW_ACL_READ, 'property');
+
$values_combo_box = array();
$combos = array();
+ $check_date_type = array('type' => 'filter',
+ 'name' => 'check_date_type',
+ 'extra' => '',
+ 'text' => lang('check date type'),
+ 'list' => array(
+ array(
+ 'id' => 1,
+ 'name' => lang('modified date')
+ ),
+ array(
+ 'id' => 2,
+ 'name' => lang('entry date')
+ )
+ )
+ );
+
+ if($order_read)
+ {
+ $check_date_type['list'][] = array(
+ 'id' => 3,
+ 'name' => lang('no date')
+ );
+ }
+
+ $combos[] = $check_date_type;
+
$values_combo_box[3] = $this->bo->filter(array('format'
=> $group_filters, 'filter' => $this->status_id,
'default' => 'O'));
@@ -700,9 +731,8 @@
'list' => $values_combo_box[2]
);
- $filter_tts_assigned_to_me =
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_assigned_to_me'];
+ $values_combo_box[4] =
$this->_get_user_list($this->user_id);
- $values_combo_box[4] =
$this->bocommon->get_user_list_right2('filter', PHPGW_ACL_EDIT, $this->user_id,
$this->acl_location);
array_unshift($values_combo_box[4], array(
'id' => -1 *
$GLOBALS['phpgw_info']['user']['account_id'],
'name' => lang('my assigned tickets'),
@@ -728,8 +758,6 @@
);
}
- $order_read = $this->acl->check('.ticket.order',
PHPGW_ACL_READ, 'property');
-
if($order_read)
{
$combos[] = array('type' => 'filter',
@@ -862,13 +890,6 @@
'form' => array(
'toolbar' => array(
'item' => array(
- array(
- 'type' =>
'link',
- 'value' =>
lang('columns'),
- 'href' => '#',
- 'class' => '',
- 'onclick' =>
"JqueryPortico.openPopup({menuaction:'property.uitts.columns'},
{closeAction:'reload'})"
- ),
array
(
'type' =>
'date-picker',
@@ -884,9 +905,16 @@
'name' =>
'end_date',
'value' =>
$end_date,
'text' =>
lang('to')
- )
- ),
- ),
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('columns'),
+ 'href' => '#',
+ 'class' => '',
+ 'onclick' =>
"JqueryPortico.openPopup({menuaction:'property.uitts.columns'},
{closeAction:'reload'})"
+ ),
+ )
+ )
),
'datatable' => array(
'source' =>
self::link(array('menuaction' => 'property.uitts.index',
@@ -1202,13 +1230,16 @@
}
}
-
if (!$values['assignedto'] &&
!$values['group_id'])
{
$_responsible =
execMethod('property.boresponsible.get_responsible', $values);
if (!$_responsible)
{
- $receipt['error'][] =
array('msg' => lang('Please select a person or a group to handle the ticket
!'));
+ if(!$values['assignedto'] =
$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])
+ {
+
+ $receipt['error'][] =
array('msg' => lang('Please select a person or a group to handle the ticket
!'));
+ }
}
else
{
@@ -1224,6 +1255,11 @@
unset($_responsible);
}
+ if (!isset($values['status']) ||
!$values['status'])
+ {
+ $values['status'] = "O";
+ }
+
if (!isset($values['priority']) ||
!$values['priority'])
{
$_priority =
$this->bo->get_priority_list();
@@ -1549,7 +1585,7 @@
'perm' => 1, 'acl_location' =>
$this->acl_location));
}
- $id = phpgw::get_var('id', 'int', 'GET');
+ $id = phpgw::get_var('id', 'int');
if ($this->tenant_id)
{
@@ -1557,6 +1593,12 @@
'id' => $id));
}
+ $add_relation = phpgw::get_var('add_request');
+ if($add_relation)
+ {
+ $receipt =
$this->bo->add_relation($add_relation, $id);
+ }
+
$bolocation = CreateObject('property.bolocation');
$values = phpgw::get_var('values');
@@ -2729,8 +2771,25 @@
$unspsc_code = $ticket['unspsc_code'] ?
$ticket['unspsc_code'] :
$GLOBALS['phpgw_info']['user']['preferences']['property']['unspsc_code'];
$enable_order_service_id =
isset($config->config_data['enable_order_service_id']) &&
$config->config_data['enable_order_service_id'] ? true : false;
$enable_unspsc =
isset($config->config_data['enable_unspsc']) &&
$config->config_data['enable_unspsc'] ? true : false;
+
+ $relation_type_list = array(
+ array(
+ 'id' => 'property.uirequest.index',
+ 'name' => lang('request')
+ ),
+// array(
+// 'id' => 'property.uiproject.index',
+// 'name' => lang('project')
+// ),
+// array(
+// 'id' => 'property.uilookup.entity',
+// 'name' => 'Everything else'
+// ),
+ );
+
$data = array(
'datatable_def' => $datatable_def,
+ 'relation_type_list' => array('options' =>
$relation_type_list),
'my_groups' => json_encode($my_groups),
'custom_attributes' => array('attributes' =>
$ticket['attributes']),
'lookup_functions' =>
isset($ticket['lookup_functions']) ? $ticket['lookup_functions'] : '',
@@ -2765,6 +2824,7 @@
'td_count' => '""',
'base_java_url' =>
"{menuaction:'property.uitts.update_data',id:{$id}}",
'location_item_id' => $id,
+ 'value_location_code' =>
$ticket['location_code'],
'value_origin' => $ticket['origin'],
'value_target' => $ticket['target'],
'value_finnish_date' => $ticket['finnish_date'],
@@ -3486,24 +3546,11 @@
private function _get_user_list($selected)
{
- $_candidates = array();
- $_candidates[] = -1;
- if
(isset($this->bo->config->config_data['fmtts_assign_group_candidates']) &&
is_array($this->bo->config->config_data['fmtts_assign_group_candidates']))
- {
- foreach
($this->bo->config->config_data['fmtts_assign_group_candidates'] as
$group_candidate)
- {
- if ($group_candidate)
- {
- $_candidates[] =
$group_candidate;
- }
- }
- }
-
$xsl_rootdir = PHPGW_SERVER_ROOT .
"/property/templates/{$GLOBALS['phpgw_info']['server']['template_set']}";
$GLOBALS['phpgw']->xslttpl->add_file(array('user_id_select'), $xsl_rootdir);
- $users =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT,
$this->acl_location, 'property', $_candidates);
+ $users =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_EDIT,
$this->acl_location, 'property', $this->group_candidates);
$user_list = array();
$selected_found = false;
foreach ($users as $user)
Modified: branches/dev-syncromind-2/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uiwo_hour.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
+++ branches/dev-syncromind-2/property/inc/class.uiwo_hour.inc.php
2016-09-07 17:59:19 UTC (rev 15608)
@@ -1438,7 +1438,7 @@
if ($_address)
{
- $subject .= ', ' . implode(', ',
$_address);
+ $_address_txt = $_address ? implode(',
', $_address) : '';
}
unset($_address);
unset($address_element);
@@ -1485,7 +1485,7 @@
'type' =>
'application/pdf'
);
}
- $body = lang('order') .
'.</br></br>' . lang('see attachment');
+ $body = lang('order') . "
{$workorder_id}.</br></br>{$_address_txt}</br></br>" . lang('see attachment');
}
else
{
@@ -3307,7 +3307,6 @@
'type' => 'application/pdf'
);
- $body = lang('order') . '.</br></br>' . lang('see
attachment');
$_to = isset($workorder['mail_recipients'][0]) &&
$workorder['mail_recipients'][0] ? implode(';', $workorder['mail_recipients'])
: '';
// _debug_array($_to);die();
$GLOBALS['phpgw']->preferences->set_account_id($workorder['user_id'], true);
@@ -3330,9 +3329,11 @@
if ($_address)
{
- $subject .= ', ' . implode(', ', $_address);
+ $_address_txt = $_address ? implode(', ',
$_address) : '';
}
+ $body = lang('order') . "
{$workorder_id}.</br></br>{$_address_txt}</br></br>" . lang('see attachment');
+
if (!is_object($GLOBALS['phpgw']->send))
{
$GLOBALS['phpgw']->send =
CreateObject('phpgwapi.send');
Modified: branches/dev-syncromind-2/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/dev-syncromind-2/property/inc/class.uiworkorder.inc.php
2016-09-07 15:10:52 UTC (rev 15607)
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15608] Syncromind: merge 15475:15607 from trunk,
sigurdne <=