fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6937] Merge 6930:6936 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6937] Merge 6930:6936 from trunk
Date: Sun, 06 Feb 2011 18:32:32 +0000

Revision: 6937
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6937
Author:   sigurdne
Date:     2011-02-06 18:32:32 +0000 (Sun, 06 Feb 2011)
Log Message:
-----------
Merge 6930:6936 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
    branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.bos_agreement.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.sodocument.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
    branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
    branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/property/inc/class.uientity.inc.php
    branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php
    branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
    branches/Version-1_0-branch/property/templates/base/entity.xsl
    branches/Version-1_0-branch/property/templates/base/files.xsl
    branches/Version-1_0-branch/property/templates/base/invoice.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml

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


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936

Modified: branches/Version-1_0-branch/property/inc/class.bodocument.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bodocument.inc.php   
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.bodocument.inc.php   
2011-02-06 18:32:32 UTC (rev 6937)
@@ -179,9 +179,9 @@
                        return $documents;
                }
 
-               function get_files_at_location($location_code)
+               function get_files_at_location($data)
                {
-                       return $this->so->get_files_at_location($location_code);
+                       return $this->so->get_files_at_location($data);
                }
 
 

Modified: branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php    
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.bogeneric.inc.php    
2011-02-06 18:32:32 UTC (rev 6937)
@@ -112,11 +112,11 @@
                {
                        if(!$selected)
                        {
-                               $selected = 
$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"];
+                               $selected = 
$GLOBALS['phpgw_info']['user']['preferences'][$this->location_info['acl_app']]["generic_columns_{$this->type}_{$this->type_id}"];
                        }
 
                        $filter = array('list' => ''); // translates to "list 
IS NULL"
-                       $columns = 
$this->custom->find('property',$this->location_info['acl_location'], 0, 
'','','',true, false, $filter);
+                       $columns = 
$this->custom->find($this->location_info['acl_app'],$this->location_info['acl_location'],
 0, '','','',true, false, $filter);
                        
$column_list=$this->bocommon->select_multi_list($selected,$columns);
 
                        return $column_list;
@@ -147,11 +147,11 @@
                public function read_single($data=array())
                {
                        $custom_fields = false;
-                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'],
 $this->location_info['acl_location']))
                        {
                                $custom_fields = true;
                                $values = array();
-                               $values['attributes'] = 
$this->custom->find('property', $this->location_info['acl_location'], 0, '', 
'ASC', 'attrib_sort', true, true);
+                               $values['attributes'] = 
$this->custom->find($this->location_info['acl_app'], 
$this->location_info['acl_location'], 0, '', 'ASC', 'attrib_sort', true, true);
                        }
 
                        if(isset($data['id']) && $data['id'])
@@ -160,7 +160,7 @@
                        }
                        if($custom_fields)
                        {
-                               $values = $this->custom->prepare($values, 
'property',$this->location_info['acl_location'], $data['view']);
+                               $values = $this->custom->prepare($values, 
$this->location_info['acl_app'],$this->location_info['acl_location'], 
$data['view']);
                        }
                        return $values;
                }

Modified: branches/Version-1_0-branch/property/inc/class.bos_agreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bos_agreement.inc.php        
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.bos_agreement.inc.php        
2011-02-06 18:32:32 UTC (rev 6937)
@@ -83,6 +83,7 @@
                        $role                           = 
phpgw::get_var('role');
                        $member_id                      = 
phpgw::get_var('member_id', 'int');
 
+                       $this->p_num            = phpgw::get_var('p_num');
 
                        $this->role                     = $role;
                        $this->so->role         = $role;
@@ -150,7 +151,7 @@
                {
                        $s_agreement = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'member_id'=>$this->member_id,
-                               'vendor_id'=>$this->vendor_id));
+                               'vendor_id'=>$this->vendor_id, 'p_num' => 
$this->p_num));
                        $this->total_records = $this->so->total_records;
 
                        $this->uicols   = $this->so->uicols;

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2011-02-06 18:32:32 UTC (rev 6937)
@@ -419,6 +419,7 @@
 
                        $this->db->transaction_begin();
 
+/*
                        if($budget['district_id'])
                        {
                                $district_filter =  "AND 
district_id='{$budget['district_id']}'";
@@ -431,7 +432,7 @@
                        {
                                $receipt['error'][] = array('msg'=>lang('budget 
%1 already saved',$this->db->f('id')));
                        }
-
+*/
                        if(!$receipt['error'])
                        {
                                $id = $this->db->next_id('fm_budget');

Modified: branches/Version-1_0-branch/property/inc/class.sodocument.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sodocument.inc.php   
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.sodocument.inc.php   
2011-02-06 18:32:32 UTC (rev 6937)
@@ -646,10 +646,38 @@
                 * @return array parent and children
                 */
 
-               function get_files_at_location($location_code)
+               function get_files_at_location($data)
                {
+                       $location_code = isset($data['location_code']) ? 
$data['location_code'] : '';
+                       $entity_id = (int)$data['entity_id'];
+                       $cat_id = (int)$data['cat_id'];
+                       $num = $data['num'];
+
+                       if( !$location_code )
+                       {
+                               if( !$entity_id  || !$cat_id || !$num)
+                               {
+                                       throw new 
Exception("property_soentity::read_entity_to_link - Missing entity information 
info in input");
+                               }
+                       }
+                       else if( !$entity_id  || !$cat_id || !$num)
+                       {
+                               if( !$location_code)
+                               {
+                                       throw new 
Exception("property_soentity::read_entity_to_link - Missing entity information 
info in input");
+                               }
+                       }
+
+                       $acl_add = $GLOBALS['phpgw']->acl->check('.document', 
PHPGW_ACL_ADD, 'property');
                        $documents = array();
-                       $sql = "SELECT count(*) as hits FROM fm_document WHERE 
location_code $this->like '$location_code%'";
+                       if($location_code)
+                       {
+                               $sql = "SELECT count(*) as hits FROM 
fm_document WHERE location_code {$this->like} '$location_code%' AND p_num IS 
NULL";
+                       }
+                       else
+                       {
+                               $sql = "SELECT count(*) as hits FROM 
fm_document WHERE p_entity_id = {$entity_id} AND p_cat_id = {$cat_id} AND p_num 
= '{$num}'";
+                       }
                        $this->db->query($sql,__LINE__,__FILE__);
                        if($this->db->next_record())
                        {
@@ -660,7 +688,10 @@
                                $cache_x_at_y[$y] = $x;
                                $documents[$x] = array
                                        (
-                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc','location_code'=> $location_code)),
+                                               'link'  => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc','location_code'=> $location_code,
+                                                                               
                                        'entity_id' => $entity_id,
+                                                                               
                                        'cat_id'        => $cat_id,
+                                                                               
                                        'p_num'         => $num)),
                                                'text'          => 
lang('documents') . ' [' . $hits . ']:',
                                                'descr'         => 
lang('Documentation'),
                                                'level'         => 0
@@ -668,16 +699,27 @@
                        }
                        else
                        {
-                               return $documents;
+//                             return $documents;
                        }
 
                        $categories = $this->cats->return_sorted_array(0, 
false);
 
+                       $location_filter = 'WHERE 1=1';
+
+                       if($location_code)
+                       {
+                               $location_filter = "WHERE location_code 
{$this->like} '{$location_code}%' AND p_num IS NULL";
+                       }
+                       else
+                       {
+                               $location_filter = "WHERE p_entity_id = 
{$entity_id} AND p_cat_id = {$cat_id} AND p_num = '{$num}'";
+                       }
+
                        foreach ($categories as $category)
                        {
                                $doc_types = 
$this->get_sub_doc_types($category['id']);
 
-                               $sql = "SELECT count(*) as hits FROM 
fm_document WHERE location_code $this->like '$location_code%' AND category IN 
(". implode(',', $doc_types) . ')';
+                               $sql = "SELECT count(*) as hits FROM 
fm_document {$location_filter} AND category IN (". implode(',', $doc_types) . 
')';
                                $this->db->query($sql,__LINE__,__FILE__);
                                $this->db->next_record();
                                $hits = (int) $this->db->f('hits');
@@ -707,15 +749,61 @@
                                $map .= '[]'; 
 
                                eval($map . ' =array('
-                                       .       "'link' => '" . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc','location_code'=> $location_code, 'doc_type'=> 
$category['id'])) . "',\n"
+                                       .       "'link' => '" . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.list_doc',
+                                                                               
                                                                                
'location_code' => $location_code,
+                                                                               
                                                                                
'doc_type'              => $category['id'],
+                                                                               
                                                                                
'entity_id'     => $entity_id,
+                                                                               
                                                                                
'cat_id'                => $cat_id,
+                                                                               
                                                                                
'p_num'                 => $num)) . "',\n"
                                        .       "'text'                 => '" . 
$category['name'] . ' [' . $hits . ']' . "',\n"
                                        .       "'descr'                => '" . 
lang('Documentation') . "',\n"
                                        .       "'level'                => "  . 
($category['level']+1) . "\n"
                                        . ');');
 
                                $cache_x_at_y[$y] = $x;
+
+//--add node
+
+                               if($acl_add && count($doc_types) == 1) // node
+                               {
+                                       $level = $level+1;
+                                       if($level == $y)
+                                       {
+                                               $x++;
+                                       }
+                                       else if($level < $y )
+                                       {
+                                               $x = $cache_x_at_y[$level]+1;
+                                       }
+                                       else if($level > $y )
+                                       {
+                                               $x = 0;
+                                       }
+                                       $y = $level;
+       
+                                       $map = '$documents'; 
+                                       for ($i = 0; $i < $level ; $i++)
+                                       {
+                                               $map .= '[' . $cache_x_at_y[$i] 
."]['children']"; 
+                                       }
+
+                                       $map .= '[]'; 
+
+                                       eval($map . ' =array('
+                                               .       "'link' => '" . 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uidocument.edit',
+                                                                               
                                                                                
'location_code' => $location_code,
+                                                                               
                                                                                
'doc_type'              => $category['id'],
+                                                                               
                                                                                
'p_entity_id'   => $entity_id,
+                                                                               
                                                                                
'p_cat_id'              => $cat_id,
+                                                                               
                                                                                
'p_num'                 => $num)) . "',\n"
+                                               .       "'text'                 
=> '" . lang('add') . "',\n"
+                                               .       "'descr'                
=> '" . lang('Add Document') . "',\n"
+                                               .       "'level'                
=> "  . $y . "\n"
+                                               . ');');
+
+                                       $cache_x_at_y[$y] = $x;
+                               }
                        }
-
                        return $documents;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2011-02-06 18:32:32 UTC (rev 6937)
@@ -567,12 +567,22 @@
 
                function read_single($data,$values = array())
                {
-                       $entity_id =$data['entity_id'];
-                       $cat_id =$data['cat_id'];
-                       $id =$data['id'];
+                       $entity_id      = (int)$data['entity_id'];
+                       $cat_id         = (int)$data['cat_id'];
+                       $id                     = (int)$data['id'];
+                       $num            = isset($data['num']) && $data['num'] ? 
$data['num'] : '';
                        $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";
 
-                       $this->db->query("SELECT * FROM $table WHERE id =$id");
+                       if($num)
+                       {
+                               $filtermethod = "WHERE num = '{$num}'";
+                       }
+                       else
+                       {
+                               $filtermethod = "WHERE id = {$id}";
+                       }
+                       
+                       $this->db->query("SELECT * FROM {$table} 
{$filtermethod}");
 
                        if($this->db->next_record())
                        {
@@ -1052,6 +1062,22 @@
                                        );
                        }
 
+                       $sql = "SELECT count(*) as hits FROM fm_s_agreement 
{$this->join} fm_s_agreement_detail ON fm_s_agreement.id = 
fm_s_agreement_detail.agreement_id WHERE p_entity_id = {$entity_id} AND 
p_cat_id = {$cat_id} AND p_num = '{$id}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       if($this->db->f('hits'))
+                       {
+                               $hits = $this->db->f('hits');
+                               $entity['related'][] = array
+                                       (
+                                               'entity_link'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction' => 
'property.uis_agreement.index',
+                                                                               
                                                'query' => 
"entity.{$entity_id}.{$cat_id}.{$id}",
+                                                                               
                                                'p_num' => $id)),
+                                               'name'                  => 
lang('service agreement') . " [{$hits}]",
+                                               'descr'                 => 
lang('service agreement')
+                                       );
+                       }
+
                        return $entity;
                }
        }

Modified: branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php    
2011-02-06 18:32:32 UTC (rev 6937)
@@ -127,15 +127,15 @@
                        }
 
                        $custom_fields = false;
-                       
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                       
if($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'],
 $this->location_info['acl_location']))
                        {
                                $custom_fields = true;
                                $choice_table = 'phpgw_cust_choice';
                                $attribute_table = 'phpgw_cust_attribute';
-                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
$this->location_info['acl_location']);
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->location_info['acl_app'], 
$this->location_info['acl_location']);
                                $attribute_filter = " location_id = 
{$location_id}";
 
-                               $user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences']['property']["generic_columns_{$this->type}_{$this->type_id}"]:'';
+                               $user_columns = 
isset($GLOBALS['phpgw_info']['user']['preferences'][$this->location_info['acl_app']]["generic_columns_{$this->type}_{$this->type_id}"])?$GLOBALS['phpgw_info']['user']['preferences'][$this->location_info['acl_app']]["generic_columns_{$this->type}_{$this->type_id}"]:'';
 
                                $user_column_filter = '';
                                if (isset($user_columns) AND 
is_array($user_columns) AND $user_columns[0])
@@ -248,7 +248,7 @@
                                                }
                                        }
 
-                                       if (isset($_querymethod) AND 
is_array($_querymethod))
+                                       if (isset($_querymethod) && 
is_array($_querymethod) && $_querymethod)
                                        {
                                                $querymethod .= " $where (" . 
implode (' OR ',$_querymethod) . ')';
                                        }
@@ -370,6 +370,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('part of town'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::location::town',
 /*
@@ -402,6 +403,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::project_group'
                                        );
@@ -423,6 +425,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => lang('dimb'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_dimb'
                                        );
@@ -444,6 +447,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => lang('dimd'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_dimd'
                                        );
@@ -465,6 +469,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_tax'
                                        );
@@ -486,6 +491,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::voucher_cats'
                                        );
@@ -507,6 +513,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::voucher_type'
                                        );
@@ -528,6 +535,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::tender'
                                        );
@@ -554,6 +562,7 @@
                                                        'edit_msg'      => 
lang('edit'),
                                                        'add_msg'       => 
lang('add'),
                                                        'name'          => '',
+                                                       'acl_app'               
        => 'property',
                                                        'acl_location' => 
'.admin',
                                                        'menu_selection' => 
"admin::property::location::location::category_{$type_id}"
                                                );
@@ -580,6 +589,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::owner::owner_cats'
                                        );
@@ -601,6 +611,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => lang('tenant 
category'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::tenant::tenant_cats'
                                        );
@@ -622,6 +633,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => lang('vendor 
category'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::vendor::vendor_cats'
                                        );
@@ -675,6 +687,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('vendor'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.vendor',
                                                'menu_selection' => 
'property::invoice::vendor',
                                                'default'                       
=> array
@@ -718,6 +731,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('owner'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.owner',
                                                'menu_selection' => 
'admin::property::owner',
                                                'default'                       
=> array
@@ -762,6 +776,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('tenant'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.tenant',
                                                'menu_selection' => 
'admin::property::tenant',
                                                'default'                       
=> array
@@ -790,6 +805,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('district'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::location::district'
                                        );
@@ -811,6 +827,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('streetaddress'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::location::street'
                                        );
@@ -832,6 +849,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::agreement::service_agree_cats'
                                        );
@@ -853,6 +871,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::tenant::claims_cats'
                                        );
@@ -874,6 +893,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => '',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::workorder_detail'
                                        );
@@ -895,6 +915,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 'condition 
type',
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::request_condition'
                                        );
@@ -916,6 +937,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => 
lang('authorities demands'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::authorities_demands',
                                                'default'                       
=> array
@@ -958,6 +980,7 @@
                                                'edit_msg'      => lang('edit'),
                                                'add_msg'       => lang('add'),
                                                'name'          => lang('budget 
account group'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_cats'
                                        );
@@ -992,6 +1015,7 @@
                                                'edit_msg'                      
=> lang('edit status'),
                                                'add_msg'                       
=> lang('add status'),
                                                'name'                          
=> lang('project status'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::project_status'
                                        );
@@ -1037,6 +1061,7 @@
                                                'edit_msg'                      
=> lang('edit status'),
                                                'add_msg'                       
=> lang('add status'),
                                                'name'                          
=> lang('workorder status'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::workorder_status'
                                        );
@@ -1058,6 +1083,7 @@
                                                'edit_msg'                      
=> lang('edit status'),
                                                'add_msg'                       
=> lang('add status'),
                                                'name'                          
=> lang('request status'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::request_status'
                                        );
@@ -1079,6 +1105,7 @@
                                                'edit_msg'                      
=> lang('edit status'),
                                                'add_msg'                       
=> lang('add status'),
                                                'name'                          
=> lang('agreement status'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::agreement::agreement_status'
                                        );
@@ -1100,6 +1127,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('building part'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::building_part'
                                        );
@@ -1121,6 +1149,7 @@
                                                'edit_msg'                      
=> lang('edit status'),
                                                'add_msg'                       
=> lang('add status'),
                                                'name'                          
=> lang('document status'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::document_status'
                                        );
@@ -1142,6 +1171,7 @@
                                                'edit_msg'                      
=> lang('edit unit'),
                                                'add_msg'                       
=> lang('add unit'),
                                                'name'                          
=> lang('unit'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::unit'
                                        );
@@ -1211,6 +1241,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('budget account'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.b_account',
                                                'menu_selection'        => 
'property::invoice::budget_account',
                                                'default'                       
=> array
@@ -1240,6 +1271,7 @@
                                                'edit_msg'                      
=> lang('edit process code'),
                                                'add_msg'                       
=> lang('add process code'),
                                                'name'                          
=> lang('process code'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::accounting::process_code',
                                                'default'                       
=> array
@@ -1276,6 +1308,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('order_dim1'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::order_dim1'
                                        );
@@ -1303,6 +1336,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('branch'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::branch'
                                        );
@@ -1331,6 +1365,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('branch'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::key_location'
                                        );
@@ -1366,6 +1401,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('Async services'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::async'
                                        );
@@ -1407,6 +1443,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('event action'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::event_action',
                                                'default'                       
=> array
@@ -1480,11 +1517,12 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('event action'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::ticket_status'
                                        );
                                break;
-
+//START HELPDESK - APP
                        case 'helpdesk_status':
                                // the helpdesk app
                                $info = array
@@ -1540,10 +1578,13 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('event action'),
+                                               'acl_app'                       
=> 'helpdesk',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::helpdesk::ticket_status'
                                        );
                                break;
+
+//END HELPDESK - APP
                        case 'pending_action_type':
                                $info = array
                                        (
@@ -1567,6 +1608,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('Pending action type'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::action_type'
                                        );
@@ -1603,6 +1645,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('order template'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.ticket.order',
                                                'menu_selection'        => 
'property::helpdesk::order_template',
                                                'default'                       
=> array
@@ -1645,6 +1688,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('response template'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.ticket',
                                                'menu_selection'        => 
'property::helpdesk::response_template',
                                                'default'                       
=> array
@@ -1706,6 +1750,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('responsibility role'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::responsibility_role',
                                                'default'                       
=> array
@@ -1720,7 +1765,6 @@
                                break;
 
                        case 'custom_menu_items':
-
                                $info = array
                                        (
                                                'table'                         
=> 'fm_custom_menu_items',
@@ -1763,6 +1807,7 @@
                                                'edit_msg'                      
=> lang('edit'),
                                                'add_msg'                       
=> lang('add'),
                                                'name'                          
=> lang('custom menu items'),
+                                               'acl_app'                       
=> 'property',
                                                'acl_location'          => 
'.admin',
                                                'menu_selection'        => 
'admin::property::custom_menu_items',
                                                'default'                       
=> array
@@ -1775,7 +1820,76 @@
                                        );
 
                                break;
+// START BOOKING TABLES
+                       case 'bb_office':
+                               $info = array
+                                       (
+                                               'table'                         
=> 'bb_office',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=>  $GLOBALS['phpgw']->translation->translate('office', array(), false, 
'booking'),
+                                               'acl_app'                       
=> 'booking',
+                                               'acl_location'          => 
'.office',
+                                               'menu_selection'        => 
'booking::settings::office',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant'           => false
+                                       );
 
+                               break;
+                       case 'bb_office_user':
+                               $info = array
+                                       (
+                                               'table'                         
=> 'bb_office_user',
+                                               'id'                            
=> array('name' => 'id', 'type' => 'auto'),
+                                               'fields'                        
=> array
+                                               (
+                                                       array
+                                                       (
+                                                               'name'          
        => 'office',
+                                                               'descr'         
        => $GLOBALS['phpgw']->translation->translate('office', array(), false, 
'booking'),
+                                                               'type'          
        => 'select',
+                                                               'filter'        
        => true,
+                                                               'values_def'    
=> array
+                                                               (
+                                                                       
'valueset'              => false,
+                                                                       
'method'                => 'property.bogeneric.get_list',
+                                                                       
'method_input'  => array('type' => 'bb_office', 'selected' => '##office##')
+                                                               )
+                                                       )
+                                               ),
+                                               'edit_msg'                      
=> lang('edit'),
+                                               'add_msg'                       
=> lang('add'),
+                                               'name'                          
=>  $GLOBALS['phpgw']->translation->translate('office user', array(), false, 
'booking'),
+                                               'acl_app'                       
=> 'booking',
+                                               'acl_location'          => 
'.office.user',
+                                               'menu_selection'        => 
'booking::settings::office::office_user',
+                                               'default'                       
=> array
+                                               (
+                                                       'user_id'               
=> array('add'  => '$this->account'),
+                                                       'entry_date'    => 
array('add'  => 'time()'),
+                                                       'modified_date' => 
array('edit' => 'time()'),
+                                               ),
+                                               'check_grant'           => false
+                                       );
+
+                               break;
+
+// END BOOKING TABLES
                        default:
                                $receipt = array();
                                $receipt['error'][]=array('msg'=>lang('ERROR: 
illegal type %1', $type));

Modified: branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php        
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php        
2011-02-06 18:32:32 UTC (rev 6937)
@@ -81,6 +81,7 @@
                                $member_id              = 
isset($data['member_id']) && $data['member_id'] ? $data['member_id'] : 0;
                                $s_agreement_id = 
isset($data['s_agreement_id'])?$data['s_agreement_id']:'';
                                $detail                 = 
isset($data['detail'])?$data['detail']:'';
+                               $p_num                  = isset($data['p_num']) 
? $data['p_num'] : '';
                        }
 
                        $choice_table = 'phpgw_cust_choice';
@@ -94,9 +95,11 @@
                                $attribute_filter = " location_id = 
{$location_id}";
 
                                $paranthesis ='(';
-                               $joinmethod = " $this->join $category_table ON 
( $entity_table.category =$category_table.id))";
+                               $joinmethod = " {$this->join} {$category_table} 
ON ( $entity_table.category =$category_table.id))";
                                $paranthesis .='(';
-                               $joinmethod .= " $this->left_join fm_vendor ON 
( $entity_table.vendor_id =fm_vendor.id))";
+                               $joinmethod .= " {$this->left_join} fm_vendor 
ON ( $entity_table.vendor_id =fm_vendor.id))";
+                               $paranthesis .='(';
+                               $joinmethod .= " {$this->left_join} 
fm_s_agreement_detail ON ( fm_s_agreement.id = 
fm_s_agreement_detail.agreement_id))";
 
                                $cols = $entity_table . 
".*,$category_table.descr as category, org_name";
 
@@ -234,7 +237,7 @@
                                $uicols['import'][]                     = false;
                        }
 
-                       $sql = "SELECT $cols FROM $paranthesis $entity_table 
$joinmethod";
+                       $sql = "SELECT DISTINCT $cols FROM $paranthesis 
$entity_table $joinmethod";
 
                        $i      = count($uicols['name']);
 
@@ -349,30 +352,39 @@
                        {
                                $query = $this->db->db_addslashes($query);
 
-                               $query_arr = array();
-                               $this->db->query("SELECT * FROM 
$attribute_table WHERE search='1' AND $attribute_filter");
+                               if($p_num)
+                               {
+                                       $query=explode(".",$query);
+                                       $querymethod = " {$where} 
(fm_s_agreement_detail.p_entity_id='" . (int)$query[1] . "' AND 
fm_s_agreement_detail.p_cat_id='" . (int)$query[2] . "' AND 
fm_s_agreement_detail.p_num='{$query[3]}')";
+                                       $where = 'AND';
+                               }
+                               else
+                               {
+                                       $query_arr = array();
+                                       $this->db->query("SELECT * FROM 
$attribute_table WHERE search='1' AND $attribute_filter");
 
-                               while ($this->db->next_record())
-                               {
-                                       if($this->db->f('datatype')=='V' || 
$this->db->f('datatype')=='email' || $this->db->f('datatype')=='CH')
+                                       while ($this->db->next_record())
                                        {
-                                               $query_arr[]= "$entity_table." 
. $this->db->f('column_name') . " $this->like '%$query%'";
+                                               
if($this->db->f('datatype')=='V' || $this->db->f('datatype')=='email' || 
$this->db->f('datatype')=='CH')
+                                               {
+                                                       $query_arr[]= 
"$entity_table." . $this->db->f('column_name') . " $this->like '%$query%'";
+                                               }
+                                               else
+                                               {
+                                                       $query_arr[]= 
"$entity_table." . $this->db->f('column_name') . " = '$query'";
+                                               }
                                        }
-                                       else
+
+                                       if (isset($query_arr[0]))
                                        {
-                                               $query_arr[]= "$entity_table." 
. $this->db->f('column_name') . " = '$query'";
+                                               $querymethod = " $where (" . 
implode (' OR ',$query_arr) . ')';
+                                               $where = 'AND';
                                        }
                                }
-
-                               if (isset($query_arr[0]))
-                               {
-                                       $querymethod = " $where (" . implode (' 
OR ',$query_arr) . ')';
-                                       $where = 'AND';
-                               }
                        }
 
                        $sql .= " $filtermethod $querymethod";
-                       //echo $sql;
+//                     echo $sql;
 
                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -464,7 +476,7 @@
                                }
                                $j++;
                        }
-                       //html_print_r($s_agreement_list);
+//_debug_array($s_agreement_list);
                        return $s_agreement_list;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiXport.inc.php      
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uiXport.inc.php      
2011-02-06 18:32:32 UTC (rev 6937)
@@ -474,9 +474,9 @@
                                        'vendor_name'                           
        => $vendor_name,
                                        'spvend_code'                           
        => $invoice_common['vendor_id'],
                                        'lang_fakturadato'                      
        => lang('invoice date'),
-                                       'fakturadato'                           
        => $invoice_common['invoice_date'],
+                                       'fakturadato'                           
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['fakturadato'])),
                                        'lang_forfallsdato'                     
        => lang('Payment date'),
-                                       'forfallsdato'                          
        => $table[0]['forfallsdato'],
+                                       'forfallsdato'                          
        => 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['forfallsdato'])),
                                        'lang_janitor'                          
        => lang('Janitor'),
                                        'oppsynsmannid'                         
        => $invoice_common['janitor'],
                                        'lang_supervisor'                       
        => lang('Supervisor'),

Modified: branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uidocument.inc.php   
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uidocument.inc.php   
2011-02-06 18:32:32 UTC (rev 6937)
@@ -534,9 +534,6 @@
 
                        $p_num = phpgw::get_var('p_num');
 
-                       $location = 
$this->bo->read_location_data($location_code);
-                       //_debug_array($location);
-
                        if($this->cat_id)
                        {
                                $entity_data[$this->entity_id]['p_num']=$p_num;
@@ -546,9 +543,15 @@
                                $category = 
$this->boadmin_entity->read_single_category($this->entity_id,$this->cat_id);
                                $lookup_entity  = 
$this->bocommon->get_lookup_entity('document');
                                $appname_sub    = $entity['name'];
+                               $_values        = 
execMethod('property.soentity.read_single',array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,
 'num' => $p_num));
+
+                               $location = 
$this->bo->read_location_data($_values['location_code']);
+                               $location_code = $_values['location_code'];
+                               unset($_values);
                        }
                        else
                        {
+                               $location = 
$this->bo->read_location_data($location_code);
                                $appname_sub    = lang('location');
                        }
 
@@ -1096,6 +1099,15 @@
                                        
$values['p'][$p_entity_id]['p_cat_name'] = $entity_category['name'];
                                }
 
+                               if(phpgw::get_var('p_num'))
+                               {
+                                       $_values        = 
execMethod('property.soentity.read_single',array('entity_id'=>$p_entity_id,'cat_id'=>$p_cat_id,
 'num' => phpgw::get_var('p_num')));
+       
+                                       $location = 
$this->bo->read_location_data($_values['location_code']);
+                                       $location_code = 
$_values['location_code'];
+                                       unset($_values);
+                               }
+
                                if($location_code)
                                {
                                        $values['location_data'] = 
$this->bolocation->read_single($location_code,array('view' => true));
@@ -1394,12 +1406,12 @@
                                        'lang_no_cat'                           
        => lang('Select category'),
                                        'lang_cat_statustext'                   
=> lang('Select the category the document belongs to. To do not use a category 
select NO CATEGORY'),
                                        'value_cat_id'                          
        => $values['doc_type'],
-                                       'cat_select'                            
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[doc_type]','selected' => $values['doc_type'])),
+                                       'cat_select'                            
        => $this->cats->formatted_xslt_list(array('select_name' => 
'values[doc_type]','selected' => 
$values['doc_type']?$values['doc_type']:$this->doc_type)),
                                        'lang_coordinator'                      
        => lang('Coordinator'),
                                        'lang_user_statustext'                  
=> lang('Select the coordinator the document belongs to. To do not use a 
category select NO USER'),
                                        'select_user_name'                      
        => 'values[coordinator]',
                                        'lang_no_user'                          
        => lang('Select coordinator'),
-                                       'user_list'                             
                => 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator'],$this->acl_location),
+                                       'user_list'                             
                => 
$this->bocommon->get_user_list_right2('select',4,$values['coordinator']?$values['coordinator']:$this->account,$this->acl_location),
 
                                        'status_list'                           
        => $this->bo->select_status_list('select',$values['status']),
                                        'status_name'                           
        => 'values[status]',

Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2011-02-06 18:32:32 UTC (rev 6937)
@@ -1750,6 +1750,16 @@
  */                    
                        if ($id)
                        {
+
+                               $document = CreateObject('property.sodocument');
+                               $documents = 
$document->get_files_at_location(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'num'=>$values['num']));
+
+                               if($documents)
+                               {
+                                       $tabs['document']       = array('label' 
=> lang('document'), 'link' => '#document');
+                                       $documents = json_encode($documents);   
                        
+                               }
+
                                $related = 
$this->bo->read_entity_to_link(array('entity_id'=>$this->entity_id,'cat_id'=>$this->cat_id,'id'=>$values['num']));
                                $related_link = array();
 
@@ -1786,18 +1796,11 @@
                                        'lang_start_ticket'                     
        => lang('start ticket'),
                                        'ticket_link'                           
        => $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),
                                        'fileupload'                            
        => $category['fileupload'],
-                                       //              'jasperupload'          
                        => $category['jasperupload'],
+                       //              'jasperupload'                          
        => $category['jasperupload'],
                                        'link_view_file'                        
        => $GLOBALS['phpgw']->link('/index.php',$link_file_data),
-                                       //              'link_to_files'         
                        => $link_to_files,
+                       //              'link_to_files'                         
        => $link_to_files,
                                        'files'                                 
                => isset($values['files'])?$values['files']:'',
-                                       //              'jasperfiles'           
                        => 
isset($values['jasperfiles'])?$values['jasperfiles']:'',
-                                       'lang_files'                            
        => lang('files'),
-                                       'lang_filename'                         
        => lang('Filename'),
-                                       'lang_file_action'                      
        => lang('Delete file'),
-                                       'lang_view_file_statustext'             
=> lang('click to view file'),
-                                       'lang_file_action_statustext'   => 
lang('Check to delete file'),
-                                       'lang_upload_file'                      
        => lang('Upload file'),
-                                       'lang_file_statustext'                  
=> lang('Select file to upload'),
+                       //              'jasperfiles'                           
        => isset($values['jasperfiles'])?$values['jasperfiles']:'',
                                        'multiple_uploader'                     
        => $id ? true : '',
                                        'fileuploader_action'                   
=> "{menuaction:'property.fileuploader.add',"
                                                                                
                                        
."upload_target:'property.uientity.addfiles',"
@@ -1849,10 +1852,11 @@
                                        'integration'                           
        => $integration,
                                        'value_integration_src'                 
=> $integration_src,
                                        'base_java_url'                         
        =>      "{menuaction:'property.uientity.get_files',".
-                                       "id:'{$id}',".
-                                       "entity_id:'{$this->entity_id}',".
-                                       "cat_id:'{$this->cat_id}',".
-                                       "type:'{$this->type}'}"
+                                                                               
                                "id:'{$id}',".
+                                                                               
                                "entity_id:'{$this->entity_id}',".
+                                                                               
                                "cat_id:'{$this->cat_id}',".
+                                                                               
                                "type:'{$this->type}'}",
+                                       'documents'                             
                => $documents
                                );
 
                        phpgwapi_yui::load_widget('dragdrop');
@@ -1864,6 +1868,8 @@
                        phpgwapi_yui::load_widget('paginator');
                        phpgwapi_yui::load_widget('animation');
 
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/examples/treeview/assets/css/folders/tree.css');
+                       phpgwapi_yui::load_widget('treeview');
                        $appname        = $entity['name'];
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang($this->type_app[$this->type]) . ' - ' . $appname . ': ' . $function_msg;

Modified: branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php    
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uigeneric.inc.php    
2011-02-06 18:32:32 UTC (rev 6937)
@@ -65,11 +65,11 @@
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
$this->location_info['menu_selection'];
                        $this->acl                                      = & 
$GLOBALS['phpgw']->acl;
                        $this->acl_location                     = 
$this->location_info['acl_location'];
-                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 'property');
-                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
-                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
-                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
-                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
+                       $this->acl_read                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_READ, 
$this->location_info['acl_app']);
+                       $this->acl_add                          = 
$this->acl->check($this->acl_location, PHPGW_ACL_ADD, 
$this->location_info['acl_app']);
+                       $this->acl_edit                         = 
$this->acl->check($this->acl_location, PHPGW_ACL_EDIT, 
$this->location_info['acl_app']);
+                       $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 
$this->location_info['acl_app']);
+                       $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, $this->location_info['acl_app']);
 
                        $this->start                            = 
$this->bo->start;
                        $this->query                            = 
$this->bo->query;
@@ -117,7 +117,7 @@
                        {
                                $GLOBALS['phpgw']->preferences->account_id = 
$this->account;
                                $GLOBALS['phpgw']->preferences->read();
-                               
$GLOBALS['phpgw']->preferences->add('property',"generic_columns_{$this->type}_{$this->type_id}",$values['columns'],'user');
+                               
$GLOBALS['phpgw']->preferences->add($this->location_info['acl_app'],"generic_columns_{$this->type}_{$this->type_id}",$values['columns'],'user');
                                
$GLOBALS['phpgw']->preferences->save_repository();
 
                                $receipt['message'][] = array('msg' => 
lang('columns is updated'));
@@ -155,7 +155,8 @@
                {
                        if(!$this->acl_read)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+                               $this->bocommon->no_access();
+                               return;
                        }
 
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data', 
"general_receipt_{$this->type}_{$this->type_id}");
@@ -249,7 +250,7 @@
                                );
 
 
-                               
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->location_info['acl_location']))
+                               
if($GLOBALS['phpgw']->locations->get_attrib_table($this->location_info['acl_app'],
 $this->location_info['acl_location']))
                                {
                                        
$datatable['actions']['form'][0]['fields']['field'][] =  array
                                                (
@@ -557,7 +558,7 @@
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$GLOBALS['phpgw']->translation->translate($this->location_info['acl_app'], 
array(), false, $this->location_info['acl_app']) . 
"::{$appname}::{$function_msg}";
 
                        $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'generic.index', 'property' );
                }
@@ -566,14 +567,22 @@
                {
                        if(!$this->acl_add)
                        {
-                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop', 'perm'=> 2, 'acl_location'=> $this->acl_location));
+                               $this->bocommon->no_access();
+                               return;
                        }
 
                        $id                     = 
phpgw::get_var($this->location_info['id']['name']);
                        $values         = phpgw::get_var('values');
 
                        $values_attribute  = phpgw::get_var('values_attribute');
-
+                       if(is_array($values_attribute))
+                       {
+                               foreach($values_attribute as &$_attr)
+                               {
+                                       $_attr['value'] = 
phpgw::get_var($_attr['name']);
+                               }
+                       }
+                       
                        $GLOBALS['phpgw_info']['apps']['manual']['section'] = 
'general.edit.' . $this->type;
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('generic','attributes_form'));
@@ -581,16 +590,16 @@
 
                        if (is_array($values))
                        {
-                               $insert_record_values = 
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",'property');
+                               $insert_record_values = 
$GLOBALS['phpgw']->session->appsession("insert_record_values{$this->acl_location}",$this->location_info['acl_app']);
 
                                if(is_array($insert_record_values))
                                {
                                        foreach($insert_record_values as $field)
                                        {
-                                               $values['extra'][$field] =      
phpgw::get_var($field);
+//                                             $values['extra'][$field] =      
phpgw::get_var($field);
                                        }
                                }
-
+//                             $values = 
$this->bocommon->collect_locationdata($values,$insert_record_values);
                                if ((isset($values['save']) && $values['save']) 
|| (isset($values['apply']) && $values['apply']))
                                {
                                        
if($GLOBALS['phpgw']->session->is_repost())
@@ -624,7 +633,7 @@
                                        {
                                                foreach ($values_attribute as 
$attribute )
                                                {
-                                                       
if($attribute['nullable'] != 1 && !$attribute['value'])
+                                                       
if($attribute['nullable'] != 1 && (!$attribute['value'] && 
!$values['extra'][$attribute['name']]))
                                                        {
                                                                
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
                                                        }
@@ -640,7 +649,8 @@
                                        {
                                                $id =   $values['id'];
                                        }
-
+//_debug_array($values);
+//_debug_array($values_attribute);die();
                                        if(!$receipt['error'])
                                        {
                                                $receipt = 
$this->bo->save($values,$action,$values_attribute);
@@ -722,19 +732,23 @@
                                }
 
                                
phpgwapi_yui::tabview_setup('general_edit_tabview');
-                               $tabs['general']        = array('label' => 
lang('general'), 'link' => '#general');
 
-                               $attributes_groups = 
$this->custom->get_attribute_groups('property', $this->acl_location, 
$values['attributes']);
+                               $attributes_groups = 
$this->custom->get_attribute_groups($this->location_info['acl_app'], 
$this->acl_location, $values['attributes']);
 
+                               if((isset($attributes_groups[0]['id']) && 
$attributes_groups[0]['id'] > 0 ) || count($attributes_groups) > 1 )
+                               {
+                                       $tabs['general']        = array('label' 
=> lang('general'), 'link' => '#general');
+                               }
+
                                $attributes = array();
                                foreach ($attributes_groups as $group)
                                {
-                                       if(isset($group['attributes']))
+                                       if(isset($group['attributes']) && 
isset($tabs['general']))
                                        {
                                                $tabs[str_replace(' ', '_', 
$group['name'])] = array('label' => $group['name'], 'link' => '#' . 
str_replace(' ', '_', $group['name']));
                                                $group['link'] = str_replace(' 
', '_', $group['name']);
-                                               $attributes[] = $group;
                                        }
+                                       $attributes[] = $group;
                                }
                                unset($attributes_groups);
                                unset($values['attributes']);
@@ -794,7 +808,7 @@
 
                        $appname        =  $this->location_info['name'];
 
-                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . "::{$appname}::{$function_msg}";
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$GLOBALS['phpgw']->translation->translate($this->location_info['acl_app'], 
array(), false, $this->location_info['acl_app']) . 
"::{$appname}::{$function_msg}";
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit' => $data));
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2011-02-06 18:32:32 UTC (rev 6937)
@@ -1965,19 +1965,25 @@
                        $id     = phpgw::get_var('id', 'int');
                        $paid   = phpgw::get_var('paid', 'bool');
 
+                       $text = $this->bo->read_remark($id,$paid);
+                       
+                       $html = '';
+                       if(stripos($text, '<table') )
+                       {
+                               $html = 1;
+                       }
+                       
                        $data = array
-                               (
-                                       'remark' => 
$this->bo->read_remark($id,$paid)
-                               );
+                       (
+                               'remark' => $text,
+                               'html'  => $html
+                       );
 
-                       //_debug_array($data);
-
                        $appname        = lang('invoice');
                        $function_msg   = lang('remark');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('remark' => $data));
-                       //      $GLOBALS['phpgw']->xslttpl->pp();
                }
 
                function consume()

Modified: branches/Version-1_0-branch/property/inc/class.uilocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uilocation.inc.php   
2011-02-06 18:32:32 UTC (rev 6937)
@@ -2094,7 +2094,7 @@
                                $related_link = array();
 
                                $document = CreateObject('property.sodocument');
-                               $documents = 
$document->get_files_at_location($location_code);
+                               $documents = $document->get_files_at_location( 
array('location_code' => $location_code) );
 
                                if($documents)
                                {
@@ -2161,6 +2161,7 @@
                                                                        
'lang_entity_statustext'        => $entry['descr'],
                                                                        
'text_entity'                           => $entry['name'],
                                                                );
+
                                                }
                                        }
                                }

Modified: branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php        
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/inc/class.uis_agreement.inc.php        
2011-02-06 18:32:32 UTC (rev 6937)
@@ -89,6 +89,7 @@
                        $this->vendor_id                        = 
$this->bo->vendor_id;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->member_id                        = 
$this->bo->member_id;
+                       $this->p_num                            = 
$this->bo->p_num;
                }
 
                function save_sessiondata()
@@ -189,7 +190,8 @@
                                                'filter'        =>$this->filter,
                                                'query'         =>$this->query,
                                                'role'          => $this->role,
-                                               'member_id'     => 
$this->member_id
+                                               'member_id'     => 
$this->member_id,
+                                               'p_num'         => $this->p_num
                                        ));
 
                                $datatable['config']['base_java_url'] = 
"menuaction:'property.uis_agreement.index',"
@@ -198,6 +200,7 @@
                                        ."cat_id: '{$this->cat_id}',"
                                        ."filter:'{$this->filter}',"
                                        ."query:'{$this->query}',"
+                                       ."p_num: '{$this->p_num}',"
                                        ."role:'{$this->role}',"
                                        ."member_id:'{$this->member_id}'";
 
@@ -295,7 +298,7 @@
                                                                ( // TEXT INPUT
                                                                        'name'  
   => 'query',
                                                                        'id'    
 => 'txt_query',
-                                                                       'value' 
   => '',//$query,
+                                                                       'value' 
   => $this->query,
                                                                        'type' 
=> 'text',
                                                                        
'onkeypress' => 'return pulsar(event)',
                                                                        'size'  
  => 28,
@@ -341,7 +344,7 @@
                        }
 
                        $list = $this->bo->read();
-
+//_debug_array($list);
                        $uicols = $this->bo->uicols;
                        $j = 0;
                        $count_uicols_name = count($uicols['name']);

Copied: 
branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml (from 
rev 6936, trunk/property/inc/import/default/efaktura_dnb_xml)
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml    
                        (rev 0)
+++ branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml    
2011-02-06 18:32:32 UTC (rev 6937)
@@ -0,0 +1,319 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id: Import_fra_BKK_csv,v 1.8 2007/03/18 16:33:16 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $spbudact_code='12304321';
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $soXport;
+               var $invoice;
+               var $meter_table;
+               protected $bilagsnr = array();
+
+               var $import = array
+               (
+                       'Bestilling'    => 'pmwrkord_code', 
+                       'Fakt. Nr'              => 'fakturanr',
+                       'Måler nr'              => 'maalernr',
+                       'Konto'                 => 'spbudact_code',
+                       'Objekt'                => 'dima',
+                       'Omr'                   => 'omraade',
+                       'Adresse'               => 'stedsnavn',
+                       'MVA'                   => 'mvakode',
+                       'Tjeneste'              => 'kostra_id',
+                       'Belop [kr]'    => 'belop'
+               );
+
+//             var $header = array('Fakt. Nr','Måler 
nr','Konto','Objekt','MVA','Belop [kr]','Omr','Adresse');
+
+
+               function import_conv()
+               {
+                       $this->soXport          = 
CreateObject('property.soXport');     
+                       $this->invoice          = 
CreateObject('property.boinvoice');
+                       $this->config           = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
+                       $this->meter_table = 
$this->config->config_data['meter_table'];
+
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->join                             = & 
$this->db->join;
+                       $this->left_join                = & 
$this->db->left_join;
+                       $this->like                             = & 
$this->db->like;
+                       $this->datetimeformat   = $this->db->datetime_format();
+                       $this->dateformat               = 
$this->db->date_format();
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+                       $conv_type      = $invoice_common['conv_type'];
+                       $this->bilagsnr[] = $this->invoice->next_bilagsnr();
+                       $buffer = array();
+                       $xmlparse = CreateObject('property.XmlToArray');
+                       $xmlparse->setEncoding('UTF-8');
+                       $xmlparse->setDecodesUTF8Automaticly(false);
+                       $xmlparse->setIncludesEmptyValues(true);
+                       $var_result = $xmlparse->parseFile($tsvfile);
+
+                       $i = 0;                 
+                       if(isset($var_result['Invoice']))
+                       {
+                               foreach ($var_result['Invoice'] as $invoice)
+                               {
+                                       foreach 
($invoice['InvoiceHeader'][0]['Buyer'][0]['Ref'] as $_ref)
+                                       {
+                                               if ($_ref['Code'] == 
'CustomerNumber')
+                                               {
+                                                       $kundenr = 
$_ref['Text'];
+                                               }
+                                       }
+
+                                       $supplier_orgnumber     = 
$invoice['InvoiceHeader'][0]['Supplier'][0]['OrgNumber'];
+                                       $fakturanr                      = 
$invoice['InvoiceHeader'][0]['InvoiceNumber'];
+                                       $invoice_date           = 
date($this->dateformat,strtotime($invoice['InvoiceHeader'][0]['InvoiceDate']));
+                                       $payment_date           = 
date($this->dateformat,strtotime($invoice['InvoiceHeader'][0]['Payment'][0]['DueDate']));
+                                       $periode                        = 
date('Ym',strtotime($invoice['InvoiceHeader'][0]['InvoiceDate']));
+                                       $kidnr                          = 
$invoice['InvoiceHeader'][0]['Payment'][0]['KidNumber'];
+                                       $currency                       = 
$invoice['InvoiceHeader'][0]['Payment'][0]['Currency'];
+                                       $maalepunktid           = 
$invoice['InvoiceHeader'][0]['InvoiceReferences'][0]['BuyersOrderNumber'];
+                                       $godkjentbelop          = 
$invoice['InvoiceSummary'][0]['InvoiceTotals'][0]['GrossAmount'];
+                                       $kunde_navn                     = 
$invoice['InvoiceHeader'][0]['Buyer'][0]['Name'];
+
+                                       $stedsnavn                      = 
$invoice['InvoiceHeader'][0]['Buyer'][0]['PostalAddress'][0]['Address1'] . "\n";
+                                       $stedsnavn                      .= 
$invoice['InvoiceHeader'][0]['Buyer'][0]['PostalAddress'][0]['Address2'] . "\n";
+                                       $stedsnavn                      .= 
$invoice['InvoiceHeader'][0]['Buyer'][0]['PostalAddress'][0]['PostalCode'] . 
"\n";
+                                       $stedsnavn                      .= 
$invoice['InvoiceHeader'][0]['Buyer'][0]['PostalAddress'][0]['PostalDistrict'] 
. "\n";
+                                       
+                                       $buffer[$i]['bilagsnr'] = 
max($this->bilagsnr);
+
+                                       if($godkjentbelop < 0)
+                                       {
+                                               $buffer[$i]['artid'] = 2;       
                                
+                                       }
+                                       else
+                                       {
+                                               $buffer[$i]['artid'] = 
$invoice_common['art'];
+                                       }
+
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $godkjentbelop = -1 * 
abs($godkjentbelop);
+                                       }
+
+                                       $merknad = <<<HTML
+                                       <table cellspacing="10">
+                                               <tr>
+                                                       <td>
+                                                               Målepunktid
+                                                       </td>
+                                                       <td>
+                                                               $maalepunktid
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Fakturanr
+                                                       </td>
+                                                       <td>
+                                                               $fakturanr
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Kundenr
+                                                       </td>
+                                                       <td>
+                                                               $kundenr
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Kundenavn
+                                                       </td>
+                                                       <td>
+                                                               $kunde_navn
+                                                       </td>
+                                               </tr>
+                                               <tr>
+                                                       <td>
+                                                               Adresse
+                                                       </td>
+                                                       <td>
+                                                               $stedsnavn
+                                                       </td>
+                                               </tr>
+                                       </table>
+HTML;
+
+
+                                       $merknad .= <<<HTML
+                                       <table cellspacing="10">
+                                               <tr>
+                                                       <td>
+                                                               Beskrivelse
+                                                       </td>
+                                                       <td>
+                                                               Enhetspris
+                                                       </td>
+                                                       <td>
+                                                               Beløp
+                                                       </td>
+                                                       <td>
+                                                               Mengde
+                                                       </td>
+                                                       <td>
+                                                               Enhet
+                                                       </td>
+                                               </tr>
+HTML;
+                                       
+                                       foreach($invoice['InvoiceDetails'] as 
$invoicedetails)
+                                       {
+                                               foreach 
($invoicedetails['BaseItemDetails'] as $baseitemdetails)
+                                               {
+                                                       $line = 
"<tr><td>{$baseitemdetails['Description']}</td>";
+                                                       $line .= '<td align = 
"right">'. number_format(round($baseitemdetails['UnitPrice'],2),2). "</td>";
+                                                       $line .= '<td align = 
"right">'."{$baseitemdetails['LineItemAmount']}</td>";
+                                                       $line .= '<td align = 
"right">'."{$baseitemdetails['QuantityInvoiced']}</td>";
+                                                       $line .= '<td align = 
"right">'."{$baseitemdetails['UnitOfMeasure']}</td></tr>";
+                                                       $merknad .= $line;
+                                               }
+                                       }                                       
+
+                                       $merknad .= <<<HTML
+                                       </table>
+HTML;
+                                       $buffer[$i]['merknad']                  
        = $merknad;
+
+                                       $maalerinfo     = 
$this->anleggsnr_to_objekt($maalepunktid,$this->meter_table);
+                                       $dima           = $maalerinfo['dima'];
+                                       $loc1           = $maalerinfo['loc1'];
+                                       $omraade        = 
$maalerinfo['district'];
+
+                                       if($invoice_common['auto_tax'])
+                                       {
+                                               
$mvakode=$this->soXport->auto_tax($dima);
+                                               
+                                               if($mvakode)
+                                               {
+                                                       $buffer[$i]['mvakode']  
        = $mvakode;
+                                               }
+                                               else
+                                               {
+                                                       $buffer[$i]['mvakode']  
        = $this->mvakode;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $buffer[$i]['mvakode']          
        = $this->mvakode;
+                                       }
+
+                                       $buffer[$i]['stedsnavn']                
        = $stedsnavn;
+                                       $buffer[$i]['currency']                 
        = $currency;
+                                       $buffer[$i]['fakturanr']                
        = $fakturanr;
+                                       $buffer[$i]['dima']                     
                = $dima;
+                                       $buffer[$i]['loc1']                     
                = $loc1;
+                                       $buffer[$i]['omraade']                  
        = $omraade;
+                                       $buffer[$i]['splitt']                   
        = $this->splitt;
+                                       $buffer[$i]['kildeid']                  
        = $this->kildeid;
+                                       $buffer[$i]['spbudact_code']            
= $this->spbudact_code;
+                                       $buffer[$i]['kidnr']                    
        = $kidnr;
+                                       $buffer[$i]['typeid']                   
        = $invoice_common['type'];
+                                       $buffer[$i]['fakturadato']              
        = $invoice_date;
+                                       $buffer[$i]['forfallsdato']             
        = $payment_date;
+                                       $buffer[$i]['periode']                  
        = $periode;
+                                       $buffer[$i]['regtid']                   
        = date($this->datetimeformat);
+                                       $buffer[$i]['belop']                    
        = $godkjentbelop;
+                                       $buffer[$i]['godkjentbelop']            
= $godkjentbelop;
+                                       $buffer[$i]['spvend_code']              
        = $invoice_common['vendor_id'];
+                                       $buffer[$i]['dimb']                     
                = $invoice_common['dim_b'];
+                                       $buffer[$i]['oppsynsmannid']            
= $invoice_common['janitor'];
+                                       $buffer[$i]['saksbehandlerid']          
= $invoice_common['supervisor'];
+                                       $buffer[$i]['budsjettansvarligid']      
= $invoice_common['budget_responsible'];
+
+                                       if($invoice_common['auto_tax'])
+                                       {
+                                               $buffer[$i]['mvakode']          
        = $this->soXport->tax_b_account_override($buffer[$i]['mvakode'] 
,$buffer[$i]['spbudact_code']);
+                                               $buffer[$i]['mvakode']          
        = $this->soXport->tax_vendor_override($buffer[$i]['mvakode'] 
,$buffer[$i]['spvend_code']);
+                                               $buffer[$i]['kostra_id']        
        = $this->soXport->get_kostra_id($buffer[$i]['dima']);
+                                       }
+
+                                       $i++;
+                                       $this->bilagsnr[] = 
max($this->bilagsnr)+1;
+                               }
+                       }
+
+                       if(!$download)
+                       {
+                               $buffer = $this->import_end_file($buffer);
+                       }
+
+//                     $this->header = array('Fakt. Nr','Måler 
nr','Konto','Objekt','MVA','Tjeneste','Belop [kr]','Omr','Adresse');
+                       return $buffer;
+               }
+               
+
+               function anleggsnr_to_objekt($anleggsnr,$meter_table)
+               {
+                       $sql = "SELECT 
{$meter_table}.ext_meter_id,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
 "
+                       . " FROM {$meter_table} {$this->join} fm_location1 ON 
{$meter_table}.loc1 = fm_location1.loc1 $this->join "
+                         . " fm_part_of_town ON fm_location1.part_of_town_id = 
fm_part_of_town.part_of_town_id WHERE {$meter_table}.ext_system_id2 
{$this->like} '%{$anleggsnr}'";
+//     _debug_array($sql);
+                       $this->db->query($sql);
+
+                       $this->db->next_record();
+                       $loc1 = $this->db->f('loc1');
+                       $loc2 = $this->db->f('loc2');
+
+                       $maalerinfo['loc1']=$loc1;
+                       $maalerinfo['dima']=$loc1.$loc2;
+                       $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+                       $maalerinfo['district']=$this->db->f('district_id');
+                       return $maalerinfo;
+               }
+
+               function import_end_file($buffer)
+               {
+
+//_debug_array($buffer);die();
+                       $num    = $this->soXport->add($buffer);
+                       array_pop($this->bilagsnr);
+                       $bilagsnr = max($this->bilagsnr);
+                       $this->db->query("UPDATE fm_idgenerator SET VALUE 
={$bilagsnr} WHERE name = 'Bilagsnummer'");
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. implode(',', $this->bilagsnr));
+                       return $receipt;
+               }
+       }

Modified: branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.edit.js        
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.edit.js        
2011-02-06 18:32:32 UTC (rev 6937)
@@ -65,3 +65,63 @@
                YAHOO.util.Dom.setStyle('lightbox-placeholder', 'display', 
'block');
 });
 
+(function() {
+       var tree;
+       
+       function treeInit()
+       {
+               buildTextNodeTree();
+               
+               //handler for expanding all nodes
+               YAHOO.util.Event.on("expand", "click", function(e) {
+                       tree.expandAll();
+                       YAHOO.util.Event.preventDefault(e);
+               });
+               
+               //handler for collapsing all nodes
+               YAHOO.util.Event.on("collapse", "click", function(e) {
+                       tree.collapseAll();
+                       YAHOO.util.Event.preventDefault(e);
+               });
+
+               tree.subscribe('clickEvent',function(oArgs) {
+                       window.open(oArgs.node.href,oArgs.node.target);
+               });
+       }
+       
+       function buildTextNodeTree()
+       {
+               //instantiate the tree:
+               tree = new YAHOO.widget.TreeView("treeDiv1");
+               for (var i = 0; i < documents.length; i++)
+               {
+                       var root = tree.getRoot();
+                       var myobj = { label: documents[i]['text'], 
href:documents[i]['link'],target:"_blank" };
+                       var tmpNode = new YAHOO.widget.TextNode(myobj, root);
+
+                       if(documents[i]['children'].length)
+                       {
+                               buildBranch(tmpNode, documents[i]['children']);
+                       }
+               }
+
+               tree.draw();
+       }
+
+       function buildBranch(node, parent)
+       {
+               for (var i = 0; i < parent.length; i++)
+               {
+                       var tmpNode = new 
YAHOO.widget.TextNode({label:parent[i]['text'], href:parent[i]['link']}, node, 
false);
+                       if(parent[i]['children'])
+                       {
+                               buildBranch(tmpNode, parent[i]['children']);
+                       }
+               }
+       }
+
+       //When the DOM is done loading, initialize TreeView instance:
+       YAHOO.util.Event.onDOMReady(treeInit);
+       
+})();
+

Modified: branches/Version-1_0-branch/property/templates/base/entity.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/entity.xsl      
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/templates/base/entity.xsl      
2011-02-06 18:32:32 UTC (rev 6937)
@@ -261,6 +261,30 @@
                                        </xsl:choose>
 
                                        <xsl:choose>
+                                               <xsl:when test="documents != 
''">
+                                                       <div id="document">
+                                                               <!-- Some style 
for the expand/contract section-->
+                                                               <style>
+                                                                       
#expandcontractdiv {border:1px dotted #dedede; margin:0 0 .5em 0; 
padding:0.4em;}
+                                                                       
#treeDiv1 { background: #fff; padding:1em; margin-top:1em; }
+                                                               </style>
+                                                               <script 
type="text/javascript">
+                                                                       var 
documents = <xsl:value-of select="documents" />;
+                                                               </script>
+
+                                                               <!-- markup for 
expand/contract links -->
+                                                               <div 
id="expandcontractdiv">
+                                                                       <a 
id="expand" href="#"><xsl:value-of select="php:function('lang', 'expand all')" 
/></a>
+                                                                       
<xsl:text> </xsl:text>
+                                                                       <a 
id="collapse" href="#"><xsl:value-of select="php:function('lang', 'collapse 
all')" /></a>
+                                                               </div>
+
+                                                               <div 
id="treeDiv1"></div>
+                                                       </div>
+                                               </xsl:when>
+                                       </xsl:choose>
+
+                                       <xsl:choose>
                                                <xsl:when test="related_link != 
''">
                                                        <div id="related">
                                                                <table 
cellpadding="2" cellspacing="2" width="80%" align="center">

Modified: branches/Version-1_0-branch/property/templates/base/files.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/files.xsl       
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/templates/base/files.xsl       
2011-02-06 18:32:32 UTC (rev 6937)
@@ -1,16 +1,16 @@
-<xsl:template name="file_list">
+<xsl:template name="file_list" xmlns:php="http://php.net/xsl";>
        <tr>
                <td width="19%" align="left" valign="top">
-                       <xsl:value-of select="//lang_files"/>
+                       <xsl:value-of select="php:function('lang', 'files')" />
                </td>
                <td>
                        <table>
                                <tr class="th">
                                        <td class="th_text" width="85%" 
align="left">
-                                               <xsl:value-of 
select="lang_filename"/>
+                                               <xsl:value-of 
select="php:function('lang', 'filename')" />
                                        </td>
                                        <td class="th_text" width="15%" 
align="center">
-                                               <xsl:value-of 
select="lang_file_action"/>
+                                               <xsl:value-of 
select="php:function('lang', 'Delete file')" />
                                        </td>
                                </tr>
                                <xsl:for-each select="files" >
@@ -29,22 +29,23 @@
                                                        </xsl:choose>
                                                </xsl:attribute>
                                                <td align="left">
+                                                       <xsl:variable 
name="view_file_statustext"><xsl:value-of select="php:function('lang', 'click 
to view file')" /></xsl:variable>
                                                        <xsl:choose>
                                                                <xsl:when 
test="//link_to_files!=''">
                                                                        
<xsl:variable name="link_to_file"><xsl:value-of 
select="//link_to_files"/>/<xsl:value-of select="directory"/>/<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                       <a 
href="{$link_to_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
+                                                                       <a 
href="{$link_to_file}" target="_blank" 
title="{$view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                </xsl:when>
                                                                <xsl:otherwise>
                                                                        
<xsl:variable name="link_view_file"><xsl:value-of 
select="//link_view_file"/>&amp;file_name=<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                       <a 
href="{$link_view_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
+                                                                       <a 
href="{$link_view_file}" target="_blank" 
title="{$view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                        <xsl:text> </xsl:text>
                                                </td>
                                                <td align="center">
-                                                       <input type="checkbox" 
name="values[file_action][]" value="{name}"  
onMouseout="window.status='';return true;">
+                                                       <input type="checkbox" 
name="values[file_action][]" value="{name}">
                                                                <xsl:attribute 
name="title">
-                                                                       
<xsl:value-of select="//lang_file_action_statustext"/>
+                                                                       
<xsl:value-of select="php:function('lang', 'Check to delete file')" />
                                                                </xsl:attribute>
                                                        </input>
                                                </td>
@@ -55,16 +56,16 @@
        </tr>
 </xsl:template>
 
-<xsl:template name="file_list_view">
+<xsl:template name="file_list_view" xmlns:php="http://php.net/xsl";>
        <tr>
                <td align="left" valign="top">
-                       <xsl:value-of select="//lang_files"/>
+                       <xsl:value-of select="php:function('lang', 'files')" />
                </td>
                <td>
                        <table>
                                <tr class="th">
                                        <td class="th_text" width="85%" 
align="left">
-                                               <xsl:value-of 
select="lang_filename"/>
+                                               <xsl:value-of 
select="php:function('lang', 'filename')" />
                                        </td>
                                </tr>
                                <xsl:for-each select="files" >
@@ -83,14 +84,15 @@
                                                        </xsl:choose>
                                                </xsl:attribute>
                                                <td align="left">
+                                                       <xsl:variable 
name="view_file_statustext"><xsl:value-of select="php:function('lang', 'click 
to view file')" /></xsl:variable>
                                                        <xsl:choose>
                                                                <xsl:when 
test="//link_to_files!=''">
                                                                        
<xsl:variable name="link_to_file"><xsl:value-of 
select="//link_to_files"/>/<xsl:value-of select="directory"/>/<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                       <a 
href="{$link_to_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
+                                                                       <a 
href="{$link_to_file}" target="_blank" 
title="{$view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                </xsl:when>
                                                                <xsl:otherwise>
                                                                        
<xsl:variable name="link_view_file"><xsl:value-of 
select="//link_view_file"/>&amp;file_name=<xsl:value-of 
select="file_name"/></xsl:variable>
-                                                                       <a 
href="{$link_view_file}" target="_blank" 
title="{//lang_view_file_statustext}"><xsl:value-of select="name"/></a>
+                                                                       <a 
href="{$link_view_file}" target="_blank" 
title="{$view_file_statustext}"><xsl:value-of select="name"/></a>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                        <xsl:text> </xsl:text>
@@ -105,12 +107,12 @@
 <xsl:template name="file_upload" xmlns:php="http://php.net/xsl";>
        <tr>
                <td valign="top">
-                       <xsl:value-of select="lang_upload_file"/>
+                       <xsl:value-of select="php:function('lang', 'upload 
file')" />
                </td>
                <td>
-                       <input type="file" name="file" size="40" 
onMouseout="window.status='';return true;">
+                       <input type="file" name="file" size="40">
                                <xsl:attribute name="title">
-                                       <xsl:value-of 
select="//lang_file_statustext"/>
+                                       <xsl:value-of 
select="php:function('lang', 'Select file to upload')" />
                                </xsl:attribute>
                        </input>
                </td>

Modified: branches/Version-1_0-branch/property/templates/base/invoice.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/invoice.xsl     
2011-02-06 18:25:27 UTC (rev 6936)
+++ branches/Version-1_0-branch/property/templates/base/invoice.xsl     
2011-02-06 18:32:32 UTC (rev 6937)
@@ -34,15 +34,20 @@
                                </td>
                        </tr>
                        <tr>
-                               <td align="center">
-                                       <textarea cols="60" rows="15" 
name="remark" readonly="readonly" onMouseout="window.status='';return true;">
-                                               <xsl:attribute 
name="onMouseover">
-                                                       
<xsl:text>window.status='</xsl:text>
-                                                       <xsl:value-of 
select="lang_content_statustext"/>
-                                                       <xsl:text>'; return 
true;</xsl:text>
-                                               </xsl:attribute>
-                                               <xsl:value-of select="remark"/>
-                                       </textarea>
+                               <td align="left">
+                                       <xsl:choose>
+                                               <xsl:when test="html = ''">
+                                                       <textarea cols="60" 
rows="15" name="remark" readonly="readonly">
+                                                               <xsl:attribute 
name="title">
+                                                                       
<xsl:value-of select="lang_content_statustext"/>
+                                                               </xsl:attribute>
+                                                               <xsl:value-of 
select="remark"/>
+                                                       </textarea>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
disable-output-escaping="yes" select="remark"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
                                </td>
                        </tr>
 




reply via email to

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