fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14979] Merge 14923:14978 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [14979] Merge 14923:14978 from trunk
Date: Fri, 06 May 2016 08:10:14 +0000

Revision: 14979
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14979
Author:   sigurdne
Date:     2016-05-06 08:10:13 +0000 (Fri, 06 May 2016)
Log Message:
-----------
Merge 14923:14978 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/activitycalendar/inc/class.soactivity.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.soarena.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.socommon.inc.php
    
branches/Version-2_0-branch/activitycalendar/inc/class.socontactperson.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.sogroup.inc.php
    
branches/Version-2_0-branch/activitycalendar/inc/class.soorganization.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.uiarena.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/class.uidashboard.inc.php
    
branches/Version-2_0-branch/activitycalendar/inc/class.uiorganization.inc.php
    branches/Version-2_0-branch/activitycalendar/inc/model/class.model.inc.php
    
branches/Version-2_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
    branches/Version-2_0-branch/activitycalendarfrontend/index.php
    branches/Version-2_0-branch/booking/inc/class.socommon.inc.php
    branches/Version-2_0-branch/bookingfrontend/index.php
    branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-2_0-branch/manual/inc/class.uidocuments.inc.php
    branches/Version-2_0-branch/manual/templates/base/documents_add.xsl
    branches/Version-2_0-branch/phpgwapi/inc/auth/class.auth_.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.db_pdo.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.vfs_shared.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/lib/YUICombo.php
    branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/settings.php
    branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php
    branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php
    branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php
    branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
    branches/Version-2_0-branch/preferences/setup/phpgw_no.lang
    branches/Version-2_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-2_0-branch/property/inc/class.boinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.boproject.inc.php
    branches/Version-2_0-branch/property/inc/class.botts.inc.php
    branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-2_0-branch/property/inc/class.menu.inc.php
    branches/Version-2_0-branch/property/inc/class.soXport.inc.php
    branches/Version-2_0-branch/property/inc/class.soagreement.inc.php
    branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.soproject.inc.php
    branches/Version-2_0-branch/property/inc/class.sotts.inc.php
    branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
    branches/Version-2_0-branch/property/inc/class.uiimport.inc.php
    branches/Version-2_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.uiinvoice2.inc.php
    branches/Version-2_0-branch/property/inc/class.uilookup.inc.php
    branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-2_0-branch/property/inc/class.uitts.inc.php
    branches/Version-2_0-branch/property/inc/class.uiwo_hour.inc.php
    branches/Version-2_0-branch/property/inc/class.uiworkorder.inc.php
    
branches/Version-2_0-branch/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
    
branches/Version-2_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
    branches/Version-2_0-branch/property/inc/hook_settings.inc.php
    branches/Version-2_0-branch/property/js/portico/ajax_invoice.js
    branches/Version-2_0-branch/property/js/portico/project.edit.js
    branches/Version-2_0-branch/property/js/portico/tts.view.js
    branches/Version-2_0-branch/property/js/portico/workorder.edit.js
    branches/Version-2_0-branch/property/setup/default_records.inc.php
    branches/Version-2_0-branch/property/setup/phpgw_no.lang
    branches/Version-2_0-branch/property/setup/setup.inc.php
    branches/Version-2_0-branch/property/setup/tables_current.inc.php
    branches/Version-2_0-branch/property/setup/tables_update.inc.php
    branches/Version-2_0-branch/property/templates/base/agreement.xsl
    branches/Version-2_0-branch/property/templates/base/config.tpl
    branches/Version-2_0-branch/property/templates/base/invoice.xsl
    branches/Version-2_0-branch/property/templates/base/invoice2.xsl
    branches/Version-2_0-branch/property/templates/base/project.xsl
    branches/Version-2_0-branch/property/templates/base/tts.xsl
    branches/Version-2_0-branch/property/templates/base/wo_hour.xsl
    branches/Version-2_0-branch/property/templates/base/workorder.xsl
    branches/Version-2_0-branch/rental/inc/SnappyMedia.php
    branches/Version-2_0-branch/rental/inc/class.bofellesdata.inc.php
    branches/Version-2_0-branch/rental/inc/class.soadjustment.inc.php
    branches/Version-2_0-branch/rental/inc/class.sobilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.sobilling_info.inc.php
    branches/Version-2_0-branch/rental/inc/class.socommon.inc.php
    branches/Version-2_0-branch/rental/inc/class.socomposite.inc.php
    branches/Version-2_0-branch/rental/inc/class.socontract.inc.php
    branches/Version-2_0-branch/rental/inc/class.socontract_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.sodocument.inc.php
    branches/Version-2_0-branch/rental/inc/class.soinvoice.inc.php
    branches/Version-2_0-branch/rental/inc/class.soinvoice_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.sonotification.inc.php
    branches/Version-2_0-branch/rental/inc/class.soparty.inc.php
    branches/Version-2_0-branch/rental/inc/class.soprice_item.inc.php
    branches/Version-2_0-branch/rental/inc/class.sounit.inc.php
    
branches/Version-2_0-branch/rental/inc/class.soworkbench_notification.inc.php
    branches/Version-2_0-branch/rental/inc/class.uibilling.inc.php
    branches/Version-2_0-branch/rental/inc/class.uicontract.inc.php
    branches/Version-2_0-branch/rental/inc/class.uimakepdf.inc.php
    branches/Version-2_0-branch/rental/inc/class.uiprice_item.inc.php
    
branches/Version-2_0-branch/rental/inc/custom/default/NLSH_add_contract_from_composite.php
    branches/Version-2_0-branch/rental/inc/model/class.adjustment.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.agresso_gl07.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.agresso_lg04.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.billing.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.billing_info.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.composite.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.contract.inc.php
    
branches/Version-2_0-branch/rental/inc/model/class.contract_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.invoice.inc.php
    
branches/Version-2_0-branch/rental/inc/model/class.invoice_price_item.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.model.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.party.inc.php
    branches/Version-2_0-branch/rental/inc/model/class.price_item.inc.php
    branches/Version-2_0-branch/rental/templates/base/party.xsl
    branches/Version-2_0-branch/setup/inc/hook_config.inc.php

Added Paths:
-----------
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/blank.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/collapsed-hover.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/collapsed.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/down-grey.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/down.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/expanded-hover.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/expanded.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/first-grey.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/first.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/folder.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/home.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/last-grey.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/last.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/left-grey.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/left.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-gard-top.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-bg.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-left.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-right.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-splitbar.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-toolbar-bg.png
    
branches/Version-2_0-branch/phpgwapi/templates/pure/images/phpgw-icon-logo.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/right-grey.png
    branches/Version-2_0-branch/phpgwapi/templates/pure/images/right.png
    branches/Version-2_0-branch/property/inc/class.uigeneric_document.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_exporter_varemottak_til_Agresso.php
    
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_melding.php
    
branches/Version-2_0-branch/property/inc/custom/default/BkBygg_lag_Agresso_ordre_fra_workorder.php
    
branches/Version-2_0-branch/property/templates/base/external_project_form.xsl
    
branches/Version-2_0-branch/property/templates/base/external_project_view.xsl
    branches/Version-2_0-branch/property/templates/base/generic_document.xsl

Removed Paths:
-------------
    branches/Version-2_0-branch/property/js/portico/ajax_project_edit.js
    branches/Version-2_0-branch/property/js/portico/ajax_workorder_edit.js

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


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

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.soactivity.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -87,14 +87,14 @@
                 * the party is involved in.
                 *
                 * @param string $sort_field
-                * @param boolean $ascending
+                * @param bool $ascending
                 * @param string $search_for
                 * @param string $search_type
                 * @param array $filters
-                * @param boolean $return_count
+                * @param bool $return_count
                 * @return string SQL
                 */
-               protected function get_query( string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count )
+               protected function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count )
                {
                        $clauses = array('1=1');
 
@@ -336,7 +336,7 @@
                 * Update the database values for an existing activity object.
                 *
                 * @param $activity the activity to be updated
-                * @return boolean true if successful, false otherwise
+                * @return bool true if successful, false otherwise
                 */
                function update( $activity )
                {

Modified: branches/Version-2_0-branch/activitycalendar/inc/class.soarena.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.soarena.inc.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.soarena.inc.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -28,14 +28,14 @@
                 *
                 *
                 * @param string $sort_field
-                * @param boolean $ascending
+                * @param bool $ascending
                 * @param string $search_for
                 * @param string $search_type
                 * @param array $filters
-                * @param boolean $return_count
+                * @param bool $return_count
                 * @return string SQL
                 */
-               protected function get_query( string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count )
+               protected function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count )
                {
                        $clauses = array('1=1');
 
@@ -266,7 +266,7 @@
                 * Update the database values for an existing arena object.
                 *
                 * @param $arena the arena to be updated
-                * @return boolean true if successful, false otherwise
+                * @return bool true if successful, false otherwise
                 */
                function update( $arena )
                {

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.socommon.inc.php     
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.socommon.inc.php     
2016-05-06 08:10:13 UTC (rev 14979)
@@ -57,16 +57,16 @@
                {
                        if ($type == 'bool')
                        {
-                               return (boolean)$value;
+                               return (bool)$value;
                        }
+                       elseif ($type == 'int')
+                       {
+                               return (int)$value;
+                       }
                        elseif ($value === null || $value == 'NULL')
                        {
                                return null;
                        }
-                       elseif ($type == 'int')
-                       {
-                               return intval($value);
-                       }
                        elseif ($type == 'float')
                        {
                                return floatval($value);
@@ -106,7 +106,7 @@
                 */
                public function get_single( int $id )
                {
-                       $objects = $this->get(null, null, null, null, null, 
null, array($this->get_id_field_name() => $id));
+                       $objects = $this->get(0, 0, '', false, '', '', 
array($this->get_id_field_name() => $id));
                        if (count($objects) > 0)
                        {
                                $keys = array_keys($objects);
@@ -129,7 +129,7 @@
                 * @param $start_index int with index of first object.
                 * @param $num_of_objects int with max number of objects to 
return.
                 * @param $sort_field string representing the object field to 
sort on.
-                * @param $ascending boolean true for ascending sort on sort 
field, false
+                * @param $ascending bool true for ascending sort on sort 
field, false
                 * for descending.
                 * @param $search_for string with free text search query.
                 * @param $search_type string with the query type.
@@ -137,7 +137,7 @@
                 * @return array of objects. May return an empty
                 * array, never null. The array keys are the respective index 
numbers.
                 */
-               public function get( int $start_index, int $num_of_objects, 
string $sort_field, boolean $ascending, string $search_for, string 
$search_type, array $filters )
+               public function get( int $start_index, int $num_of_objects, 
string $sort_field, bool $ascending, string $search_for, string $search_type, 
array $filters )
                {
                        $results = array();   // Array to store result objects
                        $map = array(); // Array to hold number of records per 
target object
@@ -261,7 +261,7 @@
                 */
                public function get_count( string $search_for, string 
$search_type, array $filters )
                {
-                       return $this->get_query_count($this->get_query(null, 
null, $search_for, $search_type, $filters, true));
+                       return $this->get_query_count($this->get_query('', 
false, $search_for, $search_type, $filters, true));
                }
 
                /**
@@ -278,16 +278,16 @@
                 * @param $start_index int with index of first object.
                 * @param $num_of_objects int with max number of objects to 
return.
                 * @param $sort_field string representing the object field to 
sort on.
-                * @param $ascending boolean true for ascending sort on sort 
field, false
+                * @param $ascending bool true for ascending sort on sort 
field, false
                 * for descending.
                 * @param $search_for string with free text search query.
                 * @param $search_type string with the query type.
                 * @param $filters array with key => value of filters.
-                * @param $return_count boolean telling to return only the 
count of the
+                * @param $return_count bool telling to return only the count 
of the
                 * matching objects, or the objects themself.
                 * @return string with SQL.
                 */
-               protected abstract function get_query( string $sort_field, 
boolean $ascending, string $search_for, string $search_type, array $filters, 
boolean $return_count );
+               protected abstract function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count );
 
                protected abstract function populate( int $object_id, &$object 
);
 

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.socontactperson.inc.php
===================================================================
--- 
branches/Version-2_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2016-05-05 23:32:23 UTC (rev 14978)
+++ 
branches/Version-2_0-branch/activitycalendar/inc/class.socontactperson.inc.php  
    2016-05-06 08:10:13 UTC (rev 14979)
@@ -29,14 +29,14 @@
                 * the party is involved in.
                 *
                 * @param string $sort_field
-                * @param boolean $ascending
+                * @param bool $ascending
                 * @param string $search_for
                 * @param string $search_type
                 * @param array $filters
-                * @param boolean $return_count
+                * @param bool $return_count
                 * @return string SQL
                 */
-               protected function get_query( string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count )
+               protected function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count )
                {
                        $clauses = array('1=1');
                        $table = "";
@@ -290,7 +290,7 @@
                 * Update the database values for an existing activity object.
                 *
                 * @param $activity the activity to be updated
-                * @return boolean true if successful, false otherwise
+                * @return bool true if successful, false otherwise
                 */
                function update( $contact_person )
                {

Modified: branches/Version-2_0-branch/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.sogroup.inc.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -29,14 +29,14 @@
                 * the party is involved in.
                 *
                 * @param string $sort_field
-                * @param boolean $ascending
+                * @param bool $ascending
                 * @param string $search_for
                 * @param string $search_type
                 * @param array $filters
-                * @param boolean $return_count
+                * @param bool $return_count
                 * @return string SQL
                 */
-               protected function get_query( string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count )
+               protected function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count )
                {
                        $clauses = array('1=1');
 
@@ -176,7 +176,7 @@
                 * Update the database values for an existing party object.
                 *
                 * @param $party the party to be updated
-                * @return boolean true if successful, false otherwise
+                * @return bool true if successful, false otherwise
                 */
                function update( $group )
                {

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- 
branches/Version-2_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2016-05-05 23:32:23 UTC (rev 14978)
+++ 
branches/Version-2_0-branch/activitycalendar/inc/class.soorganization.inc.php   
    2016-05-06 08:10:13 UTC (rev 14979)
@@ -34,14 +34,14 @@
                 * the party is involved in.
                 *
                 * @param string $sort_field
-                * @param boolean $ascending
+                * @param bool $ascending
                 * @param string $search_for
                 * @param string $search_type
                 * @param array $filters
-                * @param boolean $return_count
+                * @param bool $return_count
                 * @return string SQL
                 */
-               protected function get_query( string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count )
+               protected function get_query( string $sort_field, bool 
$ascending, string $search_for, string $search_type, array $filters, bool 
$return_count )
                {
                        $clauses = array('1=1');
 
@@ -509,7 +509,7 @@
                 * Update the database values for an existing party object.
                 *
                 * @param $party the party to be updated
-                * @return boolean true if successful, false otherwise
+                * @return bool true if successful, false otherwise
                 */
                function update_local( $organization )
                {

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2016-05-06 08:10:13 UTC (rev 14979)
@@ -473,19 +473,19 @@
                        {
                                $desc = substr($desc, 0, 254);
                        }
-                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
+                       $arenas = $this->so_arena->get(0, 0, 
'arena.arena_name', true, '', '', array());
                        if ($activity->get_new_org())
                        {
                                $org_name = 
$this->so_org->get_organization_name_local($activity->get_organization_id());
                        }
                        else
                        {
-                               $organizations = $this->so_org->get(null, null, 
'org.name', true, null, null, null);
+                               $organizations = $this->so_org->get(0, 0, 
'org.name', true, '', '', array());
                        }
 
                        if ($new_group)
                        {
-                               $group_array = $this->so_group->get(null, null, 
null, null, null, null, array(
+                               $group_array = $this->so_group->get(0, 0, '', 
false, '', '', array(
                                        'group_id' => 
$activity->get_group_id(), 'new_groups' => 'true'));
                                //var_dump($group_array);
                                if (count($group_array) > 0)
@@ -498,7 +498,7 @@
                        }
                        else
                        {
-                               $groups = $this->so_group->get(null, null, 
null, null, null, null, null);
+                               $groups = $this->so_group->get();
                        }
 
                        if ($activity->get_new_org())
@@ -710,7 +710,7 @@
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
                        $search_for = $search['value'];
-                       $search_type = phpgw::get_var('search_option');
+                       $search_type = phpgw::get_var('search_option', 
'string', 'REQUEST', '');
 
                        // Create an empty result set
                        $result_objects = array();
@@ -1355,7 +1355,7 @@
                        $returnHTML = "<option value='0'>Ingen gruppe 
valgt</option>";
                        if ($org_id)
                        {
-                               $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array(
+                               $groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, '', false, '', '', array(
                                        'org_id' => $org_id));
                                foreach ($groups as $group)
                                {

Modified: branches/Version-2_0-branch/activitycalendar/inc/class.uiarena.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.uiarena.inc.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.uiarena.inc.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -239,7 +239,7 @@
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
                        $search_for = $search['value'];
-                       $search_type = phpgw::get_var('search_option');
+                       $search_type = phpgw::get_var('search_option', 
'string', 'REQUEST', '');
 
                        // Create an empty result set
                        $result_objects = array();

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.uidashboard.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/class.uidashboard.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/class.uidashboard.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -254,7 +254,7 @@
                                        if (!$changed_group && !$changed_org)
                                        {
                                                $filter_group = array('org_id' 
=> $org_id);
-                                               $result_groups = 
activitycalendar_sogroup::get_instance()->get(null, null, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
+                                               $result_groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
                                                foreach ($result_groups as 
$result_group)
                                                {
                                                        if 
(isset($result_group))
@@ -295,7 +295,7 @@
                        $returnHTML = "<option value='0'>Ingen gruppe 
valgt</option>";
                        if ($org_id)
                        {
-                               $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array(
+                               $groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, '', false, '', '', array(
                                        'org_id' => $org_id));
                                foreach ($groups as $group)
                                {

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/class.uiorganization.inc.php
===================================================================
--- 
branches/Version-2_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2016-05-05 23:32:23 UTC (rev 14978)
+++ 
branches/Version-2_0-branch/activitycalendar/inc/class.uiorganization.inc.php   
    2016-05-06 08:10:13 UTC (rev 14979)
@@ -352,7 +352,7 @@
 
                public function index_json()
                {
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(); //get organizations
+                       $organizations = 
activitycalendar_soorganization::get_instance()->get(0, 0, '', false, '', 
'',array()); //get organizations
                        array_walk($organizations["results"], array($this, 
"_add_links"), "booking.uiorganization.show");
 
                        foreach ($organizations["results"] as &$organization)
@@ -381,7 +381,7 @@
                        $so_org = 
activitycalendar_soorganization::get_instance();
                        $so_activity = 
activitycalendar_soactivity::get_instance();
                        $so_contact = 
activitycalendar_socontactperson::get_instance();
-                       $org_array = $so_org->get(null, null, null, null, null, 
null, array('id' => $id,
+                       $org_array = $so_org->get(0, 0, '', false, '', '', 
array('id' => $id,
                                'changed_orgs' => 'true'));
                        if (count($org_array) > 0)
                        {
@@ -456,7 +456,7 @@
 
                        $so_org = 
activitycalendar_soorganization::get_instance();
                        $so_contact = 
activitycalendar_socontactperson::get_instance();
-                       $org_array = $so_org->get(null, null, null, null, null, 
null, array('id' => $id,
+                       $org_array = $so_org->get(0, 0, '', false, '', '', 
array('id' => $id,
                                'changed_orgs' => 'true'));
                        if (count($org_array) > 0)
                        {
@@ -543,7 +543,7 @@
                        $sort_ascending = ($order[0]['dir'] == 'desc') ? false 
: true;
                        // Form variables
                        $search_for = $search['value'];
-                       $search_type = phpgw::get_var('search_option');
+                       $search_type = phpgw::get_var('search_option', 
'string', 'REQUEST', '');
 
                        // Create an empty result set
                        $result_objects = array();
@@ -580,6 +580,7 @@
                                        break;
                                default: // ... get all parties of a given type
                                        //$filters = array('party_type' => 
phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
+                                       $filters = array();
                                        break;
                        }
                        if ($changed_group)
@@ -607,7 +608,7 @@
                                        if (!$changed_group && !$changed_org)
                                        {
                                                $filter_group = array('org_id' 
=> $org_id);
-                                               $result_groups = 
activitycalendar_sogroup::get_instance()->get(null, null, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
+                                               $result_groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, $sort_field, 
$sort_ascending, $search_for, $search_type, $filter_group);
                                                foreach ($result_groups as 
$result_group)
                                                {
                                                        if 
(isset($result_group))
@@ -651,7 +652,7 @@
                        $returnHTML = "<option value='0'>Ingen gruppe 
valgt</option>";
                        if ($org_id)
                        {
-                               $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array(
+                               $groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, '', false, '', '', array(
                                        'org_id' => $org_id));
                                foreach ($groups as $group)
                                {

Modified: 
branches/Version-2_0-branch/activitycalendar/inc/model/class.model.inc.php
===================================================================
--- branches/Version-2_0-branch/activitycalendar/inc/model/class.model.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendar/inc/model/class.model.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -99,7 +99,7 @@
                 * in order to validate against the standard database rules.  
The subclasses can in addition
                 * add their own specific validation logic.
                 *
-                * @return boolean true if the object is valid, false otherwise
+                * @return bool true if the object is valid, false otherwise
                 */
                public function validates()
                {

Modified: 
branches/Version-2_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- 
branches/Version-2_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2016-05-05 23:32:23 UTC (rev 14978)
+++ 
branches/Version-2_0-branch/activitycalendarfrontend/inc/class.uiactivity.inc.php
   2016-05-06 08:10:13 UTC (rev 14979)
@@ -76,8 +76,8 @@
                        $offices = $this->so_activity->select_district_list();
                        $districts = $this->so_activity->get_districts();
                        $buildings = $this->so_arena->get_buildings();
-                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
-                       $organizations = $this->so_organization->get(null, 
null, 'org.name', true, null, null, null);
+                       $arenas = $this->so_arena->get(0, 0, 
'arena.arena_name', true, '', '', array());
+                       $organizations = $this->so_organization->get(0, 0, 
'org.name', true, '', '', array());
 
                        $activity = new activitycalendar_activity();
 
@@ -187,7 +187,7 @@
                                {
                                        $new_org = false;
                                        $organization = 
$this->so_organization->get_single($o_id);
-                                       $person_arr = 
$this->so_contact->get(null, null, null, null, null, null, array(
+                                       $person_arr = $this->so_contact->get(0, 
0, '', false, '', '', array(
                                                'organization_id' => $o_id));
                                        foreach ($person_arr as $p)
                                        {
@@ -1193,7 +1193,7 @@
                        if ($org_id)
                        {
                                $group_html[] = "<option value='new_group'>Ny 
gruppe</option>";
-                               $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, array(
+                               $groups = 
activitycalendar_sogroup::get_instance()->get(0, 0, '', false, '', '', array(
                                        'org_id' => $org_id));
                                foreach ($groups as $group)
                                {

Modified: branches/Version-2_0-branch/activitycalendarfrontend/index.php
===================================================================
--- branches/Version-2_0-branch/activitycalendarfrontend/index.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/activitycalendarfrontend/index.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -78,7 +78,7 @@
        /*       * ******* Optional classes, which can be disabled for 
performance increases ******** */
        while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags']))
        {
-               if (ereg('enable_', $phpgw_class_name[0]))
+               if (preg_match('/enable_/', $phpgw_class_name[0]))
                {
                        $enable_class = str_replace('enable_', '', 
$phpgw_class_name[0]);
                        $enable_class = str_replace('_class', '', 
$enable_class);


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

Modified: branches/Version-2_0-branch/booking/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/booking/inc/class.socommon.inc.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/booking/inc/class.socommon.inc.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -289,6 +289,7 @@
 
                function read_single( $id )
                {
+                       $row = array();
                        $pk_params = $this->primary_key_conditions($id);
                        $cols_joins = $this->_get_cols_and_joins();
                        $cols = join(',', $cols_joins[0]);
@@ -357,8 +358,8 @@
                                                $row[$field] = 
$this->_unmarshal($this->db->f($field, false), $params['type']);
                                        }
                                }
-                               return $row;
                        }
+                       return $row;
                }
 
                function _get_conditions( $query, $filters )


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

Modified: branches/Version-2_0-branch/bookingfrontend/index.php
===================================================================
--- branches/Version-2_0-branch/bookingfrontend/index.php       2016-05-05 
23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/bookingfrontend/index.php       2016-05-06 
08:10:13 UTC (rev 14979)
@@ -108,7 +108,7 @@
        /*       * ******* Optional classes, which can be disabled for 
performance increases ******** */
        while ($phpgw_class_name = each($GLOBALS['phpgw_info']['flags']))
        {
-               if (ereg('enable_', $phpgw_class_name[0]))
+               if ( preg_match('/enable_/', $phpgw_class_name[0]))
                {
                        $enable_class = str_replace('enable_', '', 
$phpgw_class_name[0]);
                        $enable_class = str_replace('_class', '', 
$enable_class);

Modified: branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php       
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/controller/inc/class.socheck_list.inc.php       
2016-05-06 08:10:13 UTC (rev 14979)
@@ -428,7 +428,7 @@
                        $sql .= "cl.component_id as cl_component_id, 
cl.location_code as cl_location_code, num_open_cases, num_pending_cases, 
cl.serie_id ";
                        $sql .= "FROM controller_control c ";
                        $sql .= "LEFT JOIN controller_check_list cl on 
cl.control_id = c.id ";
-                       $sql .= "WHERE cl.location_code = '{$location_code}' ";
+                       $sql .= "WHERE cl.location_code LIKE 
'{$location_code}%' ";
 
                        if ($repeat_type != null)
                        {

Modified: branches/Version-2_0-branch/manual/inc/class.uidocuments.inc.php
===================================================================
--- branches/Version-2_0-branch/manual/inc/class.uidocuments.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/manual/inc/class.uidocuments.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -142,9 +142,8 @@
 
                        $categories = $this->_get_categories($cat_id);
 
+                       self::message_set($this->receipt);
 
-                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
-
                        $file_def = array
                                (
                                array('key' => 'file_name', 'label' => 
lang('Filename'), 'sortable' => false),
@@ -175,7 +174,6 @@
                        $data = array
                                (
                                'datatable_def' => $datatable_def,
-                               'msgbox_data' => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'categories' => array('options' => $categories),
                                'editable' => $mode == 'edit',
                                'multiple_uploader' => $mode == 'edit' ? true : 
'',
@@ -284,11 +282,6 @@
                                        'string' => "/manual/{$_cat_id}",
                                        'relatives' => array(RELATIVE_NONE)));
 
-                               foreach ($_files as &$_file)
-                               {
-                                       $_file['path'] = 
"{$_cat_id}/{$_file['name']}";
-                               }
-
                                $files = array_merge($files, $_files);
                        }
 
@@ -323,10 +316,9 @@
                        $values = array();
                        foreach ($out as $_entry)
                        {
-                               $values[] = array
-                                       (
-                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_name={$_entry['path']}' target='_blank' 
title='{$lang_view}'>{$_entry['name']}</a>",
-                                       'delete_file' => "<input 
type='checkbox' name='file_action[]' value='{$_entry['name']}' 
title='$lang_delete'>",
+                               $values[] = array(
+                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_id={$_entry['file_id']}' target='_blank' 
title='{$lang_view}'>{$_entry['name']}</a>",
+                                       'delete_file' => "<input 
type='checkbox' name='file_action[]' value='{$_entry['file_id']}' 
title='$lang_delete'>",
                                );
                        }
 
@@ -351,12 +343,7 @@
                        {
                                return lang('no access');
                        }
-
-                       $bofiles = CreateObject('property.bofiles', '/manual');
-
-                       $file_name = 
html_entity_decode(urldecode(phpgw::get_var('file_name')));
-                       $file = "{$bofiles->fakebase}/{$file_name}";
-                       $bofiles->view_file('', $file);
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                /**

Modified: branches/Version-2_0-branch/manual/templates/base/documents_add.xsl
===================================================================
--- branches/Version-2_0-branch/manual/templates/base/documents_add.xsl 
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/manual/templates/base/documents_add.xsl 
2016-05-06 08:10:13 UTC (rev 14979)
@@ -9,18 +9,7 @@
                </xsl:variable>
 
                <form name="form" id="form" action="{$action_url}" 
method="post" ENCTYPE="multipart/form-data">
-                       <dl>
-                               <xsl:choose>
-                                       <xsl:when test="msgbox_data != ''">
-                                               <dt>
-                                                       <xsl:call-template 
name="msgbox"/>
-                                               </dt>
-                                       </xsl:when>
-                               </xsl:choose>
-                       </dl>
-
                        <div id="tab-content">
-
                                <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
 
                                <div id="documents">

Modified: branches/Version-2_0-branch/phpgwapi/inc/auth/class.auth_.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/auth/class.auth_.inc.php   
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/auth/class.auth_.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -4,7 +4,8 @@
        * @author Dan Kuykendall <address@hidden>
        * @author Joseph Engo <address@hidden>
        * @author Philipp Kamps <address@hidden>
-       * @copyright Copyright (C) 2000-2008 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2000-2016 Free Software Foundation, Inc. 
http://www.fsf.org/
        * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General 
Public License
        * @package phpgwapi
        * @subpackage accounts
@@ -83,7 +84,7 @@
                        }
 
                        $salt = substr(md5(uniqid(rand(), true)), 0, $chars);
-                       return $salt;
+                       return $salt;   
                }
 
                /**
@@ -94,11 +95,34 @@
                */
                public function create_hash($passwd)
                {
+                       static $retry = 0;
                        switch 
($GLOBALS['phpgw_info']['server']['encryption_type'])
                        {
                                case 'CRYPT':
-                                       return '{CRYPT}' . crypt($passwd, 
$this->_shake_salt(CRYPT_SALT_LENGTH));
+                                       $size =  
mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
+                                       $salt = mcrypt_create_iv($size, 
MCRYPT_DEV_URANDOM);
+                                       $hash = crypt($passwd, '$5$' . 
$salt);//CRYPT_SHA256
+                                       $ret =  '{CRYPT}' . base64_encode($hash 
. $salt);
+                                       $lenght_hash = strlen($hash);
 
+                                       /*
+                                        * It happens (about one out of 15 - 20 
times) that the lenght is not as expexted
+                                        */
+
+                                       if($lenght_hash != 63 && $retry < 3)
+                                       {
+                                               if($retry < 3)
+                                               {
+                                                       $retry++;
+                                                       $ret = 
self::create_hash($passwd);
+                                               }
+                                               else
+                                               {
+                                                       throw new 
Exception('Invalid lenght of password hash: ' . $lenght_hash);
+
+                                               }
+                                       }
+                                       return $ret;
                                case 'MD5':
                                        return "{MD5}" . 
base64_encode(phpgwapi_common::hex2bin(md5($passwd)));
 
@@ -137,8 +161,10 @@
                        switch ( strtoupper($algo) )
                        {
                                case 'CRYPT':
-                                       //TODO implement this
-                                       return false;
+                                       $hash = base64_decode($hash);
+                                       $salt = substr($hash, 63);
+                                       $hash = substr($hash, 0, 63);
+                                       return $hash === crypt($passwd, '$5$' . 
$salt);
                                case 'MD5':
                                        $hash = bin2hex(base64_decode($hash));
                                        return $hash === md5($passwd);

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.db_pdo.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.db_pdo.inc.php       
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.db_pdo.inc.php       
2016-05-06 08:10:13 UTC (rev 14979)
@@ -794,7 +794,8 @@
                                {
                                        if ($strip_slashes || 
($this->auto_stripslashes && ! $strip_slashes))
                                        {
-                                               return 
htmlspecialchars_decode(stripslashes($this->Record[$name]));
+                                               return 
htmlspecialchars_decode(stripslashes(str_replace(array('&#40&#59;', 
'&#41&#59;'), array('(', ')'), $this->Record[$name])));
+//                                             return 
htmlspecialchars_decode(stripslashes($this->Record[$name]));
                                        }
                                        else
                                        {

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.vfs_shared.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.vfs_shared.inc.php   
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.vfs_shared.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -1516,7 +1516,7 @@
 
                        if ($data['object'])
                        {
-                               $robject =& new path_class;
+                               $robject = new path_class;
 
                                reset ($rarray);
                                while (list ($key, $value) = each ($rarray))

Modified: branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php  2016-05-05 
23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/functions.inc.php  2016-05-06 
08:10:13 UTC (rev 14979)
@@ -409,7 +409,7 @@
         *
         * @param object $e the Exception that was thrown
         */
-       function phpgw_handle_exception(Exception $e)
+       function phpgw_handle_exception($e)
        {
                $help = 'Please contact your administrator for assistance';
 

Modified: 
branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/lib/YUICombo.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/lib/YUICombo.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/lib/YUICombo.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -1,6 +1,6 @@
 <?php
-define(DOT, ".");
-define(EMPTY_STRING, "");
+define('DOT', ".");
+define('EMPTY_STRING', "");
 
 class YUICombo {
        function __construct($modules, $config) {

Modified: branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/settings.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/settings.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/inc/yui-combo-master/settings.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -1,17 +1,17 @@
 <?php
-define(COMBO_FILE_PATH, dirname(__FILE__));
+define('COMBO_FILE_PATH', dirname(__FILE__));
 
 //define(YUI_BUILD_PATH, COMBO_FILE_PATH . '/../../build');
-define(YUI_BUILD_PATH, realpath(COMBO_FILE_PATH . '/../../js/yui3'));
+define('YUI_BUILD_PATH', realpath(COMBO_FILE_PATH . '/../../js/yui3'));
 
 if ( substr(PHP_OS, 3) == 'WIN' )
 {
-       define(TEMP_DIR, 'c:/temp/yuicombo');
+       define('TEMP_DIR', 'c:/temp/yuicombo');
 }
 else
 {
-       define(TEMP_DIR, '/tmp/yuicombo');
+       define('TEMP_DIR', '/tmp/yuicombo');
 }
 
-define(DS, DIRECTORY_SEPARATOR);
+define('DS', DIRECTORY_SEPARATOR);
 

Modified: branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php    2016-05-05 
23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/setup/setup.inc.php    2016-05-06 
08:10:13 UTC (rev 14979)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.548';
+       $setup_info['phpgwapi']['version']   = '0.9.17.550';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '2.0';
        $setup_info['phpgwapi']['enable']    = 3;
@@ -64,6 +64,7 @@
                'phpgw_sessions',
                'phpgw_vfs',
                'phpgw_vfs_filedata',
+               'phpgw_vfs_file_relation',
                'phpgw_config2_section',
                'phpgw_config2_attrib',
                'phpgw_config2_choice',

Modified: branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php   
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/setup/tables_current.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -54,7 +54,7 @@
                        'fd' => array(
                                'account_id' => array('type' => 
'auto','nullable' => False),
                                'account_lid' => array('type' => 
'varchar','precision' => 25,'nullable' => False),
-                               'account_pwd' => array('type' => 
'varchar','precision' => '40','nullable' => False),
+                               'account_pwd' => array('type' => 
'varchar','precision' => 115,'nullable' => False),
                                'account_firstname' => array('type' => 
'varchar','precision' => 50,'nullable' => False),
                                'account_lastname' => array('type' => 
'varchar','precision' => 50,'nullable' => False),
                                'account_permissions' => array('type' => 
'text','nullable' => True),
@@ -309,7 +309,23 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-
+               'phpgw_vfs_file_relation' => array(
+                       'fd' => array(
+                               'relation_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'file_id'                       => array('type' 
=> 'int','precision' => '4','nullable' => False),
+                               'location_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'location_item_id'      => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'is_private'            => array('type' => 
'int','precision' => '2','nullable' => False),
+                               'account_id'            => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'entry_date'            => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'start_date'            => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'end_date'                      => array('type' 
=> 'int','precision' => '8 ','nullable' => False),
+                       ),
+                       'pk' => array('relation_id'),
+                       'fk' => array('phpgw_vfs' => array('file_id' => 
'file_id')),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'phpgw_history_log' => array(
                        'fd' => array(
                                'history_id' => array('type' => 
'auto','precision' => 4,'nullable' => False),

Modified: branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/setup/tables_update.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -3300,3 +3300,62 @@
                }
        }
 
+       $test[] = '0.9.17.548';
+       /**
+       * New password hash: salted crypt
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_548()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_accounts', 
'account_pwd', array
+               (
+                       'type'          => 'varchar',
+                       'precision' => 115,
+                       'nullable'      => false,
+                       'default'       => ''
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.549';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+
+       $test[] = '0.9.17.549';
+       /**
+       * Add table for file relation to multiple items
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_549()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_vfs_file_relation',array(
+                       'fd' => array(
+                               'relation_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'file_id'                       => array('type' 
=> 'int','precision' => '4','nullable' => False),
+                               'location_id'           => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'location_item_id'      => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'is_private'            => array('type' => 
'int','precision' => '2','nullable' => False),
+                               'account_id'            => array('type' => 
'int','precision' => '4','nullable' => False),
+                               'entry_date'            => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'start_date'            => array('type' => 
'int','precision' => '8','nullable' => False),
+                               'end_date'                      => array('type' 
=> 'int','precision' => '8 ','nullable' => False),
+                       ),
+                       'pk' => array('relation_id'),
+                       'fk' => array('phpgw_vfs' => array('file_id' => 
'file_id')),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );
+
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.550';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }

Modified: 
branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl
===================================================================
--- branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/phpgwapi/templates/base/datatable_jquery.xsl    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -663,7 +663,8 @@
                                                                oParams.columns 
= null;
                                                                oParams.start = 
null;
                                                                oParams.draw = 
null;
-                                                               var 
addtional_filterdata = oTable.dataTableSettings[0]['ajax']['data'];
+                                       //                      var 
addtional_filterdata = oTable.dataTableSettings[0]['ajax']['data'];
+                                                               var 
addtional_filterdata = oTable.dataTableSettings[0]['oAjaxData'];
                                                                for (var 
attrname in addtional_filterdata)
                                                                {
                                                                        
oParams[attrname] = addtional_filterdata[attrname];
@@ -915,6 +916,11 @@
                                var sDom_def = '<"clear">lfrtip';
                        }
 
+                       /*
+                        * Find and assign actions to filters
+                        */
+                       var oControls = 
$('.dtable_custom_controls:first').find(':input[name]');
+
                $(document).ready(function() {
 
                        /*
@@ -941,11 +947,6 @@
                                menuaction += '_type_' + 
table_url.searchObject.type;
                        }
 
-                       /*
-                        * Find and assign actions to filters
-                        */
-                       var oControls = 
$('.dtable_custom_controls:first').find(':input[name]');
-//console.log(oControls);
                        oTable = $('#datatable-container').dataTable({
                                paginate:               disablePagination ? 
false : true,
                                processing:             true,

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/blank.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/blank.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/collapsed-hover.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/collapsed-hover.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/collapsed.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/collapsed.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/down-grey.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/down-grey.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/down.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/down.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/expanded-hover.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/expanded-hover.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/expanded.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/expanded.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/first-grey.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/first-grey.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/first.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/first.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/folder.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/folder.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/home.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/home.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/last-grey.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/last-grey.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/last.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/last.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/left-grey.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/left-grey.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/left.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/left.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-gard-top.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-gard-top.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-bg.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-split-bar-bg.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-left.png
 (from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-split-bar-left.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-split-bar-right.png
 (from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-split-bar-right.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-splitbar.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-splitbar.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/ofm-toolbar-bg.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/ofm-toolbar-bg.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/phpgw-icon-logo.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/phpgw-icon-logo.png)
===================================================================
(Binary files differ)

Copied: 
branches/Version-2_0-branch/phpgwapi/templates/pure/images/right-grey.png (from 
rev 14978, trunk/phpgwapi/templates/pure/images/right-grey.png)
===================================================================
(Binary files differ)

Copied: branches/Version-2_0-branch/phpgwapi/templates/pure/images/right.png 
(from rev 14978, trunk/phpgwapi/templates/pure/images/right.png)
===================================================================
(Binary files differ)

Modified: branches/Version-2_0-branch/preferences/setup/phpgw_no.lang
===================================================================
--- branches/Version-2_0-branch/preferences/setup/phpgw_no.lang 2016-05-05 
23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/preferences/setup/phpgw_no.lang 2016-05-06 
08:10:13 UTC (rev 14979)
@@ -184,4 +184,5 @@
 0 - 2  preferences     no      0 - 2
 as in "." or ","       preferences     no      Velg "." eller ","
 number of planned controls on home page        preferences     no      Antall 
planlagte kontroller på hjemmeskjerm
-number of assigned controls on home page       preferences     no      Antall 
tildelte kontroller på hjemmeskjerm
\ No newline at end of file
+number of assigned controls on home page       preferences     no      Antall 
tildelte kontroller på hjemmeskjerm
+filter tickets on assigned to me       preferences     no      Filtrer 
meldinger på tildelt til meg.
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bocommon.inc.php     
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.bocommon.inc.php     
2016-05-06 08:10:13 UTC (rev 14979)
@@ -718,39 +718,39 @@
                        return $b_account;
                }
 
-               function initiate_project_group_lookup( $data )
+               function initiate_external_project_lookup( $data )
                {
-                       $project_group = array();
+                       $external_project = array();
 
                        if (isset($data['type']) && $data['type'] == 'view')
                        {
-                               if (!isset($data['project_group']) || 
!$data['project_group'])
+                               if (!isset($data['external_project_id']) || 
!$data['external_project_id'])
                                {
-                                       return $project_group;
+                                       return $external_project;
                                }
 
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_view'), 
$this->xsl_rootdir);
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('external_project_view'), 
$this->xsl_rootdir);
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_form'), 
$this->xsl_rootdir);
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('external_project_form'), 
$this->xsl_rootdir);
                        }
 
-                       $project_group['value_project_group'] = 
$data['project_group'];
-                       $project_group['value_project_group_descr'] = 
$data['project_group_descr'];
-                       $project_group['project_group_url'] = 
$GLOBALS['phpgw']->link('/index.php', array(
-                               'menuaction' => 
'property.uilookup.project_group'));
-                       $project_group['lang_select_project_group_help'] = 
lang('click to select project group');
-                       $project_group['lang_project_group'] = lang('project 
group');
-                       if ($data['project_group'] && 
(!isset($data['project_group_descr']) || !$data['project_group_descr']))
+                       $external_project['value_external_project_id'] = 
$data['external_project_id'];
+                       $external_project['value_external_project_name'] = 
$data['external_project_name'];
+                       $external_project['external_project_url'] = 
$GLOBALS['phpgw']->link('/index.php', array(
+                               'menuaction' => 
'property.uilookup.external_project'));
+                       $external_project['lang_select_external_project_help'] 
= lang('click to select external project');
+                       $external_project['lang_external_project'] = 
lang('external project');
+                       if ($data['external_project_id'] && 
(!isset($data['external_project_name']) || !$data['external_project_name']))
                        {
-                               $project_group_object = 
CreateObject('property.sogeneric');
-                               
$project_group_object->get_location_info('project_group', false);
-                               $project_group_data = 
$project_group_object->read_single(array('id' => $data['project_group']));
-                               $project_group['value_project_group_descr'] = 
$project_group_data['descr'];
-                               $project_group['value_project_group_budget'] = 
$project_group_data['budget'];
+                               $external_project_object = 
CreateObject('property.sogeneric');
+                               
$external_project_object->get_location_info('external_project', false);
+                               $external_project_data = 
$external_project_object->read_single(array('id' => 
$data['external_project_id']));
+                               
$external_project['value_external_project_name'] = 
$external_project_data['name'];
+                               
$external_project['value_external_project_budget'] = 
$external_project_data['budget'];
                        }
-                       return $project_group;
+                       return $external_project;
                }
 
                function initiate_ecodimb_lookup( $data )
@@ -2398,4 +2398,144 @@
                        }
                        return $content_email;
                }
+
+
+               public function get_vendor_contract($vendor_id = 0, $selected = 
'')
+               {
+                       if(!$vendor_id)
+                       {
+                               $vendor_id = phpgw::get_var('vendor_id', 'int');
+                       }
+
+                       $contract_list = 
ExecMethod('property.soagreement.get_vendor_contract', $vendor_id);
+                       if($selected)
+                       {
+                               foreach ($contract_list as &$contract)
+                               {
+                                       $contract['selected'] = $selected == 
$contract['id'] ? 1 : 0;
+                               }
+                       }
+
+                       return $contract_list;
+               }
+
+               /**
+                * Gets vendor canidated to be used as vendor - called as ajax 
from edit form
+                *
+                * @param string  $query
+                *
+                * @return array
+                */
+               public function get_eco_service()
+               {
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+
+                       $filter = array('active' => 1);
+                       $values = $sogeneric->read(array('filter' => 
$filter,'query' => $query));
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_eco_service_name( $id )
+               {
+                       $ret = $id;
+                       if($id = (int)$id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               $ret =  $sogeneric_data['name'];
+                       }
+                       return $ret;
+               }
+
+               public function get_unspsc_code()
+               {
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                       $values = $sogeneric->read(array('query' => $query, 
'allrows' => true));
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['name']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+               public function get_unspsc_code_name( $id )
+               {
+                       $ret = '';
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+
+               public function get_b_account()
+               {
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'budget_account');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_external_project()
+               {
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                       $filter = array('active' => 1);
+                       $values = $sogeneric->read(array('filter' => 
$filter,'query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['name']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_external_project_name( $id )
+               {
+                       $ret = $id;
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+
+               public function get_ecodimb()
+               {
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 'dimb');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boinvoice.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.boinvoice.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -589,7 +589,7 @@
 
                        $values['kostra_id'] = 
$soXport->get_kostra_id($values['loc1']);
                        $values['mvakode'] = (int)$values['tax_code'];
-                       $values['project_id'] = $values['project_group'];
+                       $values['project_id'] = $values['external_project_id'];
 
                        $values['oppsynsmannid'] = $values['janitor'];
                        $values['saksbehandlerid'] = $values['supervisor'];

Modified: branches/Version-2_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boproject.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.boproject.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -385,7 +385,7 @@
                        $criteria = array();
                        $criteria[1] = array
                                (
-                               'field' => 'project_group',
+                               'field' => 'external_project_id',
                                'type' => 'int',
                                'matchtype' => 'exact',
                                'front' => '',

Modified: branches/Version-2_0-branch/property/inc/class.botts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.botts.inc.php        
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.botts.inc.php        
2016-05-06 08:10:13 UTC (rev 14979)
@@ -65,7 +65,7 @@
                        'addfiles' => true,
                );
 
-               function __construct( $session = false )
+               function __construct( )
                {
                        if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 
'property')
                        {
@@ -108,86 +108,29 @@
                                }
                        }
 
-                       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');
-                       $order = phpgw::get_var('order');
-                       $status_id = phpgw::get_var('status_id', 'string');
-                       $user_id = phpgw::get_var('user_id', 'int');
-                       $reported_by = phpgw::get_var('reported_by', 'int');
-                       $cat_id = phpgw::get_var('cat_id', 'int');
-                       $part_of_town_id = phpgw::get_var('part_of_town_id', 
'int');
-                       $district_id = phpgw::get_var('district_id', 'int');
-                       $allrows = phpgw::get_var('allrows', 'bool');
-                       $start_date = phpgw::get_var('start_date', 'string');
-                       $end_date = phpgw::get_var('end_date', 'string');
-                       $location_code = phpgw::get_var('location_code');
-                       $vendor_id = phpgw::get_var('vendor_id', 'int');
-                       $ecodimb = phpgw::get_var('ecodimb', 'int');
-                       $b_account = phpgw::get_var('b_account', 'string');
-                       $building_part = phpgw::get_var('building_part', 
'string');
-                       $branch_id = phpgw::get_var('branch_id', 'int');
-                       $order_dim1 = phpgw::get_var('order_dim1', 'int');
-
-                       $this->start = $start ? $start : 0;
-
-                       $this->query = isset($_REQUEST['query']) ? $query : 
$this->query;
-                       $this->sort = isset($_REQUEST['sort']) ? $sort : 
$this->sort;
-                       $this->order = isset($_REQUEST['order']) ? $order : 
$this->order;
-                       $this->cat_id = isset($_REQUEST['cat_id']) ? $cat_id : 
$this->cat_id;
-                       $this->status_id = isset($_REQUEST['status_id']) ? 
$status_id : $this->status_id;
-                       $this->user_id = isset($_REQUEST['user_id']) ? $user_id 
: $this->user_id;
-                       $this->reported_by = isset($_REQUEST['user_id']) ? 
$reported_by : $this->reported_by;
-
-                       $this->part_of_town_id = 
isset($_REQUEST['part_of_town_id']) ? $part_of_town_id : $this->part_of_town_id;
-                       $this->district_id = isset($_REQUEST['district_id']) ? 
$district_id : $this->district_id;
-                       $this->allrows = isset($allrows) && $allrows ? $allrows 
: '';
-                       $this->start_date = isset($_REQUEST['start_date']) ? 
$start_date : $this->start_date;
-                       $this->end_date = isset($_REQUEST['end_date']) ? 
$end_date : $this->end_date;
-                       $this->location_code = isset($location_code) && 
$location_code ? $location_code : '';
-                       $this->vendor_id = isset($_REQUEST['vendor_id']) ? 
$vendor_id : $this->vendor_id;
+                       $this->start = phpgw::get_var('start', 'int', 
'REQUEST', 0);
+                       $this->query = phpgw::get_var('query');
+                       $this->sort = phpgw::get_var('sort');
+                       $this->order = phpgw::get_var('order');
+                       $this->status_id = phpgw::get_var('status_id', 
'string');
+                       $this->user_id = phpgw::get_var('user_id', 'int');
+                       $this->reported_by = phpgw::get_var('reported_by', 
'int');
+                       $this->cat_id = phpgw::get_var('cat_id', 'int');
+                       $this->part_of_town_id = 
phpgw::get_var('part_of_town_id', 'int');
+                       $this->district_id = phpgw::get_var('district_id', 
'int');
+                       $this->allrows = phpgw::get_var('allrows', 'bool');
+                       $this->start_date = phpgw::get_var('filter_start_date', 
'string');
+                       $this->end_date = phpgw::get_var('filter_end_date', 
'string');
+                       $this->location_code = phpgw::get_var('location_code');
+                       $this->vendor_id = phpgw::get_var('vendor_id', 'int');
+                       $this->ecodimb = phpgw::get_var('ecodimb', 'int');
+                       $this->b_account = phpgw::get_var('b_account', 
'string');
+                       $this->building_part = phpgw::get_var('building_part', 
'string');
+                       $this->branch_id = phpgw::get_var('branch_id', 'int');
+                       $this->order_dim1 = phpgw::get_var('order_dim1', 'int');
                        $this->p_num = phpgw::get_var('p_num');
-                       $this->ecodimb = isset($_REQUEST['ecodimb']) ? $ecodimb 
: $this->ecodimb;
-                       $this->b_account = isset($_REQUEST['b_account']) ? 
$b_account : $this->b_account;
-                       $this->building_part = 
isset($_REQUEST['building_part']) ? $building_part : $this->building_part;
-                       $this->branch_id = isset($_REQUEST['branch_id']) ? 
$branch_id : $this->branch_id;
-                       $this->order_dim1 = isset($_REQUEST['order_dim1']) ? 
$order_dim1 : $this->order_dim1;
                }
 
-               function save_sessiondata( $data )
-               {
-                       if ($this->use_session)
-                       {
-                               
$GLOBALS['phpgw']->session->appsession('session_data', 'fm_tts', $data);
-                       }
-               }
-
-               function read_sessiondata()
-               {
-                       $data = 
$GLOBALS['phpgw']->session->appsession('session_data', 'fm_tts');
-
-                       $this->start = isset($data['start']) ? $data['start'] : 
'';
-                       $this->query = isset($data['query']) ? $data['query'] : 
'';
-                       $this->user_id = isset($data['user_id']) ? 
$data['user_id'] : '';
-                       $this->reported_by = isset($data['reported_by']) ? 
$data['reported_by'] : '';
-                       $this->sort = isset($data['sort']) ? $data['sort'] : '';
-                       $this->order = isset($data['order']) ? $data['order'] : 
'';
-                       $this->status_id = isset($data['status_id']) ? 
$data['status_id'] : '';
-                       $this->cat_id = isset($data['cat_id']) ? 
$data['cat_id'] : '';
-                       $this->district_id = isset($data['district_id']) ? 
$data['district_id'] : '';
-                       $this->part_of_town_id = 
isset($data['part_of_town_id']) ? $data['part_of_town_id'] : '';
-                       $this->allrows = isset($data['allrows']) ? 
$data['allrows'] : '';
-                       $this->start_date = isset($data['start_date']) ? 
$data['start_date'] : '';
-                       $this->end_date = isset($data['end_date']) ? 
$data['end_date'] : '';
-                       $this->vendor_id = isset($data['vendor_id']) ? 
$data['vendor_id'] : '';
-               }
-
                function column_list( $selected = array() )
                {
                        if (!$selected)
@@ -274,6 +217,31 @@
                                        'id' => 'order_dim1',
                                        'name' => lang('order_dim1')
                                );
+                               $columns['external_project_id'] = array
+                                       (
+                                       'id' => 'external_project_id',
+                                       'name' => lang('external project')
+                               );
+                               $columns['contract_id'] = array
+                                       (
+                                       'id' => 'contract_id',
+                                       'name' => lang('contract')
+                               );
+                               $columns['service_id'] = array
+                                       (
+                                       'id' => 'service_id',
+                                       'name' => lang('service')
+                               );
+                               $columns['tax_code'] = array
+                                       (
+                                       'id' => 'tax_code',
+                                       'name' => lang('tax code')
+                               );
+                               $columns['unspsc_code'] = array
+                                       (
+                                       'id' => 'unspsc_code',
+                                       'name' => lang('unspsc code')
+                               );
                        }
 
                        $columns['ecodimb'] = array
@@ -906,6 +874,8 @@
                                        case 'MS':
                                                $type = lang('Sent by sms');
                                                break;
+                                       case 'RM': $type = lang('remark');
+                                               break;
                                        default:
                                        // nothing
                                }
@@ -1755,4 +1725,39 @@
                        }
                        return $values;
                }
+
+               public function receive_order( $id, $received_percent )
+               {
+                       $receive_order = true; // used as trigger within the 
custom function
+                       $acl_location = $this->acl_location;
+
+                       $criteria = array(
+                               'appname' => 'property',
+                               'location' => $acl_location,
+                               'allrows' => true
+                       );
+
+                       $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                       foreach ($custom_functions as $entry)
+                       {
+                               // prevent path traversal
+                               if (preg_match('/\.\./', $entry['file_name']))
+                               {
+                                       continue;
+                               }
+
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                               if ($entry['active'] && is_file($file) && 
!$entry['client_side'] && !$entry['pre_commit'])
+                               {
+                                       require $file;
+                               }
+                       }
+                       // $result from the custom function
+                       return array(
+                               'result' => $result,
+                               'time'  => 
$GLOBALS['phpgw']->common->show_date(time())
+                               );
+               }
+
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.boworkorder.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -426,7 +426,7 @@
                        $criteria = array();
                        $criteria[1] = array
                                (
-                               'field' => 'project_group',
+                               'field' => 'external_project_id',
                                'type' => 'int',
                                'matchtype' => 'exact',
                                'front' => '',
@@ -1098,4 +1098,38 @@
                                }
                        }
                }
+
+               public function receive_order( $id, $received_percent )
+               {
+                       $receive_order = true; // used as trigger within the 
custom function
+                       $acl_location = '.project.workorder';
+
+                       $criteria = array(
+                               'appname' => 'property',
+                               'location' => $acl_location,
+                               'allrows' => true
+                       );
+
+                       $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                       foreach ($custom_functions as $entry)
+                       {
+                               // prevent path traversal
+                               if (preg_match('/\.\./', $entry['file_name']))
+                               {
+                                       continue;
+                               }
+
+                               $file = PHPGW_SERVER_ROOT . 
"/property/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                               if ($entry['active'] && is_file($file) && 
!$entry['client_side'] && !$entry['pre_commit'])
+                               {
+                                       require $file;
+                               }
+                       }
+                       // $result from the custom function
+                       return array(
+                               'result' => $result,
+                               'time'  => 
$GLOBALS['phpgw']->common->show_date(time())
+                               );
+               }
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.menu.inc.php 2016-05-05 
23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.menu.inc.php 2016-05-06 
08:10:13 UTC (rev 14979)
@@ -191,12 +191,18 @@
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
                                                        'type' => 
'project_status'))
                                        ),
-                                       'project_group' => array
+                                       'external_project' => array
                                                (
-                                               'text' => lang('project group'),
+                                               'text' => lang('external 
project'),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
-                                                       'type' => 
'project_group'))
+                                                       'type' => 
'external_project'))
                                        ),
+                                       'unspsc_code' => array
+                                               (
+                                               'text' => lang('unspsc code'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'type' => 
'unspsc_code'))
+                                       ),
                                        'workorder_detail' => array
                                                (
                                                'text' => lang('Workorder 
Detail Categories'),
@@ -293,6 +299,12 @@
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
                                                        'type' => 
'budget_account'))
                                        ),
+                                       'eco_service' => array
+                                               (
+                                               'text' => lang('service'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'type' => 
'eco_service'))
+                                       ),
                                        'org_unit' => array
                                                (
                                                'text' => lang('department'),
@@ -1213,6 +1225,10 @@
                                        'image' => array('property', 
'documentation'),
                                        'children' => array
                                                (
+                                               'generic' => array(
+                                                       'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric_document.index')),
+                                                       'text' => lang('generic 
document')
+                                               ),
                                                'legislation' => array
                                                        (
                                                        'text' => 
$GLOBALS['phpgw']->translation->translate('laws and regulations', array(), 
true),

Modified: branches/Version-2_0-branch/property/inc/class.soXport.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soXport.inc.php      
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.soXport.inc.php      
2016-05-06 08:10:13 UTC (rev 14979)
@@ -189,11 +189,11 @@
                function get_project( $id )
                {
                        $id = (int)$id;
-                       $sql = "SELECT project_group FROM fm_workorder"
+                       $sql = "SELECT external_project_id FROM fm_workorder"
                                . " {$this->join} fm_project ON 
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id={$id}";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
-                       return $this->db->f('project_group');
+                       return $this->db->f('external_project_id');
                }
 
                function check_spbudact_code( $id )

Modified: branches/Version-2_0-branch/property/inc/class.soagreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soagreement.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.soagreement.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -110,6 +110,13 @@
                        $uicols['statustext'][] = lang('name');
                        $uicols['datatype'][] = 'V';
 
+                       $cols_return[] = 'contract_id';
+                       $uicols['input_type'][] = 'text';
+                       $uicols['name'][] = 'contract_id';
+                       $uicols['descr'][] = lang('contract');
+                       $uicols['statustext'][] = lang('contract');
+                       $uicols['datatype'][] = 'V';
+
                        $cols_return[] = 'org_name';
                        $uicols['input_type'][] = 'text';
                        $uicols['name'][] = 'org_name';
@@ -667,8 +674,9 @@
                                $values['termination_date'] = 
$this->db->f('termination_date');
                                $values['vendor_id'] = 
$this->db->f('vendor_id');
                                $values['b_account_id'] = 
$this->db->f('account_id');
-                               $values['name'] = 
stripslashes($this->db->f('name'));
-                               $values['descr'] = 
stripslashes($this->db->f('descr'));
+                               $values['name'] = $this->db->f('name',true);
+                               $values['contract_id'] = 
$this->db->f('contract_id',true);
+                               $values['descr'] = $this->db->f('descr',true);
                                $values['user_id'] = $this->db->f('user_id');
                                $values['group_id'] = $this->db->f('group_id');
                                $values['status'] = $this->db->f('status');
@@ -732,6 +740,7 @@
                        $vals = array();
                        $vals[] = $id;
                        $vals[] = $agreement['name'];
+                       $vals[] = $agreement['contract_id'];
                        $vals[] = $agreement['descr'];
                        $vals[] = time();
                        $vals[] = $agreement['cat_id'];
@@ -776,7 +785,7 @@
                                $vals = $this->db->validate_insert($vals);
                        }
 
-                       $this->db->query("INSERT INTO $table 
(id,name,descr,entry_date,category,start_date,end_date,termination_date,vendor_id,user_id
 $cols) "
+                       $this->db->query("INSERT INTO $table 
(id,name,contract_id,descr,entry_date,category,start_date,end_date,termination_date,vendor_id,user_id
 $cols) "
                                . "VALUES ($vals)", __LINE__, __FILE__);
 
                        $receipt['agreement_id'] = 
$id;//$this->db->get_last_insert_id($table,'id');
@@ -861,6 +870,7 @@
                        }
 
                        $value_set['name'] = $values['name'];
+                       $value_set['contract_id'] = $values['contract_id'];
                        $value_set['descr'] = $values['descr'];
                        $value_set['group_id'] = $values['group_id'];
                        $value_set['status'] = $values['status'];
@@ -1250,4 +1260,22 @@
                        $this->db->next_record();
                        return $this->db->f('descr', true);
                }
+
+               function get_vendor_contract ( $vendor_id )
+               {
+                       $vendor_id = (int)$vendor_id;
+                       $this->db->query("SELECT contract_id, name FROM 
fm_agreement WHERE status = 'active' AND contract_id IS NOT NULL AND vendor_id 
= {$vendor_id}", __LINE__, __FILE__);
+                       $values = array();
+                       while ($this->db->next_record())
+                       {
+                               $contract_id = $this->db->f('contract_id',true);
+                               $name = $this->db->f('name',true);
+                               $values[] = array(
+                                       'id' => $contract_id,
+                                       'name' => "{$contract_id}::{$name}"
+                               );
+                       }
+                       return $values;
+
+               }
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.sogeneric.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -273,6 +273,16 @@
                                //_debug_array($filtermethod);
                                //_debug_array($where);die();
 
+                               if ($this->location_info['id']['type'] == 
'varchar')
+                               {
+                                               $querymethod .= " OR 
{$table}.{$this->location_info['id']['name']} $this->_like '%$query%'";
+                                               $where = 'OR';
+                               }
+                               else
+                               {
+                                       $querymethod .= " OR CAST 
({$table}.{$this->location_info['id']['name']} AS TEXT) $this->_like 
'%$query%'";
+                               }
+
                                foreach ($this->location_info['fields'] as 
$field)
                                {
                                        if ($field['type'] == 'varchar')
@@ -447,34 +457,6 @@
 
                                        break;
 
-                               case 'project_group':
-                                       $info = array
-                                               (
-                                               'table' => 'fm_project_group',
-                                               'id' => array('name' => 'id', 
'type' => 'int'),
-                                               'fields' => array
-                                                       (
-                                                       array
-                                                               (
-                                                               'name' => 
'descr',
-                                                               'descr' => 
lang('descr'),
-                                                               'type' => 
'varchar'
-                                                       ),
-                                                       array
-                                                               (
-                                                               'name' => 
'budget',
-                                                               'descr' => 
lang('budget'),
-                                                               'type' => 'int'
-                                                       )
-                                               ),
-                                               'edit_msg' => lang('edit'),
-                                               'add_msg' => lang('add'),
-                                               'name' => '',
-                                               'acl_app' => 'property',
-                                               'acl_location' => '.admin',
-                                               'menu_selection' => 
'admin::property::project_group'
-                                       );
-                                       break;
                                case 'dimb':
                                        $info = array
                                                (
@@ -593,7 +575,7 @@
                                                ),
                                                'edit_msg' => lang('edit'),
                                                'add_msg' => lang('add'),
-                                               'name' => '',
+                                               'name' => lang('tax code'),
                                                'acl_app' => 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_tax'
@@ -1092,8 +1074,7 @@
                                                                'descr' => 
lang('descr'),
                                                                'type' => 
'varchar'
                                                        ),
-                                                       array
-                                                               (
+                                                       array(
                                                                'name' => 
'active',
                                                                'descr' => 
lang('active'),
                                                                'type' => 
'checkbox',
@@ -1107,7 +1088,7 @@
                                                        ),
                                                        array
                                                                (
-                                                               'name' => 
'project_group',
+                                                               'name' => 
'external_project',
                                                                'descr' => 
lang('mandatory project group'),
                                                                'type' => 
'checkbox'
                                                        )
@@ -1246,6 +1227,64 @@
                                        break;
 
                                //-------- ID type varchar
+                               case 'external_project':
+                                       $info = array
+                                               (
+                                               'table' => 
'fm_external_project',
+                                               'id' => array('name' => 'id', 
'type' => 'varchar'),
+                                               'fields' => array(
+                                                       array(
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array(
+                                                               'name' => 
'budget',
+                                                               'descr' => 
lang('budget'),
+                                                               'type' => 'int'
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked',
+                                                               'filter' => 
true,
+                                                               'sortable' => 
true,
+                                                               'values_def' => 
array
+                                                                       (
+                                                                       
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('external 
project'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::external_project'
+                                       );
+                                       break;
+                               case 'unspsc_code':
+                                       $info = array
+                                               (
+                                               'table' => 'fm_unspsc_code',
+                                               'id' => array('name' => 'id', 
'type' => 'varchar'),
+                                               'fields' => array(
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('unspsc code'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::unspsc_code'
+                                       );
+                                       break;
                                case 'project_status':
                                        $info = array
                                                (
@@ -1759,6 +1798,35 @@
                                        );
                                        break;
 
+                               case 'eco_service':
+                                       $info = array(
+                                               'table' => 'fm_eco_service',
+                                               'id' => array('name' => 'id', 
'type' => 'int'),
+                                               'fields' => array(
+                                                       array(
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false,
+                                                               'size' => 50,
+                                                               'sortable' => 
true
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked'
+                                                       ),
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('service'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.b_account',
+                                               'menu_selection' => 
'property::economy::eco_service',
+                                               'check_grant' => false
+                                       );
+                                       break;
                                //-------- ID type auto
 
                                case 'dimb_role_user':

Modified: branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -506,7 +506,7 @@
                                        'charge_tenant' => 
$this->db->f('charge_tenant'),
                                        'vendor' => $this->db->f('org_name', 
true),
                                        //                      'paid_percent'  
                => $this->db->f('paid_percent'),
-                                       'project_group' => 
$this->db->f('project_id'),
+                                       'external_project_id' => 
$this->db->f('project_id'),
                                        'external_ref' => 
$this->db->f('external_ref'),
                                        'currency' => $this->db->f('currency'),
                                        'budget_responsible' => 
$this->db->f('budsjettansvarligid'),
@@ -1031,7 +1031,7 @@
 
                                $value_set = array
                                        (
-                                       //                      'project_id'    
=> $values['project_group'] ? $values['project_group'] : '',
+                                       //                      'project_id'    
=> $values['external_project_id'] ? $values['external_project_id'] : '',
                                        'pmwrkord_code' => $values['order_id'],
                                        //                      'process_log'   
=> $this->db->db_addslashes($values['process_log']),
                                        //                      'process_code'  
=> $values['process_code'],
@@ -1090,7 +1090,7 @@
                        $value_set = array
                                (
                                'godkjentbelop' => $values['approved_amount'],
-                               'project_id' => $values['project_group'] ? 
$values['project_group'] : '',
+                               'project_id' => $values['external_project_id'] 
? $values['external_project_id'] : '',
                                'pmwrkord_code' => $values['order_id'],
                                'process_log' => 
$this->db->db_addslashes($values['process_log']),
                                'process_code' => $values['process_code'],
@@ -1565,7 +1565,7 @@
                                        'budget_responsible' => 
$this->db->f('budsjettansvarligid'),
                                        'invoice_date' => 
$this->db->f('fakturadato'),
                                        'project_id' => 
$this->db->f('project_id'),
-                                       'project_group' => 
$this->db->f('project_id'),
+                                       'external_project_id' => 
$this->db->f('project_id'),
                                        'payment_date' => 
$this->db->f('forfallsdato'),
                                        'merknad' => $this->db->f('merknad', 
true),
                                        'line_text' => 
$this->db->f('line_text', true),
@@ -1997,13 +1997,13 @@
                        $sql = "SELECT "
                                . "dimb as kostnadssted,"
                                . "spbudact_code as art,"
-                               . "project_group as prosjekt,"
+                               . "external_project_id as prosjekt,"
                                . "sum(belop) as belop,"
                                . "currency"
                                . ' FROM fm_workorder'
                                . " {$this->join} fm_project ON 
(fm_workorder.project_id = fm_project.id)"
                                . " {$this->join} fm_ecobilag ON 
(fm_workorder.id = fm_ecobilag.pmwrkord_code)"
-                               . " GROUP BY art, kostnadssted, project_group, 
currency ORDER BY kostnadssted,project_group, art, currency ASC";
+                               . " GROUP BY art, kostnadssted, 
external_project_id, currency ORDER BY kostnadssted,external_project_id, art, 
currency ASC";
                        $this->db->query($sql, __LINE__, __FILE__);
 
                        $values = array();
@@ -2333,7 +2333,7 @@
                        $value_set_line['dima'] = $data['dim_a'];
                        $value_set_line['dime'] = $data['dim_e'];
                        $value_set_line['mvakode'] = $data['tax_code'];
-                       $value_set_line['project_id'] = $data['project_group'];
+                       $value_set_line['project_id'] = 
$data['external_project_id'];
                        $value_set_line['spbudact_code'] = 
$data['b_account_id'];
                        $value_set_line['line_text'] = 
$this->db->db_addslashes($data['line_text']);
                        $value_set_line['process_log'] = $process_log;

Modified: branches/Version-2_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soproject.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.soproject.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -163,12 +163,12 @@
                                $uicols['classname'][] = '';
                                $uicols['sortable'][] = true;
 
-                               $cols .= ", project_group";
-                               $cols_return[] = 'project_group';
+                               $cols .= ", external_project_id";
+                               $cols_return[] = 'external_project_id';
                                $uicols['input_type'][] = 'text';
-                               $uicols['name'][] = 'project_group';
-                               $uicols['descr'][] = lang('group');
-                               $uicols['statustext'][] = lang('Project group');
+                               $uicols['name'][] = 'external_project_id';
+                               $uicols['descr'][] = lang('external project');
+                               $uicols['statustext'][] = lang('external 
project');
                                $uicols['exchange'][] = false;
                                $uicols['align'][] = '';
                                $uicols['datatype'][] = '';
@@ -529,7 +529,7 @@
                        /*
                          $group_method = ' GROUP BY 
fm_project_status.descr,loc1_name,fm_project.location_code,fm_project.id,fm_project.entry_date,fm_project.start_date,fm_project.end_date,'
                          . 
'fm_project.name,fm_project.ecodimb,phpgw_accounts.account_lid,fm_project.user_id,fm_project.address,'
-                         . 
'fm_project.budget,fm_project.reserve,planned_cost,project_group';
+                         . 
'fm_project.budget,fm_project.reserve,planned_cost,external_project_id';
                         */
 
                        if (is_array($this->grants))
@@ -893,7 +893,7 @@
                                        'p_entity_id' => 
$this->db->f('p_entity_id'),
                                        'p_cat_id' => $this->db->f('p_cat_id'),
                                        'contact_phone' => 
$this->db->f('contact_phone'),
-                                       'project_group' => 
$this->db->f('project_group'),
+                                       'external_project_id' => 
$this->db->f('external_project_id'),
                                        'ecodimb' => $this->db->f('ecodimb'),
                                        'b_account_id' => 
$this->db->f('account_group'),
                                        'contact_id' => 
$this->db->f('contact_id'),
@@ -1168,7 +1168,7 @@
                                (
                                $id,
                                $project['project_type_id'],
-                               $project['project_group'],
+                               $project['external_project_id'],
                                $project['name'],
                                'public',
                                $project['cat_id'],
@@ -1196,7 +1196,7 @@
 
                        $values = $this->db->validate_insert($values);
 
-                       $this->db->query("INSERT INTO fm_project 
(id,project_type_id,project_group,name,access,category,entry_date,start_date,end_date,coordinator,status,"
+                       $this->db->query("INSERT INTO fm_project 
(id,project_type_id,external_project_id,name,access,category,entry_date,start_date,end_date,coordinator,status,"
                                . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,contact_id,inherit_location,periodization_id
 $cols) "
                                . "VALUES ($values $vals )", __LINE__, 
__FILE__);
 
@@ -1359,7 +1359,7 @@
                        $value_set = array
                                (
                                'project_type_id' => 
$project['project_type_id'],
-                               'project_group' => $project['project_group'],
+                               'external_project_id' => 
$project['external_project_id'],
                                'name' => $project['name'],
                                'status' => $project['status'],
                                'category' => $project['cat_id'],
@@ -1731,12 +1731,12 @@
                                }
                        }
 
-                       if (isset($project['project_group']) && 
$project['project_group'])
+                       if (isset($project['external_project_id']) && 
$project['external_project_id'])
                        {
                                reset($workorders);
                                foreach ($workorders as $workorder_id)
                                {
-                                       $this->db->query("UPDATE fm_ecobilag 
SET project_id = '{$project['project_group']}' WHERE pmwrkord_code = 
'{$workorder_id}' ", __LINE__, __FILE__);
+                                       $this->db->query("UPDATE fm_ecobilag 
SET project_id = '{$project['external_project_id']}' WHERE pmwrkord_code = 
'{$workorder_id}' ", __LINE__, __FILE__);
                                }
                        }
 

Modified: branches/Version-2_0-branch/property/inc/class.sotts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.sotts.inc.php        
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.sotts.inc.php        
2016-05-06 08:10:13 UTC (rev 14979)
@@ -125,7 +125,7 @@
                        $start_date = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
                        $results = isset($data['results']) && $data['results'] 
? (int)$data['results'] : 0;
                        $allrows = $results == -1 ? true : false;
-                       $end_date = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : 0;
+                       $end_date = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] :  mktime(23, 59, 59, 
date("n"),date("j"),date("Y"));
                        $external = isset($data['external']) ? 
$data['external'] : '';
                        $dry_run = isset($data['dry_run']) ? $data['dry_run'] : 
'';
                        $new = isset($data['new']) ? $data['new'] : '';
@@ -236,24 +236,24 @@
                                $where = 'AND';
                        }
 
-                       if ($status_id == 'X')
+
+                       $custom_status = $this->get_custom_status();
+                       $closed_status = array('X');
+                       foreach ($custom_status as $custom)
                        {
-                               $closed = '';
-                               $this->db->query('SELECT * from fm_tts_status', 
__LINE__, __FILE__);
-
-                               while ($this->db->next_record())
+                               if ($custom['closed'])
                                {
-                                       if ($this->db->f('closed'))
-                                       {
-                                               $closed .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
-                                       }
+                                       $closed_status[] = "C{$custom['id']}";
                                }
+                       }
+                       reset($custom_status);
+                       $filter_closed = " AND fm_tts_tickets.status NOT IN ('" 
. implode("','", $closed_status) . "')";
 
-                               $filtermethod .= " $where ( 
(fm_tts_tickets.status='X'{$closed})";
+                       //get variants of closed
+                       if ($status_id == 'X')
+                       {
+                               $filtermethod .= " $where ( 
fm_tts_tickets.status IN ('" . implode("','", $closed_status) . "')";
                                $where = 'AND';
-
-//                             $filtermethod .= " $where ( 
fm_tts_tickets.status='X'";
-//                             $where = 'AND';
                        }
                        else if ($status_id == 'O2') // explicite 'open'
                        {
@@ -263,13 +263,11 @@
                        else if ($status_id == 'O')
                        {
                                $open = '';
-                               $this->db->query('SELECT * from fm_tts_status', 
__LINE__, __FILE__);
-
-                               while ($this->db->next_record())
+                               foreach ($custom_status as $custom)
                                {
-                                       if (!$this->db->f('closed'))
+                                       if (!$custom['closed'])
                                        {
-                                               $open .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
+                                               $open .= " OR 
fm_tts_tickets.status = 'C{$custom['id']}'";
                                        }
                                }
 
@@ -401,13 +399,13 @@
                                $order_edit = 
$GLOBALS['phpgw']->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
                                $_end_date = $end_date + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
                                $_start_date = $start_date - 3600 * 8 + 
phpgwapi_datetime::user_timezone();
-//                             $filtermethod .= " $where 
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date 
<= $_end_date ";
+                               $filtermethod .= " $where 
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date 
<= $_end_date ";
 
                                if ($order_add || $order_edit)
                                {
                                        $union_select = true;
+                                       $start_period = date('Ym', $start_date);
                                        $end_period = date('Ym', $end_date);
-                                       $start_period = date('Ym', $start_date);
 //                                     $filtermethod .= " OR 
(fm_tts_payments.period >= {$start_period} AND fm_tts_payments.period <= 
{$end_period})";
                                        $date_cost_join = "LEFT OUTER JOIN 
fm_tts_payments ON ( fm_tts_tickets.id=fm_tts_payments.ticket_id AND 
fm_tts_payments.period >= $start_period AND fm_tts_payments.period <= 
$end_period )";
 //                                     $actual_cost_field = 
'SUM(fm_tts_payments.amount) AS actual_cost';
@@ -415,8 +413,8 @@
 
                                        $actual_cost_group_field = '';
 
-                                       $start_budget_period = date('Y', 
$end_date) . '00';
-                                       $end_budget_period = date('Y', 
$start_date) . '13';
+                                       $start_budget_period = date('Y', 
$start_date) . '00';
+                                       $end_budget_period = date('Y', 
$end_date) . '13';
 //                                     $filtermethod .= " OR 
(fm_tts_budget.period >= {$start_budget_period} AND fm_tts_budget.period <= 
{$end_budget_period}))";
                                        $date_budget_join = "LEFT OUTER JOIN 
fm_tts_budget ON ( fm_tts_tickets.id=fm_tts_budget.ticket_id AND 
fm_tts_budget.period >= $start_budget_period AND fm_tts_budget.period <= 
$end_budget_period )";
 //                                     $budget_field = 
'SUM(fm_tts_budget.amount) AS budget';
@@ -518,7 +516,12 @@
                                'view' => 'fm_tts_views.id as view',
                                'loc1_name' => 'fm_location1.loc1_name',
                                'ecodimb' => 'fm_tts_tickets.ecodimb',
-                               'order_dim1' => 'fm_tts_tickets.order_dim1'
+                               'order_dim1' => 'fm_tts_tickets.order_dim1',
+                               'external_project_id' => 
'fm_tts_tickets.external_project_id',
+                               'contract_id' => 'fm_tts_tickets.contract_id',
+                               'service_id' => 'fm_tts_tickets.service_id',
+                               'tax_code' => 'fm_tts_tickets.tax_code',
+                               'unspsc_code' => 'fm_tts_tickets.unspsc_code',
                        );
 
                        $custom_cols = $this->custom->find('property', 
'.ticket', 0, '', 'ASC', 'attrib_sort', true, true);
@@ -540,13 +543,13 @@
                        $return_fields = implode(',', 
array_keys($return_field_array));
                        $return_fields_plain = implode(',', 
array_values($return_field_array));
 
-                       $union_budget = "SELECT {$return_fields_union}, 0 as 
actual_cost ,SUM(fm_tts_budget.amount) as budget FROM fm_tts_tickets"
+                       $union_budget = " 0 as actual_cost 
,SUM(fm_tts_budget.amount) as budget FROM fm_tts_tickets"
                                . " {$this->left_join} fm_location1 ON 
fm_tts_tickets.loc1=fm_location1.loc1"
                                . " {$this->left_join} fm_part_of_town ON 
fm_location1.part_of_town_id=fm_part_of_town.id"
                                . " {$this->left_join} fm_district ON 
fm_district.id = fm_part_of_town.district_id"
                                . " {$order_join}{$date_budget_join}"
                                . " LEFT OUTER JOIN fm_tts_views ON 
(fm_tts_tickets.id = fm_tts_views.id AND 
fm_tts_views.account_id='{$this->account}')";
-                       $union_cost = "SELECT 
{$return_fields_union},SUM(fm_tts_payments.amount) as actual_cost, 0 as budget 
FROM fm_tts_tickets"
+                       $union_cost = " SUM(fm_tts_payments.amount) as 
actual_cost, 0 as budget FROM fm_tts_tickets"
                                . " {$this->left_join} fm_location1 ON 
fm_tts_tickets.loc1=fm_location1.loc1"
                                . " {$this->left_join} fm_part_of_town ON 
fm_location1.part_of_town_id=fm_part_of_town.id"
                                . " {$this->left_join} fm_district ON 
fm_district.id = fm_part_of_town.district_id"
@@ -587,17 +590,19 @@
 
                        $group_fields = str_ireplace(array('fm_district.descr 
as district', 'fm_tts_views.id as view'), array(
                                'fm_district.descr', 'fm_tts_views.id'), 
$return_fields_plain);
-                       $group_fields_union = 
str_ireplace(array('fm_district.descr as district', 'fm_tts_views.id as view'), 
array(
-                               'fm_district.descr', 'fm_tts_views.id'), 
$return_fields_union);
-                       $sub_select = "({$union_budget} {$filtermethod} 
{$querymethod} GROUP BY {$group_fields_union} {$ordermethod} 
{$limit_and_offset}) UNION ({$union_cost} {$filtermethod} {$querymethod} GROUP 
BY {$group_fields_union} {$ordermethod} {$limit_and_offset})";
 
                        if ($union_select)
                        {
+                               $cache_test = 
"{$return_fields_union},{$union_budget} {$filtermethod} {$querymethod}";
+                               $group_fields_union = 
str_ireplace(array('fm_district.descr as district', 'fm_tts_views.id as view'), 
array('fm_district.descr', 'fm_tts_views.id'), $return_fields_union);
+                               $sub_select = "(SELECT 
{$return_fields_union},{$union_budget} {$filtermethod} {$querymethod} GROUP BY 
{$group_fields_union} {$ordermethod} {$limit_and_offset})"
+                               . " UNION (SELECT 
{$return_fields_union},{$union_cost} {$filtermethod} {$querymethod} GROUP BY 
{$group_fields_union} {$ordermethod} {$limit_and_offset})";
                                $main_sql = "SELECT {$return_fields} FROM 
({$sub_select} ) as t GROUP BY " . implode(',', 
array_keys($_return_field_array)) . " {$ordermethod}";
                        }
                        else
                        {
                                $main_sql = $sql . " {$filtermethod} 
{$querymethod} GROUP BY 
{$group_fields}{$budget_group_field}{$actual_cost_group_field} {$ordermethod}";
+                               $cache_test = $main_sql;
                        }
 
                        $sql_cnt = "SELECT DISTINCT budget,actual_cost, 
fm_tts_tickets.id FROM fm_tts_tickets"
@@ -617,66 +622,45 @@
 
                        $sql_cnt .= " {$filtermethod} {$querymethod}";
 
-//                     $cache_info = 
phpgwapi_cache::session_get('property','tts_listing_metadata');
+                       $filter_closed = '';// not needed
+                       if ($union_select)
+                       {
+                               $sub_select = "(SELECT 
fm_tts_tickets.id,{$union_budget} {$filtermethod} {$querymethod} 
{$filter_closed} GROUP BY fm_tts_tickets.id)"
+                               . " UNION (SELECT 
fm_tts_tickets.id,{$union_cost} {$filtermethod} {$querymethod} {$filter_closed} 
GROUP BY fm_tts_tickets.id)";
+                               $sql2 = "SELECT count(*) as cnt, SUM(budget) AS 
sum_budget, SUM(actual_cost) AS sum_actual_cost FROM ({$sub_select}) as t";
+                       }
+                       else
+                       {
+                               $sql2 = "SELECT count(*) as cnt, SUM(budget) AS 
sum_budget, SUM(actual_cost) AS sum_actual_cost FROM ({$sql_cnt} 
{$filter_closed} GROUP BY fm_tts_tickets.id) as t";
+                       }
 
-                       if (!isset($cache_info['sql_hash']) || 
$cache_info['sql_hash'] != md5($sql_cnt))
+                       $cache_info = 
phpgwapi_cache::session_get('property','tts_listing_metadata');
+
+                       if (!isset($cache_info['sql_hash']) || 
$cache_info['sql_hash'] != md5($cache_test))
                        {
                                $cache_info = array();
                        }
 //_debug_array($main_sql);
-//                     if(!$cache_info)
+                       if(!$cache_info)
                        {
-                               if ($union_select)
-                               {
-                                       $sub_select = "({$union_budget} 
{$filtermethod} {$querymethod} {$filter_closed} GROUP BY {$group_fields_union}) 
UNION ({$union_cost} {$filtermethod} {$querymethod} {$filter_closed} GROUP BY 
{$group_fields_union})";
-                                       $sql2 = "SELECT count(*) as cnt, 
sum(budget) as sum_budget, sum(actual_cost) as sum_actual_cost FROM 
({$sub_select} ) as t";
-                               }
-                               else
-                               {
-                                       $sql2 = "SELECT count(*) as cnt, 
sum(budget) as sum_budget, sum(actual_cost) as sum_actual_cost FROM ({$sql_cnt} 
GROUP BY fm_tts_tickets.id, fm_tts_tickets.budget) as t";
-                               }
-                               $this->db->query($sql2, __LINE__, __FILE__);
-                               $this->db->next_record();
-                               unset($sql2);
 
-                               $cache_info = array
-                                       (
-                                       'total_records' => $union_select ? 
((int)$this->db->f('cnt') / 2) : $this->db->f('cnt'),
-                                       'sum_budget' => 
$this->db->f('sum_budget'),
-                                       'sum_actual_cost' => 
$this->db->f('sum_actual_cost'),
-                                       'sql_hash' => md5($sql_cnt)
-                               );
 
-
-                               $custom_status = $this->get_custom_status();
-                               $closed_status = array('X');
-                               foreach ($custom_status as $custom)
-                               {
-                                       if ($custom['closed'])
-                                       {
-                                               $closed_status[] = 
"C{$custom['id']}";
-                                       }
-                               }
-                               $filter_closed = " AND fm_tts_tickets.status 
NOT IN ('" . implode("','", $closed_status) . "')";
-                               if ($union_select)
-                               {
-                                       $sub_select = "({$union_budget} 
{$filtermethod} {$querymethod} {$filter_closed} GROUP BY {$group_fields_union}) 
UNION ({$union_cost} {$filtermethod} {$querymethod} {$filter_closed} GROUP BY 
{$group_fields_union})";
-                                       $sql2 = "SELECT (SUM(budget) - 
SUM(actual_cost)) as sum_difference FROM ({$sub_select}) as t";
-                               }
-                               else
-                               {
-                                       $sql2 = "SELECT (SUM(budget) - 
SUM(actual_cost)) as sum_difference FROM ({$sql_cnt} {$filter_closed} GROUP BY 
fm_tts_tickets.id) as t";
-                               }
-
                                $this->db->query($sql2, __LINE__, __FILE__);
                                $this->db->next_record();
-                               unset($sql2);
+                               $count = $this->db->f('cnt');
+                               $sum_budget = (float)$this->db->f('sum_budget');
+                               $sum_actual_cost = 
(float)$this->db->f('sum_actual_cost');
 
-                               $cache_info['sum_difference'] = 
(float)$this->db->f('sum_difference');
+                               $cache_info = array(
+                                       'total_records'         => 
$union_select ? ((int)$count / 2) : $count,
+                                       'sum_budget'            => $sum_budget,
+                                       'sum_actual_cost'       => 
$sum_actual_cost,
+                                       'sum_difference'        => $sum_budget 
- $sum_actual_cost,
+                                       'sql_hash'                      => 
md5($cache_test)
+                               );
 
-//                             
phpgwapi_cache::session_set('property','tts_listing_metadata',$cache_info);
+                               
phpgwapi_cache::session_set('property','tts_listing_metadata',$cache_info);
                        }
-
                        $this->total_records = 
(int)$cache_info['total_records'];
                        $this->sum_budget = (int)$cache_info['sum_budget'];
                        $this->sum_actual_cost = 
(int)$cache_info['sum_actual_cost'];
@@ -725,6 +709,11 @@
                                                'billable_hours' => 
$this->db->f('billable_hours'),
                                                'ecodimb' => 
$this->db->f('ecodimb'),
                                                'order_dim1' => 
$this->db->f('order_dim1'),
+                                               'external_project_id' => 
$this->db->f('external_project_id'),
+                                               'contract_id' => 
$this->db->f('contract_id'),
+                                               'service_id' => 
$this->db->f('service_id'),
+                                               'tax_code' => 
$this->db->f('tax_code'),
+                                               'unspsc_code' => 
$this->db->f('unspsc_code'),
                                        );
 
                                        foreach ($custom_cols as $custom_col)
@@ -813,6 +802,11 @@
                                $ticket['contact_id'] = 
$this->db->f('contact_id');
                                $ticket['order_id'] = $this->db->f('order_id');
                                $ticket['vendor_id'] = 
$this->db->f('vendor_id');
+                               $ticket['contract_id'] = 
$this->db->f('contract_id',true);
+                               $ticket['service_id'] = 
$this->db->f('service_id',true);
+                               $ticket['external_project_id'] = 
$this->db->f('external_project_id',true);
+                               $ticket['unspsc_code'] = 
$this->db->f('unspsc_code',true);
+                               $ticket['tax_code'] = $this->db->f('tax_code');
                                $ticket['b_account_id'] = 
$this->db->f('b_account_id');
                                $ticket['order_descr'] = 
$this->db->f('order_descr', true);
                                $ticket['ecodimb'] = $this->db->f('ecodimb');
@@ -826,6 +820,9 @@
                                $ticket['branch_id'] = 
$this->db->f('branch_id');
                                $ticket['entry_date'] = 
$this->db->f('entry_date');
                                $ticket['modified_date'] = 
$this->db->f('modified_date');
+                               $ticket['order_sent'] = 
$this->db->f('order_sent');
+                               $ticket['order_received'] = 
$this->db->f('order_received');
+                               $ticket['order_received_percent'] = 
$this->db->f('order_received_percent');
 
                                $user_id = (int)$this->db->f('user_id');
 
@@ -1089,7 +1086,7 @@
                         * * T - Category change
                         * * S - Subject change
                         * * B - Budget
-                        * *    AC - actual cost changed
+                        * * AC - actual cost changed
                         * * H - Billing hours
                         * * F - finnish date
                         * * C% - Status changed
@@ -1657,10 +1654,15 @@
                                  }
                                 */
                                $value_set['vendor_id'] = $ticket['vendor_id'];
+                               $value_set['contract_id'] = 
$this->db->db_addslashes($ticket['contract_id']);
+                               $value_set['service_id'] = 
$ticket['service_id'];
+                               $value_set['external_project_id'] = 
$this->db->db_addslashes($ticket['external_project_id']);
+                               $value_set['unspsc_code'] = 
$ticket['unspsc_code'];
                                $value_set['b_account_id'] = 
$ticket['b_account_id'];
                                $value_set['order_descr'] = 
$this->db->db_addslashes($ticket['order_descr']);
                                $value_set['ecodimb'] = $ticket['ecodimb'];
                                $value_set['branch_id'] = $ticket['branch_id'];
+                               $value_set['tax_code'] = $ticket['tax_code'];
                        }
 
                        $value_set = $this->db->validate_update($value_set);

Modified: branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.soworkorder.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -928,7 +928,7 @@
                                        'key_deliver' => 
$this->db->f('key_deliver'),
                                        'key_responsible' => 
$this->db->f('key_responsible'),
                                        'charge_tenant' => 
$this->db->f('charge_tenant'),
-                                       'descr' => 
stripslashes($this->db->f('descr')),
+                                       'descr' => $this->db->f('descr',true),
                                        'status' => $this->db->f('status'),
                                        'calculation' => 
$this->db->f('calculation'),
                                        'b_account_id' => 
(int)$this->db->f('account_id'),
@@ -964,7 +964,16 @@
                                        'actual_cost' => 
$this->db->f('actual_cost'),
                                        'continuous' => 
$this->db->f('continuous'),
                                        'fictive_periodization' => 
$this->db->f('fictive_periodization'),
-                               );
+                                       'contract_id' =>        
$this->db->f('contract_id'),
+                                       'tax_code' => $this->db->f('tax_code'),
+                                       'unspsc_code' => 
$this->db->f('unspsc_code'),
+                                       'service_id' => 
$this->db->f('service_id'),
+                                       'building_part' => 
$this->db->f('building_part'),
+                                       'order_dim1' => 
$this->db->f('order_dim1'),
+                                       'order_sent' => 
$this->db->f('order_sent'),
+                                       'order_received' => 
$this->db->f('order_received'),
+                                       'order_received_percent' => 
$this->db->f('order_received_percent')
+                                       );
 
                                $sql = "SELECT periodization_id,"
                                        . " sum(fm_workorder_budget.budget) AS 
budget, sum(fm_workorder_budget.combined_cost) AS combined_cost,"
@@ -1254,6 +1263,12 @@
                                $workorder['approved'],
                                $workorder['continuous'],
                                $workorder['fictive_periodization'],
+                               $workorder['contract_id'],
+                               $workorder['tax_code'],
+                               $workorder['unspsc_code'],
+                               $workorder['service_id'],
+                               $workorder['building_part'],
+                               $workorder['order_dim1'],
                                isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: ''
                        );
 
@@ -1262,7 +1277,8 @@
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,tender_deadline,"
                                . 
"tender_received,inspection_on_completion,status,"
                                . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,"
-                               . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,mail_recipients
  $cols) "
+                               . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,"
+                               . "contract_id, tax_code, unspsc_code, 
service_id,building_part, order_dim1, mail_recipients  $cols) "
                                . "VALUES ( {$values} {$vals})", __LINE__, 
__FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
@@ -1400,6 +1416,12 @@
                                'approved' => $workorder['approved'],
                                'continuous' => $workorder['continuous'],
                                'fictive_periodization' => 
$workorder['fictive_periodization'],
+                               'contract_id' =>        
$workorder['contract_id'],
+                               'tax_code' => $workorder['tax_code'],
+                               'unspsc_code' => $workorder['unspsc_code'],
+                               'service_id' => $workorder['service_id'],
+                               'building_part' => $workorder['building_part'],
+                               'order_dim1' => $workorder['order_dim1'],
                                'mail_recipients' => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
                        );
 

Modified: branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php  
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uiagreement.inc.php  
2016-05-06 08:10:13 UTC (rev 14979)
@@ -839,7 +839,7 @@
                {
 
                        $agreement_id = phpgw::get_var('agreement_id', 'int');
-                       if (empty($agreement_id))
+                       if (!$agreement_id)
                        {
                                $result_data = array('results' => array());
                                $result_data['total_records'] = 0;
@@ -879,7 +879,7 @@
                        $data = phpgw::get_var('data');
                        $account_id = phpgw::get_var('account_id');
 
-                       if (empty(id))
+                       if (!$id)
                        {
                                $result_data = array('results' => array());
                                $result_data['total_records'] = 0;
@@ -1521,6 +1521,7 @@
                                'lang_name' => lang('name'),
                                'lang_name_statustext' => lang('name'),
                                'value_name' => $agreement['name'],
+                               'value_contract_id' => 
$agreement['contract_id'],
                                'lang_descr' => lang('descr'),
                                'lang_descr_statustext' => lang('descr'),
                                'value_descr' => $agreement['descr'],

Copied: 
branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php (from 
rev 14978, trunk/property/inc/class.uigeneric_document.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php   
                        (rev 0)
+++ branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -0,0 +1,878 @@
+<?php
+       /**
+        * phpGroupWare - property: a part of a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id: class.uigeneric_document.inc.php 14913 2016-04-11 
12:27:37Z sigurdne $
+        */
+       phpgw::import_class('phpgwapi.uicommon_jquery');
+       phpgw::import_class('phpgwapi.jquery');
+
+       class property_uigeneric_document extends phpgwapi_uicommon_jquery
+       {
+
+               private $bo;
+               private $receipt = array();
+               public $public_functions = array(
+                       'query' => true,
+                       'index' => true,
+                       'view' => true,
+                       'add' => true,
+                       'edit' => true,
+                       'save' => true,
+                       'delete' => true,
+                       'get_vendors' => true,
+                       'get_users' => true,
+                       'edit_title' => true,
+                       'get_relations' => true,
+                       'view_file' => true,
+                       'download' => true,
+               );
+
+               public function __construct()
+               {
+                       parent::__construct();
+
+//                     $this->bo = 
CreateObject('property.bogeneric_document');∕∕create me...
+                       $this->bocommon = & $this->bo->bocommon;
+                       $this->acl = & $GLOBALS['phpgw']->acl;
+                       $this->acl_location = 
'.document';//$this->bo->acl_location;
+                       $this->acl_read = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
+                       $this->acl_add = $this->acl->check($this->acl_location, 
PHPGW_ACL_ADD, 'property');
+                       $this->acl_edit = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $this->acl_delete = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
+                       $this->acl_manage = 
$this->acl->check($this->acl_location, 16, 'property');
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::documentation::generic";
+               }
+
+               public function download()
+               {
+                       if (!$this->acl_read)
+                       {
+                               phpgw::no_access();
+                               return;
+                       }
+
+                       $values = $this->query();
+
+                       $descr = array();
+                       $columns = array();
+                       $columns[] = 'id';
+                       $columns[] = 'title';
+                       $columns[] = 'descr';
+                       $columns[] = 'address';
+                       $columns[] = 'cnt';
+
+                       foreach ($columns as $_column)
+                       {
+                               $descr[] = lang(str_replace('_', ' ', 
$_column));
+                       }
+
+                       $this->bocommon->download($values, $columns, $descr);
+               }
+
+               /**
+                * Prepare UI
+                * @return void
+                */
+               public function index()
+               {
+                       if (!$this->acl_read)
+                       {
+                               phpgw::no_access();
+                               return;
+                       }
+
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.jeditable.js');
+                       self::add_javascript('phpgwapi', 'jquery', 
'editable/jquery.dataTables.editable.js');
+
+                       $categories = $this->_get_categories();
+
+                       $data = array(
+                               'datatable_name' => lang('generic document'),
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array('type' => 
'filter',
+                                                               'name' => 
'cat_id',
+                                                               'text' => 
lang('category') . ':',
+                                                               'list' => 
$categories,
+                                                       )
+                                               ),
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'property.uigeneric_document.index',
+                                               'phpgw_return_as' => 'json')),
+                                       'download' => 
self::link(array('menuaction' => 'property.uigeneric_document.download',
+                                               'export' => true, 'allrows' => 
true)),
+                                       'new_item' => 
self::link(array('menuaction' => 'property.uigeneric_document.add')),
+                                       'allrows' => true,
+                                       'editor_action' => 
self::link(array('menuaction' => 'property.uigeneric_document.edit_title')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'id',
+                                                       'label' => lang('ID'),
+                                                       'sortable' => true,
+                                                       'formatter' => 
'JqueryPortico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'title',
+                                                       'label' => 
lang('title'),
+                                                       'sortable' => true,
+                                                       'editor' => true
+                                               ),
+                                               /*                              
                array(
+                                                 'key' => 'descr',
+                                                 'label' => 
lang('description'),
+                                                 'sortable' => false,
+                                                 ), */
+                                               array(
+                                                       'key' => 'address',
+                                                       'label' => 
lang('buildingname'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'vendor',
+                                                       'label' => 
lang('vendor'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'year',
+                                                       'label' => lang('year'),
+                                                       'sortable' => true,
+                                                       'className' => 'center'
+                                               ),
+                                               array(
+                                                       'key' => 'multiplier',
+                                                       'label' => 
lang('multiplier'),
+                                                       'sortable' => false,
+                                                       'className' => 'right'
+                                               ),
+                                               array(
+                                                       'key' => 'cnt',
+                                                       'label' => 
lang('count'),
+                                                       'sortable' => false,
+                                                       'className' => 'center'
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'label' => 'dummy',
+                                                       'sortable' => false,
+                                                       'hidden' => true,
+                                               )
+                                       )
+                               ),
+                       );
+
+                       $parameters = array
+                               (
+                               'parameter' => array
+                                       (
+                                       array
+                                               (
+                                               'name' => 'id',
+                                               'source' => 'id'
+                                       ),
+                               )
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'view_document',
+                               'text' => lang('view'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'property.uigeneric_document.view'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'edit_document',
+                               'text' => lang('edit'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'property.uigeneric_document.edit'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
+
+
+                       if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       {
+                               $data['datatable']['actions'][] = array
+                                       (
+                                       'my_name' => 'delete_document',
+                                       'text' => lang('delete'),
+                                       'confirm_msg' => lang('do you really 
want to delete this entry') . '?',
+                                       'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                               'menuaction' => 
'property.uigeneric_document.delete'
+                                       )),
+                                       'parameters' => json_encode($parameters)
+                               );
+                       }
+
+                       self::render_template_xsl('datatable_jquery', $data);
+               }
+
+               /**
+                * Fetch data from $this->bo based on parametres
+                * @return array
+                */
+               public function query()
+               {
+                       $search = phpgw::get_var('search');
+                       $order = phpgw::get_var('order');
+                       $draw = phpgw::get_var('draw', 'int');
+
+
+                       $params = array(
+                               'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('length', 'int', 
'REQUEST', 0),
+                               'query' => $search['value'],
+                               'sort' => phpgw::get_var('sort'),
+                               'dir' => phpgw::get_var('dir'),
+                               'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
+                               'allrows' => phpgw::get_var('length', 'int') == 
-1
+                       );
+
+                       $result_objects = array();
+                       $result_count = 0;
+
+                       $values = array(); //$this->bo->read($params);
+                       if (phpgw::get_var('export', 'bool'))
+                       {
+                               return $values;
+                       }
+
+                       $result_data = array('results' => $values);
+
+                       $result_data['total_records'] = 
$this->bo->total_records;
+                       $result_data['draw'] = $draw;
+
+                       array_walk($result_data['results'], array($this, 
'_add_links'), array('menuaction' => 'property.uigeneric_document.view'));
+
+                       return $this->jquery_results($result_data);
+               }
+
+               public function view()
+               {
+                       if (!$this->acl_read)
+                       {
+                               phpgw::no_access();
+                               return;
+                       }
+                       $this->edit(null, $mode = 'view');
+               }
+
+               public function add()
+               {
+                       $this->edit();
+               }
+
+               /**
+                * Prepare data for view and edit - depending on mode
+                *
+                * @param array  $values  populated object in case of retry
+                * @param string $mode    edit or view
+                * @param int    $id      entity id - no id means 'new'
+                *
+                * @return void
+                */
+               public function edit( $values = array(), $mode = 'edit' )
+               {
+                       $id = isset($values['id']) && $values['id'] ? 
$values['id'] : phpgw::get_var('id', 'int');
+
+                       if (!$this->acl_add && !$this->acl_edit)
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uigeneric_document.view',
+                                       'id' => $id));
+                       }
+
+                       if ($mode == 'view')
+                       {
+                               if (!$this->acl_read)
+                               {
+                                       phpgw::no_access();
+                                       return;
+                               }
+                       }
+                       else
+                       {
+                               if (!$this->acl_add && !$this->acl_edit)
+                               {
+                                       phpgw::no_access();
+                                       return;
+                               }
+                       }
+
+                       $tabs = array();
+                       $tabs['generic'] = array('label' => lang('generic'), 
'link' => '#generic');
+                       $active_tab = 'generic';
+                       $tabs['relations'] = array('label' => 
lang('relations'), 'link' => "#relations",
+                               'disable' => 0);
+
+                       if ($id)
+                       {
+                               $tabs['relations']['link'] = '#relations';
+                               $tabs['relations']['disable'] = 0;
+
+                               if (!$values)
+                               {
+                                       $values = 
array();//$this->bo->read_single(array('id' => $id, 'view' => $mode == 'view'));
+                               }
+                       }
+
+                       $categories = $this->_get_categories($values['cat_id']);
+
+                       self::message_set($this->receipt);
+
+                       $related_def = array
+                               (
+                               array('key' => 'name', 'label' => lang('name'), 
'sortable' => false,
+                                       'resizeable' => true),
+                               array('key' => 'relate', 'label' => 
lang('related'), 'sortable' => false,
+                                       'resizeable' => true),
+                       );
+
+
+                       $datatable_def = array();
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_0',
+                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uigeneric_document.get_relations',
+                                               'id' => $id, 'phpgw_return_as' 
=> 'json'))),
+                               'ColumnDefs' => $related_def,
+                               'config' => array(
+                                       array('disableFilter' => true)
+                               )
+                       );
+
+                       $data = array
+                               (
+                               'datatable_def' => $datatable_def,
+                               'document' => $values,
+                               'lang_coordinator' =>  lang('coordinator'),
+                               'categories' => array('options' => $categories),
+                               'status_list' => array('options' => array('id' 
=> 1, 'name' => 'status_1')),
+                               'editable' => $mode == 'edit',
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'location_filter' => array('options' => 
$this->get_location_filter()),
+                               'link_controller_example' => 
self::link(array('menuaction' => 'controller.uicomponent.index'))
+                       );
+
+                       //print_r($data['tabs']); die;
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('generic document');
+
+                       if ($mode == 'edit')
+                       {
+                               
$GLOBALS['phpgw']->jqcal->add_listener('report_date');
+                               phpgwapi_jquery::load_widget('core');
+                               self::add_javascript('property', 'portico', 
'generic_document_edit.js');
+                               
phpgwapi_jquery::formvalidator_generate(array('date', 'security','file'));
+                       }
+
+                       phpgwapi_jquery::load_widget('numberformat');
+                       self::add_javascript('property', 'portico', 
'generic_document.js');
+
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
+                       self::render_template_xsl(array('generic_document', 
'datatable_inline'), $data);
+               }
+
+
+               private function get_location_filter()
+               {
+                       $this->soadmin_entity = 
CreateObject('property.soadmin_entity');
+                       $entity_list = 
$this->soadmin_entity->read(array('allrows' => true));
+                       $location_filter = array();
+                       foreach ($entity_list as $entry)
+                       {
+                               $categories = 
$this->soadmin_entity->read_category(array('entity_id' => $entry['id'],
+                                       'order' => 'name', 'sort' => 'asc', 
'enable_controller' => true, 'allrows' => true));
+                               foreach ($categories as $category)
+                               {
+                                       $location_filter[] = array(
+                                               'id' => 
$category['location_id'],
+                                               'name' => 
"{$entry['name']}::{$category['name']}",
+                                       );
+                               }
+                       }
+
+                       foreach ($location_filter as &$location)
+                       {
+                               $location['selected'] = $location['id'] == 
$location_id ? 1 : 0;
+                       }
+                       return $location_filter;
+               }
+
+
+               /**
+                * Saves an entry to the database for new/edit - redirects to 
view
+                *
+                * @param int  $id  entity id - no id means 'new'
+                *
+                * @return void
+                */
+               public function save()
+               {
+                       if (!$_POST)
+                       {
+                               return $this->edit();
+                       }
+
+                       $id = (int)phpgw::get_var('id');
+
+                       if ($id)
+                       {
+                               $values = 
array();//$this->bo->read_single(array('id' => $id, 'view' => true));
+                       }
+                       else
+                       {
+                               $values = array();
+                       }
+
+                       /*
+                        * Overrides with incoming data from POST
+                        */
+                       $values = $this->_populate($values);
+
+                       if ($this->receipt['error'])
+                       {
+                               $this->edit($values);
+                       }
+                       else
+                       {
+
+                               try
+                               {
+                                       $id = $this->bo->save($values);
+                               }
+                               catch (Exception $e)
+                               {
+                                       if ($e)
+                                       {
+                                               
phpgwapi_cache::message_set($e->getMessage(), 'error');
+                                               $this->edit($values);
+                                               return;
+                                       }
+                               }
+
+                               $this->_handle_files($id);
+                               if ($_FILES['import_file']['tmp_name'])
+                               {
+                                       $this->_handle_import($id);
+                               }
+                               else
+                               {
+                                       phpgwapi_cache::message_set('ok!', 
'message');
+                                       self::redirect(array('menuaction' => 
'property.uigeneric_document.edit',
+                                               'id' => $id));
+                               }
+                       }
+               }
+
+               /**
+                * Fetch a list of files to be displayed in view/edit
+                *
+                * @param int  $id  entity id
+                *
+                * @return array $ResultSet json resultset
+                */
+               public function get_relations()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+
+                       $values = array();
+                       $values[] = array(
+                               'name' => 'Item 1',
+                               'relate' => '<input type="checkbox" 
checked="checked">',
+                       );
+                       $values[] = array(
+                               'name' => 'Item 2',
+                               'relate' => '<input type="checkbox">',
+                       );
+
+                       return array(
+                               'recordsTotal' => count($values),
+                               'recordsFiltered' => count($values),
+                               'draw' => phpgw::get_var('draw', 'int'),
+                               'data' => $values,
+                       );
+               }
+
+
+               /**
+                * Dowloads a single file to the browser
+                *
+                * @param int  $id  entity id
+                *
+                * @return file
+                */
+               function view_file()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return lang('no access');
+                       }
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
+               }
+
+               /**
+                * Store and / or delete files related to an entity
+                *
+                * @param int  $id  entity id
+                *
+                * @return void
+                */
+               private function _handle_files( $id )
+               {
+                       $id = (int)$id;
+                       if (!$id)
+                       {
+                               throw new 
Exception('uigeneric_document::_handle_files() - missing id');
+                       }
+                       $bofiles = CreateObject('property.bofiles');
+
+                       if (isset($_POST['file_action']) && 
is_array($_POST['file_action']))
+                       {
+                               
$bofiles->delete_file("/generic_document/{$id}/",array('file_action' => 
$_POST['file_action']));
+                       }
+                       $file_name = str_replace(' ', '_', 
$_FILES['file']['name']);
+
+                       if ($file_name)
+                       {
+                               if (!is_file($_FILES['file']['tmp_name']))
+                               {
+                                       
phpgwapi_cache::message_set(lang('Failed to upload file !'), 'error');
+                                       return;
+                               }
+
+                               $to_file = $bofiles->fakebase . 
'/generic_document/' . $id . '/' . $file_name;
+                               if ($bofiles->vfs->file_exists(array(
+                                               'string' => $to_file,
+                                               'relatives' => 
Array(RELATIVE_NONE)
+                                       )))
+                               {
+                                       phpgwapi_cache::message_set(lang('This 
file already exists !'), 'error');
+                               }
+                               else
+                               {
+                                       
$bofiles->create_document_dir("generic_document/{$id}");
+                                       $bofiles->vfs->override_acl = 1;
+
+                                       if (!$bofiles->vfs->cp(array(
+                                                       'from' => 
$_FILES['file']['tmp_name'],
+                                                       'to' => $to_file,
+                                                       'relatives' => 
array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL))))
+                                       {
+                                               
phpgwapi_cache::message_set(lang('Failed to upload file !'), 'error');
+                                       }
+                                       $bofiles->vfs->override_acl = 0;
+                               }
+                       }
+               }
+
+
+               /**
+                * Gets user candidates to be used as coordinator - called as 
ajax from edit form
+                *
+                * @param string  $query
+                *
+                * @return array
+                */
+               public function get_users()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $accounts = 
$GLOBALS['phpgw']->accounts->get_list('accounts', $start, $sort, $order, 
$query, $offset);
+
+                       $values = array();
+                       foreach ($accounts as $account)
+                       {
+                               if ($account->enabled)
+                               {
+                                       $values[] = array
+                                               (
+                                               'id' => $account->id,
+                                               'name' => 
$account->__toString(),
+                                       );
+                               }
+                       }
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               /**
+                * Gets vendor canidated to be used as vendor - called as ajax 
from edit form
+                *
+                * @param string  $query
+                *
+                * @return array
+                */
+               public function get_vendors()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'vendor');
+                       $values = $sogeneric->read(array('query' => $query));
+                       foreach ($values as &$entry)
+                       {
+                               $entry['name'] = $entry['org_name'];
+                       }
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               /**
+                * Edit title fo entity directly from table
+                *
+                * @param int  $id  id of entity
+                * @param string  $value new title of entity
+                *
+                * @return string text to appear in ui as receipt on action
+                */
+               public function edit_title()
+               {
+                       $id = phpgw::get_var('id', 'int', 'POST');
+
+                       if (!$this->acl_edit)
+                       {
+                               return lang('no access');
+                       }
+
+                       if ($id)
+                       {
+                               $values = $this->bo->read_single(array('id' => 
$id, 'view' => true));
+                               $values['title'] = phpgw::get_var('value');
+
+                               try
+                               {
+                                       $this->bo->edit_title($values);
+                               }
+                               catch (Exception $e)
+                               {
+                                       if ($e)
+                                       {
+                                               echo $e->getMessage();
+                                       }
+                               }
+                               echo true;
+                       }
+                       else
+                       {
+                               echo "ERROR";
+                       }
+               }
+
+               /**
+                * Delete document and all related info
+                *
+                * @param int  $id  id of entity
+                *
+                * @return string text to appear in ui as receipt on action
+                */
+               public function delete()
+               {
+                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       {
+                               return 'No access';
+                       }
+                       $id = phpgw::get_var('id', 'int', 'GET');
+
+                       try
+                       {
+                               $this->bo->delete($id);
+                       }
+                       catch (Exception $e)
+                       {
+                               if ($e)
+                               {
+                                       return $e->getMessage();
+                               }
+                       }
+                       return 'Deleted';
+               }
+
+                       /*
+                * Overrides with incoming data from POST
+                */
+
+               private function _populate( $data = array() )
+               {
+
+                       $values = phpgw::get_var('values');
+
+                       $_fields = array
+                               (
+                               array
+                                       (
+                                       'name' => 'title',
+                                       'type' => 'string',
+                                       'required' => true
+                               ),
+                               array
+                                       (
+                                       'name' => 'descr',
+                                       'type' => 'string',
+                                       'required' => true
+                               ),
+                               array
+                                       (
+                                       'name' => 'cat_id',
+                                       'type' => 'integer',
+                                       'required' => true
+                               ),
+                               array
+                                       (
+                                       'name' => 'report_date',
+                                       'type' => 'string',
+                                       'required' => true
+                               ),
+                               array
+                                       (
+                                       'name' => 'status_id',
+                                       'type' => 'integer',
+                                       'required' => true
+                               ),
+                               array
+                                       (
+                                       'name' => 'vendor_id',
+                                       'type' => 'integer',
+                                       'required' => false
+                               ),
+                               array
+                                       (
+                                       'name' => 'vendor_name',
+                                       'type' => 'string',
+                                       'required' => false
+                               ),
+                               array
+                                       (
+                                       'name' => 'coordinator_id',
+                                       'type' => 'integer',
+                                       'required' => false
+                               ),
+                               array
+                                       (
+                                       'name' => 'coordinator_name',
+                                       'type' => 'string',
+                                       'required' => false
+                               ),
+                               array
+                                       (
+                                       'name' => 'multiplier',
+                                       'type' => 'float',
+                                       'required' => false
+                               ),
+                       );
+
+
+                       foreach ($_fields as $_field)
+                       {
+                               if ($data[$_field['name']] = 
$_POST['values'][$_field['name']])
+                               {
+                                       $data[$_field['name']] = 
phpgw::clean_value($data[$_field['name']], $_field['type']);
+                               }
+                               if ($_field['required'] && 
!$data[$_field['name']])
+                               {
+                                       $this->receipt['error'][] = array('msg' 
=> lang('Please enter value for attribute %1', $_field['name']));
+                               }
+                       }
+
+
+                       /*
+                        * Extra data from custom fields
+                        */
+                       $values['attributes'] = 
phpgw::get_var('values_attribute');
+
+                       if (is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as $attribute)
+                               {
+                                       if ($attribute['nullable'] != 1 && 
(!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                       {
+                                               $this->receipt['error'][] = 
array('msg' => lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                       }
+                               }
+                       }
+
+                       if (!isset($values['cat_id']) || !$values['cat_id'])
+                       {
+                               $this->receipt['error'][] = array('msg' => 
lang('Please select a category !'));
+                       }
+
+                       if (!isset($values['title']) || !$values['title'])
+                       {
+                               $this->receipt['error'][] = array('msg' => 
lang('Please give a title !'));
+                       }
+
+                       if (!isset($values['report_date']) || 
!$values['report_date'])
+                       {
+                               $this->receipt['error'][] = array('msg' => 
lang('Please select a date!'));
+                       }
+
+                       return $values;
+               }
+
+               private function _get_categories( $selected = 0 )
+               {
+                       $cats = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
+                       $cats->supress_info = true;
+                       $categories = $cats->formatted_xslt_list(array('format' 
=> 'filter', 'selected' => $selected,
+                               'globals' => true, 'use_acl' => 
$this->_category_acl));
+                       $default_value = array('cat_id' => '', 'name' => 
lang('no category'));
+                       array_unshift($categories['cat_list'], $default_value);
+
+                       foreach ($categories['cat_list'] as & $_category)
+                       {
+                               $_category['id'] = $_category['cat_id'];
+                       }
+
+                       return $categories['cat_list'];
+               }
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.uiimport.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiimport.inc.php     
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uiimport.inc.php     
2016-05-06 08:10:13 UTC (rev 14979)
@@ -50,6 +50,10 @@
 
                        $this->valid_tables = array
                                (
+                               'fm_streetaddress' => array('name' => 
'fm_streetaddress (' . lang('street name') . ')', 'permission' => 
PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
+                               'fm_unspsc_code' => array('name' => 
'fm_unspsc_code (' . lang('unspsc code') . ')', 'permission' => PHPGW_ACL_READ 
| PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
+                               'fm_external_project' => array('name' => 
'fm_external_project (' . lang('external project') . ')', 'permission' => 
PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
+                               'fm_eco_service' => array('name' => 
'fm_eco_service (' . lang('service') . ')', 'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
                                'fm_vendor' => array('name' => 'fm_vendor (' . 
lang('vendor') . ')', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_condition_survey' => array('name' => 
'fm_condition_survey (' . lang('condition survey') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
@@ -57,7 +61,6 @@
                                'fm_budget' => array('name' => 'fm_budget (' . 
lang('budget') . ')', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_org_unit' => array('name' => 'fm_org_unit 
(' . lang('department') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
-                               'fm_project_group' => array('name' => 
'fm_project_group', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_eco_periodization_outline' => array('name' 
=> 'fm_eco_periodization_outline (' . lang('periodization outline') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
                                'fm_eco_periodization' => array('name' => 
'fm_eco_periodization (' . lang('periodization') . ')',

Modified: branches/Version-2_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiinvoice.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uiinvoice.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -246,7 +246,7 @@
                        $name = array
                                (
                                'workorder_id',
-                               'project_group',
+                               'external_project_id',
                                'status',
                                'voucher_id',
                                'invoice_id',
@@ -1508,7 +1508,7 @@
                                        'key' => 'workorder', 'label' => 
lang('Workorder'), 'className' => 'center',
                                        'sortable' => true, 'hidden' => false),
                                array(
-                                       'key' => 'project_group', 'label' => 
lang('project group'), 'className' => 'center',
+                                       'key' => 'external_project_id', 'label' 
=> lang('external project'), 'className' => 'center',
                                        'sortable' => false, 'hidden' => false),
                                array(
                                        'key' => 'close_order', 'label' => 
lang('Close order'), 'className' => 'center',
@@ -1767,7 +1767,7 @@
                                        'col_name' => 'workorder', 'label' => 
lang('Workorder'), 'className' => 'centerClasss',
                                        'sortable' => true, 'sort_field' => 
'pmwrkord_code', 'visible' => true),
                                array(
-                                       'col_name' => 'project_group', 'label' 
=> lang('project group'), 'className' => 'centerClasss',
+                                       'col_name' => 'external_project_id', 
'label' => lang('external project'), 'className' => 'centerClasss',
                                        'sortable' => false, 'sort_field' => 
'', 'visible' => true),
                                array(
                                        'col_name' => 'close_order', 'label' => 
lang('Close order'), 'className' => 'centerClasss',
@@ -1845,7 +1845,7 @@
                                        }
                                        else if (($i == 1))
                                        {
-                                               
$json_row[$uicols[$i]['col_name']] .= $invoices['project_group'];
+                                               
$json_row[$uicols[$i]['col_name']] .= $invoices['external_project_id'];
                                        }
                                        else if (($i == 2))
                                        {
@@ -2149,7 +2149,7 @@
 
                        if (isset($values['save']))
                        {
-                               $values['project_group'] = 
phpgw::get_var('project_group', 'int', 'POST');
+                               $values['external_project_id'] = 
phpgw::get_var('external_project_id', 'string', 'POST');
                                if ($GLOBALS['phpgw']->session->is_repost())
                                {
                                        $this->receipt['error'][] = array('msg' 
=> lang('repost'));
@@ -2276,9 +2276,9 @@
                                'type' => 'voucher_process_code',
                                'selected' => isset($values['process_code']) ? 
$values['process_code'] : $line['process_code']));
 
-                       $project_group_data = 
$this->bocommon->initiate_project_group_lookup(array(
-                               'project_group' => $values['project_group'] ? 
$values['project_group'] : $line['project_group'],
-                               'project_group_descr' => 
$values['project_group_descr']));
+                       $external_project_data = 
$this->bocommon->initiate_external_project_lookup(array(
+                               'external_project_id' => 
$values['external_project_id'] ? $values['external_project_id'] : 
$line['external_project_id'],
+                               'external_project_name' => 
$values['external_project_name']));
 
                        $tabs = array();
                        $tabs['generic'] = array('label' => lang('generic'), 
'link' => '#generic');
@@ -2299,7 +2299,7 @@
                                'sign_orig' => $sign_orig,
                                'my_initials' => $my_initials,
                                'process_code_list' => $process_code_list,
-                               'project_group_data' => $project_group_data,
+                               'external_project_data' => 
$external_project_data,
                                'order_id' => $line['order_id'],
                                'value_amount' => $line['amount'],
                                'value_approved_amount' => 
$line['approved_amount'],
@@ -3591,7 +3591,7 @@
                                'approved_list' => $approved_list,
                                'sign_orig' => $sign_orig,
                                'my_initials' => $my_initials,
-                               'project_group_data' => $project_group_data,
+                               'external_project_data' => 
$external_project_data,
                                'orders' => $orders,
                                'value_amount' => $line['amount'],
                                'value_currency' => $line['currency'],

Modified: branches/Version-2_0-branch/property/inc/class.uiinvoice2.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiinvoice2.inc.php   
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uiinvoice2.inc.php   
2016-05-06 08:10:13 UTC (rev 14979)
@@ -496,8 +496,8 @@
                                ),
                                array
                                        (
-                                       'key' => 'project_group',
-                                       'label' => lang('project group'),
+                                       'key' => 'external_project_id',
+                                       'label' => lang('external project'),
                                        'sortable' => false,
                                        'formatter' => 
'JqueryPortico.FormatterRight',
                                ),

Modified: branches/Version-2_0-branch/property/inc/class.uilookup.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uilookup.inc.php     
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uilookup.inc.php     
2016-05-06 08:10:13 UTC (rev 14979)
@@ -59,7 +59,7 @@
                        'street' => true,
                        'tenant' => true,
                        'phpgw_user' => true,
-                       'project_group' => true,
+                       'external_project' => true,
                        'ecodimb' => true,
                        'order_template' => true,
                        'response_template' => true,
@@ -1311,7 +1311,7 @@
                        self::render_template_xsl('datatable_jquery', $data);
                }
 
-               function project_group()
+               function external_project()
                {
                        if (phpgw::get_var('phpgw_return_as') == 'json')
                        {
@@ -1333,7 +1333,7 @@
 
                                $values = array();
                                $bo = CreateObject('property.bogeneric');
-                               $bo->get_location_info('project_group');
+                               $bo->get_location_info('external_project');
                                $values = $bo->read($params);
 
                                $result_data = array
@@ -1345,10 +1345,10 @@
                                return $this->jquery_results($result_data);
                        }
 
-                       $action = 
'parent.document.getElementsByName("project_group")[0].value = "";' . "\r\n";
-                       $action .= 
'parent.document.getElementsByName("project_group_descr")[0].value = "";' . 
"\r\n";
-                       $action .= 
'parent.document.getElementsByName("project_group")[0].value = aData["id"];' . 
"\r\n";
-                       $action .= 
'parent.document.getElementsByName("project_group_descr")[0].value = 
aData["descr"];' . "\r\n";
+                       $action = 
'parent.document.getElementsByName("external_project_id")[0].value = "";' . 
"\r\n";
+                       $action .= 
'parent.document.getElementsByName("external_project_name")[0].value = "";' . 
"\r\n";
+                       $action .= 
'parent.document.getElementsByName("external_project_id")[0].value = 
aData["id"];' . "\r\n";
+                       $action .= 
'parent.document.getElementsByName("external_project_name")[0].value = 
aData["name"];' . "\r\n";
                        $action .= 
'parent.JqueryPortico.onPopupClose("close");' . "\r";
 
                        $data = array(
@@ -1361,9 +1361,9 @@
                                ),
                                'datatable' => array(
                                        'source' => self::link(array(
-                                               'menuaction' => 
'property.uilookup.project_group',
+                                               'menuaction' => 
'property.uilookup.external_project',
                                                'query' => $this->query,
-                                               'type' => 'project_group',
+                                               'type' => 'external_project',
                                                'phpgw_return_as' => 'json'
                                        )),
                                        'allrows' => true,
@@ -1373,7 +1373,7 @@
                        );
 
                        $uicols = array(
-                               'name' => array('id', 'descr', 'budget'),
+                               'name' => array('id', 'name', 'budget'),
                                'sortable' => array(true, false, true),
                                'formatter' => array('', '', 
'JqueryPortico.FormatterRight'),
                                'descr' => array(lang('ID'), lang('Name'), 
lang('budget'))
@@ -1393,8 +1393,8 @@
                                array_push($data['datatable']['field'], 
$params);
                        }
 
-                       $appname = lang('project group');
-                       $function_msg = lang('list project group');
+                       $appname = lang('external project');
+                       $function_msg = lang('list external project');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 

Modified: branches/Version-2_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiproject.inc.php    
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uiproject.inc.php    
2016-05-06 08:10:13 UTC (rev 14979)
@@ -68,11 +68,12 @@
                        'date_search' => true,
                        'columns' => true,
                        'bulk_update_status' => true,
-                       'project_group' => true,
                        'view_file' => true,
                        'get_orders' => true,
                        'get_vouchers' => true,
-                       'check_missing_project_budget' => true
+                       'check_missing_project_budget' => true,
+                       'get_external_project'=> true,
+                       'get_ecodimb'   => true
                );
 
                function __construct()
@@ -730,7 +731,7 @@
 
                        $values = phpgw::get_var('values');
                        $values_attribute = phpgw::get_var('values_attribute');
-                       $values['project_group'] = 
phpgw::get_var('project_group');
+//                     $values['external_project_id'] = 
phpgw::get_var('external_project_id');
                        $values['ecodimb'] = phpgw::get_var('ecodimb');
                        $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
                        $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
@@ -789,9 +790,9 @@
                                
$sogeneric->get_location_info('b_account_category', false);
                                $status_data = 
$sogeneric->read_single(array('id' => (int)$values['b_account_id']), array());
 
-                               if (isset($status_data['project_group']) && 
$status_data['project_group'])//mandatory for this account group
+                               if (isset($status_data['external_project']) && 
$status_data['external_project'])//mandatory for this account group
                                {
-                                       if (!isset($values['project_group']) || 
!$values['project_group'])
+                                       if 
(!isset($values['external_project_id']) || !$values['external_project_id'])
                                        {
                                                $this->receipt['error'][] = 
array('msg' => lang('Please select a project group!'));
                                                $error_id = true;
@@ -1545,9 +1546,9 @@
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_start_date');
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_end_date');
 
-                       $project_group_data = 
$this->bocommon->initiate_project_group_lookup(array(
-                               'project_group' => $values['project_group'],
-                               'project_group_descr' => 
$values['project_group_descr']));
+                       $external_project_data = 
$this->bocommon->initiate_external_project_lookup(array(
+                               'external_project_id' => 
$values['external_project_id'],
+                               'external_project_name' => 
$values['external_project_name']));
 
 
                        //---datatable 
settings---------------------------------------------------
@@ -2042,7 +2043,9 @@
                                'lang_name' => lang('Name'),
                                'lang_project_id' => lang('Project ID'),
                                'value_project_id' => isset($id) ? $id : '',
-                               'project_group_data' => $project_group_data,
+//                             'external_project_data' => 
$external_project_data,
+                               'value_external_project_id' => 
$values['external_project_id'],
+                               'value_external_project_name' => 
$this->_get_external_project_name($values['external_project_id']),
                                'value_name' => isset($values['name']) ? 
$values['name'] : '',
                                'lang_name_statustext' => lang('Enter Project 
Name'),
                                'lang_other_branch' => lang('Other branch'),
@@ -2143,6 +2146,7 @@
 
                        phpgwapi_jquery::load_widget('core');
                        phpgwapi_jquery::load_widget('numberformat');
+                       phpgwapi_jquery::load_widget('autocomplete');
 
                        self::add_javascript('property', 'portico', 
'project.edit.js');
                        self::render_template_xsl(array('project', 
'datatable_inline', 'files', 'attributes_form'), array(
@@ -2240,7 +2244,7 @@
                                        'amount' => $entry['amount'],
                                        'approved_amount' => 
$entry['approved_amount'],
                                        'vendor' => $entry['vendor'],
-                                       'project_group' => $entry['project_id'],
+                                       'external_project_id' => 
$entry['project_id'],
                                        'currency' => $entry['currency'],
                                        'budget_responsible' => 
$entry['budget_responsible'],
                                        'budsjettsigndato' => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
@@ -2601,6 +2605,29 @@
                        $this->edit(array(), $mode = 'view');
                }
 
+               public function get_external_project()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+                       return $this->bocommon->get_external_project();
+               }
+
+               public function get_ecodimb()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+                       return $this->bocommon->get_ecodimb();
+               }
+
+               private function _get_external_project_name( $id )
+               {
+                       return $this->bocommon->get_external_project_name($id);
+               }
+
                protected function _generate_tabs( $tabs_ = array(), 
$active_tab = 'general', $suppress = array() )
                {
                        $tabs = array

Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-05-05 23:32:23 UTC (rev 14978)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-05-06 08:10:13 UTC (rev 14979)
@@ -48,7 +48,14 @@
                        'edit_priority' => true,
                        'update_data' => true,
                        '_print' => true,
-                       'columns' => true
+                       'columns' => true,
+                       'get_vendor_contract'=> true,
+                       'get_eco_service'=> true,
+                       'get_ecodimb'   => true,
+                       'get_b_account' => true,
+                       'get_external_project'=> true,
+                       'get_unspsc_code'=> true,
+                       'receive_order' => true
                );
 
                /**
@@ -193,28 +200,6 @@
                        return $this->jquery_results($result_data);
                }
 
-               function save_sessiondata()
-               {
-                       $data = array
-                               (
-                               'start' => $this->start,
-                               'query' => $this->query,
-                               'sort' => $this->sort,
-                               'order' => $this->order,
-                               'status_id' => $this->status_id,
-                               'user_id' => $this->user_id,
-                               'reported_by' => $this->reported_by,
-                               'cat_id' => $this->cat_id,
-                               'vendor_id' => $this->vendor_id,
-                               'district_id' => $this->district_id,
-                               'part_of_town_id' => $this->part_of_town_id,
-                               'allrows' => $this->allrows,
-                               'start_date' => $this->start_date,
-                               'end_date' => $this->end_date
-                       );
-                       $this->bo->save_sessiondata($data);
-               }
-
                function _print()
                {
                        if (!$this->acl_read)
@@ -255,9 +240,43 @@
                        $start_date = urldecode($this->start_date);
                        $end_date = urldecode($this->end_date);
 
-                       $this->bo->allrows = true;
-                       $list = $this->bo->read($start_date, $end_date, 
$external, '', $download = true);
+                       $search = phpgw::get_var('search');
+                       $order = phpgw::get_var('order');
+                       $draw = phpgw::get_var('draw', 'int');
+                       $columns = phpgw::get_var('columns');
 
+                       $params = array(
+                               'start' => 0,
+                               'results' => -1,
+                               'query' => $search['value'],
+                               'order' => 
$columns[$order[0]['column']]['data'],
+                               'sort' => $order[0]['dir'],
+                               'dir' => $order[0]['dir'],
+                               'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
+                               'allrows' => phpgw::get_var('length', 'int') == 
-1 ? true : false,
+                               'status_id' => $this->bo->status_id,
+                               'user_id' => $this->bo->user_id,
+                               'reported_by' => $this->bo->reported_by,
+                               'cat_id' => $this->bo->cat_id,
+                               'vendor_id' => $this->bo->vendor_id,
+                               'district_id' => $this->bo->district_id,
+                               'part_of_town_id' => $this->bo->part_of_town_id,
+                               'allrows' => true,
+                               'start_date' => $start_date,
+                               'end_date' => $end_date,
+                               'location_code' => $this->bo->location_code,
+                               'p_num' => $this->bo->p_num,
+                               'building_part' => $this->bo->building_part,
+                               'b_account' => $this->bo->b_account,
+                               'ecodimb' => $this->bo->ecodimb,
+                               'branch_id' => phpgw::get_var('branch_id'),
+                               'order_dim1' => phpgw::get_var('order_dim1'),
+                               'external' => $external,
+                               'download' => true
+                       );
+//                     _debug_array($params); die();
+                       $list = $this->bo->read($params);
+
                        $custom_status = $this->bo->get_custom_status();
 
                        $status = array();
@@ -485,7 +504,6 @@
 
                private function _get_fields()
                {
-                       $this->bo->read(array('dry_run' => true));
                        $this->bo->get_origin_entity_type();
                        $uicols_related = $this->bo->uicols_related;
 
@@ -499,19 +517,19 @@
                        $uicols['descr'][] = lang('subject');
 
                        $location_types = 
execMethod('property.soadmin_location.select_location_type');
-                       $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
+//                     $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
 
-                       static $location_cache = array();
-
                        foreach ($location_types as $dummy => $level)
                        {
-                               if (in_array($level['id'], $level_assigned))
+               //              if (in_array($level['id'], $level_assigned))
                                {
                                        $uicols['name'][] = 
"loc{$level['id']}_name";
                                        $uicols['descr'][] = $level['name'];
                                }
+                               break;//first one only...
                        }
 
+
                        $uicols['name'][] = 'entry_date';
                        $uicols['descr'][] = lang('entry date');
 
@@ -680,17 +698,19 @@
                                        'list' => $values_combo_box[2]
                                );
 
+                               $filter_tts_assigned_to_me = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_assigned_to_me'];
+
                                $values_combo_box[4] = 
$this->bocommon->get_user_list_right2('filter', PHPGW_ACL_EDIT, $this->user_id, 
$this->acl_location);
                                array_unshift($values_combo_box[4], array(
                                        'id' => -1 * 
$GLOBALS['phpgw_info']['user']['account_id'],
                                        'name' => lang('my assigned tickets'),
-                                       'selected'      => (int)$this->user_id 
<= 0 ? 1 : 0));
+                                       'selected'      => ((int)$this->user_id 
< 0  || (int)$filter_tts_assigned_to_me == 1) ? 1 : 0));
 
                                array_unshift($values_combo_box[4], array('id' 
=> '', 'name' => lang('assigned to')));
                                $combos[] = array('type' => 'filter',
                                        'name' => 'user_id',
                                        'extra' => '',
-                                       'text' => lang('user'),
+                                       'text' => lang('assigned to'),
                                        'list' => $values_combo_box[4]
                                );
 
@@ -868,8 +888,8 @@
                                ),
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'property.uitts.index',
-                                               'start_date' => $start_date,
-                                               'end_date' => $end_date,
+                                       //      'start_date' => $start_date,
+                                       //      'end_date' => $end_date,
                                                'phpgw_return_as' => 'json')),
                                        'download' => 
self::link(array('menuaction' => 'property.uitts.download',
                                                'export' => true, 'allrows' => 
true)),
@@ -1431,8 +1451,7 @@
                        $function_msg = lang('add ticket');
 
                        self::add_javascript('property', 'portico', 
'tts.add.js');
-                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
-                               'file'));
+                       phpgwapi_jquery::formvalidator_generate(array('date', 
'security','file'));
                        $this->_insert_custom_js();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files', 'attributes_form'));
@@ -1521,11 +1540,11 @@
 
                        $values = phpgw::get_var('values');
                        $values['contact_id'] = phpgw::get_var('contact', 
'int', 'POST');
-                       $values['ecodimb'] = phpgw::get_var('ecodimb');
+//                     $values['ecodimb'] = phpgw::get_var('ecodimb');
                        $values['vendor_id'] = phpgw::get_var('vendor_id', 
'int', 'POST');
                        $values['vendor_name'] = phpgw::get_var('vendor_name', 
'string', 'POST');
-                       $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
-                       $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
+//                     $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
+//                     $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
 
                        $values_attribute = phpgw::get_var('values_attribute');
 
@@ -2458,6 +2477,186 @@
                                )
                        );
 
+
+                       // start invoice
+                       $invoices = array();
+                       $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+                               'order_id' => $id));
+                       $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array(
+                               'order_id' => $id,
+                               'paid' => true));
+                       $invoices = array_merge($active_invoices, 
$historical_invoices);
+
+
+                       $link_data_invoice1 = array
+                               (
+                               'menuaction' => 'property.uiinvoice.index',
+                               'user_lid' => 'all'
+                       );
+                       $link_data_invoice2 = array
+                               (
+                               'menuaction' => 'property.uiinvoice2.index'
+                       );
+
+                       $content_invoice = array();
+                       $amount = 0;
+                       $approved_amount = 0;
+                       foreach ($invoices as $entry)
+                       {
+                               $entry['voucher_id'] = $entry['transfer_time'] 
? -1 * $entry['voucher_id'] : $entry['voucher_id'];
+                               if ($entry['voucher_out_id'])
+                               {
+                                       $voucher_out_id = 
$entry['voucher_out_id'];
+                               }
+                               else
+                               {
+                                       $voucher_out_id = 
abs($entry['voucher_id']);
+                               }
+
+                               if 
($this->bo->config->config_data['invoicehandler'] == 2)
+                               {
+                                       if ($entry['voucher_id'] > 0)
+                                       {
+                                               
$link_data_invoice2['voucher_id'] = $entry['voucher_id'];
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice2);
+                                       }
+                                       else
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+                                               $link_data_invoice1['paid'] = 
'true';
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                               }
+                               else
+                               {
+                                       if ($entry['voucher_id'] > 0)
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = $entry['voucher_id'];
+                                               $link_data_invoice1['query'] = 
$entry['voucher_id'];
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                                       else
+                                       {
+                                               
$link_data_invoice1['voucher_id'] = abs($entry['voucher_id']);
+                                               $link_data_invoice1['paid'] = 
'true';
+                                               $url = 
$GLOBALS['phpgw']->link('/index.php', $link_data_invoice1);
+                                       }
+                               }
+                               $link_voucher_id = "<a href='" . $url . "'>" . 
$voucher_out_id . "</a>";
+
+                               $content_invoice[] = array
+                                       (
+                                       'voucher_id' => ($_lean) ? 
$entry['voucher_id'] : $link_voucher_id,
+                                       'voucher_out_id' => 
$entry['voucher_out_id'],
+                                       'status' => $entry['status'],
+                                       'period' => $entry['period'],
+                                       'periodization' => 
$entry['periodization'],
+                                       'periodization_start' => 
$entry['periodization_start'],
+                                       'invoice_id' => $entry['invoice_id'],
+                                       'budget_account' => 
$entry['budget_account'],
+                                       'dima' => $entry['dima'],
+                                       'dimb' => $entry['dimb'],
+                                       'dimd' => $entry['dimd'],
+                                       'type' => $entry['type'],
+                                       'amount' => $entry['amount'],
+                                       'approved_amount' => 
$entry['approved_amount'],
+                                       'vendor' => $entry['vendor'],
+                                       'external_project_id' => 
$entry['project_id'],
+                                       'currency' => $entry['currency'],
+                                       'budget_responsible' => 
$entry['budget_responsible'],
+                                       'budsjettsigndato' => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+                                       'transfer_time' => 
$entry['transfer_time'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
+                               );
+
+                               $amount += $entry['amount'];
+                               $approved_amount += $entry['approved_amount'];
+                       }
+
+                       $invoice_def = array
+                               (
+                               array(
+                                       'key' => 'voucher_id',
+                                       'label' => lang('bilagsnr'),
+                                       'sortable' => false,
+                                       'value_footer' => lang('Sum')),
+                               array(
+                                       'key' => 'voucher_out_id',
+                                       'hidden' => true),
+                               array(
+                                       'key' => 'invoice_id',
+                                       'label' => lang('invoice number'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'vendor',
+                                       'label' => lang('vendor'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'amount',
+                                       'label' => lang('amount'),
+                                       'sortable' => false,
+                                       'className' => 'right',
+                                       'value_footer' => 
number_format($amount, 2, $this->decimal_separator, '.')),
+                               array(
+                                       'key' => 'approved_amount',
+                                       'label' => lang('approved amount'),
+                                       'sortable' => false,
+                                       'className' => 'right',
+                                       'value_footer' => 
number_format($approved_amount, 2, $this->decimal_separator, '.')),
+                               array(
+                                       'key' => 'period',
+                                       'label' => lang('period'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'periodization',
+                                       'label' => lang('periodization'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'periodization_start',
+                                       'label' => lang('periodization start'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'currency',
+                                       'label' => lang('currency'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'type',
+                                       'label' => lang('type'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'budget_responsible',
+                                       'label' => lang('budget responsible'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'budsjettsigndato',
+                                       'label' => lang('budsjettsigndato'),
+                                       'sortable' => false),
+                               array(
+                                       'key' => 'transfer_time',
+                                       'label' => lang('transfer time'),
+                                       'sortable' => false)
+                       );
+
+                       $datatable_def[] = array
+                               (
+                               'container' => 'datatable-container_7',
+                               'requestUrl' => "''",
+                               'data' => json_encode($content_invoice),
+                               'ColumnDefs' => $invoice_def,
+                               'config' => array(
+                                       array(
+                                               'disableFilter' => true),
+                                       array(
+                                               'disablePagination' => true)
+                               )
+                       );
+
+
+
+                       // end invoice table
+
+                       
//----------------------------------------------datatable settings--------
+
+
                        $_filter_buildingpart = array();
                        $filter_buildingpart = 
isset($this->bo->config->config_data['filter_buildingpart']) ? 
$this->bo->config->config_data['filter_buildingpart'] : array();
 
@@ -2466,7 +2665,6 @@
                                $_filter_buildingpart = 
array("filter_{$filter_key}" => 1);
                        }
 
-                       
//----------------------------------------------datatable settings--------
 //_debug_array($supervisor_email);die();
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
                        $cat_select = 
$this->cats->formatted_xslt_list(array('select_name' => 'values[cat_id]',
@@ -2527,7 +2725,7 @@
                                $my_groups[$group_id] = $group->firstname;
                        }
 
-                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
+                       phpgwapi_jquery::formvalidator_generate(array('date', 
'security',
                                'file'));
 
                        $tabs = array();
@@ -2536,6 +2734,7 @@
                        $tabs['history'] = array('label' => lang('History'), 
'link' => '#history');
                        $active_tab = 'general';
 
+                       $unspsc_code = $ticket['unspsc_code'] ? 
$ticket['unspsc_code'] : 
$GLOBALS['phpgw_info']['user']['preferences']['property']['unspsc_code'];
                        $data = array
                                (
                                'datatable_def' => $datatable_def,
@@ -2551,6 +2750,12 @@
                                'vendor_data' => $vendor_data,
                                'b_account_data' => $b_account_data,
                                'ecodimb_data' => $ecodimb_data,
+                               'value_service_id' => $ticket['service_id'],
+                               'value_service_name' => 
$this->_get_eco_service_name($ticket['service_id']),
+                               'value_external_project_id' => 
$ticket['external_project_id'],
+                               'value_external_project_name' => 
$this->_get_external_project_name($ticket['external_project_id']),
+                               'value_unspsc_code' => $unspsc_code,
+                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($unspsc_code),
                                'value_budget' => $ticket['budget'],
                                'value_actual_cost' => $ticket['actual_cost'],
                                'year_list' => array('options' => 
$this->bocommon->select_list($ticket['actual_cost_year'] ? 
$ticket['actual_cost_year'] : date('Y'), $year_list)),
@@ -2587,6 +2792,7 @@
                                'lang_priority_statustext' => lang('Select the 
priority the selection belongs to.'),
                                'select_priority_name' => 'values[priority]',
                                'priority_list' => array('options' => 
$this->bo->get_priority_list($ticket['priority'])),
+                               'contract_list' => array('options' => 
$this->get_vendor_contract($ticket['vendor_id'], $ticket['contract_id']) ),
                                'lang_no_cat' => lang('no category'),
                                'value_cat_id' => $this->cat_id,
                                'cat_select' => $cat_select,
@@ -2632,14 +2838,21 @@
                                'order_dim1_list' => array('options' => 
$this->bocommon->select_category_list(array(
                                                'type' => 'order_dim1', 
'selected' => $ticket['order_dim1'], 'order' => 'id',
                                                'id_in_name' => 'num'))),
+                               'tax_code_list' => array('options' => 
$this->bocommon->select_category_list(array(
+                                               'type' => 'tax', 'selected' => 
$ticket['tax_code'], 'order' => 'id',
+                                               'id_in_name' => 'num'))),
                                'branch_list' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'] == 
1 ? array(
                                        'options' => 
execMethod('property.boproject.select_branch_list', $values['branch_id'])) : '',
                                'preview_html' => 
"javascript:preview_html($id)",
                                'preview_pdf' => "javascript:preview_pdf($id)",
-                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab)
+                               'tabs' => 
phpgwapi_jquery::tabview_generate($tabs, $active_tab),
+                               'value_order_sent'      => 
$ticket['order_sent'],
+                               'value_order_received'  => 
$ticket['order_received'] ? 
$GLOBALS['phpgw']->common->show_date($ticket['order_received']) : '[ DD/MM/YYYY 
- H:i ]',
+                               'value_order_received_percent' => (int) 
$ticket['order_received_percent']
                        );
 

@@ Diff output truncated at 153600 characters. @@



reply via email to

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