fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16498] Stable: Merge 16489:16497 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [16498] Stable: Merge 16489:16497 from trunk
Date: Thu, 30 Mar 2017 08:35:36 -0400 (EDT)

Revision: 16498
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16498
Author:   sigurdne
Date:     2017-03-30 08:35:36 -0400 (Thu, 30 Mar 2017)
Log Message:
-----------
Stable: Merge 16489:16497 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/admin/inc/class.uiconfig.inc.php
    branches/Version-2_0-branch/booking/inc/class.socommon.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.bopermission.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.sobooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.sogeneric.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.sopermission.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uiapplication.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uicustomer.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uicustomer_report.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uipermission.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uivendor.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php
    branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js
    branches/Version-2_0-branch/eventplanner/setup/default_records.inc.php
    branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang
    branches/Version-2_0-branch/eventplanner/setup/setup.inc.php
    branches/Version-2_0-branch/eventplanner/setup/tables_current.inc.php
    branches/Version-2_0-branch/eventplanner/setup/tables_update.inc.php
    branches/Version-2_0-branch/eventplanner/templates/base/booking.xsl
    
branches/Version-2_0-branch/eventplannerfrontend/js/portico/application.edit.js
    
branches/Version-2_0-branch/eventplannerfrontend/setup/default_records.inc.php
    branches/Version-2_0-branch/eventplannerfrontend/templates/base/booking.xsl
    branches/Version-2_0-branch/header.inc.php.template
    branches/Version-2_0-branch/helpdesk/inc/class.sogeneric.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.common.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.crypto.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.setup.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.setup_detection.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.setup_html.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.uicommon.inc.php
    branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-2_0-branch/property/inc/class.sogeneric_.inc.php
    branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.sogeneric.inc.php
    branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php
    branches/Version-2_0-branch/rental/setup/phpgw_no.lang
    branches/Version-2_0-branch/rental/setup/tables_current.inc.php
    branches/Version-2_0-branch/setup/inc/functions.inc.php
    branches/Version-2_0-branch/setup/lang/phpgw_de.lang
    branches/Version-2_0-branch/setup/lang/phpgw_en.lang
    branches/Version-2_0-branch/setup/lang/phpgw_fr.lang
    branches/Version-2_0-branch/setup/lang/phpgw_no.lang
    branches/Version-2_0-branch/setup/lang/phpgw_tr.lang
    branches/Version-2_0-branch/setup/manageheader.php
    branches/Version-2_0-branch/setup/templates/base/manageheader.tpl

Added Paths:
-----------
    branches/Version-2_0-branch/eventplanner/inc/class.bocalendar.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.socalendar.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uicalendar.inc.php
    branches/Version-2_0-branch/eventplanner/inc/model/class.calendar.inc.php
    
branches/Version-2_0-branch/eventplannerfrontend/inc/class.uicalendar.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.crypto_libsodium.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.crypto_mcrypt.inc.php

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

Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch 2017-03-30 12:35:36 UTC (rev 16498)

Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
 /branches/dev-syncromind:13653
 /branches/dev-syncromind-2:14933-16394
 /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,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488
\ No newline at end of property
+/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,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497
\ No newline at end of property
Modified: branches/Version-2_0-branch/admin/inc/class.uiconfig.inc.php
===================================================================
--- branches/Version-2_0-branch/admin/inc/class.uiconfig.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/admin/inc/class.uiconfig.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -184,7 +184,8 @@
                                {
                                        $valarray = explode('_', $value);
                                        $type = $valarray[0];
-                                       $new = $newval = '';
+                                       $new = array();
+                                       $newval = '';
 
                                        while($chunk = next($valarray))
                                        {

Index: branches/Version-2_0-branch/booking
===================================================================
--- branches/Version-2_0-branch/booking 2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/booking 2017-03-30 12:35:36 UTC (rev 16498)

Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
 /branches/dev-syncromind-2/booking:14933-16394
 /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,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395
\ No newline at end of property
+/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,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497
\ No newline at end of property
Modified: branches/Version-2_0-branch/booking/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.socommon.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/booking/inc/class.socommon.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -576,6 +576,7 @@
                                                        while 
($this->db->next_record())
                                                        {
                                                                $id = 
$this->_unmarshal($this->db->f($key, false), 'int');
+                                                               
$results[$id_map[$id]][$field] = array();
                                                                $data = array();
                                                                foreach 
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
                                                                {
@@ -604,6 +605,7 @@
                                                        while 
($this->db->next_record())
                                                        {
                                                                $id = 
$this->_unmarshal($this->db->f($key, false), 'int');
+                                                               
$results[$id_map[$id]][$field] = array();
                                                                
$results[$id_map[$id]][$field][] = $this->_unmarshal($this->db->f($column, 
false), $params['type']);
                                                        }
                                                }

Modified: branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bobooking.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -60,8 +60,19 @@
 
                public function store($object)
                {
+                       $save_last_booking = false;
+                       if(!$object->get_id())
+                       {
+                               $save_last_booking = true;
+                       }
+
                        $this->store_pre_commit($object);
                        $ret = 
eventplanner_sobooking::get_instance()->store($object);
+                       if($ret && $save_last_booking)
+                       {
+                               phpgwapi_cache::system_set('eventplanner', 
"last_booking{$object->customer_id}", time());
+                       }
+
                        $this->store_post_commit($object);
                        return $ret;
                }
@@ -104,8 +115,13 @@
                        return $values;
                }
 
-               public function update_active_status( $ids, $action )
+               public function get_booking_id_from_calendar( $calendar_id )
                {
+                       return 
eventplanner_sobooking::get_instance()->get_booking_id_from_calendar($calendar_id);
+               }
+
+/*             public function update_active_status( $ids, $action )
+               {
                        if($action == 'enable' && $ids)
                        {
                                $_ids = array();
@@ -175,20 +191,5 @@
 
                        return 
eventplanner_sobooking::get_instance()->update_active_status($_ids, $action);
                }
-
-               public function update_schedule( $id, $from_ )
-               {
-                       $booking = 
eventplanner_sobooking::get_instance()->read_single($id, true);
-                       $booking->from_ = $from_;
-                       $booking->customer_id = $booking->customer_id ? 
$booking->customer_id : '';//foreigns key
-                       $booking->process_update = true;
-
-                       if($booking->validate())
-                       {
-                               return $booking->store();
-                       }
-                       return false;
-               }
-
-
+*/
        }
\ No newline at end of file

Copied: branches/Version-2_0-branch/eventplanner/inc/class.bocalendar.inc.php 
(from rev 16497, trunk/eventplanner/inc/class.bocalendar.inc.php)
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bocalendar.inc.php       
                        (rev 0)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bocalendar.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,192 @@
+<?php
+       /**
+        * phpGroupWare
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 Free Software Foundation 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+        * @internal
+        * @package eventplanner
+        * @subpackage calendar
+        * @version $Id:$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU Lesser General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       phpgw::import_class('phpgwapi.bocommon');
+       phpgw::import_class('eventplanner.socalendar');
+
+       include_class('eventplanner', 'calendar', 'inc/model/');
+
+       class eventplanner_bocalendar extends phpgwapi_bocommon
+       {
+               protected static
+                       $bo,
+                       $fields,
+                       $acl_location;
+
+               public function __construct()
+               {
+                       $this->fields = eventplanner_calendar::get_fields();
+                       $this->acl_location = 
eventplanner_calendar::acl_location;
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       if (self::$bo == null)
+                       {
+                               self::$bo = new eventplanner_bocalendar();
+                       }
+                       return self::$bo;
+               }
+
+               public function store($object)
+               {
+                       $this->store_pre_commit($object);
+                       $ret = 
eventplanner_socalendar::get_instance()->store($object);
+                       $this->store_post_commit($object);
+                       return $ret;
+               }
+
+               public function read($params)
+               {
+                       $status_text = array(lang('inactive'), lang('active'));
+                       if(empty($params['filters']['active']))
+                       {
+                               $params['filters']['active'] = 1;
+                       }
+                       else
+                       {
+                               unset($params['filters']['active']);
+                       }
+                       $values =  
eventplanner_socalendar::get_instance()->read($params);
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach ($values['results'] as &$entry)
+                       {
+                               $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
+                               $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+                               $entry['from_'] = 
$GLOBALS['phpgw']->common->show_date($entry['from_']);
+                               $entry['to_'] = 
$GLOBALS['phpgw']->common->show_date($entry['to_']);
+                               $entry['status'] = 
$status_text[$entry['active']];
+                       }
+                       return $values;
+               }
+
+               public function read_single($id, $return_object = true)
+               {
+                       if ($id)
+                       {
+                               $values = 
eventplanner_socalendar::get_instance()->read_single($id, $return_object);
+                       }
+                       else
+                       {
+                               $values = new eventplanner_calendar();
+                       }
+
+                       return $values;
+               }
+
+               public function update_active_status( $ids, $action )
+               {
+                       if($action == 'enable' && $ids)
+                       {
+                               $_ids = array();
+                               $application_id = 
eventplanner_socalendar::get_instance()->read_single($ids[0], 
true)->application_id;
+
+                               $application = 
createObject('eventplanner.boapplication')->read_single($application_id);
+                               $params = array();
+                               $params['filters']['active'] = 1;
+                               $params['filters']['application_id'] = 
$application_id;
+
+                               $calendars =  
eventplanner_socalendar::get_instance()->read($params);
+
+                               $existing_calendar_ids = array();
+                               foreach ($calendars['results'] as $calendar)
+                               {
+                                       $existing_calendar_ids[] = 
$calendar['id'];
+                               }
+
+                               $number_of_active = 
(int)$calendars['total_records'];
+                               $limit = (int)$application->num_granted_events;
+
+                               $error = false;
+                               foreach ($ids as $id)
+                               {
+                                       if(in_array($id, 
$existing_calendar_ids) )
+                                       {
+                                               continue;
+                                       }
+                                       if($limit > $number_of_active)
+                                       {
+                                               $_ids[] = $id;
+                                               $number_of_active ++;
+                                       }
+                                       else
+                                       {
+                                               $error = true;
+                                               $message = lang('maximum of 
granted events are reached');
+                                               
phpgwapi_cache::message_set($message, 'error');
+                                               break;
+                                       }
+                               }
+                               if($ids && !$_ids && !$error)
+                               {
+                                       return true;
+                               }
+                       }
+                       else if ($action == 'delete' && $ids)
+                       {
+                               foreach ($ids as $id)
+                               {
+                                       $booking_id = 
createObject('eventplanner.bobooking')->get_booking_id_from_calendar($id);
+                                       $booking = 
eventplanner_sobooking::get_instance()->read_single($booking_id, true);
+                                       if(!$booking->customer_id)
+                                       {
+                                               $_ids[] = $id;
+                                       }
+                                       else
+                                       {
+                                               $message = lang('can not delete 
calendar with customer');
+                                               
phpgwapi_cache::message_set($message, 'error');
+                                       }
+                               }               
+                       }
+                       else
+                       {
+                               $_ids = $ids;
+                       }
+
+                       return 
eventplanner_socalendar::get_instance()->update_active_status($_ids, $action);
+               }
+
+               public function update_schedule( $id, $from_ )
+               {
+                       $calendar = 
eventplanner_socalendar::get_instance()->read_single($id, true);
+                       $calendar->from_ = $from_;
+                       $calendar->process_update = true;
+
+                       if($calendar->validate())
+                       {
+                               return $calendar->store();
+                       }
+                       return false;
+               }
+       }
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.bopermission.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bopermission.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bopermission.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -120,4 +120,9 @@
 
                        return $values;
                }
+
+               public function delete( $id )
+               {
+                       return 
eventplanner_sopermission::get_instance()->delete($id);
+               }
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/eventplanner/inc/class.sobooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.sobooking.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.sobooking.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -36,6 +36,8 @@
                public function __construct()
                {
                        parent::__construct('eventplanner_booking', 
eventplanner_booking::get_fields());
+                       $this->acl_location = 
eventplanner_booking::acl_location;
+                       $this->use_acl = true;
                }
 
                /**
@@ -52,7 +54,38 @@
                        return self::$so;
                }
 
+               function get_acl_condition( )
+               {
+                       if($this->relaxe_acl)
+                       {
+                               return;
+                       }
 
+                       $acl_condition = parent::get_acl_condition();
+
+                       $sql = "SELECT object_id, permission FROM 
eventplanner_permission WHERE subject_id = {$this->account}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $object_ids = array(-1);
+                       while ($this->db->next_record())
+                       {
+                               $permission = $this->db->f('permission');
+                               if($permission & PHPGW_ACL_READ)
+                               {
+                                       $object_ids[] = 
$this->db->f('object_id');
+                               }
+                       }
+
+                       if($acl_condition)
+                       {
+                               return '(' . $acl_condition . ' OR 
eventplanner_booking.customer_id IN (' . implode(',', $object_ids) . '))';
+                       }
+                       else
+                       {
+                               return 'eventplanner_booking.customer_id IN (' 
. implode(',', $object_ids) . ')';
+                       }
+
+               }
+
                protected function populate( array $data )
                {
                        $object = new eventplanner_booking();
@@ -76,11 +109,6 @@
 
                protected function update_history( $object, $fields )
                {
-       //              $status_text = eventplanner_booking::get_status_list();
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $lang_active = lang('active');
-                       $lang_inactive = lang('inactive');
-
                        $original = 
$this->read_single($object->get_id());//returned as array()
                        foreach ($fields as $field => $params)
                        {
@@ -89,29 +117,6 @@
                                if (!empty($params['history']) && $new_value && 
$old_value && ($new_value != $old_value))
                                {
                                        $label = !empty($params['label']) ? 
lang($params['label']) : $field;
-                                       switch ($field)
-                                       {
-                                               case 'status':
-                                                       $old_value = 
$status_text[$old_value];
-                                                       $new_value = 
$status_text[$new_value];
-                                                       break;
-                                               case 'active':
-                                                       $old_value = $old_value 
? $lang_active : $lang_inactive;
-                                                       $new_value = $new_value 
? $lang_active : $lang_inactive;
-                                                       break;
-                                               case 'from_':
-                                               case 'to_':
-                                                       if(($old_value + 
phpgwapi_datetime::user_timezone()) == $new_value)
-                                                       {
-                                                               continue;
-                                                       }
-
-                                                       $old_value = 
$GLOBALS['phpgw']->common->show_date($old_value);
-                                                       $new_value = 
$GLOBALS['phpgw']->common->show_date($new_value);
-                                                       break;
-                                               default:
-                                                       break;
-                                       }
                                        $value_set = array
                                        (
                                                'booking_id'    => 
$object->get_id(),
@@ -128,51 +133,11 @@
                        }
                }
 
-               public function update_active_status($ids, $action )
+               public function get_booking_id_from_calendar( $calendar_id )
                {
-                       if(!$ids || !is_array($ids))
-                       {
-                               return;
-                       }
-
-                       switch ($action)
-                       {
-                               case 'disable':
-                                       $sql = "UPDATE eventplanner_booking SET 
active = 0";
-                                       $where = 'WHERE';
-
-                                       break;
-                               case 'enable':
-                                       $sql = "UPDATE eventplanner_booking SET 
active = 1";
-                                       $where = 'WHERE';
-                                       break;
-
-                               case 'delete':
-                                       $sql = "DELETE FROM 
eventplanner_booking WHERE customer_id IS NULL";
-                                       $where = 'AND';
-                                       break;
-
-                               case 'disconnect':
-                                       $sql = "UPDATE eventplanner_booking SET"
-                                       . " customer_id = NULL,"
-                                       . " customer_contact_name = NULL,"
-                                       . " customer_contact_email = NULL,"
-                                       . " customer_contact_phone = NULL,"
-                                       . " location = NULL";
-                                       $where = 'WHERE';
-                                       break;
-
-                               default:
-                                       throw new Exception("action {$action} 
not supported");
-                                       break;
-                       }
-
-                       $sql .= " {$where} id IN(". implode(',', $ids) . ')';
-                       $this->db->transaction_begin();
-                       
+                       $sql = "SELECT id FROM eventplanner_booking WHERE 
calendar_id = " . (int) $calendar_id;
                        $this->db->query($sql,__LINE__,__FILE__);
-
-
-                       return  $this->db->transaction_commit();
+                       $this->db->next_record();
+                       return (int) $this->db->f('id');
                }
        }
\ No newline at end of file

Copied: branches/Version-2_0-branch/eventplanner/inc/class.socalendar.inc.php 
(from rev 16497, trunk/eventplanner/inc/class.socalendar.inc.php)
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.socalendar.inc.php       
                        (rev 0)
+++ branches/Version-2_0-branch/eventplanner/inc/class.socalendar.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,172 @@
+<?php
+       /**
+        * phpGroupWare - property: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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 eventplanner
+        * @subpackage calendar
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.socommon');
+
+       class eventplanner_socalendar extends phpgwapi_socommon
+       {
+
+               protected static $so;
+
+               public function __construct()
+               {
+                       parent::__construct('eventplanner_calendar', 
eventplanner_calendar::get_fields());
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('eventplanner.socalendar');
+                       }
+                       return self::$so;
+               }
+
+
+               protected function populate( array $data )
+               {
+                       $object = new eventplanner_calendar();
+                       foreach ($this->fields as $field => $field_info)
+                       {
+                               $object->set_field($field, $data[$field]);
+                       }
+
+                       return $object;
+               }
+
+               protected function update( $object )
+               {
+                       $this->db->transaction_begin();
+                       $this->update_history($object, $this->fields);
+
+                       parent::update($object);
+
+                       return  $this->db->transaction_commit();
+               }
+
+               protected function update_history( $object, $fields )
+               {
+       //              $status_text = eventplanner_calendar::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       $lang_active = lang('active');
+                       $lang_inactive = lang('inactive');
+
+                       $original = 
$this->read_single($object->get_id());//returned as array()
+                       foreach ($fields as $field => $params)
+                       {
+                               $new_value = $object->$field;
+                               $old_value = $original[$field];
+                               if (!empty($params['history']) && $new_value && 
$old_value && ($new_value != $old_value))
+                               {
+                                       $label = !empty($params['label']) ? 
lang($params['label']) : $field;
+                                       switch ($field)
+                                       {
+                                               case 'status':
+                                                       $old_value = 
$status_text[$old_value];
+                                                       $new_value = 
$status_text[$new_value];
+                                                       break;
+                                               case 'active':
+                                                       $old_value = $old_value 
? $lang_active : $lang_inactive;
+                                                       $new_value = $new_value 
? $lang_active : $lang_inactive;
+                                                       break;
+                                               case 'from_':
+                                               case 'to_':
+                                                       if(($old_value + 
phpgwapi_datetime::user_timezone()) == $new_value)
+                                                       {
+                                                               continue;
+                                                       }
+
+                                                       $old_value = 
$GLOBALS['phpgw']->common->show_date($old_value);
+                                                       $new_value = 
$GLOBALS['phpgw']->common->show_date($new_value);
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       $value_set = array
+                                       (
+                                               'calendar_id'   => 
$object->get_id(),
+                                               'time'          => time(),
+                                               'author'        => 
$GLOBALS['phpgw_info']['user']['fullname'],
+                                               'comment'       => $label . ':: 
' . lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', ' 
.lang('new value') . ': ' . $this->db->db_addslashes($new_value),
+                                               'type'  => 'history',
+                                       );
+
+                                       $this->db->query( 'INSERT INTO 
eventplanner_calendar_comment (' .  implode( ',', array_keys( $value_set ) )   
. ') VALUES ('
+                                       . $this->db->validate_insert( 
array_values( $value_set ) ) . ')',__LINE__,__FILE__);
+                               }
+
+                       }
+               }
+
+               public function update_active_status($ids, $action )
+               {
+                       if(!$ids || !is_array($ids))
+                       {
+                               return;
+                       }
+
+                       switch ($action)
+                       {
+                               case 'disable':
+                                       $sql = "UPDATE eventplanner_calendar 
SET active = 0";
+                                       $where = 'WHERE';
+
+                                       break;
+                               case 'enable':
+                                       $sql = "UPDATE eventplanner_calendar 
SET active = 1";
+                                       $where = 'WHERE';
+                                       break;
+
+                               case 'delete':
+                                       $sql = "DELETE FROM 
eventplanner_calendar WHERE customer_id IS NULL";
+                                       $where = 'AND';
+                                       break;
+
+                               case 'disconnect':
+                                       $sql = "DELETE FROM 
eventplanner_booking WHERE calendar_id IN(". implode(',', $ids) . ')';
+                                       return 
$this->db->query($sql,__LINE__,__FILE__);
+
+                               default:
+                                       throw new Exception("action {$action} 
not supported");
+                                       break;
+                       }
+
+                       $sql .= " {$where} id IN(". implode(',', $ids) . ')';
+                       $this->db->transaction_begin();
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+
+                       return  $this->db->transaction_commit();
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/eventplanner/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.sogeneric.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.sogeneric.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -35,7 +35,7 @@
                        parent::__construct($type, $type_id);
                }
 
-               public function get_location_info( $type, $type_id )
+               public function get_location_info( $type, $type_id = 0 )
                {
 
                        $type_id = (int)$type_id;

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.sopermission.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.sopermission.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.sopermission.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -66,51 +66,12 @@
 
                protected function update( $object )
                {
-                       $this->db->transaction_begin();
-       //              $status_text = 
eventplanner_permission::get_status_list();
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $lang_active = lang('active');
-                       $lang_inactive = lang('inactive');
+                       return parent::update($object);
+               }
 
-                       $original = 
$this->read_single($object->get_id());//returned as array()
-                       foreach ($this->fields as $field => $params)
-                       {
-                               $new_value = $object->$field;
-                               $old_value = $original[$field];
-                               if (!empty($params['history']) && ($new_value 
!= $old_value))
-                               {
-                                       $label = !empty($params['label']) ? 
lang($params['label']) : $field;
-                                       switch ($field)
-                                       {
-                                               case 'status':
-                                                       $old_value = 
$status_text[$old_value];
-                                                       $new_value = 
$status_text[$new_value];
-                                                       break;
-                                               case 'active':
-                                                       $old_value = $old_value 
? $lang_active : $lang_inactive;
-                                                       $new_value = $new_value 
? $lang_active : $lang_inactive;
-                                                       break;
-                                               default:
-                                                       break;
-                                       }
-                                       $value_set = array
-                                       (
-                                               'permission_id' => 
$object->get_id(),
-                                               'time'          => time(),
-                                               'author'        => 
$GLOBALS['phpgw_info']['user']['fullname'],
-                                               'comment'       => $label . ':: 
' . lang('old value') . ': ' . $this->db->db_addslashes($old_value) . ', ' 
.lang('new value') . ': ' . $this->db->db_addslashes($new_value),
-                                               'type'  => 'history',
-                                       );
-
-                                       $this->db->query( 'INSERT INTO 
eventplanner_permission_comment (' .  implode( ',', array_keys( $value_set ) )  
 . ') VALUES ('
-                                       . $this->db->validate_insert( 
array_values( $value_set ) ) . ')',__LINE__,__FILE__);
-                               }
-
-                       }
-
-                       parent::update($object);
-
-                       return  $this->db->transaction_commit();
+               public function delete( $id )
+               {
+                       return  $this->db->query( 'DELETE FROM 
eventplanner_permission WHERE id=' . (int) $id ,__LINE__,__FILE__);
                }
 
        }
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.uiapplication.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uiapplication.inc.php    
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uiapplication.inc.php    
2017-03-30 12:35:36 UTC (rev 16498)
@@ -175,7 +175,7 @@
                                )
                        );
 
-                       $data['datatable']['actions'][] = array
+/*                     $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'view',
                                'text' => lang('show'),
@@ -185,7 +185,7 @@
                                )),
                                'parameters' => json_encode($parameters)
                        );
-
+*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',
@@ -315,7 +315,7 @@
                                        'type' => 'custom',
                                        'className' => 'add',
                                        'custom_code' => "
-                                                               add_booking();"
+                                                               add_schedule();"
                                ),
                                array('my_name' => 'select_all'),
                                array('my_name' => 'select_none'),
@@ -358,9 +358,10 @@
 
                        $datatable_def[] = array(
                                'container' => 'datatable-container_1',
-                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uibooking.query_relaxed",
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uicalendar.query_relaxed",
                                        'filter_application_id' => $id,
                                        'filter_active' => 1,
+                                       'redirect'      => 'booking',
                                        'phpgw_return_as' => 'json'))),
                                'tabletools' => $tabletools,
                                'ColumnDefs' => $dates_def,

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uibooking.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -44,8 +44,6 @@
                        'edit' => true,
                        'save' => true,
                        'save_ajax' => true,
-                       'update_active_status' => true,
-                       'update_schedule'               => true
                );
                protected
                        $fields,
@@ -125,7 +123,7 @@
                                )
                        );
 
-                       $data['datatable']['actions'][] = array
+/*                     $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'view',
                                'text' => lang('show'),
@@ -135,7 +133,7 @@
                                )),
                                'parameters' => json_encode($parameters)
                        );
-
+*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',
@@ -172,9 +170,19 @@
                        else
                        {
                                $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $calendar_id = phpgw::get_var('calendar_id', 
'int');
+                               if(!$id && $calendar_id)
+                               {
+                                       $id = 
$this->bo->get_booking_id_from_calendar($calendar_id);
+                               }
                                $booking = $this->bo->read_single($id);
                        }
 
+                       if(!$calendar_id)
+                       {
+                               $calendar_id = $booking->calendar_id;
+                       }
+
                        $tabs = array();
                        $tabs['first_tab'] = array(
                                'label' => lang('booking'),
@@ -279,13 +287,9 @@
                                )
                        );
 
-                       $application = 
createObject('eventplanner.boapplication')->read_single($booking->application_id,
 true, $relaxe_acl = true);
+                       $calendar = 
createObject('eventplanner.bocalendar')->read_single($calendar_id, true, 
$relaxe_acl = true);
 
-//                     $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime', $booking->from_, array(
-//                                     'min_date' => date('Y/m/d', 
$application->date_start),
-//                                     'max_date' => date('Y/m/d', 
$application->date_end)
-//                             )
-//                     );
+                       $application = 
createObject('eventplanner.boapplication')->read_single($calendar->application_id,
 true, $relaxe_acl = true);
 
                        $application_type_list = 
execMethod('eventplanner.bogeneric.get_list', array('type' => 
'application_type'));
                        $types = (array)$application->types;
@@ -304,22 +308,24 @@
                                }
                        }
 
-                       
-                       
-                       
-                       $application_url = self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.edit", 'id' => $booking->application_id));
+                       $application_url = self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.edit", 'id' => $calendar->application_id));
                        $lang_application = lang('application');
                        if($this->currentapp == 'eventplannerfrontend')
                        {
-                               $application_url = 
self::link(array('menuaction' => "{$this->currentapp}.uievents.edit", 'id' => 
$booking->application_id));
+                               $application_url = 
self::link(array('menuaction' => "{$this->currentapp}.uievents.edit", 'id' => 
$calendar->application_id));
                                $lang_application = lang('event');
                        }
 
+                       if($booking->customer_id && !$booking->customer_name)
+                       {
+                               $booking->customer_name = 
createObject('eventplanner.bocustomer')->read_single($booking->customer_id)->name;
+                       }
 
                        $data = array(
                                'datatable_def' => $datatable_def,
-                               'form_action' => self::link(array('menuaction' 
=> "{$this->currentapp}.uibooking.save")),
+                               'form_action' => self::link(array('menuaction' 
=> "{$this->currentapp}.uibooking.save", 'calendar_id' => $calendar_id)),
                                'cancel_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uibooking.index",)),
+                               'calendar'      =>$calendar,
                                'booking' => $booking,
                                'application' => $application,
                                'application_type_list' => 
$application_type_list,
@@ -346,53 +352,4 @@
                {
                        return parent::save(true);
                }
-
-               public function update_active_status()
-               {
-                       $ids = phpgw::get_var('ids', 'int');
-                       $action = phpgw::get_var('action', 'string');
-
-                       if ($this->bo->update_active_status($ids, $action))
-                       {
-                               return array(
-                                       'status_kode' => 'ok',
-                                       'status' => lang('ok'),
-                                       'msg' => lang('messages_saved_form')
-                               );
-                       }
-                       else
-                       {
-                               $messages = phpgwapi_cache::message_get(true);
-                               return array(
-                                       'status_kode' => 'error',
-                                       'status' => lang('error'),
-                                       'msg' => $messages ? $messages : 
lang('did not validate')
-                               );
-                       }
-               }
-
-               public function update_schedule( )
-               {
-                       $id = phpgw::get_var('id', 'int');
-                       $from_ = phpgw::get_var('from_', 'date');
-                       if ($this->bo->update_schedule($id, $from_))
-                       {
-                               return array(
-                                       'status_kode' => 'ok',
-                                       'status' => lang('ok'),
-                                       'msg' => lang('messages_saved_form')
-                               );
-                       }
-                       else
-                       {
-                               $messages = phpgwapi_cache::message_get(true);
-                               return array
-                               (
-                                       'status_kode' => 'error',
-                                       'status' => lang('error'),
-                                       'msg' => $messages ? $messages : 
lang('did not validate')
-                               );
-                       }
-
-               }
        }
\ No newline at end of file

Copied: branches/Version-2_0-branch/eventplanner/inc/class.uicalendar.inc.php 
(from rev 16497, trunk/eventplanner/inc/class.uicalendar.inc.php)
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uicalendar.inc.php       
                        (rev 0)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uicalendar.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,420 @@
+<?php
+       /**
+        * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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 calendar was funded by 
http://www.bergen.kommune.no/
+        * @package eventplanner
+        * @subpackage calendar
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.uicommon');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('eventplanner', 'calendar', 'inc/model/');
+
+       class eventplanner_uicalendar extends phpgwapi_uicommon
+       {
+
+               public $public_functions = array(
+                       'add' => true,
+                       'index' => true,
+                       'query' => true,
+                       'query_relaxed'=> true,
+                       'get_list'=> true,
+                       'view' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'save_ajax' => true,
+                       'update_active_status' => true,
+                       'update_schedule'               => true
+               );
+               protected
+                       $fields,
+                       $permissions,
+                       $currentapp;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('calendar');
+                       $this->bo = createObject('eventplanner.bocalendar');
+                       $this->fields = eventplanner_calendar::get_fields();
+                       $this->permissions = 
eventplanner_calendar::get_instance()->get_permission_array();
+                       $this->currentapp = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       self::set_active_menu("{$this->currentapp}::calendar");
+               }
+
+               public function index()
+               {
+                       if (empty($this->permissions[PHPGW_ACL_READ]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+
+                       $function_msg = lang('calendar');
+
+                       $data = array(
+                               'datatable_name' => $function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array(
+                                                               'type' => 
'autocomplete',
+                                                               'name' => 
'application',
+                                                               'app' => 
$this->currentapp,
+                                                               'ui' => 
'application',
+                                                               'function' => 
'get_list',
+                                                               'label_attr' => 
'title',
+                                                               'text' => 
lang('application') . ':',
+                                                               
'requestGenerator' => 'requestWithApplicationFilter'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'checkbox',
+                                                               'name' => 
'filter_active',
+                                                               'text' => 
lang('showall'),
+                                                               'value' => 1,
+                                                               'checked' => 1,
+                                                       )
+                                               )
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
"{$this->currentapp}.uicalendar.index",
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                       //              'new_item' => 
self::link(array('menuaction' => 'eventplanner.uicalendar.add')),
+                                       'editor_action' => '',
+                                       'field' => parent::_get_fields()
+                               )
+                       );
+
+                       $parameters = array(
+                               'parameter' => array(
+                                       array(
+                                               'name' => 'id',
+                                               'source' => 'id'
+                                       )
+                               )
+                       );
+
+/*                     $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'view',
+                               'text' => lang('show'),
+                               'action' => self::link(array
+                                       (
+                                       'menuaction' => 
"{$this->currentapp}.uicalendar.view"
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+*/
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => self::link(array
+                                       (
+                                       'menuaction' => 
"{$this->currentapp}.uicalendar.edit"
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       self::add_javascript($this->currentapp, 'portico', 
'calendar.index.js');
+                       phpgwapi_jquery::load_widget('numberformat');
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+               /*
+                * Edit the price item with the id given in the http variable 
'id'
+                */
+
+               public function edit( $values = array(), $mode = 'edit' )
+               {
+                       $active_tab = !empty($values['active_tab']) ? 
$values['active_tab'] : phpgw::get_var('active_tab', 'string', 'REQUEST', 
'first_tab');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('edit');
+                       if (empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       if (!empty($values['object']))
+                       {
+                               $calendar = $values['object'];
+                       }
+                       else
+                       {
+                               $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $calendar = $this->bo->read_single($id);
+                       }
+
+                       $tabs = array();
+                       $tabs['first_tab'] = array(
+                               'label' => lang('calendar'),
+                               'link' => '#first_tab',
+                               'function' => "set_tab('first_tab')"
+                       );
+                       $tabs['reports'] = array(
+                               'label' => lang('reports'),
+                               'link' => '#reports',
+                               'function' => "set_tab('reports')"
+                       );
+
+                       $bocommon = CreateObject('property.bocommon');
+
+                       $comments = (array)$calendar->comments;
+                       foreach ($comments as $key => &$comment)
+                       {
+                               $comment['value_count'] = $key +1;
+                               $comment['value_date'] = 
$GLOBALS['phpgw']->common->show_date($comment['time']);
+                       }
+
+                       $comments_def = array(
+                               array('key' => 'value_count', 'label' => '#', 
'sortable' => true, 'resizeable' => true),
+                               array('key' => 'value_date', 'label' => 
lang('Date'), 'sortable' => true, 'resizeable' => true),
+                               array('key' => 'author', 'label' => 
lang('User'), 'sortable' => true, 'resizeable' => true),
+                               array('key' => 'comment', 'label' => 
lang('Note'), 'sortable' => true, 'resizeable' => true)
+                       );
+
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_0',
+                               'requestUrl' => "''",
+                               'ColumnDefs' => $comments_def,
+                               'data' => json_encode($comments),
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $vendor_report_def = array(
+                               array('key' => 'id', 'label' => lang('id'), 
'sortable' => true, 'resizeable' => true,'formatter' => 
'JqueryPortico.formatLink'),
+                               array('key' => 'created', 'label' => 
lang('Date'), 'sortable' => true, 'resizeable' => true),
+                       );
+
+                       $vendor_report = array();
+
+                       $tabletools = array(
+                               array(
+                                       'my_name' => 'add',
+                                       'text' => lang('add'),
+                                       'type' => 'custom',
+                                       'className' => 'add',
+                                       'custom_code' => "
+                                                               
add_report('vendor');"
+                               )
+                       );
+
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_1',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uivendor_report.query",
+                                       'filter_calendar_id' => $id,
+                                       'filter_active' => 1,
+                                       'phpgw_return_as' => 'json'))),
+                               'ColumnDefs' => $vendor_report_def,
+                               'data' => json_encode($vendor_report),
+                               'tabletools' => $tabletools,
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $customer_report_def = array(
+                               array('key' => 'id', 'label' => lang('id'), 
'sortable' => true, 'resizeable' => true,'formatter' => 
'JqueryPortico.formatLink'),
+                               array('key' => 'created', 'label' => 
lang('Date'), 'sortable' => true, 'resizeable' => true),
+                       );
+
+                       $customer_report = array();
+                       $tabletools = array(
+                               array(
+                                       'my_name' => 'add',
+                                       'text' => lang('add'),
+                                       'type' => 'custom',
+                                       'className' => 'add',
+                                       'custom_code' => "
+                                                               
add_report('customer');"
+                               )
+                       );
+                       $datatable_def[] = array(
+                               'container' => 'datatable-container_2',
+//                             'requestUrl' => 
json_encode(self::link(array('menuaction' => 
"{$this->currentapp}.uicustomer_report.query",
+//                                     'filter_calendar_id' => $id,
+//                                     'filter_active' => 1,
+//                                     'phpgw_return_as' => 'json'))),
+                               'requestUrl' => "''",
+                               'ColumnDefs' => $customer_report_def,
+                               'data' => json_encode($customer_report),
+                               'tabletools' => $tabletools,
+                               'config' => array(
+                                       array('disableFilter' => true),
+                                       array('disablePagination' => true)
+                               )
+                       );
+
+                       $application = 
createObject('eventplanner.boapplication')->read_single($calendar->application_id,
 true, $relaxe_acl = true);
+
+//                     $GLOBALS['phpgw']->jqcal2->add_listener('from_', 
'datetime', $calendar->from_, array(
+//                                     'min_date' => date('Y/m/d', 
$application->date_start),
+//                                     'max_date' => date('Y/m/d', 
$application->date_end)
+//                             )
+//                     );
+
+                       $application_type_list = 
execMethod('eventplanner.bogeneric.get_list', array('type' => 
'application_type'));
+                       $types = (array)$application->types;
+                       if($types)
+                       {
+                               foreach ($application_type_list as 
&$application_type)
+                               {
+                                       foreach ($types as $type)
+                                       {
+                                               if((!empty($type['type_id']) && 
$type['type_id'] == $application_type['id']) || ($type == 
$application_type['id']))
+                                               {
+                                                       
$application_type['selected'] = 1;
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+
+                       
+                       
+                       
+                       $application_url = self::link(array('menuaction' => 
"{$this->currentapp}.uiapplication.edit", 'id' => $calendar->application_id));
+                       $lang_application = lang('application');
+                       if($this->currentapp == 'eventplannerfrontend')
+                       {
+                               $application_url = 
self::link(array('menuaction' => "{$this->currentapp}.uievents.edit", 'id' => 
$calendar->application_id));
+                               $lang_application = lang('event');
+                       }
+
+
+                       $data = array(
+                               'datatable_def' => $datatable_def,
+                               'form_action' => self::link(array('menuaction' 
=> "{$this->currentapp}.uicalendar.save")),
+                               'cancel_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uicalendar.index",)),
+                               'calendar' => $calendar,
+                               'application' => $application,
+                               'application_type_list' => 
$application_type_list,
+                               'new_customer_url' => 
self::link(array('menuaction' => "{$this->currentapp}.uicustomer.add")),
+                               'application_url' => $application_url,
+                               'lang_application' => $lang_application,
+                               'customer_url' => self::link(array('menuaction' 
=> "{$this->currentapp}.uicustomer.edit", 'id' => $calendar->customer_id)),
+                               'mode' => $mode,
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_active_tab' => $active_tab
+                       );
+                       phpgwapi_jquery::formvalidator_generate(array());
+                       self::add_javascript($this->currentapp, 'portico', 
'calendar.edit.js');
+                       phpgwapi_jquery::load_widget('autocomplete');
+                       self::render_template_xsl(array('calendar', 
'datatable_inline'), array($mode => $data));
+               }
+
+               public function save()
+               {
+                       parent::save();
+               }
+
+               public function save_ajax()
+               {
+                       return parent::save(true);
+               }
+
+               public function update_active_status()
+               {
+                       $ids = phpgw::get_var('ids', 'int');
+                       $action = phpgw::get_var('action', 'string');
+
+                       if ($this->bo->update_active_status($ids, $action))
+                       {
+                               return array(
+                                       'status_kode' => 'ok',
+                                       'status' => lang('ok'),
+                                       'msg' => lang('messages_saved_form')
+                               );
+                       }
+                       else
+                       {
+                               $messages = phpgwapi_cache::message_get(true);
+                               return array(
+                                       'status_kode' => 'error',
+                                       'status' => lang('error'),
+                                       'msg' => $messages ? $messages : 
lang('did not validate')
+                               );
+                       }
+               }
+
+               public function update_schedule( )
+               {
+                       $id = phpgw::get_var('id', 'int');
+                       $from_ = phpgw::get_var('from_', 'date');
+                       if ($this->bo->update_schedule($id, $from_))
+                       {
+                               return array(
+                                       'status_kode' => 'ok',
+                                       'status' => lang('ok'),
+                                       'msg' => lang('messages_saved_form')
+                               );
+                       }
+                       else
+                       {
+                               $messages = phpgwapi_cache::message_get(true);
+                               return array
+                               (
+                                       'status_kode' => 'error',
+                                       'status' => lang('error'),
+                                       'msg' => $messages ? $messages : 
lang('did not validate')
+                               );
+                       }
+
+               }
+
+               public function query()
+               {
+                       $params = $this->bo->build_default_read_params();
+                       $values = $this->bo->read($params);
+                       $redirect = phpgw::get_var('redirect');
+                       if($redirect == 'booking')
+                       {
+                               array_walk($values["results"], array($this, 
"_add_links2"), "{$this->currentapp}.uibooking.edit");
+                       }
+                       else
+                       {
+                               array_walk($values["results"], array($this, 
"_add_links"), "{$this->currentapp}.uicalendar.edit");
+                       }
+                       return $this->jquery_results($values);
+               }
+
+               public function _add_links2( &$value, $key, $data )
+               {
+                       $link_array = array('menuaction' => $data, 
'calendar_id' => $value['id']);
+                       $value['link'] = self::link($link_array);
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uicustomer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uicustomer.inc.php       
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uicustomer.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -139,7 +139,7 @@
                                )
                        );
 
-                       $data['datatable']['actions'][] = array
+/*                     $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'view',
                                'text' => lang('show'),
@@ -149,7 +149,7 @@
                                )),
                                'parameters' => json_encode($parameters)
                        );
-
+*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.uicustomer_report.inc.php
===================================================================
--- 
branches/Version-2_0-branch/eventplanner/inc/class.uicustomer_report.inc.php    
    2017-03-30 12:34:00 UTC (rev 16497)
+++ 
branches/Version-2_0-branch/eventplanner/inc/class.uicustomer_report.inc.php    
    2017-03-30 12:35:36 UTC (rev 16498)
@@ -131,7 +131,7 @@
                                )
                        );
 
-                       $data['datatable']['actions'][] = array
+/*                     $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'view',
                                'text' => lang('show'),
@@ -141,7 +141,7 @@
                                )),
                                'parameters' => json_encode($parameters)
                        );
-
+*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.uipermission.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uipermission.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uipermission.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -41,7 +41,8 @@
                        'view' => true,
                        'edit' => true,
                        'save' => true,
-                       'object'        => true
+                       'object'        => true,
+                       'delete'        => true
                );
 
                protected
@@ -136,6 +137,23 @@
                                'parameters' => json_encode($parameters)
                        );
 
+                       if (!empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               $data['datatable']['actions'][] = array
+                                       (
+                                       'my_name' => 'delete',
+                                       'statustext' => lang('delete entry'),
+                                       'text' => lang('delete'),
+                                       'confirm_msg' => lang('do you really 
want to delete this entry'),
+                                       'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                               'menuaction' => 
'eventplanner.uipermission.delete'
+                                       )),
+                                       'parameters' => json_encode($parameters)
+                               );
+
+                       }
+
                        self::add_javascript('eventplanner', 'portico', 
'permission.index.js');
                        phpgwapi_jquery::load_widget('numberformat');
 
@@ -142,6 +160,23 @@
                        self::render_template_xsl('datatable_jquery', $data);
                }
 
+               function delete()
+               {
+                       if (empty($this->permissions[PHPGW_ACL_DELETE]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       $id = phpgw::get_var('id', 'int');
+                       if ($this->bo->delete($id))
+                       {
+                               return lang('entry %1 has been deleted', $id);
+                       }
+                       else
+                       {
+                               return lang('delete failed');
+                       }
+               }
                /*
                 * Edit the price item with the id given in the http variable 
'id'
                 */

Modified: branches/Version-2_0-branch/eventplanner/inc/class.uivendor.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uivendor.inc.php 
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uivendor.inc.php 
2017-03-30 12:35:36 UTC (rev 16498)
@@ -140,7 +140,7 @@
                                )
                        );
 
-                       $data['datatable']['actions'][] = array
+/*                     $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'view',
                                'text' => lang('show'),
@@ -150,7 +150,7 @@
                                )),
                                'parameters' => json_encode($parameters)
                        );
-
+*/
                        $data['datatable']['actions'][] = array
                                (
                                'my_name' => 'edit',

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.booking.inc.php    
2017-03-30 12:35:36 UTC (rev 16498)
@@ -37,7 +37,7 @@
                const STATUS_PENDING = 2;
                const STATUS_REJECTED = 3;
                const STATUS_APPROVED = 4;
-               const acl_location = '.booking';
+               const acl_location = '.customer';
 
                protected
                        $id,
@@ -47,8 +47,7 @@
                        $cost,
                        $from_,
                        $to_,
-                       $application_id,
-                       $application_name,
+                       $calendar_id,
                        $vendor_name,
                        $customer_id,
                        $customer_name,
@@ -61,7 +60,7 @@
                        $created,
                        $secret,
                        $process_update;
-               protected $field_of_responsibility_name = '.booking';
+               protected $field_of_responsibility_name = '.customer';
 
                public function __construct( int $id = null )
                {
@@ -99,55 +98,54 @@
                                        'formatter' => 
'JqueryPortico.formatLink',
                                        'public' => true
                                ),
-                               'owner_id' => array('action' => PHPGW_ACL_ADD,
+                               'calendar_id' => array('action' => 
PHPGW_ACL_ADD,
                                        'type' => 'int',
                                        'required' => false
                                ),
-                               'active' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                               'owner_id' => array('action' => PHPGW_ACL_ADD,
                                        'type' => 'int',
-                                       'public' => true,
-                                       'history' => true
+                                       'required' => false
                                ),
-                               'completed' => array('action' => PHPGW_ACL_EDIT,
-                                       'type' => 'int',
-                                       'history' => true
-                               ),
-                               'cost' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
-                                       'type' => 'decimal'
-                               ),
-                               'from_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
-                                       'type' => 'date',
+                               'from_' => array('action' => PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
                                        'label' => 'from',
-                                       'history' => true,
-                                       'required' => true,
-                                       'public' => true
+                                       'public' => true,
+                                       'join' => array(
+                                               'table' => 
'eventplanner_calendar',
+                                               'fkey' => 'calendar_id',
+                                               'key' => 'id',
+                                               'column' => 'from_'
+                                       )
                                ),
-                               'to_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
-                                       'type' => 'date',
+                               'to_' => array('action' => PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
                                        'label' => 'to',
-                                       'history' => true,
-                                       'required' => true,
-                                       'public' => true
+                                       'public' => true,
+                                       'join' => array(
+                                               'table' => 
'eventplanner_calendar',
+                                               'fkey' => 'calendar_id',
+                                               'key' => 'id',
+                                               'column' => 'to_'
+                                       )
                                ),
-                               'application_id' => array('action' => 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
-                                       'type' => 'int',
-                                       'label' => 'application',
-                                       'sortable' => true,
-                                       'required' => true,
-                                       'public' => true
-                               ),
-                               'application_name' => array('action' => 
PHPGW_ACL_READ,
+                               'active' => array('action' => PHPGW_ACL_READ,
                                        'type' => 'string',
                                        'query' => true,
-                                       'label' => 'application',
+                                       'label' => 'active',
                                        'public' => true,
                                        'join' => array(
-                                               'table' => 
'eventplanner_application',
-                                               'fkey' => 'application_id',
+                                               'table' => 
'eventplanner_calendar',
+                                               'fkey' => 'calendar_id',
                                                'key' => 'id',
-                                               'column' => 'title'
+                                               'column' => 'active'
                                        )
                                ),
+                               'completed' => array('action' => PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'history' => true
+                               ),
                                'vendor_name' => array('action' => 
PHPGW_ACL_READ,
                                        'type' => 'string',
                                        'query' => true,
@@ -154,8 +152,9 @@
                                        'label' => 'vendor',
                                        'public' => true,
                                        'multiple_join' => array(
-                                               'statement' => 'LEFT JOIN 
eventplanner_application ON eventplanner_application.id = 
eventplanner_booking.application_id'
-                                               . ' LEFT JOIN 
eventplanner_vendor ON eventplanner_application.vendor_id = 
eventplanner_vendor.id',
+                                               'statement' => ' JOIN 
eventplanner_calendar ON eventplanner_calendar.id = 
eventplanner_booking.calendar_id'
+                                               . ' JOIN 
eventplanner_application ON eventplanner_application.id = 
eventplanner_calendar.application_id'
+                                               . ' JOIN eventplanner_vendor ON 
eventplanner_application.vendor_id = eventplanner_vendor.id',
                                                'column' => 
'eventplanner_vendor.name'
                                        )
                                ),
@@ -291,26 +290,12 @@
 
                protected function doValidate( $entity, &$errors )
                {
-                       $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id);
                        $params = array();
                        $params['filters']['active'] = 1;
-                       $params['filters']['application_id'] = 
$entity->application_id;
+                       $params['filters']['customer_id'] = 
$entity->customer_id;
 
                        $bookings = 
eventplanner_sobooking::get_instance()->read($params);
 
-                       foreach ($bookings['results'] as $booking)
-                       {
-                               if ($booking['id'] == $entity->get_id())
-                               {
-                                       continue;
-                               }
-
-                               if (($entity->from_ > $booking['from_'] && 
$entity->from_ < $booking['to_']) || ($entity->to_ > $booking['from_'] && 
$entity->to_ < $booking['to_']))
-                               {
-                                       $errors['from_'] = lang('Time is 
already booked');
-                               }
-                       }
-
                        $orig_customer_id = 0;
                        if ($entity->get_id())
                        {
@@ -318,27 +303,24 @@
                                $orig_customer_id = $orig_booking->customer_id;
                        }
 
-                       $number_of_customer_bookings = 0;
+                       $test_total_tecords = 0;
                        if ($entity->customer_id && $entity->customer_id != 
$orig_customer_id)
                        {
+                               $last_booking = 
(int)phpgwapi_cache::system_get('eventplanner', 
"last_booking{$entity->customer_id}");
                                $config = CreateObject('phpgwapi.config', 
'eventplanner')->read();
                                $booking_interval = 
!empty($config['booking_interval']) ? (int)$config['booking_interval'] : 0;
+
+                               $current_interval = floor((time() - 
$last_booking ) / (60 * 60));
+
+                               if ($last_booking && $booking_interval && 
$current_interval < $booking_interval)
+                               {
+                                       $errors['booking_interval'] = 
lang('There is a minimum interval of %1 hours', $booking_interval);
+                               }
+
                                $customer = 
createObject('eventplanner.bocustomer')->read_single($entity->customer_id);
                                $max_events = (int)$customer->max_events;
                                foreach ($bookings['results'] as $booking)
                                {
-                                       $current_interval = 0;
-
-                                       if ($booking['customer_id'] == 
$entity->customer_id)
-                                       {
-                                               $current_interval = 
floor(abs(($booking['from_'] - $entity->from_)) / (60 * 60 * 24));
-                                       }
-
-                                       if ($booking_interval && 
$current_interval && $current_interval < $booking_interval)
-                                       {
-                                               $errors['booking_interval'] = 
lang('There is a minimum interval of %1 day(s)', $booking_interval);
-                                       }
-
                                        $booking_year = date('Y', 
$booking['from_']);
 
                                        if ($booking_year != date('Y', 
$entity->from_))
@@ -345,41 +327,22 @@
                                        {
                                                continue;
                                        }
+                                       $test_total_tecords ++;
+                               }
 
-                                       if ($booking['customer_id'] == 
$entity->customer_id)
-                                       {
-                                               $number_of_customer_bookings ++;
-                                       }
+                               if ($entity->customer_id || 
$entity->process_update) // update
+                               {
                                }
+                               else // new entry
+                               {
+                                       $test_total_tecords ++;
+                               }
 
-                               if ($max_events && $number_of_customer_bookings 
>= $max_events)
+                               if ($test_total_tecords > (int)$max_events)
                                {
                                        $errors['num_granted_events_year'] = 
lang('maximum of granted events per year (%1) are reached', $max_events);
                                }
                        }
-
-                       if ($entity->customer_id || $entity->process_update) // 
update
-                       {
-                               $test_total_tecords = 
(int)$bookings['total_records'];
-                       }
-                       else // new entry
-                       {
-                               $test_total_tecords = 
(int)$bookings['total_records'] + 1;
-                       }
-
-                       if ($test_total_tecords > 
(int)$application->num_granted_events)
-                       {
-                               $errors['num_granted_events'] = lang('maximum 
of granted events are reached');
-                       }
-
-                       $date_start = date('Ymd', $application->date_start);
-                       $date_end = date('Ymd', $application->date_end);
-                       $from_ = date('Ymd', $entity->from_);
-
-                       if ($from_ < $date_start || $from_ > $date_end)
-                       {
-                               $errors['from_'] = lang('date is outside the 
scope');
-                       }
                }
 
                protected function generate_secret( $length = 10 )

Copied: 
branches/Version-2_0-branch/eventplanner/inc/model/class.calendar.inc.php (from 
rev 16497, trunk/eventplanner/inc/model/class.calendar.inc.php)
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.calendar.inc.php   
                        (rev 0)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.calendar.inc.php   
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,308 @@
+<?php
+       /**
+        * phpGroupWare - eventplanner: a part of a Facilities Management 
System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2016 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 eventplanner
+        * @subpackage calendar
+        * @version $Id: $
+        */
+       phpgw::import_class('eventplanner.bocalendar');
+
+       include_class('phpgwapi', 'model', 'inc/model/');
+
+       class eventplanner_calendar extends phpgwapi_model
+       {
+
+               const STATUS_REGISTERED = 1;
+               const STATUS_PENDING = 2;
+               const STATUS_REJECTED = 3;
+               const STATUS_APPROVED = 4;
+               const acl_location = '.calendar';
+
+               protected
+                       $id,
+                       $owner_id,
+                       $active,
+                       $completed,
+                       $cost,
+                       $from_,
+                       $to_,
+                       $application_id,
+                       $application_name,
+                       $vendor_name,
+                       $customer_id,
+                       $customer_name,
+                       $customer_contact_name,
+                       $customer_contact_email,
+                       $customer_contact_phone,
+                       $location,
+                       $comments,
+                       $comment,
+                       $created,
+                       $secret,
+                       $process_update;
+               protected $field_of_responsibility_name = '.calendar';
+
+               public function __construct( int $id = null )
+               {
+                       parent::__construct((int)$id);
+                       $this->field_of_responsibility_name = 
self::acl_location;
+               }
+
+               /**
+                * Implementing classes must return an instance of itself.
+                *
+                * @return the class instance.
+                */
+               public static function get_instance()
+               {
+                       return new eventplanner_calendar();
+               }
+
+               public static function get_status_list()
+               {
+                       return array(
+                               self::STATUS_REGISTERED => lang('registered'),
+                               self::STATUS_PENDING => lang('pending'),
+                               self::STATUS_REJECTED => lang('rejected'),
+                               self::STATUS_APPROVED => lang('approved')
+                       );
+               }
+
+               public static function get_fields( $debug = true )
+               {
+                       $fields = array(
+                               'id' => array('action' => PHPGW_ACL_READ,
+                                       'type' => 'int',
+                                       'label' => 'id',
+                                       'sortable' => true,
+                                       'formatter' => 
'JqueryPortico.formatLink',
+                                       'public' => true
+                               ),
+                               'owner_id' => array('action' => PHPGW_ACL_ADD,
+                                       'type' => 'int',
+                                       'required' => false
+                               ),
+                               'active' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'public' => true,
+                                       'history' => true
+                               ),
+                               'completed' => array('action' => PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'history' => true
+                               ),
+                               'cost' => array('action' => PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'decimal'
+                               ),
+                               'from_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'from',
+                                       'history' => true,
+                                       'required' => true,
+                                       'public' => true
+                               ),
+                               'to_' => array('action' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'to',
+                                       'history' => true,
+                                       'required' => true,
+                                       'public' => true
+                               ),
+                               'application_id' => array('action' => 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'label' => 'application',
+                                       'sortable' => true,
+                                       'required' => true,
+                                       'public' => true
+                               ),
+                               'application_name' => array('action' => 
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'application',
+                                       'public' => true,
+                                       'join' => array(
+                                               'table' => 
'eventplanner_application',
+                                               'fkey' => 'application_id',
+                                               'key' => 'id',
+                                               'column' => 'title'
+                                       )
+                               ),
+                               'location' => array('action' => PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'location',
+                                       'public' => true,
+                                       'join' => array(
+                                               'table' => 
'eventplanner_booking',
+                                               'fkey' => 'id',
+                                               'key' => 'calendar_id',
+                                               'column' => 'location'
+                                       )
+                               ),
+                               'vendor_name' => array('action' => 
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'vendor',
+                                       'public' => true,
+                                       'multiple_join' => array(
+                                               'statement' => 'LEFT JOIN 
eventplanner_application ON eventplanner_application.id = 
eventplanner_calendar.application_id'
+                                               . ' LEFT JOIN 
eventplanner_vendor ON eventplanner_application.vendor_id = 
eventplanner_vendor.id',
+                                               'column' => 
'eventplanner_vendor.name'
+                                       )
+                               ),
+                               'customer_name' => array('action' => 
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'customer',
+                                       'public' => true,
+                                       'multiple_join' => array(
+                                               'statement' => 'LEFT JOIN 
eventplanner_booking ON eventplanner_booking.calendar_id = 
eventplanner_calendar.id'
+                                               . ' LEFT JOIN 
eventplanner_customer ON eventplanner_booking.customer_id = 
eventplanner_customer.id',
+                                               'column' => 
'eventplanner_customer.name'
+                                       )
+                               ),
+                               'created' => array('action' => PHPGW_ACL_READ,
+                                       'type' => 'date',
+                                       'label' => 'created',
+                                       'sortable' => true,
+                               )
+                       );
+
+                       if ($debug)
+                       {
+                               foreach ($fields as $field => $field_info)
+                               {
+                                       if 
(!property_exists('eventplanner_calendar', $field))
+                                       {
+                                               phpgwapi_cache::message_set('$' 
. "{$field},", 'error');
+                                       }
+                               }
+                       }
+                       return $fields;
+               }
+
+               /**
+                * Implement in subclasses to perform actions on entity before 
validation
+                */
+               protected function preValidate( &$entity )
+               {
+                       if (!empty($entity->comment))
+                       {
+                               $entity->comment_input = array(
+                                       'time' => time(),
+                                       'author' => 
$GLOBALS['phpgw_info']['user']['fullname'],
+                                       'comment' => $entity->comment,
+                                       'type' => 'comment'
+                               );
+                       }
+
+                       if (!$entity->get_id())
+                       {
+                               $entity->status = 
eventplanner_calendar::STATUS_REGISTERED;
+                               $entity->secret = self::generate_secret();
+                               $entity->owner_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       }
+
+                       if (empty($entity->completed))
+                       {
+                               $entity->completed = 0;
+                       }
+
+                       if (!empty($entity->application_id))
+                       {
+                               $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id,
 true, $relaxe_acl = true);
+                               $entity->to_ = $entity->from_ + 
((int)$application->timespan * 60);
+                       }
+
+                       $entity->modified = time();
+                       $entity->active = (int)$entity->active;
+               }
+
+               protected function doValidate( $entity, &$errors )
+               {
+                       $application = 
createObject('eventplanner.boapplication')->read_single($entity->application_id);
+                       $params = array();
+                       $params['filters']['active'] = 1;
+                       $params['filters']['application_id'] = 
$entity->application_id;
+
+                       $calendars = 
eventplanner_socalendar::get_instance()->read($params);
+
+                       foreach ($calendars['results'] as $calendar)
+                       {
+                               if ($calendar['id'] == $entity->get_id())
+                               {
+                                       continue;
+                               }
+
+                               if (($entity->from_ > $calendar['from_'] && 
$entity->from_ < $calendar['to_']) || ($entity->to_ > $calendar['from_'] && 
$entity->to_ < $calendar['to_']))
+                               {
+                                       $errors['from_'] = lang('Time is 
already booked');
+                               }
+                       }
+
+
+                       if ($entity->get_id()) // update
+                       {
+                               $test_total_tecords = 
(int)$calendars['total_records'];
+                       }
+                       else // new entry
+                       {
+                               $test_total_tecords = 
(int)$calendars['total_records'] + 1;
+                       }
+
+                       if ($test_total_tecords > 
(int)$application->num_granted_events)
+                       {
+                               $errors['num_granted_events'] = lang('maximum 
of granted events are reached');
+                       }
+
+                       $date_start = date('Ymd', $application->date_start);
+                       $date_end = date('Ymd', $application->date_end);
+                       $from_ = date('Ymd', $entity->from_);
+
+                       if ($from_ < $date_start || $from_ > $date_end)
+                       {
+                               $errors['from_'] = lang('date is outside the 
scope');
+                       }
+               }
+
+               protected function generate_secret( $length = 10 )
+               {
+                       return substr(base64_encode(rand(1000000000, 
9999999999)), 0, $length);
+               }
+
+               public function serialize()
+               {
+                       return self::toArray();
+               }
+
+               public function store()
+               {
+                       return 
eventplanner_bocalendar::get_instance()->store($this);
+               }
+
+               public function read_single( $id )
+               {
+                       return 
eventplanner_bocalendar::get_instance()->read_single($id, true);
+               }
+       }
\ No newline at end of file

Modified: 
branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php   
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/inc/model/class.customer.inc.php   
2017-03-30 12:35:36 UTC (rev 16498)
@@ -114,12 +114,12 @@
                                'category_id' => array('action'=>  
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
                                        'type' => 'int'
                                        ),
-                               'created' => array('action'=> PHPGW_ACL_READ,
+/*                             'created' => array('action'=> PHPGW_ACL_READ,
                                        'type' => 'date',
                                        'label' => 'created',
                                        'sortable' => true,
-                                       ),
-                               'modified' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_EDIT,
+                                       ),*/
+                               'modified' => array('action'=>  PHPGW_ACL_EDIT,
                                        'type' => 'date',
                                        'label' => 'modified',
                                        'sortable' => true,

Modified: 
branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js
===================================================================
--- branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/js/portico/application.edit.js     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -260,7 +260,7 @@
        $("#stage_size").val(total_size);
 }
 
-add_booking = function ()
+add_schedule = function ()
 {
        var from_ = $("#from_").val();
        if (!from_)
@@ -269,7 +269,7 @@
        }
 
        oArgs = {
-               menuaction: 'eventplanner.uibooking.save_ajax',
+               menuaction: 'eventplanner.uicalendar.save_ajax',
                application_id: $("#application_id").val()
        };
 
@@ -319,7 +319,7 @@
        {
                return;
        }
-       oArgs = {menuaction: 'eventplanner.uibooking.update_schedule'};
+       oArgs = {menuaction: 'eventplanner.uicalendar.update_schedule'};
 
        var requestUrl = phpGWLink('index.php', oArgs, true);
        var htmlString = '';
@@ -364,7 +364,7 @@
        $("#receipt").html("");
        if (action === 'add')
        {
-               add_booking();
+               add_schedule();
                return;
        }
 
@@ -400,7 +400,7 @@
        {
                var data = {"ids": ids, "action": action, from_: 
$("#from_").val()};
 
-               oArgs = {menuaction: 
'eventplanner.uibooking.update_active_status'};
+               oArgs = {menuaction: 
'eventplanner.uicalendar.update_active_status'};
 
                var requestUrl = phpGWLink('index.php', oArgs, true);
 

Modified: branches/Version-2_0-branch/eventplanner/setup/default_records.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/default_records.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/setup/default_records.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -20,6 +20,7 @@
        $GLOBALS['phpgw']->locations->add('.events', 'events', 'eventplanner', 
$allow_grant = true, $custom_tbl = '', $c_function = true);
        $GLOBALS['phpgw']->locations->add('.customer', 'customer', 
'eventplanner', $allow_grant = true, $custom_tbl = '', $c_function = true);
        $GLOBALS['phpgw']->locations->add('.vendor', 'vendor', 'eventplanner', 
$allow_grant = true, $custom_tbl = '', $c_function = true);
+       $GLOBALS['phpgw']->locations->add('.calendar', 'calendar', 
'eventplanner', $allow_grant = true);
        $GLOBALS['phpgw']->locations->add('.booking', 'booking', 
'eventplanner', $allow_grant = true, $custom_tbl = '', $c_function = true);
        $GLOBALS['phpgw']->locations->add('.vendor_report', 'vendor_report', 
'eventplanner', $allow_grant = true, $custom_tbl = '', $c_function = true, 
$c_attrib = true);
        $GLOBALS['phpgw']->locations->add('.customer_report', 
'customer_report', 'eventplanner', $allow_grant = true, $custom_tbl = '', 
$c_function = true, $c_attrib = true);

Modified: branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/setup/phpgw_no.lang        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -32,6 +32,7 @@
 contact name   eventplanner    no      Navn kontaktperson
 contact email  eventplanner    no      Epost kontaktperson
 contact phone  eventplanner    no      Tlf. kontaktperson
+contact email 2        eventplanner    no      Epost 2
 case officer   eventplanner    no      Saksbehandler
 active eventplanner    no      Aktiv
 inactive       eventplanner    no      Inaktiv
@@ -118,4 +119,4 @@
 Time is already booked eventplanner    no      Tiden er allerede booking
 booking interval       eventplanner    no      Booking intervall
 days   eventplanner    no      dager
-there is a minimum interval of %1 day(s)       eventplanner    no      Det er 
et minimumsintervall på %1 dag(er)
\ No newline at end of file
+there is a minimum interval of %1 hours        eventplanner    no      Det er 
et minimumsintervall på %1 time(r)
\ No newline at end of file

Modified: branches/Version-2_0-branch/eventplanner/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/setup.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/setup/setup.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -11,7 +11,7 @@
         * @version $Id: setup.inc.php 14728 2016-02-11 22:28:46Z sigurdne $
         */
        $setup_info['eventplanner']['name'] = 'eventplanner';
-       $setup_info['eventplanner']['version'] = '0.9.18.007';
+       $setup_info['eventplanner']['version'] = '0.9.18.008';
        $setup_info['eventplanner']['app_order'] = 20;
        $setup_info['eventplanner']['enable'] = 1;
        $setup_info['eventplanner']['app_group'] = 'office';
@@ -55,6 +55,8 @@
                'eventplanner_application_type',
                'eventplanner_application',
                'eventplanner_application_comment',
+               'eventplanner_calendar',
+               'eventplanner_calendar_comment',
                'eventplanner_booking',
                'eventplanner_booking_comment',
                'eventplanner_booking_cost',

Modified: branches/Version-2_0-branch/eventplanner/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/tables_current.inc.php       
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/setup/tables_current.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -50,7 +50,7 @@
                                'eventplanner_vendor_category' => 
array('category_id' => 'id'),
                        ),
                        'ix' => array(),
-                       'uc' => array()
+                       'uc' => array('organization_number')
                ),
                'eventplanner_vendor_comment' => array(
                        'fd' => array(
@@ -229,16 +229,61 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'eventplanner_booking' => array(
+               'eventplanner_calendar' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
False),
-                               'customer_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
+                               'application_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+       //                      'customer_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
                                'from_' => array('type' => 'int', 'precision' 
=> '8', 'nullable' => False),
                                'to_' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => False, 'default' => '1'),
                                'completed' => array('type' => 'int', 
'precision' => 4, 'nullable' => False,'default' => '0'),
                                'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2, 'nullable' => True,'default' => '0.00'),
-                               'application_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+       //                      'customer_contact_name' => array('type' => 
'text', 'nullable' => True),
+       //                      'customer_contact_email' => array('type' => 
'text', 'nullable' => True),
+       //                      'customer_contact_phone' => array('type' => 
'text', 'nullable' => True),
+       //                      'location' => array('type' => 'text', 
'nullable' => True),
+       //                      'reminder' => array('type' => 'int', 
'precision' => 4, 'nullable' => False, 'default' => '0'),
+       //                      'secret' => array('type' => 'text', 'nullable' 
=> False),
+       //                      'sms_total' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'owner_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'public' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True),
+                               'created' => array('type' => 'int', 'precision' 
=> '8',  'nullable' => False, 'default' => 'current_timestamp'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+       //                      'eventplanner_customer' => array('customer_id' 
=> 'id'),
+                               'eventplanner_application' => 
array('application_id' => 'id'),
+                               ),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'eventplanner_calendar_comment' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'calendar_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'time' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False),
+                               'author' => array('type' => 'text', 'nullable' 
=> False),
+                               'comment' => array('type' => 'text', 'nullable' 
=> False),
+                               'type' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => false,'default' => 'comment'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'eventplanner_calendar' => array('calendar_id' 
=> 'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'eventplanner_booking' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'calendar_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
+                               'customer_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => true),
+//                             'from_' => array('type' => 'int', 'precision' 
=> '8', 'nullable' => False),
+//                             'to_' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False),
+//                             'active' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => False, 'default' => '1'),
+                               'completed' => array('type' => 'int', 
'precision' => 4, 'nullable' => False,'default' => '0'),
+//                             'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2, 'nullable' => True,'default' => '0.00'),
+//                             'application_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'customer_contact_name' => array('type' => 
'text', 'nullable' => True),
                                'customer_contact_email' => array('type' => 
'text', 'nullable' => True),
                                'customer_contact_phone' => array('type' => 
'text', 'nullable' => True),
@@ -252,8 +297,8 @@
                        ),
                        'pk' => array('id'),
                        'fk' => array(
+                               'eventplanner_calendar' => array('calendar_id' 
=> 'id'),
                                'eventplanner_customer' => array('customer_id' 
=> 'id'),
-                               'eventplanner_application' => 
array('application_id' => 'id'),
                                ),
                        'ix' => array(),
                        'uc' => array()

Modified: branches/Version-2_0-branch/eventplanner/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/setup/tables_update.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/setup/tables_update.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -224,3 +224,134 @@
                }
                return $GLOBALS['setup_info']['eventplanner']['currentver'];
        }
+
+       $test[] = '0.9.18.007';
+       function eventplanner_upgrade0_9_18_007()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw']->locations->add('.calendar', 'calendar', 
'eventplanner', $allow_grant = true);
+               $GLOBALS['phpgw']->locations->add('.calendar', 'calendar', 
'eventplannerfrontend', $allow_grant = true);
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'eventplanner_calendar',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => False),
+                                       'application_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => True),
+                                       'from_' => array('type' => 'int', 
'precision' => '8', 'nullable' => False),
+                                       'to_' => array('type' => 'int', 
'precision' => '8', 'nullable' => False),
+                                       'active' => array('type' => 'int', 
'precision' => 4, 'nullable' => False, 'default' => '1'),
+                                       'completed' => array('type' => 'int', 
'precision' => 4, 'nullable' => False,'default' => '0'),
+                                       'cost' => array('type' => 'decimal', 
'precision' => 20, 'scale' => 2, 'nullable' => True,'default' => '0.00'),
+                                       'owner_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                                       'public' => array('type' => 'int', 
'precision' => '2', 'nullable' => True),
+                                       'created' => array('type' => 'int', 
'precision' => '8',  'nullable' => False, 'default' => 'current_timestamp'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                       'eventplanner_application' => 
array('application_id' => 'id'),
+                                       ),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'eventplanner_calendar_comment',  array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => False),
+                                       'calendar_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                                       'time' => array('type' => 'int', 
'precision' => '8', 'nullable' => False),
+                                       'author' => array('type' => 'text', 
'nullable' => False),
+                                       'comment' => array('type' => 'text', 
'nullable' => False),
+                                       'type' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => false,'default' => 'comment'),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(
+                                       'eventplanner_calendar' => 
array('calendar_id' => 'id')),
+                               'ix' => array(),
+                               'uc' => array()
+                       ));
+
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn('eventplanner_booking', 'calendar_id',
+                       array
+                       (
+                               'type' => 'int',
+                               'precision' => 4,
+                               'nullable' => true
+                       )
+               );
+
+               $sql = "SELECT * FROM eventplanner_booking";
+               $GLOBALS['phpgw_setup']->oProc->query($sql, __LINE__, __FILE__);
+               
+               $calendars = array();
+               while($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $calendars[] = array(
+                               'id'    => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                               'application_id' => 
$GLOBALS['phpgw_setup']->oProc->f('application_id'),
+                               'customer_id' => 
$GLOBALS['phpgw_setup']->oProc->f('customer_id'),
+                               'from_' => 
$GLOBALS['phpgw_setup']->oProc->f('from_'),
+                               'to_' => 
$GLOBALS['phpgw_setup']->oProc->f('to_'),
+                               'active' => 
$GLOBALS['phpgw_setup']->oProc->f('active'),
+                               'completed' => 
$GLOBALS['phpgw_setup']->oProc->f('completed'),
+                               'cost' => 
$GLOBALS['phpgw_setup']->oProc->f('cost'),
+                               'customer_contact_name' => 
$GLOBALS['phpgw_setup']->oProc->f('customer_contact_name'),
+                               'customer_contact_email' => 
$GLOBALS['phpgw_setup']->oProc->f('customer_contact_email'),
+                               'customer_contact_phone' => 
$GLOBALS['phpgw_setup']->oProc->f('customer_contact_phone'),
+                               'location' => 
$GLOBALS['phpgw_setup']->oProc->f('location'),
+                               'reminder' => 
$GLOBALS['phpgw_setup']->oProc->f('reminder'),
+                               'secret' => 
$GLOBALS['phpgw_setup']->oProc->f('secret'),
+                               'sms_total' => 
$GLOBALS['phpgw_setup']->oProc->f('sms_total'),
+                               'owner_id' => 
$GLOBALS['phpgw_setup']->oProc->f('owner_id'),
+                               'public' => 
$GLOBALS['phpgw_setup']->oProc->f('public'),
+                               'created' => 
$GLOBALS['phpgw_setup']->oProc->f('created')
+                       );
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
eventplanner_booking WHERE customer_id IS NULL", __LINE__, __FILE__);
+
+               foreach ($calendars as $calendar)
+               {
+                       $value_set = array(
+                               'application_id' => $calendar['application_id'],
+                               'from_' => $calendar['from_'],
+                               'to_' => $calendar['to_'],
+                               'active' => $calendar['active'],
+                               'completed' => $calendar['completed'],
+                               'cost' => $calendar['cost'],
+                               'owner_id' => $calendar['owner_id'],
+                               'public' => $calendar['public'],
+                               'created' => $calendar['created'],
+                       );
+
+                       $GLOBALS['phpgw_setup']->oProc->query('INSERT INTO 
eventplanner_calendar (' . implode(',', array_keys($value_set)) . ') VALUES (' 
. $GLOBALS['phpgw_setup']->oProc->validate_insert(array_values($value_set)) . 
')');
+                       $calendar_id = 
(int)$GLOBALS['phpgw_setup']->oProc->m_odb->get_last_insert_id('eventplanner_calendar',
 'id');
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
eventplanner_booking SET calendar_id = {$calendar_id}"
+                       . " WHERE id = {$calendar['id']}", __LINE__, __FILE__);
+
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->query("ALTER TABLE 
eventplanner_booking DROP CONSTRAINT eventplanner_booking_application_id_fkey", 
__LINE__, __FILE__);
+
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('eventplanner_booking', array(), 
'from_');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('eventplanner_booking', array(), 
'to_');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('eventplanner_booking', array(), 
'cost');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('eventplanner_booking', array(), 
'application_id');
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('eventplanner_booking', array(), 
'active');
+
+
+               $sql = "ALTER TABLE public.eventplanner_booking"
+                       . " ADD CONSTRAINT 
eventplanner_booking_calendar_id_fkey FOREIGN KEY (calendar_id)"
+                       . " REFERENCES eventplanner_calendar (id) MATCH SIMPLE"
+                       . " ON UPDATE NO ACTION ON DELETE NO ACTION";
+               
+               $GLOBALS['phpgw_setup']->oProc->query($sql, __LINE__, __FILE__);
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['eventplanner']['currentver'] = 
'0.9.18.008';
+               }
+               return $GLOBALS['setup_info']['eventplanner']['currentver'];
+       }

Modified: branches/Version-2_0-branch/eventplanner/templates/base/booking.xsl
===================================================================
--- branches/Version-2_0-branch/eventplanner/templates/base/booking.xsl 
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplanner/templates/base/booking.xsl 
2017-03-30 12:35:36 UTC (rev 16498)
@@ -76,6 +76,7 @@
                                </div>
                                <input type="hidden" id="active_tab" 
name="active_tab" value="{value_active_tab}"/>
                                <div id="first_tab">
+                                       <input type="hidden" name="calendar_id" 
value="{calendar/id}"/>
                                        <xsl:if test="booking/id > 0">
                                                <div class="pure-control-group">
                                                        <label>
@@ -82,7 +83,6 @@
                                                                <xsl:value-of 
select="php:function('lang', 'id')"/>
                                                        </label>
                                                        <input type="hidden" 
id="booking_id" name="id" value="{booking/id}"/>
-                                                       <input type="hidden" 
name="application_id" value="{booking/application_id}"/>
                                                        <xsl:value-of 
select="booking/id"/>
                                                </div>
                                        </xsl:if>
@@ -103,7 +103,7 @@
                                                                </a>
 
                                                        </label>
-                                                       <xsl:value-of 
select="booking/application_name"/>
+                                                       <xsl:value-of 
select="calendar/application_name"/>
                                                </div>
 
                                                <div class="pure-control-group">
@@ -274,7 +274,7 @@
                                                                <xsl:value-of 
select="php:function('lang', 'active')"/>
                                                        </label>
                                                        <input type="checkbox" 
name="active" id="active" value="1" readonly="readonly">
-                                                               <xsl:if 
test="booking/active = 1">
+                                                               <xsl:if 
test="calendar/active = 1">
                                                                        
<xsl:attribute name="checked" value="checked"/>
                                                                </xsl:if>
                                                        </input>
@@ -284,7 +284,7 @@
                                                                <xsl:value-of 
select="php:function('lang', 'completed')"/>
                                                        </label>
                                                        <input type="checkbox" 
name="completed" id="completed" value="1">
-                                                               <xsl:if 
test="booking/completed = 1">
+                                                               <xsl:if 
test="calendar/completed = 1">
                                                                        
<xsl:attribute name="checked" value="checked"/>
                                                                </xsl:if>
                                                        </input>
@@ -298,9 +298,9 @@
                                                                <xsl:value-of 
select="$lang_from"/>
                                                        </label>
                                                        <input type="text" 
id="from_" name="from_" size="16" readonly="readonly">
-                                                               <xsl:if 
test="booking/from_ != 0 and booking/from_ != ''">
+                                                               <xsl:if 
test="calendar/from_ != 0 and calendar/from_ != ''">
                                                                        
<xsl:attribute name="value">
-                                                                               
<xsl:value-of select="php:function('show_date', number(booking/from_), 
$date_format)"/>
+                                                                               
<xsl:value-of select="php:function('show_date', number(calendar/from_), 
$date_format)"/>
                                                                        
</xsl:attribute>
                                                                </xsl:if>
                                                                <xsl:attribute 
name="data-validation">
@@ -322,7 +322,7 @@
                                                        <label>
                                                                <xsl:value-of 
select="php:function('lang', 'to')"/>
                                                        </label>
-                                                       <xsl:value-of 
select="php:function('show_date', number(booking/to_), $date_format)"/>
+                                                       <xsl:value-of 
select="php:function('show_date', number(calendar/to_), $date_format)"/>
                                                </div>
                                                
                                                <div class="pure-control-group">
@@ -463,7 +463,7 @@
                                <xsl:variable name="cancel_url">
                                        <xsl:value-of select="cancel_url"/>
                                </xsl:variable>
-                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onMouseout="window.status='';return true;" onClick="window.location = 
'{cancel_url}';"/>
+                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onClick="window.location = '{cancel_url}';"/>
                        </div>
                </form>
        </div>

Copied: 
branches/Version-2_0-branch/eventplannerfrontend/inc/class.uicalendar.inc.php 
(from rev 16497, trunk/eventplannerfrontend/inc/class.uicalendar.inc.php)
===================================================================
--- 
branches/Version-2_0-branch/eventplannerfrontend/inc/class.uicalendar.inc.php   
                            (rev 0)
+++ 
branches/Version-2_0-branch/eventplannerfrontend/inc/class.uicalendar.inc.php   
    2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,47 @@
+<?php
+       phpgw::import_class('eventplanner.uicalendar');
+       include_class('eventplanner', 'application', 'inc/model/');
+       class eventplannerfrontend_uicalendar extends eventplanner_uicalendar
+       {
+
+               public function __construct()
+               {
+                       $GLOBALS['phpgw']->translation->add_app('eventplanner');
+                       parent::__construct();
+               }
+
+               public function query()
+               {
+                       $params = $this->bo->build_default_read_params();
+                       $params['filters']['status'] = 
eventplanner_application::STATUS_APPROVED;
+                       $values = $this->bo->read($params);
+                       array_walk($values["results"], array($this, 
"_add_links"), "eventplannerfrontend.uicalendar.edit");
+
+                       return $this->jquery_results($values);
+               }
+
+               public function query_relaxed()
+               {
+                       $params = $this->bo->build_default_read_params();
+                       $params['relaxe_acl'] = true;
+                       $params['filters']['status'] = 
eventplanner_application::STATUS_APPROVED;
+                       $values = $this->bo->read($params);
+                       $redirect = phpgw::get_var('redirect');
+                       if($redirect == 'booking')
+                       {
+                               array_walk($values["results"], array($this, 
"_add_links2"), "{$this->currentapp}.uibooking.edit");
+                       }
+                       else
+                       {
+                               array_walk($values["results"], array($this, 
"_add_links"), "{$this->currentapp}.uicalendar.edit");
+                       }
+
+                       return $this->jquery_results($values);
+               }
+
+               public function edit()
+               {
+                       parent::edit();
+               }
+
+       }

Modified: 
branches/Version-2_0-branch/eventplannerfrontend/js/portico/application.edit.js
===================================================================
--- 
branches/Version-2_0-branch/eventplannerfrontend/js/portico/application.edit.js 
    2017-03-30 12:34:00 UTC (rev 16497)
+++ 
branches/Version-2_0-branch/eventplannerfrontend/js/portico/application.edit.js 
    2017-03-30 12:35:36 UTC (rev 16498)
@@ -260,7 +260,7 @@
        $("#stage_size").val(total_size);
 }
 
-add_booking = function ()
+add_schedule = function ()
 {
        var from_ = $("#from_").val();
        if (!from_)
@@ -269,7 +269,7 @@
        }
 
        oArgs = {
-               menuaction: 'eventplannerfrontend.uibooking.save_ajax',
+               menuaction: 'eventplannerfrontend.uicalendar.save_ajax',
                application_id: $("#application_id").val()
        };
 
@@ -319,7 +319,7 @@
        {
                return;
        }
-       oArgs = {menuaction: 'eventplannerfrontend.uibooking.update_schedule'};
+       oArgs = {menuaction: 'eventplannerfrontend.uicalendar.update_schedule'};
 
        var requestUrl = phpGWLink('eventplannerfrontend/', oArgs, true);
        var htmlString = '';
@@ -355,7 +355,7 @@
        $("#receipt").html("");
        if (action === 'add')
        {
-               add_booking();
+               add_schedule();
                return;
        }
 
@@ -391,7 +391,7 @@
        {
                var data = {"ids": ids, "action": action, from_: 
$("#from_").val()};
 
-               oArgs = {menuaction: 
'eventplannerfrontend.uibooking.update_active_status'};
+               oArgs = {menuaction: 
'eventplannerfrontend.uicalendar.update_active_status'};
 
                var requestUrl = phpGWLink('eventplannerfrontend/', oArgs, 
true);
 

Modified: 
branches/Version-2_0-branch/eventplannerfrontend/setup/default_records.inc.php
===================================================================
--- 
branches/Version-2_0-branch/eventplannerfrontend/setup/default_records.inc.php  
    2017-03-30 12:34:00 UTC (rev 16497)
+++ 
branches/Version-2_0-branch/eventplannerfrontend/setup/default_records.inc.php  
    2017-03-30 12:35:36 UTC (rev 16498)
@@ -5,6 +5,7 @@
        $GLOBALS['phpgw']->locations->add('.events', 'events', 
'eventplannerfrontend', $allow_grant = true, $custom_tbl = '', $c_function = 
true);
        $GLOBALS['phpgw']->locations->add('.customer', 'customer', 
'eventplannerfrontend', $allow_grant = true, $custom_tbl = '', $c_function = 
true);
        $GLOBALS['phpgw']->locations->add('.vendor', 'vendor', 
'eventplannerfrontend', $allow_grant = true, $custom_tbl = '', $c_function = 
true);
+       $GLOBALS['phpgw']->locations->add('.calendar', 'calendar', 
'eventplannerfrontend', $allow_grant = true);
        $GLOBALS['phpgw']->locations->add('.booking', 'booking', 
'eventplannerfrontend', $allow_grant = true, $custom_tbl = '', $c_function = 
true);
        $GLOBALS['phpgw']->locations->add('.vendor_report', 'vendor_report', 
'eventplannerfrontend', $allow_grant = true, $custom_tbl = '', $c_function = 
true);
        $GLOBALS['phpgw']->locations->add('.customer_report', 
'customer_report', 'eventplannerfrontend', $allow_grant = true, $custom_tbl = 
'', $c_function = true);

Modified: 
branches/Version-2_0-branch/eventplannerfrontend/templates/base/booking.xsl
===================================================================
--- branches/Version-2_0-branch/eventplannerfrontend/templates/base/booking.xsl 
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/eventplannerfrontend/templates/base/booking.xsl 
2017-03-30 12:35:36 UTC (rev 16498)
@@ -103,7 +103,7 @@
                                                                </a>
 
                                                        </label>
-                                                       <xsl:value-of 
select="booking/application_name"/>
+                                                       <xsl:value-of 
select="calendar/application_name"/>
                                                </div>
 
                                                <div class="pure-control-group">
@@ -274,7 +274,7 @@
                                                                <xsl:value-of 
select="php:function('lang', 'active')"/>
                                                        </label>
                                                        <input type="checkbox" 
name="active" id="active" value="1" readonly="readonly">
-                                                               <xsl:if 
test="booking/active = 1">
+                                                               <xsl:if 
test="calendar/active = 1">
                                                                        
<xsl:attribute name="checked" value="checked"/>
                                                                </xsl:if>
                                                        </input>
@@ -284,7 +284,7 @@
                                                                <xsl:value-of 
select="php:function('lang', 'completed')"/>
                                                        </label>
                                                        <input type="checkbox" 
name="completed" id="completed" value="1">
-                                                               <xsl:if 
test="booking/completed = 1">
+                                                               <xsl:if 
test="calendar/completed = 1">
                                                                        
<xsl:attribute name="checked" value="checked"/>
                                                                </xsl:if>
                                                        </input>
@@ -298,9 +298,9 @@
                                                                <xsl:value-of 
select="$lang_from"/>
                                                        </label>
                                                        <input type="text" 
id="from_" name="from_" size="16" readonly="readonly">
-                                                               <xsl:if 
test="booking/from_ != 0 and booking/from_ != ''">
+                                                               <xsl:if 
test="calendar/from_ != 0 and calendar/from_ != ''">
                                                                        
<xsl:attribute name="value">
-                                                                               
<xsl:value-of select="php:function('show_date', number(booking/from_), 
$date_format)"/>
+                                                                               
<xsl:value-of select="php:function('show_date', number(calendar/from_), 
$date_format)"/>
                                                                        
</xsl:attribute>
                                                                </xsl:if>
                                                                <xsl:attribute 
name="data-validation">
@@ -322,7 +322,7 @@
                                                        <label>
                                                                <xsl:value-of 
select="php:function('lang', 'to')"/>
                                                        </label>
-                                                       <xsl:value-of 
select="php:function('show_date', number(booking/to_), $date_format)"/>
+                                                       <xsl:value-of 
select="php:function('show_date', number(calendar/to_), $date_format)"/>
                                                </div>
                                                
                                                <div class="pure-control-group">
@@ -463,7 +463,7 @@
                                <xsl:variable name="cancel_url">
                                        <xsl:value-of select="cancel_url"/>
                                </xsl:variable>
-                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onMouseout="window.status='';return true;" onClick="window.location = 
'{cancel_url}';"/>
+                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" value="{lang_cancel}" 
onClick="window.location = '{cancel_url}';"/>
                        </div>
                </form>
        </div>

Modified: branches/Version-2_0-branch/header.inc.php.template
===================================================================
--- branches/Version-2_0-branch/header.inc.php.template 2017-03-30 12:34:00 UTC 
(rev 16497)
+++ branches/Version-2_0-branch/header.inc.php.template 2017-03-30 12:35:36 UTC 
(rev 16498)
@@ -149,10 +149,18 @@
        $GLOBALS['phpgw_info']['server']['lost_password_url'] = 
'{LOST_PASSWORD_URL}';
 
        /**
+       * @global string $phpgw_info['server']['enable_crypto']
+       * phpGroupWare offers 2 session management systems - php and db
+       * Unless you really know what you are doing use php here as it works 
better 99.5% of the time
+       */
+       $GLOBALS['phpgw_info']['server']['enable_crypto'] = '{ENABLE_CRYPTO}';
+
+       /**
        * @global boolean $phpgw_info['server']['mcrypt_enabled']
        * This is used to control mcrypt's use
+       * Note: deprecated
        */
-       $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = {ENABLE_MCRYPT};
+       $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = false;
 
        /**
        * @global string $phpgw_info['server']['mcrypt_iv']
@@ -171,6 +179,13 @@
        */
        $GLOBALS['phpgw_info']['server']['setup_mcrypt_key'] = 
'{SETUP_MCRYPT_KEY}';
 
+       /**
+       * @global string $phpgw_info['server']['setup_libsodium_key']
+       * This is a random string used as the encryption key for libsodium
+       * Never change it!
+       */
+       $GLOBALS['phpgw_info']['server']['setup_libsodium_key'] = 
'{SETUP_LIBSODIUM_KEY}';
+
        /*
                This ensures IE gets the right character set
        */

Modified: branches/Version-2_0-branch/helpdesk/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/helpdesk/inc/class.sogeneric.inc.php    
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/helpdesk/inc/class.sogeneric.inc.php    
2017-03-30 12:35:36 UTC (rev 16498)
@@ -38,7 +38,7 @@
                }
 
 
-               public function get_location_info( $type, $type_id )
+               public function get_location_info( $type, $type_id = 0 )
                {
 
                        $type_id = (int)$type_id;

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.common.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.common.inc.php       
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.common.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -1591,7 +1591,7 @@
                //      $prev_helper = 
$GLOBALS['phpgw']->translation->translator_helper;
                //      $GLOBALS['phpgw']->translation->translator_helper = '';
 
-                       $data = '';
+                       $data = array();
                        if (is_array($text))
                        {
                                foreach($text as $key => $value)

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.crypto.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.crypto.inc.php       
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.crypto.inc.php       
2017-03-30 12:35:36 UTC (rev 16498)
@@ -1,25 +1,41 @@
 <?php
        /**
-       * Handles encrypting strings based on various encryption schemes
-       * @author Joseph Engo <address@hidden>
-       * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc. 
http://www.fsf.org/
-       * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
-       * @package phpgwapi
-       * @subpackage network
-       * @version $Id$
-       */
+        * Handles encrypting strings based on various encryption schemes
+        * @author Joseph Engo <address@hidden>
+        * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
+        * @package phpgwapi
+        * @subpackage network
+        * @version $Id$
+        */
 
+
+       if(!empty($GLOBALS['phpgw_info']['server']['mcrypt_enabled']) || 
$GLOBALS['phpgw_info']['server']['enable_crypto'] == 'mcrypt' )
+       {
+               require_once PHPGW_API_INC . '/class.crypto_mcrypt.inc.php';
+       }
+       else if( $GLOBALS['phpgw_info']['server']['enable_crypto'] == 
'libsodium' )
+       {
+               require_once PHPGW_API_INC . '/class.crypto_libsodium.inc.php';
+       }
+       else
+       {
+               //Fall back
+               class phpgwapi_crypto extends phpgwapi_crypto_
+               {
+               }
+       }
+
        /**
-       * Handles encrypting strings based on various encryption schemes
-       *
-       * @package phpgwapi
-       * @subpackage network
-       */
-       class crypto
+        * Handles encrypting strings based on various encryption schemes
+        *
+        * @package phpgwapi
+        * @subpackage network
+        */
+       class phpgwapi_crypto_
        {
                var $enabled = false;
                var $debug = false;
-
                var $algo;
                var $mode;
                var $td; /* Handle for mcrypt */
@@ -26,9 +42,9 @@
                var $iv = '';
                var $key = '';
 
-               function __construct($vars='')
+               function __construct( $vars = '' )
                {
-                       if(is_array($vars))
+                       if (is_array($vars))
                        {
                                $this->init($vars);
                        }
@@ -35,210 +51,56 @@
                        register_shutdown_function(array(&$this, 'cleanup'));
                }
 
-               function init($vars)
+               function init( $vars )
                {
-                       /* _debug_array(mcrypt_list_algorithms()); */
-                       $key = $vars[0];
-                       $iv  = $vars[1];
-
-                       if ($GLOBALS['phpgw_info']['server']['mcrypt_enabled'] 
-                               && extension_loaded('mcrypt')
-                               && !$this->enabled )
-                       {
-                               $this->algo = MCRYPT_TRIPLEDES;
-                               $this->mode = MCRYPT_MODE_CBC;
-
-                               if ( 
isset($GLOBALS['phpgw_info']['server']['mcrypt_algo']) )
-                               {
-                                       $this->algo = 
$GLOBALS['phpgw_info']['server']['mcrypt_algo'];
-                               }
-                               if ( 
isset($GLOBALS['phpgw_info']['server']['mcrypt_mode']) )
-                               {
-                                       $this->mode = 
$GLOBALS['phpgw_info']['server']['mcrypt_mode'];
-                               }
-
-                               if($this->debug)
-                               {
-                                       echo '<br>crypto: algorithm=' . 
$this->algo;
-                                       echo '<br>crypto: mode     =' . 
$this->mode;
-                               }
-
-                               $this->enabled = True;
-                               /* Start up mcrypt */
-                               $this->td = mcrypt_module_open ($this->algo, 
'', $this->mode, '');
-                               
-                               $ivsize  = mcrypt_enc_get_iv_size($this->td);
-                               $keysize = mcrypt_enc_get_key_size($this->td);
-
-                               /* Hack IV to be the correct size */
-                               $x = strlen($iv);
-                               for ($i = 0; $i < $ivsize; $i++)
-                               {
-                                       $this->iv .= $iv[$i % $x];
-                               }
-
-                               /* Hack Key to be the correct size */
-                               $x = strlen($key);
-
-                               for ($i = 0; $i < $keysize; $i++)
-                               {
-                                       $this->key .= $key[$i % $x];
-                               }
-                       }
-                       /* If mcrypt isn't loaded, key and iv are not needed. */
                }
 
                function cleanup()
                {
-                       if ($this->enabled && $this->td)
-                       {
-                               @mcrypt_generic_deinit($this->td);
-                       }
                }
 
-               function hex2bin($data)
+               function hex2bin( $data )
                {
                        $len = strlen($data);
-                       return pack('H'.$len, $data);
+                       return pack('H' . $len, $data);
                }
 
-               function encrypt($data, $bypass = false)
+               function encrypt( $data, $bypass = false )
                {
-                       $_obj = false;
-                       if($this->debug)
-                       {
-                               echo '<br>' . time() . ' crypto->encrypt() 
unencrypted data: ---->>>>' . $data . "\n";
-                       }
 
-                       if ( $data === '' || is_null($data) )
+                       if ($data === '' || is_null($data))
                        {
                                // no point in encrypting an empty string
                                return $data;
                        }
 
-                       if(is_array($data) || is_object($data))
-                       {
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->encrypt() found an "' . gettype($data) . '".  Serializing...' . "\n";
-                               }
-                               $data = serialize($data);
-                               $_obj = true;
-                       }
-                       else
-                       {
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->encrypt() found "' . gettype($data) . '". No serialization...' . "\n";
-                               }
-                               //FIXME - Strings are not decrypted correctly
-                               $data = serialize($data);
-                               $_obj = true;
-                       }
-
-                       /* Disable all encryption if the admin didn't set it up 
*/
-                       if ($this->enabled && !$bypass)
-                       {
-                               if($_obj)
-                               {
-                                       if($this->debug)
-                                       {
-                                               echo '<br>' . time() . ' 
crypto->encrypt() adding slashes' . "\n";
-                                       }
-                                       $data = addslashes($data);
-                               }
-
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->encrypt() data: ---->>>>' . $data;
-                               }
-
-                               mcrypt_generic_init ($this->td, $this->key, 
$this->iv);
-                               
-                               $encrypteddata = mcrypt_generic($this->td, 
$data);
-                               $encrypteddata = bin2hex($encrypteddata);
-                               
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $encrypteddata;
-                               }
-                               return $encrypteddata;
-                       }
-                       else
-                       {
-                               /* No mcrypt == insecure ! */
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $data;
-                               }
-                               return $data;
-                       }
+                       return serialize($data);
                }
 
-               function decrypt($encrypteddata, $bypass = false)
+               function decrypt( $encrypteddata, $bypass = false )
                {
-                       if($this->debug)
+                       if ($this->debug)
                        {
                                echo '<br>' . time() . ' crypto->decrypt() 
crypted data: ---->>>>' . $encrypteddata;
                        }
 
-                       if ( $encrypteddata === '' || is_null($encrypteddata) )
+                       if ($encrypteddata === '' || is_null($encrypteddata))
                        {
                                // an empty string is always a usless empty 
string
                                return $encrypteddata;
                        }
 
-                       /* Disable all encryption if the admin didn't set it up 
*/
-                       if ($this->enabled && !$bypass)
-                       {
-                               $data = $this->hex2bin($encrypteddata);
-                               mcrypt_generic_init ($this->td, $this->key, 
$this->iv);
-                               $data = mdecrypt_generic($this->td, $data);
+                       $data = $encrypteddata;
+                       
 
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->decrypt() decrypted data: ---->>>>' . $data;
-                               }
-                               $test = stripslashes($data);
-                               if( $test )
-                               {
-                                       if($this->debug)
-                                       {
-                                               echo '<br>' . time() . ' 
crypto->decrypt() stripping slashes' . "\n";
-                                       }
-                                       $data = $test;
-                               }
-                               unset($test);
-
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->decrypt() data: ---->>>>' . $data . "\n";
-                               }
-                       }
-                       else
-                       {
-                               /* No mcrypt == insecure ! */
-                               $data = $encrypteddata;
-                       }
-
                        $newdata = @unserialize($data);
-                       if($newdata || is_array($newdata)) // Check for empty 
array
+                       if ($newdata || is_array($newdata)) // Check for empty 
array
                        {
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->decrypt() found serialized "' . gettype($newdata) . '".  
Unserializing...' . "\n";
-                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: '; _debug_array($newdata);
-                               }
                                return $newdata;
                        }
                        else
                        {
-                               if($this->debug)
-                               {
-                                       echo '<br>' . time() . ' 
crypto->decrypt() found UNserialized "' . gettype($data) . '".  No 
unserialization...' . "\n";
-                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: ' . $data;
-                               }
                                return $data;
                        }
                }
-       } // class crypto
+       }
\ No newline at end of file

Copied: branches/Version-2_0-branch/phpgwapi/inc/class.crypto_libsodium.inc.php 
(from rev 16497, trunk/phpgwapi/inc/class.crypto_libsodium.inc.php)
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.crypto_libsodium.inc.php     
                        (rev 0)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.crypto_libsodium.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,252 @@
+<?php
+       /**
+        * Handles encrypting strings based on various encryption schemes
+        * @author Joseph Engo <address@hidden>
+        * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
+        * @package phpgwapi
+        * @subpackage network
+        * @version $Id: class.crypto.inc.php 13891 2015-09-14 19:31:31Z 
sigurdne $
+        */
+
+       /**
+        * Handles encrypting strings based on various encryption schemes
+        *
+        * @package phpgwapi
+        * @subpackage network
+        */
+
+       class phpgwapi_crypto extends phpgwapi_crypto_
+       {
+
+               function __construct( $vars = '' )
+               {
+                       parent::__construct($vars);
+               }
+
+               function init( $vars )
+               {
+                       $key = $vars[0];
+
+                       if ($GLOBALS['phpgw_info']['server']['enable_crypto'] 
== 'libsodium' && extension_loaded('libsodium') && !$this->enabled)
+                       {
+                               $this->enabled = true;
+
+                               $keysize = \Sodium\CRYPTO_SECRETBOX_KEYBYTES;
+
+                               /* Hack Key to be the correct size */
+                               $x = strlen($key);
+
+                               for ($i = 0; $i < $keysize; $i++)
+                               {
+                                       $this->key .= $key[$i % $x];
+                               }
+                       }
+               }
+
+               function cleanup()
+               {
+                       if ($this->enabled)
+                       {
+                               \Sodium\memzero($this->key);
+                       }
+               }
+
+               function hex2bin( $data )
+               {
+                       $len = strlen($data);
+                       return pack('H' . $len, $data);
+               }
+
+               function encrypt( $data, $bypass = false )
+               {
+                       $_obj = false;
+                       if ($this->debug)
+                       {
+                               echo '<br>' . time() . ' crypto->encrypt() 
unencrypted data: ---->>>>' . $data . "\n";
+                       }
+
+                       if ($data === '' || is_null($data))
+                       {
+                               // no point in encrypting an empty string
+                               return $data;
+                       }
+
+                       if (is_array($data) || is_object($data))
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() found an "' . gettype($data) . '".  Serializing...' . "\n";
+                               }
+                               $data = serialize($data);
+                               $_obj = true;
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() found "' . gettype($data) . '". No serialization...' . "\n";
+                               }
+                               //FIXME - Strings are not decrypted correctly
+                               $data = serialize($data);
+                               $_obj = true;
+                       }
+
+                       /* Disable all encryption if the admin didn't set it up 
*/
+                       if ($this->enabled && !$bypass)
+                       {
+                               if ($_obj)
+                               {
+                                       if ($this->debug)
+                                       {
+                                               echo '<br>' . time() . ' 
crypto->encrypt() adding slashes' . "\n";
+                                       }
+                                       $data = addslashes($data);
+                               }
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() data: ---->>>>' . $data;
+                               }
+                               $encrypteddata = $this->safeEncrypt( $data, 
$this->key );
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $encrypteddata;
+                               }
+                               return $encrypteddata;
+                       }
+                       else
+                       {
+                               /* No mcrypt == insecure ! */
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $data;
+                               }
+                               return $data;
+                       }
+               }
+
+               function decrypt( $encrypteddata, $bypass = false )
+               {
+                       if ($this->debug)
+                       {
+                               echo '<br>' . time() . ' crypto->decrypt() 
crypted data: ---->>>>' . $encrypteddata;
+                       }
+
+                       if ($encrypteddata === '' || is_null($encrypteddata))
+                       {
+                               // an empty string is always a usless empty 
string
+                               return $encrypteddata;
+                       }
+
+                       /* Disable all encryption if the admin didn't set it up 
*/
+                       if ($this->enabled && !$bypass)
+                       {
+                               $data = $this->safeDecrypt( $encrypteddata, 
$this->key );
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() decrypted data: ---->>>>' . $data;
+                               }
+                               $test = stripslashes($data);
+                               if ($test)
+                               {
+                                       if ($this->debug)
+                                       {
+                                               echo '<br>' . time() . ' 
crypto->decrypt() stripping slashes' . "\n";
+                                       }
+                                       $data = $test;
+                               }
+                               unset($test);
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() data: ---->>>>' . $data . "\n";
+                               }
+                       }
+                       else
+                       {
+                               /* No mcrypt == insecure ! */
+                               $data = $encrypteddata;
+                       }
+
+                       $newdata = @unserialize($data);
+                       if ($newdata || is_array($newdata)) // Check for empty 
array
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() found serialized "' . gettype($newdata) . '".  
Unserializing...' . "\n";
+                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: ';
+                                       _debug_array($newdata);
+                               }
+                               return $newdata;
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() found UNserialized "' . gettype($data) . '".  No 
unserialization...' . "\n";
+                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: ' . $data;
+                               }
+                               return $data;
+                       }
+               }
+
+               /**
+                * Encrypt a message
+                *
+                * @param string $message - message to encrypt
+                * @param string $key - encryption key
+                * @return string
+                */
+               function safeEncrypt( $message, $key )
+               {
+                       $nonce = \Sodium\randombytes_buf(
+                               \Sodium\CRYPTO_SECRETBOX_NONCEBYTES
+                       );
+
+                       $cipher = base64_encode(
+                               $nonce .
+                               \Sodium\crypto_secretbox(
+                                       $message, $nonce, $key
+                               )
+                       );
+                       \Sodium\memzero($message);
+                       \Sodium\memzero($key);
+                       return $cipher;
+               }
+
+               /**
+                * Decrypt a message
+                *
+                * @param string $encrypted - message encrypted with 
safeEncrypt()
+                * @param string $key - encryption key
+                * @return string
+                */
+               function safeDecrypt( $encrypted, $key )
+               {
+                       $decoded = base64_decode($encrypted);
+                       if ($decoded === false)
+                       {
+                               return false;
+//                             throw new \Exception('Scream bloody murder, the 
encoding failed');
+                       }
+                       if (mb_strlen($decoded, '8bit') < 
(\Sodium\CRYPTO_SECRETBOX_NONCEBYTES + \Sodium\CRYPTO_SECRETBOX_MACBYTES))
+                       {
+//                             throw new \Exception('Scream bloody murder, the 
message was truncated');
+                       }
+                       $nonce = mb_substr($decoded, 0, 
\Sodium\CRYPTO_SECRETBOX_NONCEBYTES, '8bit');
+                       $ciphertext = mb_substr($decoded, 
\Sodium\CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit');
+
+                       $plain = \Sodium\crypto_secretbox_open(
+                               $ciphertext, $nonce, $key
+                       );
+                       if ($plain === false)
+                       {
+//                             throw new \Exception('Scream bloody murder, the 
message was tampered with in transit');
+                       }
+                       \Sodium\memzero($ciphertext);
+                       \Sodium\memzero($key);
+                       return $plain;
+               }
+       }

Copied: branches/Version-2_0-branch/phpgwapi/inc/class.crypto_mcrypt.inc.php 
(from rev 16497, trunk/phpgwapi/inc/class.crypto_mcrypt.inc.php)
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.crypto_mcrypt.inc.php        
                        (rev 0)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.crypto_mcrypt.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -0,0 +1,233 @@
+<?php
+       /**
+        * Handles encrypting strings based on various encryption schemes
+        * @author Joseph Engo <address@hidden>
+        * @copyright Copyright (C) 2000-2004 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
+        * @package phpgwapi
+        * @subpackage network
+        * @version $Id: class.crypto.inc.php 13891 2015-09-14 19:31:31Z 
sigurdne $
+        */
+
+
+       /**
+        * Handles encrypting strings based on various encryption schemes
+        *
+        * @package phpgwapi
+        * @subpackage network
+        */
+       class phpgwapi_crypto extends phpgwapi_crypto_
+       {
+
+               function __construct( $vars = '' )
+               {
+                       parent::__construct($vars);
+               }
+
+               function init( $vars )
+               {
+                       /* _debug_array(mcrypt_list_algorithms()); */
+                       $key = $vars[0];
+                       $iv = $vars[1];
+
+                       if (($GLOBALS['phpgw_info']['server']['mcrypt_enabled'] 
|| $GLOBALS['phpgw_info']['server']['enable_crypto'] == 'mcrypt') && 
extension_loaded('mcrypt') && !$this->enabled)
+                       {
+                               $this->algo = MCRYPT_TRIPLEDES;
+                               $this->mode = MCRYPT_MODE_CBC;
+
+                               if 
(isset($GLOBALS['phpgw_info']['server']['mcrypt_algo']))
+                               {
+                                       $this->algo = 
$GLOBALS['phpgw_info']['server']['mcrypt_algo'];
+                               }
+                               if 
(isset($GLOBALS['phpgw_info']['server']['mcrypt_mode']))
+                               {
+                                       $this->mode = 
$GLOBALS['phpgw_info']['server']['mcrypt_mode'];
+                               }
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>crypto: algorithm=' . 
$this->algo;
+                                       echo '<br>crypto: mode     =' . 
$this->mode;
+                               }
+
+                               $this->enabled = True;
+                               /* Start up mcrypt */
+                               $this->td = mcrypt_module_open($this->algo, '', 
$this->mode, '');
+
+                               $ivsize = mcrypt_enc_get_iv_size($this->td);
+                               $keysize = mcrypt_enc_get_key_size($this->td);
+
+                               /* Hack IV to be the correct size */
+                               $x = strlen($iv);
+                               for ($i = 0; $i < $ivsize; $i++)
+                               {
+                                       $this->iv .= $iv[$i % $x];
+                               }
+
+                               /* Hack Key to be the correct size */
+                               $x = strlen($key);
+
+                               for ($i = 0; $i < $keysize; $i++)
+                               {
+                                       $this->key .= $key[$i % $x];
+                               }
+                       }
+                       /* If mcrypt isn't loaded, key and iv are not needed. */
+               }
+
+               function cleanup()
+               {
+                       if ($this->enabled && $this->td)
+                       {
+                               @mcrypt_generic_deinit($this->td);
+                       }
+               }
+
+               function hex2bin( $data )
+               {
+                       $len = strlen($data);
+                       return pack('H' . $len, $data);
+               }
+
+               function encrypt( $data, $bypass = false )
+               {
+                       $_obj = false;
+                       if ($this->debug)
+                       {
+                               echo '<br>' . time() . ' crypto->encrypt() 
unencrypted data: ---->>>>' . $data . "\n";
+                       }
+
+                       if ($data === '' || is_null($data))
+                       {
+                               // no point in encrypting an empty string
+                               return $data;
+                       }
+
+                       if (is_array($data) || is_object($data))
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() found an "' . gettype($data) . '".  Serializing...' . "\n";
+                               }
+                               $data = serialize($data);
+                               $_obj = true;
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() found "' . gettype($data) . '". No serialization...' . "\n";
+                               }
+                               //FIXME - Strings are not decrypted correctly
+                               $data = serialize($data);
+                               $_obj = true;
+                       }
+
+                       /* Disable all encryption if the admin didn't set it up 
*/
+                       if ($this->enabled && !$bypass)
+                       {
+                               if ($_obj)
+                               {
+                                       if ($this->debug)
+                                       {
+                                               echo '<br>' . time() . ' 
crypto->encrypt() adding slashes' . "\n";
+                                       }
+                                       $data = addslashes($data);
+                               }
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() data: ---->>>>' . $data;
+                               }
+
+                               mcrypt_generic_init($this->td, $this->key, 
$this->iv);
+
+                               $encrypteddata = mcrypt_generic($this->td, 
$data);
+                               $encrypteddata = bin2hex($encrypteddata);
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $encrypteddata;
+                               }
+                               return $encrypteddata;
+                       }
+                       else
+                       {
+                               /* No mcrypt == insecure ! */
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->encrypt() crypted data: ---->>>>' . $data;
+                               }
+                               return $data;
+                       }
+               }
+
+               function decrypt( $encrypteddata, $bypass = false )
+               {
+                       if ($this->debug)
+                       {
+                               echo '<br>' . time() . ' crypto->decrypt() 
crypted data: ---->>>>' . $encrypteddata;
+                       }
+
+                       if ($encrypteddata === '' || is_null($encrypteddata))
+                       {
+                               // an empty string is always a usless empty 
string
+                               return $encrypteddata;
+                       }
+
+                       /* Disable all encryption if the admin didn't set it up 
*/
+                       if ($this->enabled && !$bypass)
+                       {
+                               $data = $this->hex2bin($encrypteddata);
+                               mcrypt_generic_init($this->td, $this->key, 
$this->iv);
+                               $data = mdecrypt_generic($this->td, $data);
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() decrypted data: ---->>>>' . $data;
+                               }
+                               $test = stripslashes($data);
+                               if ($test)
+                               {
+                                       if ($this->debug)
+                                       {
+                                               echo '<br>' . time() . ' 
crypto->decrypt() stripping slashes' . "\n";
+                                       }
+                                       $data = $test;
+                               }
+                               unset($test);
+
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() data: ---->>>>' . $data . "\n";
+                               }
+                       }
+                       else
+                       {
+                               /* No mcrypt == insecure ! */
+                               $data = $encrypteddata;
+                       }
+
+                       $newdata = @unserialize($data);
+                       if ($newdata || is_array($newdata)) // Check for empty 
array
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() found serialized "' . gettype($newdata) . '".  
Unserializing...' . "\n";
+                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: ';
+                                       _debug_array($newdata);
+                               }
+                               return $newdata;
+                       }
+                       else
+                       {
+                               if ($this->debug)
+                               {
+                                       echo '<br>' . time() . ' 
crypto->decrypt() found UNserialized "' . gettype($data) . '".  No 
unserialization...' . "\n";
+                                       echo '<br>' . time() . ' 
crypto->decrypt() returning: ' . $data;
+                               }
+                               return $data;
+                       }
+               }
+       }
+       // class crypto

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.login.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -56,7 +56,7 @@
                        require_once dirname(realpath(__FILE__)) . 
'/sso/include_login.inc.php';
 
                        $lightbox                        = 
isset($_REQUEST['lightbox']) && $_REQUEST['lightbox'] ? true : false;
-                       $partial_url             = "{$frontend}/login.php";
+                       $partial_url             = 
ltrim("{$frontend}/login.php", '/');
                        $phpgw_url_for_sso       = 
'phpgwapi/inc/sso/login_server.php';
 
                        if (isset($GLOBALS['phpgw_remote_user']) && 
!empty($GLOBALS['phpgw_remote_user']))

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.sessions.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -599,7 +599,7 @@
                                }
                        }
 
-                       if($external)
+                       if($external || 
$GLOBALS['phpgw_info']['server']['webserver_url'] == '/')
                        {
                                if(substr($url, 0, 4) != 'http')
                                {

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.setup.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.setup.inc.php        
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.setup.inc.php        
2017-03-30 12:35:36 UTC (rev 16498)
@@ -206,7 +206,8 @@
                                        setcookie('ConfigLang', $ConfigLang, 
$expire);
                                        return True;
                                }
-                               else if($HeaderPW == 
md5(stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password'])))
+                               else
+                               if($HeaderPW == 
md5(stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password'])))
                                {
                                        setcookie('HeaderPW', $HeaderPW , 
$expire);
                                        setcookie('ConfigLang', $ConfigLang, 
$expire);

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.setup_detection.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.setup_detection.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.setup_detection.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -40,7 +40,7 @@
                        return $setup_info;
                }
 
-               function get_db_versions($setup_info='')
+               function get_db_versions($setup_info=array())
                {
                        $tname = Array();
                        $GLOBALS['phpgw_setup']->db->Halt_On_Error = 'no';
@@ -493,4 +493,4 @@
                                return True;
                        }
                }
-       }
\ No newline at end of file
+       }

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.setup_html.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.setup_html.inc.php   
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.setup_html.inc.php   
2017-03-30 12:35:36 UTC (rev 16498)
@@ -35,8 +35,8 @@
                                $domains = array();
                        }
 
-                       $setting = phpgw::get_var('setting', 'string', 'POST');
-                       $settings = phpgw::get_var("settings", 'string', 
'POST');
+                       $setting = phpgw::get_var('setting', 'raw', 'POST');
+                       $settings = phpgw::get_var("settings", 'raw', 'POST');
 
                        foreach($domains as $k => $v)
                        {
@@ -48,7 +48,7 @@
                                
$GLOBALS['header_template']->set_var('DB_DOMAIN',$v);
                                foreach($dom as $x => $y)
                                {
-                                       if( $setting['enable_mcrypt'] == 'True' 
&& ($x == 'db_pass' || $x == 'db_host' || $x == 'db_name' || $x == 'db_user' || 
$x == 'config_pass'))
+                                       if( ($setting['enable_mcrypt'] == 
'True' || !empty($setting['enable_crypto'])) && ($x == 'db_pass' || $x == 
'db_host' || $x == 'db_name' || $x == 'db_user' || $x == 'config_pass'))
                                        {
                                                $y = 
$GLOBALS['phpgw']->crypto->encrypt($y);
                                        }
@@ -63,7 +63,7 @@
                        {
                                foreach($setting as $k => $v)
                                {
-                                       if ($setting['enable_mcrypt'] == 'True' 
&& $k == 'HEADER_ADMIN_PASSWORD')
+                                       if (($setting['enable_mcrypt'] == 
'True'  || !empty($setting['enable_crypto']))&& $k == 'HEADER_ADMIN_PASSWORD')
                                        {
                                                $v = 
$GLOBALS['phpgw']->crypto->encrypt($v);
                                        }

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -271,6 +271,7 @@
                                }
                                $results[] = $row;
                        }
+                       $id_map = array();
                        if (count($results) > 0)
                        {
                                foreach ($results as $id => $result)
@@ -302,6 +303,7 @@
                                                        while 
($this->db->next_record())
                                                        {
                                                                $id = 
$this->unmarshal($this->db->f($key, false), 'int');
+                                                               
$results[$id_map[$id]][$field] = array();
                                                                $data = array();
                                                                foreach 
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
                                                                {
@@ -330,6 +332,7 @@
                                                        while 
($this->db->next_record())
                                                        {
                                                                $id = 
$this->unmarshal($this->db->f($key, false), 'int');
+                                                               
$results[$id_map[$id]][$field] = array();
                                                                
$results[$id_map[$id]][$field][] = $this->unmarshal($this->db->f($column, 
false), $params['type']);
                                                        }
                                                }

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -126,7 +126,18 @@
                {
                        if (empty($this->permissions[PHPGW_ACL_ADD]))
                        {
-                               phpgw::no_access();
+                               if ($ajax)
+                               {
+                                       return array(
+                                               'status_kode' => 'error',
+                                               'status' => lang('error'),
+                                               'msg' => lang('no access')
+                                       );
+                               }
+                               else
+                               {
+                                       phpgw::no_access();
+                               }
                        }
                        $active_tab = phpgw::get_var('active_tab', 'string', 
'REQUEST', 'first_tab');
 

Modified: branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php    
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php    
2017-03-30 12:35:36 UTC (rev 16498)
@@ -44,7 +44,7 @@
                }
 
 
-               public function get_location_info( $type, $type_id )
+               public function get_location_info( $type, $type_id = 0 )
                {
                        $type_id = (int)$type_id;
                        $this->type = $type;

Modified: branches/Version-2_0-branch/property/inc/class.sogeneric_.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sogeneric_.inc.php   
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/property/inc/class.sogeneric_.inc.php   
2017-03-30 12:35:36 UTC (rev 16498)
@@ -340,7 +340,7 @@
                        return $values;
                }
 
-               abstract function get_location_info( $type, $type_id );
+               abstract function get_location_info( $type, $type_id = 0 );
 
                public function get_name( $data )
                {

Modified: branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -312,7 +312,7 @@
                        $invoices = array();
                        foreach ($contracts_to_bill as $contract_id) // Runs 
through all the contracts that should be billed in this run
                        {
-                               $invoice = 
rental_invoice::create_invoice($decimals, $billing->get_id(), $contract_id, 
in_array($contract_id, $contracts_overriding_billing_start) ? true : false, 
$bill_from_timestamp, $billing_end_timestamp, in_array($contract_id, 
$contracts_bill_only_one_time) ? true : false, $dry_run, $billing_term); // 
Creates an invoice of the contract
+                               $invoice = 
rental_invoice::create_invoice($decimals, $billing->get_id(), $contract_id, 
in_array($contract_id, $contracts_overriding_billing_start) ? true : false, 
$bill_from_timestamp, $billing_end_timestamp, in_array($contract_id, 
$contracts_bill_only_one_time) ? true : false, $dry_run, $billing_term, 
$month); // Creates an invoice of the contract
                                if ($invoice != null)
                                {
                                        $total_sum += $invoice->get_total_sum();

Modified: 
branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php  
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php  
2017-03-30 12:35:36 UTC (rev 16498)
@@ -52,8 +52,13 @@
                                if($filters['credits'])
                                {
                                        $filter_clauses[] = "is_one_time";
-                                       $filter_clauses[] = 
"rental_contract_price_item.total_price < 0.00";    
+                                       $filter_clauses[] = 
"rental_contract_price_item.total_price < 0.00";
                                }
+                               else if($filters['positive_one_time'])
+                               {
+                                       $filter_clauses[] = "is_one_time";
+                                       $filter_clauses[] = 
"rental_contract_price_item.total_price > 0.00";
+                               }
                                else
                                {
                                        $billing_term_id = 
(int)$filters['billing_term_id'];

Modified: branches/Version-2_0-branch/rental/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.sogeneric.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/inc/class.sogeneric.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -35,7 +35,7 @@
                        parent::__construct($type, $type_id);
                }
 
-               public function get_location_info( $type, $type_id )
+               public function get_location_info( $type, $type_id = 0 )
                {
 
                        $type_id = (int)$type_id;

Modified: branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php      
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php      
2017-03-30 12:35:36 UTC (rev 16498)
@@ -231,11 +231,16 @@
                                                                $month = 1;
                                                                
$billing_term_label = lang('free_of_charge');
                                                        }
-                                                       else
+                                                       else if ($billing_month 
== '2')
                                                        {
                                                                $month = 2;
                                                                
$billing_term_label = lang('credits');
                                                        }
+                                                       else
+                                                       {
+                                                               $month = 3;
+                                                               
$billing_term_label = lang('positive one time');
+                                                       }
                                                }
                                                else // yearly
                                                {
@@ -522,11 +527,16 @@
                                                $month = 1;
                                                $billing_term_label = 
lang('free_of_charge');
                                        }
-                                       else
+                                       else if ($billing_month == '2')
                                        {
                                                $month = 2;
                                                $billing_term_label = 
lang('credits');
                                        }
+                                       else
+                                       {
+                                               $month = 3;
+                                               $billing_term_label = 
lang('positive one time');
+                                       }
                                }
                                else // yearly
                                {
@@ -579,11 +589,21 @@
 
                                        $socontract_price_item = 
rental_socontract_price_item::get_instance();
 
-
+                                       $sort_ascending = false;
+                                       $search_for = '';
+                                       $search_type = '';
                                        //... 2. Contracts with one-time price 
items
                                        if($billing_term == 5)
                                        {
-                                               $filters2 = 
array('contract_ids_one_time' => true, 'credits' => true);
+                                               $filters2 = 
array('contract_ids_one_time' => true);
+                                               if($month == 2)
+                                               {
+                                                       $filters2['credits'] = 
true;
+                                               }
+                                               else if($month == 3)
+                                               {
+                                                       
$filters2['positive_one_time'] = true;
+                                               }
                                                $contracts = array();
                                        }
                                        else
@@ -961,6 +981,7 @@
                                        {
                                                $options[] = array('id' => 
$term_id . '-1', 'name' => lang($term_title), 'selected' => (($term_id . '-1' 
== $billing_term_selection) ? 1 : 0));
                                                $options[] = array('id' => 
$term_id . '-2', 'name' => 'Kreditering', 'selected' => (($term_id . '-2' == 
$billing_term_selection) ? 1 : 0));
+                                               $options[] = array('id' => 
$term_id . '-3', 'name' => lang('positive one time'), 'selected' => (($term_id 
. '-3' == $billing_term_selection) ? 1 : 0));
                                        }
                                        $current++;
                                        $billing_term_group_options[] = 
array('label' => lang($term_title), 'options' => $options);

Modified: branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php  
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php  
2017-03-30 12:35:36 UTC (rev 16498)
@@ -329,7 +329,7 @@
                 * @param bool $bill_only_one_time      flag to indicate if the 
the invoice should only bill one time price elements
                 * @return rental_invoice       the newly created invoice
                 */
-               public static function create_invoice( int $decimals, int 
$billing_id, int $contract_id, bool $override, int $timestamp_invoice_start, 
int $timestamp_invoice_end, $bill_only_one_time, $dry_run = false, 
$billing_term = 0 )
+               public static function create_invoice( int $decimals, int 
$billing_id, int $contract_id, bool $override, int $timestamp_invoice_start, 
int $timestamp_invoice_end, $bill_only_one_time, $dry_run = false, 
$billing_term = 0, $month = 0)
                {
                        $contract = 
rental_socontract::get_instance()->get_single($contract_id);
 
@@ -363,8 +363,21 @@
                                {
                                        $filters2 = array(
                                                'contract_id' => 
$contract->get_id(),
-                                               'contract_ids_one_time' => 
true, 'credits' => true
+                                               'contract_ids_one_time' => true
                                        );
+                                       if($month == 2)
+                                       {
+                                               $filters2['credits'] = true;
+                                       }
+                                       else if($month == 3)
+                                       {
+                                               $filters2['positive_one_time'] 
= true;
+                                       }
+
+//                                     $filters2 = array(
+//                                             'contract_id' => 
$contract->get_id(),
+//                                             'contract_ids_one_time' => 
true, 'credits' => true
+//                                     );
                                }
                                else
                                {

Modified: branches/Version-2_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/rental/setup/phpgw_no.lang      2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/setup/phpgw_no.lang      2017-03-30 
12:35:36 UTC (rev 16498)
@@ -665,4 +665,5 @@
 select all     rental  no      Velg alle
 planned        rental  no      Planlagt
 email template rental  no      Standardtekster
-expired        rental  no      Utgått
\ No newline at end of file
+expired        rental  no      Utgått
+positive one time      rental  no      Positive engangsbeløp
\ No newline at end of file

Modified: branches/Version-2_0-branch/rental/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/setup/tables_current.inc.php     
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/rental/setup/tables_current.inc.php     
2017-03-30 12:35:36 UTC (rev 16498)
@@ -240,8 +240,18 @@
                                'location_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => true),
                                'result_unit_number' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true),
                                'org_enhet_id' => array('type' => 'int', 
'precision' => 8, 'nullable' => true),
-                               'unit_leader' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => true)
+                               'unit_leader' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => true),
+//                             'organization_number' => array('type' => 
'varchar', 'precision' => '9','nullable' => True),
                        ),
+/**
+ *
+1.       Kundenr.
+2.       Org.nr.
+3.       Ansattnr.
+4.       Født nr. (dd.mm.åååå)
+5.       Koststed (fire siffer)
+
+ */
                        'pk' => array('id'),
                        'fk' => array(),
                        'ix' => array(),

Modified: branches/Version-2_0-branch/setup/inc/functions.inc.php
===================================================================
--- branches/Version-2_0-branch/setup/inc/functions.inc.php     2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/inc/functions.inc.php     2017-03-30 
12:35:36 UTC (rev 16498)
@@ -346,9 +346,11 @@
 
        $GLOBALS['phpgw_info']['server']['app_images'] = 
'templates/base/images';
 
-       if(isset($_POST['setting']['enable_mcrypt']) && 
$_POST['setting']['enable_mcrypt'] == 'True')
+//     if(isset($_POST['setting']['enable_mcrypt']) && 
$_POST['setting']['enable_mcrypt'] == 'True')
+       if(!empty($_POST['setting']['enable_crypto']))
        {
-               $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = true;
+//             $GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = true;
+               $GLOBALS['phpgw_info']['server']['enable_crypto'] = 
$_POST['setting']['enable_crypto'];
                $_iv  = $_POST['setting']['mcrypt_iv'];
                $_key = $_POST['setting']['setup_mcrypt_key'];
        }

Modified: branches/Version-2_0-branch/setup/lang/phpgw_de.lang
===================================================================
--- branches/Version-2_0-branch/setup/lang/phpgw_de.lang        2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/lang/phpgw_de.lang        2017-03-30 
12:35:36 UTC (rev 16498)
@@ -306,7 +306,7 @@
 this section will help you export users and groups from phpgroupware's account 
tables into your ldap tree      setup   de      Dieser Abschnitt wird Ihnen 
beim exportieren von Benutzern/Gruppen aus phpGroupWare's Account Tabellen in 
Ihren LDAP Baum behilflich sein
 this section will help you import users and groups from your ldap tree into 
phpgroupware's account tables      setup   de      Dieser Abschnitt wird Ihnen 
beim importieren von Benutzern/Gruppen aus Ihrem LDAP Baum in phpGroupWare's 
Account Tabellen behilflich sein
 this section will help you setup your ldap accounts for use with phpgroupware  
setup   de      Dieser Abschnitt wird ihnen helfen ihrer LDAP Benutzer für 
phpGroupWare vorzubereiten.
-this should be around 30 bytes in length.<br>note: the default has been 
randomly generated.    setup   de      Das sollte ungefähr 30 Zeichen lang 
sein<br>Hinweis: Die Vorgabe wurde zufällig erzeugt.
+this should be around 32 bytes in length.<br>note: the default has been 
randomly generated.    setup   de      Das sollte ungefähr 32 Zeichen lang 
sein<br>Hinweis: Die Vorgabe wurde zufällig erzeugt.
 this stage is completed<br>    setup   de      Dieser Schritt ist 
abgeschlossen<br>
 this will create 1 admin account and 3 demo accounts<br>the username/passwords 
are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!this will delete all 
existing accounts!!!</b><br>        setup   de      Dies wird 1 Admin- und 3 
Demo Benutzerkonten erstellen<br>Die Benutzernamen/Passworte sind: demo/guest, 
demo2/guest and demo3/guest.<br><b>!!!DIES WIRD ALLE EXISTIERENDEN 
BENUTZERKONTEN LÖSCHEN!!!</b><br>
 to a version it does not know about    setup   de      auf eine Version von 
der nichts bekannt ist

Modified: branches/Version-2_0-branch/setup/lang/phpgw_en.lang
===================================================================
--- branches/Version-2_0-branch/setup/lang/phpgw_en.lang        2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/lang/phpgw_en.lang        2017-03-30 
12:35:36 UTC (rev 16498)
@@ -326,7 +326,7 @@
 this section will help you export users and groups from phpgroupware's account 
tables into your ldap tree      setup   en      This section will help you 
export users and groups from phpGroupWare's account tables into your LDAP tree
 this section will help you import users and groups from your ldap tree into 
phpgroupware's account tables      setup   en      This section will help you 
import users and groups from your LDAP tree into phpGroupWare's account tables
 this section will help you setup your ldap accounts for use with phpgroupware  
setup   en      This section will help you setup your LDAP accounts for use 
with phpGroupWare
-this should be around 30 bytes in length.<br>note: the default has been 
randomly generated.    setup   en      This should be around 30 bytes in 
length.<br>Note: The default has been randomly generated.
+this should be around 32 bytes in length.<br>note: the default has been 
randomly generated.    setup   en      This should be around 32 bytes in 
length.<br>Note: The default has been randomly generated.
 this stage is completed<br>    setup   en      This stage is completed<br>
 this will create 1 admin account and 3 demo accounts<br>the username/passwords 
are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!this will delete all 
existing accounts!!!</b><br>        setup   en      This will create 1 admin 
account and 3 demo accounts<br>The username/passwords are: demo/guest, 
demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING 
ACCOUNTS!!!</b><br>
 this will create an admin account and (optionally) 3 demo accounts.<br>the 
username/passwords are: demo/guest, demo2/guest and demo3/guest.<br>        
setup   en      This will create an admin account and (optionally) 3 demo 
accounts.<br>The username/passwords are: demo/guest, demo2/guest and 
demo3/guest.<br>

Modified: branches/Version-2_0-branch/setup/lang/phpgw_fr.lang
===================================================================
--- branches/Version-2_0-branch/setup/lang/phpgw_fr.lang        2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/lang/phpgw_fr.lang        2017-03-30 
12:35:36 UTC (rev 16498)
@@ -322,7 +322,7 @@
 this section will help you export users and groups from phpgroupWare's account 
tables into your ldap tree      setup   fr      Cette section va vous aider à 
exporter les utilisateurs et groupes des tables de comptes de phpGroupWare vers 
votre arbre LDAP
 this section will help you import users and groups from your ldap tree into 
phpGroupWare's account tables      setup   fr      Cette section va vous aider 
à importer les utilisateurs et groupes de votre arbre LDAP vers les tables de 
comptes de phpGroupWare
 this section will help you setup your LDAP accounts for use with phpGroupWare  
setup   fr      Cette section va vous aider à configurer vos comptes LDAP pour 
les utiliser dans phpGroupWare
-this should be around 30 bytes in length.<br>note: the default has been 
randomly generated.    setup   fr      Ceci devrait faire environ 30 octets de 
long.<br>Note: la valeur par défaut a été générée au hasard.
+this should be around 32 bytes in length.<br>note: the default has been 
randomly generated.    setup   fr      Ceci devrait faire environ 32 octets de 
long.<br>Note: la valeur par défaut a été générée au hasard.
 this stage is completed<br>    setup   fr      Cette étape est complétée<br>
 this will create 1 admin account and 3 demo accounts<br>the username/passwords 
are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL 
EXISTING ACCOUNTS!!!</b><br>        setup   fr      Ceci va créer 1 compte 
admin et 3 comptes demo<br>Les utilisateurs/mots de passe sont: demo/guest, 
demo2/guest et demo3/guest.<br><b>!!!CECI VA SUPPRIMER TOUS LES COMPTES 
EXISTANTS!!!</b><br>
 this will create an admin account and (optionally) 3 demo accounts.<br>the 
username/passwords are: demo/guest, demo2/guest and demo3/guest.<br>        
setup   fr      Ceci va créer un compte admin et 3 comptes demo 
(optionnel).<br>Les utilisateurs/mots de passe sont: demo/guest, demo2/guest et 
demo3/guest.<br>

Modified: branches/Version-2_0-branch/setup/lang/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/setup/lang/phpgw_no.lang        2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/lang/phpgw_no.lang        2017-03-30 
12:35:36 UTC (rev 16498)
@@ -326,7 +326,7 @@
 this section will help you export users and groups from phpgroupware's account 
tables into your ldap tree      setup   no      This section will help you 
export users and groups from phpGroupWare's account tables into your LDAP tree
 this section will help you import users and groups from your ldap tree into 
phpgroupware's account tables      setup   no      This section will help you 
import users and groups from your LDAP tree into phpGroupWare's account tables
 this section will help you setup your ldap accounts for use with phpgroupware  
setup   no      This section will help you setup your LDAP accounts for use 
with phpGroupWare
-this should be around 30 bytes in length.<br>note: the default has been 
randomly generated.    setup   no      This should be around 30 bytes in 
length.<br>Note: The default has been randomly generated.
+this should be around 32 bytes in length.<br>note: the default has been 
randomly generated.    setup   no      This should be around 32 bytes in 
length.<br>Note: The default has been randomly generated.
 this stage is completed<br>    setup   no      This stage is completed<br>
 this will create 1 admin account and 3 demo accounts<br>the username/passwords 
are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!this will delete all 
existing accounts!!!</b><br>        setup   no      This will create 1 admin 
account and 3 demo accounts<br>The username/passwords are: demo/guest, 
demo2/guest and demo3/guest.<br><b>!!!THIS WILL DELETE ALL EXISTING 
ACCOUNTS!!!</b><br>
 this will create an admin account and (optionally) 3 demo accounts.<br>the 
username/passwords are: demo/guest, demo2/guest and demo3/guest.<br>        
setup   no      This will create an admin account and (optionally) 3 demo 
accounts.<br>The username/passwords are: demo/guest, demo2/guest and 
demo3/guest.<br>

Modified: branches/Version-2_0-branch/setup/lang/phpgw_tr.lang
===================================================================
--- branches/Version-2_0-branch/setup/lang/phpgw_tr.lang        2017-03-30 
12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/lang/phpgw_tr.lang        2017-03-30 
12:35:36 UTC (rev 16498)
@@ -302,7 +302,7 @@
 this section will help you export users and groups from phpgroupware's account 
tables into your ldap tree      setup   tr      Bu bölüm size kullanıcı ve 
grupları phpGroupWare hesap tablosundan LDAP ağaç yapısına taşımanıza yardım 
eder
 this section will help you import users and groups from your ldap tree into 
phpgroupware's account tables      setup   tr      Bu bölüm size kullanıcı ve 
grupları phpGroupWare LDAP ağaç yapısından LDAP hesap tablosuna taşımanıza 
yardım eder
 this section will help you setup your ldap accounts for use with phpgroupware  
setup   tr      Bu bölüm size LDAP hesaplarının phpgroupware ile 
kullanılmasının düzenlenmesinde yardımcı olur
-this should be around 30 bytes in length.<br>note: the default has been 
randomly generated.    setup   tr      Bu yaklaşık 30 byte uzunluğunda 
olabilir.<br>Dikkat: Varsayılan rastgele oluşturuldu.
+this should be around 32 bytes in length.<br>note: the default has been 
randomly generated.    setup   tr      Bu yaklaşık 32 byte uzunluğunda 
olabilir.<br>Dikkat: Varsayılan rastgele oluşturuldu.
 this stage is completed<br>    setup   tr      Bu bölüm tamamlandı<br>
 this will create 1 admin account and 3 demo accounts<br>the username/passwords 
are: demo/guest, demo2/guest and demo3/guest.<br><b>!!!this will delete all 
existing accounts!!!</b><br>        setup   tr      Bu bir yönetici 3 te demo 
hesap oluşturacaktır.<br>kullanıcı adı/şifreler: demo/guest, demo2/guest and 
demo3/guest.<br><b>!!!BU VAROLAN BÜTÜN HESAPLARI SİLECEKTİR!!!</b><br>
 to a version it does not know about    setup   tr      bu versiyon tanınmıyor

Modified: branches/Version-2_0-branch/setup/manageheader.php
===================================================================
--- branches/Version-2_0-branch/setup/manageheader.php  2017-03-30 12:34:00 UTC 
(rev 16497)
+++ branches/Version-2_0-branch/setup/manageheader.php  2017-03-30 12:35:36 UTC 
(rev 16498)
@@ -22,7 +22,7 @@
         * Include setup functions
         */
        require_once('./inc/functions.inc.php');
-       
+
        srand((double)microtime()*1000000);
        $random_char = array(
                '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f',
@@ -43,7 +43,7 @@
        if(!isset($GLOBALS['phpgw_info']['server']['setup_mcrypt_key']) || 
!$GLOBALS['phpgw_info']['server']['setup_mcrypt_key'])
        {
                $GLOBALS['phpgw_info']['server']['setup_mcrypt_key'] = '';
-               for($i=0; $i < 30; ++$i)
+               for($i=0; $i < 32; ++$i)
                {
                        $GLOBALS['phpgw_info']['server']['setup_mcrypt_key'] .= 
$random_char[rand(0,count($random_char)-1)];
                }
@@ -246,10 +246,10 @@
                        }
 */
 
-                       if (version_compare(PHP_VERSION, '5.2.0') < 0)
+                       if (version_compare(PHP_VERSION, '5.3.0') < 0)
                        {
                                $detected .= '<b><p align="center" class="msg">'
-                                       . lang('You appear to be using PHP %1, 
phpGroupWare requires version 5.2.0 or later', PHP_VERSION). "\n"
+                                       . lang('You appear to be using PHP %1, 
phpGroupWare requires version 5.3.0 or later', PHP_VERSION). "\n"
                                        . 
'</p></b><td></tr></table></body></html>';
                                die($detected);
                        }
@@ -269,13 +269,13 @@
                                {
                                        $request_order = '<li>' . lang('You 
appear to have set request_order = "GPCS"') . "</li>\n";
                                }
-                               
+
                        }
 
                        if ( !function_exists('json_encode') ) // Some 
distributions have removed the standard JSON extension as of PHP 5.5rc2 due to 
a license conflict
                        {
                                $detected .= '<b><p align="center" class="msg">'
-                                       . "You have to install php5-json\n"
+                                       . "You have to install php-json\n"
                                        . 
'</p></b><td></tr></table></body></html>';
                                die($detected);
                        }
@@ -293,7 +293,7 @@
                                }
                        }
 
-                       $phpver = '<li>' . lang('You appear to be using PHP 
%1+', 5.2) . "</li>\n";
+                       $phpver = '<li>' . lang('You appear to be using PHP 
%1+', 5.3) . "</li>\n";
                        $supported_sessions_type = array('php', 'db');
 
                        $detected .= '<table id="manageheader">' . "\n";
@@ -358,6 +358,20 @@
                                }
                        }
 
+                       if(!class_exists('ZipArchive'))
+                       {
+                               $detected .= '<li class="warn">' . lang('you 
need ZipArchive for Excel-support') . "</li>\n";
+                       }
+
+                       if(class_exists('SoapClient'))
+                       {
+                               $detected .= '<li>' . lang('You appear to have 
Soap support enabled') . "</li>\n";
+                       }
+                       else
+                       {
+                               $detected .= '<li class="warn">' . lang('you 
may need Soap support for integration with other systems') . "</li>\n";
+                       }
+
                        /* Not currently supported
                        if (extension_loaded('odbc') || 
function_exists('odbc_connect'))
                        {
@@ -429,15 +443,29 @@
                        {
                                $detected .= '<li class="warn">' . lang('No 
support for shared memory found.') . "</li>\n";
                        }
+
+                       $supported_crypto_type = array();
+                       if(extension_loaded('libsodium') || 
function_exists('\Sodium\version_string()'))
+                       {
+                               $supported_crypto_type[] = 'libsodium';
+                               $detected .= '<li>' . lang('You appear to have 
enabled support for libsodium %1', \Sodium\version_string()) . "</li>\n";
+                       }
+                       else
+                       {
+                               $detected .= '<li class="warn">' . lang('No 
libsodium support found.') . "</li>\n";
+                       }
+
                        if(extension_loaded('mcrypt') || 
function_exists('mcrypt_list_modes'))
                        {
+                               $supported_crypto_type[] = 'mcrypt';
                                $detected .= '<li>' . lang('You appear to have 
enabled support for mcrypt') . "</li>\n";
-//                             
$GLOBALS['phpgw_info']['server']['mcrypt_enabled'] = true;
                        }
                        else
                        {
                                $detected .= '<li class="warn">' . lang('No 
mcrypt support found.') . "</li>\n";
-                       }               
+                       }
+
+
                        if( extension_loaded('xsl') && 
class_exists('XSLTProcessor') )
                        {
                                $detected .= '<li>' . lang('You appear to have 
XML/XSLT support enabled') . "</li>\n";
@@ -680,6 +708,28 @@
                        }
                        $setup_tpl->set_var('session_options',$session_options);
 
+                       unset($stype);
+                       $selected = '';
+                       $crypto_options = '';
+                       $crypto_options .= <<<HTML
+                               <option value="">None</option>
+
+HTML;
+                       foreach ( $supported_crypto_type as $stype )
+                       {
+                               $selected = '';
+                               if( 
isset($GLOBALS['phpgw_info']['server']['enable_crypto'])
+                                       && $stype == 
$GLOBALS['phpgw_info']['server']['enable_crypto'])
+                               {
+                                       $selected = ' selected ';
+                               }
+                               $crypto_options .= <<<HTML
+                                       <option{$selected} 
value="{$stype}">{$stype}</option>
+
+HTML;
+                       }
+                       $setup_tpl->set_var('crypto_options',$crypto_options);
+
                        if ( 
isset($GLOBALS['phpgw_info']['server']['mcrypt_enabled']) && 
$GLOBALS['phpgw_info']['server']['mcrypt_enabled'] )
                        {
                                $setup_tpl->set_var('mcrypt_enabled_yes',' 
selected');
@@ -773,14 +823,15 @@
                        $setup_tpl->set_var('lang_persistdescr',lang('Do you 
want persistent connections (higher performance, but consumes more 
resources)'));
                        $setup_tpl->set_var('lang_sesstype',lang('Sessions 
Type'));
                        $setup_tpl->set_var('lang_sesstypedescr',lang('What 
type of sessions management do you want to use (PHP session management usually 
performs better)?'));
+                       $setup_tpl->set_var('lang_enable_crypto',lang('Enable 
Crypto'));
                        $setup_tpl->set_var('lang_enablemcrypt',lang('Enable 
MCrypt'));
                        $setup_tpl->set_var('lang_mcryptversion',lang('MCrypt 
version'));
                        $setup_tpl->set_var('lang_mcryptversiondescr',lang('Set 
this to "old" for versions &lt; 2.4, otherwise the exact mcrypt version you 
use.'));
                        $setup_tpl->set_var('lang_mcryptiv',lang('MCrypt 
initialization vector'));
-                       $setup_tpl->set_var('lang_mcryptivdescr',lang('This 
should be around 30 bytes in length.<br>Note: The default has been randomly 
generated.'));
+                       $setup_tpl->set_var('lang_mcryptivdescr',lang('This 
should be around 32 bytes in length.<br>Note: The default has been randomly 
generated.'));
 
                        $setup_tpl->set_var('lang_setup_mcrypt_key',lang('Enter 
some random text as encryption key for the setup encryption'));
-                       
$setup_tpl->set_var('lang_setup_mcrypt_key_descr',lang('This should be around 
30 bytes in length.<br>Note: The default has been randomly generated.'));
+                       
$setup_tpl->set_var('lang_setup_mcrypt_key_descr',lang('This should be around 
32 bytes in length.<br>Note: The default has been randomly generated.'));
 
                        $setup_tpl->set_var('lang_domselect',lang('Domain 
select box on login'));
                        $setup_tpl->set_var('lang_domain_from_host', 
lang('Automatically detect domain from hostname'));

Modified: branches/Version-2_0-branch/setup/templates/base/manageheader.tpl
===================================================================
--- branches/Version-2_0-branch/setup/templates/base/manageheader.tpl   
2017-03-30 12:34:00 UTC (rev 16497)
+++ branches/Version-2_0-branch/setup/templates/base/manageheader.tpl   
2017-03-30 12:35:36 UTC (rev 16498)
@@ -60,6 +60,13 @@
     <td>{lang_sesstypedescr}</td>
   </tr>
   <tr>
+    <td colspan=2><b>{lang_enable_crypto}</b><br>
+      <select name="setting[enable_crypto]">
+{crypto_options}
+      </select>
+    </td>
+  </tr>
+  <!--tr>
     <td colspan=2><b>{lang_enablemcrypt}</b><br>
       <select name="setting[enable_mcrypt]">
         <option value="True"{mcrypt_enabled_yes}>True
@@ -66,7 +73,7 @@
         <option value="False"{mcrypt_enabled_no}>False
       </select>
     </td>
-  </tr>
+  </tr-->
   <tr>
     <td><b>{lang_mcryptiv}</b><br><input type="text" name="setting[mcrypt_iv]" 
value="{mcrypt_iv}" size="30"></td>
     <td>{lang_mcryptivdescr}</td>




reply via email to

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