fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14929] prepare for integration with accounting syste


From: Sigurd Nes
Subject: [Fmsystem-commits] [14929] prepare for integration with accounting system
Date: Fri, 22 Apr 2016 14:29:44 +0000

Revision: 14929
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14929
Author:   sigurdne
Date:     2016-04-22 14:29:43 +0000 (Fri, 22 Apr 2016)
Log Message:
-----------
prepare for integration with accounting system

Modified Paths:
--------------
    trunk/preferences/setup/phpgw_no.lang
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.boproject.inc.php
    trunk/property/inc/class.boworkorder.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.soXport.inc.php
    trunk/property/inc/class.soagreement.inc.php
    trunk/property/inc/class.sogeneric.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.sotts.inc.php
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiagreement.inc.php
    trunk/property/inc/class.uiimport.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/inc/class.uilookup.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
    trunk/property/inc/hook_settings.inc.php
    trunk/property/js/portico/ajax_invoice.js
    trunk/property/js/portico/project.edit.js
    trunk/property/js/portico/tts.view.js
    trunk/property/js/portico/workorder.edit.js
    trunk/property/setup/default_records.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/setup/setup.inc.php
    trunk/property/setup/tables_current.inc.php
    trunk/property/setup/tables_update.inc.php
    trunk/property/templates/base/agreement.xsl
    trunk/property/templates/base/invoice.xsl
    trunk/property/templates/base/invoice2.xsl
    trunk/property/templates/base/project.xsl
    trunk/property/templates/base/tts.xsl
    trunk/property/templates/base/workorder.xsl

Added Paths:
-----------
    trunk/property/templates/base/external_project_form.xsl
    trunk/property/templates/base/external_project_view.xsl

Modified: trunk/preferences/setup/phpgw_no.lang
===================================================================
--- trunk/preferences/setup/phpgw_no.lang       2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/preferences/setup/phpgw_no.lang       2016-04-22 14:29:43 UTC (rev 
14929)
@@ -184,4 +184,5 @@
 0 - 2  preferences     no      0 - 2
 as in "." or ","       preferences     no      Velg "." eller ","
 number of planned controls on home page        preferences     no      Antall 
planlagte kontroller på hjemmeskjerm
-number of assigned controls on home page       preferences     no      Antall 
tildelte kontroller på hjemmeskjerm
\ No newline at end of file
+number of assigned controls on home page       preferences     no      Antall 
tildelte kontroller på hjemmeskjerm
+filter tickets on assigned to me       preferences     no      Filtrer 
meldinger på tildelt til meg.
\ No newline at end of file

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.bocommon.inc.php   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -718,39 +718,39 @@
                        return $b_account;
                }
 
-               function initiate_project_group_lookup( $data )
+               function initiate_external_project_lookup( $data )
                {
-                       $project_group = array();
+                       $external_project = array();
 
                        if (isset($data['type']) && $data['type'] == 'view')
                        {
-                               if (!isset($data['project_group']) || 
!$data['project_group'])
+                               if (!isset($data['external_project_id']) || 
!$data['external_project_id'])
                                {
-                                       return $project_group;
+                                       return $external_project;
                                }
 
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_view'), 
$this->xsl_rootdir);
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('external_project_view'), 
$this->xsl_rootdir);
                        }
                        else
                        {
-                               
$GLOBALS['phpgw']->xslttpl->add_file(array('project_group_form'), 
$this->xsl_rootdir);
+                               
$GLOBALS['phpgw']->xslttpl->add_file(array('external_project_form'), 
$this->xsl_rootdir);
                        }
 
-                       $project_group['value_project_group'] = 
$data['project_group'];
-                       $project_group['value_project_group_descr'] = 
$data['project_group_descr'];
-                       $project_group['project_group_url'] = 
$GLOBALS['phpgw']->link('/index.php', array(
-                               'menuaction' => 
'property.uilookup.project_group'));
-                       $project_group['lang_select_project_group_help'] = 
lang('click to select project group');
-                       $project_group['lang_project_group'] = lang('project 
group');
-                       if ($data['project_group'] && 
(!isset($data['project_group_descr']) || !$data['project_group_descr']))
+                       $external_project['value_external_project_id'] = 
$data['external_project_id'];
+                       $external_project['value_external_project_name'] = 
$data['external_project_name'];
+                       $external_project['external_project_url'] = 
$GLOBALS['phpgw']->link('/index.php', array(
+                               'menuaction' => 
'property.uilookup.external_project'));
+                       $external_project['lang_select_external_project_help'] 
= lang('click to select external project');
+                       $external_project['lang_external_project'] = 
lang('external project');
+                       if ($data['external_project_id'] && 
(!isset($data['external_project_name']) || !$data['external_project_name']))
                        {
-                               $project_group_object = 
CreateObject('property.sogeneric');
-                               
$project_group_object->get_location_info('project_group', false);
-                               $project_group_data = 
$project_group_object->read_single(array('id' => $data['project_group']));
-                               $project_group['value_project_group_descr'] = 
$project_group_data['descr'];
-                               $project_group['value_project_group_budget'] = 
$project_group_data['budget'];
+                               $external_project_object = 
CreateObject('property.sogeneric');
+                               
$external_project_object->get_location_info('external_project', false);
+                               $external_project_data = 
$external_project_object->read_single(array('id' => 
$data['external_project_id']));
+                               
$external_project['value_external_project_name'] = 
$external_project_data['name'];
+                               
$external_project['value_external_project_budget'] = 
$external_project_data['budget'];
                        }
-                       return $project_group;
+                       return $external_project;
                }
 
                function initiate_ecodimb_lookup( $data )

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.boinvoice.inc.php  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -589,7 +589,7 @@
 
                        $values['kostra_id'] = 
$soXport->get_kostra_id($values['loc1']);
                        $values['mvakode'] = (int)$values['tax_code'];
-                       $values['project_id'] = $values['project_group'];
+                       $values['project_id'] = $values['external_project_id'];
 
                        $values['oppsynsmannid'] = $values['janitor'];
                        $values['saksbehandlerid'] = $values['supervisor'];

Modified: trunk/property/inc/class.boproject.inc.php
===================================================================
--- trunk/property/inc/class.boproject.inc.php  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.boproject.inc.php  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -385,7 +385,7 @@
                        $criteria = array();
                        $criteria[1] = array
                                (
-                               'field' => 'project_group',
+                               'field' => 'external_project_id',
                                'type' => 'int',
                                'matchtype' => 'exact',
                                'front' => '',

Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php        2016-04-22 07:32:50 UTC 
(rev 14928)
+++ trunk/property/inc/class.boworkorder.inc.php        2016-04-22 14:29:43 UTC 
(rev 14929)
@@ -426,7 +426,7 @@
                        $criteria = array();
                        $criteria[1] = array
                                (
-                               'field' => 'project_group',
+                               'field' => 'external_project_id',
                                'type' => 'int',
                                'matchtype' => 'exact',
                                'front' => '',

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.menu.inc.php       2016-04-22 14:29:43 UTC (rev 
14929)
@@ -191,12 +191,18 @@
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
                                                        'type' => 
'project_status'))
                                        ),
-                                       'project_group' => array
+                                       'external_project' => array
                                                (
-                                               'text' => lang('project group'),
+                                               'text' => lang('external 
project'),
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
-                                                       'type' => 
'project_group'))
+                                                       'type' => 
'external_project'))
                                        ),
+                                       'unspsc_code' => array
+                                               (
+                                               'text' => lang('unspsc code'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'type' => 
'unspsc_code'))
+                                       ),
                                        'workorder_detail' => array
                                                (
                                                'text' => lang('Workorder 
Detail Categories'),
@@ -293,6 +299,12 @@
                                                'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
                                                        'type' => 
'budget_account'))
                                        ),
+                                       'eco_service' => array
+                                               (
+                                               'text' => lang('service'),
+                                               'url' => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index',
+                                                       'type' => 
'eco_service'))
+                                       ),
                                        'org_unit' => array
                                                (
                                                'text' => lang('department'),

Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php    2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.soXport.inc.php    2016-04-22 14:29:43 UTC (rev 
14929)
@@ -189,11 +189,11 @@
                function get_project( $id )
                {
                        $id = (int)$id;
-                       $sql = "SELECT project_group FROM fm_workorder"
+                       $sql = "SELECT external_project_id FROM fm_workorder"
                                . " {$this->join} fm_project ON 
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id={$id}";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $this->db->next_record();
-                       return $this->db->f('project_group');
+                       return $this->db->f('external_project_id');
                }
 
                function check_spbudact_code( $id )

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

Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.sogeneric.inc.php  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -273,6 +273,12 @@
                                //_debug_array($filtermethod);
                                //_debug_array($where);die();
 
+                               if ($this->location_info['id']['type'] == 
'varchar')
+                               {
+                                               $querymethod .= " OR 
{$table}.{$this->location_info['id']['name']} $this->_like '%$query%'";
+                                               $where = 'OR';
+                               }
+
                                foreach ($this->location_info['fields'] as 
$field)
                                {
                                        if ($field['type'] == 'varchar')
@@ -447,34 +453,6 @@
 
                                        break;
 
-                               case 'project_group':
-                                       $info = array
-                                               (
-                                               'table' => 'fm_project_group',
-                                               'id' => array('name' => 'id', 
'type' => 'int'),
-                                               'fields' => array
-                                                       (
-                                                       array
-                                                               (
-                                                               'name' => 
'descr',
-                                                               'descr' => 
lang('descr'),
-                                                               'type' => 
'varchar'
-                                                       ),
-                                                       array
-                                                               (
-                                                               'name' => 
'budget',
-                                                               'descr' => 
lang('budget'),
-                                                               'type' => 'int'
-                                                       )
-                                               ),
-                                               'edit_msg' => lang('edit'),
-                                               'add_msg' => lang('add'),
-                                               'name' => '',
-                                               'acl_app' => 'property',
-                                               'acl_location' => '.admin',
-                                               'menu_selection' => 
'admin::property::project_group'
-                                       );
-                                       break;
                                case 'dimb':
                                        $info = array
                                                (
@@ -593,7 +571,7 @@
                                                ),
                                                'edit_msg' => lang('edit'),
                                                'add_msg' => lang('add'),
-                                               'name' => '',
+                                               'name' => lang('tax code'),
                                                'acl_app' => 'property',
                                                'acl_location' => '.admin',
                                                'menu_selection' => 
'admin::property::accounting::accounting_tax'
@@ -1107,7 +1085,7 @@
                                                        ),
                                                        array
                                                                (
-                                                               'name' => 
'project_group',
+                                                               'name' => 
'external_project',
                                                                'descr' => 
lang('mandatory project group'),
                                                                'type' => 
'checkbox'
                                                        )
@@ -1246,6 +1224,53 @@
                                        break;
 
                                //-------- ID type varchar
+                               case 'external_project':
+                                       $info = array
+                                               (
+                                               'table' => 
'fm_external_project',
+                                               'id' => array('name' => 'id', 
'type' => 'varchar'),
+                                               'fields' => array(
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       ),
+                                                       array(
+                                                               'name' => 
'budget',
+                                                               'descr' => 
lang('budget'),
+                                                               'type' => 'int'
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('external 
project'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::external_project'
+                                       );
+                                       break;
+                               case 'unspsc_code':
+                                       $info = array
+                                               (
+                                               'table' => 'fm_unspsc_code',
+                                               'id' => array('name' => 'id', 
'type' => 'varchar'),
+                                               'fields' => array(
+                                                       array
+                                                               (
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar'
+                                                       )
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('unspsc code'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.admin',
+                                               'menu_selection' => 
'admin::property::unspsc_code'
+                                       );
+                                       break;
                                case 'project_status':
                                        $info = array
                                                (
@@ -1759,6 +1784,35 @@
                                        );
                                        break;
 
+                               case 'eco_service':
+                                       $info = array(
+                                               'table' => 'fm_eco_service',
+                                               'id' => array('name' => 'id', 
'type' => 'int'),
+                                               'fields' => array(
+                                                       array(
+                                                               'name' => 
'name',
+                                                               'descr' => 
lang('name'),
+                                                               'type' => 
'varchar',
+                                                               'nullable' => 
false,
+                                                               'size' => 50,
+                                                               'sortable' => 
true
+                                                       ),
+                                                       array(
+                                                               'name' => 
'active',
+                                                               'descr' => 
lang('active'),
+                                                               'type' => 
'checkbox',
+                                                               'default' => 
'checked'
+                                                       ),
+                                               ),
+                                               'edit_msg' => lang('edit'),
+                                               'add_msg' => lang('add'),
+                                               'name' => lang('service'),
+                                               'acl_app' => 'property',
+                                               'acl_location' => '.b_account',
+                                               'menu_selection' => 
'property::economy::eco_service',
+                                               'check_grant' => false
+                                       );
+                                       break;
                                //-------- ID type auto
 
                                case 'dimb_role_user':

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

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

Modified: trunk/property/inc/class.sotts.inc.php
===================================================================
--- trunk/property/inc/class.sotts.inc.php      2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.sotts.inc.php      2016-04-22 14:29:43 UTC (rev 
14929)
@@ -125,7 +125,7 @@
                        $start_date = isset($data['start_date']) && 
$data['start_date'] ? (int)$data['start_date'] : 0;
                        $results = isset($data['results']) && $data['results'] 
? (int)$data['results'] : 0;
                        $allrows = $results == -1 ? true : false;
-                       $end_date = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : 0;
+                       $end_date = isset($data['end_date']) && 
$data['end_date'] ? (int)$data['end_date'] : time();
                        $external = isset($data['external']) ? 
$data['external'] : '';
                        $dry_run = isset($data['dry_run']) ? $data['dry_run'] : 
'';
                        $new = isset($data['new']) ? $data['new'] : '';
@@ -236,24 +236,24 @@
                                $where = 'AND';
                        }
 
-                       if ($status_id == 'X')
-                       {
-                               $closed = '';
-                               $this->db->query('SELECT * from fm_tts_status', 
__LINE__, __FILE__);
 
-                               while ($this->db->next_record())
+                       $custom_status = $this->get_custom_status();
+                       $closed_status = array('X');
+                       foreach ($custom_status as $custom)
+                       {
+                               if ($custom['closed'])
                                {
-                                       if ($this->db->f('closed'))
-                                       {
-                                               $closed .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
-                                       }
+                                       $closed_status[] = "C{$custom['id']}";
                                }
+                       }
+                       reset($custom_status);
+                       $filter_closed = " AND fm_tts_tickets.status NOT IN ('" 
. implode("','", $closed_status) . "')";
 
-                               $filtermethod .= " $where ( 
(fm_tts_tickets.status='X'{$closed})";
+                       //get variants of closed
+                       if ($status_id == 'X')
+                       {
+                               $filtermethod .= " $where ( 
fm_tts_tickets.status IN ('" . implode("','", $closed_status) . "')";
                                $where = 'AND';
-
-//                             $filtermethod .= " $where ( 
fm_tts_tickets.status='X'";
-//                             $where = 'AND';
                        }
                        else if ($status_id == 'O2') // explicite 'open'
                        {
@@ -263,13 +263,11 @@
                        else if ($status_id == 'O')
                        {
                                $open = '';
-                               $this->db->query('SELECT * from fm_tts_status', 
__LINE__, __FILE__);
-
-                               while ($this->db->next_record())
+                               foreach ($custom_status as $custom)
                                {
-                                       if (!$this->db->f('closed'))
+                                       if (!$custom['closed'])
                                        {
-                                               $open .= " OR 
fm_tts_tickets.status = 'C" . $this->db->f('id') . "'";
+                                               $open .= " OR 
fm_tts_tickets.status = 'C{$custom['id']}'";
                                        }
                                }
 
@@ -401,7 +399,7 @@
                                $order_edit = 
$GLOBALS['phpgw']->acl->check('.ticket.order', PHPGW_ACL_EDIT, 'property');
                                $_end_date = $end_date + 3600 * 16 + 
phpgwapi_datetime::user_timezone();
                                $_start_date = $start_date - 3600 * 8 + 
phpgwapi_datetime::user_timezone();
-//                             $filtermethod .= " $where 
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date 
<= $_end_date ";
+                               $filtermethod .= " $where 
fm_tts_tickets.modified_date >= $_start_date AND fm_tts_tickets.modified_date 
<= $_end_date ";
 
                                if ($order_add || $order_edit)
                                {
@@ -587,12 +585,11 @@
 
                        $group_fields = str_ireplace(array('fm_district.descr 
as district', 'fm_tts_views.id as view'), array(
                                'fm_district.descr', 'fm_tts_views.id'), 
$return_fields_plain);
-                       $group_fields_union = 
str_ireplace(array('fm_district.descr as district', 'fm_tts_views.id as view'), 
array(
-                               'fm_district.descr', 'fm_tts_views.id'), 
$return_fields_union);
-                       $sub_select = "({$union_budget} {$filtermethod} 
{$querymethod} GROUP BY {$group_fields_union} {$ordermethod} 
{$limit_and_offset}) UNION ({$union_cost} {$filtermethod} {$querymethod} GROUP 
BY {$group_fields_union} {$ordermethod} {$limit_and_offset})";
 
                        if ($union_select)
                        {
+                               $group_fields_union = 
str_ireplace(array('fm_district.descr as district', 'fm_tts_views.id as view'), 
array('fm_district.descr', 'fm_tts_views.id'), $return_fields_union);
+                               $sub_select = "({$union_budget} {$filtermethod} 
{$querymethod} GROUP BY {$group_fields_union} {$ordermethod} 
{$limit_and_offset}) UNION ({$union_cost} {$filtermethod} {$querymethod} GROUP 
BY {$group_fields_union} {$ordermethod} {$limit_and_offset})";
                                $main_sql = "SELECT {$return_fields} FROM 
({$sub_select} ) as t GROUP BY " . implode(',', 
array_keys($_return_field_array)) . " {$ordermethod}";
                        }
                        else
@@ -639,25 +636,13 @@
                                $this->db->next_record();
                                unset($sql2);
 
-                               $cache_info = array
-                                       (
+                               $cache_info = array(
                                        'total_records' => $union_select ? 
((int)$this->db->f('cnt') / 2) : $this->db->f('cnt'),
                                        'sum_budget' => 
$this->db->f('sum_budget'),
                                        'sum_actual_cost' => 
$this->db->f('sum_actual_cost'),
                                        'sql_hash' => md5($sql_cnt)
                                );
 
-
-                               $custom_status = $this->get_custom_status();
-                               $closed_status = array('X');
-                               foreach ($custom_status as $custom)
-                               {
-                                       if ($custom['closed'])
-                                       {
-                                               $closed_status[] = 
"C{$custom['id']}";
-                                       }
-                               }
-                               $filter_closed = " AND fm_tts_tickets.status 
NOT IN ('" . implode("','", $closed_status) . "')";
                                if ($union_select)
                                {
                                        $sub_select = "({$union_budget} 
{$filtermethod} {$querymethod} {$filter_closed} GROUP BY {$group_fields_union}) 
UNION ({$union_cost} {$filtermethod} {$querymethod} {$filter_closed} GROUP BY 
{$group_fields_union})";
@@ -667,6 +652,7 @@
                                {
                                        $sql2 = "SELECT (SUM(budget) - 
SUM(actual_cost)) as sum_difference FROM ({$sql_cnt} {$filter_closed} GROUP BY 
fm_tts_tickets.id) as t";
                                }
+//                                     _debug_array($sql2);
 
                                $this->db->query($sql2, __LINE__, __FILE__);
                                $this->db->next_record();
@@ -813,6 +799,11 @@
                                $ticket['contact_id'] = 
$this->db->f('contact_id');
                                $ticket['order_id'] = $this->db->f('order_id');
                                $ticket['vendor_id'] = 
$this->db->f('vendor_id');
+                               $ticket['contract_id'] = 
$this->db->f('contract_id',true);
+                               $ticket['service_id'] = 
$this->db->f('service_id',true);
+                               $ticket['external_project_id'] = 
$this->db->f('external_project_id',true);
+                               $ticket['unspsc_code'] = 
$this->db->f('unspsc_code',true);
+                               $ticket['tax_code'] = $this->db->f('tax_code');
                                $ticket['b_account_id'] = 
$this->db->f('b_account_id');
                                $ticket['order_descr'] = 
$this->db->f('order_descr', true);
                                $ticket['ecodimb'] = $this->db->f('ecodimb');
@@ -1657,10 +1648,15 @@
                                  }
                                 */
                                $value_set['vendor_id'] = $ticket['vendor_id'];
+                               $value_set['contract_id'] = 
$this->db->db_addslashes($ticket['contract_id']);
+                               $value_set['service_id'] = 
$ticket['service_id'];
+                               $value_set['external_project_id'] = 
$this->db->db_addslashes($ticket['external_project_id']);
+                               $value_set['unspsc_code'] = 
$ticket['unspsc_code'];
                                $value_set['b_account_id'] = 
$ticket['b_account_id'];
                                $value_set['order_descr'] = 
$this->db->db_addslashes($ticket['order_descr']);
                                $value_set['ecodimb'] = $ticket['ecodimb'];
                                $value_set['branch_id'] = $ticket['branch_id'];
+                               $value_set['tax_code'] = $ticket['tax_code'];
                        }
 
                        $value_set = $this->db->validate_update($value_set);

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2016-04-22 07:32:50 UTC 
(rev 14928)
+++ trunk/property/inc/class.soworkorder.inc.php        2016-04-22 14:29:43 UTC 
(rev 14929)
@@ -964,6 +964,10 @@
                                        'actual_cost' => 
$this->db->f('actual_cost'),
                                        'continuous' => 
$this->db->f('continuous'),
                                        'fictive_periodization' => 
$this->db->f('fictive_periodization'),
+                                       'contract_id' =>        
$this->db->f('contract_id'),
+                                       'tax_code' => $this->db->f('tax_code'),
+                                       'unspsc_code' => 
$this->db->f('unspsc_code'),
+                                       'service_id' => 
$this->db->f('service_id'),
                                );
 
                                $sql = "SELECT periodization_id,"
@@ -1254,6 +1258,10 @@
                                $workorder['approved'],
                                $workorder['continuous'],
                                $workorder['fictive_periodization'],
+                               $workorder['contract_id'],
+                               $workorder['tax_code'],
+                               $workorder['unspsc_code'],
+                               $workorder['service_id'],
                                isset($workorder['vendor_email']) && 
is_array($workorder['vendor_email']) ? implode(',', $workorder['vendor_email']) 
: ''
                        );
 
@@ -1262,7 +1270,8 @@
                        $this->db->query("INSERT INTO fm_workorder 
(id,num,project_id,title,access,entry_date,start_date,end_date,tender_deadline,"
                                . 
"tender_received,inspection_on_completion,status,"
                                . 
"descr,budget,combined_cost,account_id,rig_addition,addition,key_deliver,key_fetch,vendor_id,charge_tenant,"
-                               . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,mail_recipients
  $cols) "
+                               . 
"user_id,ecodimb,category,billable_hours,contract_sum,approved,continuous,fictive_periodization,"
+                               . "contract_id, tax_code, unspsc_code, 
service_id, mail_recipients  $cols) "
                                . "VALUES ( {$values} {$vals})", __LINE__, 
__FILE__);
 
                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES ({$id},'workorder')");
@@ -1400,6 +1409,10 @@
                                'approved' => $workorder['approved'],
                                'continuous' => $workorder['continuous'],
                                'fictive_periodization' => 
$workorder['fictive_periodization'],
+                               'contract_id' =>        
$workorder['contract_id'],
+                               'tax_code' => $workorder['tax_code'],
+                               'unspsc_code' => $workorder['unspsc_code'],
+                               'service_id' => $workorder['service_id'],
                                'mail_recipients' => 
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ? 
implode(',', $workorder['vendor_email']) : '',
                        );
 

Modified: trunk/property/inc/class.uiagreement.inc.php
===================================================================
--- trunk/property/inc/class.uiagreement.inc.php        2016-04-22 07:32:50 UTC 
(rev 14928)
+++ trunk/property/inc/class.uiagreement.inc.php        2016-04-22 14:29:43 UTC 
(rev 14929)
@@ -839,7 +839,7 @@
                {
 
                        $agreement_id = phpgw::get_var('agreement_id', 'int');
-                       if (empty($agreement_id))
+                       if (!$agreement_id)
                        {
                                $result_data = array('results' => array());
                                $result_data['total_records'] = 0;
@@ -879,7 +879,7 @@
                        $data = phpgw::get_var('data');
                        $account_id = phpgw::get_var('account_id');
 
-                       if (empty(id))
+                       if (!$id)
                        {
                                $result_data = array('results' => array());
                                $result_data['total_records'] = 0;
@@ -1521,6 +1521,7 @@
                                'lang_name' => lang('name'),
                                'lang_name_statustext' => lang('name'),
                                'value_name' => $agreement['name'],
+                               'value_contract_id' => 
$agreement['contract_id'],
                                'lang_descr' => lang('descr'),
                                'lang_descr_statustext' => lang('descr'),
                                'value_descr' => $agreement['descr'],

Modified: trunk/property/inc/class.uiimport.inc.php
===================================================================
--- trunk/property/inc/class.uiimport.inc.php   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.uiimport.inc.php   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -50,6 +50,9 @@
 
                        $this->valid_tables = array
                                (
+                               'fm_unspsc_code' => array('name' => 
'fm_unspsc_code (' . lang('unspsc code') . ')', 'permission' => PHPGW_ACL_READ 
| PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
+                               'fm_external_project' => array('name' => 
'fm_external_project (' . lang('external project') . ')', 'permission' => 
PHPGW_ACL_READ | PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
+                               'fm_eco_service' => array('name' => 
'fm_eco_service (' . lang('service') . ')', 'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
                                'fm_vendor' => array('name' => 'fm_vendor (' . 
lang('vendor') . ')', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_condition_survey' => array('name' => 
'fm_condition_survey (' . lang('condition survey') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
@@ -57,7 +60,6 @@
                                'fm_budget' => array('name' => 'fm_budget (' . 
lang('budget') . ')', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_org_unit' => array('name' => 'fm_org_unit 
(' . lang('department') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
-                               'fm_project_group' => array('name' => 
'fm_project_group', 'permission' => PHPGW_ACL_READ | PHPGW_ACL_ADD | 
PHPGW_ACL_EDIT),
                                'fm_eco_periodization_outline' => array('name' 
=> 'fm_eco_periodization_outline (' . lang('periodization outline') . ')',
                                        'permission' => PHPGW_ACL_READ | 
PHPGW_ACL_ADD | PHPGW_ACL_EDIT),
                                'fm_eco_periodization' => array('name' => 
'fm_eco_periodization (' . lang('periodization') . ')',

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

Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2016-04-22 14:29:43 UTC (rev 
14929)
@@ -496,8 +496,8 @@
                                ),
                                array
                                        (
-                                       'key' => 'project_group',
-                                       'label' => lang('project group'),
+                                       'key' => 'external_project_id',
+                                       'label' => lang('external project'),
                                        'sortable' => false,
                                        'formatter' => 
'JqueryPortico.FormatterRight',
                                ),

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

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.uiproject.inc.php  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -68,11 +68,11 @@
                        'date_search' => true,
                        'columns' => true,
                        'bulk_update_status' => true,
-                       'project_group' => true,
                        'view_file' => true,
                        'get_orders' => true,
                        'get_vouchers' => true,
-                       'check_missing_project_budget' => true
+                       'check_missing_project_budget' => true,
+                       'get_external_project'=> true,
                );
 
                function __construct()
@@ -730,7 +730,7 @@
 
                        $values = phpgw::get_var('values');
                        $values_attribute = phpgw::get_var('values_attribute');
-                       $values['project_group'] = 
phpgw::get_var('project_group');
+//                     $values['external_project_id'] = 
phpgw::get_var('external_project_id');
                        $values['ecodimb'] = phpgw::get_var('ecodimb');
                        $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
                        $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
@@ -789,9 +789,9 @@
                                
$sogeneric->get_location_info('b_account_category', false);
                                $status_data = 
$sogeneric->read_single(array('id' => (int)$values['b_account_id']), array());
 
-                               if (isset($status_data['project_group']) && 
$status_data['project_group'])//mandatory for this account group
+                               if (isset($status_data['external_project']) && 
$status_data['external_project'])//mandatory for this account group
                                {
-                                       if (!isset($values['project_group']) || 
!$values['project_group'])
+                                       if 
(!isset($values['external_project_id']) || !$values['external_project_id'])
                                        {
                                                $this->receipt['error'][] = 
array('msg' => lang('Please select a project group!'));
                                                $error_id = true;
@@ -1545,9 +1545,9 @@
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_start_date');
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_end_date');
 
-                       $project_group_data = 
$this->bocommon->initiate_project_group_lookup(array(
-                               'project_group' => $values['project_group'],
-                               'project_group_descr' => 
$values['project_group_descr']));
+                       $external_project_data = 
$this->bocommon->initiate_external_project_lookup(array(
+                               'external_project_id' => 
$values['external_project_id'],
+                               'external_project_name' => 
$values['external_project_name']));
 
 
                        //---datatable 
settings---------------------------------------------------
@@ -2042,7 +2042,9 @@
                                'lang_name' => lang('Name'),
                                'lang_project_id' => lang('Project ID'),
                                'value_project_id' => isset($id) ? $id : '',
-                               'project_group_data' => $project_group_data,
+//                             'external_project_data' => 
$external_project_data,
+                               'value_external_project_id' => 
$values['external_project_id'],
+                               'value_external_project_name' => 
$this->_get_external_project_name($values['external_project_id']),
                                'value_name' => isset($values['name']) ? 
$values['name'] : '',
                                'lang_name_statustext' => lang('Enter Project 
Name'),
                                'lang_other_branch' => lang('Other branch'),
@@ -2143,6 +2145,7 @@
 
                        phpgwapi_jquery::load_widget('core');
                        phpgwapi_jquery::load_widget('numberformat');
+                       phpgwapi_jquery::load_widget('autocomplete');
 
                        self::add_javascript('property', 'portico', 
'project.edit.js');
                        self::render_template_xsl(array('project', 
'datatable_inline', 'files', 'attributes_form'), array(
@@ -2240,7 +2243,7 @@
                                        'amount' => $entry['amount'],
                                        'approved_amount' => 
$entry['approved_amount'],
                                        'vendor' => $entry['vendor'],
-                                       'project_group' => $entry['project_id'],
+                                       'external_project_id' => 
$entry['project_id'],
                                        'currency' => $entry['currency'],
                                        'budget_responsible' => 
$entry['budget_responsible'],
                                        'budsjettsigndato' => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
@@ -2601,6 +2604,41 @@
                        $this->edit(array(), $mode = 'view');
                }
 
+               public function get_external_project()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['name']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               private function _get_external_project_name( $id )
+               {
+                       $ret = '';
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+
                protected function _generate_tabs( $tabs_ = array(), 
$active_tab = 'general', $suppress = array() )
                {
                        $tabs = array

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/class.uitts.inc.php      2016-04-22 14:29:43 UTC (rev 
14929)
@@ -48,7 +48,13 @@
                        'edit_priority' => true,
                        'update_data' => true,
                        '_print' => true,
-                       'columns' => true
+                       'columns' => true,
+                       'get_vendor_contract'=> true,
+                       'get_eco_service'=> true,
+                       'get_ecodimb'   => true,
+                       'get_b_account' => true,
+                       'get_external_project'=> true,
+                       'get_unspsc_code'=> true
                );
 
                /**
@@ -255,9 +261,43 @@
                        $start_date = urldecode($this->start_date);
                        $end_date = urldecode($this->end_date);
 
-                       $this->bo->allrows = true;
-                       $list = $this->bo->read($start_date, $end_date, 
$external, '', $download = true);
+                       $search = phpgw::get_var('search');
+                       $order = phpgw::get_var('order');
+                       $draw = phpgw::get_var('draw', 'int');
+                       $columns = phpgw::get_var('columns');
 
+                       $params = array(
+                               'start' => 0,
+                               'results' => -1,
+                               'query' => $search['value'],
+                               'order' => 
$columns[$order[0]['column']]['data'],
+                               'sort' => $order[0]['dir'],
+                               'dir' => $order[0]['dir'],
+                               'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
+                               'allrows' => phpgw::get_var('length', 'int') == 
-1 ? true : false,
+                               'status_id' => $this->bo->status_id,
+                               'user_id' => $this->bo->user_id,
+                               'reported_by' => $this->bo->reported_by,
+                               'cat_id' => $this->bo->cat_id,
+                               'vendor_id' => $this->bo->vendor_id,
+                               'district_id' => $this->bo->district_id,
+                               'part_of_town_id' => $this->bo->part_of_town_id,
+                               'allrows' => true,
+                               'start_date' => $start_date,
+                               'end_date' => $end_date,
+                               'location_code' => $this->bo->location_code,
+                               'p_num' => $this->bo->p_num,
+                               'building_part' => $this->bo->building_part,
+                               'b_account' => $this->bo->b_account,
+                               'ecodimb' => $this->bo->ecodimb,
+                               'branch_id' => phpgw::get_var('branch_id'),
+                               'order_dim1' => phpgw::get_var('order_dim1'),
+                               'external' => $external,
+                               'download' => true
+                       );
+//                     _debug_array($params); die();
+                       $list = $this->bo->read($params);
+
                        $custom_status = $this->bo->get_custom_status();
 
                        $status = array();
@@ -680,17 +720,19 @@
                                        'list' => $values_combo_box[2]
                                );
 
+                               $filter_tts_assigned_to_me = 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_assigned_to_me'];
+
                                $values_combo_box[4] = 
$this->bocommon->get_user_list_right2('filter', PHPGW_ACL_EDIT, $this->user_id, 
$this->acl_location);
                                array_unshift($values_combo_box[4], array(
                                        'id' => -1 * 
$GLOBALS['phpgw_info']['user']['account_id'],
                                        'name' => lang('my assigned tickets'),
-                                       'selected'      => (int)$this->user_id 
<= 0 ? 1 : 0));
+                                       'selected'      => ((int)$this->user_id 
< 0  || (int)$filter_tts_assigned_to_me == 1) ? 1 : 0));
 
                                array_unshift($values_combo_box[4], array('id' 
=> '', 'name' => lang('assigned to')));
                                $combos[] = array('type' => 'filter',
                                        'name' => 'user_id',
                                        'extra' => '',
-                                       'text' => lang('user'),
+                                       'text' => lang('assigned to'),
                                        'list' => $values_combo_box[4]
                                );
 
@@ -1431,8 +1473,7 @@
                        $function_msg = lang('add ticket');
 
                        self::add_javascript('property', 'portico', 
'tts.add.js');
-                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
-                               'file'));
+                       phpgwapi_jquery::formvalidator_generate(array('date', 
'security','file'));
                        $this->_insert_custom_js();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
                        $GLOBALS['phpgw']->xslttpl->add_file(array('tts', 
'files', 'attributes_form'));
@@ -1521,11 +1562,11 @@
 
                        $values = phpgw::get_var('values');
                        $values['contact_id'] = phpgw::get_var('contact', 
'int', 'POST');
-                       $values['ecodimb'] = phpgw::get_var('ecodimb');
+//                     $values['ecodimb'] = phpgw::get_var('ecodimb');
                        $values['vendor_id'] = phpgw::get_var('vendor_id', 
'int', 'POST');
                        $values['vendor_name'] = phpgw::get_var('vendor_name', 
'string', 'POST');
-                       $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
-                       $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
+//                     $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int', 'POST');
+//                     $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string', 'POST');
 
                        $values_attribute = phpgw::get_var('values_attribute');
 
@@ -2527,7 +2568,7 @@
                                $my_groups[$group_id] = $group->firstname;
                        }
 
-                       
phpgwapi_jquery::formvalidator_generate(array('location', 'date', 'security',
+                       phpgwapi_jquery::formvalidator_generate(array('date', 
'security',
                                'file'));
 
                        $tabs = array();
@@ -2551,6 +2592,12 @@
                                'vendor_data' => $vendor_data,
                                'b_account_data' => $b_account_data,
                                'ecodimb_data' => $ecodimb_data,
+                               'value_service_id' => $ticket['service_id'],
+                               'value_service_name' => 
$this->_get_eco_service_name($ticket['service_id']),
+                               'value_external_project_id' => 
$ticket['external_project_id'],
+                               'value_external_project_name' => 
$this->_get_external_project_name($ticket['external_project_id']),
+                               'value_unspsc_code' => $ticket['unspsc_code'],
+                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($ticket['unspsc_code']),
                                'value_budget' => $ticket['budget'],
                                'value_actual_cost' => $ticket['actual_cost'],
                                'year_list' => array('options' => 
$this->bocommon->select_list($ticket['actual_cost_year'] ? 
$ticket['actual_cost_year'] : date('Y'), $year_list)),
@@ -2587,6 +2634,7 @@
                                'lang_priority_statustext' => lang('Select the 
priority the selection belongs to.'),
                                'select_priority_name' => 'values[priority]',
                                'priority_list' => array('options' => 
$this->bo->get_priority_list($ticket['priority'])),
+                               'contract_list' => array('options' => 
$this->get_vendor_contract($ticket['vendor_id'], $ticket['contract_id']) ),
                                'lang_no_cat' => lang('no category'),
                                'value_cat_id' => $this->cat_id,
                                'cat_select' => $cat_select,
@@ -2632,6 +2680,9 @@
                                'order_dim1_list' => array('options' => 
$this->bocommon->select_category_list(array(
                                                'type' => 'order_dim1', 
'selected' => $ticket['order_dim1'], 'order' => 'id',
                                                'id_in_name' => 'num'))),
+                               'tax_code_list' => array('options' => 
$this->bocommon->select_category_list(array(
+                                               'type' => 'tax', 'selected' => 
$ticket['tax_code'], 'order' => 'id',
+                                               'id_in_name' => 'num'))),
                                'branch_list' => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'])
 && 
$GLOBALS['phpgw_info']['user']['preferences']['property']['tts_branch_list'] == 
1 ? array(
                                        'options' => 
execMethod('property.boproject.select_branch_list', $values['branch_id'])) : '',
                                'preview_html' => 
"javascript:preview_html($id)",
@@ -2640,6 +2691,7 @@
                        );
 
                        phpgwapi_jquery::load_widget('numberformat');
+                       phpgwapi_jquery::load_widget('autocomplete');
                        self::add_javascript('property', 'portico', 
'tts.view.js');
 
                        $this->_insert_custom_js();
@@ -2663,6 +2715,162 @@
                        ExecMethod('property.bofiles.get_file', 
phpgw::get_var('file_id', 'int'));
                }
 
+               public function get_vendor_contract($vendor_id = 0, $selected = 
'')
+               {
+                       if(!$vendor_id)
+                       {
+                               $vendor_id = phpgw::get_var('vendor_id', 'int');
+                       }
+
+                       $contract_list = 
ExecMethod('property.soagreement.get_vendor_contract', $vendor_id);
+                       if($selected)
+                       {
+                               foreach ($contract_list as &$contract)
+                               {
+                                       $contract['selected'] = $selected == 
$contract['id'] ? 1 : 0;
+                               }
+                       }
+
+                       return $contract_list;
+               }
+
+               /**
+                * Gets vendor canidated to be used as vendor - called as ajax 
from edit form
+                *
+                * @param string  $query
+                *
+                * @return array
+                */
+               public function get_eco_service()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+               public function get_external_project()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_unspsc_code()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                       $values = $sogeneric->read(array('query' => $query, 
'allrows' => true));
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['name']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_ecodimb()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 'dimb');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_b_account()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'budget_account');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+
+               private function _get_eco_service_name( $id )
+               {
+                       $ret = '';
+                       if($id = (int)$id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               $ret =  $sogeneric_data['name'];
+                       }
+                       return $ret;
+               }
+
+               private function _get_unspsc_code_name( $id )
+               {
+                       $ret = '';
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+               private function _get_external_project_name( $id )
+               {
+                       $ret = '';
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'external_project');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+
                protected function _generate_tabs( $history = '' )
                {
                        if (!$tab = phpgw::get_var('tab'))

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2016-04-22 07:32:50 UTC 
(rev 14928)
+++ trunk/property/inc/class.uiworkorder.inc.php        2016-04-22 14:29:43 UTC 
(rev 14929)
@@ -64,7 +64,12 @@
                        'columns' => true,
                        'add_invoice' => true,
                        'recalculate' => true,
-                       'save' => true
+                       'save' => true,
+                       'get_vendor_contract'=> true,
+                       'get_eco_service'=> true,
+                       'get_ecodimb'   => true,
+                       'get_b_account' => true,
+                       'get_unspsc_code'=> true
                );
 
                function __construct()
@@ -653,14 +658,10 @@
                        $boproject = CreateObject('property.boproject');
                        $config = CreateObject('phpgwapi.config', 'property');
                        $config->read();
-
                        $project_id = phpgw::get_var('project_id', 'int');
                        $values = phpgw::get_var('values');
-                       $values['ecodimb'] = phpgw::get_var('ecodimb');
                        $values['vendor_id'] = phpgw::get_var('vendor_id', 
'int');
                        $values['vendor_name'] = phpgw::get_var('vendor_name', 
'string');
-                       $values['b_account_id'] = 
phpgw::get_var('b_account_id', 'int');
-                       $values['b_account_name'] = 
phpgw::get_var('b_account_name', 'string');
                        $values['event_id'] = phpgw::get_var('event_id', 'int');
                        $origin = phpgw::get_var('origin');
                        $origin_id = phpgw::get_var('origin_id', 'int');
@@ -1771,7 +1772,7 @@
                                        'amount' => $entry['amount'],
                                        'approved_amount' => 
$entry['approved_amount'],
                                        'vendor' => $entry['vendor'],
-                                       'project_group' => $entry['project_id'],
+                                       'external_project_id' => 
$entry['project_id'],
                                        'currency' => $entry['currency'],
                                        'budget_responsible' => 
$entry['budget_responsible'],
                                        'budsjettsigndato' => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']), 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']) : '',
@@ -2336,17 +2337,21 @@
                                'value_extra_mail_address' => 
$value_extra_mail_address,
                                'lean' => $_lean ? 1 : 0,
                                'decimal_separator' => $this->decimal_separator,
-                               'validator' => 
phpgwapi_jquery::formvalidator_generate(array(
-                                       'location',
-                                       'date',
-                                       'security',
-                                       'file'))
+                               'value_service_id' => $values['service_id'],
+                               'value_service_name' => 
$this->_get_eco_service_name($values['service_id']),
+                               'tax_code_list' => array('options' => 
$this->bocommon->select_category_list(array(
+                                               'type' => 'tax', 'selected' => 
$values['tax_code'], 'order' => 'id',
+                                               'id_in_name' => 'num'))),
+                               'contract_list' => array('options' => 
$this->get_vendor_contract($values['vendor_id'], $values['contract_id']) ),
+                               'value_unspsc_code' => $values['unspsc_code'],
+                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($values['unspsc_code']),
                        );
 
                        $appname = lang('Workorder');
 
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
 
+                       
phpgwapi_jquery::formvalidator_generate(array('date','security','file'));
                        phpgwapi_jquery::load_widget('core');
                        phpgwapi_jquery::load_widget('numberformat');
 
@@ -2502,16 +2507,12 @@
                                {
                                        $values['amount'] = 
str_ireplace($GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
 '', $values['amount']);
                                }
-                               $values['amount'] = str_replace(array(
-                                       ' ',
-                                       ','), array(
-                                       '',
-                                       '.'), $values['amount']);
+                               $values['amount'] = str_replace(array(' ',','), 
array('','.'), $values['amount']);
 
                                $insert_record = 
$GLOBALS['phpgw']->session->appsession('insert_record', 'property');
                                $values = 
$this->bocommon->collect_locationdata($values, $insert_record);
                                $values['b_account_id'] = 
phpgw::get_var('b_account_id');
-                               $values['project_group'] = 
phpgw::get_var('project_group');
+                               $values['external_project_id'] = 
phpgw::get_var('external_project_id');
                                $values['dimb'] = phpgw::get_var('ecodimb');
                                $values['vendor_id'] = 
phpgw::get_var('vendor_id');
                        }
@@ -2656,9 +2657,9 @@
                                )
                        );
 
-                       $project_group_data = 
$this->bocommon->initiate_project_group_lookup(array(
-                               'project_group' => $values['project_group'] ? 
$values['project_group'] : $project['project_group'],
-                               'project_group_descr' => 
$values['project_group_descr']));
+                       $external_project_data = 
$this->bocommon->initiate_external_project_lookup(array(
+                               'external_project_id' => 
$values['external_project_id'] ? $values['external_project_id'] : 
$project['external_project_id'],
+                               'external_project_name' => 
$values['external_project_name']));
 
 
                        $b_account_data = 
$this->bocommon->initiate_ui_budget_account_lookup(array
@@ -2719,7 +2720,16 @@
                                'value_paid_date' => 
isset($values['paid_date']) ? $values['paid_date'] : '',
                                'vendor_data' => $vendor_data,
                                'ecodimb_data' => $ecodimb_data,
-                               'project_group_data' => $project_group_data,
+                               'external_project_data' => 
$external_project_data,
+                               'value_service_id' => $values['service_id'],
+                               'value_service_name' => 
$this->_get_eco_service_name($values['service_id']),
+                               'tax_code_list' => array('options' => 
$this->bocommon->select_category_list(array(
+                                               'type' => 'tax', 'selected' => 
$values['tax_code'], 'order' => 'id',
+                                               'id_in_name' => 'num'))),
+                               'contract_list' => array('options' => 
$this->get_vendor_contract($values['vendor_id'], $values['contract_id']) ),
+                               'value_unspsc_code' => $values['unspsc_code'],
+                               'value_unspsc_code_name' => 
$this->_get_unspsc_code_name($values['unspsc_code']),
+
                                'value_kidnr' => isset($values['kidnr']) ? 
$values['kidnr'] : '',
                                'value_invoice_id' => 
isset($values['invoice_id']) ? $values['invoice_id'] : '',
                                'value_voucher_out_id' => 
isset($values['voucher_out_id']) ? $values['voucher_out_id'] : '',
@@ -2802,6 +2812,134 @@
                                'delete' => $data));
                }
 
+               public function get_vendor_contract($vendor_id = 0, $selected = 
'')
+               {
+                       if(!$vendor_id)
+                       {
+                               $vendor_id = phpgw::get_var('vendor_id', 'int');
+                       }
+
+                       $contract_list = 
ExecMethod('property.soagreement.get_vendor_contract', $vendor_id);
+                       if($selected)
+                       {
+                               foreach ($contract_list as &$contract)
+                               {
+                                       $contract['selected'] = $selected == 
$contract['id'] ? 1 : 0;
+                               }
+                       }
+
+                       return $contract_list;
+               }
+
+               /**
+                * Gets vendor canidated to be used as vendor - called as ajax 
from edit form
+                *
+                * @param string  $query
+                *
+                * @return array
+                */
+               public function get_eco_service()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_unspsc_code()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                       $values = $sogeneric->read(array('query' => $query, 
'allrows' => true));
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['name']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_ecodimb()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 'dimb');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+               public function get_b_account()
+               {
+                       if (!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $sogeneric = CreateObject('property.sogeneric', 
'budget_account');
+                       $values = $sogeneric->read(array('query' => $query));
+
+                       foreach ($values as &$value)
+                       {
+                               $value['name'] = "{$value['id']} 
{$value['descr']}";
+                       }
+
+                       return array('ResultSet' => array('Result' => $values));
+               }
+
+
+               private function _get_eco_service_name( $id )
+               {
+                       $ret = '';
+                       if($id = (int)$id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'eco_service');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               $ret =  $sogeneric_data['name'];
+                       }
+                       return $ret;
+               }
+
+               private function _get_unspsc_code_name( $id )
+               {
+                       $ret = '';
+                       if($id)
+                       {
+                               $sogeneric = CreateObject('property.sogeneric', 
'unspsc_code');
+                               $sogeneric_data = 
$sogeneric->read_single(array('id' => $id));
+                               if($sogeneric_data)
+                               {
+                                       $ret =  $sogeneric_data['name'];
+                               }
+                       }
+                       return $ret;
+               }
+
                protected function _generate_tabs( $tabs_ = array(), 
$active_tab = 'general', $suppress = array() )
                {
                        $tabs = array
@@ -2839,4 +2977,5 @@
 
                        return phpgwapi_jquery::tabview_generate($tabs, 
$active_tab);
                }
+
        }
\ No newline at end of file

Modified: 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
===================================================================
--- 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
        2016-04-22 07:32:50 UTC (rev 14928)
+++ 
trunk/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
        2016-04-22 14:29:43 UTC (rev 14929)
@@ -257,7 +257,7 @@
                        }
 
                        //prosjektnummer;prosjektstatus;bestillingsnummer;beløp
-                       $agresso_prosjekt = trim($data[0]);
+                       $external_project = trim($data[0]);
                        $prosjektstatus = trim($data[1]);
                        $order_id = trim($data[2]);
                        $diff_actual_cost = (float)trim($data[3]);
@@ -268,7 +268,7 @@
 
                        if (!$id)
                        {
-                               $this->receipt['error'][] = array('msg' => 
"Oppdatere beløp for agresso prosjekt {$agresso_prosjekt}: fant ikke 
bestillingen, hopper over: {$order_id}");
+                               $this->receipt['error'][] = array('msg' => 
"Oppdatere beløp for agresso prosjekt {$external_project}: fant ikke 
bestillingen, hopper over: {$order_id}");
                                return false;
                        }
 
@@ -291,12 +291,12 @@
                        $values_cost = 
$this->db->validate_insert(array_values($value_set_cost));
                        $this->db->query("INSERT INTO fm_tts_payments 
({$cols_cost}) VALUES ({$values_cost})");
 
-                       $this->receipt['message'][] = array('msg' => 
"Oppdaterer melding #{$id} for agresso prosjekt {$agresso_prosjekt}: gammelt 
beløp: {$old_actual_cost}, nytt beløp: {$new_actual_cost}");
+                       $this->receipt['message'][] = array('msg' => 
"Oppdaterer melding #{$id} for agresso prosjekt {$external_project}: gammelt 
beløp: {$old_actual_cost}, nytt beløp: {$new_actual_cost}");
                        $this->historylog->add('AC', $id, $new_actual_cost, 
$old_actual_cost);
 
                        $value_set = array
                                (
-                               'agresso_prosjekt' => $agresso_prosjekt,
+                               'external_project' => $external_project,
                                'actual_cost' => $new_actual_cost,
                                'actual_cost_year' => date('Y'),
                                'modified_date' => time()
@@ -316,7 +316,7 @@
 
                private function update_status( $data )
                {
-                       $agresso_prosjekt = trim($data[0]);
+                       $external_project = trim($data[0]);
                        $prosjektstatus = trim($data[1]);
                        $order_id = trim($data[2]);
 
@@ -331,11 +331,11 @@
 
                        if (!$id)
                        {
-                               $this->receipt['error'][] = array('msg' => 
"Oppdatere status: fant ikke bestillingen for agresso prosjekt 
{$agresso_prosjekt}");
+                               $this->receipt['error'][] = array('msg' => 
"Oppdatere status: fant ikke bestillingen for agresso prosjekt 
{$external_project}");
                                return false;
                        }
 
-                       $this->db->query("UPDATE fm_tts_tickets SET 
agresso_prosjekt = '{$agresso_prosjekt}' WHERE id={$id}", __LINE__, __FILE__);
+                       $this->db->query("UPDATE fm_tts_tickets SET 
external_project = '{$external_project}' WHERE id={$id}", __LINE__, __FILE__);
 
                        $ok = true;
                        if (preg_match('/(^C|^P)/i', $prosjektstatus))

Modified: trunk/property/inc/hook_settings.inc.php
===================================================================
--- trunk/property/inc/hook_settings.inc.php    2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/inc/hook_settings.inc.php    2016-04-22 14:29:43 UTC (rev 
14929)
@@ -182,7 +182,9 @@
 
 
 
+       create_select_box('Filter tickets on assigned to me', 
'tts_assigned_to_me', $yes_and_no, '');
        create_select_box('Notify me by mail when ticket is assigned or 
altered', 'tts_notify_me', $yes_and_no, '');
+
        create_select_box('Send e-mail from TTS', 'tts_user_mailnotification', 
$yes_and_no, 'Send e-mail from TTS as default');
        create_input_box('Refresh TTS every (seconds)', 'refreshinterval', 'The 
intervall for Helpdesk refresh - cheking for new tickets');
 

Modified: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/js/portico/ajax_invoice.js   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -38,7 +38,7 @@
                $("#line_text").val('');
                $("#order_id").val('');
                $("#order_id_orig").val('');
-               $("#project_group").val('');
+               $("#external_project_id").val('');
                $("#invoice_id").html('');
                $("#kid_nr").html('');
                $("#vendor").html('');
@@ -315,7 +315,7 @@
                        }
                        else
                        {
-                               htmlString += "<option>Ingen bilag</option>"
+                               htmlString += "<option>Ingen bilag</option>";
                                $("#voucher_id_filter").html(htmlString);
                        }
                }
@@ -383,7 +383,7 @@
                                        $("#order_text").html('Bestilling');
                                }
 
-                               
$("#project_group").val(voucher[0].project_group);
+                               
$("#external_project_id").val(voucher[0].external_project_id);
 
                                if (update_image)
                                {
@@ -658,7 +658,7 @@
                                $("#voucher_id_text").html('');
                                $("#order_id").val('');
                                $("#order_id_orig").val('');
-                               $("#project_group").val('');
+                               $("#external_project_id").val('');
                                $("#invoice_id").html('');
                                $("#kid_nr").html('');
                                $("#vendor").html('');

Modified: trunk/property/js/portico/project.edit.js
===================================================================
--- trunk/property/js/portico/project.edit.js   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/js/portico/project.edit.js   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -444,3 +444,7 @@
                check_and_submit_valid_session();
        });
 });
+
+var oArgs = {menuaction: 'property.uiproject.get_external_project'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'external_project_name', 
'external_project_id', 'external_project_container');

Modified: trunk/property/js/portico/tts.view.js
===================================================================
--- trunk/property/js/portico/tts.view.js       2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/js/portico/tts.view.js       2016-04-22 14:29:43 UTC (rev 
14929)
@@ -177,13 +177,57 @@
        }
 };
 
+this.fetch_vendor_contract = function ()
+{
+       if (!document.getElementById('vendor_id').value)
+       {
+               return;
+       }
 
+       if ($("#vendor_id").val() != vendor_id)
+       {
+               var oArgs = {menuaction: 
'property.uitts.get_vendor_contract',vendor_id:$("#vendor_id").val()};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function (data)
+                       {
+                               if (data != null)
+                               {
+                                       if (data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                                       htmlString = "<option>" + data.length + 
" kontrakter funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function (i)
+                                       {
+                                               htmlString += "<option value='" 
+ obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       
$("#vendor_contract_id").html(htmlString);
+                               }
+                       }
+               });
+
+       }
+};
+
+
 this.onDOMAttrModified = function (e)
 {
        var attr = e.attrName || e.propertyName;
        var target = e.target || e.srcElement;
        if (attr.toLowerCase() === 'vendor_id')
        {
+               fetch_vendor_contract();
                fetch_vendor_email();
        }
 };
@@ -217,4 +261,25 @@
                        d.addEventListener('DOMAttrModified', 
onDOMAttrModified, false);
                }
        }
-});
\ No newline at end of file
+});
+
+var oArgs = {menuaction: 'property.uitts.get_eco_service'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'service_name', 'service_id', 
'service_container');
+
+var oArgs = {menuaction: 'property.uitts.get_ecodimb'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'ecodimb_name', 'ecodimb', 
'ecodimb_container');
+
+var oArgs = {menuaction: 'property.uitts.get_b_account'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'b_account_name', 'b_account_id', 
'b_account_container');
+
+var oArgs = {menuaction: 'property.uitts.get_external_project'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'external_project_name', 
'external_project_id', 'external_project_container');
+
+var oArgs = {menuaction: 'property.uitts.get_unspsc_code'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'unspsc_code_name', 'unspsc_code', 
'unspsc_code_container');
+

Modified: trunk/property/js/portico/workorder.edit.js
===================================================================
--- trunk/property/js/portico/workorder.edit.js 2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/js/portico/workorder.edit.js 2016-04-22 14:29:43 UTC (rev 
14929)
@@ -137,12 +137,56 @@
        }
 };
 
+this.fetch_vendor_contract = function ()
+{
+       if (!document.getElementById('vendor_id').value)
+       {
+               return;
+       }
+
+       if ($("#vendor_id").val() != vendor_id)
+       {
+               var oArgs = {menuaction: 
'property.uiworkorder.get_vendor_contract',vendor_id:$("#vendor_id").val()};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl,
+                       success: function (data)
+                       {
+                               if (data != null)
+                               {
+                                       if (data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                                       htmlString = "<option>" + data.length + 
" kontrakter funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function (i)
+                                       {
+                                               htmlString += "<option value='" 
+ obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       
$("#vendor_contract_id").html(htmlString);
+                               }
+                       }
+               });
+
+       }
+};
+
 this.onDOMAttrModified = function (e)
 {
        var attr = e.attrName || e.propertyName;
        var target = e.target || e.srcElement;
        if (attr.toLowerCase() == 'vendor_id')
        {
+               fetch_vendor_contract();
                fetch_vendor_email();
        }
 }
@@ -167,3 +211,20 @@
 {
        return "<div align=\"center\">" + oData['active'] + 
oData['active_orig'] + "</div>";
 };
+
+var oArgs = {menuaction: 'property.uiworkorder.get_eco_service'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'service_name', 'service_id', 
'service_container');
+
+var oArgs = {menuaction: 'property.uiworkorder.get_ecodimb'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'ecodimb_name', 'ecodimb', 
'ecodimb_container');
+
+var oArgs = {menuaction: 'property.uiworkorder.get_b_account'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'b_account_name', 'b_account_id', 
'b_account_container');
+
+var oArgs = {menuaction: 'property.uiworkorder.get_unspsc_code'};
+var strURL = phpGWLink('index.php', oArgs, true);
+JqueryPortico.autocompleteHelper(strURL, 'unspsc_code_name', 'unspsc_code', 
'unspsc_code_container');
+

Modified: trunk/property/setup/default_records.inc.php
===================================================================
--- trunk/property/setup/default_records.inc.php        2016-04-22 07:32:50 UTC 
(rev 14928)
+++ trunk/property/setup/default_records.inc.php        2016-04-22 14:29:43 UTC 
(rev 14929)
@@ -38,8 +38,8 @@
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib, 
c_attrib_table) VALUES ({$app_id}, '.project.workorder', 'Workorder', 1, 1 ,1, 
'fm_workorder')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib, 
c_attrib_table) VALUES ({$app_id}, '.project.request', 'Request', 1, 1 ,1, 
'fm_request')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr, allow_grant, allow_c_function, allow_c_attrib, 
c_attrib_table) VALUES ({$app_id}, '.ticket', 'Helpdesk', 1, 1, 1, 
'fm_tts_tickets')");
+       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr, allow_c_attrib, c_attrib_table) VALUES ({$app_id}, 
'.ticket.order', 'Helpdesk ad hock order', 1, 'fm_tts_tickets')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr) VALUES ({$app_id}, '.ticket.external', 'Helpdesk External 
user')");
-       $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr) VALUES ({$app_id}, '.ticket.order', 'Helpdesk ad hock 
order')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr) VALUES ({$app_id}, '.invoice', 'Invoice')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr) VALUES ({$app_id}, '.document', 'Documents')");
        $GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_locations 
(app_id, name, descr) VALUES ({$app_id}, '.drawing', 'Drawing')");

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2016-04-22 07:32:50 UTC (rev 14928)
+++ trunk/property/setup/phpgw_no.lang  2016-04-22 14:29:43 UTC (rev 14929)
@@ -383,6 +383,7 @@
 consume history        property        no      Historisk forbruk
 continue       property        no      Fortsett
 continuous     property        no      Løpende
+contract       property        no      Kontrakt
 line   property        no      Linje
 sheet  property        no      Ark
 choose file    property        no      Velg Fil
@@ -1680,7 +1681,7 @@
 send workorder property        no      Send ordre
 serious        property        no      Kraftig
 serious consequences   property        no      Store konsekvenser
-service        property        no      Service
+service        property        no      Tjeneste
 service agreement      property        no      serviceavtale
 service agreement attributes   property        no      Serviceavtale 
attributter
 service agreement categories   property        no      Serviceavtale kategorier
@@ -2054,4 +2055,6 @@
 modified on    common  no      Oppdatert
 property type  property        no      Type
 hjemmel        common  no      Hjemmel
-record has been edited common  no      data er editert
\ No newline at end of file
+record has been edited common  no      data er editert
+external project       property        no      Eksternt prosjekt
+unspsc code    common  no      UNSPSC-kode
\ No newline at end of file

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2016-04-22 07:32:50 UTC (rev 14928)
+++ trunk/property/setup/setup.inc.php  2016-04-22 14:29:43 UTC (rev 14929)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.696';
+       $setup_info['property']['version']              = '0.9.17.697';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';
@@ -129,7 +129,8 @@
                'fm_project',
                'fm_project_buffer_budget',
                'fm_projectbranch',
-               'fm_project_group',
+               'fm_external_project',
+               'fm_unspsc_code',
                'fm_project_history',
                'fm_project_budget',
                'fm_tts_status',
@@ -148,6 +149,7 @@
                'fm_ecobilagkilde',
                'fm_ecobilagoverf',
                'fm_ecobilag_category',
+               'fm_eco_service',
                'fm_ecodimb',
                'fm_ecodimb_role',
                'fm_ecodimb_role_user',

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/setup/tables_current.inc.php 2016-04-22 14:29:43 UTC (rev 
14929)
@@ -518,7 +518,7 @@
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
                                'descr' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True, 'default' => '0'),
-                               'project_group' => array('type' => 'int', 
'precision' => '2', 'nullable' => True,
+                               'external_project' => array('type' => 'int', 
'precision' => '2', 'nullable' => True,
                                        'default' => '0')
                        ),
                        'pk' => array('id'),
@@ -589,6 +589,10 @@
                                'mail_recipients' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True),
                                'continuous' => array('type' => 'int', 
'precision' => 2, 'nullable' => True),
                                'fictive_periodization' => array('type' => 
'int', 'precision' => 2, 'nullable' => True),
+                               'contract_id' => array('type' => 'varchar', 
'precision' => '30', 'nullable' => True),
+                               'tax_code' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'unspsc_code' => array('type' => 'varchar', 
'precision' => '15', 'nullable' => True),
+                               'service_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -669,6 +673,7 @@
                                'group_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
                                'vendor_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                               'contract_id' => array('type' => 'varchar', 
'precision' => '30', 'nullable' => True),
                                'name' => array('type' => 'varchar', 
'precision' => '100', 'nullable' => False),
                                'descr' => array('type' => 'text', 'nullable' 
=> True),
                                'status' => array('type' => 'varchar', 
'precision' => '10', 'nullable' => True),
@@ -1129,6 +1134,11 @@
                                'contact_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'order_id' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'vendor_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               'contract_id' => array('type' => 'varchar', 
'precision' => '30', 'nullable' => True),
+                               'tax_code' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'external_project_id' => array('type' => 
'varchar', 'precision' => '10', 'nullable' => True),
+                               'unspsc_code' => array('type' => 'varchar', 
'precision' => '15', 'nullable' => True),
+                               'service_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'order_descr' => array('type' => 'text', 
'nullable' => True),
                                'b_account_id' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => True),
                                'ecodimb' => array('type' => 'int', 'precision' 
=> 4, 'nullable' => True),
@@ -1206,6 +1216,17 @@
                        'fk' => array(),
                        'uc' => array()
                ),
+               'fm_eco_service' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => False),
+                               'active' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True, 'default' => '0'),
+                       ),
+                       'pk' => array('id'),
+                       'ix' => array(),
+                       'fk' => array(),
+                       'uc' => array()
+               ),
                'fm_ecoart' => array(
                        'fd' => array(
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
@@ -1703,7 +1724,7 @@
                                'key_deliver' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
                                'other_branch' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => True),
                                'key_responsible' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
-                               'project_group' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               'external_project_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
                                'planned_cost' => array('type' => 'int', 
'precision' => '4', 'nullable' => True,
                                        'default' => '0'),
                                'account_id' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => True),
@@ -1761,10 +1782,10 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'fm_project_group' => array(
+               'fm_external_project' => array(
                        'fd' => array(
-                               'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
-                               'descr' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
+                               'id' => array('type' => 'varchar', 'precision' 
=> '10', 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
                                'budget' => array('type' => 'int', 'precision' 
=> '4', 'nullable' => True),
                        ),
                        'pk' => array('id'),
@@ -1772,6 +1793,16 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+               'fm_unspsc_code' => array(
+                       'fd' => array(
+                               'id' => array('type' => 'varchar', 'precision' 
=> '15', 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
+                       ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
                'fm_investment' => array(
                        'fd' => array(
                                'entity_id' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => False),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/setup/tables_update.inc.php  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -8838,3 +8838,155 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
+       /**
+       * Update property version from 0.9.17.696 to 0.9.17.697
+       * Add parametres for integration with e-commerse platforms
+       */
+       $test[] = '0.9.17.696';
+
+       function property_upgrade0_9_17_696()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'contract_id', array(
+                       'type' => 'varchar',
+                       'precision' => 30,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'service_id', array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_eco_service', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'int', 
'precision' => '4', 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => False),
+                                       'active' => array('type' => 'int', 
'precision' => '2', 'nullable' => True, 'default' => '0'),
+                               ),
+                               'pk' => array('id'),
+                               'ix' => array(),
+                               'fk' => array(),
+                               'uc' => array()
+                       )
+               );
+
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'tax_code', array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               $location_id = $GLOBALS['phpgw']->locations->get_id('property', 
'.ticket.order');
+
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE phpgw_locations 
SET allow_c_attrib = 1, c_attrib_table = 'fm_tts_tickets' WHERE location_id = 
{$location_id}");
+
+               $metadata = 
$GLOBALS['phpgw_setup']->oProc->m_odb->metadata('fm_tts_tickets');
+               if(isset($metadata['agresso_prosjekt']))
+               {
+                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+                       
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_tts_tickets', 
'agresso_prosjekt', 'external_project_id');
+                       $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM 
phpgw_cust_attribute WHERE location_id = {$location_id} AND column_name 
='agresso_prosjekt'");
+               }
+               else
+               {
+                       
$GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'external_project_id', array(
+                               'type' => 'varchar',
+                               'precision' => 10,
+                               'nullable' => True
+                               )
+                       );
+               }
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_external_project', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'varchar', 
'precision' => '10', 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
+                                       'budget' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'fm_unspsc_code', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'varchar', 
'precision' => '15', 'nullable' => False),
+                                       'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
+                               ),
+                               'pk' => array('id'),
+                               'fk' => array(),
+                               'ix' => array(),
+                               'uc' => array()
+                       )
+               );
+
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_tts_tickets", 
'unspsc_code', array(
+                       'type' => 'varchar',
+                       'precision' => 15,
+                       'nullable' => True
+                       )
+               );
+
+               
$GLOBALS['phpgw_setup']->oProc->RenameColumn('fm_b_account_category', 
'project_group', 'external_project');
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_project", 
'external_project_id', array(
+                               'type' => 'varchar',
+                               'precision' => 10,
+                               'nullable' => True
+                               )
+                       );
+
+               $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_project SET 
external_project_id = project_group WHERE project_group IS NOT NULL");
+
+               $GLOBALS['phpgw_setup']->oProc->DropColumn('fm_project', 
array(), 'project_group');
+               $GLOBALS['phpgw_setup']->oProc->DropTable('fm_project_group');
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'contract_id', array(
+                       'type' => 'varchar',
+                       'precision' => 30,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'service_id', array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'unspsc_code', array(
+                       'type' => 'varchar',
+                       'precision' => 15,
+                       'nullable' => True
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_workorder", 
'tax_code', array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.697';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }

Modified: trunk/property/templates/base/agreement.xsl
===================================================================
--- trunk/property/templates/base/agreement.xsl 2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/agreement.xsl 2016-04-22 14:29:43 UTC (rev 
14929)
@@ -166,6 +166,16 @@
                                                        </div>
                                                        <div 
class="pure-control-group">
                                                                <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'contract')"/>
+                                                               </label>
+                                                               <input 
type="text" name="values[contract_id]" value="{value_contract_id}">
+                                                                       
<xsl:attribute name="title">
+                                                                               
<xsl:value-of select="php:function('lang', 'contract')"/>
+                                                                       
</xsl:attribute>
+                                                               </input>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
                                                                        
<xsl:value-of select="lang_status"/>
                                                                </label>
                                                                
<xsl:call-template name="status_select"/>
@@ -750,6 +760,12 @@
                                                        </div>
                                                        <div 
class="pure-control-group">
                                                                <label>
+                                                                       
<xsl:value-of select="php:function('lang', 'contract')"/>
+                                                               </label>
+                                                               <xsl:value-of 
select="value_contract_id"/>
+                                                       </div>
+                                                       <div 
class="pure-control-group">
+                                                               <label>
                                                                        
<xsl:value-of select="lang_status"/>
                                                                </label>
                                                                <xsl:for-each 
select="status_list">

Added: trunk/property/templates/base/external_project_form.xsl
===================================================================
--- trunk/property/templates/base/external_project_form.xsl                     
        (rev 0)
+++ trunk/property/templates/base/external_project_form.xsl     2016-04-22 
14:29:43 UTC (rev 14929)
@@ -0,0 +1,39 @@
+
+<!-- $Id: external_project_form.xsl 14719 2016-02-10 19:45:46Z sigurdne $ -->
+<xsl:template name="external_project_form">
+       <xsl:apply-templates select="external_project_data"/>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl"; match="external_project_data">
+       <script type="text/javascript">
+               function external_project_lookup()
+               {
+                       TINY.box.show({iframe:'<xsl:value-of 
select="external_project_url"/>', 
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
 mask:true, animate:true, close: true});
+               }
+       </script>
+       <div class="pure-control-group">
+               <label for="name">
+                       <a href="javascript:external_project_lookup()" 
title="{lang_select_external_project_help}">
+                               <xsl:value-of select="lang_external_project"/>
+                       </a>
+               </label>
+               <input size="9" type="text" name="external_project_id" 
value="{value_external_project_id}">
+                       <xsl:attribute name="title">
+                               <xsl:value-of 
select="lang_select_external_project_help"/>
+                       </xsl:attribute>
+               </input>
+               <input size="30" type="text" name="external_project_name" 
value="{value_external_project_name}" onClick="external_project_lookup();" 
readonly="readonly">
+                       <xsl:attribute name="title">
+                               <xsl:value-of 
select="lang_select_external_project_help"/>
+                       </xsl:attribute>
+               </input>
+               <xsl:choose>
+                       <xsl:when test="value_external_project_budget != ''">
+                               <xsl:value-of select="php:function('lang', 
'budget')"/>
+                               <xsl:text>: </xsl:text>
+                               <xsl:value-of 
select="value_external_project_budget"/>
+                       </xsl:when>
+               </xsl:choose>
+       </div>
+</xsl:template>

Added: trunk/property/templates/base/external_project_view.xsl
===================================================================
--- trunk/property/templates/base/external_project_view.xsl                     
        (rev 0)
+++ trunk/property/templates/base/external_project_view.xsl     2016-04-22 
14:29:43 UTC (rev 14929)
@@ -0,0 +1,25 @@
+
+<!-- $Id: external_project_view.xsl 14719 2016-02-10 19:45:46Z sigurdne $ -->
+<xsl:template name="external_project_view">
+       <xsl:apply-templates select="external_project_data"/>
+</xsl:template>
+
+<!-- New template-->
+<xsl:template xmlns:php="http://php.net/xsl"; match="external_project_data">
+       <div class="pure-control-group">
+               <label for="name">
+                       <xsl:value-of select="lang_external_project"/>
+               </label>
+               <xsl:value-of select="value_external_project_id"/>
+               <xsl:text> [</xsl:text>
+               <xsl:value-of select="value_external_project_name"/>
+               <xsl:text>]</xsl:text>
+               <xsl:choose>
+                       <xsl:when test="value_external_project_budget != ''">
+                               <xsl:value-of select="php:function('lang', 
'budget')"/>
+                               <xsl:text>: </xsl:text>
+                               <xsl:value-of 
select="value_external_project_budget"/>
+                       </xsl:when>
+               </xsl:choose>
+       </div>
+</xsl:template>

Modified: trunk/property/templates/base/invoice.xsl
===================================================================
--- trunk/property/templates/base/invoice.xsl   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/invoice.xsl   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -1462,7 +1462,7 @@
                                                                
<xsl:apply-templates select="process_code_list"/>
                                                        </select>
                                                </div>
-                                       <xsl:call-template 
name="project_group_form"/>
+                                       <xsl:call-template 
name="external_project_form"/>
                                                <div class="pure-control-group">
                                                        <label>
                                                        <xsl:value-of 
select="php:function('lang', 'voucher process log')"/>

Modified: trunk/property/templates/base/invoice2.xsl
===================================================================
--- trunk/property/templates/base/invoice2.xsl  2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/invoice2.xsl  2016-04-22 14:29:43 UTC (rev 
14929)
@@ -437,7 +437,7 @@
                        <xsl:value-of select="php:function('lang', 'project 
group')" />
                </td>
                <td>
-                       <input type="text" name="values[project_group]" 
id="project_group" value="{voucher_info/voucher/project_group}"/>
+                       <input type="text" name="values[external_project_id]" 
id="external_project_id" value="{voucher_info/voucher/external_project_id}"/>
                </td>
        </tr>
 </xsl:template>

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/project.xsl   2016-04-22 14:29:43 UTC (rev 
14929)
@@ -330,7 +330,16 @@
                                                </xsl:attribute>
                                        </input>
                                </div>
-                               <xsl:call-template name="project_group_form"/>
+                               <!--xsl:call-template 
name="external_project_form"/-->
+                               <div class="pure-control-group">
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'external project')"/>
+                                       </label>
+                                       <input type="hidden" 
id="external_project_id" name="values[external_project_id]"  
value="{value_external_project_id}"/>
+                                       <input type="text" 
id="external_project_name" name="values[external_project_name]" 
value="{value_external_project_id} {value_external_project_name}"/>
+                                       <div id="external_project_container"/>
+                               </div>
+
                                <xsl:choose>
                                        <xsl:when test="ecodimb_data!=''">
                                                <xsl:call-template 
name="ecodimb_form"/>

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/tts.xsl       2016-04-22 14:29:43 UTC (rev 
14929)
@@ -648,21 +648,121 @@
                                                                                
        </xsl:attribute>
                                                                                
</input>
                                                                        </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="php:function('lang', 'external project')"/>
+                                                                               
</label>
+                                                                               
<input type="hidden" id="external_project_id" 
name="values[external_project_id]"  value="{value_external_project_id}"/>
+                                                                               
<input type="text" id="external_project_name" 
name="values[external_project_name]" value="{value_external_project_id} 
{value_external_project_name}"/>
+                                                                               
<div id="external_project_container"/>
+                                                                       </div>
 
                                                                        
<xsl:call-template name="vendor_form"/>
-                                                                       
<xsl:call-template name="ecodimb_form"/>
-                                                                       
<xsl:call-template name="b_account_form"/>
                                                                        <div 
class="pure-control-group">
                                                                                
<label>
+                                                                               
        <xsl:value-of select="php:function('lang', 'contract')"/>
+                                                                               
</label>
+                                                                               
<select id="vendor_contract_id" name="values[contract_id]">
+                                                                               
        <option value="">
+                                                                               
                <xsl:value-of select="php:function('lang', 'select')"/>
+                                                                               
        </option>
+                                                                               
        <xsl:apply-templates select="contract_list/options"/>
+                                                                               
</select>
+                                                                       </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_service">
+                                                                               
        <xsl:value-of select="php:function('lang', 'service')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_service"/>
+                                                                               
</label>
+                                                                               
<input type="hidden" id="service_id" name="values[service_id]"  
value="{value_service_id}"/>
+                                                                               
<input type="text" id="service_name" name="values[service_name]" 
value="{value_service_name}">
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_service"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+
+                                                                               
<div id="service_container"/>
+                                                                       </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_dimb">
+                                                                               
        <xsl:value-of select="php:function('lang', 'dimb')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_dimb"/>
+                                                                               
</label>
+                                                                               
<input type="hidden" id="ecodimb" name="values[ecodimb]"  
value="{ecodimb_data/value_ecodimb}"/>
+                                                                               
<input type="text" id="ecodimb_name" name="values[ecodimb_name]" 
value="{ecodimb_data/value_ecodimb} {ecodimb_data/value_ecodimb_descr}">
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_dimb"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                               
<div id="ecodimb_container"/>
+                                                                       </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_budget_account">
+                                                                               
        <xsl:value-of select="php:function('lang', 'budget account')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_budget_account"/>
+                                                                               
</label>
+                                                                               
<input type="hidden" id="b_account_id" name="values[b_account_id]"  
value="{b_account_data/value_b_account_id}"/>
+                                                                               
<input type="text" id="b_account_name" name="values[b_account_name]" 
value="{b_account_data/value_b_account_id} 
{b_account_data/value_b_account_name}">
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_budget_account"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                               
<div id="b_account_container"/>
+                                                                       </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_unspsc_code">
+                                                                               
        <xsl:value-of select="php:function('lang', 'unspsc code')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_unspsc_code"/>
+                                                                               
</label>
+                                                                               
<input type="hidden" id="unspsc_code" name="values[unspsc_code]"  
value="{value_unspsc_code}"/>
+                                                                               
<input type="text" id="unspsc_code_name" name="values[unspsc_code_name]" 
value="{value_unspsc_code} {value_unspsc_code_name}">
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_unspsc_code"/>
+                                                                               
        </xsl:attribute>
+                                                                               
</input>
+                                                                               
<div id="unspsc_code_container"/>
+                                                                       </div>
+
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_building_part">
                                                                                
        <xsl:value-of select="php:function('lang', 'building part')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_building_part"/>
                                                                                
</label>
                                                                                
                
                                                                                
<select name="values[building_part]">
                                                                                
        <xsl:attribute name="title">
-                                                                               
                <xsl:value-of select="php:function('lang', 'select building 
part')"/>
+                                                                               
                <xsl:value-of select="$lang_building_part"/>
                                                                                
        </xsl:attribute>
-                                                                               
        <option value="0">
-                                                                               
                <xsl:value-of select="php:function('lang', 'select building 
part')"/>
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_building_part"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <option value="">
+                                                                               
                <xsl:value-of select="$lang_building_part"/>
                                                                                
        </option>
                                                                                
        <xsl:apply-templates select="building_part_list/options"/>
                                                                                
</select>
@@ -686,20 +786,66 @@
                                                                                
</xsl:when>
                                                                        
</xsl:choose>
                                                                        <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_order_dim1">
+                                                                               
        <xsl:value-of select="php:function('lang', 'order_dim1')"/>
+                                                                               
</xsl:variable>
                                                                                
<label>
-                                                                               
        <xsl:value-of select="php:function('lang', 'order_dim1')"/>
+                                                                               
        <xsl:value-of select="$lang_order_dim1"/>
                                                                                
</label>
                                                                                
<select name="values[order_dim1]">
                                                                                
        <xsl:attribute name="title">
                                                                                
                <xsl:value-of select="php:function('lang', 'order_dim1')"/>
                                                                                
        </xsl:attribute>
-                                                                               
        <option value="0">
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_order_dim1"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <option value="">
                                                                                
                <xsl:value-of select="php:function('lang', 'order_dim1')"/>
                                                                                
        </option>
                                                                                
        <xsl:apply-templates select="order_dim1_list/options"/>
                                                                                
</select>
                                                                        </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<xsl:variable name="lang_tax_code">
+                                                                               
        <xsl:value-of select="php:function('lang', 'tax code')"/>
+                                                                               
</xsl:variable>
+                                                                               
<label>
+                                                                               
        <xsl:value-of select="$lang_tax_code"/>
+                                                                               
</label>
+                                                                               
<select name="values[tax_code]">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="$lang_tax_code"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation">
+                                                                               
                <xsl:text>required</xsl:text>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:attribute name="data-validation-error-msg">
+                                                                               
                <xsl:value-of select="$lang_tax_code"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:apply-templates select="tax_code_list/options"/>
+                                                                               
</select>
+                                                                       </div>
+                                                                       <div 
class="pure-control-group">
+                                                                               
<label>
+                                                                               
        <a href="javascript:template_lookup()">
+                                                                               
                <xsl:attribute name="title">
+                                                                               
                        <xsl:value-of select="php:function('lang', 'lookup 
template')"/>
+                                                                               
                </xsl:attribute>
+                                                                               
                <xsl:value-of select="php:function('lang', 'description')"/>
+                                                                               
        </a>
+                                                                               
</label>
 
+                                                                               
<textarea cols="{textareacols}" rows="{textarearows}" id="order_descr" 
name="values[order_descr]" wrap="virtual">
+                                                                               
        <xsl:attribute name="title">
+                                                                               
                <xsl:value-of select="php:function('lang', 'description 
order')"/>
+                                                                               
        </xsl:attribute>
+                                                                               
        <xsl:value-of select="value_order_descr"/>
+                                                                               
</textarea>
+                                                                       </div>
+
                                                                        <div 
class="pure-control-group">
                                                                                
<label>
                                                                                
        <xsl:value-of select="php:function('lang', 'cost estimate')"/>
@@ -796,23 +942,6 @@
 
                                                                                
</div>
                                                                        </div>
-                                                                       <div 
class="pure-control-group">
-                                                                               
<label>
-                                                                               
        <a href="javascript:template_lookup()">
-                                                                               
                <xsl:attribute name="title">
-                                                                               
                        <xsl:value-of select="php:function('lang', 'lookup 
template')"/>
-                                                                               
                </xsl:attribute>
-                                                                               
                <xsl:value-of select="php:function('lang', 'description')"/>
-                                                                               
        </a>
-                                                                               
</label>
-                                                                               
                
-                                                                               
<textarea cols="{textareacols}" rows="{textarearows}" id="order_descr" 
name="values[order_descr]" wrap="virtual">
-                                                                               
        <xsl:attribute name="title">
-                                                                               
                <xsl:value-of select="php:function('lang', 'description 
order')"/>
-                                                                               
        </xsl:attribute>
-                                                                               
        <xsl:value-of select="value_order_descr"/>
-                                                                               
</textarea>
-                                                                       </div>
                                                                        
<xsl:choose>
                                                                                
<xsl:when test="need_approval='1'">
                                                                                
        <div class="pure-control-group">

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2016-04-22 07:32:50 UTC (rev 
14928)
+++ trunk/property/templates/base/workorder.xsl 2016-04-22 14:29:43 UTC (rev 
14929)
@@ -506,68 +506,176 @@
                                        </div>
                                        <xsl:choose>
                                                <xsl:when test="mode='edit'">
-                                                       <xsl:call-template 
name="event_form"/>
+                                                       <!--xsl:call-template 
name="event_form"/-->
                                                        <xsl:call-template 
name="vendor_form"/>
-                                                       <div 
class="pure-control-group">
-                                                               <label 
for="name">
-                                                                       
<xsl:value-of select="php:function('lang', 'send order')"/>
-                                                               </label>
-                                                               <div 
class="pure-custom">
-                                                                       
<xsl:for-each select="datatable_def">
-                                                                               
<xsl:if test="container = 'datatable-container_4'">
-                                                                               
        <xsl:call-template name="table_setup">
-                                                                               
                <xsl:with-param name="container" select ='container'/>
-                                                                               
                <xsl:with-param name="requestUrl" select ='requestUrl' />
-                                                                               
                <xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
-                                                                               
                <xsl:with-param name="tabletools" select ='tabletools' />
-                                                                               
                <xsl:with-param name="data" select ='data' />
-                                                                               
                <xsl:with-param name="config" select ='config' />
-                                                                               
        </xsl:call-template>
-                                                                               
</xsl:if>
-                                                                       
</xsl:for-each>
-                                                               </div>
-                                                       </div>
-                                                       <div 
class="pure-control-group">
-                                                               <label 
for="name">
-                                                                       
<xsl:value-of select="php:function('lang', 'extra mail address')"/>
-                                                               </label>
-                                                               <input 
type="text" name="values[vendor_email][]" value="{value_extra_mail_address}">
-                                                                       
<xsl:attribute name="title">
-                                                                               
<xsl:value-of select="php:function('lang', 'The order will also be sent to this 
one')"/>
-                                                                       
</xsl:attribute>
-                                                               </input>
-                                                       </div>
                                                </xsl:when>
                                                <xsl:otherwise>
-                                                       <xsl:call-template 
name="event_view"/>
                                                        <xsl:call-template 
name="vendor_view"/>
                                                </xsl:otherwise>
                                        </xsl:choose>
-                                       <xsl:call-template name="ecodimb_form"/>
                                        <div class="pure-control-group">
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'contract')"/>
+                                               </label>
+                                               <select id="vendor_contract_id" 
name="values[contract_id]">
+                                                       <xsl:if test="mode != 
'edit'">
+                                                               <xsl:attribute 
name="disabled">
+                                                                       
<xsl:text>disabled</xsl:text>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                                       <option value="">
+                                                               <xsl:value-of 
select="php:function('lang', 'select')"/>
+                                                       </option>
+                                                       <xsl:apply-templates 
select="contract_list/options"/>
+                                               </select>
+                                       </div>
+
+                                       <div class="pure-control-group">
                                                <label for="name">
-                                                       <xsl:value-of 
select="b_group_data/lang_b_account"/>
+                                                       <xsl:value-of 
select="php:function('lang', 'send order')"/>
                                                </label>
-                                               <input type="text" size="9" 
value="{b_group_data/value_b_account_id}" readonly="readonly">
-                                                       <xsl:attribute 
name="disabled">
-                                                               
<xsl:text>disabled</xsl:text>
+                                               <div class="pure-custom">
+                                                       <xsl:for-each 
select="datatable_def">
+                                                               <xsl:if 
test="container = 'datatable-container_4'">
+                                                                       
<xsl:call-template name="table_setup">
+                                                                               
<xsl:with-param name="container" select ='container'/>
+                                                                               
<xsl:with-param name="requestUrl" select ='requestUrl' />
+                                                                               
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+                                                                               
<xsl:with-param name="tabletools" select ='tabletools' />
+                                                                               
<xsl:with-param name="data" select ='data' />
+                                                                               
<xsl:with-param name="config" select ='config' />
+                                                                       
</xsl:call-template>
+                                                               </xsl:if>
+                                                       </xsl:for-each>
+                                               </div>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <label for="name">
+                                                       <xsl:value-of 
select="php:function('lang', 'extra mail address')"/>
+                                               </label>
+                                               <input type="text" 
name="values[vendor_email][]" value="{value_extra_mail_address}">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'The order will also be sent to this one')"/>
                                                        </xsl:attribute>
+                                                       <xsl:if test="mode != 
'edit'">
+                                                               <xsl:attribute 
name="disabled">
+                                                                       
<xsl:text>disabled</xsl:text>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
                                                </input>
-                                               <input type="text" size="30" 
value="{b_group_data/value_b_account_name}" readonly="readonly">
-                                                       <xsl:attribute 
name="disabled">
-                                                               
<xsl:text>disabled</xsl:text>
-                                                       </xsl:attribute>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <xsl:variable 
name="lang_service">
+                                                       <xsl:value-of 
select="php:function('lang', 'service')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_service"/>
+                                               </label>
+                                               <input type="hidden" 
id="service_id" name="values[service_id]"  value="{value_service_id}"/>
+                                               <input type="text" 
id="service_name" name="values[service_name]" value="{value_service_name}">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="mode='edit'">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:when>
+                                                               <xsl:otherwise 
test="mode='edit'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="$lang_service"/>
+                                                                       
</xsl:attribute>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
                                                </input>
+                                               <div id="service_container"/>
                                        </div>
-                                       <xsl:choose>
-                                               <xsl:when test="mode='edit'">
-                                                       <xsl:call-template 
name="b_account_form"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:call-template 
name="b_account_view"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
                                        <div class="pure-control-group">
+                                               <xsl:variable name="lang_dimb">
+                                                       <xsl:value-of 
select="php:function('lang', 'dimb')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_dimb"/>
+                                               </label>
+                                               <input type="hidden" 
id="ecodimb" name="values[ecodimb]"  value="{ecodimb_data/value_ecodimb}"/>
+                                               <input type="text" 
id="ecodimb_name" name="values[ecodimb_name]" 
value="{ecodimb_data/value_ecodimb} {ecodimb_data/value_ecodimb_descr}">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="mode='edit'">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:when>
+                                                               <xsl:otherwise 
test="mode='edit'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="$lang_dimb"/>
+                                                                       
</xsl:attribute>
+
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </input>
+                                               <div id="ecodimb_container"/>
+                                       </div>
+                                       <div class="pure-control-group">
+                                               <xsl:variable 
name="lang_budget_account">
+                                                       <xsl:value-of 
select="php:function('lang', 'budget account')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_budget_account"/>
+                                               </label>
+                                               <input type="hidden" 
id="b_account_id" name="values[b_account_id]"  
value="{b_account_data/value_b_account_id}"/>
+                                               <input type="text" 
id="b_account_name" name="values[b_account_name]" 
value="{b_account_data/value_b_account_name}">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="mode='edit'">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:when>
+                                                               <xsl:otherwise 
test="mode='edit'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="$lang_budget_account"/>
+                                                                       
</xsl:attribute>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </input>
+                                               <div id="b_account_container"/>
+                                       </div>
+                                       <!--xsl:call-template 
name="b_account_form"/-->
+                                       <div class="pure-control-group">
+                                               <xsl:variable 
name="lang_unspsc_code">
+                                                       <xsl:value-of 
select="php:function('lang', 'unspsc code')"/>
+                                               </xsl:variable>
+                                               <label>
+                                                       <xsl:value-of 
select="$lang_unspsc_code"/>
+                                               </label>
+                                               <input type="hidden" 
id="unspsc_code" name="values[unspsc_code]"  value="{value_unspsc_code}"/>
+                                               <input type="text" 
id="unspsc_code_name" name="values[unspsc_code_name]" 
value="{value_unspsc_code} {value_unspsc_code_name}">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="mode='edit'">
+                                                                       
<xsl:attribute name="data-validation">
+                                                                               
<xsl:text>required</xsl:text>
+                                                                       
</xsl:attribute>
+                                                               </xsl:when>
+                                                               <xsl:otherwise 
test="mode='edit'">
+                                                                       
<xsl:attribute name="disabled">
+                                                                               
<xsl:text>disabled</xsl:text>
+                                                                       
</xsl:attribute>
+                                                                       
<xsl:attribute name="data-validation-error-msg">
+                                                                               
<xsl:value-of select="$lang_unspsc_code"/>
+                                                                       
</xsl:attribute>
+
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                               </input>
+                                               <div 
id="unspsc_code_container"/>
+                                       </div>
+                                       <div class="pure-control-group">
                                                <label for="name">
                                                        <xsl:value-of 
select="lang_cat_sub"/>
                                                </label>
@@ -1076,7 +1184,7 @@
                                <div id="invoice">
                                        <xsl:call-template 
name="location_form"/>
                                        <xsl:call-template 
name="b_account_form"/>
-                                       <xsl:call-template 
name="project_group_form"/>
+                                       <xsl:call-template 
name="external_project_form"/>
                                        <xsl:call-template name="ecodimb_form"/>
                                        <xsl:call-template name="vendor_form"/>
                                        <div class="pure-control-group">




reply via email to

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