fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15901] Stable: Merge 15888:15900 from trunk


From: sigurdne
Subject: [Fmsystem-commits] [15901] Stable: Merge 15888:15900 from trunk
Date: Wed, 26 Oct 2016 08:54:04 +0000 (UTC)

Revision: 15901
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15901
Author:   sigurdne
Date:     2016-10-26 08:54:04 +0000 (Wed, 26 Oct 2016)
Log Message:
-----------
Stable: Merge 15888:15900 from trunk

Modified Paths:
--------------
    branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
    branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
    branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
    
branches/Version-2_0-branch/phpgwapi/js/jquery/file-upload/css/jquery.fileupload-custom.css
    branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-2_0-branch/property/inc/class.menu.inc.php
    branches/Version-2_0-branch/property/inc/class.soentity.inc.php
    branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
    branches/Version-2_0-branch/property/inc/class.uientity.inc.php
    branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php
    branches/Version-2_0-branch/property/inc/class.uiimport_components.inc.php
    branches/Version-2_0-branch/property/inc/class.uitts.inc.php
    
branches/Version-2_0-branch/property/inc/import/class.import_component_files.inc.php
    
branches/Version-2_0-branch/property/inc/import/class.import_components.inc.php
    
branches/Version-2_0-branch/property/inc/import/class.import_entity_categories.inc.php
    branches/Version-2_0-branch/property/js/portico/condition_survey_edit.js
    branches/Version-2_0-branch/property/js/portico/entity.edit.js
    branches/Version-2_0-branch/property/js/portico/import_components.js
    branches/Version-2_0-branch/property/js/portico/tts.view.js
    branches/Version-2_0-branch/property/templates/base/condition_survey.xsl
    branches/Version-2_0-branch/property/templates/base/entity.xsl
    branches/Version-2_0-branch/property/templates/base/files.xsl
    branches/Version-2_0-branch/property/templates/base/import_components.xsl
    branches/Version-2_0-branch/property/templates/base/lookup.entity.xsl
    branches/Version-2_0-branch/property/templates/base/tts.xsl
    branches/Version-2_0-branch/setup/config.php
    branches/Version-2_0-branch/setup/index.php

Added Paths:
-----------
    branches/Version-2_0-branch/property/inc/class.multiuploader.inc.php
    branches/Version-2_0-branch/property/templates/base/multi_upload_file.xsl

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


Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-15747
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887
   + /branches/dev-syncromind:13653
/branches/dev-syncromind-2:14933-15891
/branches/stavangerkommune:12743-12875,12986
/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900


Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind-2/booking:14933-15747
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849
   + /branches/dev-syncromind-2/booking:14933-15891
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900


Property changes on: branches/Version-2_0-branch/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind-2/bookingfrontend:14933-15747
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849
   + /branches/dev-syncromind-2/bookingfrontend:14933-15891
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php       
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.jquery.inc.php       
2016-10-26 08:54:04 UTC (rev 15901)
@@ -196,8 +196,9 @@
                                                
"file-upload/js/jquery.fileupload-jquery-ui",
                                        );
                                                
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/file-upload/css/jquery.fileupload.css");
+                                               
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/file-upload/css/jquery.fileupload-ui.css");
                                                
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/file-upload/css/jquery.fileupload-custom.css");
-                                               
$GLOBALS['phpgw']->css->add_external_file("phpgwapi/js/jquery/file-upload/css/jquery.fileupload-ui.css");
+                                               
                                        break;
                                
                                default:
@@ -485,6 +486,12 @@
                        $GLOBALS['phpgw']->js->add_code('', $js);
                }
                
+               public static function init_multi_upload_file()
+               {
+                       self::load_widget('file-upload');
+               }
+               
+               /*
                public static function form_file_upload_generate( $action )
                {
                        self::load_widget('file-upload');
@@ -611,6 +618,6 @@
                        $GLOBALS['phpgw']->js->add_code('', $js);
                        
                        return $output;
-               }
+               }*/
                
        }
\ No newline at end of file

Modified: branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php
===================================================================
--- branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/phpgwapi/inc/class.socommon.inc.php     
2016-10-26 08:54:04 UTC (rev 15901)
@@ -227,7 +227,7 @@
                        }
 
                        $base_sql = "SELECT $cols FROM $this->table_name $joins 
WHERE $condition $order ";
-                       if ($results)
+                       if ($results > -1)
                        {
                                $this->db->limit_query($base_sql, $start, 
__LINE__, __FILE__, $results);
                        }

Modified: branches/Version-2_0-branch/phpgwapi/js/jquery/common.js
===================================================================
--- branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-10-26 
08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/phpgwapi/js/jquery/common.js    2016-10-26 
08:54:04 UTC (rev 15901)
@@ -578,7 +578,8 @@
        {
                $.each(result.message, function (k, v)
                {
-                       document.getElementById('message' + n).innerHTML += 
v.msg + '<br/>';
+                       //document.getElementById('message' + n).innerHTML += 
v.msg + '<br/>';
+                       $('#message' + n).append(v.msg + "<br>");
                });
        }
 
@@ -586,7 +587,8 @@
        {
                $.each(result.error, function (k, v)
                {
-                       document.getElementById('message' + n).innerHTML += 
v.msg + '<br/>';
+                       //document.getElementById('message' + n).innerHTML += 
v.msg + '<br/>';
+                       $('#message' + n).append(v.msg + "<br>");
                });
        }
 };

Modified: 
branches/Version-2_0-branch/phpgwapi/js/jquery/file-upload/css/jquery.fileupload-custom.css
===================================================================
--- 
branches/Version-2_0-branch/phpgwapi/js/jquery/file-upload/css/jquery.fileupload-custom.css
 2016-10-26 08:43:38 UTC (rev 15900)
+++ 
branches/Version-2_0-branch/phpgwapi/js/jquery/file-upload/css/jquery.fileupload-custom.css
 2016-10-26 08:54:04 UTC (rev 15901)
@@ -28,7 +28,7 @@
 .template-upload .table-cell {
        display: table-cell;
        vertical-align: middle;
-       padding-right: 7px;
+       padding-right: 15px;
 }
 .template-upload .error {
        margin: 0px;
@@ -46,7 +46,7 @@
 .template-download .table-cell {
        display: table-cell;
        vertical-align: middle;
-    padding-right: 7px;
+    padding-right: 15px;
 }
 .template-download .error {
        margin: 0px;
@@ -98,4 +98,34 @@
     border: 1px solid #aaaaaa;
     color: #222222;
     font-weight: normal;
+}
+
+.content_upload_download {
+       position: relative; 
+       overflow: auto; 
+       max-height: 50vh; 
+       width: 100%;    
+}
+
address@hidden (max-width: 767px) {
+  .fileupload-buttonbar .toggle,
+  .files .toggle,
+  .files .btn span {
+    display:inline;
+  }
+  .files .name {
+    width: auto;
+    word-wrap: break-word;
+  }
+  .files audio,
+  .files video {
+    max-width: 80px;
+  }
+  .files img,
+  .files canvas {
+    max-width: 100%;
+  }
+  .content_upload_download {
+       max-height: 80vh; 
+  }
 }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.bolocation.inc.php   
2016-10-26 08:54:04 UTC (rev 15901)
@@ -816,6 +816,8 @@
                        {
                                $responsible_item = 
$soresponsible->get_active_responsible_at_location($location['location_code'], 
$data['role_id']);
                                $location['responsible_item'] = 
$responsible_item['id'];
+                               $location['responsible_contact'] = ''; 
//placeholder
+                               $location['responsible_contact_id'] = ''; 
//placeholder
                                if(isset($responsible_item['contact_id']))
                                {
                                        
if(isset($names[$responsible_item['contact_id']]))

Modified: branches/Version-2_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.menu.inc.php 2016-10-26 
08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.menu.inc.php 2016-10-26 
08:54:04 UTC (rev 15901)
@@ -53,11 +53,21 @@
                                $start_page = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_start_page'];
                        }
 
+                       $config = CreateObject('phpgwapi.config', 
'property')->read();
+                       if (!empty($config['app_name']))
+                       {
+                               $lang_app_name = $config['app_name'];
+                       }
+                       else
+                       {
+                               $lang_app_name = lang('property');
+                       }
+
                        $menus['navbar'] = array
                                (
                                'property' => array
                                        (
-                                       'text' => lang('property'),
+                                       'text' => $lang_app_name,
                                        'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
"property.ui{$start_page}.index")),
                                        'image' => array('property', 'navbar'),
                                        'order' => 35,
@@ -819,11 +829,7 @@
                                        }
                                }
 
-                               $config = CreateObject('phpgwapi.config', 
'property');
-                               $config->read();
-
-
-                               if 
(!isset($config->config_data['suppress_tenant']) || 
!$config->config_data['suppress_tenant'])
+                               if (!isset($config['suppress_tenant']) || 
!$config['suppress_tenant'])
                                {
                                        $children['tenant'] = array
                                                (
@@ -1019,7 +1025,7 @@
 
                        if ($acl->check('.invoice', PHPGW_ACL_READ, 'property'))
                        {
-                               $invoicehandler = 
isset($config->config_data['invoicehandler']) && 
$config->config_data['invoicehandler'] == 2 ? 'uiinvoice2' : 'uiinvoice';
+                               $invoicehandler = 
isset($config['invoicehandler']) && $config['invoicehandler'] == 2 ? 
'uiinvoice2' : 'uiinvoice';
                                $children = array();
                                $children_invoice = array();
                                if ($acl->check('.invoice', PHPGW_ACL_PRIVATE, 
'property'))
@@ -1312,7 +1318,9 @@
 
                                                if ($type != 'horisontal')
                                                {
-                                                       
$menus['navigation']["entity_{$entry['id']}"]['children'] = 
$entity->read_category_tree($entry['id'], 'property.uientity.index', 
PHPGW_ACL_READ);
+                                                       //bypass_acl_at_entity
+                                                       $_required = 
!empty($config['bypass_acl_at_entity']) && 
is_array($config['bypass_acl_at_entity']) && in_array($entry['id'], 
$config['bypass_acl_at_entity']) ? '' : PHPGW_ACL_READ ;
+                                                       
$menus['navigation']["entity_{$entry['id']}"]['children'] = 
$entity->read_category_tree($entry['id'], 'property.uientity.index', 
$_required);
                                                }
 
                                                $custom_menu_items = 
$custom_menus->read_tree(array('type' => 'custom_menu_items',

Copied: branches/Version-2_0-branch/property/inc/class.multiuploader.inc.php 
(from rev 15900, trunk/property/inc/class.multiuploader.inc.php)
===================================================================
--- branches/Version-2_0-branch/property/inc/class.multiuploader.inc.php        
                        (rev 0)
+++ branches/Version-2_0-branch/property/inc/class.multiuploader.inc.php        
2016-10-26 08:54:04 UTC (rev 15901)
@@ -0,0 +1,351 @@
+<?php
+       /**
+        * phpGroupWare - property: a Facilities Management System.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2003,2004,2005,2006,2007 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/bbb_/ekstern/
+        * @package property
+        * @subpackage location
+        * @version $Id$
+        */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       require_once PHPGW_SERVER_ROOT . 
"/property/inc/import/UploadHandler.php";
+
+       class property_multiuploader extends UploadHandler
+       {
+               
+               function __construct($options = null, $initialize = true, 
$error_messages = null)
+               {
+                       $this->bofiles = CreateObject('property.bofiles', 
'/property');
+                       
+                       parent::__construct($options, $initialize, 
$error_messages);
+               }
+               
+               public function add_file($print_response = true) 
+               {
+                       if ($this->get_query_param('_method') === 'DELETE') {
+                               return $this->delete_file($print_response);
+                       }
+                       $upload = 
$this->get_upload_data($this->options['param_name']);
+
+                       // Parse the Content-Disposition header, if available:
+                       $content_disposition_header = 
$this->get_server_var('HTTP_CONTENT_DISPOSITION');
+                       $file_name = $content_disposition_header ?
+                               rawurldecode(preg_replace(
+                                       '/(^[^"]+")|("$)/',
+                                       '',
+                                       $content_disposition_header
+                               )) : null;
+                       // Parse the Content-Range header, which has the 
following form:
+                       // Content-Range: bytes 0-524287/2000000
+                       $content_range_header = 
$this->get_server_var('HTTP_CONTENT_RANGE');
+                       $content_range = $content_range_header ?
+                               preg_split('/[^0-9]+/', $content_range_header) 
: null;
+                       $size =  $content_range ? $content_range[3] : null;
+                       $files = array();
+                       if ($upload) {
+                               if (is_array($upload['tmp_name'])) {
+                                       // param_name is an array identifier 
like "files[]",
+                                       // $upload is a multi-dimensional array:
+                                       foreach ($upload['tmp_name'] as $index 
=> $value) {
+                                               $files[] = 
$this->handle_file_upload_custom(
+                                                       
$upload['tmp_name'][$index],
+                                                       $file_name ? $file_name 
: $upload['name'][$index],
+                                                       $size ? $size : 
$upload['size'][$index],
+                                                       $upload['type'][$index],
+                                                       
$upload['error'][$index],
+                                                       $index,
+                                                       $content_range
+                                               );
+                                       }
+                               } else {
+                                       // param_name is a single object 
identifier like "file",
+                                       // $upload is a one-dimensional array:
+                                       $files[] = 
$this->handle_file_upload_custom(
+                                               isset($upload['tmp_name']) ? 
$upload['tmp_name'] : null,
+                                               $file_name ? $file_name : 
(isset($upload['name']) ?
+                                                               $upload['name'] 
: null),
+                                               $size ? $size : 
(isset($upload['size']) ?
+                                                               $upload['size'] 
: $this->get_server_var('CONTENT_LENGTH')),
+                                               isset($upload['type']) ?
+                                                               $upload['type'] 
: $this->get_server_var('CONTENT_TYPE'),
+                                               isset($upload['error']) ? 
$upload['error'] : null,
+                                               null,
+                                               $content_range
+                                       );
+                               }
+                       }
+                       $response = array($this->options['param_name'] => 
$files);
+                       return $this->generate_response($response, 
$print_response);
+               }
+       
+               protected function handle_file_upload_custom($uploaded_file, 
$name, $size, $type, $error,
+                               $index = null, $content_range = null) 
+               {
+                       $file = new \stdClass();
+                       $file->name = $this->get_file_name($uploaded_file, 
$name, $size, $type, $error,
+                               $index, $content_range);
+                       $file->size = $this->fix_integer_overflow((int)$size);
+                       $file->type = $type;
+
+                       if ($this->custom_validate($uploaded_file, $file, 
$error, $index)) 
+                       {
+                               $this->handle_form_data($file, $index);
+                               //$upload_dir = $this->get_upload_path();
+
+                               $file_path = 
$this->get_upload_path($file->name);
+                               $append_file = $content_range && 
is_file($file_path) &&
+                                       $file->size > 
$this->get_file_size($file_path);
+                               
+                               $this->upload_file($this->options['base_dir'], 
$uploaded_file, $file);
+                               if ($file->error) {
+                                       return $file;
+                               }
+                       
+                               $file_size = $this->get_file_size($file_path, 
$append_file);
+                               if ($file_size === $file->size) {
+                                       $file->url = 
$this->get_download_url($file->name);
+                                       if 
($this->is_valid_image_file($file_path)) {
+                                               
$this->handle_image_file($file_path, $file);
+                                       }
+                               } else {
+                                       $file->size = $file_size;
+                                       if (!$content_range && 
$this->options['discard_aborted_uploads']) {
+                                               unlink($file_path);
+                                               $file->error = 
$this->get_error_message('abort');
+                                       }
+                               }
+                               $this->set_additional_file_properties($file);
+                       }
+
+                       return $file;
+               }
+               
+               
+               public function custom_validate( $uploaded_file, $file, $error, 
$index)
+               {
+                       // Check post_max_size 
(http://us3.php.net/manual/en/features.file-upload.php#73762)
+                       $POST_MAX_SIZE = ini_get('post_max_size');
+                       $unit = strtoupper(substr($POST_MAX_SIZE, -1));
+                       $multiplier = ($unit == 'M' ? 1048576 : ($unit == 'K' ? 
1024 : ($unit == 'G' ? 1073741824 : 1)));
+
+                       if ((int)$_SERVER['CONTENT_LENGTH'] > $multiplier * 
(int)$POST_MAX_SIZE && $POST_MAX_SIZE)
+                       {
+                               $file->error = lang('POST exceeded maximum 
allowed size.');
+                               return false;                           
+                       }
+
+                       $max_file_size_in_bytes = 2147483647; // 2GB in bytes
+
+                       $config = CreateObject('phpgwapi.config', 'property');
+                       $config->read();
+                       $uploader_filetypes = 
isset($config->config_data['uploader_filetypes']) ? 
$config->config_data['uploader_filetypes'] : 'jpg,gif,png';
+
+                       //$extension_whitelist = array("jpg", "gif", "png");    
// Allowed file extensions
+                       $extension_whitelist = explode(',', 
$uploader_filetypes);
+
+                       $valid_chars_regex = '.A-Z0-9_ 
address@hidden&()+={}\[\]\',~`-'; // Characters allowed in the file name (in a 
Regular Expression format)
+                       // Other variables      
+                       $MAX_FILENAME_LENGTH = 260;
+                       $uploadErrors = array
+                               (
+                               0 => lang("There is no error, the file uploaded 
successfully"),
+                               1 => lang("The uploaded file exceeds the 
upload_max_filesize directive in php.ini"),
+                               2 => lang("The uploaded file exceeds the 
MAX_FILE_SIZE directive that was specified in the HTML form"),
+                               3 => lang("The uploaded file was only partially 
uploaded"),
+                               4 => lang("No file was uploaded"),
+                               6 => lang("Missing a temporary folder")
+                       );
+
+                       // Validate the upload
+                       if (!isset($uploaded_file))
+                       {
+                               $file->error = lang("No upload found");
+                               return false;   
+                       }
+                       else if (isset($error) && $error != 0)
+                       {
+                               $file->error = $uploadErrors[$error];
+                               return false;
+                       }
+                       else if (!isset($uploaded_file) || 
address@hidden($uploaded_file))
+                       {
+                               $file->error = lang("Upload failed 
is_uploaded_file test.");
+                               return false;
+                       }
+                       else if (!isset($file->name))
+                       {
+                               $file->error = lang("File has no name.");
+                               return false;
+                       }
+
+                       // Validate file extension
+                       $path_info = pathinfo($file->name);
+                       $file_extension = $path_info["extension"];
+                       $is_valid_extension = false;
+                       foreach ($extension_whitelist as $extension)
+                       {
+                               if (strcasecmp($file_extension, $extension) == 
0)
+                               {
+                                       $is_valid_extension = true;
+                                       break;
+                               }
+                       }
+                       
+                       if (!$is_valid_extension)
+                       {
+                               $file->error = lang("Invalid file extension");
+                               return false;
+                       }
+                       
+                       // Validate the file size (Warning: the largest files 
supported by this code is 2GB)
+                       $file_size = $file->size;
+                       if (!$file_size || $file_size > $max_file_size_in_bytes)
+                       {
+                               $file->error = lang("File exceeds the maximum 
allowed size");
+                               return false;
+                       }
+
+                       if ($file_size <= 0)
+                       {
+                               $file->error = lang("File size outside allowed 
lower bound");
+                               return false;
+                       }
+
+                       // Validate file name (for our purposes we'll just 
remove invalid characters)
+                       $file_name = preg_replace('/[^' . $valid_chars_regex . 
']|\.+$/i', "", basename($file->name));
+                       if (strlen($file_name) == 0 || strlen($file_name) > 
$MAX_FILENAME_LENGTH)
+                       {
+                               $file->error = lang("Invalid file name");
+                               return false;
+                       }
+                       
+                       return true;
+               }
+               
+
+               private function upload_file( $save_path, $uploaded_file, $file)
+               {                       
+                       $to_file = 
"{$this->bofiles->fakebase}/{$save_path}/{$file->name}";
+
+                       // Validate that we won't over-write an existing file
+                       if ($this->bofiles->vfs->file_exists(array(
+                                       'string' => $to_file,
+                                       'relatives' => Array(RELATIVE_NONE)
+                               )))
+                       {
+                               $file->error = lang('This file already exists 
!');
+                               return false;
+                       }
+
+                       $receipt = 
$this->bofiles->create_document_dir($save_path);
+                       if ($receipt['error'])
+                       {
+                               $file->error = $receipt['error'][0]['msg'];
+                               return false;
+                       }
+
+                       $this->bofiles->vfs->override_acl = 1;
+                       if ($this->bofiles->vfs->cp(array(
+                                       'from' => $uploaded_file,
+                                       'to' => 
"{$this->bofiles->fakebase}/{$save_path}/{$file->name}",
+                                       'relatives' => array(RELATIVE_NONE | 
VFS_REAL, RELATIVE_ALL))))
+                       {
+                               return true;
+                       }
+                       else
+                       {
+                               $file->error = lang('Failed to upload file !');
+                               return false;
+                       }
+
+                       $this->bofiles->vfs->override_acl = 0;
+               }
+               
+               public function delete_file($print_response = true) 
+               {
+                       $file_names = $this->get_file_names_params();
+                       if (empty($file_names)) {
+                               $file_names = 
array($this->get_file_name_param());
+                       }
+                       $response = array();
+                       foreach ($file_names as $file_name) 
+                       {
+                               $file_path = $this->get_upload_path($file_name);
+                               
+                               //$check_path = 
trim("{$this->fakebase}{$path}", "/");
+
+                               $file = 
"{$this->bofiles->fakebase}/{$this->options['base_dir']}/{$file_name}";
+
+                               /*if($check_path != 
trim($file_info['directory'], "/"))
+                               {
+                                       phpgwapi_cache::message_set( "deleting 
file from wrong location", 'error');
+                                       return false;
+                               }*/
+
+                               if ($this->bofiles->vfs->file_exists(array(
+                                               'string' => $file,
+                                               'relatives' => 
array(RELATIVE_NONE)
+                                       )))
+                               {
+                                       $this->bofiles->vfs->override_acl = 1;
+
+                                       if (!$this->bofiles->vfs->rm(array(
+                                                       'string' => $file,
+                                                       'relatives' => array(
+                                                               RELATIVE_NONE
+                                                       )
+                                               )))
+                                       {
+                                               
//phpgwapi_cache::message_set(lang('failed to delete file') . ' :' .$file, 
'error');
+                                               $success = false;
+                                       }
+                                       else
+                                       {
+                                               
//phpgwapi_cache::message_set(lang('file deleted') . ' :' . $file, 'message');
+                                               $success = true;
+                                       }
+                                       $this->bofiles->vfs->override_acl = 0;
+                               }
+                               
+                               //echo $file_path; die;
+                               //$success = is_file($file_path) && 
$file_name[0] !== '.' && unlink($file_path);
+                               if ($success) {
+                                       foreach 
($this->options['image_versions'] as $version => $options) {
+                                               if (!empty($version)) {
+                                                       $file = 
$this->get_upload_path($file_name, $version);
+                                                       if (is_file($file)) {
+                                                               unlink($file);
+                                                       }
+                                               }
+                                       }
+                               }
+                               $response[$file_name] = $success;
+                       }
+                       return $this->generate_response($response, 
$print_response);
+               }
+               
+       }
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.soentity.inc.php     
2016-10-26 08:54:04 UTC (rev 15901)
@@ -668,19 +668,35 @@
 
                        if ($query)
                        {
-                               $query = $this->db->db_addslashes($query);
+                               $query = 
html_entity_decode($this->db->db_addslashes($query));
                                $query = str_replace(",", '.', $query);
-                               $_int_query = (int)$query;
+                               $_int_query = 0;
+                               $query_parts = array();
+                               if(ctype_digit($query))
+                               {
+                                       $_int_query = (int)$query;
+                               }
                                if (stristr($query, '.'))
                                {
-                                       $query = explode(".", $query);
-                                       $_querymethod[] = 
"($entity_table.location_code $this->like '" . $query[0] . "%' AND 
$entity_table.location_code $this->like '%" . $query[1] . "')";
+                                       $query_parts = explode(".", $query);
                                }
+
+                               if(ctype_digit( $query_parts[0]) && 
!empty($query_parts[1]) && ctype_digit( $query_parts[1]))
+                               {
+                                       $_querymethod[] = 
"($entity_table.location_code $this->like '" . $query_parts[0] . "%' AND 
$entity_table.location_code $this->like '%" . $query_parts[1] . "')";
+                               }
                                else
                                {
                                        if (!$criteria_id)
                                        {
-                                               $_querymethod[] = "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id 
= {$_int_query} OR address {$this->like} '%{$query}%')";
+                                               if($_int_query)
+                                               {
+                                                       $_querymethod[] = "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id 
= {$_int_query} OR address {$this->like} '%{$query}%')";                    
+                                               }
+                                               else
+                                               {
+                                                       $_querymethod[] = "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR address 
{$this->like} '%{$query}%')";                                                   
                       
+                                               }
 //                                             $where= 'OR';
                                        }
                                        else
@@ -795,7 +811,7 @@
                                        }
                                }
                        }
-
+//_debug_array($_querymethod);
                        $sql = "SELECT fm_bim_item.* __XML-ORDER__ FROM 
fm_bim_item {$this->join} fm_bim_type ON (fm_bim_item.type = fm_bim_type.id)"
                                . " {$this->join} phpgw_accounts ON 
$entity_table.user_id = phpgw_accounts.account_id"
                                . " {$acl_group_join}";
@@ -837,8 +853,7 @@
                                        {
                                                if(!empty($attibute['choice']))
                                                {
-                                                       $_querymethod[] = 
"(json_representation->>'status' IS NULL OR CAST( 
json_representation->>'status' AS integer) < 90)";
-                                                       $__querymethod = 
array(); // remove block
+                                                       $_querymethod_status = 
"(json_representation->>'status' IS NULL OR CAST( 
json_representation->>'status' AS integer) < 90)";
                                                }
                                        }
                                }
@@ -898,10 +913,16 @@
                        $querymethod = '';
 
                        $_querymethod = array_merge($__querymethod, 
$_querymethod);
+//                     _debug_array($_querymethod);
                        if ($_querymethod)
                        {
                                $querymethod = " $where (" . implode(' OR ', 
$_querymethod) . ')';
                                unset($_querymethod);
+
+                               if($_querymethod_status)
+                               {
+                                       $querymethod .= " AND 
{$_querymethod_status}";
+                               }
                        }
 
 //                     $filtermethod .= "AND xmlexists('//location_code[text() 
= ''5002-02'']' PASSING BY REF xml_representation)";
@@ -1723,17 +1744,34 @@
                        if ($query)
                        {
                                $query = $this->db->db_addslashes($query);
+                               $_int_query = 0;
+                               $query_parts = array();
+                               if(ctype_digit($query))
+                               {
+                                       $_int_query = (int)$query;
+                               }
                                $query = str_replace(",", '.', $query);
                                if (stristr($query, '.'))
                                {
-                                       $query = explode(".", $query);
-                                       $_querymethod[] = 
"($entity_table.location_code $this->like '" . $query[0] . "%' AND 
$entity_table.location_code $this->like '%" . $query[1] . "')";
+                                       $query_parts = explode(".", $query);
                                }
+
+                               if(ctype_digit( $query_parts[0]) && 
!empty($query_parts[1]) && ctype_digit( $query_parts[1]))
+                               {
+                                       $_querymethod[] = 
"($entity_table.location_code $this->like '" . $query_parts[0] . "%' AND 
$entity_table.location_code $this->like '%" . $query_parts[1] . "')";
+                               }
                                else
                                {
                                        if (!$criteria_id)
                                        {
-                                               $_querymethod[] .= "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.num 
{$this->like} '%{$query}%' OR address {$this->like} '%{$query}%')";
+                                               if($_int_query)
+                                               {
+                                                       $_querymethod[] = "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR {$entity_table}.id 
= {$_int_query} OR address {$this->like} '%{$query}%')";
+                                               }
+                                               else
+                                               {
+                                                       $_querymethod[] = "( 
{$entity_table}.location_code {$this->like} '%{$query}%' OR address 
{$this->like} '%{$query}%')";
+                                               }
 //                                             $where= 'OR';
                                        }
                                        else

Modified: branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.soinvoice.inc.php    
2016-10-26 08:54:04 UTC (rev 15901)
@@ -607,10 +607,10 @@
                        }
 
                        $groupmethod = "GROUP BY 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,"
-                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start,external_voucher_id";
+                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start";
 
                        $sql = "SELECT DISTINCT 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,sum(belop) as belop, 
sum(godkjentbelop) as godkjentbelop,"
-                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start,external_voucher_id"
+                               . " 
currency,budsjettansvarligid,org_name,periode,periodization,periodization_start"
                                . " FROM {$table}{$join_project}"
                                . " {$this->join} fm_vendor ON 
{$table}.spvend_code = fm_vendor.id {$filtermethod} {$groupmethod}";
 
@@ -620,7 +620,8 @@
                        $values = array();
                        while ($this->db->next_record())
                        {
-                               $values[] = array(
+                               $values[] = array
+                                       (
                                        'workorder_id' => 
$this->db->f('pmwrkord_code'),
                                        'voucher_id' => 
$this->db->f('bilagsnr'),
                                        'voucher_out_id' => 
$this->db->f('bilagsnr_ut'),
@@ -632,8 +633,7 @@
                                        'period' => $this->db->f('periode'),
                                        'periodization' => 
$this->db->f('periodization'),
                                        'periodization_start' => 
$this->db->f('periodization_start'),
-                                       'budget_responsible' => 
$this->db->f('budsjettansvarligid'),
-                                       'external_voucher_id' => 
$this->db->f('external_voucher_id'),
+                                       'budget_responsible' => 
$this->db->f('budsjettansvarligid')
                                );
                        }
 

Modified: 
branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php   
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.uicondition_survey.inc.php   
2016-10-26 08:54:04 UTC (rev 15901)
@@ -53,7 +53,9 @@
                        'view_file' => true,
                        'import' => true,
                        'download' => true,
-                       'summation' => true
+                       'summation' => true,
+                       'handle_multi_upload_file' => true,
+                       'build_multi_upload_file' => true
                );
 
                public function __construct()
@@ -100,6 +102,66 @@
                        $this->bocommon->download($values, $columns, $descr);
                }
 
+               public function handle_multi_upload_file()
+               {
+                       $id = phpgw::get_var('id');
+                       
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', 
+                                       array('menuaction' => 
'property.uicondition_survey.handle_multi_upload_file', 'id' => $id));
+                       
+                       phpgw::import_class('property.multiuploader');
+       
+
+                       $options['base_dir'] = "condition_survey/{$id}";
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/property/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode($multi_upload_action);
+                       $upload_handler = new property_multiuploader($options, 
false);
+                       
+                       switch ($_SERVER['REQUEST_METHOD']) {
+                               case 'OPTIONS':
+                               case 'HEAD':
+                                       $upload_handler->head();
+                                       break;
+                               case 'GET':
+                                       $upload_handler->get();
+                                       break;
+                               case 'PATCH':
+                               case 'PUT':
+                               case 'POST':
+                                       $upload_handler->add_file();
+                                       break;
+                               case 'DELETE':
+                                       $upload_handler->delete_file();
+                                       break;
+                               default:
+                                       $upload_handler->header('HTTP/1.1 405 
Method Not Allowed');
+                       }
+               
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               
+               public function build_multi_upload_file()
+               {
+                       phpgwapi_jquery::init_multi_upload_file();
+                       
+                       $id = phpgw::get_var('id');
+                       
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', 
+                                       array('menuaction' => 
'property.uicondition_survey.handle_multi_upload_file', 'id' => $id));
+
+                       $data = array
+                               (
+                               'multi_upload_action' => $multi_upload_action   
                                
+                       );
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('files', 
'multi_upload_file'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('multi_upload' => $data));
+               }
+               
                /**
                 * Prepare UI
                 * @return void
@@ -540,6 +602,7 @@
                                self::add_javascript('property', 'portico', 
'condition_survey_edit.js');
                                
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
                                        'file'));
+                               $data['multi_upload_parans'] = 
"{menuaction:'property.uicondition_survey.build_multi_upload_file', 
id:'{$id}'}";                        
                        }
 
                        phpgwapi_jquery::load_widget('numberformat');
@@ -548,7 +611,7 @@
                        self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
 
-                       self::render_template_xsl(array('condition_survey', 
'datatable_inline'), $data);
+                       self::render_template_xsl(array('condition_survey', 
'files', 'datatable_inline'), $data);
                }
 
                /**

Modified: branches/Version-2_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uientity.inc.php     
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.uientity.inc.php     
2016-10-26 08:54:04 UTC (rev 15901)
@@ -63,7 +63,7 @@
                        'attrib_help' => true,
                        'print_pdf' => true,
                        'index' => true,
-                       'addfiles' => true,
+                       //'addfiles' => true,
                        'get_documents' => true,
                        'get_files' => true,
                        'get_target' => true,
@@ -76,7 +76,9 @@
                        'get_assigned_history' => true,
                        'get_cases' => true,
                        'get_checklists'=>true,
-                       'get_cases_for_checklist' => true
+                       'get_cases_for_checklist' => true,
+                       'handle_multi_upload_file' => true,
+                       'build_multi_upload_file' => true
                );
 
                function __construct()
@@ -119,7 +121,17 @@
                        {
                                $this->acl_location .= ".{$this->cat_id}";
                        }
-                       $this->acl_read = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 
$this->type_app[$this->type]);
+                       $config = CreateObject('phpgwapi.config', 
'property')->read();
+
+                       if(!empty($config['bypass_acl_at_entity']) && 
is_array($config['bypass_acl_at_entity']) && in_array($this->entity_id, 
$config['bypass_acl_at_entity']))
+                       {
+                               $this->acl_read = true;
+                       }
+                       else
+                       {
+                               $this->acl_read = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 
$this->type_app[$this->type]);
+                       }
+
                        $this->acl_add = $this->acl->check($this->acl_location, 
PHPGW_ACL_ADD, $this->type_app[$this->type]);
                        $this->acl_edit = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 
$this->type_app[$this->type]);
                        $this->acl_delete = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 
$this->type_app[$this->type]);
@@ -360,6 +372,87 @@
                        unset($file);
                }
 
+               public function handle_multi_upload_file()
+               {
+                       $id = phpgw::get_var('id');
+                       $entity_id = phpgw::get_var('entity_id');
+                       $cat_id = phpgw::get_var('cat_id');
+                       $type = phpgw::get_var('type');
+                       
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', 
+                                       array('menuaction' => 
'property.uientity.handle_multi_upload_file', 
+                                                               'id' => $id,
+                                                               'entity_id' => 
$entity_id,
+                                                               'cat_id' => 
$cat_id,
+                                                               'type' => 
$type));
+                       
+                       phpgw::import_class('property.multiuploader');
+                       
+                       $values = $this->bo->read_single(array('entity_id' => 
$entity_id, 'cat_id' => $cat_id,
+                               'id' => $id));
+
+                       $loc1 = isset($values['location_data']['loc1']) && 
$values['location_data']['loc1'] ? $values['location_data']['loc1'] : 'dummy';
+                       if ($this->type_app[$this->type] == 'catch')
+                       {
+                               $loc1 = 'dummy';
+                       }
+
+                       $options['base_dir'] = 
"{$this->category_dir}/{$loc1}/{$id}";
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/property/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode($multi_upload_action);
+                       $upload_handler = new property_multiuploader($options, 
false);
+                       
+                       switch ($_SERVER['REQUEST_METHOD']) {
+                               case 'OPTIONS':
+                               case 'HEAD':
+                                       $upload_handler->head();
+                                       break;
+                               case 'GET':
+                                       $upload_handler->get();
+                                       break;
+                               case 'PATCH':
+                               case 'PUT':
+                               case 'POST':
+                                       $upload_handler->add_file();
+                                       break;
+                               case 'DELETE':
+                                       $upload_handler->delete_file();
+                                       break;
+                               default:
+                                       $upload_handler->header('HTTP/1.1 405 
Method Not Allowed');
+                       }
+               
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               
+               public function build_multi_upload_file()
+               {
+                       phpgwapi_jquery::init_multi_upload_file();
+                       
+                       $id = phpgw::get_var('id');
+                       $entity_id = phpgw::get_var('_entity_id');
+                       $cat_id = phpgw::get_var('_cat_id');
+                       $type = phpgw::get_var('_type');
+                       
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', 
+                                       array('menuaction' => 
'property.uientity.handle_multi_upload_file', 
+                                                               'id' => $id,
+                                                               'entity_id' => 
$entity_id,
+                                                               'cat_id' => 
$cat_id,
+                                                               'type' => 
$type));
+
+                       $data = array
+                               (
+                               'multi_upload_action' => $multi_upload_action   
                                
+                       );
+       
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('files', 
'multi_upload_file'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('multi_upload' => $data));
+               }
+               
                private function _get_filters( $selected = 0 )
                {
                        $values_combo_box = array();
@@ -784,6 +877,7 @@
                        $this->bocommon->download($list, $uicols['name'], 
$uicols['descr'], $uicols['input_type']);
                }
 
+               /*
                function addfiles()
                {
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
@@ -830,7 +924,7 @@
                        }
 
                        
$fileuploader->upload("{$this->category_dir}/{$loc1}/{$id}");
-               }
+               }*/
 
                /**
                 * Function to get related via Ajax-call
@@ -1163,8 +1257,9 @@
                        //redirect if no rights
                        if (!$this->acl_read && $this->cat_id)
                        {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
-                                       'perm' => 1, 'acl_location' => 
$this->acl_location));
+                               phpgw::no_access('property', lang('No access') 
.' :: '. $this->acl_location);
+//                             $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
+//                                     'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
                        $default_district = 
(isset($GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'])
 ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['default_district'] : 
'');
@@ -2411,11 +2506,16 @@
                                'files' => isset($values['files']) ? 
$values['files'] : '',
                                //              'jasperfiles'                   
                => isset($values['jasperfiles'])?$values['jasperfiles']:'',
                                'multiple_uploader' => $id ? true : '',
-                               'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',"
+                               /*'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',"
                                . "upload_target:'property.uientity.addfiles',"
                                . "id:'{$id}',"
                                . "_entity_id:'{$this->entity_id}',"
                                . "_cat_id:'{$this->cat_id}',"
+                               . "_type:'{$this->type}'}",*/
+                               'multi_upload_parans' => 
"{menuaction:'property.uientity.build_multi_upload_file',"
+                               . "id:'{$id}',"
+                               . "_entity_id:'{$this->entity_id}',"
+                               . "_cat_id:'{$this->cat_id}',"
                                . "_type:'{$this->type}'}",
                                'value_origin' => isset($values['origin_data']) 
? $values['origin_data'] : '',
                                'value_origin_type' => isset($origin) ? $origin 
: '',

Modified: 
branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php   
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.uigeneric_document.inc.php   
2016-10-26 08:54:04 UTC (rev 15901)
@@ -466,8 +466,8 @@
                                
                                $related_def2 = array
                                        (
-                                       array('key' => 'location_code', 'label' 
=> lang('location'), 'sortable' => false, 'resizeable' => true),
-                                       array('key' => 'loc1_name', 'label' => 
lang('name'), 'sortable' => false, 'resizeable' => true),
+                                       array('key' => 'location_code', 'label' 
=> lang('location'), 'sortable' => true, 'resizeable' => true),
+                                       array('key' => 'loc1_name', 'label' => 
lang('name'), 'sortable' => true, 'resizeable' => true),
                                        //array('key' => 'location_id', 'label' 
=> lang('location id'), 'sortable' => false, 'resizeable' => true, 'hidden' => 
true),
                                        array('key' => 'relate', 'label' => 
lang('related'), 'sortable' => false, 'resizeable' => true),
                                );

Modified: 
branches/Version-2_0-branch/property/inc/class.uiimport_components.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uiimport_components.inc.php  
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.uiimport_components.inc.php  
2016-10-26 08:54:04 UTC (rev 15901)
@@ -52,6 +52,7 @@
                        'handle_import_files' => true,
                        'import_components' => true,
                        'get_attributes_from_template' => true,
+                       'get_profile' => true,
                        'download' => true
                );
 
@@ -64,13 +65,17 @@
                        $this->bo = CreateObject('property.boadmin_entity', 
true);
                        $this->acl = & $GLOBALS['phpgw']->acl;
                        $this->db = & $GLOBALS['phpgw']->db;
+                       $this->config = createObject('phpgwapi.config', 
'component_import');
+                       $this->config_repository = 
$this->config->read_repository();
                }
 
                public function download()
                {
-                       $config = createObject('phpgwapi.config', 
'component_import');
-                       $values = $config->read_repository();
-                       $components = $values['preview_components'];
+                       /*$config = createObject('phpgwapi.config', 
'component_import');
+                       $values = $config->read_repository();*/
+                       //$components = 
$this->config_repository['preview_components'];
+                       $components = phpgwapi_cache::session_get('property', 
'preview_components');
+                       $components = ($components) ? unserialize($components) 
: array();
                        
                        $fields = array_keys($components[0]);
 
@@ -115,11 +120,15 @@
                }
                
                public function import_component_files()
-               {
-                       $location_code = 
phpgwapi_cache::session_get('property', 'location_code');
+               {               
+                       /*$location_code = 
phpgwapi_cache::session_get('property', 'location_code');
                        $id = phpgwapi_cache::session_get('property', 
'location_item_id');
-                       $attrib_name_componentID = 
phpgwapi_cache::session_get('property', 'attrib_name_componentID');
+                       $attrib_name_componentID = 
phpgwapi_cache::session_get('property', 'attrib_name_componentID');*/
                        
+                       $location_code = phpgw::get_var('location_code');
+                       $id = phpgw::get_var('location_item_id');
+                       $attrib_name_componentID = 
phpgw::get_var('attribute_name_component_id');
+                       
                        if (!$attrib_name_componentID)
                        {
                                $receipt['error'][] = array('msg' => 
lang('Choose attribute name for Component ID'));
@@ -188,11 +197,11 @@
                        {
                                return false;
                        }
-                       require_once PHPGW_SERVER_ROOT . 
"/property/inc/import/UploadHandler.php";
+                       phpgw::import_class('property.multiuploader');
                        
                        $options['upload_dir'] = $path_upload_dir;
                        $options['script_url'] = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiimport_components.handle_import_files'));
-                       $upload_handler = new UploadHandler($options);
+                       $upload_handler = new property_multiuploader($options);
                }
 
                private function _get_components_cached_file ()
@@ -300,8 +309,21 @@
                        return $html_table;             
                }
                
+               private function _get_default_options() 
+               {
+                       return  array (
+                               '' => ' ... ',
+                               'new_column' => lang('New attribute'),
+                               'building_part' => lang('Building Part'),
+                               'name_building_part' => lang('Name of the 
Building Part'),
+                               'component_id'    => lang('Component ID')
+                       );
+               }
+               
                private function _build_columns()
                {
+                       $cod_profile = phpgw::get_var('cod_profile');
+                       
                        $cached_file = $this->_get_components_cached_file();
                        if (!$cached_file)
                        {
@@ -317,16 +339,17 @@
                        $highestColumm = 
$objPHPExcel->getActiveSheet()->getHighestDataColumn();
                        $highestColumnIndex = 
PHPExcel_Cell::columnIndexFromString($highestColumm);     
 
+                       $profile = array();
+                       
+                       if ($cod_profile)
+                       {
+                               $profiles = 
$this->config_repository['profiles'];
+                               $profile = $profiles[$cod_profile]['content'];
+                       }
+
                        $html_table = '<table class="pure-table 
pure-table-bordered">';
 
-                       $_options = array
-                       (
-                               '' => ' ... ',
-                               'new_column' => 'New attribute',
-                               'building_part' => '-- Building Part',
-                               'name_building_part' => '-- Name of the 
Building Part',
-                               'component_id'    => '-- Component ID'
-                       );
+                       $_options = $this->_get_default_options();
 
                        $template = explode("_", $template_id);
 
@@ -348,8 +371,7 @@
                        {
                                $_column = $this->_getexcelcolumnname($j);
                                $_value = 
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($j, 
$start_line)->getCalculatedValue();
-                               //$selected = isset($columns[$_column]) && 
$columns[$_column] ? $columns[$_column] : '';
-                               $selected = '';
+                               $selected = 
isset($profile['columns']['columns'][$_column]) && 
$profile['columns']['columns'][$_column] ? 
$profile['columns']['columns'][$_column] : '';
 
                                $_listbox = 
$this->_getArrayItem("column_{$_column}", "columns[{$_column}]", $selected, 
$_options, true, "onchange=\"enabledAtributes('{$_column}')\" class='columns'");
                                $_listTypes = 
$this->_getArrayItem("data_type_{$_column}", "data_types[{$_column}]", 
$selected, $_options_data_type, true, "disabled class='data_types'");
@@ -367,6 +389,51 @@
                        return $html_table;     
                }
                
+               private function _prepare_profile ()
+               {
+                       $columns = (array) phpgw::get_var('columns');
+                       
+                       $template_id = phpgwapi_cache::session_get('property', 
'template_id');
+                       $attrib_name_componentID = 
phpgwapi_cache::session_get('property', 'attrib_name_componentID');
+                       
+                       $template = explode("_", $template_id);
+                       $entity_id = $template[0];
+                       $cat_id = $template[1];
+                       $attributes = 
$this->custom->find($this->type_app[$this->type], 
".{$this->type}.{$entity_id}.{$cat_id}", 0, '', 'ASC', 'attrib_sort', true, 
true);
+                       
+                       $_options = $this->_get_default_options();
+                       foreach ($attributes as $attribute)
+                       {
+                               if ($attrib_name_componentID == 
$attribute['column_name'])
+                               {
+                                       $attrib_name_componentID_Text = 
$attribute['input_text'];
+                               }
+                               $_options[$attribute['column_name']] = 
$attribute['input_text'];
+                       }
+                       
+                       $columns_name = array();
+                       foreach ($columns as $k => $v)
+                       {
+                               if ($v == 'new_column')
+                               {
+                                       unset($columns[$k]);
+                                       continue;
+                               }
+                               $columns_name[] = $k .' => '.$_options[$v];
+                       }
+                       
+                       $entity_info = $this->bo->read_single($entity_id);
+                       $category_info = 
$this->bo->read_single_category($entity_id, $cat_id);
+                       $template_name = 
"{$entity_info['name']}::{$category_info['name']}";
+                       
+                       $profile['columns'] = array('columns' => $columns, 
'columns_name' => $columns_name);
+                       $profile['template'] = array('template_id' => 
$template_id, 'template_name' => $template_name);
+                       $profile['attrib_name_componentID'] = array('id' => 
$attrib_name_componentID, 'text' => $attrib_name_componentID_Text);
+                       phpgwapi_cache::session_set('property', 'profile', 
serialize($profile));                
+                       
+                       return $profile;
+               }
+               
                private function _prepare_values_to_preview()
                {
                        $columns = (array) phpgw::get_var('columns');
@@ -480,38 +547,54 @@
                        
                        $preview_components = 
$import_components->prepare_preview_components($import_data);
 
-                       $config = createObject('phpgwapi.config', 
'component_import');
+                       //$config = createObject('phpgwapi.config', 
'component_import');
 
                        if (count($new_attribs_for_template))
                        {
-                               $config->value('new_attribs_for_template', 
serialize($new_attribs_for_template));
+                               
//$this->config->value('new_attribs_for_template', 
serialize($new_attribs_for_template));
+                               phpgwapi_cache::session_set('property', 
'new_attribs_for_template', serialize($new_attribs_for_template));
                                foreach($new_attribs_for_template as $attrib)
                                {
                                        $values[] = $attrib['column_name'];
                                }
                                $result['new_attribs_for_template'] = $values;
                        } else {
+                               phpgwapi_cache::session_set('property', 
'new_attribs_for_template', '');
                                $result['new_attribs_for_template'][] = 
lang('Not exist attributes to insert the template');
                        }
 
                        if (count($new_entity_categories))
                        {
-                               $config->value('new_entity_categories', 
serialize($new_entity_categories));
+                               //$this->config->value('new_entity_categories', 
serialize($new_entity_categories));
+                               phpgwapi_cache::session_set('property', 
'new_entity_categories', serialize($new_entity_categories));
                                $result['new_entity_categories'] = 
array_values($new_entity_categories);
                        } else {
+                               phpgwapi_cache::session_set('property', 
'new_entity_categories', '');
                                $result['new_entity_categories'][] = lang('Not 
exist new entity categories');
                        }
+                       
+                       $profile = $this->_prepare_profile();
+                       $result['profile'] = $profile;
 
-                       $config->value('building_part_in_table', 
serialize($building_part_in_table));
-                       $config->value('preview_components', 
serialize($preview_components));
-                       $config->value('new_components', 
serialize($import_data));
-                       $config->save_repository();
+                       /*$this->config->value('building_part_in_table', 
serialize($building_part_in_table));
+                       $this->config->value('preview_components', 
serialize($preview_components));
+                       $this->config->value('new_components', 
serialize($import_data));
+                       $this->config->save_repository();*/
+                       
+                       phpgwapi_cache::session_set('property', 
'building_part_in_table', serialize($building_part_in_table));
+                       phpgwapi_cache::session_set('property', 
'preview_components', serialize($preview_components));
+                       phpgwapi_cache::session_set('property', 
'new_components', serialize($import_data));
 
                        return $result;
                }
                
                private function _save_values_import()
                {                       
+                       $name_profile = phpgw::get_var('name_profile', 
'REQUEST');
+                       $cod_profile = phpgw::get_var('cod_profile', 'REQUEST');
+                       $profile_option_save = 
phpgw::get_var('profile_option_save', 'int', 'REQUEST');
+                       $save_profile = phpgw::get_var('save_profile', 'int', 
'REQUEST');
+                       
                        $template_id = phpgwapi_cache::session_get('property', 
'template_id');
                        $attrib_name_componentID = 
phpgwapi_cache::session_get('property', 'attrib_name_componentID');
                        $location_code = 
phpgwapi_cache::session_get('property', 'location_code');
@@ -533,9 +616,11 @@
                                return;
                        }
 
-                       $config = createObject('phpgwapi.config', 
'component_import');
-                       $config_repository = $config->read_repository();
-                       $import_data = $config_repository['new_components'];
+                       /*$config = createObject('phpgwapi.config', 
'component_import');
+                       $config_repository = $config->read_repository();*/
+                       //$import_data = 
$this->config_repository['new_components'];
+                       $import_data = phpgwapi_cache::session_get('property', 
'new_components');
+                       $import_data = ($import_data) ? 
unserialize($import_data) : array();
                        
                        if (!count($import_data))
                        {
@@ -564,7 +649,28 @@
 
                        $receipt = 
$import_components->add_components($import_data, $location_code, 
$attrib_name_componentID);
                        $this->receipt = $this->_msg_data($receipt);
+                       
+                       if ($save_profile)
+                       {
+                               $profiles = 
$this->config_repository['profiles'];
+                               
+                               if ($profile_option_save == 1)
+                               {
+                                       $cod_profile = str_replace(' ', '_',  
mb_strtolower($name_profile, 'UTF-8'));
+                                       $profiles[$cod_profile]['name'] = 
$name_profile;
+                               }
+                               
+                               if ($cod_profile)
+                               {                               
+                                       $content = 
phpgwapi_cache::session_get('property', 'profile');
+                                       $content = ($content) ? 
unserialize($content) : array();
+                                       $profiles[$cod_profile]['content'] = 
$content;
 
+                                       $this->config->value('profiles', 
serialize($profiles));
+                                       $this->config->save_repository();
+                               }
+                       }                       
+                       
                        return $this->receipt;
                }
                
@@ -657,8 +763,8 @@
                {
                        $tabs = array();
                        $tabs['locations'] = array('label' => 
lang('Locations'), 'link' => '#locations');
+                       $tabs['components'] = array('label' => 
lang('Components'), 'link' => '#components', 'disable' => 1);
                        $tabs['files'] = array('label' => lang('Files'), 'link' 
=> '#files', 'disable' => 0);
-                       $tabs['components'] = array('label' => 
lang('Components'), 'link' => '#components', 'disable' => 1);
                        $tabs['relations'] = array('label' => 
lang('Relations'), 'link' => '#relations', 'disable' => 1);
                                        
                        $active_tab = 'locations';
@@ -673,8 +779,8 @@
 
                        $related_def = array
                                (
-                               array('key' => 'location_code', 'label' => 
lang('location'), 'sortable' => false, 'resizeable' => true),
-                               array('key' => 'loc1_name', 'label' => 
lang('name'), 'sortable' => false, 'resizeable' => true)
+                               array('key' => 'location_code', 'label' => 
lang('location'), 'sortable' => true, 'resizeable' => true),
+                               array('key' => 'loc1_name', 'label' => 
lang('name'), 'sortable' => true, 'resizeable' => true)
                        );
 
 
@@ -689,6 +795,15 @@
                                )                               
                        );      
                                
+                       $profile_list = array();
+                       $profiles = $this->config_repository['profiles'];
+                       foreach($profiles as $k => $v)
+                       {
+                               $profile_list[] = array('id'=> $k, 
'name'=>$v['name']);
+                       }
+                       array_unshift($profile_list, array('id' => '', 'name' 
=> lang('choose profile')));
+                       
+                       //$profile = $this->config_repository['profile'];
                        $entity_list = $this->bo->read(array('allrows' => 
true));
                        $category_list = array();
                        foreach ($entity_list as $entry)
@@ -697,6 +812,7 @@
 
                                foreach ($cat_list as $category)
                                {
+                                       //$selected = 
($profile['template']['template_id'] == "{$entry['id']}_{$category['id']}") ? 1 
:0;
                                        $category_list[] = array
                                                (
                                                'id' => 
"{$entry['id']}_{$category['id']}",
@@ -705,7 +821,7 @@
                                }
                        }
                
-                       $form_upload_action = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiimport_components.handle_import_files'));
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiimport_components.handle_import_files'));
                        
                        $access_error_upload_dir = '';
                        $import_component_files = new import_component_files();
@@ -716,6 +832,7 @@
                        } else {
                                phpgwapi_cache::session_set('property', 
'path_upload_dir', $import_component_files->get_path_upload_dir());
                        }
+                       phpgwapi_jquery::init_multi_upload_file();
                        
                        $data = array
                        (
@@ -727,7 +844,8 @@
                                'district_filter' => array('options' => 
$district_filter),
                                'part_of_town_filter' => array('options' => 
$part_of_town_filter),
                                'template_list' => array('options' => 
$category_list),
-                               'form_file_upload' => 
phpgwapi_jquery::form_file_upload_generate($form_upload_action),
+                               'profile_list' => array('options' => 
$profile_list),
+                               'multi_upload_action' => $multi_upload_action,
                                'access_error_upload_dir' => 
$access_error_upload_dir,
                                'image_loader' => 
$GLOBALS['phpgw']->common->image('property', 'ajax-loader', '.gif', false)
                        );
@@ -735,11 +853,13 @@
                        self::add_javascript('property', 'portico', 
'import_components.js');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('Importer ');
 
-                       self::render_template_xsl(array('import_components', 
'datatable_inline'), $data);
+                       self::render_template_xsl(array('import_components', 
'multi_upload_file', 'datatable_inline'), $data);
                }
 
                public function get_attributes_from_template()
                {
+                       //$profile = $this->config_repository['profile'];
+                       
                        $category_template = 
phpgw::get_var('category_template');
 
                        $template_info = explode('_', $category_template);
@@ -750,6 +870,7 @@
                        $list = array();
                        foreach ($attrib_list as $attrib)
                        {
+                               //$selected = 
($profile['attrib_name_componentID']['id'] == $attrib['column_name']) ? 1 : 0;
                                $list[] = array('id' => $attrib['column_name'], 
'name' => $attrib['input_text']); 
                        }
                        
@@ -836,6 +957,19 @@
                        return $categories;
                }
                
+               public function get_profile()
+               {
+                       $cod_profile = phpgw::get_var('cod_profile', 'REQUEST');
+
+                       $profiles = $this->config_repository['profiles'];
+                       $content = $profiles[$cod_profile]['content'];
+                       
+                       $template_id = ($content['template']['template_id']);
+                       $attrib_name_componentID = 
$content['attrib_name_componentID']['id'];
+
+                       return array('template_id'=>$template_id, 
'attrib_name_componentID'=>$attrib_name_componentID);
+               }
+               
                public function get_data_type()
                {
                        $values = $this->bocommon->select_datatype();

Modified: branches/Version-2_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/inc/class.uitts.inc.php        
2016-10-26 08:54:04 UTC (rev 15901)
@@ -57,7 +57,9 @@
                        'get_unspsc_code'=> true,
                        'receive_order' => true,
                        'check_purchase_right'=> true,
-                       'show_attachment'       => true
+                       'show_attachment'       => true,
+                       'handle_multi_upload_file' => true,
+                       'build_multi_upload_file' => true
                );
 
                /**
@@ -256,7 +258,7 @@
                                $browser->content_header($document['name'], '', 
$size);
                                echo $content;
                        }
-       
+
                }
 
                function download2()
@@ -493,6 +495,59 @@
                        }
                }
 
+               public function handle_multi_upload_file()
+               {
+                       $id = phpgw::get_var('id');
+                       
+                       phpgw::import_class('property.multiuploader');
+                       
+                       $options['base_dir'] = 'fmticket/'.$id;
+                       $options['upload_dir'] = 
$GLOBALS['phpgw_info']['server']['files_dir'].'/property/'.$options['base_dir'].'/';
+                       $options['script_url'] = 
html_entity_decode(self::link(array('menuaction' => 
'property.uitts.handle_multi_upload_file', 'id' => $id)));
+                       $upload_handler = new property_multiuploader($options, 
false);
+                       
+                       switch ($_SERVER['REQUEST_METHOD']) {
+                               case 'OPTIONS':
+                               case 'HEAD':
+                                       $upload_handler->head();
+                                       break;
+                               case 'GET':
+                                       $upload_handler->get();
+                                       break;
+                               case 'PATCH':
+                               case 'PUT':
+                               case 'POST':
+                                       $upload_handler->add_file();
+                                       break;
+                               case 'DELETE':
+                                       $upload_handler->delete_file();
+                                       break;
+                               default:
+                                       $upload_handler->header('HTTP/1.1 405 
Method Not Allowed');
+                       }
+               
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+               
+               public function build_multi_upload_file()
+               {
+                       phpgwapi_jquery::init_multi_upload_file();
+                       $id = phpgw::get_var('id', 'int');
+                       
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       
+                       $multi_upload_action = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uitts.handle_multi_upload_file', 'id' => $id));
+
+                       $data = array
+                               (
+                               'multi_upload_action' => $multi_upload_action   
                                
+                       );
+       
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('files', 
'multi_upload_file'));
+                       $GLOBALS['phpgw']->xslttpl->set_var('phpgw', 
array('multi_upload' => $data));
+               }
+               
                function columns()
                {
                        $receipt = array();
@@ -672,7 +727,7 @@
                                        )
                                )
                        );
-               
+
                        if($order_read)
                        {
                                $check_date_type['list'][] = array(
@@ -1146,7 +1201,7 @@
 
                        self::render_template_xsl('datatable_jquery', $data);
                }
-
+               
                function add()
                {
                        if (!$this->acl_add)
@@ -1286,7 +1341,7 @@
                                        {
                                                if(!$values['assignedto'] = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['assigntodefault'])
                                                {
-                                               
+
                                                        $receipt['error'][] = 
array('msg' => lang('Please select a person or a group to handle the ticket 
!'));
                                                }
                                        }
@@ -2856,9 +2911,10 @@
                                'pref_send_mail' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification'])
 ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_user_mailnotification']
 : '',
                                'fileupload' => 
isset($this->bo->config->config_data['fmttsfileupload']) ? 
$this->bo->config->config_data['fmttsfileupload'] : '',
                                'multiple_uploader' => true,
-                               'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',"
+                               /*'fileuploader_action' => 
"{menuaction:'property.fileuploader.add',"
                                . "upload_target:'property.botts.addfiles',"
-                               . "id:'{$id}'}",
+                               . "id:'{$id}'}",*/
+                               'multi_upload_parans' => 
"{menuaction:'property.uitts.build_multi_upload_file', id:'{$id}'}",
                                'link_view_file' => 
$GLOBALS['phpgw']->link('/index.php', $link_file_data),
                                'link_to_files' => 
isset($this->bo->config->config_data['files_url']) ? 
$this->bo->config->config_data['files_url'] : '',
                                'files' => isset($ticket['files']) ? 
$ticket['files'] : '',

Modified: 
branches/Version-2_0-branch/property/inc/import/class.import_component_files.inc.php
===================================================================
--- 
branches/Version-2_0-branch/property/inc/import/class.import_component_files.inc.php
        2016-10-26 08:43:38 UTC (rev 15900)
+++ 
branches/Version-2_0-branch/property/inc/import/class.import_component_files.inc.php
        2016-10-26 08:54:04 UTC (rev 15901)
@@ -9,6 +9,8 @@
                        
                        $this->fakebase = '/temp_files_components';
                        $this->path_upload_dir = 
$GLOBALS['phpgw_info']['server']['files_dir'].$this->fakebase.'/';
+                       
+                       $this->latest_uploads = array();
                }
                
                public function get_path_upload_dir()
@@ -61,6 +63,58 @@
                        return true;
                }
                
+               private function _get_files_by_component($id, $location_id)
+               {
+                       $sql = "SELECT a.location_id, a.location_item_id, 
b.file_id, b.name FROM phpgw_vfs_file_relation a INNER JOIN phpgw_vfs b "
+                                       . " ON a.file_id = b.file_id WHERE 
a.location_item_id = '{$id}' AND a.location_id = '{$location_id}'"
+                                       . " AND b.mime_type != 'Directory' AND 
b.mime_type != 'journal' AND b.mime_type != 'journal-deleted'";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $values = array();
+                       
+                       while ($this->db->next_record())
+                       {
+                               $healthy = $this->db->f('file_id').'_#';
+                               $values[] = trim(str_replace($healthy, '', 
$this->db->f('name')));
+                       }
+
+                       return $values;                 
+               }
+               
+               private function _search_in_latest_uploads($file)
+               {
+                       $file_name = str_replace(' ', '_', $file);
+                       $file_id = array_search($file_name, 
$this->latest_uploads);
+                       if ($file_id)
+                       {
+                               return $file_id;
+                       }
+                       
+                       return false;
+               }
+               
+               private function _search_file_in_db($file)
+               {
+                       $file_name = str_replace(' ', '_', $file);
+                       
+                       $sql = "SELECT file_id, name FROM phpgw_vfs "
+                                       . " WHERE name LIKE '%{$file_name}'"
+                                       . " AND mime_type != 'Directory' AND 
mime_type != 'journal' AND mime_type != 'journal-deleted'";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+
+                       $value = array();
+
+                       if ($this->db->next_record())
+                       {
+                               $value['file_id'] = $this->db->f('file_id');
+                               $value['name'] = $this->db->f('name');
+                       }
+
+                       return $value['file_id'];                       
+               }
+               
                public function add_files($id, $location_code, 
$attrib_name_componentID)
                {               
                        $exceldata = 
$this->_getexceldata($_FILES['file']['tmp_name'], true);
@@ -83,6 +137,133 @@
                                );
                        }
 
+                       $count_new_relations = 0;
+                       $count_relations_existing = 0;
+                       $count_new_files = 0;
+                       $count_files_existing = 0;
+                       
+                       foreach ($component_files as $k => $files) 
+                       {
+                               if (empty($k))
+                               {
+                                       $component = array('id' => $id, 
'location_id' => $GLOBALS['phpgw']->locations->get_id('property', 
'.location.'.count(explode('-', $location_code))));
+                               }
+                               else {
+                                       $component = $this->_get_component($k, 
$attrib_name_componentID, $location_code);
+                                       if( empty($component['id']) || 
empty($component['location_id']))
+                                       {
+                                               $message['message'][] = 
array('msg' => lang("Component '%1' with location code '%2' does not exist", 
$k, $location_code));
+                                               continue;
+                                       }
+                               }
+                               
+                               $files_in_component = 
$this->_get_files_by_component($component['id'], $component['location_id']);
+
+                               foreach ($files as $file_data)
+                               {
+                                       if (in_array(str_replace(' ', '_', 
$file_data['file']), $files_in_component))
+                                       {
+                                               $count_relations_existing++;
+                                               continue;
+                                       }
+                                       
+                                       $this->db->transaction_begin();
+                                       try
+                                       {
+                                               $this->db->Exception_On_Error = 
true;                                           
+
+                                               $file = $file_data['file'];
+                                               
+                                               $file_id = 
$this->_search_in_latest_uploads($file);
+                                               if (!$file_id)
+                                               {
+                                                       $file_id = 
$this->_search_file_in_db($file);
+                                                       if ($file_id)
+                                                       {
+                                                               throw new 
Exception("file '{$file}' exist in DB. Component: '{$k}'");
+                                                               
$count_files_existing++;
+                                                       }
+
+                                                       if 
(!is_file($this->path_upload_dir.$file))
+                                                       {
+                                                               throw new 
Exception("file '{$file}' does not exist in folder temporary. Component: 
'{$k}'");
+                                                       }       
+
+                                                       $file_id = 
$this->_save_file($file_data);
+                                                       if (!$file_id)
+                                                       {                       
                        
+                                                               throw new 
Exception("failed to copy file '{$file}'. Component: '{$k}'");
+                                                       } 
+                                                       
unlink($this->path_upload_dir.$file);
+                                                       $count_new_files++;
+                                               }
+                                               
+                                               $result = 
$this->_save_file_relation($component['id'], $component['location_id'], 
$file_id);
+                                               if (!$result)
+                                               {                               
                
+                                                       $message['error'][] = 
array('msg' => "failed to save relation. File: '{$file}'. Component: '{$k}'");
+                                               } else {
+                                                       $count_new_relations++;
+                                               }                               
        
+
+                                               $this->db->Exception_On_Error = 
false;
+                                       }
+                                       catch (Exception $e)
+                                       {
+                                               if ($e)
+                                               {
+                                                       
$this->db->transaction_abort();                         
+                                                       $message['error'][] = 
array('msg' => $e->getMessage());
+                                                       continue;
+                                               }
+                                       }
+                                       $this->db->transaction_commit();
+                               }
+                       }
+                       
+                       if ($count_new_files)
+                       {
+                               $message['message'][] = array('msg' => lang('%1 
files copy successfully', $count_new_files));
+                       }
+                       if ($count_relations_existing)
+                       {
+                               $message['message'][] = array('msg' => lang('%1 
relations existing', $count_relations_existing));
+                       }
+                       if ($count_new_relations)
+                       {
+                               $message['message'][] = array('msg' => lang('%1 
relations saved successfully', $count_new_relations));
+                       }
+                       if ($count_files_existing)
+                       {
+                               $message['message'][] = array('msg' => lang('%1 
files already exist and were rejected', $count_files_existing));
+                       }
+                       
+                       return $message;
+               }
+               
+               
+               /*public function add_files($id, $location_code, 
$attrib_name_componentID)
+               {               
+                       $exceldata = 
$this->_getexceldata($_FILES['file']['tmp_name'], true);
+                       $component_files = array();
+                       $message = array();
+                       
+                       foreach ($exceldata as $row) 
+                       {
+                               if (!$this->_valid_row($row))
+                               {
+                                       continue;
+                               }
+                               
+                               $array_path = explode("\\", 
$row[(count($row)-1)]);
+                                               
+                               $component_files[$row[0]][] = array(
+                                       'name' => $row[1],
+                                       'desription' => $row[2],
+                                       'file' => 
$array_path[count($array_path)-1]
+                               );
+                       }
+
                        $this->db->transaction_begin();
                        
                        try
@@ -97,7 +278,7 @@
                                                $component = array('id' => $id, 
'location_id' => $GLOBALS['phpgw']->locations->get_id('property', 
'.location.'.count(explode('-', $location_code))));
                                        }
                                        else {
-                                               $component = 
$this->_get_component($k, $attrib_name_componentID);
+                                               $component = 
$this->_get_component($k, $attrib_name_componentID, $location_code);
                                                if( empty($component['id']) || 
empty($component['location_id']))
                                                {
                                                        throw new 
Exception("component {$k} does not exist");
@@ -143,17 +324,20 @@
                        $message['message'][] = array('msg' => lang('%1 files 
saved successfully', $count));            
                        
                        return $message;
-               }
+               }*/
                
                
-               private function _get_component( $query, 
$attrib_name_componentID)
+               private function _get_component( $query, 
$attrib_name_componentID, $location_code)
                {
+                       $location_code_values = explode('-', $location_code);
+                       $loc1 =  $location_code_values[0];
+                        
                        if ($query)
                        {
                                $query = $this->db->db_addslashes($query);
                        }
 
-                       $sql = "SELECT * FROM fm_bim_item WHERE 
json_representation->>'{$attrib_name_componentID}' = '{$query}'";
+                       $sql = "SELECT * FROM fm_bim_item WHERE loc1 = 
'{$loc1}' AND json_representation->>'{$attrib_name_componentID}' = '{$query}'";
 
                        $this->db->query($sql, __LINE__, __FILE__);
 
@@ -197,6 +381,8 @@
 
                        if ($file_id) 
                        {
+                               $this->latest_uploads[$file_id] = $file_name;
+                               
                                $metadata['report_date'] = 
phpgwapi_datetime::date_to_timestamp(date('Y-m-d'));
                                $metadata['title'] = $file_data['name']; 
                                $metadata['descr'] = $file_data['desription'];

Modified: 
branches/Version-2_0-branch/property/inc/import/class.import_components.inc.php
===================================================================
--- 
branches/Version-2_0-branch/property/inc/import/class.import_components.inc.php 
    2016-10-26 08:43:38 UTC (rev 15900)
+++ 
branches/Version-2_0-branch/property/inc/import/class.import_components.inc.php 
    2016-10-26 08:54:04 UTC (rev 15901)
@@ -74,14 +74,17 @@
                        return $components;
                }
                
-               private function _get_component( $query, 
$attrib_name_componentID)
+               private function _get_component( $query, 
$attrib_name_componentID, $location_code)
                {
+                       $location_code_values = explode('-', $location_code);
+                       $loc1 =  $location_code_values[0];
+                       
                        if ($query)
                        {
                                $query = $this->db->db_addslashes($query);
                        }
 
-                       $sql = "SELECT * FROM fm_bim_item WHERE 
json_representation->>'{$attrib_name_componentID}' = '{$query}'";
+                       $sql = "SELECT * FROM fm_bim_item WHERE loc1 = 
'{$loc1}' AND json_representation->>'{$attrib_name_componentID}' = '{$query}'";
 
                        $this->db->query($sql, __LINE__, __FILE__);
 
@@ -125,7 +128,7 @@
                                                $attributes_values = 
$this->_set_attributes_values($values, $attributes);
                                                $values_insert = 
$this->_populate(array('location_code'=>$location_code, 'location'=>$location), 
$attributes_values);
 
-                                               $component = 
$this->_get_component($values_insert[$attrib_name_componentID], 
$attrib_name_componentID);
+                                               $component = 
$this->_get_component($values_insert[$attrib_name_componentID], 
$attrib_name_componentID, $location_code);
                                                if ($component['id'])
                                                {
                                                        $receipt = 
$this->_edit_eav($values_insert, $entity['entity_id'], $entity['cat_id'], 
$component['id']);

Modified: 
branches/Version-2_0-branch/property/inc/import/class.import_entity_categories.inc.php
===================================================================
--- 
branches/Version-2_0-branch/property/inc/import/class.import_entity_categories.inc.php
      2016-10-26 08:43:38 UTC (rev 15900)
+++ 
branches/Version-2_0-branch/property/inc/import/class.import_entity_categories.inc.php
      2016-10-26 08:54:04 UTC (rev 15901)
@@ -24,8 +24,8 @@
                        $this->join = $this->db->join;
                        $this->bo = CreateObject('property.boadmin_entity', 
true);
                        $this->custom = CreateObject('property.custom_fields');
-                       $this->config = createObject('phpgwapi.config', 
'component_import');
-                       $this->config_repository = 
$this->config->read_repository();
+                       //$this->config = createObject('phpgwapi.config', 
'component_import');
+                       //$this->config_repository = 
$this->config->read_repository();
                        
                        $this->array_entity_categories = array(
                                '0' => array('name' => '0 Generelt'),
@@ -128,7 +128,10 @@
                {
                        $receipt = array();
                        
-                       $new_categories = 
$this->config_repository['new_entity_categories'];
+                       //$new_categories = 
$this->config_repository['new_entity_categories'];
+                       $new_categories = 
phpgwapi_cache::session_get('property', 'new_entity_categories');
+                       $new_categories = ($new_categories) ? 
unserialize($new_categories) : array();
+                       
                        if (!count($new_categories))
                        {
                                $receipt['message'][] = array('msg' => 
lang('Not exist new categories to insert'));
@@ -233,7 +236,10 @@
                {
                        $receipt = array();
                        
-                       $building_part_in_table = 
$this->config_repository['building_part_in_table'];
+                       //$building_part_in_table = 
$this->config_repository['building_part_in_table'];
+                       $building_part_in_table = 
phpgwapi_cache::session_get('property', 'building_part_in_table');
+                       $building_part_in_table = ($building_part_in_table) ? 
unserialize($building_part_in_table) : array();
+
                        if (!count($building_part_in_table))
                        {
                                $receipt['message'][] = array('msg' => 
lang('Not exist new categories to insert'));
@@ -422,7 +428,10 @@
                {
                        $receipt = array();
                        
-                       $attributes = 
$this->config_repository['new_attribs_for_template'];
+                       //$attributes = 
$this->config_repository['new_attribs_for_template'];
+                       $attributes = phpgwapi_cache::session_get('property', 
'new_attribs_for_template');
+                       $attributes = ($attributes) ? unserialize($attributes) 
: array();
+                       
                        if (!count($attributes))
                        {
                                $receipt['message'][] = array('msg' => 
lang('Not exist attributes to insert the template'));

Modified: 
branches/Version-2_0-branch/property/js/portico/condition_survey_edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/condition_survey_edit.js    
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/js/portico/condition_survey_edit.js    
2016-10-26 08:54:04 UTC (rev 15901)
@@ -9,11 +9,17 @@
 
 this.fileuploader = function ()
 {
-       var requestUrl = phpGWLink('index.php', fileuploader_action);
-       TINY.box.show({iframe: requestUrl, boxid: 'frameless', width: 750, 
height: 450, fixed: false, maskid: 'darkmask', maskopacity: 40, mask: true, 
animate: true, close: true});
+       var sUrl = phpGWLink('index.php', multi_upload_parans);
+       //TINY.box.show({iframe: sUrl, boxid: "frameless", width: 750, height: 
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate: 
true, close: true}); //refresh_files is called after upload
+       TINY.box.show({iframe: sUrl, boxid: 'frameless', width: 750, height: 
450, fixed: false, maskid: 'darkmask', maskopacity: 40, mask: true, animate: 
true,
+               close: true,
+               closejs: function ()
+               {
+                       refresh_files()
+               }
+       });     
 }
 
-
 function refresh_files()
 {
        var oArgs = {menuaction: 'property.uicondition_survey.get_files', id: 
survey_id};

Modified: branches/Version-2_0-branch/property/js/portico/entity.edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/entity.edit.js      
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/js/portico/entity.edit.js      
2016-10-26 08:54:04 UTC (rev 15901)
@@ -1,8 +1,15 @@
 
 this.fileuploader = function ()
 {
-       var sUrl = phpGWLink('index.php', fileuploader_action);
-       TINY.box.show({iframe: sUrl, boxid: "frameless", width: 750, height: 
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate: 
true, close: true}); //refresh_files is called after upload
+       var sUrl = phpGWLink('index.php', multi_upload_parans);
+       //TINY.box.show({iframe: sUrl, boxid: "frameless", width: 750, height: 
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate: 
true, close: true}); //refresh_files is called after upload
+       TINY.box.show({iframe: sUrl, boxid: 'frameless', width: 750, height: 
450, fixed: false, maskid: 'darkmask', maskopacity: 40, mask: true, animate: 
true,
+               close: true,
+               closejs: function ()
+               {
+                       refresh_files()
+               }
+       });     
 };
 
 this.refresh_files = function ()

Modified: branches/Version-2_0-branch/property/js/portico/import_components.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/import_components.js        
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/js/portico/import_components.js        
2016-10-26 08:54:04 UTC (rev 15901)
@@ -7,6 +7,7 @@
        $('.processing-columns').hide();
        $('.processing-import-relations').hide();
        $('.processing-save').hide();
+       $('.get-profile').hide();
        
        $('select#type_id').change( function()
        {
@@ -61,7 +62,7 @@
                {
                        var selected = api.rows(this).data()[0];
                        //console.log(selected.location_code);
-                       $('#tab-content').responsiveTabs('enable', 2);
+                       $('#tab-content').responsiveTabs('enable', 1);
                        $('#tab-content').responsiveTabs('enable', 3);
                        $('#tab-content').responsiveTabs('activate', 1);
                        $('.location_name').html(selected.location_code + ' ' + 
selected.loc1_name);
@@ -82,7 +83,12 @@
                                var $el = $("#attribute_name_component_id");
                                $el.empty();
                                $.each(result, function(key, value) {
-                                       
$el.append($("<option></option>").attr("value", value.id).text(value.name));
+                                       if (value.selected)
+                                       {
+                                               $el.append($("<option 
selected></option>").attr("value", value.id).text(value.name));
+                                       } else {
+                                               
$el.append($("<option></option>").attr("value", value.id).text(value.name));
+                                       }
                                });
                        }, data, "GET", "json"
                );                              
@@ -99,6 +105,18 @@
                        return false;
                }
                
+               if ($('#location_item_id').val() === '')
+               {
+                       alert('Choose Location');
+                       return false;
+               }       
+       
+               if ($('#attribute_name_component_id').val() === '')
+               {
+                       alert('Choose attribute name for Component ID');
+                       return false;
+               }
+               
                if (isSendingData())
                {
                        return false;
@@ -108,6 +126,9 @@
                var file_data = $('#excel_files').prop('files')[0];
                var form_data = new FormData(form);
                form_data.append('file', file_data);
+               form_data.append('attribute_name_component_id', 
$('#attribute_name_component_id').val());
+               form_data.append('location_code', $('#location_code').val());
+               form_data.append('location_item_id', 
$('#location_item_id').val());
 
                $('.processing-import-relations').show();
                
@@ -124,7 +145,7 @@
                                statusSend = false;
                                $('.processing-import-relations').hide();
                                JqueryPortico.show_message(4, result);
-                               $('#import_components_files').prop('disabled', 
true);
+                               
//$('#import_components_files').prop('disabled', true);
                        }
                });
        });
@@ -184,6 +205,7 @@
                                $('#content_lines').empty();
                                $('#content_columns').empty();
                                $('#template_list').prop('disabled', false);
+                               $('#profile_list').prop('disabled', false);
                                
$('#attribute_name_component_id').prop('disabled', false);
                        }
                });
@@ -229,6 +251,7 @@
                                
$('#responsiveTabsDemo').responsiveTabs('disable', 2);
                                
$('#responsiveTabsDemo').responsiveTabs('disable', 3);
                                $('#template_list').prop('disabled', false);
+                               $('#profile_list').prop('disabled', false);
                                
$('#attribute_name_component_id').prop('disabled', false);
                                
                        }, data, "GET", "json"
@@ -261,7 +284,8 @@
                        "step": 3,
                        "sheet_id": $('#sheet_id').val(), 
                        'start_line': 
$('input:radio[name=start_line]:checked').val(),
-                       'template_id': $('#template_list').val()
+                       'template_id': $('#template_list').val(),
+                       'cod_profile': $('#profile_list').val()
                };
                
                $('.processing-start-line').show();
@@ -281,6 +305,7 @@
                                
$('#responsiveTabsDemo').responsiveTabs('activate', 2);
                                
$('#responsiveTabsDemo').responsiveTabs('disable', 3);
                                $('#template_list').prop('disabled', true);
+                               $('#profile_list').prop('disabled', true);
                        
                        }, data, "GET", "json"
                );
@@ -398,6 +423,24 @@
                                $('#message3').empty();
                                $('#message1').empty();
                                
+                               $('#template_name').empty();
+                               if (typeof(result.profile.template) !== 
'undefined')
+                               {
+                                       
$('#template_name').append(result.profile.template.template_name);
+                               }
+                               $('#component_id_text').empty();
+                               if 
(typeof(result.profile.attrib_name_componentID) !== 'undefined')
+                               {
+                                       
$('#component_id_text').append(result.profile.attrib_name_componentID.text);
+                               }
+                               $('#columns_name').empty();
+                               if (typeof(result.profile.columns.columns_name) 
!== 'undefined')
+                               {
+                                       
$.each(result.profile.columns.columns_name, function(i, field){
+                                               $('#columns_name').append(field 
+ "<br>");
+                                       });
+                               }
+                               
                                $('#new_entity_categories').empty();
                                if (typeof(result.new_entity_categories) !== 
'undefined')
                                {
@@ -413,7 +456,7 @@
                                                
$('#new_attributes').append(field + "<br>");
                                        });
                                }
-                               
$('#attribute_name_component_id').prop('disabled', true);
+                               
//$('#attribute_name_component_id').prop('disabled', true);
                                $('#step5').prop('disabled', false);
 
                        }, data, "GET", "JSON"
@@ -430,17 +473,29 @@
                        alert('Choose Location');
                        return false;
                }
+               if ($('#save_profile:checked').length)
+               {
+                       if 
($('input:radio[name=profile_option_save]:checked').val() == 1 && 
$('#name_profile').val() == '')
+                       {
+                               alert('enter name for profile');
+                               return false;
+                       }
+               }
                
                if (isSendingData())
                {
                        return false;
                }
-               
+                
                var data = {
                        "step": 5,
                        'save': 1,
                        'location_code': $('#location_code').val(),
-                       'location_item_id': $('#location_item_id').val()
+                       'location_item_id': $('#location_item_id').val(),
+                       'save_profile': $('#save_profile:checked').length,
+                       'name_profile': $('#name_profile').val(),
+                       'profile_option_save': 
$('input:radio[name=profile_option_save]:checked').val(),
+                       'cod_profile': $('#cod_profile_selected').val()
                };
                
                $('.processing-save').show();
@@ -485,9 +540,53 @@
                $('#responsiveTabsDemo').responsiveTabs('disable', 2);
                $('#responsiveTabsDemo').responsiveTabs('disable', 3);
                $('#template_list').prop('disabled', false);
+               $('#profile_list').prop('disabled', false);
                $('#attribute_name_component_id').prop('disabled', false);
        });
        
+       $('#profile_list').on('change', function ()
+       {
+               $('#profile_selected').empty();
+               $('#profile_selected').append($("#profile_list 
option:selected").text());
+               $('#cod_profile_selected').val($('#profile_selected').val());
+
+               if ($('#profile_list').val())
+               {
+                       $('#profile_option_save_2').prop('disabled', false);
+                       $('#profile_option_save_2').prop('checked', true);
+                       $('#profile_option_save_1').prop('disabled', true);
+                       $('#name_profile').prop('disabled', true);
+               } else {
+                       $('#profile_option_save_1').prop('disabled', false);
+                       $('#profile_option_save_1').prop('checked', true);
+                       $('#profile_option_save_2').prop('disabled', true);
+                       $('#name_profile').prop('disabled', false);
+               }
+               
+               var oArgs = {menuaction: 
'property.uiimport_components.get_profile'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+                
+               var data = {
+                       'cod_profile': $('#profile_list').val()
+               };
+               
+               $('.get-profile').show();
+               
+               JqueryPortico.execute_ajax(requestUrl,
+                       function(result){
+                               
+                               statusSend = false;
+                               $('.get-profile').hide();
+                               if (result.template_id)
+                               {
+                                       
$('#template_list').val(result.template_id);
+                               }
+                               
$('#attribute_name_component_id').val(result.attrib_name_componentID);
+               
+                       }, data, "GET", "JSON"
+               );
+       });
+       
 });
 
 function valid_new_attribute (code)

Modified: branches/Version-2_0-branch/property/js/portico/tts.view.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/tts.view.js 2016-10-26 
08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/js/portico/tts.view.js 2016-10-26 
08:54:04 UTC (rev 15901)
@@ -237,8 +237,15 @@
 
 this.fileuploader = function ()
 {
-       var sUrl = phpGWLink('index.php', fileuploader_action);
-       TINY.box.show({iframe: sUrl, boxid: "frameless", width: 750, height: 
450, fixed: false, maskid: "darkmask", maskopacity: 40, mask: true, animate: 
true, close: true}); //refresh_files is called after upload
+       //JqueryPortico.openPopup(multi_upload_parans,{closeAction:'close'})
+       var sUrl = phpGWLink('index.php', multi_upload_parans);
+       TINY.box.show({iframe: sUrl, boxid: 'frameless', width: 750, height: 
450, fixed: false, maskid: 'darkmask', maskopacity: 40, mask: true, animate: 
true,
+               close: true,
+               closejs: function ()
+               {
+                       refresh_files()
+               }
+       });     
 };
 
 this.refresh_files = function ()

Modified: 
branches/Version-2_0-branch/property/templates/base/condition_survey.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/condition_survey.xsl    
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/condition_survey.xsl    
2016-10-26 08:54:04 UTC (rev 15901)
@@ -242,11 +242,7 @@
                                        <script type="text/javascript">
                                   
                                                var survey_id = '<xsl:value-of 
select='survey/id'/>';
-                                               var fileuploader_action = {
-                                               
menuaction:'property.fileuploader.add',
-                                               
upload_target:'property.bocondition_survey.addfiles',
-                                               id: survey_id
-                                               };
+                                               var multi_upload_parans = 
<xsl:value-of select="multi_upload_parans"/>;
                                        
                                                this.show_related_requests = 
function()
                                                {
@@ -437,32 +433,3 @@
        </option>
 </xsl:template>
 
-<xsl:template xmlns:php="http://php.net/xsl"; name="file_upload">
-       <dt>
-               <label>
-                       <xsl:value-of select="php:function('lang', 'upload 
file')"/>
-               </label>
-       </dt>
-       <dd>
-               <input type="file" name="file" size="40">
-                       <xsl:attribute name="title">
-                               <xsl:value-of select="php:function('lang', 
'Select file to upload')"/>
-                       </xsl:attribute>
-               </input>
-       </dd>
-       <xsl:choose>
-               <xsl:when test="multiple_uploader!=''">
-                       <dt>
-                               <label>
-                                       <a href="javascript:fileuploader()">
-                                               <xsl:attribute name="title">
-                                                       <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
-                                               </xsl:attribute>
-                                               <xsl:value-of 
select="php:function('lang', 'upload multiple files')"/>
-                                       </a>
-                               </label>
-                       </dt>
-               </xsl:when>
-       </xsl:choose>
-</xsl:template>
-

Modified: branches/Version-2_0-branch/property/templates/base/entity.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/entity.xsl      
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/entity.xsl      
2016-10-26 08:54:04 UTC (rev 15901)
@@ -706,7 +706,7 @@
                                        <xsl:when test="files!='' or  
fileupload = 1 and value_id!=''">
                                                <div id="files">
                                                        <script 
type="text/javascript">
-                                                               var 
fileuploader_action = <xsl:value-of select="fileuploader_action"/>;
+                                                               var 
multi_upload_parans = <xsl:value-of select="multi_upload_parans"/>;
                                                        </script>
                                                        <fieldset>
                                                                <div 
class="pure-control-group">

Modified: branches/Version-2_0-branch/property/templates/base/files.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/files.xsl       
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/files.xsl       
2016-10-26 08:54:04 UTC (rev 15901)
@@ -1,10 +1,20 @@
 
 <!-- $Id$ -->
+
+<xsl:template name="multi_upload">
+       <xsl:apply-templates select="multi_upload"/>
+</xsl:template>
+
+<xsl:template xmlns:php="http://php.net/xsl"; match="multi_upload">
+       <xsl:call-template name="multi_upload_file"/>
+</xsl:template>
+
+
 <!-- New template-->
 <xsl:template xmlns:php="http://php.net/xsl"; name="file_upload">
        <div class="pure-control-group">
                <label>
-                               <xsl:value-of select="php:function('lang', 
'upload file')"/>
+                               <xsl:value-of select="php:function('lang', 
'upload files')"/>
                </label>
                                <input type="file" name="file" size="40">
                                        <xsl:attribute name="title">

Modified: 
branches/Version-2_0-branch/property/templates/base/import_components.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/import_components.xsl   
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/import_components.xsl   
2016-10-26 08:54:04 UTC (rev 15901)
@@ -63,7 +63,8 @@
                                        <label>
                                                <xsl:value-of 
select="access_error_upload_dir" />
                                        </label>
-                                       <xsl:value-of 
disable-output-escaping="yes" select="form_file_upload"/>
+                                       <xsl:call-template 
name="multi_upload_file"/>
+                                       <!--<xsl:value-of 
disable-output-escaping="yes" select="form_file_upload"/>-->
                                </div>
                                
                                <div id="components">
@@ -76,6 +77,15 @@
                                                </div>
                                                <div class="pure-control-group">
                                                        <label for="vendor">
+                                                               <xsl:value-of 
select="php:function('lang', 'Profile')" />
+                                                       </label>
+                                                       <select 
id="profile_list" name="profile_list">
+                                                               
<xsl:apply-templates select="profile_list/options"/>
+                                                       </select>
+                                                       <img 
src="{image_loader}" class="get-profile" align="absmiddle"></img>
+                                               </div>
+                                               <div class="pure-control-group">
+                                                       <label for="vendor">
                                                                <xsl:value-of 
select="php:function('lang', 'Template')" />
                                                        </label>
                                                        <select 
id="template_list" name="template_list">
@@ -117,7 +127,7 @@
                                                        </ul>
                                                        <div id="tab-1">
                                                                <select 
id="sheet_id" name="sheet_id">
-                                                                       <option 
value=''>Select Sheet</option>
+                                                                       <option 
value=''><xsl:value-of select="php:function('lang', 'Select Sheet')"/></option>
                                                                </select>
                                                                <input 
type="button" id="step2" name="step2" size="40">
                                                                        
<xsl:attribute name="value">
@@ -147,6 +157,40 @@
                                                        <div id="tab-4">
                                                                <div 
class="pure-control-group">
                                                                        <label 
for="vendor">
+                                                                               
<xsl:value-of select="php:function('lang', 'Profile')" />
+                                                                       </label>
+                                                                       <div 
class="pure-custom">
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'Category template')" 
/></label>
+                                                                               
        <div id="template_name" class="pure-custom"></div>
+                                                                               
</div>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'Attribute name for 
Component ID')" /></label>
+                                                                               
        <div id="component_id_text" class="pure-custom"></div>
+                                                                               
</div>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'Columns and 
attributes')" /></label>
+                                                                               
        <div id="columns_name" class="pure-custom"></div>
+                                                                               
</div>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'Save Profile')" 
/></label>
+                                                                               
        <input type="checkbox" value="1" id="save_profile" name="save_profile" 
checked="true"/>                                                                
                                                                                
 
+                                                                               
</div>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'add')" /></label>
+                                                                               
        <input type="radio" value="1" id="profile_option_save_1" 
name="profile_option_save" checked="true"/>
+                                                                               
        <input type="text" value="" id="name_profile" name="name_profile" />
+                                                                               
</div>
+                                                                               
<div class="pure-control-group">
+                                                                               
        <label><xsl:value-of select="php:function('lang', 'update')" /></label>
+                                                                               
        <input type="radio" value="2" id="profile_option_save_2" 
name="profile_option_save" disabled="true"/>
+                                                                               
        <div id="profile_selected" style="display:inline-block; 
margin-right:10px;"></div>
+                                                                               
        <input type="hidden" id="cod_profile_selected" 
name="cod_profile_selected" value=""></input>
+                                                                               
</div>
+                                                                       </div>  
                        
+                                                               </div>
+                                                               <div 
class="pure-control-group">
+                                                                       <label 
for="vendor">
                                                                                
<xsl:value-of select="php:function('lang', 'New Categories')" />
                                                                        </label>
                                                                        <div 
id="new_entity_categories" class="pure-custom"></div>

Modified: branches/Version-2_0-branch/property/templates/base/lookup.entity.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/lookup.entity.xsl       
2016-10-26 08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/lookup.entity.xsl       
2016-10-26 08:54:04 UTC (rev 15901)
@@ -692,6 +692,7 @@
                                        }
 
                                        api = oTable.api();
+                                       api.buttons(0,null).remove();
                                        api.destroy();
 
                                        //Reset the destroyed values.

Copied: 
branches/Version-2_0-branch/property/templates/base/multi_upload_file.xsl (from 
rev 15900, trunk/property/templates/base/multi_upload_file.xsl)
===================================================================
--- branches/Version-2_0-branch/property/templates/base/multi_upload_file.xsl   
                        (rev 0)
+++ branches/Version-2_0-branch/property/templates/base/multi_upload_file.xsl   
2016-10-26 08:54:04 UTC (rev 15901)
@@ -0,0 +1,127 @@
+
+<!-- $Id: multi_upload_file.xsl 14753 2016-02-18 18:23:21Z sigurdne $ -->
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl"; name="multi_upload_file">
+       <xsl:variable name="action">
+               <xsl:value-of select="multi_upload_action"/>
+       </xsl:variable>
+       <form id="multi_upload_file" action="{$action}" method="POST" 
enctype="multipart/form-data">
+               <!-- The fileupload-buttonbar contains buttons to add/delete 
files and start/cancel the upload -->
+               <div class="fileupload-buttonbar">
+                       <div class="fileupload-buttons">
+                               <!-- The fileinput-button span is used to style 
the file input field as button -->
+                               <span class="fileinput-button pure-button">
+                                       <span>Add files...</span>
+                                       <input type="file" id="files" 
name="files[]" multiple=""/>
+                               </span>
+                               <button type="submit" class="start 
pure-button">Start upload</button>
+                               <button type="reset" class="cancel 
pure-button">Cancel upload</button>
+                               <button type="button" class="delete 
pure-button">Delete</button>
+                               <input type="checkbox" class="toggle"/>
+                               <!-- The global file processing state -->
+                               <span class="fileupload-process"></span>
+                       </div>
+                       <div class="fileupload-progress fade" 
style="display:none">
+                               <!-- The global progress bar -->
+                               <div class="progress" role="progressbar" 
aria-valuemin="0" aria-valuemax="100"></div>
+                               <!-- The extended global progress state -->
+                               <div class="progress-extended">&nbsp;</div>
+                       </div>
+               </div>
+               <!-- The table listing the files available for upload/download 
-->
+               <div class="content_upload_download">                           
        
+                       <div class="presentation files" style="display: 
inline-table;"></div>
+               </div>
+       </form>
+
+       <!-- The template to display files available for upload -->
+       <script id="template-upload" type="text/x-tmpl">
+<![CDATA[
+       {% for (var i=0, file; file=o.files[i]; i++) { %}
+               <div class="template-upload">
+                       <div class="table-cell">
+                               <div class="name">{%=file.name%}</div>
+                               <div class="error"></div>
+                       </div>
+                       <div class="table-cell">
+                               <div class="size">Processing...</div>
+                       </div>
+                       <div class="table-cell">
+                               <div class="progress" style="width: 
100px;"></div>
+                       </div>
+                       <div class="table-cell">
+                               {% if (!i && !o.options.autoUpload) { %}
+                                       <button class="start pure-button" 
disabled="">Start</button>
+                               {% } %}
+                               {% if (!i) { %}
+                                       <button class="cancel 
pure-button">Cancel</button>
+                               {% } %}
+                       </div>
+               </div>
+       {% } %}
+]]>    
+       </script>
+       <!-- The template to display files available for download -->
+       <script id="template-download" type="text/x-tmpl">
+<![CDATA[
+       {% for (var i=0, file; file=o.files[i]; i++) { %}
+               <div class="template-download">
+                       <div class="table-cell">                                
                
+                               <div class="name">
+                                       <!--<a href="{%=file.url%}" 
title="{%=file.name%}" download="{%=file.name%}" 
{%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>-->
+                                       {%=file.name%}                          
                        
+                               </div>
+                               {% if (file.error) { %} <div 
class="error">Error: {%=file.error%} </div>{% } %}
+                       </div>
+                       <div class="table-cell">
+                               <div 
class="size">{%=o.formatFileSize(file.size)%}</div>
+                       </div>
+                       <div class="table-cell">
+                               <button class="delete pure-button" 
data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if 
(file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% 
} %}>Delete</button>
+                               <input type="checkbox" name="delete" value="1" 
class="toggle"/>
+                       </div>
+               </div>
+       {% } %}
+]]>    
+       </script>
+
+       <script>
+               $(function () {
+                       'use strict';
+                                       
+                       // Initialize the jQuery File Upload widget:
+                       $('#multi_upload_file').fileupload({
+                               // Uncomment the following to send cross-domain 
cookies:
+                               //xhrFields: {withCredentials: true},
+                               url: '<xsl:value-of 
select="multi_upload_action"/>',
+                               limitConcurrentUploads: 4,
+                               //acceptFileTypes: /(\.|\/)(png|pdf)$/i
+                       });
+                               
+                       // Enable iframe cross-domain access via redirect 
option:
+                       $('#multi_upload_file').fileupload(
+                               'option',
+                               'redirect',
+                               window.location.href.replace(
+                                       /\/[^\/]*$/,
+                                       '/cors/result.html?%s'
+                               )
+                       );
+                               
+                       // Load existing files:
+                       
$('#multi_upload_file').addClass('fileupload-processing');
+                       $.ajax({
+                               // Uncomment the following to send cross-domain 
cookies:
+                               //xhrFields: {withCredentials: true},
+                               url: 
$('#multi_upload_file').fileupload('option', 'url'),
+                               dataType: 'json',
+                               context: $('#multi_upload_file')[0]
+                       }).always(function () {
+                               $(this).removeClass('fileupload-processing');
+                       }).done(function (result) {
+                               $(this).fileupload('option', 'done').call(this, 
$.Event('done'), {result: result});
+                       });
+               });
+       </script>
+</xsl:template>
\ No newline at end of file

Modified: branches/Version-2_0-branch/property/templates/base/tts.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/tts.xsl 2016-10-26 
08:43:38 UTC (rev 15900)
+++ branches/Version-2_0-branch/property/templates/base/tts.xsl 2016-10-26 
08:54:04 UTC (rev 15901)
@@ -652,7 +652,7 @@
                                        <xsl:choose>
                                                <xsl:when test="fileupload = 1">
                                                        <script 
type="text/javascript">
-                                                               var 
fileuploader_action = <xsl:value-of select="fileuploader_action"/>;
+                                                               var 
multi_upload_parans = <xsl:value-of select="multi_upload_parans"/>;
                                                        </script>
                                                        <xsl:call-template 
name="file_upload"/>
                                                </xsl:when>
@@ -1180,24 +1180,7 @@
                                                                                
</div>
                                                                        </div>
 
-                                                                       <div 
class="pure-control-group">
-                                                                               
<div class="pure-custom">
-                                                                               
        <xsl:for-each select="datatable_def">
-                                                                               
                <xsl:if test="container = 'datatable-container_8'">
-                                                                               
                        <xsl:call-template name="table_setup">
-                                                                               
                                <xsl:with-param name="container" select 
='container'/>
-                                                                               
                                <xsl:with-param name="requestUrl" select 
='requestUrl' />
-                                                                               
                                <xsl:with-param name="ColumnDefs" select 
='ColumnDefs' />
-                                                                               
                                <xsl:with-param name="tabletools" select 
='tabletools' />
-                                                                               
                                <xsl:with-param name="data" select ='data' />
-                                                                               
                                <xsl:with-param name="config" select ='config' 
/>
-                                                                               
                        </xsl:call-template>
-                                                                               
                </xsl:if>
-                                                                               
        </xsl:for-each>
-                                                                               
</div>
-                                                                       </div>
 
-
                                                                </xsl:when>
                                                        </xsl:choose>
                                                </xsl:when>

Modified: branches/Version-2_0-branch/setup/config.php
===================================================================
--- branches/Version-2_0-branch/setup/config.php        2016-10-26 08:43:38 UTC 
(rev 15900)
+++ branches/Version-2_0-branch/setup/config.php        2016-10-26 08:54:04 UTC 
(rev 15901)
@@ -150,7 +150,8 @@
                        {
                                $GLOBALS['phpgw_setup']->db->query("DELETE FROM 
phpgw_config WHERE config_name='{$setting}'", __LINE__, __FILE__);
                        }
-                       if($value)
+                       /* cookie_domain has to allow an empty value*/
+                       if($value || $setting == 'cookie_domain')
                        {
                                $value = 
$GLOBALS['phpgw_setup']->db->db_addslashes($value);
                                $GLOBALS['phpgw_setup']->db->query("INSERT INTO 
phpgw_config (config_app,config_name, config_value) VALUES ('phpgwapi', 
'{$setting}','{$value}')", __LINE__, __FILE__);

Modified: branches/Version-2_0-branch/setup/index.php
===================================================================
--- branches/Version-2_0-branch/setup/index.php 2016-10-26 08:43:38 UTC (rev 
15900)
+++ branches/Version-2_0-branch/setup/index.php 2016-10-26 08:54:04 UTC (rev 
15901)
@@ -429,12 +429,60 @@
                case 10:
                        $setup_tpl->set_var('config_status_img',$completed);
                        
$setup_tpl->set_var('config_status_alt',lang('completed'));
+                       $completed_notice = '';
+                       $GLOBALS['phpgw_setup']->db->query("SELECT config_value 
FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name='files_dir'");
+                       $GLOBALS['phpgw_setup']->db->next_record();
+                       $files_dir = 
$GLOBALS['phpgw_setup']->db->f('config_value');
+                       $GLOBALS['phpgw_setup']->db->query("SELECT config_value 
FROM phpgw_config WHERE config_app = 'phpgwapi' AND 
config_name='file_store_contents'");
+                       $GLOBALS['phpgw_setup']->db->next_record();
+                       $file_store_contents = 
$GLOBALS['phpgw_setup']->db->f('config_value');
+                       if($files_dir && $file_store_contents == 'filesystem')
+                       {
+                               if(!is_dir($files_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('files dir %1 is not a directory', $files_dir) . '</b>';
+                               }
+                               if(!is_readable($files_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('files dir %1 is not readable', $files_dir) . '</b>';
+                               }
+                               if(!is_writable($files_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('files dir %1 is not writeable', $files_dir) . '</b>';
+                               }
+                       }
+
+                       $GLOBALS['phpgw_setup']->db->query("SELECT config_value 
FROM phpgw_config WHERE config_app = 'phpgwapi' AND config_name='temp_dir'");
+                       $GLOBALS['phpgw_setup']->db->next_record();
+                       $temp_dir = 
$GLOBALS['phpgw_setup']->db->f('config_value');
+                       if($temp_dir)
+                       {
+                               if(!is_dir($temp_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('temp dir %1 is not a directory', $temp_dir) . '</b>';
+                               }
+                               if(!is_readable($temp_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('temp dir %1 is not readable', $temp_dir) . '</b>';
+                               }
+                               if(!is_writable($temp_dir))
+                               {
+                                       $completed_notice .= '<br /><b>' . 
lang('temp dir %1 is not writeable', $temp_dir) . '</b>';
+                               }
+                       }
+
                        $btn_edit_config = 
$GLOBALS['phpgw_setup']->html->make_frm_btn_simple(
                                lang('Configuration completed'),
                                'POST','config.php',
                                'submit',lang('Edit Current Configuration'),
-                               ''
+                               $completed_notice
                        );
+
+                       if($completed_notice)
+                       {
+                               
$GLOBALS['phpgw_setup']->html->show_alert_msg('Error', $completed_notice );
+                       }
+
                        $GLOBALS['phpgw_setup']->db->query("select config_value 
FROM phpgw_config WHERE config_name='auth_type'");
                        $GLOBALS['phpgw_setup']->db->next_record();
                        if ($GLOBALS['phpgw_setup']->db->f('config_value') == 
'ldap')




reply via email to

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