fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6875] Merge 6870:6874 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6875] Merge 6870:6874 from trunk
Date: Fri, 28 Jan 2011 18:25:53 +0000

Revision: 6875
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6875
Author:   sigurdne
Date:     2011-01-28 18:25:52 +0000 (Fri, 28 Jan 2011)
Log Message:
-----------
Merge 6870:6874 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/templates/base/application.xsl
    branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
    branches/Version-1_0-branch/frontend/setup/default_records.inc.php
    branches/Version-1_0-branch/frontend/setup/phpgw_no.lang
    branches/Version-1_0-branch/frontend/setup/setup.inc.php
    branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
    branches/Version-1_0-branch/frontend/templates/base/config.tpl
    branches/Version-1_0-branch/frontend/templates/base/contract.xsl
    branches/Version-1_0-branch/frontend/templates/base/frontend.xsl
    branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-1_0-branch/property/inc/class.boentity.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
    branches/Version-1_0-branch/property/inc/class.uitts.inc.php
    branches/Version-1_0-branch/property/inc/hook_config.inc.php
    branches/Version-1_0-branch/property/templates/base/config.tpl
    branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
    branches/Version-1_0-branch/rental/inc/hook_settings.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.property_location.inc.php
    branches/Version-1_0-branch/rental/setup/phpgw_no.lang
    branches/Version-1_0-branch/rental/templates/base/config.tpl
    branches/Version-1_0-branch/rental/templates/base/party.php

Added Paths:
-----------
    branches/Version-1_0-branch/frontend/help/NO/contact.odt
    branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php
    branches/Version-1_0-branch/frontend/setup/nlsh/
    branches/Version-1_0-branch/rental/inc/hook_config.inc.php

Removed Paths:
-------------
    branches/Version-1_0-branch/frontend/help/NO/contact_BKB.odt

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


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

Modified: branches/Version-1_0-branch/booking/templates/base/application.xsl
===================================================================
--- branches/Version-1_0-branch/booking/templates/base/application.xsl  
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/booking/templates/base/application.xsl  
2011-01-28 18:25:52 UTC (rev 6875)
@@ -102,7 +102,7 @@
                                                <dd><xsl:value-of 
select="comment" disable-output-escaping="yes"/></dd>
                                        </xsl:when>
                                        <xsl:otherwise>                         
-                                               <dd><xsl:value-of 
select="comment"/></dd>
+                                               <dd><div style="width: 
80%;"><xsl:value-of select="comment"/></div></dd>
                                        </xsl:otherwise>
                                </xsl:choose>
                        </xsl:for-each>
@@ -113,7 +113,7 @@
             <dt><xsl:value-of select="php:function('lang', 'Activity')" /></dt>
             <dd><xsl:value-of select="application/activity_name"/></dd>
             <dt><xsl:value-of select="php:function('lang', 'Description')" 
/></dt>
-                       <dd><pre><xsl:value-of 
select="application/description"/></pre></dd>
+                       <dd><div style="width: 80%;"><xsl:value-of 
select="application/description"/></div></dd>
                </dl>
         <dl class="proplist-col">
             <dt class="heading">3. <xsl:value-of select="php:function('lang', 
'Where?')" /></dt>

Copied: branches/Version-1_0-branch/frontend/help/NO/contact.odt (from rev 
6874, trunk/frontend/help/NO/contact.odt)
===================================================================
(Binary files differ)

Deleted: branches/Version-1_0-branch/frontend/help/NO/contact_BKB.odt
===================================================================
(Binary files differ)

Modified: branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.borental.inc.php     
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/inc/class.borental.inc.php     
2011-01-28 18:25:52 UTC (rev 6875)
@@ -78,7 +78,7 @@
          *
          * @param integer $org_unit_ids
          */
-        public static function get_property_locations($org_unit_ids)
+        public static function get_property_locations($array)
         {
                
                $property_locations = array();
@@ -90,22 +90,28 @@
                $types = 
rental_socontract::get_instance()->get_fields_of_responsibility();
                        $location_id_internal = 
array_search('contract_type_internleie', $types);
                $location_id_in = array_search('contract_type_innleie', $types);
+               $location_id_ex = array_search('contract_type_eksternleie', 
$types);
                
-               foreach($org_unit_ids as $org_unit_id){
+               foreach($array as $row){
                        /*
              * 1. hent alle kontraktsparter som har org unit id (foreløpig 
bruker vi result_unit_number i rentalparty)
              * 2. hent alle kontrakter på kontraktspartene
              * 3. hent alle leieobjekt på kontraktene
              * 4. hent ut bygg-ider, location_code, fra leieobjektet
              */
-               
-                       if(!isset($org_unit_id['ORG_UNIT_ID']) || 
$org_unit_id['ORG_UNIT_ID'] == '')
+                       if(is_array($row))
                        {
-                               continue;
+                               if(!isset($row['ORG_UNIT_ID']) || 
$row['ORG_UNIT_ID'] == '')
+                               {
+                                       continue;
+                               }
+                               $parties = 
rental_soparty::get_instance()->get(null, null, null, null, null, null, 
array('org_unit_id' => $row['ORG_UNIT_ID']));
                        }
-                       
-                       $parties = rental_soparty::get_instance()->get(null, 
null, null, null, null, null, array('org_unit_id' => 
$org_unit_id['ORG_UNIT_ID']));
-                       
+                       else
+                       {
+                               $parties = 
rental_soparty::get_instance()->get(null, null, null, null, null, null, 
array('email' => $row));
+                       }
+               
                        $contracts = array();
                        $composites = array();
                        
@@ -134,8 +140,6 @@
                                                        $property_location = 
$unit->get_location();
                                                        
$property_locations[$property_location->get_location_code()] = 
$property_location;
                                                        
-                                                       
-                                                       
                                                        // Contract holders: 
contracts_per_location (internal) and contracts_in_per_location (in)
                                                        
                                                        // Internal contract 
should have impact on total price
@@ -173,6 +177,24 @@
                                                                }
                                                                
array_push($contracts_in_per_location[$property_location->get_location_code()], 
$contract);
                                                        }
+                                                       else 
if($contract->get_location_id() == $location_id_ex)
+                                                       {
+                                                               $total_price = 
rental_socontract_price_item::get_instance()->get_total_price($contract->get_id());
+                                                               
$contract->set_total_price($total_price);
+                                                               
+                                                               
if(!is_array($contracts_ex_per_location[$property_location->get_location_code()]))
+                                                               {
+                                                                       
$contracts_ex_per_location[$property_location->get_location_code()] = array();  
+                                                               }
+                                                               
array_push($contracts_ex_per_location[$property_location->get_location_code()], 
$contract);
+                                                               
+                                                               
if($contract->is_active())
+                                                               {
+                                                                       
$property_locations_active[$property_location->get_location_code()] = true;
+                                                                       
$rented_area_per_location[$property_location->get_location_code()] += 
$contract->get_rented_area();
+                                                                       
$rented_price_per_location[$property_location->get_location_code()] += 
$total_price;
+                                                               }
+                                                       }
                                                }                       
                                        }
                                }
@@ -181,6 +203,7 @@
                
                phpgwapi_cache::session_set('frontend', 
'contracts_per_location', $contracts_per_location);
                phpgwapi_cache::session_set('frontend', 
'contracts_in_per_location', $contracts_in_per_location);
+               phpgwapi_cache::session_set('frontend', 
'contracts_ex_per_location', $contracts_ex_per_location);
                phpgwapi_cache::session_set('frontend', 
'rented_area_per_location', $rented_area_per_location);
                phpgwapi_cache::session_set('frontend', 
'total_price_per_location', $rented_price_per_location);
                

Copied: branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php 
(from rev 6874, trunk/frontend/inc/class.uicontract_ex.inc.php)
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php        
                        (rev 0)
+++ branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -0,0 +1,15 @@
+<?php
+
+phpgw::import_class('frontend.uicontract');
+
+class frontend_uicontract_ex extends frontend_uicontract
+{
+       public function __construct()
+       {
+               $this->contract_state_identifier = "contract_state_ex";
+               $this->contracts_per_location_identifier = 
"contracts_ex_per_location";
+               $this->form_url = 
"index.php?menuaction=frontend.uicontract_ex.index";
+               
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.rental.contract_ex'));
+               parent::__construct();
+       }
+}

Modified: branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php   
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php   
2011-01-28 18:25:52 UTC (rev 6875)
@@ -53,6 +53,11 @@
                {
                        // This module uses XSLT templates
                        $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       
+                       $config = CreateObject('phpgwapi.config','frontend');
+                       $config->read();
+                       $use_fellesdata = 
$config->config_data['use_fellesdata'];
+                       $logo_path = $config->config_data['logo_path'];
 
                        // Get the mode: in frame or full screen
                        $mode = phpgwapi_cache::session_get('frontend', 
'noframework');
@@ -68,6 +73,8 @@
                        
                        // Get header state
                        $this->header_state = 
phpgwapi_cache::session_get('frontend', 'header_state');
+                       $this->header_state['use_fellesdata'] = $use_fellesdata;
+                       $this->header_state['logo_path'] = $logo_path;
                        
                        // Get navigation parameters
                        $param_selected_location = phpgw::get_var('location');  
                // New location selected from locations list
@@ -146,28 +153,37 @@
                                $this->insert_links_on_header_state();
                        } 
                        /* No state, first visit after login, or refresh 
request*/
-                       else if(!isset($this->header_state) || isset($refresh))
+                       else if(!isset($this->header_state) || isset($refresh) 
|| !isset($this->header_state['locations']))
                        {
-                               //Specify organisational units
-                               $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
-                               
-                               //Merge with delegation units
-                               $delegation_org_ids = 
frontend_bofrontend::get_delegations($GLOBALS['phpgw_info']['user']['account_id']);
-                               if(count($delegation_org_ids) > 0)
+                               if($use_fellesdata)
                                {
-                                       $delegation_units = 
frontend_bofellesdata::get_instance()->populate_result_units($delegation_org_ids);
-                                       $org_units = 
array_merge($org_units,$delegation_units);
+                                       //Specify organisational units
+                                       $org_units = 
frontend_bofellesdata::get_instance()->get_result_units($GLOBALS['phpgw_info']['user']['account_lid']);
+                                       
+                                       //Merge with delegation units
+                                       $delegation_org_ids = 
frontend_bofrontend::get_delegations($GLOBALS['phpgw_info']['user']['account_id']);
+                                       if(count($delegation_org_ids) > 0)
+                                       {
+                                               $delegation_units = 
frontend_bofellesdata::get_instance()->populate_result_units($delegation_org_ids);
+                                               $org_units = 
array_merge($org_units,$delegation_units);
+                                       }
+                                       
+                                       //Update org units on header state
+                                       $this->header_state['org_unit'] = 
$org_units;
+                                       
$this->header_state['number_of_org_units'] = count($org_units);
+                                       
$this->header_state['selected_org_unit'] = 'all';
+                                       
+                                       //Update locations
+                                       $property_locations = 
frontend_borental::get_property_locations($org_units);
                                }
+                               else 
+                               {
+                                       //If no organisational database is in 
use: get rented properties based on username
+                                       $usernames[] = 
$GLOBALS['phpgw_info']['user']['account_lid'];
+                                       $property_locations = 
frontend_borental::get_property_locations($usernames);
+                               }
                                
-                               //Update org units on header state
-                               $this->header_state['org_unit'] = $org_units;
-                               $this->header_state['number_of_org_units'] = 
count($org_units);
-                               $this->header_state['selected_org_unit'] = 
'all';
-                               
-                               //Update locations
-                               $property_locations = 
frontend_borental::get_property_locations($org_units);
                                $property_locations_update = true;
-
                                $this->insert_links_on_header_state();
                                
                        }
@@ -225,6 +241,7 @@
 
                                
phpgwapi_cache::session_clear('frontend','contract_state');
                                
phpgwapi_cache::session_clear('frontend','contract_state_in');
+                               
phpgwapi_cache::session_clear('frontend','contract_state_ex');
                        }
                        /* Store the header state on the session*/
                        $bomessenger = CreateObject('messenger.bomessenger');
@@ -317,7 +334,7 @@
                                 (
                                        'menuaction'=> 'manual.uimanual.help',
                                        'app' => 
$GLOBALS['phpgw_info']['flags']['currentapp'],
-                                       'section' => 'contact_BKB'
+                                       'section' => 'contact'
                                 )) . "','700','600')";
                 
                        $folder_url = "javascript:openwindow('"

Modified: branches/Version-1_0-branch/frontend/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2011-01-28 18:25:52 UTC (rev 6875)
@@ -12,6 +12,7 @@
        $GLOBALS['phpgw']->locations->add('.ticket', 'helpdesk', 'frontend', 
false);
        $GLOBALS['phpgw']->locations->add('.rental.contract', 
'contract_internal', 'frontend', false);
        
$GLOBALS['phpgw']->locations->add('.rental.contract_in','contract_in','frontend',
 false);
+       
$GLOBALS['phpgw']->locations->add('.rental.contract_ex','contract_ex','frontend',
 false);
        $GLOBALS['phpgw']->locations->add('.document.drawings', 'drawings', 
'frontend', false);
        $GLOBALS['phpgw']->locations->add('.document.pictures', 'pictures', 
'frontend', false);
        $GLOBALS['phpgw']->locations->add('.property.maintenance', 
'maintenance', 'frontend', false);

Modified: branches/Version-1_0-branch/frontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/frontend/setup/phpgw_no.lang    2011-01-28 
16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/setup/phpgw_no.lang    2011-01-28 
18:25:52 UTC (rev 6875)
@@ -7,6 +7,7 @@
 services       frontend        no      Tjenester
 contract       frontend        no      Kontrakter
 contract_in    frontend        no      Innleiekontrakter
+contract_ex    frontend        no      Eksternleiekontrakter
 helpdesk       frontend        no      Melding om avvik
 subject        frontend        no      Meldingstittel
 entry_date     frontend        no      Dato

Modified: branches/Version-1_0-branch/frontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/setup.inc.php    2011-01-28 
16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/setup/setup.inc.php    2011-01-28 
18:25:52 UTC (rev 6875)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['frontend']['name'] = 'frontend';
-       $setup_info['frontend']['version'] = '0.2';
+       $setup_info['frontend']['version'] = '0.4';
        $setup_info['frontend']['app_order'] = 9;
 //     $setup_info['frontend']['tables'] = array();
        $setup_info['frontend']['enable'] = 1;
@@ -29,6 +29,11 @@
                'appname' => 'rental',
                'versions' => array('0.1.0')
        );
+       
+       $setup_info['frontend']['depends'][] = array(
+               'appname' => 'messenger',
+               'versions' => array('0.9.17.500')
+       );
 
        /* The hooks this app includes, needed for hooks registration */
        $setup_info['frontend']['hooks'] = array

Modified: branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2011-01-28 18:25:52 UTC (rev 6875)
@@ -12,7 +12,7 @@
        */
 
        /**
-       * Update frontend version from 0.1 to 0.9.17.500
+       * Update frontend version from 0.1 to 0.2
        * Add locations as placeholders for functions and menues
        * 
        */
@@ -32,13 +32,33 @@
 
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
-                       $GLOBALS['setup_info']['frontend']['currentver'] = 
'0.9.17.500';
+                       $GLOBALS['setup_info']['frontend']['currentver'] = 
'0.2';
                        return $GLOBALS['setup_info']['frontend']['currentver'];
                }
        }
        
+       /**
+       * Update frontend version from 0.1 to 0.2
+       * Add new location as placeholders for functions and menues
+       * 
+       */
        $test[] = '0.2';
        function frontend_upgrade0_2()
        {
                
$GLOBALS['phpgw']->locations->add('.rental.contract_in','contract_in','frontend',
 false);
+               $GLOBALS['setup_info']['frontend']['currentver'] = '0.3';
+               return $GLOBALS['setup_info']['frontend']['currentver'];
        }
+       
+       /**
+       * Update frontend version from 0.2 to 0.3
+       * Add new location as placeholders for functions and menues
+       * 
+       */
+       $test[] = '0.3';
+       function frontend_upgrade0_3()
+       {
+               
$GLOBALS['phpgw']->locations->add('.rental.contract_ex','contract_ex','frontend',
 false);
+               $GLOBALS['setup_info']['frontend']['currentver'] = '0.4';
+               return $GLOBALS['setup_info']['frontend']['currentver'];
+       }

Modified: branches/Version-1_0-branch/frontend/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/config.tpl      
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/templates/base/config.tpl      
2011-01-28 18:25:52 UTC (rev 6875)
@@ -74,7 +74,16 @@
                <tr class="row_off">
                        <td>{lang_delegate_limit}:</td>
                        <td><input name="newsettings[delegate_limit]" 
value="{value_delegate_limit}"></td>
-               </tr>           
+               </tr>
+               <tr class="row_off">
+                       <td>{lang_use_fellesdata}:</td>
+                       <td>
+                               <select name="newsettings[use_fellesdata]">
+                                       <option value="" 
{selected_use_fellesdata_}>NO</option>
+                                       <option value="1" 
{selected_use_fellesdata_1}>YES</option>
+                               </select>
+                       </td>
+               </tr>   
                <tr class="row_on">
                        <td colspan="2">&nbsp;<b>{lang_external_db}</b></td>
                </tr>
@@ -124,6 +133,13 @@
                        <td>{lang_email_contract_messages}:</td>
                        <td><input name="newsettings[email_contract_messages]" 
value="{value_email_contract_messages}"></td>
                </tr>
+               <tr class="row_on">
+                       <td colspan="2">&nbsp;<b>{lang_logo_settings}</b></td>
+               </tr>
+               <tr class="row_on">
+                       <td>{lang_logo_contract_messages}:</td>
+                       <td><input name="newsettings[logo_path]" 
value="{value_logo_path}"></td>
+               </tr>
 <!-- END body -->
 <!-- BEGIN footer -->
                <tr class="th">

Modified: branches/Version-1_0-branch/frontend/templates/base/contract.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/contract.xsl    
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/templates/base/contract.xsl    
2011-01-28 18:25:52 UTC (rev 6875)
@@ -130,7 +130,7 @@
                                                                                
                <li>
                                                                                
                        <dl style="padding-left: 1em;">
                                                                                
                                <dt style="float: left;"><img 
src="frontend/templates/base/images/16x16/house.png" class="list_image" /></dt>
-                                                                               
                                <dd>
+                                                                               
                                <dd><br/>
                                                                                
                                        <xsl:if test="normalize-space(address)">
                                                                                
                                                <xsl:value-of select="address" 
disable-output-escaping="yes"/>
                                                                                
                                        </xsl:if>

Modified: branches/Version-1_0-branch/frontend/templates/base/frontend.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/frontend.xsl    
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/frontend/templates/base/frontend.xsl    
2011-01-28 18:25:52 UTC (rev 6875)
@@ -3,7 +3,7 @@
        <div id="header">
                <div id="login-bar">
                        <ul class="user_menu">
-                               <li><em><img 
src="frontend/templates/base/images/16x16/user_red.png"  class="list_image" 
/></em><xsl:value-of select="name_of_user"/></li>
+                               <li><em><img 
src="frontend/templates/base/images/16x16/user_red.png"  class="list_image" 
/></em><xsl:value-of select="name_of_user"/> | <a 
href="http://portico/pe/preferences/changepassword.php";>Bytt passord</a></li>
                                <li><a 
href="index.php?menuaction=frontend.uimessages.index" 
class="list_image"><em><img 
src="frontend/templates/base/images/16x16/email.png" 
class="list_image"/></em><xsl:value-of select="new_messages"/></a></li>
                                <li>
                                        <a href="logout.php"  
class="header_link"><em><img 
src="frontend/templates/base/images/16x16/door_out.png" 
class="list_image"/></em><xsl:value-of select="php:function('lang', 
'logout')"/></a> 
@@ -26,61 +26,72 @@
                                <li><em><img 
src="frontend/templates/base/images/16x16/coins.png" 
class="list_image"/></em><xsl:value-of select="php:function('lang', 
'total_price_internal')"/>: <xsl:value-of select="total_price"/></li>
                        </ul>
                        </div>
-                       <div id="org_units">
-                       <ul>
-                               <li>
-                                       <em>
-                                               <img 
src="frontend/templates/base/images/16x16/chart_organisation.png"  
class="list_image" />
-                                       </em>
-                                       <xsl:value-of 
select="php:function('lang', 'organisational_units')"/> 
-                                       (<xsl:value-of 
select="number_of_org_units"/>)
-                                       <a 
href="index.php?menuaction=frontend.uihelpdesk.index&amp;refresh=true" 
class="list_image">
-                                               <img 
src="frontend/templates/base/images/16x16/page_refresh.png" class="list_image"/>
-                                       </a>
-                               </li>
-                               <li>
-                                       <form 
action="index.php?menuaction=frontend.uihelpdesk.index" method="post">
-                                               <select size="3" 
onchange="this.form.submit()" name="org_unit_id">
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="selected_org_unit = 'all'">
-                                                                       <option 
value="all" selected="selected"><xsl:value-of select="php:function('lang', 
'all_organisational_units')"/></option>
-                                                                       
<xsl:for-each select="org_unit">
-                                                                               
<xsl:sort select="ORG_NAME"/>
-                                                                               
<option value="{ORG_UNIT_ID}"><xsl:value-of select="ORG_NAME"/></option>
-                                                                       
</xsl:for-each>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       <option 
value="all"><xsl:value-of select="php:function('lang', 
'all_organisational_units')"/></option>
-                                                                       
<xsl:for-each select="org_unit">
-                                                                               
<xsl:sort select="ORG_NAME"/>
-                                                                               
<xsl:choose>
-                                                                               
                <xsl:when test="ORG_UNIT_ID = //header/selected_org_unit">
-                                                                               
                        <option value="{ORG_UNIT_ID}" 
selected="selected"><xsl:value-of select="ORG_NAME"/></option>
-                                                                               
                </xsl:when>
-                                                                               
                <xsl:otherwise>
-                                                                               
                        <option value="{ORG_UNIT_ID}"><xsl:value-of 
select="ORG_NAME"/></option>
-                                                                               
                </xsl:otherwise>
-                                                                               
        </xsl:choose>
-                                                                       
</xsl:for-each>
-                                                               </xsl:otherwise>
-                                                               
-                                                       </xsl:choose> 
-                                               </select>
-                                       </form>
-                               </li>
-                       </ul>
-                       </div>
+                       <xsl:choose>
+                       <xsl:when test="use_fellesdata = 1">
+                                       <div id="org_units">
+                                       <ul>
+                                               <li>
+                                                       <em>
+                                                               <img 
src="frontend/templates/base/images/16x16/chart_organisation.png"  
class="list_image" />
+                                                       </em>
+                                                       <xsl:value-of 
select="php:function('lang', 'organisational_units')"/> 
+                                                       (<xsl:value-of 
select="number_of_org_units"/>)
+                                                       <a 
href="index.php?menuaction=frontend.uihelpdesk.index&amp;refresh=true" 
class="list_image">
+                                                               <img 
src="frontend/templates/base/images/16x16/page_refresh.png" class="list_image"/>
+                                                       </a>
+                                               </li>
+                                               <li>
+                                                       <form 
action="index.php?menuaction=frontend.uihelpdesk.index" method="post">
+                                                               <select 
size="3" onchange="this.form.submit()" name="org_unit_id">
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="selected_org_unit = 'all'">
+                                                                               
        <option value="all" selected="selected"><xsl:value-of 
select="php:function('lang', 'all_organisational_units')"/></option>
+                                                                               
        <xsl:for-each select="org_unit">
+                                                                               
                <xsl:sort select="ORG_NAME"/>
+                                                                               
                <option value="{ORG_UNIT_ID}"><xsl:value-of 
select="ORG_NAME"/></option>
+                                                                               
        </xsl:for-each>
+                                                                               
</xsl:when>
+                                                                               
<xsl:otherwise>
+                                                                               
        <option value="all"><xsl:value-of select="php:function('lang', 
'all_organisational_units')"/></option>
+                                                                               
        <xsl:for-each select="org_unit">
+                                                                               
                <xsl:sort select="ORG_NAME"/>
+                                                                               
                <xsl:choose>
+                                                                               
                                <xsl:when test="ORG_UNIT_ID = 
//header/selected_org_unit">
+                                                                               
                                        <option value="{ORG_UNIT_ID}" 
selected="selected"><xsl:value-of select="ORG_NAME"/></option>
+                                                                               
                                </xsl:when>
+                                                                               
                                <xsl:otherwise>
+                                                                               
                                        <option 
value="{ORG_UNIT_ID}"><xsl:value-of select="ORG_NAME"/></option>
+                                                                               
                                </xsl:otherwise>
+                                                                               
                        </xsl:choose>
+                                                                               
        </xsl:for-each>
+                                                                               
</xsl:otherwise>
+                                                                               
+                                                                       
</xsl:choose> 
+                                                               </select>
+                                                       </form>
+                                               </li>
+                                       </ul>
+                                       </div>
+                               </xsl:when>
+                       </xsl:choose>
                        <div id="logo_holder">
-                               <img 
src="https://www.bergen.kommune.no/internet/htdocs/images/logo.gif"/>
+                               <img src="{logo_path}"/>
                        </div>
                </div>
     </div>
-       <table id="header">     
+       <table id="header">
                <xsl:choose>
                        <xsl:when test="number_of_locations = 0">
                                <tr valign="top">
                                        <td>
                                                <label>
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="use_fellesdata != 1">
+                                                                       <a 
href="index.php?menuaction=frontend.uihelpdesk.index&amp;refresh=true" 
class="list_image">
+                                                                               
                                <img 
src="frontend/templates/base/images/16x16/page_refresh.png" class="list_image"/>
+                                                                               
                        </a>
+                                                                 </xsl:when>
+                                                       </xsl:choose>
                                                        <img 
src="frontend/templates/base/images/32x32/house.png" class="list_image"/>
                                                        <em 
class="select_header"><xsl:value-of select="php:function('lang', 
'no_buildings')"/></em>
                                                </label>
@@ -93,6 +104,13 @@
                                                <div id="unit_selector">
                                                        <form 
action="index.php?menuaction=frontend.uihelpdesk.index" method="post">
                                                                <label>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="use_fellesdata != 1">
+                                                                               
        <a 
href="index.php?menuaction=frontend.uihelpdesk.index&amp;refresh=true" 
class="list_image">
+                                                                               
                                                <img 
src="frontend/templates/base/images/16x16/page_refresh.png" class="list_image"/>
+                                                                               
                                        </a>
+                                                                               
  </xsl:when>
+                                                                       
</xsl:choose>
                                                                        <img 
src="frontend/templates/base/images/32x32/house.png" class="list_image"/>
                                                                        <em 
class="select_header"><xsl:value-of select="php:function('lang', 
'select_unit')"/></em>
                                                                </label>

Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2011-01-28 18:25:52 UTC (rev 6875)
@@ -1259,29 +1259,35 @@
                                $cols_return[] = 'loc' . 
$location_types[$i]['id'];
                        }
 
-                       if($lookup)
+//                     if($lookup)
                        {
+                               $GLOBALS['phpgw']->config->read();
+                               $list_location_level = 
isset($GLOBALS['phpgw']->config->config_data['list_location_level'])     && 
$GLOBALS['phpgw']->config->config_data['list_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['list_location_level'] : array();
+/*
                                $cols_return[]                          = 
'loc1_name';
                                $cols_extra[]                           = 
'loc1_name';
-                               $uicols['input_type'][]         = 'text';
+                               $cols_return_lookup[]           = 
"loc{$i}_name";
+                               $uicols['input_type'][]         = in_array(1, 
$list_location_level) ? 'text' : 'hidden';
                                $uicols['name'][]                       = 
'loc1_name';
-                               $uicols['descr'][]                      = 
lang('Property Name');
-                               $uicols['statustext'][]         = 
lang('Property Name');
-                               $uicols['exchange'][]           = true;
+                               $uicols['descr'][]                      = 
$location_types[0]['name'];
+                               $uicols['statustext'][]         = 
$location_types[0]['descr'];
+                               $uicols['exchange'][]           = $lookup;
                                $uicols['align'][]                      = '';
                                $uicols['datatype'][]           = '';
                                $uicols['formatter'][]          = '';
                                $uicols['classname'][]          = '';
                                $uicols['sortable'][]           = true;
-
-                               for ($i=2;$i<($type_id+1);$i++)
+*/
+                               for ($i=1;$i<($type_id+1);$i++)
                                {
-                                       $cols_return_lookup[]           = 'loc' 
. $i . '_name';
-                                       $uicols['input_type'][]         = 
'hidden';
-                                       $uicols['name'][]                       
= 'loc' . $i . '_name';
-                                       $uicols['descr'][]                      
= '';
-                                       $uicols['statustext'][]         = '';
-                                       $uicols['exchange'][]           = true;
+                                       $cols_return[]                          
= "loc{$i}_name";
+                                       $cols_extra[]                           
= "loc{$i}_name";
+                                       $cols_return_lookup[]           = 
"loc{$i}_name";
+                                       $uicols['input_type'][]         = 
in_array($i, $list_location_level) ? 'text' : 'hidden';
+                                       $uicols['name'][]                       
= "loc{$i}_name";
+                                       $uicols['descr'][]                      
= $location_types[($i-1)]['name'];
+                                       $uicols['statustext'][]         = 
$location_types[$i-1]['descr'];
+                                       $uicols['exchange'][]           = 
$lookup;
                                        $uicols['align'][]                      
= '';
                                        $uicols['datatype'][]           = '';
                                        $uicols['formatter'][]          = '';

Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2011-01-28 18:25:52 UTC (rev 6875)
@@ -308,21 +308,21 @@
                        //_debug_array($cols_extra);
                        //_debug_array($cols_return_lookup);
 
-                       if(isset($data['lookup']) && $data['lookup'])
+//                     if(isset($data['lookup']) && $data['lookup'])
                        {
-                               for ($i=0;$i<count($entity);$i++)
+                               foreach ($entity as &$entry)
                                {
-                                       
$location_data=$this->solocation->read_single($entity[$i]['location_code']);
+                                       $location_data = 
$this->solocation->read_single($entry['location_code']);
                                        for ($j=0;$j<count($cols_extra);$j++)
                                        {
-                                               $entity[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
+                                               $entry[$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
                                        }
 
                                        if($cols_return_lookup)
                                        {
                                                for 
($k=0;$k<count($cols_return_lookup);$k++)
                                                {
-                                                       
$entity[$i][$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
+                                                       
$entry[$cols_return_lookup[$k]] = $location_data[$cols_return_lookup[$k]];
                                                }
                                        }
                                }

Modified: branches/Version-1_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2011-01-28 18:25:52 UTC (rev 6875)
@@ -1141,7 +1141,7 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
-                       //echo $sql;
+//                     _debug_array($sql);
                        $cols_return    = $this->cols_return;
 
                        $this->db->next_record();

Modified: branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uilookup.inc.php     
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/class.uilookup.inc.php     
2011-01-28 18:25:52 UTC (rev 6875)
@@ -2011,12 +2011,12 @@
 
                        for ($i=0;$i<count($input_name);$i++)
                        {
-                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = "";' 
."\r\n";
+                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = '';\r\n";
                        }
 
                        for ($i=0;$i<count($input_name);$i++)
                        {
-                               $function_exchange_values .= 
'opener.document.getElementsByName("'.$input_name[$i].'")[0].value = 
data.getData("'.$input_name[$i].'");' ."\r\n";
+                               $function_exchange_values .= 
"opener.document.getElementsByName('{$input_name[$i]}')[0].value = 
data.getData('{$input_name[$i]}');\r\n";
                        }
 
                        $function_exchange_values .= 'window.close()';
@@ -2069,11 +2069,11 @@
                                        {
                                                if(isset($column['format']) && 
$column['format']== "link" && $column['java_link']==true)
                                                {
-                                                       
$json_row[$column['name']] = "<a href='#' id='".$column['link']."' 
onclick='javascript:filter_data(this.id);'>" .$column['value']."</a>";
+                                                       
$json_row[$column['name']] = "<a href='#' id='{$column['link']}' 
onclick='javascript:filter_data(this.id);'>{$column['value']}</a>";
                                                }
                                                else 
if(isset($column['format']) && $column['format']== "link")
                                                {
-                                                       
$json_row[$column['name']] = "<a href='".$column['link']."' target='_blank'>" 
.$column['value']."</a>";
+                                                       
$json_row[$column['name']] = "<a href='{$column['link']}' 
target='_blank'>{$column['value']}</a>";
                                                }
                                                else
                                                {

Modified: branches/Version-1_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -755,64 +755,104 @@
                        }
 
                        $ticket_list = array();
-                       //                      if(!$dry_run)
-                               {
-                                       $ticket_list = 
$this->bo->read($start_date, $end_date,'',$dry_run);
-                               }
 
+                       $ticket_list = $this->bo->read($start_date, 
$end_date,'',$dry_run);
+
                        $this->bo->get_origin_entity_type();
                        $uicols_related = $this->bo->uicols_related;
                        //_debug_array($uicols_related);
                        $uicols = array();
 
                        $uicols['name'][] = 'priority';
+                       $uicols['descr'][]      = lang('priority');
                        $uicols['name'][] = 'id';
+                       $uicols['descr'][]      = lang('id');
                        $uicols['name'][] = 'bgcolor';
+                       $uicols['descr'][]      = lang('bgcolor');
                        $uicols['name'][] = 'subject';
-                       $uicols['name'][] = 'loc1_name';
+                       $uicols['descr'][]      = lang('subject');
                        $uicols['name'][] = 'location_code';
+                       $uicols['descr'][]      = lang('location code');
+                       $location_types = 
execMethod('property.soadmin_location.select_location_type');
+                       $level_assigned = 
isset($this->bo->config->config_data['list_location_level']) && 
$this->bo->config->config_data['list_location_level'] ? 
$this->bo->config->config_data['list_location_level'] : array();
+
+                       foreach ( $location_types as $dummy => $level)
+                       {
+                               if ( in_array($level['id'], $level_assigned))
+                               {
+                                       $uicols['name'][] = 
"loc{$level['id']}_name";
+                                       $uicols['descr'][]      = 
$level['name'];
+                                       if($level['id'] > 1)
+                                       {
+                                               foreach ($ticket_list as & 
$ticket)
+                                               {
+                                                       $location_data = 
execMethod('property.solocation.read_single', $ticket['location_code']);
+                                                       
$ticket["loc{$level['id']}_name"] = $location_data["loc{$level['id']}_name"];
+                                               }
+                                       }
+                               }
+                       }
+
+//                     $uicols['name'][] = 'loc1_name';
+
                        $uicols['name'][] = 'address';
-                       //                      $uicols['name'][] = 'user';
+                       $uicols['descr'][]      = lang('address');
+//                     $uicols['name'][] = 'user';
+//                     $uicols['descr'][]      = lang('user');
                        $uicols['name'][] = 'assignedto';
+                       $uicols['descr'][]      = lang('assignedto');
                        $uicols['name'][] = 'entry_date';
+                       $uicols['descr'][]      = lang('entry date');
                        $uicols['name'][] = 'status';
+                       $uicols['descr'][]      = lang('status');
 
                        if( $this->acl->check('.ticket.order', PHPGW_ACL_READ, 
'property') )
                        {
                                $uicols['name'][] = 'order_id';
+                               $uicols['descr'][]      = lang('order id');
                                $uicols['name'][] = 'vendor';
+                               $uicols['descr'][]      = lang('vendor');
                        }
 
                        if( $this->acl->check('.ticket.order', PHPGW_ACL_ADD, 
'property') )
                        {
                                $uicols['name'][] = 'estimate';
+                               $uicols['descr'][]      = lang('estimate');
                                $uicols['name'][] = 'actual_cost';
+                               $uicols['descr'][]      = lang('actual cost');
                        }
 
                        foreach($uicols_related as $related)
                        {
                                $uicols['name'][] = $related;                   
+                               $uicols['descr'][]      = lang(str_replace('_', 
' ', $related));
                        }
 
                        if( $this->_show_finnish_date )
                        {
                                $uicols['name'][] = 'finnish_date';
+                               $uicols['descr'][]      = lang('finnish date');
                                $uicols['name'][] = 'delay';
+                               $uicols['descr'][]      = lang('delay');
                        }
 
                        $uicols['name'][] = 'child_date';
+                       $uicols['descr'][]      = lang('child date');
                        $uicols['name'][] = 'link_view';
+                       $uicols['descr'][]      = lang('link view');
                        $uicols['name'][] = 'lang_view_statustext';
+                       $uicols['descr'][]      = lang('lang view statustext');
                        $uicols['name'][] = 'text_view';
+                       $uicols['descr'][]      = lang('text view');
 
                        $custom_cols = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] 
? $GLOBALS['phpgw_info']['user']['preferences']['property']['ticket_columns'] : 
array();
 
                        foreach ($custom_cols as $col)
                        {
-                               //                      $uicols['input_type'][] 
= 'text';
-                               $uicols['name'][]                       = $col;
-                               //                      $uicols['descr'][]      
        = lang(str_replace('_', ' ', $col));
-                               //                      $uicols['statustext'][] 
= $col;
+       //                      $uicols['input_type'][] = 'text';
+                               $uicols['name'][]               = $col;
+       //                      $uicols['descr'][]              = 
lang(str_replace('_', ' ', $col));
+       //                      $uicols['statustext'][] = $col;
                        }
 
 
@@ -1018,25 +1058,25 @@
                        unset($parameters);
                        for ($i=0;$i<$count_uicols_name;$i++)
                        {
-                               //              
if($uicols['input_type'][$i]!='hidden')
-                       {
-                               
$datatable['headers']['header'][$i]['formatter']                = 
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''?  '""' : 
$uicols['formatter'][$i];
-                               $datatable['headers']['header'][$i]['name']     
                = $uicols['name'][$i];
-                               $datatable['headers']['header'][$i]['text']     
                = lang(str_replace('_', ' ', $uicols['name'][$i]));
-                               $datatable['headers']['header'][$i]['visible']  
                = true;
-                               $datatable['headers']['header'][$i]['sortable'] 
                = false;
-                               if($uicols['name'][$i]=='priority' || 
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto' || 
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'|| 
$uicols['name'][$i]=='entry_date' || $uicols['name'][$i]=='order_id')
+       //              if($uicols['input_type'][$i]!='hidden')
                                {
-                                       
$datatable['headers']['header'][$i]['sortable']         = true;
-                                       
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['formatter']                = 
!isset($uicols['formatter'][$i]) || $uicols['formatter'][$i]==''?  '""' : 
$uicols['formatter'][$i];
+                                       
$datatable['headers']['header'][$i]['name']                     = 
$uicols['name'][$i];
+                                       
$datatable['headers']['header'][$i]['text']                     = 
$uicols['descr'][$i];
+                                       
$datatable['headers']['header'][$i]['visible']                  = true;
+                                       
$datatable['headers']['header'][$i]['sortable']                 = false;
+                                       if($uicols['name'][$i]=='priority' || 
$uicols['name'][$i]=='id' || $uicols['name'][$i]=='assignedto' || 
$uicols['name'][$i]=='finnish_date'|| $uicols['name'][$i]=='user'|| 
$uicols['name'][$i]=='entry_date' || $uicols['name'][$i]=='order_id')
+                                       {
+                                               
$datatable['headers']['header'][$i]['sortable']         = true;
+                                               
$datatable['headers']['header'][$i]['sort_field']   = $uicols['name'][$i];
+                                       }
+                                       if($uicols['name'][$i]=='text_view' || 
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' || 
$uicols['name'][$i]== 'link_view' || 
$uicols['name'][$i]=='lang_view_statustext')
+                                       {
+                                               
$datatable['headers']['header'][$i]['visible']          = false;
+                                               
$datatable['headers']['header'][$i]['format']           = 'hidden';
+                                       }
                                }
-                               if($uicols['name'][$i]=='text_view' || 
$uicols['name'][$i]=='bgcolor' || $uicols['name'][$i]=='child_date' || 
$uicols['name'][$i]== 'link_view' || 
$uicols['name'][$i]=='lang_view_statustext')
-                               {
-                                       
$datatable['headers']['header'][$i]['visible']          = false;
-                                       
$datatable['headers']['header'][$i]['format']           = 'hidden';
-                               }
                        }
-                       }
 
                        //path for property.js
                        $datatable['property_js'] = 
$GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property.js";

Modified: branches/Version-1_0-branch/property/inc/hook_config.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/hook_config.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/inc/hook_config.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -171,3 +171,30 @@
                return $out;
        }
 
+
+       /**
+       * Get HTML checkbox with location levels that should be listed in lists
+       *
+       * @param $config
+       * @return string HTML checkboxes to be placed in a table
+       */
+       function list_location_level($config)
+       {
+               $location_types = 
execMethod('property.soadmin_location.select_location_type');
+
+               $level_assigned = isset($config['list_location_level']) ? 
$config['list_location_level'] : array();
+               $out = '';
+               foreach ( $location_types as $dummy => $level)
+               {
+                       $checked = '';
+                       if ( in_array($level['id'], $level_assigned))
+                       {
+                               $checked = ' checked';
+                       }
+
+                       $out .=  <<<HTML
+                       <tr><td><input type="checkbox" 
name="newsettings[list_location_level][]" value="{$level['id']}" 
{$checked}><label>{$level['name']}</label></td></tr>
+HTML;
+               }
+               return $out;
+       }

Modified: branches/Version-1_0-branch/property/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/config.tpl      
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/property/templates/base/config.tpl      
2011-01-28 18:25:52 UTC (rev 6875)
@@ -341,7 +341,6 @@
                                </table>
                        </td>
                </tr>
-
                <tr class="row_off">
                        <td>{lang_send_response_TTS}.</td>
                        <td>
@@ -446,6 +445,16 @@
                                </select>
                        </td>
                </tr>
+               <tr class="row_on">
+                       <td valign = 'top'>{lang_list_location_level}:</td>
+                       <td>
+                               <!--to be able to blank the setting - need an 
empty value-->
+                               <input type = 'hidden' 
name="newsettings[list_location_level][]" value="">
+                               <table>
+                                       {hook_list_location_level}
+                               </table>
+                       </td>
+               </tr>
                <!--
                groupnotification
                -->

Modified: branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.soparty.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/inc/class.soparty.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -159,6 +159,14 @@
                                $filter_clauses[] = "party.org_enhet_id = 
{$org_unit_id}";
                        }
                }
+               
+               if(isset($filters['email'])){
+                       $email = $this->marshal($filters['email'],'string');
+                       if(isset($email))
+                       {
+                               $filter_clauses[] = "party.email = {$email}";
+                       }
+               }
 
                if(isset($filters['sync']))
                {

Modified: branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -21,7 +21,8 @@
                        'download_agresso'      => true,
                        'sync'                          => true,
                        'update_all_org_enhet_id'       => true,
-                       'syncronize_party'      => true
+                       'syncronize_party'      => true,
+                       'create_user_based_on_email' => true
        );
 
        public function __construct()
@@ -487,5 +488,110 @@
                        }
                }
        }
+       
+       /**
+        * Function to create Portico Estate users based on email, first- and 
lastname on contract parties.
+        */
+       public function create_user_based_on_email()
+       {       
+               //Get the party identifier from the reuest
+               $party_id = phpgw::get_var('id');
+               
+               //Access control: only executive officers and administrators 
can create such accounts
+               if(($this->isExecutiveOfficer() || $this->isAdministrator()))
+               {
+                       if(isset($party_id) && $party_id > 0)
+                       {
+                               //Load the party from the database
+                               $party = 
rental_soparty::get_instance()->get_single($party_id);
+                               $email = $party->get_email();
+                               
+                               //Validate the email
+                               $validator = 
CreateObject('phpgwapi.EmailAddressValidator');
+                               if(!$validator->check_email_address($email))
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'rental.uiparty.edit','id' => $party_id, 'error' => 
lang('error_create_user_based_on_email_not_valid_address')));
+                               }
+                               if ($GLOBALS['phpgw']->accounts->exists($email) 
)
+                               {
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'rental.uiparty.edit','id' => $party_id, 'error' => 
lang('error_create_user_based_on_email_account_exist')));
+                               }
+                               
+                               //Read group configuration
+                               $config = 
CreateObject('phpgwapi.config','rental');
+                               $config->read();
+                               $renter_group = 
$config->config_data['create_user_based_on_email_group'];
+                               
+                               //Get namae and generate password
+                               $first_name = $party->get_first_name();
+                               $last_name = $party->get_last_name();
+                               $passwd = 
$GLOBALS['phpgw']->common->randomstring(6)."ABab1!"; 
+                               
+                               
+                               try {
+                                       //Create account which never expires
+                                       $account                        = new 
phpgwapi_user();
+                                       $account->lid           = $email;
+                                       $account->firstname     = $first_name;
+                                       $account->lastname      = $last_name;
+                                       $account->passwd        = $passwd;
+                                       $account->enabled       = true;
+                                       $account->expires       = -1;
+                                       $frontend_account       = 
$GLOBALS['phpgw']->accounts->create($account, array($renter_group), array(), 
array('frontend'));
+                                       
+                                       //Specify the accounts access to 
modules 
+                                       $aclobj =& $GLOBALS['phpgw']->acl;
+                                       
$aclobj->set_account_id($frontend_account, true);
+                                       $aclobj->add('frontend', '.', 1);
+                                       $aclobj->add('frontend', 'run', 1);
+                                       $aclobj->add('manual', '.', 1);
+                                       $aclobj->add('manual', 'run', 1);
+                                       $aclobj->add('preferences', 
'changepassword',1);
+                                       $aclobj->add('preferences', '.',1);
+                                       $aclobj->add('preferences', 'run',1);
+                                       $aclobj->save_repository();
+                                       
+                                       //Set the default module for the account
+                                       $preferences = 
createObject('phpgwapi.preferences', $frontend_account);
+                                       
$preferences->add('common','default_app','frontend');
+                                       $preferences->save_repository();
+                               
+                               } catch (Exception $e) {
+                                       //Redirect with error message if 
something goes wrong
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'rental.uiparty.edit','id' => $party_id, 'error' => $e->getMessage()));
+                               }
+               
+                               if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'] )
+                               {
+                                       if (!is_object($GLOBALS['phpgw']->send))
+                                       {
+                                               $GLOBALS['phpgw']->send = 
CreateObject('phpgwapi.send');
+                                       }
+                                       
+                                       //Get addresses from module 
configuration
+                                       $from = 
$config->config_data['from_email_setting'];
+                                       $address = 
$config->config_data['http_address_for_external_users'];
+                                       
+                                       // Define email content
+                                       $title = 
lang('email_create_user_based_on_email_title');
+                                       $message = 
lang('email_create_user_based_on_email_message',$first_name,$last_name,$passwd, 
$address);
+                               
+                                       //Send email
+                                       $rcpt = 
$GLOBALS['phpgw']->send->msg('email',$email,$title,
+                                                stripslashes(nl2br($message)), 
'', '', '',
+                                                $from , 'System message',
+                                                'html', '', array() , false);
+                                       
+                                       //Redirect with sucess message if 
receipt is ok
+                                       if($rcpt)
+                                       {
+                                               
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'rental.uiparty.edit','id' => $party_id, 'message' => 
lang('success_create_user_based_on_email')));
+                                       }
+                               }
+                       }       
+               }
+               //Redirect to edit mode with error message if user reaches this 
point.
+               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'rental.uiparty.edit','id' => $party_id, 'error' => 
lang('error_create_user_based_on_email')));
+       }
 }
 ?>

Copied: branches/Version-1_0-branch/rental/inc/hook_config.inc.php (from rev 
6874, trunk/rental/inc/hook_config.inc.php)
===================================================================
--- branches/Version-1_0-branch/rental/inc/hook_config.inc.php                  
        (rev 0)
+++ branches/Version-1_0-branch/rental/inc/hook_config.inc.php  2011-01-28 
18:25:52 UTC (rev 6875)
@@ -0,0 +1,49 @@
+<?php
+       /**
+       * Rental - configuration hook
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package phpgroupware
+       * @subpackage Frontend
+       * @category hooks
+       * @version $Id: hook_config.inc.php 4237 2009-11-27 23:17:21Z sigurd $
+       */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       function create_user_based_on_email_group($config)
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $group_assigned = 
isset($config['create_user_based_on_email_group']) ? 
$config['create_user_based_on_email_group'] : '';
+
+               $out = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
+
+               foreach ( $groups as $group => $label)
+               {
+                       $selected = '';
+                       if ( $group_assigned == $group )
+                       {
+                               $selected = ' selected';
+                       }
+
+                       $out .=  <<<HTML
+                               <option 
value="{$group}"{$selected}>{$label}</option>
+HTML;
+               }
+               return $out;
+       }
\ No newline at end of file

Modified: branches/Version-1_0-branch/rental/inc/hook_settings.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/hook_settings.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/inc/hook_settings.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -35,4 +35,4 @@
        create_input_box('Decimal separator','decimal_separator', 'As in "." or 
","');
        create_input_box('responsibility','responsibility', '6 characters');
        create_input_box('project_id','project_id', '1-6 characters');
-
+       
\ No newline at end of file

Modified: branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -233,10 +233,19 @@
                        foreach($this->get_units() as $unit) // Runs through 
all of the composites units
                        {
                                $location = $unit->get_location();
+                               
                                if($location != null) // There is an underlying 
property location
                                {
-                                       $addresses .= 
$location->get_address_1() . "<br>\n";
-                                       $location_codes .= 
$location->get_location_code() . "<br>\n";
+                                       $address = $location->get_address_1();
+                                       if(isset($address) && $address != '')
+                                       {
+                                               $addresses .= $address . 
"<br>\n";
+                                       }
+                                       else
+                                       {
+                                               $addresses .= 
$location->get_concat_name() . "<br/>\n";
+                                       }
+                                       $location_codes .= 
$location->get_location_code() . "<br/>\n";
                                        $gab_ids .= $location->get_gab_id() . 
"<br>\n";
                                }
                        }

Modified: 
branches/Version-1_0-branch/rental/inc/model/class.property_location.inc.php
===================================================================
--- 
branches/Version-1_0-branch/rental/inc/model/class.property_location.inc.php    
    2011-01-28 16:00:47 UTC (rev 6874)
+++ 
branches/Version-1_0-branch/rental/inc/model/class.property_location.inc.php    
    2011-01-28 18:25:52 UTC (rev 6875)
@@ -60,6 +60,18 @@
 
        public function get_area_net(){ return $this->area_net; }
        
+       public function get_concat_name()
+       {
+               if(count($this->names) > 0)
+               {
+                       return implode(', ',$this->names);      
+               }
+               else
+               {
+                       return '';
+               }
+       }
+       
        public function serialize()
        {
                $result = array();              

Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2011-01-28 
16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2011-01-28 
18:25:52 UTC (rev 6875)
@@ -153,6 +153,8 @@
 create_contract_contract_type_eksternleie      rental  no      Opprett 
eksternleiekontrakt
 create_contract_contract_type_innleie  rental  no      Opprett innleiekontrakt
 create_contract_contract_type_internleie       rental  no      Opprett 
internleiekontrakt
+create_user_based_on_email_link        rental  no      Opprett bruker basert 
på e-post
+create user based on email group       rental  no      Velg gruppe nye brukere 
blir innmeldt i
 cs15_export    rental  no      Kundefil
 currency decimal places        rental  no      Antall desimaler for valuta
 currency prefix        rental  no      Valuta prefix
@@ -188,8 +190,13 @@
 edit   rental  no      Redigér
 elements_pr_page       rental  no      elementer per side
 elements       rental  no      Elementer
-email  renal   no      E-post
+email  rental  no      E-post
+email_create_user_based_on_email_title rental  no      Tilgang til Portico 
Estate
+email_create_user_based_on_email_message       rental  no      Hei %1 
%2:<br/>Det er opprettet en tilgang for deg i Portico 
Estate<br/><br/>Brukernavnet er e-posten din<br/>Passordet er 
%3<br/><br/>Systemet kan nås på adressen %4
 ended  rental  no      Avsluttet
+error_create_user_based_on_email       rental  no      En feil oppstod under 
opprettelse av bruker
+error_create_user_based_on_email_account_exist rental  no      En konto med 
denne e-posten som brukernavn eksisterer allerede
+error_create_user_based_on_email_not_valid_address     rental  no      Kan 
ikke opprette kontoen pga av e-postadressen ikke er gyldig
 error_no_contract_or_party     rental  no      Ingen kontrakt eller 
kontraktspart å utføre handlingen på
 events rental  no      Hendelser
 every_second_week      rental  no      Hver 14. dag
@@ -222,6 +229,7 @@
 f_new_price_item       rental  no      Nytt priselement
 f_new_rc       rental  no      Nytt leieobjekt
 from   rental  no      Fra
+from email setting     rental  no      E-post adresse systemmeldinger (Fra)
 frontpage_was_reset    rental  no      Oppsettet på forsiden ble nullstilt
 frontpage_reset_setup  rental  no      Nullstill oppsett 
 f_select_columns       rental  no      Velg kolonner
@@ -234,6 +242,7 @@
 hidden_for_pick        rental  no      skjult
 has_custom_address     rental  no      Er adressen overstyrt?
 house_number   rental  no      Husnummer
+http address for external users        rental  no      HTTP adresse for 
eksterne brukere
 id     rental  no      ID
 Identifier     rental  no      Identifikator
 import_log_messages    rental  no      Import log
@@ -492,6 +501,7 @@
 status_unknown rental  no      Ukjent status
 status rental  no      Status
 Success        rental  no      Suksess
+success_create_user_based_on_email     rental  no      En brukerkonto ble 
opprettet og en e-post ble sendt til brukeren
 sum    rental  no      Sum
 sync   rental  no      Synkroniser
 sync_identifier        rental  no      Kun identifikator

Modified: branches/Version-1_0-branch/rental/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/config.tpl        
2011-01-28 16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/templates/base/config.tpl        
2011-01-28 18:25:52 UTC (rev 6875)
@@ -36,7 +36,23 @@
                        <td>{lang_billing_time_limit}:</td>
                        <td><input name="newsettings[billing_time_limit]" 
value="{value_billing_time_limit}"></td>
                </tr>
+               <tr class="row_on">
+                       <td>{lang_from_email_setting}:</td>
+                       <td><input name="newsettings[from_email_setting]" 
value="{value_from_email_setting}"></td>
+               </tr>
                <tr class="row_off">
+                       <td>{lang_http_address_for_external_users}:</td>
+                       <td><input 
name="newsettings[http_address_for_external_users]" 
value="{value_http_address_for_external_users}"></td>
+               </tr>
+               <tr class="row_on">
+                       <td>{lang_create_user_based_on_email_group}:</td>
+                       <td>
+                        <select 
name="newsettings[create_user_based_on_email_group]">
+{hook_create_user_based_on_email_group}
+                        </select>
+                       </td>
+               </tr>
+               <tr class="row_off">
                        <td>{lang_use_fellesdata}:</td>
                        <td>
                                <select name="newsettings[use_fellesdata]">

Modified: branches/Version-1_0-branch/rental/templates/base/party.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/party.php 2011-01-28 
16:00:47 UTC (rev 6874)
+++ branches/Version-1_0-branch/rental/templates/base/party.php 2011-01-28 
18:25:52 UTC (rev 6875)
@@ -266,6 +266,12 @@
                                                ?>
                                                        <input type="text" 
name="email" id="email" value="<?php echo $party->get_email() ?>" />
                                                <?php
+                                                       $validator = 
CreateObject('phpgwapi.EmailAddressValidator');
+                                                       $email = 
$party->get_email();
+                                                       
if($validator->check_email_address($email) && 
!$GLOBALS['phpgw']->accounts->exists($email))
+                                                       {
+                                                               ?><br/><a 
href="?menuaction=rental.uiparty.create_user_based_on_email&id=<?php echo 
$party->get_id() ?>"><?php echo lang('create_user_based_on_email_link') ?></a> 
<?php        
+                                                       }
                                                }
                                                else
                                                {




reply via email to

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