fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16100] Stable: Merge 16082:16099 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [16100] Stable: Merge 16082:16099 from trunk
Date: Sun, 18 Dec 2016 19:31:35 +0000 (UTC)

Revision: 16100
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16100
Author:   sigurdne
Date:     2016-12-18 19:31:35 +0000 (Sun, 18 Dec 2016)
Log Message:
-----------
Stable: Merge 16082:16099 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/admin/inc/class.ui_custom.inc.php
    branches/Version-2_0-branch/admin/templates/base/custom.xsl
    branches/Version-2_0-branch/eventplanner/inc/class.bocommon.inc.php
    branches/Version-2_0-branch/eventplanner/inc/class.uivendor_report.inc.php
    branches/Version-2_0-branch/eventplanner/js/portico/booking.edit.js
    branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/model/class.model.inc.php
    branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
    branches/Version-2_0-branch/phpgwapi/templates/mobilefrontend/navbar.inc.php
    branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php
    branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-2_0-branch/property/inc/class.uitts.inc.php
    branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
    
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
    
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
    branches/Version-2_0-branch/property/js/portico/workorder.edit.js
    branches/Version-2_0-branch/rental/inc/class.menu.inc.php
    branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
    branches/Version-2_0-branch/rental/setup/phpgw_no.lang
    branches/Version-2_0-branch/rental/setup/setup.inc.php
    branches/Version-2_0-branch/rental/setup/tables_current.inc.php
    branches/Version-2_0-branch/rental/setup/tables_update.inc.php

Added Paths:
-----------
    branches/Version-2_0-branch/mobilefrontend/rental/
    branches/Version-2_0-branch/rental/inc/class.bomoveout.inc.php
    branches/Version-2_0-branch/rental/inc/class.somoveout.inc.php
    branches/Version-2_0-branch/rental/inc/class.uimoveout.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.moveout.inc.php
    branches/Version-2_0-branch/rental/js/rental/moveout.edit.js
    branches/Version-2_0-branch/rental/templates/base/moveout.xsl

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


Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-15891
/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
   + /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-15891
/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

Modified: branches/Version-2_0-branch/admin/inc/class.ui_custom.inc.php
===================================================================
--- branches/Version-2_0-branch/admin/inc/class.ui_custom.inc.php       
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/admin/inc/class.ui_custom.inc.php       
2016-12-18 19:31:35 UTC (rev 16100)
@@ -61,7 +61,7 @@
                        $this->bolocation->acl_app      = $this->appname;
 
                        $this->acl                       = & 
$GLOBALS['phpgw']->acl;
-                       $this->acl_location      = 'admin';
+                       $this->acl_location      = '.admin';
                        $this->acl_read          = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, $this->appname);
                        $this->acl_add           = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, $this->appname);
                        $this->acl_edit          = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, $this->appname);
@@ -96,6 +96,11 @@
 
                function list_attribute()
                {
+                       if(!$this->acl_read)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
+
                        $appname        = $this->appname;
                        $location       = $this->location;
                        $id                     = phpgw::get_var('id', 'int');
@@ -259,6 +264,11 @@
 
                function edit_attrib()
                {
+                       if(!$this->acl_add)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
+
                        $appname        = $this->appname;
                        $location       = $this->location;
                        $id                     = phpgw::get_var('id', 'int');
@@ -477,6 +487,11 @@
 
                function list_custom_function()
                {
+                       if(!$this->acl_read)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
+
                        if($this->local_menu_selection)
                        {
                                
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
@@ -663,7 +678,12 @@
 
                function edit_custom_function()
                {
-       //              $GLOBALS['phpgw_info']['flags']['menu_selection'] .= 
'::list_functions';
+                       if(!$this->acl_add)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
+
+                       //              
$GLOBALS['phpgw_info']['flags']['menu_selection'] .= '::list_functions';
                        $appname        = $this->appname;
                        $location       = $this->location;
                        $id                     = phpgw::get_var('id', 'int');
@@ -782,6 +802,11 @@
 
                function delete()
                {
+                       if(!$this->acl_delete)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
+
                        $appname                                = 
phpgw::get_var('appname');
                        $location                               = 
phpgw::get_var('location');
                        $attrib_id                              = 
phpgw::get_var('attrib_id', 'int');
@@ -1270,6 +1295,10 @@
 
                public function query($data = array())
                {
+                       if(!$this->acl_read)
+                       {
+                               phpgw::no_access($this->appname);
+                       }
 
                        $search  = phpgw::get_var('search');
                        $order   = phpgw::get_var('order');

Modified: branches/Version-2_0-branch/admin/templates/base/custom.xsl
===================================================================
--- branches/Version-2_0-branch/admin/templates/base/custom.xsl 2016-12-18 
19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/admin/templates/base/custom.xsl 2016-12-18 
19:31:35 UTC (rev 16100)
@@ -286,7 +286,7 @@
                                                <xsl:value-of 
select="php:function('lang', 'column name')" />
                                        </td>
                                        <td>
-                                               <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="20">
+                                               <input type="text" 
name="values[column_name]" value="{value_column_name}" maxlength="50">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'enter the name for the column')" />
                                                        </xsl:attribute>

Modified: branches/Version-2_0-branch/eventplanner/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.bocommon.inc.php 
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/eventplanner/inc/class.bocommon.inc.php 
2016-12-18 19:31:35 UTC (rev 16100)
@@ -104,6 +104,9 @@
                                        }
                                }
                        }
+                       $values_attribute = phpgw::get_var('values_attribute');
+                       $object->set_field( 'values_attribute', 
$values_attribute);
+
                        return $object;
                }
 

Modified: 
branches/Version-2_0-branch/eventplanner/inc/class.uivendor_report.inc.php
===================================================================
--- branches/Version-2_0-branch/eventplanner/inc/class.uivendor_report.inc.php  
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/eventplanner/inc/class.uivendor_report.inc.php  
2016-12-18 19:31:35 UTC (rev 16100)
@@ -45,7 +45,8 @@
 
                protected
                        $fields,
-                       $permissions;
+                       $permissions,
+                       $custom_fields;
 
                public function __construct()
                {

Modified: branches/Version-2_0-branch/eventplanner/js/portico/booking.edit.js
===================================================================
--- branches/Version-2_0-branch/eventplanner/js/portico/booking.edit.js 
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/eventplanner/js/portico/booking.edit.js 
2016-12-18 19:31:35 UTC (rev 16100)
@@ -1,3 +1,4 @@
+var customer_id_selection;
 var lang;
 var oArgs = {menuaction: 'eventplanner.uicustomer.index', organization_number: 
true};
 var strURL = phpGWLink('index.php', oArgs, true);

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2016-12-18 19:31:35 UTC (rev 16100)
@@ -1,4 +1,5 @@
 <?php
+
        /**
         * phpGroupWare
         *
@@ -10,23 +11,22 @@
         * @subpackage phpgwapi
         * @version $Id: class.custom_fields.inc.php 15409 2016-08-03 11:52:23Z 
sigurdne $
         */
-
        /*
-          This program is free software: you can redistribute it and/or modify
-          it under the terms of the GNU General Public License as published by
-          the Free Software Foundation, either version 2 of the License, or
-          (at your option) any later version.
+         This program is 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.
+         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/>.
+         You should have received a copy of the GNU General Public License
+         along with this program.  If not, see <http://www.gnu.org/licenses/>.
         */
 
-       abstract class  phpgwapi_socommon
+       abstract class phpgwapi_socommon
        {
 
                protected $db;
@@ -41,7 +41,7 @@
                protected static $so;
                protected $table_name;
 
-               public function __construct($table_name, $fields)
+               public function __construct( $table_name, $fields )
                {
                        $this->db = & $GLOBALS['phpgw']->db;
                        $this->db2 = clone($GLOBALS['phpgw']->db);
@@ -77,7 +77,7 @@
                /**
                 * Rollback the current transaction
                 *
-                * @return bool True if sucessful, False if fails
+                * @return bool True if successful, False if fails
                 */
                public function transaction_abort()
                {
@@ -173,7 +173,6 @@
                 */
                public abstract static function get_instance();
 
-
                /**
                 * Method for retrieving the db-object (security "forgotten")
                 */
@@ -340,7 +339,7 @@
                        return $this->table_name . '.id=' . $id_value;
                }
 
-               function read_single( $id, $return_object = false)
+               function read_single( $id, $return_object = false )
                {
                        if (!$id && !$return_object)
                        {
@@ -416,7 +415,7 @@
                                        }
                                }
                        }
-                       if($return_object)
+                       if ($return_object)
                        {
                                return $this->populate($row);
                        }
@@ -426,7 +425,6 @@
                        }
                }
 
-
                function _get_conditions( $query, $filters )
                {
                        $clauses = array('1=1');
@@ -484,7 +482,7 @@
                                        }
                                        else
                                        {
-                                               $_column = 
$this->fields[$key]['join'] ? $this->fields[$key]['join']['column'] : $key;     
                             
+                                               $_column = 
$this->fields[$key]['join'] ? $this->fields[$key]['join']['column'] : $key;
                                                $clauses[] = 
"{$table}.{$_column}=" . $this->marshal($val, $this->fields[$key]['type']);
                                        }
                                }
@@ -544,7 +542,6 @@
                        return array($cols, $joins);
                }
 
-
                /**
                 * Implementing classes must return the name of the field used 
in the query
                 * returned from get_query().
@@ -558,7 +555,6 @@
 
                protected abstract function populate( array $data );
 
-
                protected function add( &$object )
                {
                        $object->entry_date = time();
@@ -566,14 +562,11 @@
 
                        $fields = $object::get_fields();
 
-                       foreach ($fields as $field      => $field_info)
+                       foreach ($fields as $field => $field_info)
                        {
-                               if(($field_info['action'] & PHPGW_ACL_ADD)
-                                       && empty($field_info['join'])
-                                       && empty($field_info['related'])
-                                       && empty($field_info['manytomany']))
+                               if (($field_info['action'] & PHPGW_ACL_ADD) && 
empty($field_info['join']) && empty($field_info['related']) && 
empty($field_info['manytomany']))
                                {
-                                       if($field_info['type'] == 'json')
+                                       if ($field_info['type'] == 'json')
                                        {
                                                $value_set[$field] = 
json_encode($object->$field);
                                        }
@@ -583,8 +576,25 @@
                                        }
                                }
                        }
-                       
-                       $sql = "INSERT INTO {$this->table_name} (". 
implode(',',  array_keys($value_set))
+//                     $custom_fields = $object::get_custom_fields();
+                       $values_attribute = 
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
+
+                       if ( $values_attribute)
+                       {
+                               foreach ($values_attribute as $attrib_id => 
$entry)
+                               {
+                                       if ($entry['value'])
+                                       {
+                                               if ($entry['datatype'] == 'C' 
|| $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] 
== 'link')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+                                               $value_set[$entry['name']] = 
$entry['value'];
+                                       }
+                               }
+                       }
+
+                       $sql = "INSERT INTO {$this->table_name} (" . 
implode(',', array_keys($value_set))
                                . ') VALUES ('
                                . 
$this->db->validate_insert(array_values($value_set))
                                . ')';
@@ -598,7 +608,7 @@
                                $this->db->transaction_begin();
                        }
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->query($sql, __LINE__, __FILE__);
 
                        $id = $this->db->get_last_insert_id($this->table_name, 
'id');
                        $object->set_id($id);
@@ -626,12 +636,9 @@
 
                        foreach ($this->fields as $field => $field_info)
                        {
-                               if(($field_info['action'] & PHPGW_ACL_EDIT) 
-                                       && empty($field_info['join'])
-                                       && empty($field_info['related'])
-                                       && empty($field_info['manytomany']))
+                               if (($field_info['action'] & PHPGW_ACL_EDIT) && 
empty($field_info['join']) && empty($field_info['related']) && 
empty($field_info['manytomany']))
                                {
-                                       if($field_info['type'] == 'json')
+                                       if ($field_info['type'] == 'json')
                                        {
                                                $value_set[$field] = 
json_encode($object->$field);
                                        }
@@ -641,12 +648,28 @@
                                        }
                                }
                        }
+                       $values_attribute = 
createObject('phpgwapi.custom_fields')->convert_attribute_save($object->values_attribute);
 
+                       if ( $values_attribute)
+                       {
+                               foreach ($values_attribute as $attrib_id => 
$entry)
+                               {
+                                       if ($entry['value'])
+                                       {
+                                               if ($entry['datatype'] == 'C' 
|| $entry['datatype'] == 'T' || $entry['datatype'] == 'V' || $entry['datatype'] 
== 'link')
+                                               {
+                                                       $entry['value'] = 
$this->db->db_addslashes($entry['value']);
+                                               }
+                                               $value_set[$entry['name']] = 
$entry['value'];
+                                       }
+                               }
+                       }
+
                        $sql = "UPDATE {$this->table_name} SET "
                                . $this->db->validate_update($value_set)
                                . " WHERE id = {$id}";
 
-                       $ret1 = $this->db->query($sql,__LINE__,__FILE__);
+                       $ret1 = $this->db->query($sql, __LINE__, __FILE__);
 
                        $ret2 = $this->add_manytomany($object);
 
@@ -681,7 +704,7 @@
                                                $colnames = join(',', 
array_keys($colnames));
 
                                                $v = 
$object->get_field($params['manytomany']['input_field']);
-                                               
+
                                                $data = array();
                                                foreach 
($params['manytomany']['column'] as $intOrCol => $paramsOrCol)
                                                {
@@ -705,17 +728,17 @@
                                                }
                                                $v = join(',', $data);
                                                $update_query = "INSERT INTO 
$table ($key, $colnames) VALUES($id, $v)";
-                                               return 
$this->db->query($update_query,__LINE__,__FILE__);
+                                               return 
$this->db->query($update_query, __LINE__, __FILE__);
                                        }
                                        else
                                        {
                                                $colname = 
$params['manytomany']['column'];
                                                $v = 
$this->marshal($object->get_field($params['manytomany']['input_field']), 
$params['type']);
                                                $update_query = "INSERT INTO 
$table ($key, $colname) VALUES($id, $v)";
-                                               return 
$this->db->query($update_query,__LINE__,__FILE__);
+                                               return 
$this->db->query($update_query, __LINE__, __FILE__);
                                        }
                                }
-                               else if(!empty($params['manytomany']) && 
is_array($value))
+                               else if (!empty($params['manytomany']) && 
is_array($value))
                                {
                                        $update_queries = array();
                                        $table = $params['manytomany']['table'];
@@ -773,7 +796,6 @@
                                        {
                                                $this->db->query($update_query, 
__LINE__, __FILE__);
                                        }
-
                                }
                        }
                        return true;
@@ -796,4 +818,4 @@
                                return $this->add($object);
                        }
                }
-       }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/phpgwapi/inc/model/class.model.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/model/class.model.inc.php  
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/phpgwapi/inc/model/class.model.inc.php  
2016-12-18 19:31:35 UTC (rev 16100)
@@ -279,7 +279,15 @@
                        return $errors ? false : true;
                }
 
+
                /**
+                * Implement in subclasses
+                */
+               public function get_custom_fields()
+               {
+                       return array();
+               }
+               /**
                 * Implement in subclasses to perform actions on entity before 
validation
                 */
                protected function preValidate( &$entity )

Modified: branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
===================================================================
--- branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-12-18 
19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-12-18 
19:31:35 UTC (rev 16100)
@@ -509,8 +509,11 @@
        });
        $("#" + container + ' tbody').on('click', 'tr', function ()
        {
+               $(this).toggleClass('selected');
                var api = oTable.api();
-               var selectedRows = api.rows({selected: true}).count();
+//             var selectedRows = api.rows({selected: true}).count();
+               var selectedRows = api.rows('.selected').data().length;
+
                api.buttons('.record').enable(selectedRows > 0);
 
                var row = $(this);

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl    
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_inline.xsl    
2016-12-18 19:31:35 UTC (rev 16100)
@@ -93,7 +93,9 @@
                                                                                
                                {
                                                                                
                                         $(this).prop("checked", true);
                                                                                
                                });
-                                                                               
                                var selectedRows = api.rows( { selected: true } 
).count();
+                                                                               
                        //      var selectedRows = api.rows( { selected: true } 
).count();
+                                                                               
                                var selectedRows = 
api.rows('.selected').data().length;
+
                                                                                
                                api.buttons( '.record' ).enable( selectedRows > 
0 );
                                                                                
                        }
                                                                                
                }<xsl:value-of select="phpgw:conditional(not(position() = 
last()), ',', '')"/>

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-12-18 19:31:35 UTC (rev 16100)
@@ -1190,8 +1190,11 @@
                        });
 
                        $('#datatable-container tbody').on( 'click', 'tr', 
function () {
+                                       $(this).toggleClass('selected');
                                        var api = oTable.api();
-                                       var selectedRows = api.rows( { 
selected: true } ).count();
+//                                     alert( 
api.rows('.selected').data().length +' row(s) selected' );
+//                                     var selectedRows = api.rows( { 
selected: true } ).count();
+                                       var selectedRows = 
api.rows('.selected').data().length;
                                        api.buttons( '.record' ).enable( 
selectedRows > 0 );
                                        var row = $(this);
                                        var checkbox = 
row.find('input[type="checkbox"]');

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/mobilefrontend/navbar.inc.php
===================================================================
--- 
branches/Version-2_0-branch/phpgwapi/templates/mobilefrontend/navbar.inc.php    
    2016-12-18 19:25:52 UTC (rev 16099)
+++ 
branches/Version-2_0-branch/phpgwapi/templates/mobilefrontend/navbar.inc.php    
    2016-12-18 19:31:35 UTC (rev 16100)
@@ -20,6 +20,8 @@
                $tts_text = lang('ticket');
                $condition_survey_url = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'property.uicondition_survey.index'));
                $condition_survey_text = 
$GLOBALS['phpgw']->translation->translate('condition survey', array(), false, 
'property');
+               $moveout_url = $GLOBALS['phpgw']->link('/index.php', 
array('menuaction' => 'rental.uimoveout.index'));
+               $moveout_text = 
$GLOBALS['phpgw']->translation->translate('moveout', array(), false, 'rental');
 
                $topmenu = <<<HTML
                <div class="pure-menu pure-menu-horizontal">
@@ -36,6 +38,9 @@
                                <li class="pure-menu-item">
                                        <a href="{$condition_survey_url}" 
class="pure-menu-link">{$condition_survey_text}</a>
                                </li>
+                               <li class="pure-menu-item">
+                                       <a href="{$moveout_url}" 
class="pure-menu-link">{$moveout_text}</a>
+                               </li>
                        </ul>
                </div>
 HTML;

Modified: branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php       
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/property/inc/class.boadmin_entity.inc.php       
2016-12-18 19:31:35 UTC (rev 16100)
@@ -94,12 +94,6 @@
                        $this->bocommon = CreateObject('property.bocommon');
                        $this->custom = createObject('property.custom_fields');
 
-                       if ($session)
-                       {
-                               $this->read_sessiondata();
-                               $this->use_session = true;
-                       }
-
                        $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query = phpgw::get_var('query');
                        $sort = phpgw::get_var('sort');
@@ -109,6 +103,9 @@
                        $allrows = phpgw::get_var('allrows', 'bool');
                        $entity_id = phpgw::get_var('entity_id', 'int');
 
+                       $this->so = CreateObject('property.soadmin_entity', '', 
'', $this->bocommon);
+                       $this->type_app = $this->so->get_type_app();
+
                        $this->start = $start ? $start : 0;
                        $this->query = isset($query) ? $query : $this->query;
                        $this->sort = isset($sort) && $sort ? $sort : '';
@@ -117,32 +114,10 @@
                        $this->cat_id = isset($cat_id) && $cat_id ? $cat_id : 
'';
                        $this->entity_id = isset($entity_id) && $entity_id ? 
$entity_id : '';
                        $this->allrows = phpgw::get_var('allrows', 'bool');
-                       $this->so = CreateObject('property.soadmin_entity', '', 
'', $this->bocommon);
                        $this->so->type = $this->type;
-                       $this->type_app = $this->so->get_type_app();
-               }
 
-               function save_sessiondata( $data )
-               {
-                       if ($this->use_session)
-                       {
-                               
$GLOBALS['phpgw']->session->appsession('session_data', 'standard_e', $data);
-                       }
                }
 
-               function read_sessiondata()
-               {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data', 'standard_e');
-
-                       $this->start = isset($data['start']) ? $data['start'] : 
'';
-                       $this->query = isset($data['query']) ? $data['query'] : 
'';
-                       $this->sort = isset($data['sort']) ? $data['sort'] : '';
-                       $this->order = isset($data['order']) ? $data['order'] : 
'';
-                       $this->cat_id = isset($data['cat_id']) ? 
$data['cat_id'] : '';
-                       $this->entity_id = isset($data['entity_id']) ? 
$data['entity_id'] : '';
-                       $this->allrows = isset($data['allrows']) ? 
$data['allrows'] : '';
-               }
-
                function get_location_level_list( $selected = '' )
                {
 

Modified: branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php       
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/property/inc/class.uiadmin_entity.inc.php       
2016-12-18 19:31:35 UTC (rev 16100)
@@ -95,20 +95,6 @@
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::{$this->type_app[$this->type]}::entity";
                }
 
-               function save_sessiondata()
-               {
-                       $data = array
-                               (
-                               'start' => $this->start,
-                               'query' => $this->query,
-                               'sort' => $this->sort,
-                               'order' => $this->order,
-                               'entity_id' => $this->entity_id,
-                               'cat_id' => $this->cat_id
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
                function index()
                {
                        if (!$this->acl_read)

Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-12-18 19:31:35 UTC (rev 16100)
@@ -3513,7 +3513,7 @@
                                $custom = 
createObject('property.custom_fields');
                                $vendor_data['attributes'] = 
$custom->find('property', '.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
 
-                               $vendor_data = 
$contacts->read_single(array('id' => $ticket['vendor_id']), $vendor_data);
+                               $vendor_data = 
$contacts->read_single(array('id' => $vendor_id), $vendor_data);
                                if (is_array($vendor_data))
                                {
                                        foreach ($vendor_data['attributes'] as 
$attribute)

Modified: branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php  
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php  
2016-12-18 19:31:35 UTC (rev 16100)
@@ -979,7 +979,7 @@
                                                case 'project':
                                                        $approval_menuaction = 
'property.uiproject.edit';
                                                        $subject = 
lang('Approval') . ": {$values['project_id']}";
-                                                       $message = '<a href ="' 
. $GLOBALS['phpgw']->link( array('menuaction' => $approval_menuaction,
+                                                       $message = '<a href ="' 
. $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
$approval_menuaction,
                                                                        'id' => 
$values['project_id']), false, true) . '">' . lang('project %1 needs approval', 
$values['project_id']) . '</a>';
                                                        if 
(isset($config->config_data['project_approval_status']) && 
$config->config_data['project_approval_status'])
                                                        {
@@ -992,7 +992,7 @@
                                                default:
                                                        $approval_menuaction = 
'property.uiworkorder.edit';
                                                        $subject = 
lang('Approval') . ": {$id}";
-                                                       $message = '<a href ="' 
. $GLOBALS['phpgw']->link( array('menuaction' => $approval_menuaction,
+                                                       $message = '<a href ="' 
. $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
$approval_menuaction,
                                                        'id' => $id), false, 
true) . '">' . lang('Workorder %1 needs approval', $id) . '</a>';
                                                        $_orders = array($id);
                                                        break;

Modified: 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
===================================================================
--- 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
        2016-12-18 19:25:52 UTC (rev 16099)
+++ 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_exporter_data_til_Agresso.php
        2016-12-18 19:31:35 UTC (rev 16100)
@@ -250,6 +250,10 @@
                                {
                                        $file_written = true;
                                }
+                               else
+                               {
+                                       phpgwapi_cache::message_set("$filename 
feilet", 'error');
+                               }
                        }
 
                        $transfer_ok = false;

Modified: 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
===================================================================
--- 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
  2016-12-18 19:25:52 UTC (rev 16099)
+++ 
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
  2016-12-18 19:31:35 UTC (rev 16100)
@@ -59,19 +59,23 @@
                        $config->read();
                        $approval_level = 
!empty($config->config_data['approval_level']) ? 
$config->config_data['approval_level'] : 'order';
 
+                       $approval_amount = 0;
                        $price = 0;
                        if($approval_level == 'project')
                        {
-                               $price = 
ExecMethod('property.boworkorder.get_accumulated_budget_amount', 
$workorder['project_id']);
+                               $approval_amount = 
ExecMethod('property.boworkorder.get_accumulated_budget_amount', 
$workorder['project_id']);
+                               $price = 
ExecMethod('property.boworkorder.get_budget_amount', $workorder['id']);
                        }
                        else
                        {
-                               $price = 
ExecMethod('property.boworkorder.get_budget_amount', $workorder['id']);
+                               $approval_amount = 
ExecMethod('property.boworkorder.get_budget_amount', $workorder['id']);
+                               $price = $approval_amount;
+
                        }
 
                        try
                        {
-                               $purchase_grant_ok = 
CreateObject('property.botts')->validate_purchase_grant( $workorder['ecodimb'], 
$price, $workorder['id']);
+                               $purchase_grant_ok = 
CreateObject('property.botts')->validate_purchase_grant( $workorder['ecodimb'], 
$approval_amount, $workorder['id']);
                        }
                        catch (Exception $ex)
                        {

Modified: branches/Version-2_0-branch/property/js/portico/workorder.edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/workorder.edit.js   
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/property/js/portico/workorder.edit.js   
2016-12-18 19:31:35 UTC (rev 16100)
@@ -544,8 +544,10 @@
        (budget_sum - Number(local_value_budget) + 
Number(accumulated_budget_amount)),
        (Number(local_value_budget),Number(accumulated_budget_amount)));
 
-       $("#order_received_amount").val(total_amount);
+       var order_received_amount = Math.max(contract_sum,      budget_sum,     
Number(local_value_budget));
 
+       $("#order_received_amount").val(order_received_amount);
+
        var oArgs = {menuaction: 'property.uitts.check_purchase_right', 
ecodimb: ecodimb, amount: total_amount, order_id: order_id};
        var requestUrl = phpGWLink('index.php', oArgs, true);
        var htmlString = "";

Copied: branches/Version-2_0-branch/rental/inc/class.bomoveout.inc.php (from 
rev 16099, trunk/rental/inc/class.bomoveout.inc.php)
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.bomoveout.inc.php              
                (rev 0)
+++ branches/Version-2_0-branch/rental/inc/class.bomoveout.inc.php      
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,122 @@
+<?php
+       /**
+        * phpGroupWare - rental: 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 customer was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package rental
+        * @subpackage moveout
+        * @version $Id: $
+        */
+
+
+       phpgw::import_class('eventplanner.bocommon');
+       phpgw::import_class('rental.somoveout');
+
+       include_class('rental', 'moveout', 'inc/model/');
+
+       class rental_bomoveout extends eventplanner_bocommon
+       {
+               protected static
+                       $bo,
+                       $fields,
+                       $acl_location;
+
+               public function __construct()
+               {
+                       $this->fields = rental_moveout::get_fields();
+                       $this->acl_location = rental_moveout::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 rental_bomoveout();
+                       }
+                       return self::$bo;
+               }
+
+               public function store($object)
+               {
+                       $this->store_pre_commit($object);
+                       $ret = rental_somoveout::get_instance()->store($object);
+                       $this->store_post_commit($object);
+                       return $ret;
+               }
+
+               public function read($params)
+               {
+                       if(empty($params['filters']['active']))
+                       {
+                               $params['filters']['active'] = 1;
+                       }
+                       else
+                       {
+                               unset($params['filters']['active']);
+                       }
+                       $values =  
rental_somoveout::get_instance()->read($params);
+       //              $status_text = rental_moveout::get_status_list();
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+                       foreach ($values['results'] as &$entry)
+                       {
+       //                              $entry['status'] = 
$status_text[$entry['status']];
+                                       $entry['created'] = 
$GLOBALS['phpgw']->common->show_date($entry['created']);
+                                       $entry['modified'] = 
$GLOBALS['phpgw']->common->show_date($entry['modified']);
+                       }
+                       return $values;
+               }
+
+               public function read_single($id, $return_object = true)
+               {
+                       if ($id)
+                       {
+                               $values = 
rental_somoveout::get_instance()->read_single($id, $return_object);
+                       }
+                       else
+                       {
+                               $values = new rental_moveout();
+                       }
+
+                       $custom_fields = 
rental_moveout::get_instance()->get_custom_fields();
+                       if($custom_fields)
+                       {
+                               $custom_fields = 
rental_somoveout::get_instance()->read_custom_field_values($id, $custom_fields);
+                               $_values = 
createObject('property.custom_fields')->prepare(array('attributes' => 
$custom_fields), 'rental', rental_moveout::acl_location, $view = false);
+
+                               if($return_object)
+                               {
+                                       $values->attributes = 
$_values[attributes];
+                               }
+                               else
+                               {
+                                       $values['attributes'] = 
$_values[attributes];
+                               }
+                       }
+
+                       return $values;
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/rental/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.menu.inc.php   2016-12-18 
19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/inc/class.menu.inc.php   2016-12-18 
19:31:35 UTC (rev 16100)
@@ -143,6 +143,11 @@
                        if(!$use_fellesdata)
                        {
                                $menus['navigation'] = 
array_reverse($menus['navigation'], true);
+                               $menus['navigation']['moveout'] = array(
+                                       'text' => lang('moveout'),
+                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uimoveout.index')),
+                                       'image' => array('rental', 
'text-x-generic'),
+                               );
                                $menus['navigation']['schedule'] = array(
                                        'text' => lang('schedule'),
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uicomposite.schedule')),
@@ -153,6 +158,7 @@
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uiapplication.index')),
                                        'image' => array('rental', 
'text-x-generic'),
                                );
+
                                $menus['navigation'] = 
array_reverse($menus['navigation'], true);
                        }
 
@@ -219,6 +225,18 @@
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_custom_function',
                                                'appname' => 'rental', 
'location' => '.contract', 'menu_selection' => 
'admin::rental::custom_functions'))
                                ),
+                               'custom_field_groups' => array
+                                               (
+                                               'text' => lang('custom field 
groups'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute_group',
+                                                       'appname' => 'rental', 
'menu_selection' => 'admin::rental::custom_field_groups'))
+                                       ),
+                                       'custom_fields' => array
+                                               (
+                                               'text' => lang('custom fields'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'admin.ui_custom.list_attribute',
+                                                       'appname' => 'rental', 
'menu_selection' => 'admin::rental::custom_fields'))
+                                       ),
                        );
 
                        $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');

Copied: branches/Version-2_0-branch/rental/inc/class.somoveout.inc.php (from 
rev 16099, trunk/rental/inc/class.somoveout.inc.php)
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.somoveout.inc.php              
                (rev 0)
+++ branches/Version-2_0-branch/rental/inc/class.somoveout.inc.php      
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,128 @@
+<?php
+       /**
+        * phpGroupWare - rental: 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/ and Nordlandssykehuset
+        * @package rental
+        * @subpackage moveout
+        * @version $Id: $
+        */
+       phpgw::import_class('phpgwapi.socommon');
+
+       class rental_somoveout extends phpgwapi_socommon
+       {
+
+               protected static $so;
+
+               public function __construct()
+               {
+                       parent::__construct('rental_moveout', 
rental_moveout::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('rental.somoveout');
+                       }
+                       return self::$so;
+               }
+
+               public function read_custom_field_values( $id, $custom_fields )
+               {
+                       $sql = "SELECT * FROM {$this->table_name} WHERE id = " 
. (int)$id;
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       if ($this->db->next_record() && 
is_array($custom_fields))
+                       {
+                               foreach ($custom_fields as &$attr)
+                               {
+                                       $attr['value'] = 
$this->db->f($attr['column_name']);
+                               }
+                       }
+                       return $custom_fields;
+               }
+
+               protected function populate( array $data )
+               {
+                       $object = new rental_moveout();
+                       foreach ($this->fields as $field => $field_info)
+                       {
+                               $object->set_field($field, $data[$field]);
+                       }
+
+                       return $object;
+               }
+
+               protected function update( $object )
+               {
+                       $this->db->transaction_begin();
+                       //              $status_text = 
rental_moveout::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 ($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
+                                               (
+                                               'moveout_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 
rental_moveout_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();
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php     
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php     
2016-12-18 19:31:35 UTC (rev 16100)
@@ -33,6 +33,7 @@
                        'index' => true,
                        'query' => true,
                        'view' => true,
+                       'get'   =>  true,
                        'add_party' => true,
                        'remove_party' => true,
                        'add_composite' => true,
@@ -1492,6 +1493,46 @@
                        $this->edit(array('contract_id' => $contract_id));
                }
 
+
+               public function get( $id = 0 )
+               {
+                       $contract_id =  $id ? (int)$id : 
(int)phpgw::get_var('id');
+                       if (!empty($contract_id))
+                       {
+                               $contract = 
rental_socontract::get_instance()->get_single($contract_id);
+
+                               if (!($contract && 
$contract->has_permission(PHPGW_ACL_READ)))
+                               {
+                                       
phpgw::no_access($GLOBALS['phpgw_info']['flags']['currentapp'], 
lang('permission_denied_view_contract'));
+                               }
+
+                               $ret = $contract->serialize();
+                               foreach ($ret as &$entry)
+                               {
+                                       $entry = rtrim($entry, '<br/>');
+                               }
+
+                       //      $ret['last_edited_by'] = 
$contract->get_last_edited_by();
+                               $ret['executive_officer'] = 
$GLOBALS['phpgw']->accounts->id2name($contract->get_executive_officer_id());
+                               $ret['security_amount'] = 
$contract->get_security_amount();
+                               phpgw::import_class('rental.soparty');
+
+                               $parties =  $contract->get_parties();
+                               foreach ($parties as $party_id => $value) // 
get the last one
+                               {
+
+                               }
+
+                               $party =  
rental_soparty::get_instance()->get_single($party_id);
+       //                      _debug_array($party);
+
+                               $ret['identifier'] = $party->get_identifier();
+                               $ret['mobile_phone'] = 
$party->get_mobile_phone();
+
+                               return $ret;
+                       }
+               }
+
                /**
                 * View a contract
                 */

Copied: branches/Version-2_0-branch/rental/inc/class.uimoveout.inc.php (from 
rev 16099, trunk/rental/inc/class.uimoveout.inc.php)
===================================================================
--- branches/Version-2_0-branch/rental/inc/class.uimoveout.inc.php              
                (rev 0)
+++ branches/Version-2_0-branch/rental/inc/class.uimoveout.inc.php      
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,250 @@
+<?php
+       /**
+        * phpGroupWare - rental: 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 moveout was funded by 
http://www.bergen.kommune.no/ and Nordlandssykehuset
+        * @package rental
+        * @subpackage moveout
+        * @version $Id: $
+        */
+       phpgw::import_class('eventplanner.uicommon');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('rental', 'moveout', 'inc/model/');
+
+       class rental_uimoveout extends eventplanner_uicommon
+       {
+
+               public $public_functions = array(
+                       'add' => true,
+                       'index' => true,
+                       'query' => true,
+                       'view' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'get' => true
+               );
+               protected
+                       $bo,
+                       $fields,
+                       $permissions,
+                       $custom_fields;
+
+               public function __construct()
+               {
+                       parent::__construct();
+                       self::set_active_menu('rental::moveout');
+                       $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . 
lang('moveout');
+                       $this->bo = createObject('rental.bomoveout');
+                       $this->fields = rental_moveout::get_fields();
+                       $this->permissions = 
rental_moveout::get_instance()->get_permission_array();
+                       $this->custom_fields = 
rental_moveout::get_instance()->get_custom_fields();
+               }
+
+               public function index()
+               {
+                       $function_msg = lang('moveout');
+
+                       if (empty($this->permissions[PHPGW_ACL_READ]))
+                       {
+                               phpgw::no_access($function_msg);
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       phpgwapi_jquery::load_widget('autocomplete');
+
+                       $data = array(
+                               'datatable_name' => $function_msg,
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                               )
+                                       )
+                               ),
+                               'datatable' => array(
+                                       'source' => self::link(array(
+                                               'menuaction' => 
'rental.uimoveout.index',
+                                               'phpgw_return_as' => 'json'
+                                       )),
+                                       'allrows' => true,
+                                       'new_item' => 
self::link(array('menuaction' => 'rental.uimoveout.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' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 'rental.uimoveout.view'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit',
+                               'text' => lang('edit'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 'rental.uimoveout.edit'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       self::add_javascript('rental', 'rental', 
'moveout.index.js');
+                       phpgwapi_jquery::load_widget('numberformat');
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               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']))
+                       {
+                               $moveout = $values['object'];
+                       }
+                       else
+                       {
+                               $id = !empty($values['id']) ? $values['id'] : 
phpgw::get_var('id', 'int');
+                               $moveout = $this->bo->read_single($id);
+                       }
+
+                       $tabs = array();
+                       $tabs['first_tab'] = array(
+                               'label' => lang('moveout'),
+                               'link' => '#first_tab'
+                       );
+
+
+                       $comments = (array)$moveout->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)
+                               )
+                       );
+
+
+                       $custom_values = $moveout->attributes ? 
$moveout->attributes : array();
+
+                       foreach ($custom_values as $attrib_id => &$attrib)
+                       {
+                               if (isset($attrib['choice']) && 
is_array($attrib['choice']) && $attrib['value'])
+                               {
+                                       foreach ($attrib['choice'] as &$choice)
+                                       {
+                                               if (is_array($attrib['value']))
+                                               {
+                                                       $choice['selected'] = 
in_array($choice['id'], $attrib['value']) ? 1 : 0;
+                                               }
+                                               else
+                                               {
+                                                       $choice['selected'] = 
$choice['id'] == $attrib['value'] ? 1 : 0;
+                                               }
+                                       }
+                               }
+                       }
+                       $organized_fields = 
createObject('booking.custom_fields','rental')->organize_fields(rental_moveout::acl_location,
 $custom_values);
+
+                       $data = array(
+                               'datatable_def' => $datatable_def,
+                               'form_action' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uimoveout.save')),
+                               'cancel_url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'rental.uimoveout.index',)),
+                               'moveout' => $moveout,
+                               'contract'      => 
createObject('rental.uicontract')->get($moveout->contract_id),
+                               'mode' => $mode,
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_active_tab' => $active_tab,
+                               'attributes_group' => $organized_fields,
+                       );
+                       phpgwapi_jquery::formvalidator_generate(array());
+                       phpgwapi_jquery::load_widget('autocomplete');
+                       self::add_javascript('rental', 'rental', 
'moveout.edit.js');
+                       self::render_template_xsl(array('moveout', 
'datatable_inline', 'attributes_form'), array($mode => $data));
+               }
+
+               /*
+                * Get the moveout with the id given in the http variable 'id'
+                */
+
+               public function get( $id = 0 )
+               {
+                       if (empty($this->permissions[PHPGW_ACL_ADD]))
+                       {
+                               phpgw::no_access();
+                       }
+
+                       $id = !empty($id) ? $id : phpgw::get_var('id', 'int');
+
+                       $moveout = $this->bo->read_single($id)->toArray();
+
+                       unset($moveout['secret']);
+
+                       return $moveout;
+               }
+
+               public function save()
+               {
+                       parent::save();
+               }
+       }
\ No newline at end of file

Copied: branches/Version-2_0-branch/rental/inc/model/class.moveout.inc.php 
(from rev 16099, trunk/rental/inc/model/class.moveout.inc.php)
===================================================================
--- branches/Version-2_0-branch/rental/inc/model/class.moveout.inc.php          
                (rev 0)
+++ branches/Version-2_0-branch/rental/inc/model/class.moveout.inc.php  
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,207 @@
+<?php
+       /**
+        * phpGroupWare - rental: 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/ and Nordlandssykehuset
+        * @package rental
+        * @subpackage moveout
+        * @version $Id: $
+        */
+
+       phpgw::import_class('rental.bomoveout');
+
+       include_class('phpgwapi', 'model', 'inc/model/');
+
+       class rental_moveout extends phpgwapi_model
+       {
+
+               const acl_location = '.moveout';
+
+               protected
+                       $id,
+                       $contract_id,
+                       $old_contract_id,
+                       $created,
+                       $modified,
+                       $account_id,
+                       $comments,
+                       $comment,
+                       $attributes,// custom fields
+                       $values_attribute;// custom fields
+
+               static $custom_fields = array();
+
+               protected $field_of_responsibility_name = '.moveout';
+
+               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 rental_moveout();
+               }
+
+               public function set_custom_fields()
+               {
+                       $this->custom_fields = 
$GLOBALS['phpgw']->custom_fields->find('rental', self::acl_location, 0, '', 
'ASC', 'attrib_sort', true, true);
+               }
+
+               public function get_custom_fields()
+               {
+                       if (!$this->custom_fields)
+                       {
+                               $this->set_custom_fields();
+                       }
+                       return $this->custom_fields;
+               }
+
+               public function get_organized_fields()
+               {
+                       if (!$this->custom_fields)
+                       {
+                               $this->custom_fields = 
createObject('booking.custom_fields', 
'rental')->get_organized_fields(self::acl_location);
+                       }
+                       return $this->custom_fields;
+               }
+
+               public static function get_fields($debug = true)
+               {
+                        $fields = array(
+                               'id' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'int',
+                                       'label' => 'id',
+                                       'sortable'=> true,
+                                       'formatter' => 
'JqueryPortico.formatLink',
+                                       ),
+                               'created' => array('action'=> PHPGW_ACL_READ,
+                                       'type' => 'date',
+                                       'label' => 'created',
+                                       'sortable' => true,
+                                       ),
+                               'modified' => array('action'=> PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT,
+                                       'type' => 'date',
+                                       'label' => 'modified',
+                                       'sortable' => true,
+                                       ),
+                               'account_id' => array('action'=> PHPGW_ACL_ADD,
+                                       'type' => 'int',
+                                       'label' => 'contract_id',
+                                       'sortable' => true,
+                                       ),
+                               'contract_id' => array('action'=> PHPGW_ACL_ADD 
| PHPGW_ACL_EDIT,
+                                       'type' => 'int',
+                                       'label' => 'contract_id',
+                                       'sortable' => true,
+                                       ),
+                               'old_contract_id' => array('action'=>  
PHPGW_ACL_READ,
+                                       'type' => 'string',
+                                       'query' => true,
+                                       'label' => 'contract',
+                                       'join' => array(
+                                               'table' => 'rental_contract',
+                                               'fkey' => 'contract_id',
+                                               'key' => 'id',
+                                               'column' => 'old_contract_id'
+                                               )
+                                       ),
+                               'comments' => array(
+                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'manytomany' => array(
+                                               'input_field' => 
'comment_input',
+                                               'table' => 
'rental_moveout_comment',
+                                               'key' => 'moveout_id',
+                                               'column' => array('time', 
'author', 'comment', 'type'),
+                                               'order' => array('sort' => 
'time', 'dir' => 'ASC')
+                                       )),
+                               'comment' => array(
+                                       'action'=> PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT,
+                                       'type' => 'string',
+                                       'related' => true,
+                                       )
+                       );
+
+                       if($debug)
+                       {
+                               foreach ($fields as $field => $field_info)
+                               {
+                                       if(!property_exists('rental_moveout', 
$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 (!empty($entity->moveout_organization_number))
+                       {
+                               $entity->moveout_organization_number = 
str_replace(' ', '', $entity->moveout_organization_number);
+                       }
+
+                       $entity->modified = time();
+                       if(!$entity->get_id())
+                       {
+                               $entity->account_id = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       }
+
+               }
+
+
+               public function serialize()
+               {
+                       return self::toArray();
+               }
+
+               public function store()
+               {
+                       return rental_bomoveout::get_instance()->store($this);
+               }
+
+               public function read_single($id)
+               {
+                       return 
rental_bomoveout::get_instance()->read_single($id, true);
+               }
+       }

Copied: branches/Version-2_0-branch/rental/js/rental/moveout.edit.js (from rev 
16099, trunk/rental/js/rental/moveout.edit.js)
===================================================================
--- branches/Version-2_0-branch/rental/js/rental/moveout.edit.js                
                (rev 0)
+++ branches/Version-2_0-branch/rental/js/rental/moveout.edit.js        
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,80 @@
+/* 
+ * Copyright (C) 2016 hc483
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+
+var contract_id_selection;
+var lang;
+var oArgs = {menuaction: 'rental.uicontract.index', organization_number: true};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'contract_name', 'contract_id', 
'contract_container', 'old_contract_id');
+
+$(window).on('load', function ()
+{
+       contract_id = $('#contract_id').val();
+       if (contract_id)
+       {
+               contract_id_selection = contract_id;
+       }
+       $("#contract_name").on("autocompleteselect", function (event, ui)
+       {
+               var contract_id = ui.item.value;
+               if (contract_id !== contract_id_selection)
+               {
+                       populateContractParty(contract_id);
+               }
+       });
+});
+
+function populateContractParty(contract_id)
+{
+       contract_id = contract_id || $('#contract_id').val();
+
+       if (!contract_id)
+       {
+               return;
+       }
+       oArgs = {
+               menuaction: 'rental.uicontract.get',
+               id: contract_id
+       };
+
+       var requestUrl = phpGWLink('index.php', oArgs, true);
+       var data = {};
+
+       JqueryPortico.execute_ajax(requestUrl,
+               function (result)
+               {
+               
+                       $("#executive_officer").html(result.executive_officer);
+                       $("#composite").html(result.composite);
+                       $("#rented_area").html(result.rented_area);
+                       $("#security_amount").html(result.security_amount);
+                       $("#date_start").html(result.date_start);
+                       $("#date_end").html(result.date_end);
+                       $("#type").html(result.type);
+                       $("#party").html(result.party);
+                       $("#identifier").html(result.identifier);
+                       $("#mobile_phone").html(result.mobile_phone);
+                       $("#department").html(result.department);
+                       $("#contract_status").html(result.contract_status);
+                       $("#rented_area").html(result.rented_area);
+                       $("#term_label").html(result.term_label);
+
+               }, data, "POST", "json"
+               );
+}

Modified: branches/Version-2_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/rental/setup/phpgw_no.lang      2016-12-18 
19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/setup/phpgw_no.lang      2016-12-18 
19:31:35 UTC (rev 16100)
@@ -640,4 +640,7 @@
 type   rental  no      Type
 custom price   rental  no      Taksering
 price type     rental  no      Pristype
-schedule       rental  no      Kalender
\ No newline at end of file
+schedule       rental  no      Kalender
+moveout        rental  no      Utflytting
+custom fields  rental  no      Egendefinerte felt
+custom field groups    rental  no      Grupper for Egendefinerte felt
\ No newline at end of file

Modified: branches/Version-2_0-branch/rental/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/setup/setup.inc.php      2016-12-18 
19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/setup/setup.inc.php      2016-12-18 
19:31:35 UTC (rev 16100)
@@ -30,7 +30,9 @@
                'rental_adjustment',  // Price regulations
                'rental_application',
                'rental_application_comment',
-               'rental_application_composite'
+               'rental_application_composite',
+               'rental_moveout',
+               'rental_moveout_comment'
        );
        $setup_info['rental']['enable'] = 1;
        $setup_info['rental']['app_group'] = 'office';

Modified: branches/Version-2_0-branch/rental/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/setup/tables_current.inc.php     
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/setup/tables_current.inc.php     
2016-12-18 19:31:35 UTC (rev 16100)
@@ -568,5 +568,37 @@
                        ),
                        'ix' => array(),
                        'uc' => array()
-               )
+               ),
+               'rental_moveout' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
false),
+                               'contract_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                               'account_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                               'created' => array('type' => 'int', 'precision' 
=> '8',  'nullable' => false, 'default' => 'current_timestamp'),
+                               'modified' => array('type' => 'int', 
'precision' => '8',  'nullable' => false, 'default' => 'current_timestamp'),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(
+                               'rental_contract' => array('contract_id' => 
'id'),
+                               'phpgw_accounts' => array('account_id' => 
'account_id')
+                       ),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'rental_moveout_comment' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'auto', 'nullable' => 
False),
+                               'moveout_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'time' => array('type' => 'int', 'precision' => 
'8', 'nullable' => False, 'default' => 'current_timestamp'),
+                               '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(
+                               'rental_moveout' => array('moveout_id' => 
'id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+
        );

Modified: branches/Version-2_0-branch/rental/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/rental/setup/tables_update.inc.php      
2016-12-18 19:25:52 UTC (rev 16099)
+++ branches/Version-2_0-branch/rental/setup/tables_update.inc.php      
2016-12-18 19:31:35 UTC (rev 16100)
@@ -739,3 +739,55 @@
                        return $GLOBALS['setup_info']['rental']['currentver'];
                }
        }
+
+
+       $test[] = '0.1.0.31';
+       function rental_upgrade0_1_0_31()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw']->locations->add('.moveout', 'Moveout', 
'rental', $allow_grant = true, $custom_tbl = 'rental_moveout', $c_function = 
true, $c_attrib = true);
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'rental_moveout', array(
+                                       'fd' => array(
+                                               'id' => array('type' => 'auto', 
'nullable' => false),
+                                               'contract_id' => array('type' 
=> 'int', 'precision' => '4', 'nullable' => false),
+                                               'account_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => false),
+                                               'created' => array('type' => 
'int', 'precision' => '8',  'nullable' => false, 'default' => 
'current_timestamp'),
+                                               'modified' => array('type' => 
'int', 'precision' => '8',  'nullable' => false, 'default' => 
'current_timestamp'),
+                                       ),
+                                       'pk' => array('id'),
+                                       'fk' => array(
+                                               'rental_contract' => 
array('contract_id' => 'id'),
+                                               'phpgw_accounts' => 
array('account_id' => 'account_id')
+                                       ),
+                                       'ix' => array(),
+                                       'uc' => array()
+                               )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'rental_moveout_comment',  array(
+                                       'fd' => array(
+                                               'id' => array('type' => 'auto', 
'nullable' => False),
+                                               'moveout_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => False),
+                                               'time' => array('type' => 
'int', 'precision' => '8', 'nullable' => False, 'default' => 
'current_timestamp'),
+                                               '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(
+                                               'rental_moveout' => 
array('moveout_id' => 'id')),
+                                       'ix' => array(),
+                                       'uc' => array()
+                               )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['rental']['currentver'] = 
'0.1.0.32';
+                       return $GLOBALS['setup_info']['rental']['currentver'];
+               }
+       }

Copied: branches/Version-2_0-branch/rental/templates/base/moveout.xsl (from rev 
16099, trunk/rental/templates/base/moveout.xsl)
===================================================================
--- branches/Version-2_0-branch/rental/templates/base/moveout.xsl               
                (rev 0)
+++ branches/Version-2_0-branch/rental/templates/base/moveout.xsl       
2016-12-18 19:31:35 UTC (rev 16100)
@@ -0,0 +1,289 @@
+
+<!-- $Id: price_item.xsl 12604 2015-01-15 17:06:11Z nelson224 $ -->
+<xsl:template match="data">
+       <xsl:choose>
+               <xsl:when test="edit">
+                       <xsl:apply-templates select="edit" />
+               </xsl:when>
+               <xsl:when test="view">
+                       <xsl:apply-templates select="view" />
+               </xsl:when>
+       </xsl:choose>
+
+</xsl:template>
+
+<!-- add / edit  -->
+<xsl:template xmlns:php="http://php.net/xsl"; match="edit">
+       <xsl:variable name="date_format">
+               <xsl:value-of select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')" />
+       </xsl:variable>
+       <xsl:variable name="form_action">
+               <xsl:value-of select="form_action"/>
+       </xsl:variable>
+       <xsl:variable name="mode">
+               <xsl:value-of select="mode"/>
+       </xsl:variable>
+
+       <div>
+               <script type="text/javascript">
+                       var lang = <xsl:value-of 
select="php:function('js_lang', 'Name or company is required')"/>;
+               </script>
+               <form id="form" name="form" method="post" 
action="{$form_action}" class="pure-form pure-form-aligned">
+                       <div id="tab-content">
+                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <input type="hidden" id="active_tab" 
name="active_tab" value="{value_active_tab}"/>
+                               <div id="first_tab">
+                                       <fieldset>
+                                               <legend>
+                                                       <xsl:value-of 
select="php:function('lang', 'basis data')"/>
+                                               </legend>
+                                               <xsl:if test="moveout/id > 0">
+                                                       <div 
class="pure-control-group">
+                                                               <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')"/>
+                                                               </label>
+                                                               <input 
type="hidden" name="id" value="{moveout/id}"/>
+                                                               <xsl:value-of 
select="moveout/id"/>
+                                                       </div>
+                                               </xsl:if>
+
+
+                                               <div class="pure-control-group">
+                                                       <xsl:variable 
name="lang_contract">
+                                                               <xsl:value-of 
select="php:function('lang', 'contract')"/>
+                                                       </xsl:variable>
+                                                       <label>
+                                                               <xsl:value-of 
select="$lang_contract"/>
+                                                       </label>
+                                                       <input type="hidden" 
id="contract_id" name="contract_id"  value="{contract/id}">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="$lang_contract"/>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_contract"/>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <input type="text" 
id="contract_name" name="contract_name" value="{contract/old_contract_id}">
+                                                               <xsl:if 
test="contract/id > 0">
+                                                                       
<xsl:attribute name="readonly">
+                                                                               
<xsl:text>readonly</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:if>
+                                                               <xsl:attribute 
name="placeholder">
+                                                                       
<xsl:value-of select="$lang_contract"/>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                       </input>
+                                                       <div 
id="contract_container"/>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'executive_officer')"/>
+                                                       </label>
+                                                       <div 
id="executive_officer" class="pure-custom">
+                                                               <xsl:value-of 
select="contract/executive_officer"/>
+                                                       </div>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'composite')"/>
+                                                       </label>
+                                                       <div id="composite" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/composite"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'rented_area')"/>
+                                                       </label>
+                                                       <div id="rented_area" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/rented_area"/>
+                                                       </div>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'security_amount')"/>
+                                                       </label>
+                                                       <div 
id="security_amount" class="pure-custom">
+                                                               <xsl:value-of 
select="contract/security_amount"/>
+                                                       </div>
+                                               </div>
+
+
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'date_start')"/>
+                                                       </label>
+                                                       <div id="date_start" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/date_start"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'date_end')"/>
+                                                       </label>
+                                                       <div id="date_end" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/date_end"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'type')"/>
+                                                       </label>
+                                                       <div id="type" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/type"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'party')"/>
+                                                       </label>
+                                                       <div id="party" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/party"/>
+                                                       </div>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'identifier')"/>
+                                                       </label>
+                                                       <div id="identifier" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/identifier"/>
+                                                       </div>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'mobile_phone')"/>
+                                                       </label>
+                                                       <div id="mobile_phone" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/mobile_phone"/>
+                                                       </div>
+                                               </div>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'department')"/>
+                                                       </label>
+                                                       <div id="department" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/department"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'contract_status')"/>
+                                                       </label>
+                                                       <div 
id="contract_status" class="pure-custom">
+                                                               <xsl:value-of 
select="contract/contract_status"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'rented_area')"/>
+                                                       </label>
+                                                       <div id="rented_area" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/rented_area"/>
+                                                       </div>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'billing_terms')"/>
+                                                       </label>
+                                                       <div id="term_label" 
class="pure-custom">
+                                                               <xsl:value-of 
select="contract/term_label"/>
+                                                       </div>
+                                               </div>
+                                       </fieldset>
+
+                                       <fieldset>
+                                               <legend>
+                                                       <xsl:value-of 
select="php:function('lang', 'report')"/>
+                                               </legend>
+
+                                               <xsl:call-template 
name="attributes_values"/>
+
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'comment')"/>
+                                                       </label>
+                                                       <textarea cols="47" 
rows="7" name="comment">
+                                                               <xsl:value-of 
select="moveout/comment"/>
+                                                       </textarea>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label>
+                                                               <xsl:value-of 
select="php:function('lang', 'details')"/>
+                                                       </label>
+                                                       <div 
class="pure-custom">
+                                                               <xsl:for-each 
select="datatable_def">
+                                                                       <xsl:if 
test="container = 'datatable-container_0'">
+                                                                               
<xsl:call-template name="table_setup">
+                                                                               
        <xsl:with-param name="container" select ='container'/>
+                                                                               
        <xsl:with-param name="requestUrl" select ='requestUrl'/>
+                                                                               
        <xsl:with-param name="ColumnDefs" select ='ColumnDefs'/>
+                                                                               
        <xsl:with-param name="data" select ='data'/>
+                                                                               
        <xsl:with-param name="config" select ='config'/>
+                                                                               
</xsl:call-template>
+                                                                       
</xsl:if>
+                                                               </xsl:for-each>
+                                                       </div>
+                                               </div>
+                                       </fieldset>
+                               </div>
+                       </div>
+                       <div class="proplist-col">
+                               <input type="submit" class="pure-button 
pure-button-primary" name="save">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                       </xsl:attribute>
+                               </input>
+                               <xsl:variable name="cancel_url">
+                                       <xsl:value-of select="cancel_url"/>
+                               </xsl:variable>
+                               <input type="button" class="pure-button 
pure-button-primary" name="cancel" onClick="window.location = '{cancel_url}';">
+                                       <xsl:attribute name="value">
+                                               <xsl:value-of 
select="php:function('lang', 'cancel')"/>
+                                       </xsl:attribute>
+                               </input>
+                       </div>
+               </form>
+       </div>
+</xsl:template>
+
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
+
+
+<xsl:template xmlns:php="http://php.net/xsl"; match="view">
+       <div>
+               <form id="form" name="form" method="post" action="" 
class="pure-form pure-form-aligned">
+                       <div id="tab-content">
+                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <div id="showing">
+
+                               </div>
+                       </div>
+                       <div class="proplist-col">
+                               <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}';"/>
+                       </div>
+               </form>
+       </div>
+</xsl:template>




reply via email to

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