fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14914] Syncromind: Merge 14911:14913 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [14914] Syncromind: Merge 14911:14913 from trunk
Date: Mon, 11 Apr 2016 12:47:32 +0000

Revision: 14914
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14914
Author:   sigurdne
Date:     2016-04-11 12:47:32 +0000 (Mon, 11 Apr 2016)
Log Message:
-----------
Syncromind: Merge 14911:14913 from trunk

Modified Paths:
--------------
    branches/dev-syncromind/bim/inc/class.sovfs.inc.php
    branches/dev-syncromind/helpdesk/inc/class.uitts.inc.php
    branches/dev-syncromind/phpgwapi/inc/class.vfs_sql.inc.php
    branches/dev-syncromind/property/inc/class.bofiles.inc.php
    branches/dev-syncromind/property/inc/class.uiagreement.inc.php
    branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php
    branches/dev-syncromind/property/inc/class.uientity.inc.php
    branches/dev-syncromind/property/inc/class.uiproject.inc.php
    branches/dev-syncromind/property/inc/class.uirequest.inc.php
    branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
    branches/dev-syncromind/property/inc/class.uitenant_claim.inc.php
    branches/dev-syncromind/property/inc/class.uitts.inc.php
    branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
    branches/dev-syncromind/property/inc/class.uiworkorder.inc.php

Property Changed:
----------------
    branches/dev-syncromind/


Property changes on: branches/dev-syncromind
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13731-13773,13775,13778-13791,13793-13800,13802-13811,13816-13880,13882-13931,13934,13940-13963,13978-14029,14031-14268,14273-14399,14401-14546
   + /branches/stavangerkommune:12743-12875,12986
/trunk:12111-12211,12213-12246,12250-12363,12366-12405,12407-12435,12437-12462,12464-12527,12530-12602,12604-12670,12672-12683,12686-12750,12753-12785,12787-12974,12987,12989-13177,13179-13344,13346-13399,13401-13432,13434-13481,13483-13506,13542-13602,13604-13653,13656-13668,13670-13689,13691-13726,13731-13773,13775,13778-13791,13793-13800,13802-13811,13816-13880,13882-13931,13934,13940-13963,13978-14029,14031-14268,14273-14399,14401-14546,14912-14913

Modified: branches/dev-syncromind/bim/inc/class.sovfs.inc.php
===================================================================
--- branches/dev-syncromind/bim/inc/class.sovfs.inc.php 2016-04-11 12:27:37 UTC 
(rev 14913)
+++ branches/dev-syncromind/bim/inc/class.sovfs.inc.php 2016-04-11 12:47:32 UTC 
(rev 14914)
@@ -209,8 +209,6 @@
                                $errorString = $errorString . 
"filename:$this->filename \n";
                                throw new 
InvalidArgumentException($errorString);
                        }
-                       $file = array();
-                       $file['file_action'][0] = $this->filename;
                        if($this->subModule)
                        {
                                $path = "/$this->subModule/";
@@ -219,7 +217,32 @@
                        {
                                $path = "/";
                        }
-                       $recieve = $this->bofiles->delete_file($path, $file);
+
+                       $file = 
"{$this->bofiles->fakebase}{$path}{$this->filename}";
+
+                       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
+                                               )
+                                       )))
+                               {
+                                       $recieve['error'][] = array('msg' => 
lang('failed to delete file') . ' :' . $this->bofiles->fakebase . $path . 
$this->filename);
+                               }
+                               else
+                               {
+                                       $recieve['message'][] = array('msg' => 
lang('file deleted') . ' :' . $this->bofiles->fakebase . $path . 
$this->filename);
+                               }
+                               $this->bofiles->vfs->override_acl = 0;
+                       }
+
                        if($recieve['message'])
                        {
                                $result = $recieve['message'][0]["msg"];

Modified: branches/dev-syncromind/helpdesk/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/helpdesk/inc/class.uitts.inc.php    2016-04-11 
12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/helpdesk/inc/class.uitts.inc.php    2016-04-11 
12:47:32 UTC (rev 14914)
@@ -1903,7 +1903,7 @@
                                if(isset($values['file_attach']) && 
is_array($values['file_attach']))
                                {
 //                                     $bofiles        = 
CreateObject('helpdesk.bofiles' '/helpdesk');
-                                       $attachments = 
$bofiles->get_attachments("/{$id}/", $values['file_attach']);
+                                       $attachments = 
$bofiles->get_attachments($values['file_attach']);
                                        $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ',$values['file_attach']);
                                }
                                if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
@@ -2090,22 +2090,13 @@
                                );      
 
 
-                       $link_to_files = 
(isset($this->bo->config->config_data['files_url'])?$this->bo->config->config_data['files_url']:'');
-
                        $link_view_file = 
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
 
                        for($z=0; $z<count($ticket['files']); $z++)
                        {                               
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_to_files.'/'.$ticket['files'][$z]['directory'].'/'.$ticket['files'][$z]['file_name'].'"
 target="_blank" title="'.lang('click to view file').'" 
style="cursor:help">'.$ticket['files'][$z]['name'].'</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_name='.$ticket['files'][$z]['file_name'].'" 
target="_blank" title="'.lang('click to view 
file').'">'.$ticket['files'][$z]['name'].'</a>';
-                               }                               
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to delete 
file').'">';
-                               $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" 
value="'.$ticket['files'][$z]['name'].'" title="'.lang('Check to attach 
file').'">';
+                               $content_files[$z]['file_name'] = '<a 
href="'.$link_view_file.'&amp;file_id='.$ticket['files'][$z]['file_id'].'" 
target="_blank" title="'.lang('click to view 
file').'">'.$ticket['files'][$z]['name'].'</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" 
value="'.$ticket['files'][$z]['file_id'].'" title="'.lang('Check to delete 
file').'">';
+                               $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" 
value="'.$ticket['files'][$z]['file_id'].'" title="'.lang('Check to attach 
file').'">';
                        }                                                       
 
                        $datavalues[2] = array
@@ -2301,8 +2292,7 @@
                                
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'helpdesk.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
                        }
 
-                       $bofiles        = 
CreateObject('property.bofiles','/helpdesk');
-                       $bofiles->view_file('fmticket');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                protected function _generate_tabs($history='')

Modified: branches/dev-syncromind/phpgwapi/inc/class.vfs_sql.inc.php
===================================================================
--- branches/dev-syncromind/phpgwapi/inc/class.vfs_sql.inc.php  2016-04-11 
12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/phpgwapi/inc/class.vfs_sql.inc.php  2016-04-11 
12:47:32 UTC (rev 14914)
@@ -755,6 +755,48 @@
                }
 
                /*
+                * get file info by id
+                *
+                * @return Array of file information.
+                */
+               function get_info( $file_id )
+               {
+                       $file_id = (int) $file_id;
+                       $query = $GLOBALS['phpgw']->db->query("SELECT 
directory, name FROM phpgw_vfs WHERE file_id={$file_id}", __LINE__, __FILE__);
+                       $GLOBALS['phpgw']->db->next_record();
+                       $directory = $GLOBALS['phpgw']->db->f('directory');
+                       $name = $GLOBALS['phpgw']->db->f('name');
+
+                       $file = "{$directory}/{$name}";
+
+                       $ls_array = $this->ls(array(
+                                       'string' => $file,
+                                       'relatives' => array(RELATIVE_NONE),
+                                       'checksubdirs' => false,
+                                       'nofiles' => true
+                               ));
+                       
+                       return isset($ls_array[0]) && $ls_array[0] ? 
$ls_array[0] : array();
+               }
+
+               /*
+                * get file by id
+                *
+                * @return Array of file information and file content
+                */
+               function get($file_id)
+               {
+                       $file_info = $this->get_info( $file_id );
+
+                       $file_info['content'] =  $this->read(array(
+                                       'string' => 
"{$file_info['directory']}/{$file_info['name']}",
+                                       'relatives' => array(RELATIVE_NONE)
+                               )
+                       );
+
+                       return $file_info;
+               }
+               /*
                 * See vfs_shared
                 */
                function read($data)

Modified: branches/dev-syncromind/property/inc/class.bofiles.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.bofiles.inc.php  2016-04-11 
12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.bofiles.inc.php  2016-04-11 
12:47:32 UTC (rev 14914)
@@ -88,17 +88,17 @@
                        $receipt = array();
 
                        if (!$this->vfs->file_exists(array(
-                               'string' => $this->fakebase,
-                               'relatives' => array(RELATIVE_NONE)
-                       )))
+                                       'string' => $this->fakebase,
+                                       'relatives' => array(RELATIVE_NONE)
+                               )))
                        {
                                $this->vfs->override_acl = 1;
                                if (!$this->vfs->mkdir(array(
-                                       'string' => $this->fakebase,
-                                       'relatives' => array(
-                                               RELATIVE_NONE
-                                       )
-                               )))
+                                               'string' => $this->fakebase,
+                                               'relatives' => array(
+                                                       RELATIVE_NONE
+                                               )
+                                       )))
                                {
                                        $receipt['error'][] = array('msg' => 
lang('failed to create directory') . ' :' . $this->fakebase);
                                }
@@ -117,17 +117,17 @@
                                $catalog .= "/{$entry}";
 
                                if (!$this->vfs->file_exists(array(
-                                       'string' => 
"{$this->fakebase}{$catalog}",
-                                       'relatives' => array(RELATIVE_NONE)
-                               )))
+                                               'string' => 
"{$this->fakebase}{$catalog}",
+                                               'relatives' => 
array(RELATIVE_NONE)
+                                       )))
                                {
                                        $this->vfs->override_acl = 1;
                                        if (!$this->vfs->mkdir(array(
-                                               'string' => 
"{$this->fakebase}{$catalog}",
-                                               'relatives' => array(
-                                                       RELATIVE_NONE
-                                               )
-                                       )))
+                                                       'string' => 
"{$this->fakebase}{$catalog}",
+                                                       'relatives' => array(
+                                                               RELATIVE_NONE
+                                                       )
+                                               )))
                                        {
                                                $receipt['error'][] = 
array('msg' => lang('failed to create directory') . ' :' . $this->fakebase . 
$catalog);
                                        }
@@ -150,36 +150,43 @@
                 *
                 * @return array Array with result on the 
action(failed/success) for each file
                 */
-               function delete_file( $path, $values )
+               function delete_file($path, $values )
                {
                        $receipt = array();
 
-                       foreach ($values['file_action'] as $file_name)
+                       foreach ($values['file_action'] as $file_id)
                        {
-                               $file_name = html_entity_decode($file_name);
-                               $file_name = 
$this->strip_entities_from_name($file_name);
+                               $file_info = $this->vfs->get_info($file_id);
 
-                               $file = "{$this->fakebase}{$path}{$file_name}";
+                               $check_path = trim("{$this->fakebase}{$path}", 
"/");
 
+                               $file = 
"{$file_info['directory']}/{$file_info['name']}";
+
+                               if($check_path != trim($file_info['directory'], 
"/"))
+                               {
+                                       phpgwapi_cache::message_set( "deleting 
file from wrong location", 'error');
+                                       return false;
+                               }
+
                                if ($this->vfs->file_exists(array(
-                                       'string' => $file,
-                                       'relatives' => array(RELATIVE_NONE)
-                               )))
+                                               'string' => $file,
+                                               'relatives' => 
array(RELATIVE_NONE)
+                                       )))
                                {
                                        $this->vfs->override_acl = 1;
 
                                        if (!$this->vfs->rm(array(
-                                               'string' => $file,
-                                               'relatives' => array(
-                                                       RELATIVE_NONE
-                                               )
-                                       )))
+                                                       'string' => $file,
+                                                       'relatives' => array(
+                                                               RELATIVE_NONE
+                                                       )
+                                               )))
                                        {
-                                               $receipt['error'][] = 
array('msg' => lang('failed to delete file') . ' :' . $this->fakebase . $path . 
$file_name);
+                                               
phpgwapi_cache::message_set(lang('failed to delete file') . ' :' .$file, 
'error');
                                        }
                                        else
                                        {
-                                               $receipt['message'][] = 
array('msg' => lang('file deleted') . ' :' . $this->fakebase . $path . 
$file_name);
+                                               
phpgwapi_cache::message_set(lang('file deleted') . ' :' . $file, 'message');
                                        }
                                        $this->vfs->override_acl = 0;
                                }
@@ -190,6 +197,52 @@
                /**
                 * View File - echo (or download) to browser.
                 *
+                * @param intenger $file_id
+                *
+                * @return null
+                */
+               function get_file( $file_id, $jasper = false )
+               {
+                       $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+
+                       if (!$jasper)
+                       {
+                               $this->vfs->override_acl = 1;
+
+                               $document = $this->vfs->get($file_id);
+
+                               $this->vfs->override_acl = 0;
+                               $browser = CreateObject('phpgwapi.browser');
+                               $browser->content_header($document['name'], 
$document['mime_type'], $document['size']);
+                               echo $document['content'];
+                       }
+                       else //Execute the jasper report
+                       {
+                               $output_type = 'PDF';
+                               $file_info = $this->vfs->get_info($file_id);
+                               $file = 
"{$file_info['directory']}/{$file_info['name']}";
+
+                               $report_source = "{$this->rootdir}{$file}";
+                               $jasper_wrapper = 
CreateObject('phpgwapi.jasper_wrapper');
+                               try
+                               {
+                                       $jasper_wrapper->execute('', 
$output_type, $report_source);
+                               }
+                               catch (Exception $e)
+                               {
+                                       $error = $e->getMessage();
+                                       //FIXME Do something clever with the 
error
+                                       echo "<H1>{$error}</H1>";
+                               }
+                       }
+               }
+
+               /**
+                * View File - echo (or download) to browser.
+                *
                 * @param string $type part of path where to look for files
                 * @param string $file optional filename
                 *
@@ -216,9 +269,9 @@
                        }
 
                        if ($this->vfs->file_exists(array(
-                               'string' => $file,
-                               'relatives' => array(RELATIVE_NONE)
-                       )))
+                                       'string' => $file,
+                                       'relatives' => array(RELATIVE_NONE)
+                               )))
                        {
                                $ls_array = $this->vfs->ls(array(
                                        'string' => $file,
@@ -269,34 +322,28 @@
                 *
                 * @return array Array with filecontent
                 */
-               function get_attachments( $path, $values )
+               function get_attachments( $values )
                {
-                       $mime_magic = createObject('phpgwapi.mime_magic');
                        $attachments = array();
-                       foreach ($values as $file_name)
+                       foreach ($values as $file_id)
                        {
-                               $file_name = 
$this->strip_entities_from_name($file_name);
-                               $file = "{$this->fakebase}{$path}{$file_name}";
+                               $file_info = $this->vfs->get_info($file_id);
 
-                               if ($this->vfs->file_exists(array(
-                                       'string' => $file,
-                                       'relatives' => array(RELATIVE_NONE))))
-                               {
-                                       $mime = 
$mime_magic->filename2mime($file_name);
+                               $file = 
"{$file_info['directory']}/{$file_info['name']}";
 
-                                       $attachments[] = array
-                                               (
-                                               'file' => 
"{$GLOBALS['phpgw_info']['server']['files_dir']}{$file}",
-                                               'name' => $file_name,
-                                               'type' => $mime
-                                       );
-                               }
+                               $attachments[] = array
+                                       (
+                                       'file' => 
"{$GLOBALS['phpgw_info']['server']['files_dir']}{$file}",
+                                       'name' => $file_info['name'],
+                                       'type' => $file_info['mime_type']
+                               );
                        }
                        return $attachments;
                }
 
-               function strip_entities_from_name($file_name)
+               function strip_entities_from_name( $file_name )
                {
-                       return str_replace(array('&#40;', 
'&#41;','&#8722;&#8722;'),array('(', ')', '--'), $file_name);
+                       return str_replace(array('&#40;', '&#41;', 
'&#8722;&#8722;'), array('(', ')',
+                               '--'), $file_name);
                }
        }
\ No newline at end of file

Modified: branches/dev-syncromind/property/inc/class.uiagreement.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiagreement.inc.php      
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uiagreement.inc.php      
2016-04-11 12:47:32 UTC (rev 14914)
@@ -172,8 +172,7 @@
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('agreement');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                private function _get_Filters()
@@ -1427,8 +1426,8 @@
 
                        for ($z = 0; $z < count($agreement['files']); $z++)
                        {
-                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_name=' . $agreement['files'][$z]['file_name'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$agreement['files'][$z]['name'] . '</a>';
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$agreement['files'][$z]['name'] . '" title="' . lang('Check to delete file') . 
'">';
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $agreement['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$agreement['files'][$z]['name'] . '</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$agreement['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') 
. '">';
                        }
 
                        $myColumnDefs2 = array
@@ -2232,14 +2231,7 @@
 
                        for ($z = 0; $z < count($agreement['files']); $z++)
                        {
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $agreement['files'][$z]['directory'] . '/' . 
$agreement['files'][$z]['file_name'] . '" target="_blank" title="' . 
lang('click to view file') . '">' . $agreement['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$agreement['files'][$z]['file_name'] . '" target="_blank" title="' . 
lang('click to view file') . '">' . $agreement['files'][$z]['name'] . '</a>';
-                               }
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $agreement['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$agreement['files'][$z]['name'] . '</a>';
                        }
 
                        $myColumnDefs2 = array

Modified: branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php       
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uicondition_survey.inc.php       
2016-04-11 12:47:32 UTC (rev 14914)
@@ -24,7 +24,7 @@
         * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
         * @package property
         * @subpackage logistic
-        * @version $Id$
+        * @version $Id$
         */
        phpgw::import_class('phpgwapi.uicommon_jquery');
        phpgw::import_class('phpgwapi.jquery');
@@ -76,7 +76,7 @@
 
                public function download()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                $this->bocommon->no_access();
                                return;
@@ -92,7 +92,7 @@
                        $columns[] = 'address';
                        $columns[] = 'cnt';
 
-                       foreach ($columns as $_column)
+                       foreach ($columns as $_column)
                        {
                                $descr[] = lang(str_replace('_', ' ', 
$_column));
                        }
@@ -106,13 +106,13 @@
                 */
                public function index()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                $this->bocommon->no_access();
                                return;
                        }
 
-                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
                        {
                                return $this->query();
                        }
@@ -140,7 +140,7 @@
                                                'phpgw_return_as' => 'json')),
                                        'download' => 
self::link(array('menuaction' => 'property.uicondition_survey.download',
                                                'export' => true, 'allrows' => 
true)),
-                                       'new_item'      => 
self::link(array('menuaction' => 'property.uicondition_survey.add')),
+                                       'new_item' => 
self::link(array('menuaction' => 'property.uicondition_survey.add')),
                                        'allrows' => true,
                                        'editor_action' => 
self::link(array('menuaction' => 
'property.uicondition_survey.edit_survey_title')),
                                        'field' => array(
@@ -245,7 +245,7 @@
                        );
 
 
-                       if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
                        {
                                $data['datatable']['actions'][] = array
                                        (
@@ -260,7 +260,7 @@
                                );
                        }
 
-                       if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
                        {
                                $data['datatable']['actions'][] = array
                                        (
@@ -303,7 +303,7 @@
                        $result_count = 0;
 
                        $values = $this->bo->read($params);
-                       if (phpgw::get_var('export', 'bool'))
+                       if (phpgw::get_var('export', 'bool'))
                        {
                                return $values;
                        }
@@ -320,7 +320,7 @@
 
                public function view()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                $this->bocommon->no_access();
                                return;
@@ -342,19 +342,19 @@
                 *
                 * @return void
                 */
-               public function edit( $values = array(), $mode = 'edit' )
+               public function edit( $values = array(), $mode = 'edit' )
                {
                        $id = isset($values['id']) && $values['id'] ? 
$values['id'] : phpgw::get_var('id', 'int');
 
-                       if (!$this->acl_add && !$this->acl_edit)
+                       if (!$this->acl_add && !$this->acl_edit)
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.view',
                                        'id' => $id));
                        }
 
-                       if ($mode == 'view')
+                       if ($mode == 'view')
                        {
-                               if (!$this->acl_read)
+                               if (!$this->acl_read)
                                {
                                        $this->bocommon->no_access();
                                        return;
@@ -362,7 +362,7 @@
                        }
                        else
                        {
-                               if (!$this->acl_add && !$this->acl_edit)
+                               if (!$this->acl_add && !$this->acl_edit)
                                {
                                        $this->bocommon->no_access();
                                        return;
@@ -382,9 +382,9 @@
                                'disable' => 1);
                        $tabs['import'] = array('label' => lang('import'), 
'link' => "#import", 'disable' => 1);
 
-                       if ($id)
+                       if ($id)
                        {
-                               if ($mode == 'edit')
+                               if ($mode == 'edit')
                                {
                                        $tabs['import']['link'] = '#import';
                                        $tabs['import']['disable'] = 0;
@@ -396,13 +396,13 @@
                                $tabs['summation']['link'] = '#summation';
                                $tabs['summation']['disable'] = 0;
 
-                               if (!$values)
+                               if (!$values)
                                {
                                        $values = 
$this->bo->read_single(array('id' => $id, 'view' => $mode == 'view'));
                                }
                        }
 
-                       if (isset($values['location_code']) && 
$values['location_code'])
+                       if (isset($values['location_code']) && 
$values['location_code'])
                        {
                                $values['location_data'] = 
execMethod('property.solocation.read_single', $values['location_code']);
                        }
@@ -438,7 +438,7 @@
                                (
                                'container' => 'datatable-container_0',
                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_files',
-                                       'id' => $id, 'phpgw_return_as' => 
'json'))),
+                                               'id' => $id, 'phpgw_return_as' 
=> 'json'))),
                                'ColumnDefs' => $file_def,
                                'config' => array(
                                        array('disableFilter' => true),
@@ -472,11 +472,11 @@
                                (
                                'container' => 'datatable-container_1',
                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_request',
-                                       'id' => $id, 'phpgw_return_as' => 
'json'))),
-                               'ColumnDefs' => $related_def,
-                               'config' => array(
-                                       array('allrows' => true),
-                               )
+                                               'id' => $id, 'phpgw_return_as' 
=> 'json'))),
+                               'ColumnDefs' => $related_def,
+                               'config' => array(
+                                       array('allrows' => true),
+                               )
                        );
 
                        $summation_def = array
@@ -503,7 +503,7 @@
                                (
                                'container' => 'datatable-container_2',
                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_summation',
-                                       'id' => $id, 'phpgw_return_as' => 
'json'))),
+                                               'id' => $id, 'phpgw_return_as' 
=> 'json'))),
                                'ColumnDefs' => $summation_def,
                                'config' => array(
                                        array('disableFilter' => true),
@@ -533,7 +533,7 @@
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');
 
-                       if ($mode == 'edit')
+                       if ($mode == 'edit')
                        {
                                
$GLOBALS['phpgw']->jqcal->add_listener('report_date');
                                phpgwapi_jquery::load_widget('core');
@@ -560,14 +560,14 @@
                 */
                public function save()
                {
-                       if (!$_POST)
+                       if (!$_POST)
                        {
-                               return  $this->edit();
+                               return $this->edit();
                        }
 
                        $id = (int)phpgw::get_var('id');
 
-                       if ($id)
+                       if ($id)
                        {
                                $values = $this->bo->read_single(array('id' => 
$id, 'view' => true));
                        }
@@ -581,7 +581,7 @@
                         */
                        $values = $this->_populate($values);
 
-                       if ($this->receipt['error'])
+                       if ($this->receipt['error'])
                        {
                                $this->edit($values);
                        }
@@ -592,9 +592,9 @@
                                {
                                        $id = $this->bo->save($values);
                                }
-                               catch (Exception $e)
+                               catch (Exception $e)
                                {
-                                       if ($e)
+                                       if ($e)
                                        {
                                                
phpgwapi_cache::message_set($e->getMessage(), 'error');
                                                $this->edit($values);
@@ -603,14 +603,14 @@
                                }
 
                                $this->_handle_files($id);
-                               if ($_FILES['import_file']['tmp_name'])
+                               if ($_FILES['import_file']['tmp_name'])
                                {
                                        $this->_handle_import($id);
                                }
                                else
                                {
                                        phpgwapi_cache::message_set('ok!', 
'message');
-                                       self::redirect(array('menuaction' => 
'property.uicondition_survey.edit',
+                                       self::redirect(array('menuaction' => 
'property.uicondition_survey.edit',
                                                'id' => $id));
                                }
                        }
@@ -627,7 +627,7 @@
                {
                        $id = phpgw::get_var('id', 'int', 'REQUEST');
 
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return;
                        }
@@ -658,7 +658,7 @@
 
                        $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? 
(int)$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
 
-                       if ($allrows)
+                       if ($allrows)
                        {
                                $out = $files;
                        }
@@ -677,12 +677,12 @@
                        $lang_delete = lang('click to delete file');
 
                        $values = array();
-                       foreach ($out as $_entry)
+                       foreach ($out as $_entry)
                        {
                                $values[] = array
                                        (
-                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_name={$_entry['name']}' target='_blank' 
title='{$lang_view}'>{$_entry['name']}</a>",
-                                       'delete_file' => "<input 
type='checkbox' name='file_action[]' value='{$_entry['name']}' 
title='$lang_delete'>",
+                                       'file_name' => "<a 
href='{$link_view_file}&amp;file_id={$_entry['file_id']}' target='_blank' 
title='{$lang_view}'>{$_entry['name']}</a>",
+                                       'delete_file' => "<input 
type='checkbox' name='file_action[]' value='{$_entry['file_id']}' 
title='$lang_delete'>",
                                );
                        }
 
@@ -700,7 +700,7 @@
                        $id = phpgw::get_var('id', 'int', 'REQUEST');
                        $year = phpgw::get_var('year', 'int', 'REQUEST');
 
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return;
                        }
@@ -715,7 +715,7 @@
                        $allrows = true;
                        $num_rows = $total_records;
 
-                       if ($allrows)
+                       if ($allrows)
                        {
                                $out = $values;
                        }
@@ -738,33 +738,33 @@
                {
                        $id = phpgw::get_var('id', 'int', 'REQUEST');
 
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return;
                        }
 
                        $borequest = CreateObject('property.borequest');
 
-                       $search = phpgw::get_var('search');
-                       $order = phpgw::get_var('order');
-                       $draw = phpgw::get_var('draw', 'int');
-                       $columns = phpgw::get_var('columns');
-
-                       $params = array(
+                       $search = phpgw::get_var('search');
+                       $order = phpgw::get_var('order');
+                       $draw = phpgw::get_var('draw', 'int');
+                       $columns = phpgw::get_var('columns');
+
+                       $params = array(
                                'condition_survey_id' => $id,
-                               'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
-                               'results' => phpgw::get_var('length', 'int', 
'REQUEST', 0),
-                               'query' => $search['value'],
-                               'order' => 
$columns[$order[0]['column']]['data'],
-                               'sort' => $order[0]['dir'],
-                               'allrows' => phpgw::get_var('length', 'int') == 
-1,
+                               'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('length', 'int', 
'REQUEST', 0),
+                               'query' => $search['value'],
+                               'order' => 
$columns[$order[0]['column']]['data'],
+                               'sort' => $order[0]['dir'],
+                               'allrows' => phpgw::get_var('length', 'int') == 
-1,
                        );
 
-                       $values = $borequest->read_survey_data($params);
+                       $values = $borequest->read_survey_data($params);
                        $total_records = $borequest->total_records;
 
                        $base_url = self::link(array('menuaction' => 
'property.uirequest.edit'));
-                       foreach ($values as &$_entry)
+                       foreach ($values as &$_entry)
                        {
                                $_entry['url'] = "<a 
href=\"{$base_url}&id={$_entry['id']}\" >{$_entry['id']}</a>";
                        }
@@ -788,13 +788,11 @@
                 */
                function view_file()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return lang('no access');
                        }
-
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('condition_survey');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                /**
@@ -804,34 +802,34 @@
                 *
                 * @return void
                 */
-               private function _handle_files( $id )
+               private function _handle_files( $id )
                {
                        $id = (int)$id;
-                       if (!$id)
+                       if (!$id)
                        {
                                throw new 
Exception('uicondition_survey::_handle_files() - missing id');
                        }
                        $bofiles = CreateObject('property.bofiles');
 
-                       if (isset($_POST['file_action']) && 
is_array($_POST['file_action']))
+                       if (isset($_POST['file_action']) && 
is_array($_POST['file_action']))
                        {
-                               
$bofiles->delete_file("/condition_survey/{$id}/", array('file_action' => 
$_POST['file_action']));
+                               
$bofiles->delete_file("/condition_survey/{$id}/",array('file_action' => 
$_POST['file_action']));
                        }
                        $file_name = str_replace(' ', '_', 
$_FILES['file']['name']);
 
-                       if ($file_name)
+                       if ($file_name)
                        {
-                               if (!is_file($_FILES['file']['tmp_name']))
+                               if (!is_file($_FILES['file']['tmp_name']))
                                {
                                        
phpgwapi_cache::message_set(lang('Failed to upload file !'), 'error');
                                        return;
                                }
 
                                $to_file = $bofiles->fakebase . 
'/condition_survey/' . $id . '/' . $file_name;
-                               if ($bofiles->vfs->file_exists(array(
-                                       'string' => $to_file,
-                                       'relatives' => Array(RELATIVE_NONE)
-                               )))
+                               if ($bofiles->vfs->file_exists(array(
+                                               'string' => $to_file,
+                                               'relatives' => 
Array(RELATIVE_NONE)
+                                       )))
                                {
                                        phpgwapi_cache::message_set(lang('This 
file already exists !'), 'error');
                                }
@@ -840,10 +838,10 @@
                                        
$bofiles->create_document_dir("condition_survey/{$id}");
                                        $bofiles->vfs->override_acl = 1;
 
-                                       if (!$bofiles->vfs->cp(array(
-                                               'from' => 
$_FILES['file']['tmp_name'],
-                                               'to' => $to_file,
-                                               'relatives' => 
array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL))))
+                                       if (!$bofiles->vfs->cp(array(
+                                                       'from' => 
$_FILES['file']['tmp_name'],
+                                                       'to' => $to_file,
+                                                       'relatives' => 
array(RELATIVE_NONE | VFS_REAL, RELATIVE_ALL))))
                                        {
                                                
phpgwapi_cache::message_set(lang('Failed to upload file !'), 'error');
                                        }
@@ -865,23 +863,23 @@
                 *
                 * @return void
                 */
-               private function _handle_import( $id )
+               private function _handle_import( $id )
                {
                        $id = (int)$id;
-                       if (!$id)
+                       if (!$id)
                        {
                                throw new 
Exception('uicondition_survey::_handle_import() - missing id');
                        }
-                       phpgwapi_jquery::formvalidator_generate(array('file'));
+                       phpgwapi_jquery::formvalidator_generate(array('file'));
 
                        $step = phpgw::get_var('step', 'int', 'REQUEST');
                        $sheet_id = phpgw::get_var('sheet_id', 'int', 
'REQUEST');
 
                        $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'int', 'REQUEST');
 
-                       if (!$step)
+                       if (!$step)
                        {
-                               if ($cached_file = 
phpgwapi_cache::session_get('property', 'condition_survey_import_file'))
+                               if ($cached_file = 
phpgwapi_cache::session_get('property', 'condition_survey_import_file'))
                                {
                                        
phpgwapi_cache::session_clear('property', 'condition_survey_import_file');
                                        unlink($cached_file);
@@ -889,7 +887,7 @@
                                }
                        }
 
-                       if ($start_line = phpgw::get_var('start_line', 'int', 
'REQUEST'))
+                       if ($start_line = phpgw::get_var('start_line', 'int', 
'REQUEST'))
                        {
                                phpgwapi_cache::system_set('property', 
'import_sheet_start_line', $start_line);
                        }
@@ -900,7 +898,7 @@
                        }
 
 
-                       if ($columns = phpgw::get_var('columns'))
+                       if ($columns = phpgw::get_var('columns'))
                        {
                                phpgwapi_cache::system_set('property', 
'import_sheet_columns', $columns);
                        }
@@ -911,12 +909,12 @@
                        }
 
 
-                       if ($step > 1)
+                       if ($step > 1)
                        {
                                $cached_file = 
phpgwapi_cache::session_get('property', 'condition_survey_import_file');
                        }
 
-                       if ($step == 1 || 
isset($_FILES['import_file']['tmp_name']))
+                       if ($step == 1 || 
isset($_FILES['import_file']['tmp_name']))
                        {
                                $file = $_FILES['import_file']['tmp_name'];
                                $cached_file = "{$file}_temporary_import_file";
@@ -934,7 +932,7 @@
                                        'relatives' => array(
                                                RELATIVE_NONE
                                        )
-                               )
+                                       )
                                );
 
                                
$bofiles->create_document_dir("condition_survey/{$id}");
@@ -950,15 +948,15 @@
 
                        $tabs = array();
 
-                       switch ($step)
+                       switch ($step)
                        {
                                case 0:
                                        $active_tab = 'step_1';
                                        $lang_submit = lang('continue');
                                        $tabs['step_1'] = array('label' => 
lang('choose file'), 'link' => '#step_1');
-                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => null, 'disable' => true);
-                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null, 'disable' => true);
-                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
+                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => null, 'disable' => true);
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null, 'disable' => true);
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
                                        break;
                                case 1:
                                        $active_tab = 'step_2';
@@ -967,8 +965,8 @@
                                                        'menuaction' => 
'property.uicondition_survey.import', 'id' => $id, 'step' => 0,
                                                        'sheet_id' => 
$sheet_id, 'start_line' => $start_line)));
                                        $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => '#step_2');
-                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null, 'disable' => true);
-                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null, 'disable' => true);
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
                                        break;
                                case 2:
                                        $active_tab = 'step_3';
@@ -980,7 +978,7 @@
                                                        'menuaction' => 
'property.uicondition_survey.import', 'id' => $id, 'step' => 1,
                                                        'sheet_id' => 
$sheet_id, 'start_line' => $start_line)));
                                        $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => '#step_3');
-                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null, 'disable' => true);
                                        break;
                                case 3:
                                        $active_tab = 'step_4';
@@ -1007,12 +1005,12 @@
 
 //-----------
 
-                       if (!$step)
+                       if (!$step)
                        {
                                phpgwapi_cache::session_clear('property', 
'condition_survey_import_file');
                                unlink($cached_file);
                        }
-                       else if ($cached_file)
+                       else if ($cached_file)
                        {
                                phpgw::import_class('phpgwapi.phpexcel');
 
@@ -1022,9 +1020,9 @@
                                        $AllSheets = 
$objPHPExcel->getSheetNames();
 
                                        $sheets = array();
-                                       if ($AllSheets)
+                                       if ($AllSheets)
                                        {
-                                               foreach ($AllSheets as $key => 
$sheet)
+                                               foreach ($AllSheets as $key => 
$sheet)
                                                        $sheets[] = array
                                                                (
                                                                'id' => $key,
@@ -1034,13 +1032,13 @@
                                        }
 
                                        
$objPHPExcel->setActiveSheetIndex((int)$sheet_id);
-                                       $rows = 
$objPHPExcel->getActiveSheet()->getHighestDataRow();
-                                       $highestColumm = 
$objPHPExcel->getActiveSheet()->getHighestDataColumn();
-                                       $highestColumnIndex = 
PHPExcel_Cell::columnIndexFromString($highestColumm);
+                                       $rows = 
$objPHPExcel->getActiveSheet()->getHighestDataRow();
+                                       $highestColumm = 
$objPHPExcel->getActiveSheet()->getHighestDataColumn();
+                                       $highestColumnIndex = 
PHPExcel_Cell::columnIndexFromString($highestColumm);
                                }
-                               catch (Exception $e)
+                               catch (Exception $e)
                                {
-                                       if ($e)
+                                       if ($e)
                                        {
                                                
phpgwapi_cache::message_set($e->getMessage(), 'error');
                                                
phpgwapi_cache::session_clear('property', 'condition_survey_import_file');
@@ -1052,20 +1050,20 @@
                        $survey = $this->bo->read_single(array('id' => $id, 
'view' => $mode == 'view'));
 
                        $i = 0;
-                       $html_table = '<table class="pure-table 
pure-table-bordered">';
-                       if ($rows > 1 && $step == 2)
+                       $html_table = '<table class="pure-table 
pure-table-bordered">';
+                       if ($rows > 1 && $step == 2)
                        {
 
                                $cols = array();
-                               for ($j = 0; $j < $highestColumnIndex; $j++)
+                               for ($j = 0; $j < $highestColumnIndex; $j++)
                                {
                                        $cols[] = $this->getexcelcolumnname($j);
                                }
 
-                               $html_table .= "<thead><tr><th align = 
'center'>" . lang('select') . "</th><th align = 'center'>" . lang('row') . 
"</th><th align='center'>" . implode("</th><th align='center'>", $cols) . 
'</th></tr></thead>';
-                               foreach 
($objPHPExcel->getActiveSheet()->getRowIterator() as $row)
+                               $html_table .= "<thead><tr><th align = 
'center'>" . lang('select') . "</th><th align = 'center'>" . lang('row') . 
"</th><th align='center'>" . implode("</th><th align='center'>", $cols) . 
'</th></tr></thead>';
+                               foreach 
($objPHPExcel->getActiveSheet()->getRowIterator() as $row)
                                {
-                                       if ($i > 20)
+                                       if ($i > 20)
                                        {
                                                break;
                                        }
@@ -1073,29 +1071,29 @@
 
                                        $row_key = $i;
                                        $_checked = '';
-                                       if ($start_line == $row_key)
+                                       if ($start_line == $row_key)
                                        {
                                                $_checked = 'checked="checked"';
                                        }
 
-                                       $_radio = "<input id=\"start_line\" 
type =\"radio\" {$_checked} name=\"start_line\" value=\"{$row_key}\">";
+                                       $_radio = "<input id=\"start_line\" 
type =\"radio\" {$_checked} name=\"start_line\" value=\"{$row_key}\">";
 
                                        $cellIterator = $row->getCellIterator();
                                        
$cellIterator->setIterateOnlyExistingCells(false);
 
                                        $row_values = array();
-                                       foreach ($cellIterator as $cell)
+                                       foreach ($cellIterator as $cell)
                                        {
-                                               if (!is_null($cell))
+                                               if (!is_null($cell))
                                                {
                                                        $row_values[] = 
$cell->getCalculatedValue();
                                                }
                                        }
-                                       $html_table .= 
"<tr><td>{$_radio}</td><td>{$row_key}</td><td>" . implode('</td><td>', 
$row_values) . '</td></tr>';
+                                       $html_table .= 
"<tr><td>{$_radio}</td><td>{$row_key}</td><td>" . implode('</td><td>', 
$row_values) . '</td></tr>';
                                }
                                echo '</table>';
                        }
-                       else if ($rows > 1 && $step == 3)
+                       else if ($rows > 1 && $step == 3)
                        {
                                $_options = array
                                        (
@@ -1117,14 +1115,14 @@
                                $custom = 
createObject('phpgwapi.custom_fields');
                                $attributes = $custom->find('property', 
'.project.request', 0, '', '', '', true, true);
 
-                               foreach ($attributes as $attribute)
+                               foreach ($attributes as $attribute)
                                {
                                        
$_options["custom_attribute_{$attribute['id']}"] = $attribute['input_text'];
                                }
 
                                phpgw::import_class('phpgwapi.sbox');
 
-                               for ($j = 0; $j < $highestColumnIndex; $j++)
+                               for ($j = 0; $j < $highestColumnIndex; $j++)
                                {
                                        $_column = 
$this->getexcelcolumnname($j);
                                        $_value = 
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($j, 
$start_line)->getCalculatedValue();
@@ -1134,7 +1132,7 @@
                                        $html_table .= "<tr><td>[{$_column}] 
{$_value}</td><td>{$_listbox}</td><tr>";
                                }
                        }
-                       else if ($rows > 1 && $step == 4)
+                       else if ($rows > 1 && $step == 4)
                        {
 
                                $rows = 
$objPHPExcel->getActiveSheet()->getHighestDataRow();
@@ -1142,28 +1140,28 @@
 
                                $import_data = array();
 
-                               for ($i = $start_line; $i < $rows; $i++)
+                               for ($i = $start_line; $i < $rows; $i++)
                                {
                                        $_result = array();
 
-                                       foreach ($columns as $_row_key => 
$_value_key)
+                                       foreach ($columns as $_row_key => 
$_value_key)
                                        {
-                                               if ($_value_key != 
'_skip_import_')
+                                               if ($_value_key != 
'_skip_import_')
                                                {
                                                        $_result[$_value_key] = 
$objPHPExcel->getActiveSheet()->getCell("{$_row_key}{$i}")->getCalculatedValue();
                                                }
                                        }
                                        $import_data[] = $_result;
                                }
-                               if ($import_data)
+                               if ($import_data)
                                {
                                        try
                                        {
                                                $this->bo->import($survey, 
$import_data);
                                        }
-                                       catch (Exception $e)
+                                       catch (Exception $e)
                                        {
-                                               if ($e)
+                                               if ($e)
                                                {
                                                        
phpgwapi_cache::message_set($e->getMessage(), 'error');
                                                }
@@ -1181,7 +1179,7 @@
 
 
 
-                       if (isset($survey['location_code']) && 
$survey['location_code'])
+                       if (isset($survey['location_code']) && 
$survey['location_code'])
                        {
                                $survey['location_data'] = 
execMethod('property.solocation.read_single', $survey['location_code']);
                        }
@@ -1220,11 +1218,11 @@
                 * @param index : a column index we want to get the value in 
excel column format
                 * @return (string) : excel column format
                 */
-               private function getexcelcolumnname( $index )
+               private function getexcelcolumnname( $index )
                {
                        //Get the quotient : if the index superior to base 26 
max ?
                        $quotient = $index / 26;
-                       if ($quotient >= 1)
+                       if ($quotient >= 1)
                        {
                                //If yes, get top level column + the current 
column code
                                return $this->getexcelcolumnname($quotient - 1) 
. chr(($index % 26) + 65);
@@ -1241,11 +1239,11 @@
                 *
                 * @param string  $query
                 *
-                * @return array 
+                * @return array
                 */
                public function get_users()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return;
                        }
@@ -1255,9 +1253,9 @@
                        $accounts = 
$GLOBALS['phpgw']->accounts->get_list('accounts', $start, $sort, $order, 
$query, $offset);
 
                        $values = array();
-                       foreach ($accounts as $account)
+                       foreach ($accounts as $account)
                        {
-                               if ($account->enabled)
+                               if ($account->enabled)
                                {
                                        $values[] = array
                                                (
@@ -1274,11 +1272,11 @@
                 *
                 * @param string  $query
                 *
-                * @return array 
+                * @return array
                 */
                public function get_vendors()
                {
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                return;
                        }
@@ -1287,7 +1285,7 @@
 
                        $sogeneric = CreateObject('property.sogeneric', 
'vendor');
                        $values = $sogeneric->read(array('query' => $query));
-                       foreach ($values as &$entry)
+                       foreach ($values as &$entry)
                        {
                                $entry['name'] = $entry['org_name'];
                        }
@@ -1306,12 +1304,12 @@
                {
                        $id = phpgw::get_var('id', 'int', 'POST');
 
-                       if (!$this->acl_edit)
+                       if (!$this->acl_edit)
                        {
                                return lang('no access');
                        }
 
-                       if ($id)
+                       if ($id)
                        {
                                $values = $this->bo->read_single(array('id' => 
$id, 'view' => true));
                                $values['title'] = phpgw::get_var('value');
@@ -1320,9 +1318,9 @@
                                {
                                        $this->bo->edit_title($values);
                                }
-                               catch (Exception $e)
+                               catch (Exception $e)
                                {
-                                       if ($e)
+                                       if ($e)
                                        {
                                                echo $e->getMessage();
                                        }
@@ -1344,7 +1342,7 @@
                 */
                public function delete()
                {
-                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
                        {
                                return 'No access';
                        }
@@ -1354,9 +1352,9 @@
                        {
                                $this->bo->delete($id);
                        }
-                       catch (Exception $e)
+                       catch (Exception $e)
                        {
-                               if ($e)
+                               if ($e)
                                {
                                        return $e->getMessage();
                                }
@@ -1373,7 +1371,7 @@
                 */
                public function delete_imported_records()
                {
-                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
+                       if (!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
                        {
                                return 'No access';
                        }
@@ -1383,9 +1381,9 @@
                        {
                                $this->bo->delete_imported_records($id);
                        }
-                       catch (Exception $e)
+                       catch (Exception $e)
                        {
-                               if ($e)
+                               if ($e)
                                {
                                        return $e->getMessage();
                                }
@@ -1402,7 +1400,7 @@
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::project::condition_survey::summation";
 
-                       if (!$this->acl_read)
+                       if (!$this->acl_read)
                        {
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.index'));
                        }
@@ -1430,7 +1428,7 @@
                                'name' => lang('all'),
                        );
 
-                       foreach ($survey_list as $survey)
+                       foreach ($survey_list as $survey)
                        {
                                $surveys[] = array
                                        (
@@ -1446,7 +1444,7 @@
 
                        $years = array();
 
-                       for ($i = 0; $i < 6; $i++)
+                       for ($i = 0; $i < 6; $i++)
                        {
                                $years[] = array
                                        (
@@ -1481,7 +1479,7 @@
                                (
                                'container' => 'datatable-container_0',
                                'requestUrl' => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_summation',
-                                       'id' => $id, 'phpgw_return_as' => 
'json'))),
+                                               'id' => $id, 'phpgw_return_as' 
=> 'json'))),
                                'ColumnDefs' => $summation_def
                        );
 
@@ -1502,7 +1500,7 @@
                 * Overrides with incoming data from POST
                 */
 
-               private function _populate( $data = array() )
+               private function _populate( $data = array() )
                {
                        $insert_record = 
phpgwapi_cache::session_get('property', 'insert_record');
 
@@ -1573,13 +1571,13 @@
                        );
 
 
-                       foreach ($_fields as $_field)
+                       foreach ($_fields as $_field)
                        {
-                               if ($data[$_field['name']] = 
$_POST['values'][$_field['name']])
+                               if ($data[$_field['name']] = 
$_POST['values'][$_field['name']])
                                {
                                        $data[$_field['name']] = 
phpgw::clean_value($data[$_field['name']], $_field['type']);
                                }
-                               if ($_field['required'] && 
!$data[$_field['name']])
+                               if ($_field['required'] && 
!$data[$_field['name']])
                                {
                                        $this->receipt['error'][] = array('msg' 
=> lang('Please enter value for attribute %1', $_field['name']));
                                }
@@ -1589,7 +1587,7 @@
 
                        $values = $this->bocommon->collect_locationdata($data, 
$insert_record);
 
-                       if (!isset($values['location_code']) || 
!$values['location_code'])
+                       if (!isset($values['location_code']) || 
!$values['location_code'])
                        {
                                $this->receipt['error'][] = array('msg' => 
lang('Please select a location !'));
                        }
@@ -1599,28 +1597,28 @@
                         */
                        $values['attributes'] = 
phpgw::get_var('values_attribute');
 
-                       if (is_array($values['attributes']))
+                       if (is_array($values['attributes']))
                        {
-                               foreach ($values['attributes'] as $attribute)
+                               foreach ($values['attributes'] as $attribute)
                                {
-                                       if ($attribute['nullable'] != 1 && 
(!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                       if ($attribute['nullable'] != 1 && 
(!$attribute['value'] && !$values['extra'][$attribute['name']]))
                                        {
                                                $this->receipt['error'][] = 
array('msg' => lang('Please enter value for attribute %1', 
$attribute['input_text']));
                                        }
                                }
                        }
 
-                       if (!isset($values['cat_id']) || !$values['cat_id'])
+                       if (!isset($values['cat_id']) || !$values['cat_id'])
                        {
                                $this->receipt['error'][] = array('msg' => 
lang('Please select a category !'));
                        }
 
-                       if (!isset($values['title']) || !$values['title'])
+                       if (!isset($values['title']) || !$values['title'])
                        {
                                $this->receipt['error'][] = array('msg' => 
lang('Please give a title !'));
                        }
 
-                       if (!isset($values['report_date']) || 
!$values['report_date'])
+                       if (!isset($values['report_date']) || 
!$values['report_date'])
                        {
                                $this->receipt['error'][] = array('msg' => 
lang('Please select a date!'));
                        }
@@ -1628,7 +1626,7 @@
                        return $values;
                }
 
-               private function _get_categories( $selected = 0 )
+               private function _get_categories( $selected = 0 )
                {
                        $cats = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
                        $cats->supress_info = true;
@@ -1637,7 +1635,7 @@
                        $default_value = array('cat_id' => '', 'name' => 
lang('no category'));
                        array_unshift($categories['cat_list'], $default_value);
 
-                       foreach ($categories['cat_list'] as & $_category)
+                       foreach ($categories['cat_list'] as & $_category)
                        {
                                $_category['id'] = $_category['cat_id'];
                        }

Modified: branches/dev-syncromind/property/inc/class.uientity.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uientity.inc.php 2016-04-11 
12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uientity.inc.php 2016-04-11 
12:47:32 UTC (rev 14914)
@@ -277,13 +277,13 @@
                        $bofiles = CreateObject('property.bofiles');
                        if (isset($values['file_action']) && 
is_array($values['file_action']))
                        {
-                               
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
+                               
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/" ,$values);
                        }
 
                        if (isset($values['file_jasperaction']) && 
is_array($values['file_jasperaction']))
                        {
                                $values['file_action'] = 
$values['file_jasperaction'];
-                               
$bofiles->delete_file("/{$this->category_dir}/{$loc1}/{$id}/", $values);
+                               
$bofiles->delete_file("{$this->category_dir}/{$loc1}/{$id}/" ,$values);
                        }
 
                        $files = array();
@@ -953,8 +953,8 @@
                        {
                                $content_files[] = array
                                        (
-                                       'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . '&amp;file_name=' . 
urlencode($_entry['name']) . '" target="_blank" title="' . lang('click to view 
file') . '">' . $_entry['name'] . '</a>',
-                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="' . $_entry['name'] . '" 
title="' . lang('Check to delete file') . '">'
+                                       'file_name' => '<a href="' . 
$GLOBALS['phpgw']->link('/index.php', $link_file_data) . '&amp;file_id=' . 
$_entry['file_id'] . '" target="_blank" title="' . lang('click to view file') . 
'">' . $_entry['name'] . '</a>',
+                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '" 
title="' . lang('Check to delete file') . '">'
                                );
                        }
 
@@ -1051,17 +1051,11 @@
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
-                       $file_name = urldecode(phpgw::get_var('file_name'));
-                       $loc1 = phpgw::get_var('loc1', 'string', 'REQUEST', 
'dummy');
-                       if ($this->type_app[$this->type] == 'catch')
-                       {
-                               $loc1 = 'dummy';
-                       }
-                       $id = phpgw::get_var('id', 'int');
+                       $file_id = phpgw::get_var('file_id', 'int');
                        $jasper = phpgw::get_var('jasper', 'bool');
 
                        $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file("{$this->category_dir}/{$loc1}", 
'', $jasper);
+                       $bofiles->get_file($file_id, $jasper);
                }
 
                function index()

Modified: branches/dev-syncromind/property/inc/class.uiproject.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uiproject.inc.php        
2016-04-11 12:47:32 UTC (rev 14914)
@@ -160,8 +160,7 @@
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('project');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                function columns()
@@ -1835,8 +1834,6 @@
                                'id' => $id
                        );
 
-                       $link_to_files = 
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] : 
'');
-
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
 
                        $_files = $this->bo->get_files($id);
@@ -1847,15 +1844,8 @@
                        $content_files = array();
                        foreach ($_files as $_file)
                        {
-                               if ($link_to_files)
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href='{$link_to_files}/{$_file['directory']}/{$_file['file_name']}' 
target=\"_blank\" title='{$lang_view_file}'>{$_file['name']}</a>";
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href=\"{$link_view_file}&amp;file_name={$_file['file_name']}\" 
target=\"_blank\" title=\"{$lang_view_file}\">{$_file['name']}</a>";
-                               }
-                               $content_files[$z]['delete_file'] = "<input 
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\" 
title=\"{$lang_delete_file}\">";
+                               $content_files[$z]['file_name'] = "<a 
href=\"{$link_view_file}&amp;file_id={$_file['file_id']}\" target=\"_blank\" 
title=\"{$lang_view_file}\">{$_file['name']}</a>";
+                               $content_files[$z]['delete_file'] = "<input 
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['file_id']}\" 
title=\"{$lang_delete_file}\">";
                                $z++;
                        }
 

Modified: branches/dev-syncromind/property/inc/class.uirequest.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uirequest.inc.php        
2016-04-11 12:47:32 UTC (rev 14914)
@@ -580,10 +580,7 @@
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
-                       $location_code = phpgw::get_var('location_code');
-
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('request');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                function download()
@@ -1316,7 +1313,6 @@
                                'id' => $id
                        );
 
-                       $link_to_files = 
$this->config->config_data['files_url'];
 
                        $j = count($values['files']);
                        for ($i = 0; $i < $j; $i++)
@@ -1351,15 +1347,8 @@
 
                        for ($z = 0; $z < count($values['files']); $z++)
                        {
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') . '" 
>';
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $values['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$values['files'][$z]['name'] . '</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') . 
'" >';
                        }
 
                        $datatable_def[] = array

Modified: branches/dev-syncromind/property/inc/class.uis_agreement.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uis_agreement.inc.php    
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uis_agreement.inc.php    
2016-04-11 12:47:32 UTC (rev 14914)
@@ -174,8 +174,7 @@
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('service_agreement');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                private function _get_Filters()
@@ -977,7 +976,6 @@
                        phpgwapi_jquery::load_widget('core');
 //                     $active_tab             = phpgw::get_var('tab', 
'string', 'REQUEST', 'general');
 
-                       $config = CreateObject('phpgwapi.config', 'property');
                        $boalarm = CreateObject('property.boalarm');
                        $get_items = false;
 
@@ -1083,8 +1081,6 @@
                                'id' => $id
                        );
 
-                       $config->read();
-                       $link_to_files = $config->config_data['files_url'];
 
                        $j = count($values['files']);
                        for ($i = 0; $i < $j; $i++)
@@ -1302,15 +1298,8 @@
 
                        for ($z = 0; $z < count($values['files']); $z++)
                        {
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') . 
'">';
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $values['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$values['files'][$z]['name'] . '</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') . 
'">';
                        }
 
                        $myColumnDefs2 = array
@@ -2247,7 +2236,6 @@
                        }
 
                        $s_agreement_id = phpgw::get_var('id'); // in case of 
bigint
-                       $config = CreateObject('phpgwapi.config', 'property');
 
                        $tabs = array();
                        $tabs['general'] = array('label' => lang('general'), 
'link' => '#general');
@@ -2326,10 +2314,6 @@
                                'id' => $s_agreement_id
                        );
 
-
-                       $config->read();
-                       $link_to_files = $config->config_data['files_url'];
-
                        $j = count($s_agreement['files']);
                        for ($i = 0; $i < $j; $i++)
                        {
@@ -2450,14 +2434,7 @@
 
                        for ($z = 0; $z < count($s_agreement['files']); $z++)
                        {
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $s_agreement['files'][$z]['directory'] . '/' . 
$s_agreement['files'][$z]['file_name'] . '" target="_blank" title="' . 
lang('click to view file') . '">' . $s_agreement['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$s_agreement['files'][$z]['file_name'] . '" target="_blank" title="' . 
lang('click to view file') . '">' . $s_agreement['files'][$z]['name'] . '</a>';
-                               }
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $s_agreement['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$s_agreement['files'][$z]['name'] . '</a>';
                        }
 
                        $myColumnDefs2 = array

Modified: branches/dev-syncromind/property/inc/class.uitenant_claim.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitenant_claim.inc.php   
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uitenant_claim.inc.php   
2016-04-11 12:47:32 UTC (rev 14914)
@@ -108,8 +108,7 @@
                                $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uilocation.stop',
                                        'perm' => PHPGW_ACL_READ, 
'acl_location' => $this->acl_location));
                        }
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('tenant_claim');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                private function _get_filter_tenant()
@@ -751,8 +750,6 @@
                                'id' => $claim_id
                        );
 
-                       $link_to_files = 
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] : 
'');
-
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
 
                        $_files = $this->bo->get_files($claim_id);
@@ -763,15 +760,8 @@
                        $content_files = array();
                        foreach ($_files as $_file)
                        {
-                               if ($link_to_files)
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href='{$link_to_files}/{$_file['directory']}/{$_file['file_name']}' 
target=\"_blank\" title='{$lang_view_file}'>{$_file['name']}</a>";
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href=\"{$link_view_file}&amp;file_name={$_file['file_name']}\" 
target=\"_blank\" title=\"{$lang_view_file}\">{$_file['name']}</a>";
-                               }
-                               $content_files[$z]['delete_file'] = "<input 
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\" 
title=\"{$lang_delete_file}\">";
+                               $content_files[$z]['file_name'] = "<a 
href=\"{$link_view_file}&amp;file_id={$_file['file_id']}\" target=\"_blank\" 
title=\"{$lang_view_file}\">{$_file['name']}</a>";
+                               $content_files[$z]['delete_file'] = "<input 
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['file_id']}\" 
title=\"{$lang_delete_file}\">";
                                $z++;
                        }
 

Modified: branches/dev-syncromind/property/inc/class.uitts.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uitts.inc.php    2016-04-11 
12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uitts.inc.php    2016-04-11 
12:47:32 UTC (rev 14914)
@@ -1467,10 +1467,8 @@
                        $link_file_data = array
                                (
                                'menuaction' => 'property.uitts.view_file',
-                               'id' => $id
                        );
 
-                       $link_to_files = 
isset($this->bo->config->config_data['files_url']) ? 
$this->bo->config->config_data['files_url'] : '';
 
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
                        $values = $this->bo->read_single($id);
@@ -1481,9 +1479,9 @@
                        {
                                $content_files[] = array
                                        (
-                                       'file_name' => '<a href="' . 
$link_view_file . '&amp;file_name=' . $_entry['name'] . '" target="_blank" 
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
-                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="' . $_entry['name'] . '" 
title="' . lang('Check to delete file') . '">',
-                                       'attach_file' => '<input 
type="checkbox" name="values[file_attach][]" value="' . $_entry['name'] . '" 
title="' . lang('Check to attach file') . '">'
+                                       'file_name' => '<a href="' . 
$link_view_file . '&amp;file_id=' . $_entry['file_id'] . '" target="_blank" 
title="' . lang('click to view file') . '">' . $_entry['name'] . '</a>',
+                                       'delete_file' => '<input 
type="checkbox" name="values[file_action][]" value="' . $_entry['file_id'] . '" 
title="' . lang('Check to delete file') . '">',
+                                       'attach_file' => '<input 
type="checkbox" name="values[file_attach][]" value="' . $_entry['file_id'] . '" 
title="' . lang('Check to attach file') . '">'
                                );
                        }
 
@@ -2103,8 +2101,13 @@
                                if (isset($values['file_attach']) && 
is_array($values['file_attach']))
                                {
                                        $bofiles = 
CreateObject('property.bofiles');
-                                       $attachments = 
$bofiles->get_attachments("/fmticket/{$id}/", $values['file_attach']);
-                                       $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ', $values['file_attach']);
+                                       $attachments = 
$bofiles->get_attachments($values['file_attach']);
+                                       $_attachment_log = array();
+                                       foreach ($attachments as $_attachment)
+                                       {
+                                               $_attachment_log[] = 
$_attachment['name'];
+                                       }
+                                       $attachment_log = ' ' . 
lang('attachments') . ' : ' . implode(', ', $_attachment_log);
                                }
 
                                if (isset($values['send_order_format']) && 
$values['send_order_format'] == 'pdf')
@@ -2340,22 +2343,14 @@
                                )
                        );
 
-                       $link_to_files = 
(isset($this->bo->config->config_data['files_url']) ? 
$this->bo->config->config_data['files_url'] : '');
 
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
 
                        for ($z = 0; $z < count($ticket['files']); $z++)
                        {
-                               if ($link_to_files != '')
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $ticket['files'][$z]['directory'] . '/' . 
$ticket['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $ticket['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$ticket['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $ticket['files'][$z]['name'] . '</a>';
-                               }
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$ticket['files'][$z]['name'] . '" title="' . lang('Check to delete file') . 
'">';
-                               $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" value="' . 
$ticket['files'][$z]['name'] . '" title="' . lang('Check to attach file') . 
'">';
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $ticket['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$ticket['files'][$z]['name'] . '</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') . 
'">';
+                               $content_files[$z]['attach_file'] = '<input 
type="checkbox" name="values[file_attach][]" value="' . 
$ticket['files'][$z]['file_id'] . '" title="' . lang('Check to attach file') . 
'">';
                        }
 
 
@@ -2665,8 +2660,7 @@
                                        'perm' => 1, 'acl_location' => 
$this->acl_location));
                        }
 
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('fmticket');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                protected function _generate_tabs( $history = '' )

Modified: branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php        
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uiwo_hour.inc.php        
2016-04-11 12:47:32 UTC (rev 14914)
@@ -1433,9 +1433,15 @@
                                        if (isset($values['file_action']) && 
is_array($values['file_action']))
                                        {
                                                $bofiles = 
CreateObject('property.bofiles');
-                                               $attachments = 
$bofiles->get_attachments("/project/{$project['project_id']}/", 
$values['file_action']['project']);
-                                               $attachments = 
array_merge($attachments, 
$bofiles->get_attachments("/workorder/{$workorder_id}/", 
$values['file_action']['workorder']));
-                                               $attachment_log = 
lang('attachments') . ': ' . implode(', ', $values['file_action']['project']) . 
', ' . implode(', ', $values['file_action']['workorder']);
+                                               $attachments = 
$bofiles->get_attachments($values['file_action']['project']);
+                                               $attachments = 
array_merge($attachments, 
$bofiles->get_attachments($values['file_action']['workorder']));
+                                               $_attachment_log = array();
+                                               foreach ($attachments as 
$_attachment)
+                                               {
+                                                       $_attachment_log[] = 
$_attachment['name'];
+                                               }
+
+                                               $attachment_log = 
lang('attachments') . ': ' . implode(', ', $_attachment_log);
                                        }
 
                                        if ($send_as_pdf)
@@ -1614,7 +1620,6 @@
                        );
 
                        $content_files = array();
-                       $link_to_files = 
(isset($this->config->config_data['files_url']) ? 
$this->config->config_data['files_url'] : '');
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
                        
                        $files = $workorder['files'] ? $workorder['files'] : 
array();
@@ -1623,15 +1628,8 @@
 
                        for ($z = 0; $z < count($files); $z++)
                        {
-                               if ($link_to_files)
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href='{$link_to_files}/{$files[$z]['directory']}/{$files[$z]['file_name']} 
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = "<a 
href='{$link_view_file}&amp;file_name={$files[$z]['file_name']}' 
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
-                               }
-                               $content_files[$z]['select_file'] = "<input 
type='checkbox' name='values[file_action][workorder][]' 
value='{$files[$z]['name']}' title='{$lang_select_file}'>";
+                               $content_files[$z]['file_name'] = "<a 
href='{$link_view_file}&amp;file_id={$files[$z]['file_id']}' target='_blank' 
title='{$lang_view_file}'>{$files[$z]['name']}</a>";
+                               $content_files[$z]['select_file'] = "<input 
type='checkbox' name='values[file_action][workorder][]' 
value='{$files[$z]['file_id']}' title='{$lang_select_file}'>";
                        }
 
                        $project_link_file_data = array
@@ -1647,15 +1645,8 @@
                        $i = $z;
                        for ($z = 0; $z < count($files); $z++)
                        {
-                               if ($link_to_files)
-                               {
-                                       $content_files[$i]['file_name'] = "<a 
href='{$link_to_files}/{$files[$z]['directory']}/{$files[$z]['file_name']} 
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
-                               }
-                               else
-                               {
-                                       $content_files[$i]['file_name'] = "<a 
href='{$link_view_file}&amp;file_name={$files[$z]['file_name']}' 
target='_blank' title='{$lang_view_file}'>{$files[$z]['name']}</a>";
-                               }
-                               $content_files[$i]['select_file'] = "<input 
type='checkbox' name='values[file_action][project][]' 
value='{$files[$z]['name']}' title='{$lang_select_file}'>";
+                               $content_files[$i]['file_name'] = "<a 
href='{$link_view_file}&amp;file_id={$files[$z]['file_id']}' target='_blank' 
title='{$lang_view_file}'>{$files[$z]['name']}</a>";
+                               $content_files[$i]['select_file'] = "<input 
type='checkbox' name='values[file_action][project][]' 
value='{$files[$z]['file_id']}' title='{$lang_select_file}'>";
                                $i ++;
                        }
 

Modified: branches/dev-syncromind/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/dev-syncromind/property/inc/class.uiworkorder.inc.php      
2016-04-11 12:27:37 UTC (rev 14913)
+++ branches/dev-syncromind/property/inc/class.uiworkorder.inc.php      
2016-04-11 12:47:32 UTC (rev 14914)
@@ -153,8 +153,7 @@
                                        'perm' => 1,
                                        'acl_location' => $this->acl_location));
                        }
-                       $bofiles = CreateObject('property.bofiles');
-                       $bofiles->view_file('workorder');
+                       ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
                function columns()
@@ -1651,22 +1650,13 @@
                                )
                        );
 
-                       $link_to_files = 
(isset($config->config_data['files_url']) ? $config->config_data['files_url'] : 
'');
-
                        $link_view_file = $GLOBALS['phpgw']->link('/index.php', 
$link_file_data);
 
                        $content_files = array();
                        for ($z = 0; $z < count($values['files']); $z++)
                        {
-                               if ($link_to_files)
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_to_files . '/' . $values['files'][$z]['directory'] . '/' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               else
-                               {
-                                       $content_files[$z]['file_name'] = '<a 
href="' . $link_view_file . '&amp;file_name=' . 
$values['files'][$z]['file_name'] . '" target="_blank" title="' . lang('click 
to view file') . '">' . $values['files'][$z]['name'] . '</a>';
-                               }
-                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['name'] . '" title="' . lang('Check to delete file') . 
'">';
+                               $content_files[$z]['file_name'] = '<a href="' . 
$link_view_file . '&amp;file_id=' . $values['files'][$z]['file_id'] . '" 
target="_blank" title="' . lang('click to view file') . '">' . 
$values['files'][$z]['name'] . '</a>';
+                               $content_files[$z]['delete_file'] = '<input 
type="checkbox" name="values[file_action][]" value="' . 
$values['files'][$z]['file_id'] . '" title="' . lang('Check to delete file') . 
'">';
                        }
 
                        $files_def = array




reply via email to

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