fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15259] Stable: Merge 14979:15258 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [15259] Stable: Merge 14979:15258 from trunk
Date: Mon, 6 Jun 2016 12:26:20 +0000 (UTC)

Revision: 15259
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15259
Author:   sigurdne
Date:     2016-06-06 12:26:20 +0000 (Mon, 06 Jun 2016)
Log Message:
-----------
Stable: Merge 14979:15258 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/admin/inc/class.uiaccounts.inc.php
    branches/Version-2_0-branch/booking/inc/class.uiallocation.inc.php
    branches/Version-2_0-branch/booking/inc/class.uiapplication.inc.php
    branches/Version-2_0-branch/booking/inc/class.uibooking.inc.php
    branches/Version-2_0-branch/booking/inc/class.uicommon.inc.php
    branches/Version-2_0-branch/booking/inc/class.uievent.inc.php
    branches/Version-2_0-branch/booking/setup/phpgw_no.lang
    branches/Version-2_0-branch/booking/templates/base/allocation.xsl
    branches/Version-2_0-branch/booking/templates/base/application_edit.xsl
    branches/Version-2_0-branch/booking/templates/base/customer_identifier.xsl
    branches/Version-2_0-branch/bookingfrontend/css/bookingfrontend.css
    branches/Version-2_0-branch/bookingfrontend/setup/phpgw_no.lang
    
branches/Version-2_0-branch/bookingfrontend/templates/base/application_new.xsl
    branches/Version-2_0-branch/controller/inc/class.menu.inc.php
    branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-2_0-branch/controller/setup/phpgw_no.lang
    branches/Version-2_0-branch/controller/templates/base/config.tpl
    branches/Version-2_0-branch/demo/inc/class.sodemo.inc.php
    branches/Version-2_0-branch/helpdesk/inc/class.sotts.inc.php
    branches/Version-2_0-branch/hrm/inc/class.bocommon.inc.php
    branches/Version-2_0-branch/hrm/inc/class.souser.inc.php
    branches/Version-2_0-branch/hrm/inc/class.uiuser.inc.php
    branches/Version-2_0-branch/notes/inc/class.sonotes.inc.php
    branches/Version-2_0-branch/notes/inc/class.uinotes.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.acl.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.jqcal.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.phpgw.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
    branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
    branches/Version-2_0-branch/phpgwapi/setup/phpgw_en.lang
    branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php
    branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php
    branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
    branches/Version-2_0-branch/phpgwapi/templates/pure/css/pure-extension.css
    branches/Version-2_0-branch/preferences/changepassword.php
    branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php
    branches/Version-2_0-branch/property/inc/class.boadmin_location.inc.php
    branches/Version-2_0-branch/property/inc/class.boagreement.inc.php
    branches/Version-2_0-branch/property/inc/class.boasync.inc.php
    branches/Version-2_0-branch/property/inc/class.bobudget.inc.php
    branches/Version-2_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-2_0-branch/property/inc/class.bocustom.inc.php
    branches/Version-2_0-branch/property/inc/class.bodocument.inc.php
    branches/Version-2_0-branch/property/inc/class.boentity.inc.php
    branches/Version-2_0-branch/property/inc/class.bogab.inc.php
    branches/Version-2_0-branch/property/inc/class.bogeneric.inc.php
    branches/Version-2_0-branch/property/inc/class.boifc.inc.php
    branches/Version-2_0-branch/property/inc/class.boinvestment.inc.php
    branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-2_0-branch/property/inc/class.bopricebook.inc.php
    branches/Version-2_0-branch/property/inc/class.boproject.inc.php
    branches/Version-2_0-branch/property/inc/class.borequest.inc.php
    branches/Version-2_0-branch/property/inc/class.bos_agreement.inc.php
    branches/Version-2_0-branch/property/inc/class.botemplate.inc.php
    branches/Version-2_0-branch/property/inc/class.botenant_claim.inc.php
    branches/Version-2_0-branch/property/inc/class.bowo_hour.inc.php
    branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-2_0-branch/property/inc/class.soadmin_location.inc.php
    branches/Version-2_0-branch/property/inc/class.soagreement.inc.php
    branches/Version-2_0-branch/property/inc/class.socustom.inc.php
    branches/Version-2_0-branch/property/inc/class.soentity.inc.php
    branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.sojasper.inc.php
    branches/Version-2_0-branch/property/inc/class.solocation.inc.php
    branches/Version-2_0-branch/property/inc/class.soproject.inc.php
    branches/Version-2_0-branch/property/inc/class.sos_agreement.inc.php
    branches/Version-2_0-branch/property/inc/class.sotts.inc.php
    branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-2_0-branch/property/inc/class.uiadmin_location.inc.php
    branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
    branches/Version-2_0-branch/property/inc/class.uiasync.inc.php
    branches/Version-2_0-branch/property/inc/class.uibudget.inc.php
    branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
    branches/Version-2_0-branch/property/inc/class.uicustom.inc.php
    branches/Version-2_0-branch/property/inc/class.uidocument.inc.php
    branches/Version-2_0-branch/property/inc/class.uidocument2.inc.php
    branches/Version-2_0-branch/property/inc/class.uientity.inc.php
    branches/Version-2_0-branch/property/inc/class.uievent.inc.php
    branches/Version-2_0-branch/property/inc/class.uigab.inc.php
    branches/Version-2_0-branch/property/inc/class.uigallery.inc.php
    branches/Version-2_0-branch/property/inc/class.uigeneric.inc.php
    branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php
    branches/Version-2_0-branch/property/inc/class.uiinvestment.inc.php
    branches/Version-2_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.uijasper.inc.php
    branches/Version-2_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-2_0-branch/property/inc/class.uipricebook.inc.php
    branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-2_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-2_0-branch/property/inc/class.uiresponsible.inc.php
    branches/Version-2_0-branch/property/inc/class.uis_agreement.inc.php
    branches/Version-2_0-branch/property/inc/class.uitemplate.inc.php
    branches/Version-2_0-branch/property/inc/class.uitenant_claim.inc.php
    branches/Version-2_0-branch/property/inc/class.uitts.inc.php
    branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
    branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
    
branches/Version-2_0-branch/property/js/portico/admin_entity.edit_category.js
    branches/Version-2_0-branch/property/js/portico/entity.edit.js
    branches/Version-2_0-branch/property/js/portico/location.edit.js
    branches/Version-2_0-branch/property/js/portico/tts.view.js
    branches/Version-2_0-branch/property/setup/default_records.inc.php
    branches/Version-2_0-branch/property/setup/setup.inc.php
    branches/Version-2_0-branch/property/setup/tables_current.inc.php
    branches/Version-2_0-branch/property/setup/tables_update.inc.php
    branches/Version-2_0-branch/property/templates/base/admin_location.xsl
    branches/Version-2_0-branch/property/templates/base/agreement.xsl
    branches/Version-2_0-branch/property/templates/base/config.tpl
    branches/Version-2_0-branch/property/templates/base/entity.xsl
    branches/Version-2_0-branch/property/templates/base/generic_document.xsl
    branches/Version-2_0-branch/property/templates/base/invoice2.xsl
    branches/Version-2_0-branch/property/templates/base/location.xsl
    branches/Version-2_0-branch/property/templates/base/workorder.xsl
    branches/Version-2_0-branch/registration/inc/class.boreg.inc.php
    branches/Version-2_0-branch/rental/inc/class.menu.inc.php
    branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.socomposite.inc.php
    branches/Version-2_0-branch/rental/inc/class.socontract.inc.php
    branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.soinvoice_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
    branches/Version-2_0-branch/rental/inc/class.uiprice_item.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.agresso_gl07.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.agresso_lg04.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.contract.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php
    
branches/Version-2_0-branch/rental/inc/model/class.invoice_price_item.inc.php
    branches/Version-2_0-branch/rental/setup/phpgw_no.lang
    branches/Version-2_0-branch/rental/setup/setup.inc.php
    branches/Version-2_0-branch/rental/setup/tables_current.inc.php
    branches/Version-2_0-branch/rental/setup/tables_update.inc.php
    branches/Version-2_0-branch/rental/templates/base/billing.xsl
    branches/Version-2_0-branch/rental/templates/base/contract.xsl
    branches/Version-2_0-branch/rental/templates/base/css/base.css
    branches/Version-2_0-branch/sms/inc/class.soautoreply.inc.php
    branches/Version-2_0-branch/sms/inc/class.socommand.inc.php
    branches/Version-2_0-branch/sms/inc/class.sopoll.inc.php
    branches/Version-2_0-branch/sms/inc/class.sosms.inc.php
    branches/Version-2_0-branch/sms/setup/default_records.inc.php
    branches/Version-2_0-branch/sms/setup/setup.inc.php
    branches/Version-2_0-branch/sms/setup/tables_update.inc.php
    branches/Version-2_0-branch/todo/inc/class.botodo.inc.php
    branches/Version-2_0-branch/todo/inc/class.sotodo.inc.php
    branches/Version-2_0-branch/todo/inc/class.uitodo.inc.php

Added Paths:
-----------
    branches/Version-2_0-branch/property/inc/class.bogeneric_document.inc.php
    branches/Version-2_0-branch/property/inc/class.sogeneric_document.inc.php
    branches/Version-2_0-branch/property/js/portico/generic_document.edit.js
    branches/Version-2_0-branch/rental/inc/class.soapplication.inc.php
    branches/Version-2_0-branch/rental/inc/class.uiapplication.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.application.inc.php
    branches/Version-2_0-branch/rental/js/rental/application.edit.js
    branches/Version-2_0-branch/rental/js/rental/application.index.js
    branches/Version-2_0-branch/rental/templates/base/application.xsl

Property Changed:
----------------
    branches/Version-2_0-branch/
    branches/Version-2_0-branch/booking/
    branches/Version-2_0-branch/bookingfrontend/


Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978
   + /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14937-15027,15165-15215,15223-15228,15230-15243,15245-15250,15254-15257
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258

Modified: branches/Version-2_0-branch/admin/inc/class.uiaccounts.inc.php
===================================================================
--- branches/Version-2_0-branch/admin/inc/class.uiaccounts.inc.php      
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/admin/inc/class.uiaccounts.inc.php      
2016-06-06 12:26:20 UTC (rev 15259)
@@ -859,6 +859,12 @@
                public function _user_save()
                {
                        $values                                                 
                = phpgw::get_var('values', 'string', 'POST');
+                       if(isset($values['passwd']))
+                       {
+                               // remove entities to stop mangling
+                               $values['passwd'] = 
html_entity_decode($values['passwd']);
+                               $values['passwd_2'] = 
html_entity_decode($values['passwd_2']);
+                       }
                        $values['account_groups']                               
= (array) phpgw::get_var('account_groups', 'int', 'POST');
                        $account_permissions                                    
= phpgw::get_var('account_permissions', 'int', 'POST');
                        $account_permissions_admin                              
= phpgw::get_var('account_permissions_admin', 'int', 'POST');


Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978
   + /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258

Modified: branches/Version-2_0-branch/booking/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uiallocation.inc.php  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/inc/class.uiallocation.inc.php  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -109,6 +109,15 @@
                                                        'label' => lang('To')
                                                ),
                                                array(
+                                                       'key' => 'cost',
+                                                       'label' => lang('cost')
+                                               ),
+                                               array(
+                                                       'key' => 'cost_history',
+                                                       'label' => lang('cost 
history'),
+                                                       'sortable' => false,
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -188,6 +197,7 @@
                        {
                                $allocation['from_'] = 
pretty_timestamp($allocation['from_']);
                                $allocation['to_'] = 
pretty_timestamp($allocation['to_']);
+                               $allocation['cost_history'] = 
count($this->bo->so->get_ordered_costs($allocation['id']));
                        }
 
                        return $this->jquery_results($allocations);
@@ -287,42 +297,13 @@
                                $allocation['active'] = '1';
                                $allocation['completed'] = '0';
 
-                               if (phpgw::get_var('weekday', 'string') != '')
-                               {
-                                       $from_date = phpgw::get_var('from_', 
'string');
-                                       $to_date = phpgw::get_var('to_', 
'string');
-                                       $weekday = phpgw::get_var('weekday', 
'string');
-                                       $datef = explode(' ', $from_date[0]);
-                                       $timef = $_POST['from_'];
-                                       $datet = explode(' ', $to_date[0]);
-                                       $timet = $_POST['to_'];
+                               $from_date = $_POST['from_'];
+                               $to_date = $_POST['to_'];
+                               $weekday = $_POST['weekday'];
 
-                                       if (strlen($_POST['from_']) < 14)
-                                       {
-                                               $allocation['from_'] = 
$datef[0] . " " . $timef;
-                                               $allocation['to_'] = $datet[0] 
. " " . $timet;
-                                               $from_date = 
$allocation['from_'];
-                                               $to_date = $allocation['to_'];
-                                       }
-                                       else
-                                       {
-                                               $allocation['from_'] = 
$_POST['from_'];
-                                               $allocation['to_'] = 
$_POST['to_'];
-                                               $from_date = 
$allocation['from_'];
-                                               $to_date = $allocation['to_'];
-                                       }
-                               }
-                               else
-                               {
-                                       $from_date = $_POST['from_'];
-                                       $to_date = $_POST['to_'];
-                                       $weekday = $_POST['weekday'];
+                               $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'] . " " . 
$_POST['from_']));
-                                       $allocation['to_'] = strftime("%Y-%m-%d 
%H:%M", strtotime($_POST['weekday'] . " " . $_POST['to_']));
-                               }
-
-
                                if (($_POST['weekday'] != 'sunday' && date('w') 
> date('w', strtotime($_POST['weekday']))) || (date('w') == 'sunday' && 
date('w') < date('w', strtotime($_POST['weekday']))))
                                {
                                        if (phpgw::get_var('weekday', 'string') 
== '')

Modified: branches/Version-2_0-branch/booking/inc/class.uiapplication.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uiapplication.inc.php 
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/inc/class.uiapplication.inc.php 
2016-06-06 12:26:20 UTC (rev 15259)
@@ -311,7 +311,7 @@
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'booking.uiapplication.index',
                                                'phpgw_return_as' => 'json')),
-                                       'sorted_by' => array('key' => 4, 'dir' 
=> 'asc'),//created
+                                       'sorted_by' => array('key' => 0, 'dir' 
=> 'desc'),//id
                                        'field' => array(
                                                array(
                                                        'key' => 'id',
@@ -805,6 +805,9 @@
 
                public function edit()
                {
+                       $config = CreateObject('phpgwapi.config', 'booking');
+                       $config->read();
+                       $application_text = $config->config_data;
                        $id = phpgw::get_var('id', 'int');
                        $application = $this->bo->read_single($id);
                        $activity_path = 
$this->activity_bo->get_path($application['activity_id']);
@@ -898,9 +901,10 @@
 
                        
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
                                'file'), 'application_form');
-
+                       //_debug_array($application_text);die();
                        self::render_template_xsl('application_edit', 
array('application' => $application,
-                               'activities' => $activities, 'agegroups' => 
$agegroups, 'audience' => $audience));
+                               'activities' => $activities, 'agegroups' => 
$agegroups, 'audience' => $audience,
+                               'config' => $application_text));
                }
 
                private function check_date_availability( &$allocation )

Modified: branches/Version-2_0-branch/booking/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uibooking.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/inc/class.uibooking.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -120,6 +120,11 @@
                                                        'label' => lang('Cost')
                                                ),
                                                array(
+                                                       'key' => 'cost_history',
+                                                       'label' => lang('cost 
history'),
+                                                       'sortable' => false,
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -199,6 +204,7 @@
                                $booking['building_name'] = $building['name'];
                                $booking['from_'] = 
pretty_timestamp($booking['from_']);
                                $booking['to_'] = 
pretty_timestamp($booking['to_']);
+                               $booking['cost_history'] = 
count($this->bo->so->get_ordered_costs($booking['id']));
                        }
 
                        array_walk($bookings["results"], array($this, 
"_add_links"), "booking.uibooking.show");
@@ -366,7 +372,9 @@
                        $step = phpgw::get_var('step', 'int', 'REQUEST', 1);
 
                        if (!isset($allocation_id))
+                       {
                                $noallocation = 1;
+                       }
                        $invalid_dates = array();
                        $valid_dates = array();
                        if (isset($allocation_id))
@@ -384,16 +392,19 @@
                        }
                        else
                        {
-                               $season = 
$this->season_bo->read_single($_POST['season_id']);
-                               $booking['organization_id'] = 
$_POST['organization_id'];
-                               $booking['organization_name'] = 
$_POST['organization_name'];
+                               $season = 
$this->season_bo->read_single(phpgw::get_var('season_id','int', 'POST'));
+                               $booking['organization_id'] = 
phpgw::get_var('organization_id','int', 'POST');
+                               $booking['organization_name'] = 
phpgw::get_var('organization_name','string', 'POST');
                                $noallocation = True;
                        }
                        if ($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
-                               $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
-                               $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
-                               $_POST['repeat_until'] = date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+//                             $_POST['from_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['from_']));
+//                             $_POST['to_'] = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($_POST['to_']));
+//                             $_POST['repeat_until'] = date("Y-m-d", 
phpgwapi_datetime::date_to_timestamp($_POST['repeat_until']));
+//                             $_POST['from_'] = 
phpgw::get_var('from_','string', 'POST');
+//                             $_POST['to_'] = phpgw::get_var('to_','string', 
'POST');
+//                             $_POST['repeat_until'] = 
phpgw::get_var('repeat_until','string', 'POST');
 
                                $today = getdate();
                                $booking = extract_values($_POST, 
$this->fields);

Modified: branches/Version-2_0-branch/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uicommon.inc.php      
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/inc/class.uicommon.inc.php      
2016-06-06 12:26:20 UTC (rev 15259)
@@ -742,11 +742,12 @@
                        $lang_select_date = lang('select date');
                        $lang_from = lang('from');
                        $lang_to = lang('to');
+                       $lang_remove = lang('remove date');
 
                        if ($GLOBALS['phpgw_info']['flags']['currentapp'] == 
'bookingfrontend')
                        {
                                $html = 'var html = "<div 
class=\'date-container\'>"+
-                            "<a class=\'close-btn btnclose\' 
href=\'javascript:void(0);\'>-</a>"+
+                            "<a class=\'close-btn btnclose\' 
href=\'javascript:void(0);\'>' . $lang_remove . '</a>"+
                             "<dt><label 
for=\'new_start_date_"+this.counter+"\'>' . $lang_from . '</label></dt>"+
                             "<dd><input class=\'new_datepicker time\' 
readonly=\'readonly\' name=\'from_[]\' id=\'new_start_date_"+this.counter+"\' 
type=\'text\'>"+
                             "</input></dd>"+

Modified: branches/Version-2_0-branch/booking/inc/class.uievent.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.uievent.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/inc/class.uievent.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -111,6 +111,15 @@
                                                        'label' => 
lang('Active')
                                                ),
                                                array(
+                                                       'key' => 'cost',
+                                                       'label' => lang('Cost')
+                                               ),
+                                               array(
+                                                       'key' => 'cost_history',
+                                                       'label' => lang('cost 
history'),
+                                                       'sortable' => false,
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -172,6 +181,7 @@
                        {
                                $event['from_'] = 
pretty_timestamp($event['from_']);
                                $event['to_'] = pretty_timestamp($event['to_']);
+                               $event['cost_history'] = 
count($this->bo->so->get_ordered_costs($event['id']));
                        }
 
                        array_walk($events["results"], array($this, 
"_add_links"), "booking.uievent.edit");
@@ -359,11 +369,11 @@
 
                                foreach ($_POST['from_'] as &$from)
                                {
-                                       $from = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($from));
+//                                     $from = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($from));
                                }
                                foreach ($_POST['to_'] as &$to)
                                {
-                                       $to = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($to));
+//                                     $to = date("Y-m-d H:i:s", 
phpgwapi_datetime::date_to_timestamp($to));
                                }
 
                                $event['dates'] = array_map(array(self, 
'_combine_dates'), $_POST['from_'], $_POST['to_']);

Modified: branches/Version-2_0-branch/booking/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/booking/setup/phpgw_no.lang     2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/setup/phpgw_no.lang     2016-06-06 
12:26:20 UTC (rev 15259)
@@ -682,3 +682,4 @@
 Mail text for comment added    booking no      Ekstra epost tekst for kommentar
 organzations_ids_description   booking no      Her kan du legge inn en komma 
separert liste med organisasjons IDer som vil få epost viss noen avbestiller 
denne ressursen.
 organzations_ids       booking no      Organisasjons IDer
+cost history   booking no      Prishistorikk
\ No newline at end of file

Modified: branches/Version-2_0-branch/booking/templates/base/allocation.xsl
===================================================================
--- branches/Version-2_0-branch/booking/templates/base/allocation.xsl   
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/templates/base/allocation.xsl   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -21,6 +21,12 @@
                                        <xsl:value-of 
select="php:function('pretty_timestamp', allocation/to_)"/>
                                </div>
                                <div class="pure-control-group">
+                                       <label for="field_cost">
+                                               <xsl:value-of 
select="php:function('lang', 'Cost')" />
+                                       </label>
+                                       <xsl:value-of select="allocation/cost"/>
+                               </div>
+                               <div class="pure-control-group">
                                        <label>
                                                <xsl:value-of 
select="php:function('lang', 'Season')" />
                                        </label>

Modified: 
branches/Version-2_0-branch/booking/templates/base/application_edit.xsl
===================================================================
--- branches/Version-2_0-branch/booking/templates/base/application_edit.xsl     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/templates/base/application_edit.xsl     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -46,6 +46,11 @@
                                                                <label 
for="field_activity">
                                                                        
<xsl:value-of select="php:function('lang', 'Activity')" />
                                                                </label>
+                                                               <xsl:if 
test="config/application_activities">
+                                                                       <p>
+                                                                               
<xsl:value-of select="config/application_activities"/>
+                                                                       </p>
+                                                               </xsl:if>
                                                                <select 
name="activity_id" id="field_activity" class="pure-u-1 pure-u-sm-1-2 
pure-u-lg-1-3">
                                                                        
<xsl:attribute name="data-validation">
                                                                                
<xsl:text>required</xsl:text>
@@ -73,6 +78,11 @@
                                                                <label 
for="field_description">
                                                                        
<xsl:value-of select="php:function('lang', 'Description')" />
                                                                </label>
+                                                               <xsl:if 
test="config/application_description">
+                                                                       <p>
+                                                                               
<xsl:value-of select="config/application_description"/>
+                                                                       </p>
+                                                               </xsl:if>
                                                                <textarea 
id="field_description" class="full-width pure-u-1 pure-u-sm-1-2 pure-u-lg-1-3" 
name="description">
                                                                        
<xsl:attribute name="data-validation">
                                                                                
<xsl:text>required</xsl:text>
@@ -100,6 +110,11 @@
                                                                        <h3>2. 
<xsl:value-of select="php:function('lang', 'Where?')" /></h3>
                                                                </legend>
                                                        </div>
+                                                       <xsl:if 
test="config/application_where">
+                                                               <p>
+                                                                       
<xsl:value-of select="config/application_where"/>
+                                                               </p>
+                                                       </xsl:if>
                                                        <div 
class="pure-control-group">
                                                                <label 
for="field_building_name">
                                                                        
<xsl:value-of select="php:function('lang', 'Building')" />
@@ -144,6 +159,11 @@
                                                                        <h3>3. 
<xsl:value-of select="php:function('lang', 'When?')" /></h3>
                                                                </legend>
                                                        </div>
+                                                       <xsl:if 
test="config/application_when">
+                                                               <p>
+                                                                       
<xsl:value-of select="config/application_when"/>
+                                                               </p>
+                                                       </xsl:if>
                                                        <div 
id="dates-container">
                                                                <input 
type="hidden" data-validation="application_dates">
                                                                        
<xsl:attribute name="data-validation-error-msg">
@@ -236,6 +256,11 @@
                                                                        <h3>4. 
<xsl:value-of select="php:function('lang', 'Who?')" /></h3>
                                                                </legend>
                                                        </div>
+                                                       <xsl:if 
test="config/application_who">
+                                                               <p>
+                                                                       
<xsl:value-of select="config/application_who"/>
+                                                               </p>
+                                                       </xsl:if>
                                                        <div class="pure-g">
                                                                <div 
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1">
                                                                        <label 
for="field_from">
@@ -268,6 +293,11 @@
                                                                        <label 
for="field_from">
                                                                                
<xsl:value-of select="php:function('lang', 'Number of participants')" />
                                                                        </label>
+                                                                       <xsl:if 
test="config/application_howmany">
+                                                                               
<p>
+                                                                               
        <xsl:value-of select="config/application_howmany"/>
+                                                                               
</p>
+                                                                       
</xsl:if>
                                                                        <input 
type="hidden" data-validation="number_participants">
                                                                                
<xsl:attribute name="data-validation-error-msg">
                                                                                
        <xsl:value-of select="php:function('lang', 'Number of participants is 
required')" />
@@ -327,6 +357,11 @@
                                                                        </h3>
                                                                </legend>
                                                        </div>
+                                                       <xsl:if 
test="config/application_contact_information">
+                                                               <p>
+                                                                       
<xsl:value-of select="config/application_contact_information"/>
+                                                               </p>
+                                                       </xsl:if>
                                                        <div 
class="pure-control-group">
                                                                <label 
for="field_contact_name">
                                                                        
<xsl:value-of select="php:function('lang', 'Name')" />
@@ -392,12 +427,24 @@
                                                                                
        </h3>
                                                                                
</legend>
                                                                        </div>
+                                                                       <xsl:if 
test="config/application_terms">
+                                                                               
<p>
+                                                                               
        <xsl:value-of select="config/application_terms"/>
+                                                                               
</p>
+                                                                       
</xsl:if>
+
                                                                        <input 
type="hidden" data-validation="regulations_documents">
                                                                                
<xsl:attribute name="data-validation-error-msg">
                                                                                
        <xsl:value-of select="php:function('lang', 'You must accept to follow 
all terms and conditions of lease first')" />
                                                                                
</xsl:attribute>
                                                                        </input>
                                                                        <div 
id='regulation_documents'></div>
+                                                                       <xsl:if 
test="config/application_terms2">
+                                                                               
<p>
+                                                                               
        <xsl:value-of select="config/application_terms2"/>
+                                                                               
</p>
+                                                                       
</xsl:if>
+
                                                                </div>
                                                                <div 
class="pure-control-group pure-u-1 pure-u-md-1-2 pure-u-lg-1"></div>
                                                        </div>

Modified: 
branches/Version-2_0-branch/booking/templates/base/customer_identifier.xsl
===================================================================
--- branches/Version-2_0-branch/booking/templates/base/customer_identifier.xsl  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/booking/templates/base/customer_identifier.xsl  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -3,10 +3,10 @@
        <xsl:param name="label" select="string('Invoice information')"/>
 
        <func:result>
-               <xsl:if test="not(normalize-space($label))">
-                       <xsl:attribute name="style">display:none</xsl:attribute>
-               </xsl:if>
                <label>
+                       <xsl:if test="not(normalize-space($label))">
+                               <xsl:attribute 
name="style">display:none</xsl:attribute>
+                       </xsl:if>
                        <h4>
                                <xsl:value-of select="php:function('lang', 
$label)" />
                        </h4>


Property changes on: branches/Version-2_0-branch/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978
   + /branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258

Modified: branches/Version-2_0-branch/bookingfrontend/css/bookingfrontend.css
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/css/bookingfrontend.css 
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/bookingfrontend/css/bookingfrontend.css 
2016-06-06 12:26:20 UTC (rev 15259)
@@ -34,6 +34,7 @@
 #schedule_container .pure-table thead th {line-height: 1.4;}
 #schedule_container p.conflicts {margin: 0;color: #000;}
 #schedule_container .cellInfo:hover {background-image: 
url("../../phpgwapi/templates/pure/images/info.png");background-position: 100% 
0;background-repeat: no-repeat;cursor: pointer;}
+#schedule_container .free:hover {cursor: pointer;}
 #schedule_overlay {background-color: #fff;border: 1px solid #000;height: 
auto;left: 0;margin: auto;padding: 20px;position: absolute;right: 0;width: 
400px;z-index: 9;}
 #schedule_overlay img {bottom: 0;display: block;left: 0;margin: auto;position: 
absolute;right: 0;top: 0;}
 #week-selector {list-style: outside none none;margin-top: 10px;cursor: 
pointer;}
@@ -601,13 +602,14 @@
 }
 .date-container .close-btn {
     border: medium none;
-    color: white;
+    color: black;
     cursor: pointer;
     display: block;
     float: right;
-    height: 15px;
+    height: 25px;
     text-decoration: none;
     width: 25px;
+       font-size: 100%;
 }
 #agegroup {
     background: #eee none repeat scroll 0 0;

Modified: branches/Version-2_0-branch/bookingfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/setup/phpgw_no.lang     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/bookingfrontend/setup/phpgw_no.lang     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -1,5 +1,9 @@
 attachment     bookingfrontend no      Vedlegg
+remove date    bookingfrontend no      Fjern dato
 please enter a descripction    bookingfrontend no      Vennligst angi en 
beskrivelse
+please choose at least 1 resource      common  no      Vennligst velg minst en 
ressurs
+you must accept to follow all terms and conditions of lease first      common  
no      Du må bekrefte at du har lest juridiske betingelser
+invalid date   common  no      Ugyldig dato
 please enter a contact name    bookingfrontend no      Vennligst angi 
kontaktnavn
 please enter a contact email   bookingfrontend no      Vennligst angi epost
 customer identifier type is required   bookingfrontend no      Vennligst angi 
identifikasjon

Modified: 
branches/Version-2_0-branch/bookingfrontend/templates/base/application_new.xsl
===================================================================
--- 
branches/Version-2_0-branch/bookingfrontend/templates/base/application_new.xsl  
    2016-06-05 14:17:38 UTC (rev 15258)
+++ 
branches/Version-2_0-branch/bookingfrontend/templates/base/application_new.xsl  
    2016-06-06 12:26:20 UTC (rev 15259)
@@ -21,11 +21,11 @@
                                                        <label 
for="field_activity">
                                                                <xsl:value-of 
select="php:function('lang', 'Activity')" />
                                                        </label>
-                                                       <!--xsl:if 
test="config/application_activities">
+                                                       <xsl:if 
test="config/application_activities">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_activities"/>
                                                        </p>
-                                                       </xsl:if-->
+                                                       </xsl:if>
                                                </dt>
                                                <dd>
                                                        <select 
name="activity_id" id="field_activity">
@@ -55,11 +55,11 @@
                                                        <label 
for="field_description">
                                                                <xsl:value-of 
select="php:function('lang', 'Information about the event')" />
                                                        </label>
-                                                       <!--xsl:if 
test="config/application_description">
+                                                       <xsl:if 
test="config/application_description">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_description"/>
                                                        </p>
-                                                       </xsl:if-->
+                                                       </xsl:if>
                                                </dt>
                                                <dd>
                                                        <textarea 
id="field_description" class="full-width" name="description">
@@ -72,7 +72,7 @@
                                                                <xsl:value-of 
select="application/description"/>
                                                        </textarea>
                                                </dd>
-                                               <!--dt>
+                                               <dt>
                                                        <xsl:if 
test="config/application_equipment">
                                                                <p>
                                                                        
<xsl:value-of select="config/application_equipment"/>
@@ -81,17 +81,17 @@
                                                </dt>
                                                <dd>
                                                        <textarea 
id="field_equipment" class="full-width" name="equipment"><xsl:value-of 
select="application/equipment"/></textarea>
-                                               </dd-->
+                                               </dd>
                                        </dl>
                                </div>
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-2">
                                        <dl class="form-col">
                                                <div class="heading">2. 
<xsl:value-of select="php:function('lang', 'How many?')" /></div>
-                                               <!--xsl:if 
test="config/application_howmany">
+                                               <xsl:if 
test="config/application_howmany">
                                                <p>
                                                        <xsl:value-of 
select="config/application_howmany"/>
                                                </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <dt>
                                                        <label 
for="field_agegroups">
                                                                <xsl:value-of 
select="php:function('lang', 'Estimated number of participants')" />
@@ -153,11 +153,11 @@
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">
                                        <dl class="form-col">
                                                <div class="heading">3. 
<xsl:value-of select="php:function('lang', 'Where?')" /></div>
-                                               <!--xsl:if 
test="config/application_where">
+                                               <xsl:if 
test="config/application_where">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_where"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <dt>
                                                        <label 
for="field_building">
                                                                <xsl:value-of 
select="php:function('lang', 'Building')" />
@@ -212,11 +212,11 @@
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">
                                        <dl class="form-col">
                                                <div class="heading">4. 
<xsl:value-of select="php:function('lang', 'When?')" /></div>
-                                               <!--xsl:if 
test="config/application_when">
+                                               <xsl:if 
test="config/application_when">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_when"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <div id="dates-container">
                                                        <input type="hidden" 
data-validation="application_dates">
                                                                <xsl:attribute 
name="data-validation-error-msg">
@@ -228,7 +228,9 @@
                                                                <xsl:choose>
                                                                        
<xsl:when test="position() > 1">
                                                                                
<div class="date-container">
-                                                                               
        <a href="javascript:void(0);" class="close-btn btnclose">-</a>
+                                                                               
        <a href="javascript:void(0);" class="close-btn btnclose">
+                                                                               
                <xsl:value-of select="php:function('lang', 'remove date')" />
+                                                                               
        </a>
                                                                                
        <dt>
                                                                                
                <label for="start_date_{$index}">
                                                                                
                        <xsl:value-of select="php:function('lang', 'From')" />
@@ -263,7 +265,9 @@
                                                                        
</xsl:when>
                                                                        
<xsl:otherwise>
                                                                                
<div class="date-container">
-                                                                               
        <a href="javascript:void(0);" class="close-btn btnclose">-</a>
+                                                                               
        <a href="javascript:void(0);" class="close-btn btnclose">
+                                                                               
                <xsl:value-of select="php:function('lang', 'remove date')" />
+                                                                               
        </a>
                                                                                
        <dt>
                                                                                
                <label for="start_date">
                                                                                
                        <xsl:value-of select="php:function('lang', 'From')" />
@@ -311,11 +315,11 @@
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">
                                        <dl class="form-col">
                                                <div class="heading">5. 
<xsl:value-of select="php:function('lang', 'Who?')" /></div>
-                                               <!--xsl:if 
test="config/application_who">
+                                               <xsl:if 
test="config/application_who">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_who"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <dt>
                                                        <label for="field_from">
                                                                <xsl:value-of 
select="php:function('lang', 'Target audience')" />
@@ -354,11 +358,11 @@
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">
                                        <dl class="form-col">
                                                <div class="heading">6. 
<xsl:value-of select="php:function('lang', 'Contact information')" /></div>
-                                               <!--xsl:if 
test="config/application_contact_information">
+                                               <xsl:if 
test="config/application_contact_information">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_contact_information"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <dt>
                                                        <label 
for="field_contact_name">
                                                                <xsl:value-of 
select="php:function('lang', 'Name')" />
@@ -433,18 +437,18 @@
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">
                                        <dl class="form-col">
                                                <div class="heading">7. 
<xsl:value-of select="php:function('lang', 'responsible applicant')" /> / 
<xsl:value-of select="php:function('lang', 'invoice information')" /></div>
-                                               <!--xsl:if 
test="config/application_responsible_applicant">
+                                               <xsl:if 
test="config/application_responsible_applicant">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_responsible_applicant"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                                <xsl:copy-of 
select="phpgw:booking_customer_identifier(application, '')"/>
                                                <br />
-                                               <!--xsl:if 
test="config/application_invoice_information">
+                                               <xsl:if 
test="config/application_invoice_information">
                                                        <p>
                                                                <xsl:value-of 
select="config/application_invoice_information"/>
                                                        </p>
-                                               </xsl:if-->
+                                               </xsl:if>
                                        </dl>
                                </div>
                                <div class="pure-u-1 pure-u-md-1-2 
pure-u-lg-1-3">

Modified: branches/Version-2_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.menu.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/controller/inc/class.menu.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -42,79 +42,67 @@
                                'controller' => array
                                        (
                                        'text' => lang('Controller'),
-                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.control_list')),
+                       //              'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.control_list')),
+                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicomponent.index')),
                                        'image' => array('property', 
'location'),
                                        'order' => 10,
                                        'group' => 'office'
                                )
                        );
 
+                       $menus['navigation'] = array();
                        if 
($GLOBALS['phpgw']->acl->check('.usertype.superuser', PHPGW_ACL_ADD, 
'controller'))
                        {
-                               $menus['navigation'] = array
-                                       (
-                                       'control' => array
-                                               (
-                                               'text' => lang('Control'),
+                               $menus['navigation']['control'] =  array(
+                                               'text' => lang('Control types'),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.control_list')),
-                                               'image' => array('property', 
'location_1'),
-                                               'children' => array(
+                                               'image' => array('property', 
'location_1'));
+
+                               
+                               $config = CreateObject('phpgwapi.config', 
'controller');
+                               $config->read();
+
+
+                               if 
(!isset($config->config_data['home_alternative']) || 
!$config->config_data['home_alternative'])
+                               {
+                                                               
+                                       
$menus['navigation']['control']['children'] = array(
                                                        
'location_for_check_list' => array
                                                                (
                                                                'text' => 
lang('location_connections'),
                                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_register_to_location.index')),
                                                                'image' => 
array('property', 'location_1')
-                                                       ),
-                                                       
'component_for_check_list' => array
-                                                               (
-                                                               'text' => 
lang('component'),
-                                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_register_to_component.index')),
-                                                               'image' => 
array('property', 'entity_1')
                                                        )
-                                               )
-                                       ),
-                                       'control_item' => array
-                                               (
-                                               'text' => lang('Control_item'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_item.index')),
-                                               'image' => array('property', 
'location_1')
-                                       ),
-                                       'control_group' => array
-                                               (
-                                               'text' => lang('Control_group'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_group.index')),
-                                               'image' => array('property', 
'location_1'),
-                                       /*
-                                         'children' => array(
-                                         'component_for_control_group' => array
-                                         (
-                                         'text'        => lang('component'),
-                                         'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_group_component.index') ),
-                                         'image'       => array('property', 
'entity_1')
-                                         )
-                                         )
-                                        */
-                                       ),
-                                       'procedure' => array
-                                               (
-                                               'text' => lang('Procedure'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiprocedure.index')),
-                                               'image' => array('property', 
'location_1'),
-                                       ),
-                                       'calendar_overview' => array
-                                               (
-                                               'text' => 
lang('Calendar_overview'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicalendar.view_calendar_for_year')),
-                                               'image' => array('property', 
'location_1'),
-                                       ),
-                                       'status_components' => array
-                                               (
-                                               'text' => lang('status 
components'),
-                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicomponent.index')),
-                                               'image' => array('property', 
'location_1'),
-                                       ),
+                                               );
+                               }
+
+                               $menus['navigation']['control_item'] = array(
+                                       'text' => lang('Control_item'),
+                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_item.index')),
+                                       'image' => array('property', 
'location_1')
                                );
+                               $menus['navigation']['control_group'] = array(
+                                       'text' => lang('Control_group'),
+                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol_group.index')),
+                                       'image' => array('property', 
'location_1')
+                                       );
+
+                               $menus['navigation']['procedure'] = array(
+                                       'text' => lang('Procedure'),
+                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uiprocedure.index')),
+                                       'image' => array('property', 
'location_1'),
+                               );
                        }
+                       $menus['navigation']['calendar_overview'] = array(
+                               'text' => lang('Calendar_overview'),
+                               'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicalendar.view_calendar_for_year')),
+                               'image' => array('property', 'location_1'),
+                       );
+                       $menus['navigation']['status_components'] = array(
+                               'text' => lang('status components'),
+                               'url' => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'controller.uicomponent.index')),
+                               'image' => array('property', 'location_1'),
+                       );
 
                        if ($GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin') || $GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'controller'))
                        {

Modified: branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/controller/inc/class.uicheck_list.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -930,36 +930,62 @@
 //                     $valid_types = 
isset($config->config_data['document_valid_types']) && 
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' , 
$config->config_data['document_valid_types'] ) : '.pdf';
 
                        $values = array();
-//                     if($valid_types)
+
+                       $lang_view = lang('click to view file');
+                       foreach ($document_list as $entry)
                        {
-                               $lang_view = lang('click to view file');
-                               foreach ($document_list as $entry)
+                               $link_file_data = array
+                                       (
+                                       'menuaction' => 
'property.uidocument.view_file',
+                                       'id' => $entry['document_id'],
+                                       'p_num' => $data['id'],
+                                       'cat_id' => $cat_id,
+                                       'entity_id' => $entity_id,
+                               );
+
+                               $values[] = array
+                                       (
+                                       'document_id' => $entry['document_id'],
+                                       'file_name' => $entry['document_name'],
+                                       'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . "\" target='_blank' 
title='{$lang_view}'>{$entry['document_name']}</a>",
+                                       'link' => $entry['link'],
+                                       'title' => $entry['title'],
+                                       'doc_type' => $entry['doc_type'],
+                                       'document_date' => 
$GLOBALS['phpgw']->common->show_date($entry['document_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                               );
+                       }
+               
+                       $generic_document = 
CreateObject('property.sogeneric_document');
+                       $params['location_id'] = $location_id;
+                       $params['order'] = 'name';              
+                       $params['allrows'] = true;
+                       $generic_document_list = array();
+                       foreach ($doc_types as $doc_type)
+                       {
+                               if ($doc_type)
                                {
-//                                     if ( 
!preg_match("/({$valid_types})$/i", $entry['document_name']) )
-//                                     {
-//                                             continue;
-//                                     }
-                                       $link_file_data = array
-                                               (
-                                               'menuaction' => 
'property.uidocument.view_file',
-                                               'id' => $entry['document_id'],
-                                               'p_num' => $data['id'],
-                                               'cat_id' => $cat_id,
-                                               'entity_id' => $entity_id,
-                                       );
-
-                                       $values[] = array
-                                               (
-                                               'document_id' => 
$entry['document_id'],
-                                               'file_name' => 
$entry['document_name'],
-                                               'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . "\" target='_blank' 
title='{$lang_view}'>{$entry['document_name']}</a>",
-                                               'link' => $entry['link'],
-                                               'title' => $entry['title'],
-                                               'doc_type' => 
$entry['doc_type'],
-                                               'document_date' => 
$GLOBALS['phpgw']->common->show_date($entry['document_date'], 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                       );
+                                       $params['cat_id'] = $doc_type;
+                                       $generic_document_list = 
array_merge($generic_document_list, $generic_document->read($params));
                                }
                        }
+                       
+                       foreach ($generic_document_list as $entry)
+                       {
+                               $link_file_data = array
+                                       (
+                                       'menuaction' => 
'property.uigeneric_document.view_file',
+                                       'file_id' => $entry['id']
+                               );
+
+                               $values[] = array
+                                       (
+                                       'document_id' => $entry['id'],
+                                       'file_name' => $entry['name'],
+                                       'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . "\" target='_blank' 
title='{$lang_view}'>{$entry['name']}</a>"
+                               );
+                       }
+                               
+                       
                        return $values;
                }
 

Modified: branches/Version-2_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/controller/setup/phpgw_no.lang  2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/controller/setup/phpgw_no.lang  2016-06-06 
12:26:20 UTC (rev 15259)
@@ -390,4 +390,5 @@
 summary        common  no      Sammendrag
 components     controller      no      Komponenter
 report type    controller      no      RapportType
-lang_control_mandatory_location        controller      no      Påkrevd 
lokasjonsvalg
\ No newline at end of file
+lang_control_mandatory_location        controller      no      Påkrevd 
lokasjonsvalg
+Control types  controller      no      Kontrolltyper
\ No newline at end of file

Modified: branches/Version-2_0-branch/controller/templates/base/config.tpl
===================================================================
--- branches/Version-2_0-branch/controller/templates/base/config.tpl    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/controller/templates/base/config.tpl    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -1,90 +1,90 @@
 <!-- $Id$ -->
-<!-- BEGIN header -->
-<form method="POST" action="{action_url}">
+<!-- BEGIN header -->
+<form method="POST" action="{action_url}">
        <table class="pure-table pure-table-bordered">
-               <tr class="th">
-                       <td colspan="2"><font 
color="{th_text}">&nbsp;<b>{title}</b></font></td>
-               </tr>
-               <!-- END header -->
-               <!-- BEGIN body -->
-               <tr class="row_on">
-                       <td colspan="2">&nbsp;</td>
-               </tr>
-               <tr class="row_off">
-                       <td colspan="2">&nbsp;<b>{lang_controller} 
{lang_settings}</b></td>
-               </tr>
-               <tr class="row_on">
-                       <td>{lang_Use_ACL_for_control_areas}.</td>
-                       <td>
-                               <select name="newsettings[acl_at_control_area]">
-                                       <option value="2" 
{selected_acl_at_control_area_2}>{lang_no}</option>
-                                       <option value="1" 
{selected_acl_at_control_area_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_off">
-                       <td>{lang_required_actual_hours}.</td>
-                       <td>
-                               <select 
name="newsettings[required_actual_hours]">
-                                       <option value="" 
{selected_required_actual_hours_}>{lang_no}</option>
-                                       <option value="1" 
{selected_required_actual_hours_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_on">
-                       <td>Antall planlagte kontroller som skal vises.</td>
-                       <td>
-                               <input type="text" 
name="newsettings[no_of_planned_controls]" 
value="{value_no_of_planned_controls}"/>
-                       </td>
-               </tr>
-               <tr class="row_off">
-                       <td>Antall tildelte kontroller som skal vises</td>
-                       <td>
-                               <input type="text" 
name="newsettings[no_of_assigned_controls]" 
value="{value_no_of_assigned_controls}"/>
-                       </td>
-               </tr>
-               <tr class="row_on">
-                       <td>{lang_home_alternative}</td>
-                       <td>
-                               <select name="newsettings[home_alternative]">
-                                       <option value="" 
{selected_home_alternative_}>{lang_no}</option>
-                                       <option value="1" 
{selected_home_alternative_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-                <tr class="row_off">
-                       <td>{lang_control_mandatory_location}</td>
-                       <td>
-                               <select 
name="newsettings[control_mandatory_location]">
-                                       <option value="" 
{selected_control_mandatory_location_}>{lang_no}</option>
-                                       <option value="1" 
{selected_control_mandatory_location_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_on">
-                       <td>{lang_document_category}:</td>
-                       <td>
-               <!--to be able to blank the setting - need an empty value-->
-               <input type = 'hidden' name="newsettings[document_cat][]" 
value="">
-                    <table>
+               <tr class="th">
+                       <td colspan="2"><font 
color="{th_text}">&nbsp;<b>{title}</b></font></td>
+               </tr>
+               <!-- END header -->
+               <!-- BEGIN body -->
+               <tr class="row_on">
+                       <td colspan="2">&nbsp;</td>
+               </tr>
+               <tr class="row_off">
+                       <td colspan="2">&nbsp;<b>{lang_controller} 
{lang_settings}</b></td>
+               </tr>
+               <tr class="row_on">
+                       <td>{lang_Use_ACL_for_control_areas}.</td>
+                       <td>
+                               <select name="newsettings[acl_at_control_area]">
+                                       <option value="2" 
{selected_acl_at_control_area_2}>{lang_no}</option>
+                                       <option value="1" 
{selected_acl_at_control_area_1}>{lang_yes}</option>
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_off">
+                       <td>{lang_required_actual_hours}.</td>
+                       <td>
+                               <select 
name="newsettings[required_actual_hours]">
+                                       <option value="" 
{selected_required_actual_hours_}>{lang_no}</option>
+                                       <option value="1" 
{selected_required_actual_hours_1}>{lang_yes}</option>
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_on">
+                       <td>Antall planlagte kontroller som skal vises.</td>
+                       <td>
+                               <input type="text" 
name="newsettings[no_of_planned_controls]" 
value="{value_no_of_planned_controls}"/>
+                       </td>
+               </tr>
+               <tr class="row_off">
+                       <td>Antall tildelte kontroller som skal vises</td>
+                       <td>
+                               <input type="text" 
name="newsettings[no_of_assigned_controls]" 
value="{value_no_of_assigned_controls}"/>
+                       </td>
+               </tr>
+               <tr class="row_on">
+                       <td>{lang_home_alternative}</td>
+                       <td>
+                               <select name="newsettings[home_alternative]">
+                                       <option value="" 
{selected_home_alternative_}>{lang_no}</option>
+                                       <option value="1" 
{selected_home_alternative_1}>{lang_yes}</option>
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_off">
+                       <td>{lang_control_mandatory_location}</td>
+                       <td>
+                               <select 
name="newsettings[control_mandatory_location]">
+                                       <option value="" 
{selected_control_mandatory_location_}>{lang_no}</option>
+                                       <option value="1" 
{selected_control_mandatory_location_1}>{lang_yes}</option>
+                               </select>
+                       </td>
+               </tr>
+               <tr class="row_on">
+                       <td>{lang_document_category}:</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[document_cat][]" value="">
+                               <table>
                                        {hook_document_cat}
-                        </table>
-                       </td>
-               </tr>
-
-               <!-- END body -->
-               <!-- BEGIN footer -->
-               <tr class="th">
-                       <td colspan="2">
-                               &nbsp;
-                       </td>
-               </tr>
-               <tr>
-                       <td colspan="2" align="center">
-                               <input type="submit" name="submit" 
value="{lang_submit}">
-                               <input type="submit" name="cancel" 
value="{lang_cancel}">
-                       </td>
-               </tr>
-       </table>
-</form>
-<!-- END footer -->
+                               </table>
+                       </td>
+               </tr>
+
+               <!-- END body -->
+               <!-- BEGIN footer -->
+               <tr class="th">
+                       <td colspan="2">
+                               &nbsp;
+                       </td>
+               </tr>
+               <tr>
+                       <td colspan="2" align="center">
+                               <input type="submit" name="submit" 
value="{lang_submit}">
+                               <input type="submit" name="cancel" 
value="{lang_cancel}">
+                       </td>
+               </tr>
+       </table>
+</form>
+<!-- END footer -->

Modified: branches/Version-2_0-branch/demo/inc/class.sodemo.inc.php
===================================================================
--- branches/Version-2_0-branch/demo/inc/class.sodemo.inc.php   2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/demo/inc/class.sodemo.inc.php   2016-06-06 
12:26:20 UTC (rev 15259)
@@ -60,7 +60,7 @@
                        $this->custom = createObject('property.custom_fields');
 
                        $GLOBALS['phpgw']->acl->set_account_id($this->account);
-                       $this->grants = 
$GLOBALS['phpgw']->acl->get_grants('demo', $this->acl_location);
+                       $this->grants = 
$GLOBALS['phpgw']->acl->get_grants2('demo', $this->acl_location);
                }
 
                function read( $data )
@@ -83,15 +83,36 @@
 
                        if (!$filter)
                        {
-                               if (is_array($this->grants))
+                               $public_user_list = array();
+                               if (is_array($this->grants['accounts']) && 
$this->grants['accounts'])
                                {
-                                       while (list($user) = 
each($this->grants))
+                                       foreach($this->grants['accounts'] as 
$user => $_right)
                                        {
                                                $public_user_list[] = $user;
                                        }
+                                       unset($user);
                                        reset($public_user_list);
-                                       $filtermethod .= " $where ( 
$table.user_id IN(" . implode(',', $public_user_list) . "))";
+                                       $filtermethod .= " $where 
(({$table}.user_id IN(" . implode(',', $public_user_list) . ")";
+                                       $where = 'AND';
                                }
+
+                               $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' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        else if ($filter == 'yours')
                        {
@@ -126,13 +147,19 @@
                                $querymethod = " $where name $this->like 
'%$query%'";
                        }
 
-                       $sql = "SELECT COUNT(phpgw_demo_table.id) as cnt FROM 
$table $filtermethod $querymethod";
+                       $sql = "SELECT COUNT(phpgw_demo_table.id) as cnt FROM 
$table"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.user_id = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " $filtermethod $querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f('cnt');
 
-                       $sql = "SELECT * FROM $table $filtermethod $querymethod 
$ordermethod";
+                       $sql = "SELECT DISTINCT {$table}.* FROM {$table}"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.user_id = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " $filtermethod $querymethod $ordermethod";
 
                        if ($allrows)
                        {
@@ -151,7 +178,6 @@
                                        'id' => $this->db->f('id'),
                                        'name' => $this->db->f('name', true),
                                        'entry_date' => 
$this->db->f('entry_date'),
-                                       'grants' => 
(int)$this->grants[$this->db->f('user_id')]
                                );
                        }
 
@@ -184,15 +210,36 @@
 
                        if (!$filter)
                        {
-                               if (is_array($this->grants))
+                               $public_user_list = array();
+                               if (is_array($this->grants['accounts']) && 
$this->grants['accounts'])
                                {
-                                       while (list($user) = 
each($this->grants))
+                                       foreach($this->grants['accounts'] as 
$user => $_right)
                                        {
                                                $public_user_list[] = $user;
                                        }
+                                       unset($user);
                                        reset($public_user_list);
-                                       $filtermethod .= " $where ( 
$table.user_id IN(" . implode(',', $public_user_list) . "))";
+                                       $filtermethod .= " $where 
(({$table}.user_id IN(" . implode(',', $public_user_list) . ")";
+                                       $where = 'AND';
                                }
+
+                               $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' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        else if ($filter == 'yours')
                        {
@@ -317,7 +364,10 @@
 
                        $this->uicols = $uicols;
 
-                       $sql = "SELECT COUNT(phpgw_demo_table.id) as cnt FROM 
$table $filtermethod $querymethod";
+                       $sql = "SELECT COUNT(phpgw_demo_table.id) as cnt FROM"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.user_id = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " $table $filtermethod $querymethod";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
                        $this->total_records = $this->db->f('cnt');
@@ -327,7 +377,10 @@
                                return array();
                        }
 
-                       $sql = "SELECT * FROM $table $filtermethod $querymethod 
$ordermethod";
+                       $sql = "SELECT DISTINCT {$table}.* FROM {$table}"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.user_id = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " $filtermethod $querymethod $ordermethod";
                        if ($allrows)
                        {
                                $this->db->query($sql, __LINE__, __FILE__);
@@ -382,7 +435,6 @@
                                $values['user_id'] = $this->db->f('user_id');
                                $values['cat_id'] = $this->db->f('category');
                                $values['access'] = $this->db->f('access');
-                               $values['grants'] = 
(int)$this->grants[$this->db->f('user_id')];
 
                                if (isset($values['attributes']) && 
is_array($values['attributes']))
                                {

Modified: branches/Version-2_0-branch/helpdesk/inc/class.sotts.inc.php
===================================================================
--- branches/Version-2_0-branch/helpdesk/inc/class.sotts.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/helpdesk/inc/class.sotts.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -121,28 +121,23 @@
                        $location_code  = isset($data['location_code']) ? 
$data['location_code'] : '';
                        $p_num                  = isset($data['p_num']) ? 
$data['p_num'] : '';
 
-                       $this->grants   = 
$GLOBALS['phpgw']->session->appsession('grants_ticket','helpdesk');
+                       $GLOBALS['phpgw']->acl->set_account_id($this->account);
+                       $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants2('helpdesk','.ticket');
 
-                       if(!$this->grants)
-                       {
-                               
$GLOBALS['phpgw']->acl->set_account_id($this->account);
-                               $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants('helpdesk','.ticket');
-                               
$GLOBALS['phpgw']->session->appsession('grants_ticket','helpdesk',$this->grants);
-                       }
+                       $order_join = "{$this->join} phpgw_accounts ON 
phpgw_helpdesk_tickets.user_id=phpgw_accounts.account_id";
 
                        $result_order_field = '';
                        if ($order)
                        {
                                if( $order == 'assignedto' )
                                {
-                                       $result_order_field = 
',account_lastname';
-                                       $order_join = "LEFT OUTER JOIN 
phpgw_accounts ON phpgw_helpdesk_tickets.assignedto=phpgw_accounts.account_id";
-                                       $order = 'account_lastname';
+//                                     $result_order_field = 
',account_lastname';
+//                                     $order_join = "LEFT OUTER JOIN 
phpgw_accounts ON phpgw_helpdesk_tickets.assignedto=phpgw_accounts.account_id";
+//                                     $order = 'account_lastname';
                                }
                                else if( $order == 'user' )
                                {
                                        $result_order_field = 
',account_lastname';
-                                       $order_join = "LEFT OUTER JOIN 
phpgw_accounts ON phpgw_helpdesk_tickets.user_id=phpgw_accounts.account_id";
                                        $order = 'account_lastname';
                                }
                                else
@@ -157,6 +152,8 @@
                                $ordermethod = ' ORDER BY 
phpgw_helpdesk_tickets.id DESC';
                        }
 
+                       $order_join .= " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)";
+
                        $filtermethod = '';
 
                        $categories = 
$GLOBALS['phpgw']->locations->get_subs('helpdesk', '.ticket.category');
@@ -195,14 +192,36 @@
 
                        if (is_array($this->grants))
                        {
-                               $grants = & $this->grants;
-                               foreach($grants as $user => $right)
+                               $public_user_list = array();
+                               if (is_array($this->grants['accounts']) && 
$this->grants['accounts'])
                                {
-                                       $public_user_list[] = $user;
+                                       foreach($this->grants['accounts'] as 
$user => $_right)
+                                       {
+                                               $public_user_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_user_list);
+                                       $filtermethod .= " $where 
((phpgw_helpdesk_tickets.user_id IN(" . implode(',', $public_user_list) . ")";
+                                       $where = 'AND';
                                }
-                               reset($public_user_list);
-                               $filtermethod .= " $where ( 
phpgw_helpdesk_tickets.user_id IN(" . implode(',',$public_user_list) . "))";
-                               $where= 'AND';
+
+                               $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' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
 
                        if($tenant_id = 
$GLOBALS['phpgw']->session->appsession('tenant_id','helpdesk'))

Modified: branches/Version-2_0-branch/hrm/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-2_0-branch/hrm/inc/class.bocommon.inc.php  2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/hrm/inc/class.bocommon.inc.php  2016-06-06 
12:26:20 UTC (rev 15259)
@@ -71,6 +71,32 @@
                        return ($rights & $required);
                }
 
+               /**
+                *
+                * @param integer $owner_id
+                * @param array $grants
+                * @param integer $required
+                * @return bool
+                */
+               function check_perms2( $owner_id, $grants,  $required )
+               {
+                       if(isset($grants['accounts'][$owner_id]) && 
($grants['accounts'][$owner_id] & $required))
+                       {
+                               return true;
+                       }
+
+                       $equalto = 
$GLOBALS['phpgw']->accounts->membership($owner_id);
+                       foreach($grants['groups'] as $group => $_right)
+                       {
+                               if(isset($equalto[$group]) && ($_right & 
$required))
+                               {
+                                       return true;
+                               }
+                       }
+
+                       return false;
+               }
+
                function create_preferences($app='',$user_id='')
                {
                        return 
$this->socommon->create_preferences($app,$user_id);

Modified: branches/Version-2_0-branch/hrm/inc/class.souser.inc.php
===================================================================
--- branches/Version-2_0-branch/hrm/inc/class.souser.inc.php    2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/hrm/inc/class.souser.inc.php    2016-06-06 
12:26:20 UTC (rev 15259)
@@ -30,7 +30,7 @@
                        $this->join             = & $this->db->join;
                        $this->left_join        = & $this->db->left_join;
                        $GLOBALS['phpgw']->acl->set_account_id($this->account);
-                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('hrm','.user');
+                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants2('hrm','.user');
                }
 
                function read($data)
@@ -54,7 +54,6 @@
                        {
                                $account_info[] = array
                                (
-                                       'grants'                        => 
isset($this->grants[$entry->id]) ? $this->grants[$entry->id] : 0,
                                        'account_firstname'     => 
$entry->firstname,
                                        'account_lastname'      => 
$entry->lastname,
                                        'account_id'            => $entry->id

Modified: branches/Version-2_0-branch/hrm/inc/class.uiuser.inc.php
===================================================================
--- branches/Version-2_0-branch/hrm/inc/class.uiuser.inc.php    2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/hrm/inc/class.uiuser.inc.php    2016-06-06 
12:26:20 UTC (rev 15259)
@@ -76,7 +76,7 @@
                        $content = array();
                        foreach ( $account_info as $entry )
                        {
-                               if($entry['grants'])
+                               
if($this->bocommon->check_perms2($entry['account_id'], $this->grants, 
PHPGW_ACL_READ))
                                {
                                        $link_training                          
= $GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'hrm.uiuser.training', 'user_id'=> $entry['account_id']));
                                        $text_training                          
= lang('training');
@@ -182,9 +182,9 @@
                {
                        $user_id        = phpgw::get_var('user_id', 'int');
 
-                       if (!$this->grants[$user_id])
+                       if (!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_READ))
                        {
-                               $this->bocommon->no_access($links);
+                               phpgw::no_access();
                                return;
                        }
 
@@ -216,13 +216,13 @@
                                        $entry['end_date']      = 
$GLOBALS['phpgw']->common->show_date($entry['end_date'],$dateformat);
                                }
 
-                               
if($this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_EDIT))
+                               if($this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_EDIT))
                                {
                                        $link_edit      = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'hrm.uiuser.edit', 
'user_id'=> $user_id, 'training_id'=> $entry['training_id']));
                                        $text_edit      = lang('edit');
                                        $lang_edit_text = lang('edit training 
item');
                                }
-                               
if($this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_DELETE))
+                               
if($this->bocommon->check_perms2($user_id,$this->grants, PHPGW_ACL_DELETE))
                                {
                                        $link_delete            = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'hrm.uiuser.delete', 
'user_id'=> $user_id, 'training_id'=> $entry['training_id']));
                                        $text_delete            = 
lang('delete');
@@ -320,7 +320,7 @@
                                'user_id'       => $user_id
                        );
 
-                       
if($this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_ADD))
+                       if($this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_ADD))
                        {
                                $add_action     = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 'hrm.uiuser.edit', 
'user_id'=> $user_id));
                                $lang_add       = lang('add');
@@ -388,17 +388,17 @@
 
                        if(!$training_id)
                        {
-                               
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_ADD))
+                               if(!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_ADD))
                                {
-                                       $this->bocommon->no_access($links);
+                                       phpgw::no_access();
                                        return;
                                }
                        }
                        else
                        {
-                               
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_EDIT))
+                               if(!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_EDIT))
                                {
-                                       $this->bocommon->no_access($links);
+                                       phpgw::no_access();
                                        return;
                                }
                        }
@@ -605,9 +605,9 @@
                        $training_id            = phpgw::get_var('training_id', 
'int');
                        $user_id        = phpgw::get_var('user_id', 'int');
 
-                       
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_READ))
+                       if(!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_READ))
                        {
-                               $this->bocommon->no_access($links);
+                               phpgw::no_access();
                                return;
                        }
                        $GLOBALS['phpgw']->xslttpl->add_file(array('user'));
@@ -691,9 +691,9 @@
                        $training_id            = phpgw::get_var('training_id', 
'int');
                        $user_id        = phpgw::get_var('user_id', 'int');
 
-                       
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_DELETE))
+                       if(!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_DELETE))
                        {
-                               $this->bocommon->no_access($links);
+                               phpgw::no_access();
                                return;
                        }
                        $confirm = phpgw::get_var('confirm', 'bool', 'POST');
@@ -734,9 +734,9 @@
                {
                        $user_id        = phpgw::get_var('user_id', 'int');
 
-                       
if(!$this->bocommon->check_perms($this->grants[$user_id], PHPGW_ACL_READ))
+                       if(!$this->bocommon->check_perms2($user_id, 
$this->grants, PHPGW_ACL_READ))
                        {
-                               $this->bocommon->no_access($links);
+                               phpgw::no_access();
                                return;
                        }
 

Modified: branches/Version-2_0-branch/notes/inc/class.sonotes.inc.php
===================================================================
--- branches/Version-2_0-branch/notes/inc/class.sonotes.inc.php 2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/notes/inc/class.sonotes.inc.php 2016-06-06 
12:26:20 UTC (rev 15259)
@@ -41,7 +41,7 @@
                        $this->db               = &$GLOBALS['phpgw']->db;
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $GLOBALS['phpgw']->acl->set_account_id($this->account);
-                       $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants('notes');
+                       $this->grants   = 
$GLOBALS['phpgw']->acl->get_grants2('notes');
                }
 
                function read($data)
@@ -72,20 +72,33 @@
                        if ($filter == 'none')
                        {
                                $filtermethod = ' ( note_owner = ' . 
$this->account;
-                               if (is_array($this->grants))
+                               $public_user_list = array();
+                               $grants = & $this->grants;
+                               if (is_array($grants['accounts']) && 
$grants['accounts'])
                                {
-                                       $grants = $this->grants;
-                                       while (list($user) = each($grants))
+                                       foreach($grants['accounts'] as $user => 
$_right)
                                        {
                                                $public_user_list[] = $user;
                                        }
                                        reset($public_user_list);
-                                       $filtermethod .= " OR 
(note_access='public' AND note_owner IN(" . implode(',',$public_user_list) . 
")))";
+                                       $filtermethod .= " OR 
(note_access='public' AND {$table}.note_owner IN(" . implode(',', 
$public_user_list) . "))";
                                }
-                               else
+                               $public_group_list = array();
+                               if (is_array($grants['groups']) && 
$grants['groups'])
                                {
-                                       $filtermethod .= ' )';
+                                       foreach($grants['groups'] as $user => 
$_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $filtermethod .= " OR 
note_access='public' AND phpgw_group_map.group_id IN(" . implode(',', 
$public_group_list) . "))";
+                                       $where = 'AND';
                                }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        elseif ($filter == 'yours')
                        {
@@ -117,11 +130,20 @@
                                $filtermethod .= " AND note_lastmod > $lastmod 
";
                        }
 
-                       $sql = "SELECT * FROM phpgw_notes WHERE $filtermethod 
$querymethod";
+                               $this->db->query("SELECT count(*) as cnt FROM 
phpgw_notes"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.note_owner = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " {$app_filter} {$filtermethod} 
{$querymethod}", __LINE__, __FILE__);
 
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
+                               $this->db->next_record();
+                               $this->total_records = $this->db->f('cnt');
 
+
+                       $sql = "SELECT DISTINCT phpgw_notes.* FROM phpgw_notes"
+                               . " {$this->join} phpgw_accounts ON ( 
{$table}.note_owner = phpgw_accounts.account_id)"
+                               . " {$this->join} phpgw_group_map ON 
(phpgw_accounts.account_id = phpgw_group_map.account_id)"
+                               . " WHERE $filtermethod $querymethod";
+
                        if($start)
                        {
                                $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
@@ -130,7 +152,6 @@
                        $notes = array();
                        while ($this->db->next_record())
                        {
-                               $ngrants = 
$this->grants[$this->db->f('note_owner')];
                                $id = $this->db->f('note_id');
                                $notes[$id] = array
                                (
@@ -141,7 +162,6 @@
                                        'date'          => 
$GLOBALS['phpgw']->common->show_date($this->db->f('note_date')),
                                        'cat_id'        => 
$this->db->f('note_category'),
                                        'content'       => 
$this->db->f('note_content', true),
-                                       'grants'        => $ngrants
                                );
                        }
                        return $notes;

Modified: branches/Version-2_0-branch/notes/inc/class.uinotes.inc.php
===================================================================
--- branches/Version-2_0-branch/notes/inc/class.uinotes.inc.php 2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/notes/inc/class.uinotes.inc.php 2016-06-06 
12:26:20 UTC (rev 15259)
@@ -67,8 +67,8 @@
                        $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
 
                        $GLOBALS['phpgw']->acl->set_account_id($this->account);
-                       $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants('notes');
-                       $this->grants[$this->account] = PHPGW_ACL_READ + 
PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
+//                     $this->grants           = 
$GLOBALS['phpgw']->acl->get_grants2('notes');
+//                     $this->grants['accounts'][$this->account] = 
PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE;
                        $this->bonotes          = 
CreateObject('notes.bonotes',true);
 
                        $this->start            = $this->bonotes->start;

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.acl.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.acl.inc.php  2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.acl.inc.php  2016-06-06 
12:26:20 UTC (rev 15259)
@@ -1347,6 +1347,56 @@
                        return $grant_rights;
                }
                /**
+               * Get a list of users that have grants rights to their records 
at a location within an app
+               *
+               * @param string $app      Application name
+               *                               if emptry string, value of 
$GLOBALS['phpgw_info']['flags']['currentapp'] is used
+               * @param string $location location within application
+               *
+               * @return array Array with account ids and corresponding rights
+               */
+               public function get_grants2($app = '', $location = '')
+               {
+                       $grant_rights = phpgwapi_cache::session_get('phpgwapi', 
"get_grants2_{$app}_{$location}");
+                       if ( !is_null($grant_rights) )
+                       {
+                               return $grant_rights; // nothing more to do
+                       }
+
+                       $grant_rights   = $this->get_grants_type2($app, 
$location, 0);
+                       $grant_mask             = $this->get_grants_type2($app, 
$location, 1);
+                       if ( is_array($grant_mask['accounts']) )
+                       {
+                               foreach ( $grant_mask['accounts'] as $user_id 
=> $mask )
+                               {
+                                       if ( 
$grant_rights['accounts'][$user_id] )
+                                       {
+                                               
$grant_rights['accounts'][$user_id] &= (~ $mask);
+                                               if ( 
$grant_rights['accounts'][$user_id] <= 0 )
+                                               {
+                                                       
unset($grant_rights['accounts'][$user_id]);
+                                               }
+                                       }
+                               }
+                       }
+                       if ( is_array($grant_mask['groups']) )
+                       {
+                               foreach ( $grant_mask['groups'] as $user_id => 
$mask )
+                               {
+                                       if ( $grant_rights['groups'][$user_id] )
+                                       {
+                                               
$grant_rights['groups'][$user_id] &= (~ $mask);
+                                               if ( 
$grant_rights['groups'][$user_id] <= 0 )
+                                               {
+                                                       
unset($grant_rights['groups'][$user_id]);
+                                               }
+                                       }
+                               }
+                       }
+                       phpgwapi_cache::session_set('phpgwapi', 
"get_grants2_{$app}_{$location}", $grant_rights);
+                       return $grant_rights;
+               }
+               /**
                * Get application specific account based granted rights list
                *
                * @param string  $app      Application name
@@ -1358,6 +1408,143 @@
                *
                * @internal FIXME this should be simplified - if it is actually 
used
                */
+               public function get_grants_type2($app = '', $location = '', 
$mask = 0)
+               {
+                       $accounts = array();
+                       $groups = array();
+                       $grants =array(
+                               'accounts' => $accounts,
+                               'groups' => $groups
+                       );
+                       if(!$this->_account_id)
+                       {
+                               return array(
+                                               'accounts' => $accounts,
+                                               'groups' => $groups
+                                       );
+                       }
+
+                       if ( !$app )
+                       {
+                               $app = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       }
+
+                       $at_location = '';
+                       if ( $location )
+                       {
+                               $location = 
$this->_db->db_addslashes($location);
+                               $at_location = " AND phpgw_locations.name = 
'$location'";
+                       }
+
+                       $accts =& $GLOBALS['phpgw']->accounts;
+                       $acct_ids = 
array_keys($accts->membership($this->_account_id));
+                       $acct_ids[] = $this->_account_id;
+
+                       $rights = 0;
+
+                       $ids = implode(',', $acct_ids);
+                       $sql = 'SELECT acl_account, acl_grantor, acl_rights'
+                               . ' FROM phpgw_acl'
+                               . " {$this->_join} phpgw_locations ON 
phpgw_acl.location_id = phpgw_locations.location_id"
+                               . " {$this->_join} phpgw_applications ON 
phpgw_applications.app_id = phpgw_locations.app_id"
+                               . " WHERE phpgw_applications.app_name = '$app' 
$at_location"
+                                       . " AND acl_grantor > 0 AND acl_type = 
$mask"
+                                       . " AND acl_account IN ($ids)";
+
+                       $this->_db->query($sql, __LINE__, __FILE__);
+                       if ( $this->_db->num_rows() == 0 && $mask == 0  && 
isset($GLOBALS['phpgw_info']['user']['account_id']))
+                       {
+                               //return 
array($GLOBALS['phpgw_info']['user']['account_id'] => 31);
+                               return array(
+                                       'accounts' => 
array($GLOBALS['phpgw_info']['user']['account_id'] => 31),
+                                       'groups' => $groups
+                               );
+                       }
+
+                       $records = array();
+                       while ($this->_db->next_record())
+                       {
+                               $records[] = array
+                               (
+                                       'account'       => 
$this->_db->f('acl_account'),
+                                       'grantor'       => 
$this->_db->f('acl_grantor'),
+                                       'rights'        => 
$this->_db->f('acl_rights')
+                               );
+                       }
+
+                       foreach ($records as $record )
+                       {
+                               $grantor = $record['grantor'];
+                               $rights = $record['rights'];
+
+                               if( $grantor > 0 )
+                               {
+                                       if (!isset($accounts[$grantor]))
+                                       {
+                                               $is_group[$grantor] = 
$accts->get_type($grantor) == phpgwapi_account::TYPE_GROUP;
+                                               if ( !$is_group[$grantor] )
+                                               {
+                                                       $accounts[$grantor] = 
array($grantor);
+                                               }
+                                               else
+                                               {
+                                                       $groups[$grantor] = 
array($grantor);//$GLOBALS['phpgw']->accounts->get_members($grantor);
+                                               }
+                                       }
+
+                                       if ( $is_group[$grantor] )
+                                       {
+                                               // Don't allow to override 
private!
+                                               $rights &= (~ 
PHPGW_ACL_PRIVATE);
+                                               if ( 
!isset($grants['groups'][$grantor]) )
+                                               {
+                                                       
$grants['groups'][$grantor] = 0;
+                                               }
+
+                                               $grants['groups'][$grantor] |= 
$rights;
+                                               if ( !!($rights & self::READ) )
+                                               {
+                                                       
$grants['groups'][$grantor] |= self::READ;
+                                               }
+                                       }
+
+                                       foreach ( $accounts[$grantor] as 
$grantors )
+                                       {
+                                               if ( 
!isset($grants['accounts'][$grantors]) )
+                                               {
+                                                       
$grants['accounts'][$grantors] = 0;
+                                               }
+                                               $grants['accounts'][$grantors] 
|= $rights;
+                                       }
+                               }
+                       }
+
+                       if ( $mask == 0 && 
isset($GLOBALS['phpgw_info']['user']['account_id']))
+                       {
+                               
$grants['accounts'][$GLOBALS['phpgw_info']['user']['account_id']] = 31;
+                       }
+                       else
+                       {
+                               if ( 
isset($GLOBALS['phpgw_info']['user']['account_id']) && 
isset($grants['accounts'][$GLOBALS['phpgw_info']['user']['account_id']]) )
+                               {
+                                       unset 
($grants['accounts'][$GLOBALS['phpgw_info']['user']['account_id']]);
+                               }
+                       }
+
+                       return $grants;
+               }
+               /**
+               * Get application specific account based granted rights list
+               *
+               * @param string  $app      Application name
+               *                               if emptry string, value of 
$GLOBALS['phpgw_info']['flags']['currentapp'] is used
+               * @param string  $location location within application
+               * @param integer $mask     mask or right (1 means mask , 0 
means right) to check against
+               *
+               * @return array Associative array with granted access rights 
for accounts
+               *
+               * @internal FIXME this should be simplified - if it is actually 
used
+               */
                public function get_grants_type($app = '', $location = '', 
$mask = 0)
                {
                        $grants = array();

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.jqcal.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.jqcal.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.jqcal.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -80,6 +80,10 @@
                                        buttonImage: "{$this->img_cal}",
                                        buttonText: "{$this->lang_select_date}",
                                        buttonImageOnly: true
+                               }).keyup(function(e) {
+                                       if(e.keyCode == 8 || e.keyCode == 46) {
+                                               $.datepicker._clearDate(this);
+                                       }
                                });
                            $('#ui-datepicker-div').draggable();
                        });

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -219,10 +219,12 @@
                        if ($errorMessagePosition_id)
                        {
                                $errorMessagePosition = 
"$('#{$errorMessagePosition_id}')";
+                               $scrollToTopOnError = 'false';
                        }
                        else
                        {
                                $errorMessagePosition = "'top'";
+                               $scrollToTopOnError = 'true';
                        }
 
                        $translation = '';
@@ -332,7 +334,9 @@
                                        form: '#{$form_id}',
                                        validateOnBlur : false,
                                        scrollToTopOnError : false,
-                                       errorMessagePosition : 
{$errorMessagePosition}
+                                       validateHiddenInputs: true,
+                                       errorMessagePosition : 
{$errorMessagePosition},
+                                       scrollToTopOnError: 
{$scrollToTopOnError}
                                });
                        });
 JS;

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.phpgw.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.phpgw.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.phpgw.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -604,12 +604,19 @@
                         */
                        public static function no_access($appname = '', 
$message = '')
                        {
-                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
false;
                                $message = $message ? $message : lang('no 
access');
-                               $appname = $appname ? $appname : 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                               phpgwapi_cache::message_set($message, 'error');
-                               $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($appname) . '::' . lang('No access');
-                               $GLOBALS['phpgw']->common->phpgw_header(true);
+                               if (phpgw::get_var('phpgw_return_as') == 'json')
+                               {
+                                       echo $message;
+                               }
+                               else
+                               {
+                                       phpgwapi_cache::message_set($message, 
'error');
+                                       $appname = $appname ? $appname : 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                                       
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($appname) . '::' . 
lang('No access');
+                                       
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+                                       
$GLOBALS['phpgw']->common->phpgw_header(true);
+                               }
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
                }

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php      
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.vfs_sql.inc.php      
2016-06-06 12:26:20 UTC (rev 15259)
@@ -1115,6 +1115,94 @@
                        }
                }
 
+               function touch2($data,$p = array())
+               {
+                       if(!is_array($data))
+                       {
+                               $data = array();
+                       }
+
+                       $default_values = array
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT)
+                       );
+
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
+
+                       $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+
+                       if(!$p)
+                       {
+                               $p = $this->path_parts(array(
+                                               'string'        => 
$data['string'],
+                                               'relatives'     => 
array($data['relatives'][0])
+                                       )
+                               );
+                       }
+
+                       umask(000);
+
+                       if(!$this->acl_check(array(
+                                       'string'        => $p->fake_full_path,
+                                       'relatives'     => array($p->mask),
+                                       'operation'     => PHPGW_ACL_ADD
+                               ))
+                       )
+                       {
+                               return false;
+                       }
+
+                       $value_set = array
+                       (
+                               'owner_id'      => $this->working_id,
+                               'directory'     => $p->fake_leading_dirs_clean,
+                               'name'          => $p->fake_name_clean
+                       );
+
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$GLOBALS['phpgw']->db->validate_insert(array_values($value_set));
+                       $sql = "INSERT INTO phpgw_vfs ({$cols}) VALUES 
({$values})";
+
+                       $query = $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
+                       
+                       $last_insert_id = 
$GLOBALS['phpgw']->db->get_last_insert_id('phpgw_vfs', 'file_id');
+                       
+                       $this->set_attributes(array(
+                               'string'                => $p->fake_full_path,
+                               'relatives'             => array($p->mask),
+                               'attributes'    => array(
+                                                       'createdby_id'  => 
$account_id,
+                                                       'created'               
=> $this->now,
+                                                       'size'                  
=> 0,
+                                                       'deleteable'    => 'Y',
+                                                       'app'                   
=> $currentapp
+                                               )
+                               )
+                       );
+                       $this->correct_attributes(array(
+                                       'string'        => $p->fake_full_path,
+                                       'relatives'     => array($p->mask)
+                               )
+                       );
+                       
+                       $this->add_journal(array(
+                                       'string'        => $p->fake_full_path,
+                                       'relatives'     => array($p->mask),
+                                       'operation'     => VFS_OPERATION_CREATED
+                               )
+                       );
+
+                       if($query)
+                       {
+                               return $last_insert_id;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+               
                /*
                 * See vfs_shared
                 */
@@ -1302,7 +1390,7 @@
                                                        'relatives'     => 
array($t->mask)
                                                )
                                        );
-
+                                       
                                        $set_attributes_array = array
                                        (
                                                'createdby_id'  => $account_id,
@@ -1684,6 +1772,367 @@
 
                        return true;
                }
+               
+
+               function cp3($data)
+               {
+                       if(!$data['from'])
+                       {
+                               throw new Exception('nothing to copy from');
+                       }
+
+                       if(!is_array($data))
+                       {
+                               $data = array();
+                       }
+
+                       $default_values = array
+                       (
+                               'relatives'     => array(RELATIVE_CURRENT, 
RELATIVE_CURRENT)
+                       );
+
+                       $data = array_merge($this->default_values($data, 
$default_values), $data);
+
+                       $account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+
+                       $f = $this->path_parts(array(
+                                       'string'        => $data['from'],
+                                       'relatives'     => 
array($data['relatives'][0])
+                               )
+                       );
+
+                       $t = $this->path_parts(array(
+                                       'string'        => $data['to'],
+                                       'relatives'     => 
array($data['relatives'][1])
+                               )
+                       );
+
+                       if(!$this->fileoperation->check_target_directory($t))
+                       {
+                               $GLOBALS['phpgw']->log->error(array(
+                                       'text' => 'vfs::cp() : missing target 
directory %1',
+                                       'p1'   => $t->real_leading_dirs,
+                                       'p2'     => '',
+                                       'line' => __LINE__,
+                                       'file' => __FILE__
+                               ));
+
+                               return false;
+                       }
+
+                       if(!$this->acl_check(array(
+                                       'string'        => $f->fake_full_path,
+                                       'relatives'     => array($f->mask),
+                                       'operation'     => PHPGW_ACL_READ
+                               ))
+                       )
+                       {
+                               return false;
+                       }
+
+                       if($this->file_exists(array(
+                                       'string'        => $t->fake_full_path,
+                                       'relatives'     => array($t->mask)
+                               ))
+                       )
+                       {
+                               if(!$this->acl_check(array(
+                                               'string'        => 
$t->fake_full_path,
+                                               'relatives'     => 
array($t->mask),
+                                               'operation'     => 
PHPGW_ACL_EDIT
+                                       ))
+                               )
+                               {
+                                       return false;
+                               }
+                       }
+                       else
+                       {
+                               if(!$this->acl_check(array(
+                                               'string'        => 
$t->fake_full_path,
+                                               'relatives'     => 
array($t->mask),
+                                               'operation'     => PHPGW_ACL_ADD
+                                       ))
+                               )
+                               {
+                                       return false;
+                               }
+
+                       }
+
+                       umask(000);
+
+                       if($this->file_type(array(
+                                       'string'        => $f->fake_full_path,
+                                       'relatives'     => array($f->mask)
+                               )) != 'Directory'
+                       )
+                       {
+                               if($this->file_actions)
+                               {
+//                                     if(!$this->fileoperation->touch($data, 
$t) && !$this->fileoperation->copy($f, $t))
+                                       
if(isset($this->fileoperation->external_ref) && 
$this->fileoperation->external_ref)
+                                       {
+                                               $_document_id = 
$this->fileoperation->touch($data, $t);
+                                       }
+
+                                       if(!$this->fileoperation->copy($f, $t, 
$_document_id))
+                                       {
+                                               return false;
+                                       }
+
+                                       $size = 
$this->fileoperation->filesize($f);
+                               }
+                               else
+                               {
+                                       $content = $this->read(array(
+                                                       'string'        => 
$f->fake_full_path,
+                                                       'relatives'     => 
array($f->mask)
+                                               )
+                                       );
+
+                                       $size = strlen($content);
+                               }
+
+                               if($t->outside)
+                               {
+                                       return true;
+                               }
+
+                               $ls_array = $this->ls(array(
+                                               'string'        => 
$f->real_full_path, // Sigurd: seems to work better with real - old: 'string'   
     => $f->fake_full_path,
+                                               'relatives'     => 
array($f->mask),
+                                               'checksubdirs'  => false,
+                                               'mime_type'     => false,
+                                               'nofiles'       => true
+                                       )
+                               );
+                               $record = $ls_array[0];
+
+                               if($data['id'])
+                               {
+                                       $file_info = 
$this->get_info($data['id']);
+                                       $old_file = 
"{$file_info['directory']}/{$file_info['name']}";
+                               
+                                       $p = $this->path_parts(array(
+                                                       'string'        => 
$old_file,
+                                                       'relatives'     => 
array($data['relatives'][0])
+                                               )
+                                       );
+
+                                       if(!$this->acl_check(array(
+                                                       'string'        => 
$p->fake_full_path,
+                                                       'relatives'     => 
array($p->mask),
+                                                       'operation'     => 
PHPGW_ACL_DELETE
+                                               ))
+                                       )
+                                       {
+                                               return false;
+                                       }
+                       
+                                       if(!$this->file_exists(array(
+                                                       'string'        => 
$old_file,
+                                                       'relatives'     => 
array($data['relatives'][0])
+                                               ))
+                                       )
+                                       {
+                                               if($this->file_actions)
+                                               {
+                                                       
$this->fileoperation->unlink($p);
+                                               }
+                                       }
+                                       
+                                       $file_name = $t->fake_leading_dirs 
.'/'.$data['id'].'_#' .$t->fake_name_clean;
+                                       $t2 = $this->path_parts(array(
+                                                       'string'        => 
$file_name,
+                                                       'relatives'     => 
array($data['relatives'][1])
+                                               )
+                                       );      
+                                                       
+                                       $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET 
owner_id='{$this->working_id}',"
+                                       . " 
directory='{$t2->fake_leading_dirs_clean}',"
+                                       . " name='{$t2->fake_name_clean}'"
+                                       . " WHERE 
owner_id='{$this->working_id}' AND file_id='{$data['id']}'" . 
$this->extra_sql(VFS_SQL_UPDATE), __LINE__, __FILE__);
+                                       
+                                       $t = $t2;
+                                       
+                                       $set_attributes_array = array
+                                       (
+                                               'createdby_id'  => $account_id,
+                                               'created'               => 
$this->now,
+                                               'size'                  => 
$size,
+                                               'mime_type'             => 
$record['mime_type'],
+                                               'deleteable'    => 
$record['deleteable'],
+                                               'comment'               => 
$record['comment'],
+                                               'app'                   => 
$record['app']
+                                       );
+
+                                       if(!$this->file_actions)
+                                       {
+                                               
$set_attributes_array['content'] = $content;
+                                       }
+
+                                       $this->set_attributes(array(
+                                               'string'        => 
$t->fake_full_path,
+                                               'relatives'     => 
array($t->mask),
+                                               'attributes'    => 
$set_attributes_array
+                                               )
+                                       );
+
+                                       $this->add_journal(array(
+                                                       'string'        => 
$t->fake_full_path,
+                                                       'relatives'     => 
array($t->mask),
+                                                       'operation'     => 
VFS_OPERATION_EDITED
+                                               )
+                                       );
+                                       $file_id = $data['id'];
+                               }
+                               else
+                               {
+                                       $file_id = $this->touch2(array(
+                                                       'string'        => 
$t->fake_full_path,
+                                                       'relatives'     => 
array($t->mask)
+                                               )
+                                       );
+                                       
+                                       if ($file_id)
+                                       {
+                                               if($this->file_actions)
+                                               {
+                                                       $new_name = 
$t->fake_leading_dirs .'/'.$file_id.'_#' .$t->fake_name_clean;
+
+                                                       $t2 = 
$this->path_parts(array(
+                                                                       
'string'        => $new_name,
+                                                                       
'relatives'     => array($data['relatives'][1])
+                                                               )
+                                                       );                      
                        
+
+                                                       $rr = 
$this->fileoperation->rename($t, $t2);
+
+                                                       if ($rr)
+                                                       {
+                                                               $query = 
$GLOBALS['phpgw']->db->query("UPDATE phpgw_vfs SET 
owner_id='{$this->working_id}',"
+                                                               . " 
directory='{$t2->fake_leading_dirs_clean}',"
+                                                               . " 
name='{$t2->fake_name_clean}'"
+                                                               . " WHERE 
owner_id='{$this->working_id}' AND directory='{$t->fake_leading_dirs_clean}'"
+                                                               . " AND 
name='{$t->fake_name_clean}'", __LINE__, __FILE__);     
+
+                                                               $t = $t2;
+                                                       }
+                                               }
+
+                                               $set_attributes_array = array
+                                               (
+                                                       'createdby_id'  => 
$account_id,
+                                                       'created'               
=> $this->now,
+                                                       'size'                  
=> $size,
+                                                       'mime_type'             
=> $record['mime_type'],
+                                                       'deleteable'    => 
$record['deleteable'],
+                                                       'comment'               
=> $record['comment'],
+                                                       'app'                   
=> $record['app']
+                                               );
+
+                                               if(!$this->file_actions)
+                                               {
+                                                       
$set_attributes_array['content'] = $content;
+                                               }
+
+                                               $this->set_attributes(array(
+                                                               'string'        
=> $t->fake_full_path,
+                                                               'relatives'     
=> array($t->mask),
+                                                               'attributes'    
=> $set_attributes_array
+                                                       )
+                                               );                              
        
+                                       }
+                               }
+                               $this->correct_attributes(array(
+                                               'string'        => 
$t->fake_full_path,
+                                               'relatives'     => 
array($t->mask)
+                                       )
+                               );
+                               
+                               if ($file_id)
+                               {
+                                       return $file_id;
+                               }
+                               else {
+                                       return false;
+                               }                               
+                       }
+                       else    /* It's a directory */
+                       {
+                               /* First, make the initial directory */
+                               if($this->mkdir(array(
+                                               'string'        => $data['to'],
+                                               'relatives'     => 
array($data['relatives'][1])
+                                       )) === false
+                               )
+                               {
+                                       return false;
+                               }
+
+                               /* Next, we create all the directories below 
the initial directory */
+                               $ls = $this->ls(array(
+                                               'string'        => 
$f->fake_full_path,
+                                               'relatives'     => 
array($f->mask),
+                                               'checksubdirs'  => true,
+                                               'mime_type'     => 'Directory'
+                                       )
+                               );
+
+                               while(list($num, $entry) = each($ls))
+                               {
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+
+                                       if($this->mkdir(array(
+                                                       'string'        => 
"{$newdir}/{$entry['name']}",
+                                                       'relatives'     => 
array($t->mask)
+                                               )) === false
+                                       )
+                                       {
+                                               return false;
+                                       }
+                               }
+
+                               /* Lastly, we copy the files over */
+                               $ls = $this->ls(array(
+                                               'string'        => 
$f->fake_full_path,
+                                               'relatives'     => 
array($f->mask)
+                                       )
+                               );
+
+                               while(list($num, $entry) = each($ls))
+                               {
+                                       if($entry['mime_type'] == 'Directory')
+                                       {
+                                               continue;
+                                       }
+
+                                       $newdir = preg_replace("/^" . 
str_replace('/', '\/', $f->fake_full_path). "/", $t->fake_full_path, 
$entry['directory']);
+                                       $this->cp(array(
+                                                       'from'  => 
"{$entry[directory]}/{$entry[name]}",
+                                                       'to'    => 
"{$newdir}/{$entry[name]}",
+                                                       'relatives'     => 
array($f->mask, $t->mask)
+                                               )
+                                       );
+                               }
+                       }
+
+                       if(!$f->outside)
+                       {
+                               $this->add_journal(array(
+                                               'string'        => 
$f->fake_full_path,
+                                               'relatives'     => 
array($f->mask),
+                                               'operation'     => 
VFS_OPERATION_COPIED,
+                                               'state_one'     => NULL,
+                                               'state_two'     => 
$t->fake_full_path
+                                       )
+                               );
+                       }
+
+                       return true;
+               }
+               
                /*
                 * See vfs_shared
                 */

Modified: branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
===================================================================
--- branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-06-06 
12:26:20 UTC (rev 15259)
@@ -347,9 +347,9 @@
 
        if (buttons_def)
        {
-               var sDom_def = 'B<"clear">lfrtip';
-//             var sDom_def = 'Bfrtlip';
-               var sDom_def = '<lfB<t>ip>'
+//             var sDom_def = 'B<"clear">lfrtip';
+               var sDom_def = 'Bfrtlip';
+//             var sDom_def = '<lfB<t>ip>'
                if (singleSelect == true)
                {
                        select = true;
@@ -370,7 +370,7 @@
        var oTable = $("#" + container).dataTable({
                paginate: disablePagination ? false : true,
                filter: disableFilter ? false : true,
-               info: disableFilter ? false : true,
+               info: disablePagination ? false : true,
                order: order,
                processing: true,
                serverSide: serverSide_def,
@@ -380,7 +380,15 @@
                data: data,
                ajax: ajax_def,
                fnServerParams: function (aoData)
-               {
+               {                       
+                       if (!$.isEmptyObject(eval('paramsTable' + 
container.substr(container.length -1, 1))))
+                       {       
+                               $.each(eval('paramsTable' + 
container.substr(container.length -1, 1)), function (k, v)
+                               {
+                                       aoData[k] = v;
+                               });
+                       }
+
                        if (typeof (aoData.order) != 'undefined')
                        {
                                var column = aoData.order[0].column;
@@ -599,11 +607,25 @@
 };
 
 
-JqueryPortico.autocompleteHelper = function (baseUrl, field, hidden, 
container, label_attr)
+JqueryPortico.autocompleteHelper = function (baseUrl, field, hidden, 
container, label_attr, show_id, requestGenerator)
 {
+       show_id = show_id ? true : false;
+       requestGenerator = requestGenerator || false;
        label_attr = (label_attr) ? label_attr : 'name';
        $(document).ready(function ()
        {
+               if(requestGenerator)
+               {
+                       try
+                       {
+                               baseUrl = window[requestGenerator](baseUrl);
+                       }
+                       catch(err)
+                       {
+
+                       }
+               }
+
                $("#" + field).autocomplete({
                        source: function (request, response)
                        {
@@ -629,8 +651,17 @@
                                                }
                                                response($.map(data_t, function 
(item)
                                                {
+                                                       if(show_id)
+                                                       {
+                                                               label = item.id 
+ ' ' + item[label_attr];                                       
+                                                       }
+                                                       else
+                                                       {
+                                                               label = 
item[label_attr];
+                                                       }
+
                                                        return {
-                                                               label: 
item[label_attr],
+                                                               label: label,
                                                                value: item.id
                                                        };
                                                }));
@@ -1360,6 +1391,8 @@
                                                        else
                                                        {
                                                                
tableBodyTrTdText = "free";
+                                                               classes += " 
free";
+                                                               
tableBodyTrTd.setAttribute('class', classes);
                                                                if 
(vc['formatter'] == "frontendScheduleDateColumn")
                                                                {
                                                                        
tableBodyTrTd.addEventListener('click', function ()

Modified: branches/Version-2_0-branch/phpgwapi/setup/phpgw_en.lang
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/phpgw_en.lang    2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/setup/phpgw_en.lang    2016-06-06 
12:26:20 UTC (rev 15259)
@@ -550,4 +550,12 @@
 zambia common  en      ZAMBIA
 zimbabwe       common  en      ZIMBABWE
 browser not supported  common  en      The browser seems to not support HTML5
-no access      common  en      No Access
\ No newline at end of file
+no access      common  en      No Access
+No data available in table     common  en      No data available in table
+Showing _START_ to _END_ of _TOTAL_ entries    common  en      Showing _START_ 
to _END_ of _TOTAL_ entries
+Showing 0 to 0 of 0 entries    common  en      Showing 0 to 0 of 0 entries
+filtered from _MAX_ total entries      common  en      filtered from _MAX_ 
total entries
+Show _MENU_ entries    common  en      Show _MENU_ entries
+Loading...     common  en      Loading...
+Processing...  common  en      Processing...
+No matching records found      common  en      No matching records found

Modified: branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php    2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php    2016-06-06 
12:26:20 UTC (rev 15259)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.550';
+       $setup_info['phpgwapi']['version']   = '0.9.17.551';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '2.0';
        $setup_info['phpgwapi']['enable']    = 3;

Modified: branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php   
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -301,8 +301,7 @@
                'phpgw_vfs_filedata' => array(
                        'fd' => array(
                                'file_id' => array('type' => 'int','precision' 
=> '4','nullable' => False),
-                               'location_id' => array('type' => 
'int','precision' => '4','nullable' => False),
-                               'metadata' => array('type' => 'xml','nullable' 
=> False),
+                               'metadata' => array('type' => 
'jsonb','nullable' => False),
                        ),
                        'pk' => array('file_id'),
                        'fk' => array('phpgw_vfs' => array('file_id' => 
'file_id')),
@@ -311,7 +310,7 @@
                ),
                'phpgw_vfs_file_relation' => array(
                        'fd' => array(
-                               'relation_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'relation_id'           => array('type' => 
'auto','nullable' => False),
                                'file_id'                       => array('type' 
=> 'int','precision' => '4','nullable' => False),
                                'location_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
                                'location_item_id'      => array('type' => 
'int','precision' => '4','nullable' => False),

Modified: branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -3359,3 +3359,42 @@
                        return $GLOBALS['setup_info']['phpgwapi']['currentver'];
                }
        }
+
+       $test[] = '0.9.17.550';
+       /**
+       * Add table for file relation to multiple items
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_550()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $metadata = 
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('phpgw_vfs_filedata');
+               if(isset($metadata['location_id']))
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_vfs_filedata',null,'location_id');
+                       
$GLOBALS['phpgw_setup']->oProc->DropColumn('phpgw_vfs_filedata',null,'metadata');
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_vfs_filedata', 'metadata', 
array(
+                               'type' => 'jsonb',
+                               'nullable' => true
+                               )
+                       );
+
+                       $GLOBALS['phpgw_setup']->oProc->query("CREATE SEQUENCE 
public.seq_phpgw_vfs_file_relation"
+                               . " INCREMENT 1"
+                               . " MINVALUE 1"
+                               . " MAXVALUE 9223372036854775807"
+                               . " START 1"
+                               . " CACHE 1",__LINE__,__FILE__);
+
+                       $GLOBALS['phpgw_setup']->oProc->query("ALTER TABLE 
public.phpgw_vfs_file_relation"
+                               . " ALTER COLUMN relation_id SET DEFAULT 
nextval('seq_phpgw_vfs_file_relation'::regclass)",__LINE__,__FILE__);
+
+               }
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.551';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -22,12 +22,13 @@
        <xsl:param name="tabletools" />
        <xsl:param name="config" />
        <xsl:param name="data" />
+       <xsl:param name="separator" select="'_'" />
        
        <xsl:variable name="num">
-               <xsl:number count="*"/>
+               <xsl:number value="substring-after($container, $separator)"/>
        </xsl:variable>
        
-       <div id='message{($num - 1)}' class='message'/>
+       <div id='message{$num}' class='message'/>
        
        <table id="{$container}" class="display cell-border compact responsive 
no-wrap" width="100%">
                <thead>
@@ -73,11 +74,11 @@
        
        <script>
                
-       var oTable<xsl:number value="($num - 1)"/> = null;
+       var oTable<xsl:number value="$num"/> = null;
                
        <xsl:choose>
                        <xsl:when test="$tabletools">
-                                       JqueryPortico.buttons<xsl:number 
value="($num - 1)"/> =         {
+                                       JqueryPortico.buttons<xsl:number 
value="$num"/> =       {
                                                        buttons: 
                                                                [
                                                                        
<xsl:for-each select="$tabletools">
@@ -86,7 +87,7 @@
                                                                                
                {
                                                                                
                        text: "<xsl:value-of select="php:function('lang', 
'select all')"/>",
                                                                                
                        action: function () {
-                                                                               
                                var api = oTable<xsl:number value="($num - 
1)"/>.api();
+                                                                               
                                var api = oTable<xsl:number 
value="$num"/>.api();
                                                                                
                                api.rows().select();
                                                                                
                                $(".mychecks").each(function()
                                                                                
                                {
@@ -105,7 +106,7 @@
                                                                                
                {
                                                                                
                        text: "<xsl:value-of select="php:function('lang', 
'select none')"/>",
                                                                                
                        action: function () {
-                                                                               
                                var api = oTable<xsl:number value="($num - 
1)"/>.api();
+                                                                               
                                var api = oTable<xsl:number 
value="$num"/>.api();
                                                                                
                                api.rows().deselect();
                                                                                
                                $(".mychecks").each(function()
                                                                                
                                {
@@ -122,7 +123,7 @@
                                                                                
                        sUrl: '<xsl:value-of select="download"/>',
                                                                                
                        action: function (e, dt, node, config) {
                                                                                
                          var sUrl = config.sUrl;
-                                                                               
                          var addtional_filterdata = oTable<xsl:number 
value="($num - 1)"/>.dataTableSettings[0]['ajax']['data'];
+                                                                               
                          var addtional_filterdata = oTable<xsl:number 
value="$num"/>.dataTableSettings[0]['ajax']['data'];
                                                                                
                        <![CDATA[
                                                                                
                                var oParams = {};
                                                                                
                                oParams.length = -1;
@@ -184,7 +185,7 @@
                                                                                
                        </xsl:choose>
                                                                                
                        action: function (e, dt, node, config) {
                                                                                
                                                        var receiptmsg = [];
-                                                                               
                                                        var selected = 
JqueryPortico.fnGetSelected(oTable<xsl:number value="($num - 1)"/>);
+                                                                               
                                                        var selected = 
JqueryPortico.fnGetSelected(oTable<xsl:number value="$num"/>);
                                                                                
                                                        var numSelected =       
selected.length;
 
                                                                                
                                                        if (numSelected ==0){
@@ -214,7 +215,7 @@
                                                                                
                                                        for (; n &lt; 
numSelected; ) {
 
                                                                                
                                //                              
console.log(selected[n]);
-                                                                               
                                                                var aData = 
oTable<xsl:number value="($num - 1)"/>.fnGetData( selected[n] ); //complete 
dataset from json returned from server
+                                                                               
                                                                var aData = 
oTable<xsl:number value="$num"/>.fnGetData( selected[n] ); //complete dataset 
from json returned from server
                                                                                
                                //                              
console.log(aData);
 
                                                                                
                                                                //delete stuff 
comes here
@@ -236,16 +237,16 @@
                                                                                
                                                                {               
                                                                                
                                                                                
action += "&amp;confirm=yes&amp;phpgw_return_as=json";
                                                                                
                                                                                
JqueryPortico.execute_ajax(action, function(result){
-                                                                               
                                                                                
        document.getElementById("message<xsl:number value="($num - 
1)"/>").innerHTML += '<br/>' + result;
-                                                                               
                                                                                
        oTable<xsl:number value="($num - 1)"/>.fnDraw();
+                                                                               
                                                                                
        document.getElementById("message<xsl:number value="$num"/>").innerHTML 
+= '<br/>' + result;
+                                                                               
                                                                                
        oTable<xsl:number value="$num"/>.fnDraw();
                                                                                
                                                                                
});                                                                             
                                                                        
                                                                                
                                                                }
                                                                                
                                                                else if (target 
== 'ajax')
                                                                                
                                                                {
                                                                                
                                                                                
action += "&amp;phpgw_return_as=json";
                                                                                
                                                                                
JqueryPortico.execute_ajax(action, function(result){
-                                                                               
                                                                                
        document.getElementById("message<xsl:number value="($num - 
1)"/>").innerHTML += '<br/>' + result;
-                                                                               
                                                                                
        oTable<xsl:number value="($num - 1)"/>.fnDraw();
+                                                                               
                                                                                
        document.getElementById("message<xsl:number value="$num"/>").innerHTML 
+= '<br/>' + result;
+                                                                               
                                                                                
        oTable<xsl:number value="$num"/>.fnDraw();
                                                                                
                                                                                
});                                                                             
                                                                                
                                                                                
                                                                }
                                                                                
                                                                else
@@ -331,46 +332,46 @@
                        </xsl:for-each>
                ];
 
-               var columns<xsl:number value="($num - 1)"/> = [];
+               var columns<xsl:number value="$num"/> = [];
 <![CDATA[
                for(i=0;i < PreColumns.length;i++)
                {
                        if ( PreColumns[i]['visible'] == true )
                        {
 ]]>
-                               columns<xsl:number value="($num - 
1)"/>.push(PreColumns[i]);
+                               columns<xsl:number 
value="$num"/>.push(PreColumns[i]);
 <![CDATA[
                        }
                }
 ]]>
 
-               var options<xsl:number value="($num - 1)"/> = {};
+               var options<xsl:number value="$num"/> = {};
                <xsl:for-each select="$config">
                        <xsl:if test="allrows">
-                               options<xsl:number value="($num - 1)"/>.allrows 
= true;
+                               options<xsl:number value="$num"/>.allrows = 
true;
                        </xsl:if>
                        <xsl:if test="singleSelect">
-                               options<xsl:number value="($num - 
1)"/>.singleSelect = true;
+                               options<xsl:number value="$num"/>.singleSelect 
= true;
                        </xsl:if>
                        <xsl:if test="disableFilter">
-                               options<xsl:number value="($num - 
1)"/>.disableFilter = true;
+                               options<xsl:number value="$num"/>.disableFilter 
= true;
                        </xsl:if>
                        <xsl:if test="disablePagination">
-                               options<xsl:number value="($num - 
1)"/>.disablePagination = true;
+                               options<xsl:number 
value="$num"/>.disablePagination = true;
                        </xsl:if>
                        <xsl:if test="order">
-                               options<xsl:number value="($num - 1)"/>.order = 
<xsl:value-of select="order" />;
+                               options<xsl:number value="$num"/>.order = 
<xsl:value-of select="order" />;
                        </xsl:if>
                        <xsl:if test="responsive">
-                               options<xsl:number value="($num - 
1)"/>.responsive = true;
+                               options<xsl:number value="$num"/>.responsive = 
true;
                        </xsl:if>
                        <xsl:if test="editor_action">
-                               options<xsl:number value="($num - 
1)"/>.editor_action = "<xsl:value-of select="editor_action" />";
+                               options<xsl:number value="$num"/>.editor_action 
= "<xsl:value-of select="editor_action" />";
                        </xsl:if>
                </xsl:for-each>
-               if (JqueryPortico.buttons<xsl:number value="($num - 1)"/>)
+               if (JqueryPortico.buttons<xsl:number value="$num"/>)
                {
-                       options<xsl:number value="($num - 1)"/>.TableTools = 
JqueryPortico.buttons<xsl:number value="($num - 1)"/>;
+                       options<xsl:number value="$num"/>.TableTools = 
JqueryPortico.buttons<xsl:number value="$num"/>;
                }
 
                <xsl:variable name="dataset">
@@ -384,7 +385,8 @@
                        </xsl:choose>
                </xsl:variable>
 //             $(document).ready(function() {
-               oTable<xsl:number value="($num - 1)"/> = 
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>", 
<xsl:value-of select="$requestUrl"/>, columns<xsl:number value="($num - 1)"/>, 
options<xsl:number value="($num - 1)"/> , <xsl:value-of select="$dataset"/>);
+               var paramsTable<xsl:number value="$num"/> = {};
+               oTable<xsl:number value="$num"/> = 
JqueryPortico.inlineTableHelper("<xsl:value-of select="$container"/>", 
<xsl:value-of select="$requestUrl"/>, columns<xsl:number value="$num"/>, 
options<xsl:number value="$num"/> , <xsl:value-of select="$dataset"/>);
 //     });
        </script>
 </xsl:template>
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -154,8 +154,20 @@
                                                                                
<script type="text/javascript">
                                                                                
        $(document).ready(function() {
                                                                                
        var app = "<xsl:value-of select="app"/>";
+                                                                               
        app = app || 'booking';
+                                                                               
        var label_attr = "<xsl:value-of select="label_attr"/>";
+                                                                               
        label_attr = label_attr || 'name';
+                                                                               
        var show_id =  false;
+                                                                               
        <xsl:if test="show_id = 1">
+                                                                               
                show_id = true;
+                                                                               
        </xsl:if>
+
                                                                                
        var name = "<xsl:value-of select="name"/>";
                                                                                
        var ui = "<xsl:value-of select="ui"/>";
+                                                                               
        var requestGenerator = false;
+                                                                               
        <xsl:if test="requestGenerator">
+                                                                               
                requestGenerator = '<xsl:value-of select="requestGenerator"/>';
+                                                                               
        </xsl:if>
                                                                                
        var depends = false;
                                                                                
        var filter_depends = "";
                                                                                
        var filter_selected = "";
@@ -168,8 +180,8 @@
                                                                                
                if (filter_select != filter_selected){
                                                                                
                if (filter_depends) {
                                                                                
                        <![CDATA[
-                                                                               
                                        
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&filter_'+depends+'_id='+filter_depends+'&',
-                                                                               
                                                                                
                                        'filter_'+name+'_name', 
'filter_'+name+'_id', 'filter_'+name+'_container');
+                                                                               
                                        
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + 
'.ui'+ui+'.index&filter_'+depends+'_id='+filter_depends+'&',
+                                                                               
                                                                                
                                        'filter_'+name+'_name', 
'filter_'+name+'_id', 'filter_'+name+'_container', label_attr, show_id, 
requestGenerator);
                                                                                
                        ]]>
                                                                                
                }
                                                                                
                
oTable.dataTableSettings[0]['ajax']['data']['filter_'+name+'_id'] = "";
@@ -183,8 +195,8 @@
                                                                                
                filter_depends = false;
                                                                                
                if (!filter_depends) {
                                                                                
                                        <![CDATA[
-                                                                               
                                                
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
-                                                                               
                                                                                
                                        'filter_'+name+'_name', 
'filter_'+name+'_id', 'filter_'+name+'_container');
+                                                                               
                                                
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + 
'.ui'+ui+'.index&',
+                                                                               
                                                                                
                                        'filter_'+name+'_name', 
'filter_'+name+'_id', 'filter_'+name+'_container', label_attr, show_id, 
requestGenerator);
                                                                                
                                        ]]>
                                                                                
                }
                                                                                
                filter_selected = "";
@@ -196,13 +208,13 @@
                                                                                
        </xsl:if>
                                                                                
        if (filter_depends) {
                                                                                
                        <![CDATA[
-                                                                               
                                
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&filter_'+depends+'_id='+filter_depends+'&',
-                                                                               
                                                                                
                        'filter_'+name+'_name', 'filter_'+name+'_id', 
'filter_'+name+'_container');
+                                                                               
                                
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + 
'.ui'+ui+'.index&filter_'+depends+'_id='+filter_depends+'&',
+                                                                               
                                                                                
                        'filter_'+name+'_name', 'filter_'+name+'_id', 
'filter_'+name+'_container', label_attr, show_id, requestGenerator);
                                                                                
                        ]]>
                                                                                
        }else{
                                                                                
                        <![CDATA[
-                                                                               
                                
JqueryPortico.autocompleteHelper('index.php?menuaction=booking.ui'+ui+'.index&phpgw_return_as=json&',
-                                                                               
                                                                                
                        'filter_'+name+'_name', 'filter_'+name+'_id', 
'filter_'+name+'_container');
+                                                                               
                                
JqueryPortico.autocompleteHelper('index.php?menuaction=' + app + 
'.ui'+ui+'.index&',
+                                                                               
                                                                                
                        'filter_'+name+'_name', 'filter_'+name+'_id', 
'filter_'+name+'_container', label_attr, show_id, requestGenerator);
                                                                                
                        ]]>
                                                                                
        }
                                                                                
        });

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/pure/css/pure-extension.css
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/pure/css/pure-extension.css  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/phpgwapi/templates/pure/css/pure-extension.css  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -68,6 +68,7 @@
 #schedule_container .pure-table thead th {line-height: 1.4;}
 p.conflicts {margin: 0;color: #000;}
 #schedule_container .cellInfo:hover {background-image: 
url("../images/info.png");background-position: 100% 0;background-repeat: 
no-repeat;cursor: pointer;}
+#schedule_container .free:hover {cursor: pointer;}
 #schedule_overlay {background-color: #fff;border: 1px solid #000;height: 
auto;left: 0;margin: auto;padding: 20px;position: absolute;right: 0;width: 
400px;z-index: 9;}
 #schedule_overlay img {bottom: 0;display: block;left: 0;margin: auto;position: 
absolute;right: 0;top: 0;}
 #content_overlay {display: block;height: 100%;left: 0;position: fixed;top: 
0;width: 100%;}

Modified: branches/Version-2_0-branch/preferences/changepassword.php
===================================================================
--- branches/Version-2_0-branch/preferences/changepassword.php  2016-06-05 
14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/preferences/changepassword.php  2016-06-06 
12:26:20 UTC (rev 15259)
@@ -20,8 +20,8 @@
         */
        include('../header.inc.php');
 
-       $n_passwd   = isset($_POST['n_passwd']) && $_POST['n_passwd'] ? 
$_POST['n_passwd'] : '';
-       $n_passwd_2 = isset($_POST['n_passwd_2']) && $_POST['n_passwd_2'] ? 
$_POST['n_passwd_2'] : '';
+       $n_passwd   = isset($_POST['n_passwd']) && $_POST['n_passwd'] ? 
html_entity_decode(phpgw::get_var('n_passwd', 'string', 'POST')) : '';
+       $n_passwd_2 = isset($_POST['n_passwd_2']) && $_POST['n_passwd_2'] ? 
html_entity_decode(phpgw::get_var('n_passwd_2', 'string', 'POST')) : '';
 
        if (! $GLOBALS['phpgw']->acl->check('changepassword', 1, 'preferences') 
|| (isset($_POST['cancel']) && $_POST['cancel']))
        {

Modified: branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -84,7 +84,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true,
                        'get_category_list' => true,
                        'get_attrib_list' => true
                );

Modified: 
branches/Version-2_0-branch/property/inc/class.boadmin_location.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boadmin_location.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boadmin_location.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -50,7 +50,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -105,11 +104,9 @@
                        return $standard;
                }
 
-               function read_config()
+               function read_config($data = array())
                {
-                       $standard = $this->so->read_config(array('start' => 
$this->start, 'query' => $this->query,
-                               'sort' => $this->sort, 'order' => 
$this->order));
-
+                       $standard = $this->so->read_config($data);
                        $this->total_records = $this->so->total_records;
 
                        return $standard;

Modified: branches/Version-2_0-branch/property/inc/class.boagreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boagreement.inc.php  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boagreement.inc.php  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -53,7 +53,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -128,10 +127,6 @@
                        $this->status_id = $data['status_id'];
                }
 
-               function check_perms( $has, $needed )
-               {
-                       return (!!($has & $needed) == true);
-               }
 
                function select_vendor_list( $format = '', $selected = '' )
                {

Modified: branches/Version-2_0-branch/property/inc/class.boasync.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boasync.inc.php      
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boasync.inc.php      
2016-06-06 12:26:20 UTC (rev 15259)
@@ -47,7 +47,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.bobudget.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bobudget.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bobudget.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -58,7 +58,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -145,11 +144,6 @@
                        $this->direction = isset($data['direction']) ? 
$data['direction'] : '';
                }
 
-               function check_perms( $has, $needed )
-               {
-                       return (!!($has & $needed) == true);
-               }
-
                function read( $data = array() )
                {
                        /* $budget = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,

Modified: branches/Version-2_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bocommon.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bocommon.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -76,6 +76,32 @@
                        return ($rights & $required);
                }
 
+               /**
+                *
+                * @param integer $owner_id
+                * @param array $grants
+                * @param integer $required
+                * @return bool
+                */
+               function check_perms2( $owner_id, $grants,  $required )
+               {
+                       if(isset($grants['accounts'][$owner_id]) && 
($grants['accounts'][$owner_id] & $required))
+                       {
+                               return true;
+                       }
+
+                       $equalto = 
$GLOBALS['phpgw']->accounts->membership($owner_id);
+                       foreach($grants['groups'] as $group => $_right)
+                       {
+                               if(isset($equalto[$group]) && ($_right & 
$required))
+                               {
+                                       return true;
+                               }
+                       }
+
+                       return false;
+               }
+
                function create_preferences( $app = '', $user_id = '' )
                {
                        return $this->socommon->create_preferences($app, 
$user_id);

Modified: branches/Version-2_0-branch/property/inc/class.bocustom.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bocustom.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bocustom.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -46,7 +46,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -126,11 +125,6 @@
                        $this->cat_id = $data['cat_id'];
                }
 
-               function check_perms( $has, $needed )
-               {
-                       return (!!($has & $needed) == true);
-               }
-
                function read( $data = array() )
                {
                        /* $custom = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,

Modified: branches/Version-2_0-branch/property/inc/class.bodocument.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bodocument.inc.php   
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bodocument.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -52,7 +52,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boentity.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boentity.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -64,7 +64,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true,
                        'add_control' => true,
                        'update_control_serie' => true
                );

Modified: branches/Version-2_0-branch/property/inc/class.bogab.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bogab.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bogab.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -47,7 +47,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bogeneric.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bogeneric.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -351,4 +351,20 @@
                {
                        return $this->so->edit_field($data);
                }
+
+               public function get_single_attrib_value( array $data )
+               {
+                       $ret = $id = $data['id'];
+                       $type = $data['type'];
+                       $attrib_name = $data['attrib_name'];
+                       $ret = $id;
+                       if($id = (int)$id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
$type);
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               $ret =  $sogeneric_data[$attrib_name];
+                       }
+                       return $ret;
+               }
+
        }
\ No newline at end of file

Copied: 
branches/Version-2_0-branch/property/inc/class.bogeneric_document.inc.php (from 
rev 15258, trunk/property/inc/class.bogeneric_document.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bogeneric_document.inc.php   
                        (rev 0)
+++ branches/Version-2_0-branch/property/inc/class.bogeneric_document.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -0,0 +1,105 @@
+<?php
+       /**
+        * phpGroupWare - property: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare 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.
+        *
+        * phpGroupWare 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 General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id: class.bogeneric_document.inc.php 14913 2016-04-27 
12:27:37Z sigurdne $
+        */
+
+       class property_bogeneric_document
+       {
+               private $so;
+               var $public_functions = array
+                       (
+                       'read' => true,
+                       'read_single' => true,
+                       'save' => true,
+                       'delete' => true,
+                       'get_file_relations' => true
+               );
+               
+               public function __construct()
+               {
+                       $this->so = CreateObject('property.sogeneric_document');
+                       $this->bocommon = CreateObject('property.bocommon');
+               }
+
+               public function read($data = array())
+               {
+                       
+                       $values =  $this->so->read($data);
+                       $this->total_records = $this->so->total_records;
+                       
+                       return $values;
+               }
+               
+               public function read_single( $file_id )
+               {
+                       $values = $this->so->read_single($file_id);
+
+                       return json_decode($values);
+               }
+
+               function get_file_relations( $location_id, $file_id )
+               {
+                       $values = $this->so->get_file_relations($location_id, 
$file_id);
+
+                       return $values;
+               }
+               
+               function save( $values = array(), $file_id )
+               {
+                       $report_date = 
phpgwapi_datetime::date_array($values['report_date']);
+                       $values['report_date'] = mktime(2, 0, 0, 
$report_date['month'], $report_date['day'], $report_date['year']);
+                       
+                       $result = $this->so->read_single( $file_id );
+
+                       if (count($result))
+                       {
+                               $receipt = $this->so->update($values, $file_id);
+                       }
+                       else
+                       {
+                               $receipt = $this->so->add($values, $file_id);
+                       }
+                       
+                       return $receipt;
+               }
+               
+               function save_file_relations( $items = array(), $location_id, 
$file_id  )
+               {
+                       
+                       $receipt = $this->so->save_file_relations( $items, 
$location_id, $file_id );
+                       
+                       return $receipt;
+               }
+               
+               function delete( $file_id )
+               {               
+                       $receipt = $this->so->delete( $file_id );
+                       
+                       return $receipt;
+               }
+               
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.boifc.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boifc.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boifc.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -53,7 +53,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -152,11 +151,6 @@
                        $this->cat_id = (isset($data['cat_id']) ? 
$data['cat_id'] : '');
                }
 
-               function check_perms( $rights, $required )
-               {
-                       return ($rights & $required);
-               }
-
                function import( $values = '', $ifcfile = '' )
                {
                        _debug_array($ifcfile);

Modified: branches/Version-2_0-branch/property/inc/class.boinvestment.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boinvestment.inc.php 
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boinvestment.inc.php 
2016-06-06 12:26:20 UTC (rev 15259)
@@ -49,7 +49,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -56,7 +56,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true,
                        'get_locations_by_name' => true
                );
 

Modified: branches/Version-2_0-branch/property/inc/class.bopricebook.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bopricebook.inc.php  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bopricebook.inc.php  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -47,7 +47,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boproject.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boproject.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -51,7 +51,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -386,10 +385,10 @@
                        $criteria[1] = array
                                (
                                'field' => 'external_project_id',
-                               'type' => 'int',
+                               'type' => 'varchar',
                                'matchtype' => 'exact',
-                               'front' => '',
-                               'back' => ''
+                               'front' => "'",
+                               'back' => "'"
                        );
                        $criteria[2] = array
                                (

Modified: branches/Version-2_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.borequest.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.borequest.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -53,7 +53,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.bos_agreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bos_agreement.inc.php        
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bos_agreement.inc.php        
2016-06-06 12:26:20 UTC (rev 15259)
@@ -55,7 +55,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )
@@ -128,11 +127,6 @@
                        $this->status_id = $data['status_id'];
                }
 
-               function check_perms( $has, $needed )
-               {
-                       return (!!($has & $needed) == true);
-               }
-
                function select_vendor_list( $format = '', $selected = '' )
                {
                        switch ($format)

Modified: branches/Version-2_0-branch/property/inc/class.botemplate.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.botemplate.inc.php   
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.botemplate.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -46,7 +46,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.botenant_claim.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.botenant_claim.inc.php       
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.botenant_claim.inc.php       
2016-06-06 12:26:20 UTC (rev 15259)
@@ -132,11 +132,6 @@
                        $this->district_id = isset($data['district_id']) ? 
$data['district_id'] : '';
                }
 
-               function check_perms( $has, $needed )
-               {
-                       return (!!($has & $needed) == true);
-               }
-
                function get_status_list( $data = 0 )
                {
                        if (is_array($data))

Modified: branches/Version-2_0-branch/property/inc/class.bowo_hour.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bowo_hour.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.bowo_hour.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -46,7 +46,6 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true
                );
 
                function __construct( $session = false )

Modified: branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -49,11 +49,10 @@
                        'read_single' => true,
                        'save' => true,
                        'delete' => true,
-                       'check_perms' => true,
                        'get_category' => true
                );
 
-               function __construct( $session = false )
+               function __construct( )
                {
                        $this->so = CreateObject('property.soworkorder');
                        $this->bocommon = CreateObject('property.bocommon');
@@ -61,14 +60,6 @@
                        $this->cats->supress_info = true;
                        $this->interlink = & $this->so->interlink;
 
-                       $obligation = phpgw::get_var('obligation', 'bool');
-
-                       if ($session && !$obligation)
-                       {
-                               $this->read_sessiondata();
-                               $this->use_session = true;
-                       }
-
                        $default_filter_year = 'all';
 
                        if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_project_filter_year']))
@@ -88,111 +79,29 @@
                                }
                        }
 
-                       $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
-                       $query = phpgw::get_var('query');
-                       $sort = phpgw::get_var('sort');
-                       $order = phpgw::get_var('order');
-                       $filter = phpgw::get_var('filter', 'int');
-                       $filter_year = phpgw::get_var('filter_year', 'string', 
'REQUEST', $default_filter_year);
-                       $cat_id = phpgw::get_var('cat_id', 'int');
-                       $status_id = phpgw::get_var('status_id');
-                       $wo_hour_cat_id = phpgw::get_var('wo_hour_cat_id', 
'int');
-                       $start_date = phpgw::get_var('start_date');
-                       $end_date = phpgw::get_var('end_date');
-                       $b_group = phpgw::get_var('b_group');
-                       $ecodimb = phpgw::get_var('ecodimb');
-                       $paid = phpgw::get_var('paid', 'bool');
-                       $b_account = phpgw::get_var('b_account');
-                       $district_id = phpgw::get_var('district_id', 'int');
-                       $criteria_id = phpgw::get_var('criteria_id', 'int');
-                       $this->allrows = phpgw::get_var('allrows', 'bool');
-                       $this->obligation = $obligation;
+                       $this->start = phpgw::get_var('start', 'int', 
'REQUEST', 0);
+                       $this->query = phpgw::get_var('query');
+                       $this->sort = phpgw::get_var('sort');
+                       $this->order = phpgw::get_var('order');
+                       $this->filter = phpgw::get_var('filter', 'int');
+                       $this->filter_year = phpgw::get_var('filter_year', 
'string', 'REQUEST', $default_filter_year);
+                       $this->cat_id = phpgw::get_var('cat_id', 'int');
+                       $this->status_id = phpgw::get_var('status_id');
+                       $this->wo_hour_cat_id = 
phpgw::get_var('wo_hour_cat_id', 'int');
+                       $this->start_date = phpgw::get_var('filter_start_date');
+                       $this->end_date = phpgw::get_var('filter_end_date');
+                       $this->b_group = phpgw::get_var('b_group');
+                       $this->ecodimb = phpgw::get_var('ecodimb');
+                       $this->paid = phpgw::get_var('paid', 'bool');
+                       $this->b_account = phpgw::get_var('b_account');
+                       $this->district_id = phpgw::get_var('district_id', 
'int');
+                       $this->criteria_id = phpgw::get_var('criteria_id', 
'int');
+                       $this->this->allrows = phpgw::get_var('allrows', 
'bool');
+                       $this->obligation = phpgw::get_var('obligation', 
'bool');
 
-                       $this->start = $start ? $start : 0;
-                       $this->filter_year = $filter_year;
-
-                       if (array_key_exists('district_id', $_POST) || 
array_key_exists('district_id', $_GET))
-                       {
-                               $this->district_id = $district_id;
-                       }
-
-                       $this->paid = $paid;
-
-                       $this->b_group = $b_group;
-                       $this->ecodimb = $ecodimb;
-                       $this->b_account = $b_account;
-
-                       if (array_key_exists('query', $_POST) || 
array_key_exists('query', $_GET))
-                       {
-                               $this->query = $query;
-                       }
-                       if (array_key_exists('filter', $_POST) || 
array_key_exists('filter', $_GET))
-                       {
-                               $this->filter = $filter;
-                       }
-                       if (isset($sort))
-                       {
-                               $this->sort = $sort;
-                       }
-                       if (isset($order))
-                       {
-                               $this->order = $order;
-                       }
-                       if (array_key_exists('cat_id', $_POST) || 
array_key_exists('cat_id', $_GET))
-                       {
-                               $this->cat_id = $cat_id;
-                       }
-                       if (array_key_exists('criteria_id', $_POST) || 
array_key_exists('criteria_id', $_GET))
-                       {
-                               $this->criteria_id = $criteria_id;
-                       }
-                       if (array_key_exists('status_id', $_POST) || 
array_key_exists('status_id', $_GET))
-                       {
-                               $this->status_id = $status_id;
-                       }
-                       if (array_key_exists('wo_hour_cat_id', $_POST) || 
array_key_exists('wo_hour_cat_id', $_GET))
-                       {
-                               $this->wo_hour_cat_id = $wo_hour_cat_id;
-                       }
-                       if (array_key_exists('start_date', $_POST) || 
array_key_exists('start_date', $_GET))
-                       {
-                               $this->start_date = $start_date;
-                       }
-                       if (array_key_exists('end_date', $_POST) || 
array_key_exists('end_date', $_GET))
-                       {
-                               $this->end_date = $end_date;
-                       }
                }
 
-               function read_sessiondata()
-               {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data', 'workorder');
 
-                       $this->start = isset($data['start']) ? $data['start'] : 
'';
-                       $this->query = isset($data['query']) ? $data['query'] : 
'';
-                       $this->filter = isset($data['filter']) ? 
$data['filter'] : '';
-                       $this->sort = isset($data['sort']) ? $data['sort'] : '';
-                       $this->order = isset($data['order']) ? $data['order'] : 
'';
-                       $this->cat_id = isset($data['cat_id']) ? 
$data['cat_id'] : '';
-                       $this->status_id = isset($data['status_id']) ? 
$data['status_id'] : '';
-                       $this->wo_hour_cat_id = isset($data['wo_hour_cat_id']) 
? $data['wo_hour_cat_id'] : '';
-                       //              $this->start_date               = 
isset($data['start_date']) ? $data['start_date']: '';
-                       //              $this->end_date                 = 
isset($data['end_date']) ? $data['end_date']: '';
-                       //              $this->b_group                  = 
isset($data['b_group']) ? $data['b_group']: '';
-                       //              $this->paid                             
= isset($data['paid']) ? $data['paid']: '';
-                       //              $this->b_account                = 
isset($data['b_account']) ? $data['b_account']: '';
-                       $this->district_id = isset($data['district_id']) ? 
$data['district_id'] : '';
-                       $this->criteria_id = isset($data['criteria_id']) ? 
$data['criteria_id'] : '';
-               }
-
-               function save_sessiondata( $data )
-               {
-                       if ($this->use_session)
-                       {
-                               
$GLOBALS['phpgw']->session->appsession('session_data', 'workorder', $data);
-                       }
-               }
-
                public function get_category()
                {
                        $cat_id = phpgw::get_var('cat_id', 'int');
@@ -427,10 +336,10 @@
                        $criteria[1] = array
                                (
                                'field' => 'external_project_id',
-                               'type' => 'int',
+                               'type' => 'varchar',
                                'matchtype' => 'exact',
-                               'front' => '',
-                               'back' => ''
+                               'front' => "'",
+                               'back' => "'"
                        );
                        $criteria[2] = array
                                (

Modified: 
branches/Version-2_0-branch/property/inc/class.soadmin_location.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soadmin_location.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.soadmin_location.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -143,17 +143,18 @@
                                $querymethod = " where name $this->like 
'%$query%' or column_name $this->like '%$query%'";
                        }
 
-                       $sql = "SELECT fm_location_config.* 
,fm_location_type.name as name FROM fm_location_config  $this->join 
fm_location_type on fm_location_config.location_type=fm_location_type.id 
$querymethod";
+                       $sql = "SELECT fm_location_config.* 
,fm_location_type.name as name FROM fm_location_config"
+                               . "  $this->join fm_location_type on 
fm_location_config.location_type=fm_location_type.id $querymethod";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->total_records = $this->db->num_rows();
 
                        $this->db->limit_query($sql . $ordermethod, $start, 
__LINE__, __FILE__);
 
+                       $config = array();
                        while ($this->db->next_record())
                        {
-                               $config[] = array
-                                       (
+                               $config[] = array(
                                        'column_name' => 
$this->db->f('column_name'),
                                        'input_text' => 
$this->db->f('input_text'),
                                        'f_key' => $this->db->f('f_key'),
@@ -213,9 +214,21 @@
                        $receipt['id'] = $standard['id'];
 
                        $this->init_process();
+                       $default_attrib = array();
 
                        $j = 1;
                        $default_attrib['id'][] = $j;
+                       $default_attrib['column_name'][] = 'id';
+                       $default_attrib['type'][] = 'I';
+                       $default_attrib['precision'][] = 4;
+                       $default_attrib['nullable'][] = 'false';
+                       $default_attrib['input_text'][] = 'id';
+                       $default_attrib['statustext'][] = 'id';
+                       $default_attrib['attrib_sort'][] = '';
+                       $default_attrib['custom'][] = '';
+
+                       $j++;
+                       $default_attrib['id'][] = $j;
                        $default_attrib['column_name'][] = 'location_code';
                        $default_attrib['type'][] = 'V';
                        $default_attrib['precision'][] = 4 * $standard['id'];
@@ -338,6 +351,7 @@
 
 
                        $fd = array();
+                       $fd['id'] = array('type' => 'int', 'precision' => 4, 
'nullable' => true);
                        $fd['location_code'] = array('type' => 'varchar', 
'precision' => 25, 'nullable' => false);
 
                        for ($i = 1; $i < $standard['id'] + 1; $i++)
@@ -625,9 +639,9 @@
                                        if ($column_name == 'street_id')
                                        {
                                                
$this->oProc->AddColumn('fm_location' . $values[$column_name], 'street_number', 
array(
-                                                       'type' => 'varchar', 
'precision' => 10));
+                                                       'type' => 'varchar', 
'precision' => 10, 'nullable' => true));
                                                
$this->oProc->AddColumn('fm_location' . $values[$column_name] . '_history', 
'street_number', array(
-                                                       'type' => 'varchar', 
'precision' => 10));
+                                                       'type' => 'varchar', 
'precision' => 10, 'nullable' => true));
                                                
$this->oProc->DropColumn('fm_location' . $location_type, 
$table_def['fm_location' . $location_type], 'street_number');
                                                
$this->oProc->DropColumn('fm_location' . $location_type . '_history', 
$history_table_def['fm_location' . $location_type] . '_history', 
'street_number');
                                        }

Modified: branches/Version-2_0-branch/property/inc/class.soagreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soagreement.inc.php  
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.soagreement.inc.php  
2016-06-06 12:26:20 UTC (rev 15259)
@@ -212,28 +212,6 @@
 
                        $where = 'WHERE';
 
-                       /*                      if ($filter=='all')
-                         {
-                         if (is_array($grants))
-                         {
-                         while (list($user) = each($grants))
-                         {
-                         $public_user_list[] = $user;
-                         }
-                         reset($public_user_list);
-                         $filtermethod .= " $where ( $entity_table.user_id 
IN(" . implode(',',$public_user_list) . "))";
-
-                         $where= 'AND';
-                         }
-
-                         }
-                         else
-                         {
-                         $filtermethod = " $where 
$entity_table.user_id=$filter ";
-                         $where= 'AND';
-                         }
-                        */
-
                        if ($agreement_id)
                        {
                                $filtermethod .= " $where 
$entity_table.agreement_id=$agreement_id";
@@ -319,7 +297,6 @@
                                for ($i = 0; $i < $n; $i++)
                                {
                                        $agreement_list[$j][$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
-                                       $agreement_list[$j]['grants'] = 
(int)isset($grants[$this->db->f('user_id')]) ? $grants[$this->db->f('user_id')] 
: '';
                                }
 
                                if (isset($cols_return_extra) && 
is_array($cols_return_extra))

Modified: branches/Version-2_0-branch/property/inc/class.socustom.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.socustom.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.socustom.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -322,7 +322,6 @@
                                for ($i = 0; $i < $n; $i++)
                                {
                                        $custom[$j][$uicols[$i]['name']] = 
$this->db->f($uicols[$i]['name']);
-                                       $custom[$j]['grants'] = 
(int)$grants[$this->db->f('user_id')];
                                }
                                $j++;
                        }

Modified: branches/Version-2_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -126,16 +126,10 @@
                        {
                                return;
                        }
+               
+                       $acl = & $GLOBALS['phpgw']->acl;
+                       $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
-                       $grants = 
$GLOBALS['phpgw']->session->appsession('grants_entity_' . $entity_id . '_' . 
$cat_id, $this->type_app[$this->type]);
-
-                       if (!$grants)
-                       {
-                               $this->acl = & $GLOBALS['phpgw']->acl;
-                               $grants = 
$this->acl->get_grants($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
-                               
$GLOBALS['phpgw']->session->appsession('grants_entity_' . $entity_id . '_' . 
$cat_id, $this->type_app[$this->type], $grants);
-                       }
-
                        $admin_entity = CreateObject('property.soadmin_entity');
                        $admin_entity->type = $this->type;
 
@@ -179,17 +173,38 @@
 
                        if ($filter == 'all')
                        {
-                               if (is_array($grants))
+                               $public_user_list = array();
+                               if (is_array($grants['accounts']) && 
$grants['accounts'])
                                {
-                                       foreach ($grants as $user => $right)
+                                       foreach ($grants['accounts'] as $user 
=> $right)
                                        {
                                                $public_user_list[] = $user;
                                        }
+                                       unset($user);
+
                                        reset($public_user_list);
-                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . "))";
+                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . ")";
 
                                        $where = 'AND';
                                }
+
+                               $public_group_list = array();
+                               if (is_array($grants['groups']) && 
$grants['groups'])
+                               {
+                                       foreach($grants['groups'] as $user => 
$_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $where = $public_user_list ? 'OR' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        else
                        {
@@ -198,7 +213,10 @@
                        }
                        $values = array();
                        $name = 'title';
-                       $sql = "SELECT id, {$name} as name FROM {$entity_table} 
{$filtermethod}";
+                       $sql = "SELECT id, {$name} as name FROM {$entity_table}"
+                               . " {$this->join} phpgw_accounts ON 
$entity_table.user_id = phpgw_accounts.account_id"
+                               . " {$this->join} phpgw_group_map ON 
phpgw_accounts.account_id = phpgw_group_map.account_id"
+                               . " {$filtermethod}";
 
                        $this->db->query($sql, __LINE__, __FILE__);
                        while ($this->db->next_record())
@@ -465,17 +483,11 @@
                        {
                                $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
                        }
+               
+                       $acl = & $GLOBALS['phpgw']->acl;
+                       $acl->set_account_id($this->account);
+                       $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
-                       $grants = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type]);
-
-                       if (!$grants)
-                       {
-                               $this->acl = & $GLOBALS['phpgw']->acl;
-                               $this->acl->set_account_id($this->account);
-                               $grants = 
$this->acl->get_grants($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
-                               
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type], $grants);
-                       }
-
                        $admin_entity = CreateObject('property.soadmin_entity');
                        $admin_entity->type = $this->type;
 
@@ -529,17 +541,38 @@
 
                        if ($filter == 'all')
                        {
-                               if (is_array($grants) && !$bypass_acl_at_entity)
+                               $public_user_list = array();
+                               if (!$bypass_acl_at_entity && 
is_array($grants['accounts']) && $grants['accounts'])
                                {
-                                       foreach ($grants as $user => $right)
+                                       foreach ($grants['accounts'] as $user 
=> $right)
                                        {
                                                $public_user_list[] = $user;
                                        }
+                                       unset($user);
+
                                        reset($public_user_list);
-                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . "))";
+                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . ")";
 
                                        $where = 'AND';
                                }
+
+                               $public_group_list = array();
+                               if (!$bypass_acl_at_entity && 
is_array($grants['groups']) && $grants['groups'])
+                               {
+                                       foreach($grants['groups'] as $user => 
$_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $where = $public_user_list ? 'OR' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        else
                        {
@@ -743,7 +776,9 @@
                                }
                        }
 
-                       $sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM 
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)";
+                       $sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM 
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)"
+                               . " {$this->join} phpgw_accounts ON 
$entity_table.user_id = phpgw_accounts.account_id"
+                               . " {$this->join} phpgw_group_map ON 
phpgw_accounts.account_id = phpgw_group_map.account_id ";
                        $join_control = "controller_control_component_list ON 
(fm_bim_item.id = controller_control_component_list.component_id  AND 
controller_control_component_list.location_id = fm_bim_type.location_id)";
 
                        if ($control_registered)
@@ -1436,17 +1471,11 @@
                        {
                                return;
                        }
+               
+                       $acl = & $GLOBALS['phpgw']->acl;
+                       $acl->set_account_id($this->account);
+                       $grants = 
$acl->get_grants2($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
 
-                       $grants = 
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type]);
-
-                       if (!$grants)
-                       {
-                               $this->acl = & $GLOBALS['phpgw']->acl;
-                               $this->acl->set_account_id($this->account);
-                               $grants = 
$this->acl->get_grants($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}");
-                               
$GLOBALS['phpgw']->session->appsession("grants_entity_{$entity_id}_{$cat_id}", 
$this->type_app[$this->type], $grants);
-                       }
-
                        //_debug_array($cols_return_extra);
 
                        if ($order)
@@ -1502,17 +1531,38 @@
 
                        if ($filter == 'all')
                        {
-                               if (is_array($grants) && !$bypass_acl_at_entity)
+                               $public_user_list = array();
+                               if (!$bypass_acl_at_entity && 
is_array($grants['accounts']) && $grants['accounts'])
                                {
-                                       foreach ($grants as $user => $right)
+                                       foreach ($grants['accounts'] as $user 
=> $right)
                                        {
                                                $public_user_list[] = $user;
                                        }
+                                       unset($user);
+
                                        reset($public_user_list);
-                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . "))";
+                                       $filtermethod .= " $where ( 
$entity_table.user_id IN(" . implode(',', $public_user_list) . ")";
 
                                        $where = 'AND';
                                }
+
+                               $public_group_list = array();
+                               if (!$bypass_acl_at_entity && 
is_array($grants['groups']) && $grants['groups'])
+                               {
+                                       foreach($grants['groups'] as $user => 
$_right)
+                                       {
+                                               $public_group_list[] = $user;
+                                       }
+                                       unset($user);
+                                       reset($public_group_list);
+                                       $where = $public_user_list ? 'OR' : 
$where;
+                                       $filtermethod .= " $where 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                                       $where = 'AND';
+                               }
+                               if($public_user_list && !$public_group_list)
+                               {
+                                       $filtermethod .=')';
+                               }
                        }
                        else
                        {
@@ -1707,9 +1757,11 @@
                        }
 
                        $_joinmethod_datatype = 
array_merge($_joinmethod_datatype, $_joinmethod_datatype_custom);
+                       $_joinmethod_datatype[] = " {$this->join} 
phpgw_accounts ON $entity_table.user_id = phpgw_accounts.account_id"
+                               . " {$this->join} phpgw_group_map ON 
phpgw_accounts.account_id = phpgw_group_map.account_id ";
                        foreach ($_joinmethod_datatype as $_joinmethod)
                        {
-                               $sql .= $_joinmethod;
+                               $sql .= " {$_joinmethod}";
                        }
 
                        $querymethod = '';

Copied: 
branches/Version-2_0-branch/property/inc/class.sogeneric_document.inc.php (from 
rev 15258, trunk/property/inc/class.sogeneric_document.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sogeneric_document.inc.php   
                        (rev 0)
+++ branches/Version-2_0-branch/property/inc/class.sogeneric_document.inc.php   
2016-06-06 12:26:20 UTC (rev 15259)
@@ -0,0 +1,344 @@
+<?php
+       /**
+        * phpGroupWare - property: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare 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.
+        *
+        * phpGroupWare 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 General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id: class.sogeneric_document.inc.php 14913 2016-04-27 
12:27:37Z sigurdne $
+        */
+
+       class property_sogeneric_document 
+       {
+
+               function __construct()
+               {
+                       $this->vfs = CreateObject('phpgwapi.vfs');
+                       $this->vfs->fakebase = '/property';
+                       
+                       $this->db = & $GLOBALS['phpgw']->db;
+                       $this->join = & $this->db->join;
+                       $this->left_join = & $this->db->left_join;
+                       $this->like = & $this->db->like;                
+                       $this->total_records = 0;
+               }
+
+               public function read($data)
+               {
+                       $start = isset($data['start']) && $data['start'] ? 
$data['start'] : 0;
+                       $sort = isset($data['sort']) && $data['sort'] ? 
$data['sort'] : 'ASC';
+                       $order = isset($data['order']) ? $data['order'] : '';
+                       $query = isset($data['query']) ? $data['query'] : '';
+                       $allrows = isset($data['allrows']) ? $data['allrows'] : 
'';
+                       $dry_run = isset($data['dry_run']) ? $data['dry_run'] : 
'';
+                       $user_id = isset($data['user_id']) && $data['user_id'] 
? (int)$data['user_id'] : 0;
+                       $cat_id = isset($data['cat_id']) && $data['cat_id'] ? 
(int)$data['cat_id'] : 0;
+                       $location_id = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
+                       $mime_type = isset($data['mime_type']) ? 
$data['mime_type'] : '';
+                       $start_date = isset($data['start_date']) ? 
$data['start_date'] : 0;
+                       $end_date = isset($data['end_date']) ? 
$data['end_date'] : 0;
+                       $location = !empty($data['location']) ? 
$data['location'] : '';
+                       $results = (isset($data['results']) ? $data['results'] 
: 0);
+
+                       if ($order)
+                       {
+                               switch ($order)
+                               {
+                                       case 'id':
+                                               $_order = 'file_id';
+                                               break;
+                                       case 'date':
+                                               $_order = 'created';
+                                               break;
+                                       default:
+                                               $_order = $order;
+                               }
+
+                               $ordermethod = " ORDER BY a.{$_order} {$sort}";
+                       }
+                       else
+                       {
+                               $ordermethod = ' ORDER BY a.file_id ASC';
+                       }
+                       
+                       $filtermethod = "WHERE a.mime_type != 'Directory' AND 
a.mime_type != 'journal' AND a.mime_type != 'journal-deleted'";
+
+                       if ($cat_id)
+                       {
+                               $joinmethod .= " {$this->join} 
phpgw_vfs_filedata b ON ( a.file_id = b.file_id )";
+                               $filtermethod .= " AND b.metadata @> 
'{\"cat_id\":\"{$cat_id}\"}'";
+                       } 
+
+                       if ($location_id)
+                       {
+                               $joinmethod .= " {$this->join} 
phpgw_vfs_file_relation c ON ( a.file_id = c.file_id )";
+                               $filtermethod .= " AND c.location_id = 
{$location_id}";
+                       } 
+                       
+                       if ($user_id)
+                       {
+                               $filtermethod .= " AND a.createdby_id = 
{$user_id}";
+                       }
+                       
+                       if ($mime_type)
+                       {
+                               $filtermethod .= " AND a.mime_type = 
'{$mime_type}'";
+                       }
+
+                       if ($start_date)
+                       {
+                               $date_format = $this->db->date_format();
+                               $start_date = date($date_format, $start_date);
+                               $end_date = date($date_format, $end_date);
+                               $filtermethod .= " AND a.created >= 
'$start_date' AND a.created <= '$end_date'";
+                       }
+
+                       if ($location)
+                       {
+                               $filtermethod .= " AND a.directory 
{$this->like} '%{$location}%'";
+                       }
+
+                       $querymethod = '';
+                       if ($query)
+                       {
+                               $query = $this->db->db_addslashes($query);
+                               $querymethod = " AND a.name $this->like 
'%$query%'";
+                       }
+                       
+                       $sql = "SELECT DISTINCT a.file_id, a.* FROM phpgw_vfs a 
" ." {$joinmethod} "." {$filtermethod} "." {$querymethod} ";
+       
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       $this->total_records = $this->db->num_rows();
+
+                       $values = array();
+                       if (!$dry_run)
+                       {
+                               if (!$allrows)
+                               {
+                                       $this->db->limit_query($sql . 
$ordermethod, $start, __LINE__, __FILE__, $results);
+                               }
+                               else
+                               {
+                                       $this->db->query($sql . $ordermethod, 
__LINE__, __FILE__);
+                               }
+                               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                               while ($this->db->next_record())
+                               {
+                                       $values[] = array
+                                               (
+                                               'id' => $this->db->f('file_id'),
+                                               'owner_id' => 
$this->db->f('owner_id'),
+                                               'createdby_id' => 
$this->db->f('createdby_id'),
+                                               'modifiedby_id' => 
$this->db->f('modifiedby_id'),
+                                               'created' => 
$GLOBALS['phpgw']->common->show_date(strtotime($this->db->f('created')), 
$dateformat),
+                                               'modified' => 
$GLOBALS['phpgw']->common->show_date(strtotime($this->db->f('modified')), 
$dateformat),
+                                               'size' => $this->db->f('size'),
+                                               'mime_type' => 
$this->db->f('mime_type', true),
+                                               'app' => $this->db->f('app'),
+                                               'directory' => 
$this->db->f('directory', true),
+                                               'name' => $this->db->f('name'),
+                                               'link_directory' => 
$this->db->f('link_directory', true),
+                                               'link_name' => 
$this->db->f('link_name', true),
+                                               'version' => 
$this->db->f('version')
+                                       );
+                               }
+                       }
+
+                       return $values;
+               }
+               
+               public function get_file_relations($location_id, $file_id) 
+               {
+                       $filtermethod = "WHERE location_id = {$location_id} AND 
file_id = {$file_id}";
+                       
+                       $sql = "SELECT * FROM phpgw_vfs_file_relation " ." 
{$filtermethod} ";
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $values = array();
+
+                       while ($this->db->next_record())
+                       {
+                               $values[] = array
+                                       (
+                                       'id' => $this->db->f('relation_id'),
+                                       'location_item_id' => 
$this->db->f('location_item_id')
+                               );
+                       }
+                       
+                       return $values;
+               }
+               
+               function save_file_relations( $items = array(), $location_id, 
$file_id )
+               {
+                       $this->db->transaction_begin();
+                       
+                       $this->db->query("DELETE FROM phpgw_vfs_file_relation 
WHERE file_id = {$file_id} AND location_id = {$location_id}", __LINE__, 
__FILE__);
+                       
+                       $date_format = 
phpgwapi_datetime::date_array(date('Y-m-d'));
+                       $date = mktime(2, 0, 0, $date_format['month'], 
$date_format['day'], $date_format['year']);
+                               
+                       if (count($items))
+                       {
+                               foreach($items as $item)
+                               {
+                                       $values_insert = array
+                                       (
+                                               'file_id' => (int)$file_id,
+                                               'location_id' => 
(int)$location_id,
+                                               'location_item_id' => 
(int)$item,
+                                               'is_private' => 0,
+                                               'account_id' => 
$GLOBALS['phpgw_info']['user']['account_id'],
+                                               'entry_date' => $date,
+                                               'start_date' => $date,
+                                               'end_date' => $date
+                                       );                              
+
+                                       $this->db->query("INSERT INTO 
phpgw_vfs_file_relation (" . implode(',', array_keys($values_insert)) . ') 
VALUES ('
+                                               . 
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__, 
__FILE__);                          
+                               }
+                       }
+                       
+                       if ($this->db->transaction_commit())
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+               
+               
+               public function add( $data = array(), $file_id )
+               {
+                       $receipt = array();
+                       $values_insert = array
+                               (
+                               'file_id' => $file_id,
+                               'metadata' => json_encode($data)
+                       );
+
+                       $result = $this->db->query("INSERT INTO 
phpgw_vfs_filedata (" . implode(',', array_keys($values_insert)) . ') VALUES ('
+                               . 
$this->db->validate_insert(array_values($values_insert)) . ')', __LINE__, 
__FILE__);
+
+                       if ($result)
+                       {
+                               $receipt['message'] = lang('filedata has been 
saved');
+                       } 
+                       else {
+                               $receipt['error'] = lang('filedata has not been 
saved');
+                       }
+                       return $receipt;
+               }
+               
+               public function update( $data = array(), $file_id)
+               {
+                       $receipt = array();
+                       $value_set = array
+                       (
+                               'metadata' => json_encode($data)
+                       );
+
+                       $value_set = $this->db->validate_update($value_set);
+                       
+                       $result = $this->db->query("UPDATE phpgw_vfs_filedata 
SET $value_set WHERE file_id = {$file_id}", __LINE__, __FILE__);
+                       
+                       if ($result)
+                       {
+                               $receipt['message'] = lang('filedata has been 
edited');
+                       } 
+                       else {
+                               $receipt['error'] = lang('filedata has not been 
edited');
+                       }
+                       return $receipt;
+               }
+               
+               public function read_single( $id )
+               {
+                       $id = (int)$id;
+
+                       $this->db->query("SELECT * FROM phpgw_vfs_filedata 
WHERE file_id = {$id}");
+
+                       $values = array();
+                       if ($this->db->next_record())
+                       {
+                               $values['id'] = $id;
+                               $values['metadata'] = $this->db->f('metadata');
+                       }
+
+                       return $values['metadata'];                     
+               }
+               
+               public function delete( $file_id )
+               {
+                       $file_info = $this->vfs->get_info($file_id);
+                       $file = 
"{$file_info['directory']}/{$file_info['name']}";
+
+                       if ($file)
+                       {
+                               $this->db->transaction_begin();
+                               
+                               $this->db->query("DELETE FROM 
phpgw_vfs_file_relation WHERE file_id = {$file_id}", __LINE__, __FILE__);
+                               $this->db->query("DELETE FROM 
phpgw_vfs_filedata WHERE file_id = {$file_id}", __LINE__, __FILE__);
+                                                               
+                               $result = $this->delete_file($file);
+                               
+                               if ($result)
+                               {
+                                       $this->db->transaction_commit();
+                                       $receipt = lang('file deleted') . ' : ' 
. $file_info['name'];
+                               } else {                                        
+                                       $receipt = lang('failed to delete 
file') . ' : ' . $file_info['name'];
+                               }
+                       }
+                       
+                       return $receipt;
+               }
+               
+               function delete_file( $file )
+               {
+                       $result = false;
+                       if ($this->vfs->file_exists(array(
+                                       'string' => $file,
+                                       'relatives' => array(RELATIVE_NONE)
+                               )))
+                       {
+                               $this->vfs->override_acl = 1;
+
+                               if ($this->vfs->rm(array(
+                                               'string' => $file,
+                                               'relatives' => array(
+                                                       RELATIVE_NONE
+                                               )
+                                       )))
+                               {
+                                       $result = true;
+                               }
+
+                               $this->vfs->override_acl = 0;
+                       }
+                       
+                       return $result;
+               }
+               
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-06-06 12:26:20 UTC (rev 15259)
@@ -553,6 +553,18 @@
                                case 'pmwrkord_code':
                                        $ordermethod = " ORDER BY $order $sort";
                                        break;
+                               case 'workorder_id':
+                                       $ordermethod = " ORDER BY pmwrkord_code 
$sort";
+                                       break;
+                               case 'voucher_id':
+                                       $ordermethod = " ORDER BY bilagsnr_ut 
$sort, bilagsnr $sort";
+                                       break;
+                               case 'amount':
+                                       $ordermethod = " ORDER BY belop $sort";
+                                       break;
+                               case 'period':
+                                       $ordermethod = " ORDER BY periode 
$sort";
+                                       break;
                                default:
                                        $ordermethod = " ORDER BY pmwrkord_code 
DESC";
                        }

Modified: branches/Version-2_0-branch/property/inc/class.sojasper.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sojasper.inc.php     
2016-06-05 14:17:38 UTC (rev 15258)
+++ branches/Version-2_0-branch/property/inc/class.sojasper.inc.php     
2016-06-06 12:26:20 UTC (rev 15259)
@@ -41,7 +41,7 @@
                        $this->join = & $this->db->join;
                        $this->like = & $this->db->like;
                        $GLOBALS['phpgw']->acl->set_account_id($this->account);
-                       $this->grants = 
$GLOBALS['phpgw']->acl->get_grants('property', '.jasper');
+                       $this->grants = 
$GLOBALS['phpgw']->acl->get_grants2('property', '.jasper');
                }
 
                public function read( $data )
@@ -75,20 +75,34 @@
                        }
 
 
-                       $filtermethod = "WHERE ( {$table}.user_id = 
{$this->account}";
-                       if (is_array($grants))
+                       $filtermethod = "WHERE {$table}.user_id = 
{$this->account}";
+                       $public_user_list = array();
+                       if (is_array($grants['accounts']) && 
$grants['accounts'])
                        {
-                               foreach ($grants as $user => $right)
+                               foreach($grants['accounts'] as $user => $_right)
                                {
                                        $public_user_list[] = $user;
                                }
                                reset($public_user_list);
-                               $filtermethod .= " OR (access='public' AND 
{$table}.user_id IN(" . implode(',', $public_user_list) . ")))";
+                               $filtermethod .= " OR (access='public' AND 
{$table}.user_id IN(" . implode(',', $public_user_list) . ")";
                        }
-                       else
+
+                       $public_group_list = array();
+                       if (is_array($grants['groups']) && $grants['groups'])
                        {
-                               $filtermethod .= ' )';
+                               foreach($grants['groups'] as $user => $_right)
+                               {
+                                       $public_group_list[] = $user;
+                               }
+                               unset($user);
+                               reset($public_group_list);
+                               $filtermethod .= " OR access='public' AND 
phpgw_group_map.group_id IN(" . implode(',', $public_group_list) . "))";
+                               $where = 'AND';
                        }

@@ Diff output truncated at 153600 characters. @@



reply via email to

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