fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7470] Merge 7459:7469 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7470] Merge 7459:7469 from trunk
Date: Mon, 04 Jul 2011 07:36:43 +0000

Revision: 7470
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7470
Author:   sigurdne
Date:     2011-07-04 07:36:43 +0000 (Mon, 04 Jul 2011)
Log Message:
-----------
Merge 7459:7469 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.borequest.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
    branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
    branches/Version-1_0-branch/rental/setup/phpgw_no.lang
    branches/Version-1_0-branch/rental/setup/setup.inc.php
    branches/Version-1_0-branch/rental/setup/tables_current.inc.php
    branches/Version-1_0-branch/rental/setup/tables_update.inc.php
    branches/Version-1_0-branch/rental/templates/base/composite.php
    branches/Version-1_0-branch/rental/templates/base/composite_list_partial.php

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


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469

Modified: branches/Version-1_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2011-07-04 07:36:43 UTC (rev 7470)
@@ -248,6 +248,7 @@
                                foreach($condition_type_list as $condition_type)
                                {
                                        $i = $condition_type['id'];
+                                       $risk   = 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'];
                                        $values[] = array
                                        (
                                                'degree'                        
        => array('options' => 
$this->select_degree_list($conditions[$i]['degree'])),
@@ -256,8 +257,8 @@
                                                'condition_type'                
=> $condition_type_list[$i]['id'],
                                                'condition_type_name'   => 
$condition_type_list[$i]['name'],
                                                'weight'                        
        => $condition_type_list[$i]['weight'],
-                                               'risk'                          
        => (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'],
-                                               'score'                         
        => $values[$i]['risk'] * (int)$conditions[$i]['degree']
+                                               'risk'                          
        => $risk,
+                                       'score'                                 
=> $risk * (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['degree']
                                        );
                                }
                        }
@@ -272,6 +273,7 @@
                                                break;
                                        }
                                }
+                               $risk   = (int)$conditions[$i]['probability'] * 
(int)$conditions[$i]['consequence'];
                                $values[] = array
                                (
                                        'condition_type_list'   => 
array('options' => $this->bocommon->select_list($i, $condition_type_list)),
@@ -281,8 +283,8 @@
                                        'condition_type'                => 
$condition_type_list[$i]['id'],
                                        'condition_type_name'   => 
$condition_type_list[$i]['name'],
                                        'weight'                                
=> $condition_type_list[$i]['weight'],
-                                       'risk'                                  
=> (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['probability'] * (int)$conditions[$i]['consequence'],
-                                       'score'                                 
=> $values[$i]['risk'] * (int)$conditions[$i]['degree']
+                                       'risk'                                  
=> $risk,
+                                       'score'                                 
=> $risk * (int)$condition_type_list[$i]['weight'] * 
(int)$conditions[$i]['degree']
                                );
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2011-07-04 07:36:43 UTC (rev 7470)
@@ -105,7 +105,7 @@
                                
if($GLOBALS['phpgw_info']['server']['db_type']=='pgsql' || 
$GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                                {
                                        $sql = "UPDATE fm_request SET score = 
(SELECT sum(priority_key * ( degree * probability * ( consequence )))  FROM 
fm_request_condition"
-                                               . " $this->join  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = $id) WHERE fm_request.id = 
$id";
+                                               . " {$this->join}  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = {$id}) WHERE fm_request.id = 
{$id}";
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                }

Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2011-07-04 07:36:43 UTC (rev 7470)
@@ -791,15 +791,13 @@
                        $GLOBALS['phpgw_info']['flags']['noframework'] = true;
                        $values         = phpgw::get_var('values');
 
-                       $config = CreateObject('phpgwapi.config','property');
-                       $config->read();
-                       $values['authorities_demands'] = 
$values['authorities_demands'] ? $values['authorities_demands'] : 
$config->config_data['authorities_demands'];
+                       $values['authorities_demands'] = 
$values['authorities_demands'] ? $values['authorities_demands'] : 
$this->config->config_data['authorities_demands'];
 
                        if($values['update'])
                        {
                                $receipt = 
$this->bo->update_priority_key($values);
-                               $config->config_data['authorities_demands'] = 
(int) $values['authorities_demands'];
-                               $config->save_repository();
+                               
$this->config->config_data['authorities_demands'] = (int) 
$values['authorities_demands'];
+                               $this->config->save_repository();
                        }
 
                        $function_msg   = lang('Edit priority key');

Modified: branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php    
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php    
2011-07-04 07:36:43 UTC (rev 7470)
@@ -8,17 +8,18 @@
 class rental_socomposite extends rental_socommon
 {
        protected static $so;
-       
+               
        /**
         * Get a static reference to the storage object associated with this 
model object
         * 
         * @return the storage object
         */
        public static function get_instance()
-       {
-               if (self::$so == null) {
+       {                                                                       
+               if (self::$so == null) {                
                        self::$so = CreateObject('rental.socomposite');
                }
+               
                return self::$so;
        }
 
@@ -116,6 +117,15 @@
                        case "both":
                                break;
                }
+               
+               // Furnished, partly furnished, not furnished, not specified
+               if(isset($filters['furnished_status']) & 
$filters['furnished_status'] < 4){
+                       // Not specified
+                       if($filters['furnished_status'] == 0)
+                               $filter_clauses[] = 
"rental_composite.furnish_type_id IS NULL";
+                       else 
+                               $filter_clauses[] = 
"rental_composite.furnish_type_id=".$filters['furnished_status'];
+               }
 
                if(isset($filters['not_in_contract'])){
                        $filter_clauses[] = 
"(rental_contract_composite.contract_id != ".$filters['not_in_contract']." OR 
rental_contract_composite.contract_id IS NULL)";
@@ -161,7 +171,9 @@
                        {
                                $cols = "rental_composite.id AS composite_id,";
                        }
-                       $cols .= "rental_unit.id AS unit_id, 
rental_unit.location_code, rental_composite.name, 
rental_composite.has_custom_address, rental_composite.address_1, 
rental_composite.house_number, rental_composite.address_2, 
rental_composite.postcode, rental_composite.place, rental_composite.is_active, 
rental_composite.area, rental_composite.description, ";
+                       $cols .= "rental_unit.id AS unit_id, 
rental_unit.location_code, rental_composite.name, 
rental_composite.has_custom_address, rental_composite.address_1, 
rental_composite.house_number, 
+                                         rental_composite.address_2, 
rental_composite.postcode, rental_composite.place, rental_composite.is_active, 
rental_composite.area, rental_composite.description, 
rental_composite.furnish_type_id, ";
+                       $cols .= "rental_contract.id AS contract_id, 
rental_contract.date_start, rental_contract.date_end, 
rental_contract.old_contract_id, ";
                        $cols .= "
                        CASE WHEN 
                        (
@@ -176,7 +188,7 @@
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
 
-           //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}");
+           //var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}");    
            
                return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
        }
@@ -193,6 +205,7 @@
                        {
                                $composite_name = lang('no_name_composite', 
$composite_id);
                        }
+                       
                        $composite->set_name($composite_name);
                        
$composite->set_has_custom_address($this->unmarshal($this->db->f('has_custom_address',
 true), 'bool'));
                        
$composite->set_custom_address_1($this->unmarshal($this->db->f('address_1', 
true), 'string'));
@@ -201,6 +214,7 @@
                        
$composite->set_custom_postcode($this->unmarshal($this->db->f('postcode', 
true), 'string'));
                        
$composite->set_custom_place($this->unmarshal($this->db->f('place', true), 
'string'));
                        
$composite->set_area($this->unmarshal($this->db->f('area', true), 'float'));
+                       
$composite->set_furnish_type_id($this->unmarshal($this->db->f('furnish_type_id',
 true), 'int'));
                }
                // Location code
                $location_code = $this->unmarshal($this->db->f('location_code', 
true), 'string');
@@ -214,6 +228,27 @@
                        $composite->set_status($database_status);
                }
                
+               $contract_id = $this->unmarshal($this->db->f('contract_id', 
true), 'int'); 
+               
+               // Adds contract to array in composite object if it's not 
already added 
+               if($contract_id != 0 & 
!$composite->contains_contract($contract_id))
+               {
+                       $contract = new rental_contract($contract_id);
+                       
+                       $start_date = 
$this->unmarshal($this->db->f('date_start', true), 'int');
+                       $end_date = $this->unmarshal($this->db->f('date_end', 
true), 'int');
+                       $old_contract_id = 
$this->unmarshal($this->db->f('old_contract_id', true), 'string');
+                       
+                       // Adds contract if end date is not specified or 
greater than todays date  
+                       if($end_date == 0 || $end_date > time()){
+                               $contract_date = new 
rental_contract_date($start_date, $end_date);
+                               $contract->set_contract_date($contract_date);
+                               
$contract->set_old_contract_id($old_contract_id);
+                               
+                               $composite->add_contract($contract);    
+                       }
+               }
+               
                if(!$composite->contains_unit($location_code))
                {
                        //composite inneholder ikke unit -> legg den til
@@ -317,6 +352,7 @@
                        'is_active = \'' . ($composite->is_active() ? 'true' : 
'false') . '\'',
             'object_type_id = '.$composite->get_object_type_id(),
             'area = ' . $this->marshal($composite->get_area(), 'float'),
+                       'furnish_type_id = '.$composite->get_furnish_type_id(),
                );
 
                $result = $this->db->query('UPDATE rental_composite SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -334,7 +370,7 @@
        public function add(&$composite)
        {
                // Build a db-friendly array of the composite object
-               $cols = array('name', 'description', 'has_custom_address', 
'address_1', 'address_2', 'house_number', 'postcode', 'place', 
'object_type_id', 'area');
+               $cols = array('name', 'description', 'has_custom_address', 
'address_1', 'address_2', 'house_number', 'postcode', 'place', 
'object_type_id', 'area', 'furnish_type_id');
                $values = array(
                        "'".$composite->get_name()."'",
                        "'".$composite->get_description()."'",
@@ -345,7 +381,8 @@
                        "'".$composite->get_custom_postcode()."'",
                        "'".$composite->get_custom_place()."'",
             $composite->get_object_type_id(),
-            $this->marshal($composite->get_area(), 'float')
+            $this->marshal($composite->get_area(), 'float'),
+            $composite->get_furnish_type_id()
                );
 
                $query ="INSERT INTO rental_composite (" . join(',', $cols) . 
") VALUES (" . join(',', $values) . ")";
@@ -391,6 +428,5 @@
 
                return null;
     }
-       
 }
 ?>

Modified: branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php    
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php    
2011-07-04 07:36:43 UTC (rev 7470)
@@ -31,7 +31,7 @@
                }
                
                public function query()
-               {
+               { 
                        
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
                        {
                                $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
@@ -85,7 +85,10 @@
                                        phpgwapi_cache::session_set('rental', 
'composite_search_type', $search_type);
                                        phpgwapi_cache::session_set('rental', 
'composite_status', phpgw::get_var('is_active'));
                                        phpgwapi_cache::session_set('rental', 
'composite_status_contract', phpgw::get_var('has_contract'));
-                                       $filters = array('is_active' => 
phpgw::get_var('is_active'), 'is_vacant' => phpgw::get_var('occupancy'), 
'has_contract' => phpgw::get_var('has_contract'), 'availability_date_from' => 
phpgw::get_var('availability_date_from_hidden'), 'availability_date_to' => 
phpgw::get_var('availability_date_to_hidden'));
+                                       phpgwapi_cache::session_set('rental', 
'composite_furnished_status', phpgw::get_var('furnished_status'));
+                                       $filters = array('furnished_status' => 
phpgw::get_var('furnished_status'),'is_active' => phpgw::get_var('is_active'), 
'is_vacant' => phpgw::get_var('occupancy'), 
+                                                                        
'has_contract' => phpgw::get_var('has_contract'), 'availability_date_from' => 
phpgw::get_var('availability_date_from_hidden'), 
+                                                                        
'availability_date_to' => phpgw::get_var('availability_date_to_hidden'));
                                        $result_objects = 
rental_socomposite::get_instance()->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
                                        $object_count = 
rental_socomposite::get_instance()->get_count($search_for, $search_type, 
$filters);
                                        break;
@@ -116,6 +119,7 @@
                        $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
                        
                        $contract_types = 
rental_socontract::get_instance()->get_fields_of_responsibility();
+                       
                        $create_types = array();
                        foreach($contract_types as $id => $label)
                        {
@@ -331,7 +335,8 @@
                                        
$composite->set_custom_place(phpgw::get_var('place'));
                                        
$composite->set_is_active(phpgw::get_var('is_active') == 'on' ? true : false);
                                        
$composite->set_description(phpgw::get_var('description'));
-                                       
+                                       
$composite->set_furnish_type_id(phpgw::get_var('furnish_type_id'));
+
                                        
if(rental_socomposite::get_instance()->store($composite))
                                        {
                                                $message = 
lang('messages_saved_form');

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-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php        
2011-07-04 07:36:43 UTC (rev 7470)
@@ -22,9 +22,12 @@
         protected $object_type_id;
         protected $area;
         protected $status;
+        protected $furnish_type_id;
                
                protected $units;
-       
+               protected $contracts;
+               protected static $furnish_types_arr;
+               
                /**
                 * Constructor.  Takes an optional ID.  If a composite is 
created from outside
                 * the database the ID should be empty so the database can add 
one according to its logic.
@@ -35,6 +38,8 @@
                {
                        parent::__construct($id);
                        $this->units = array();
+                       $this->contracts = array();
+                       
                }
                
                /**
@@ -49,6 +54,50 @@
                }
                
                /**
+                * Adds a contract to the contracts array sorted by end date. 
Note that this method is
+                * meant for populating the object and will not fetch/insert 
anything from
+                * the database.
+                * @param $unit to add to object.
+                */
+               public function add_contract($new_contract)
+               {
+                       $temp_contracts = array();
+                       $added = false; 
+                       
+                       foreach($this->contracts as $contract)
+                       {       
+                               if($added == false & 
$contract->get_contract_date()->get_end_date() == 0)
+                               {
+                                       $temp_contracts[] = $new_contract;
+                                       $temp_contracts[] = $contract;
+                                       $added = true;
+                               }else if($added == false & 
$new_contract->get_contract_date()->get_end_date() == 0)
+                               {
+                                       $temp_contracts[] = $contract;
+                                       $temp_contracts[] = $new_contract;
+                                       $added = true;
+                               }else if($added == false & 
$contract->get_contract_date()->get_end_date() < 
$new_contract->get_contract_date()->get_end_date())
+                               {
+                                       $temp_contracts[] = $contract;
+                               }else if($added == false & 
!$contract->get_contract_date()->get_end_date() < 
$new_contract->get_contract_date()->get_end_date()) 
+                               {
+                                       $temp_contracts[] = $new_contract;
+                                       $temp_contracts[] = $contract;
+                                       $added = true;
+                               }else if($added == true)
+                               {
+                                       $temp_contracts[] = $contract;
+                               }
+                       }       
+                       
+                       if($added == false){
+                               $temp_contracts[] = $new_contract;
+                       }
+                       
+                       $this->contracts = &$temp_contracts;
+               }
+               
+               /**
                 * Checks if a unit is already added to the composite.
                 * 
                 * @param $location_code string with location code.
@@ -67,6 +116,24 @@
                }
                
                /**
+                * Checks if a contract is already added to the composite.
+                * 
+                * @param $contract_id int with contract id.
+                * @return boolean true if contract is added, false if not.
+                */
+               public function contains_contract($contract_id)
+               {
+                       foreach($this->contracts as $contract)
+                       {
+                               if($contract_id == $contract->get_id())
+                               {
+                                       return true;
+                               }
+                       }
+                       return false;
+               }
+               
+               /**
                 * Remove a given rental unit from this rental_composite. Note 
that the composite is not updated
                 * in the database until store() is called.
                 * 
@@ -191,9 +258,36 @@
             $this->object_type_id = $obj_type;
         }
 
-        public function get_object_type_id() {
+               public function get_object_type_id() {
             return (int) $this->object_type_id;
         }
+        
+               public function set_furnish_type_id(int $furnish_type) {
+            $this->furnish_type_id = $furnish_type;
+        }
+        
+               public function get_furnish_type_id() {
+            return (int) $this->furnish_type_id;
+        }
+        
+               public function get_furnish_type() {
+                       
+                       $furnish_types = $this->get_furnish_types();
+                       
+                       return $furnish_types[$this->get_furnish_type_id()];
+        }
+        
+               public static function get_furnish_types() {
+                       
+                       self::$furnish_types_arr = array( 
+                                                                               
                0 => lang('furnish_type_not_specified'), 
+                                                                               
                1 => lang('furnish_type_furnished'), 
+                                                                               
                2 => lang('furnish_type_partly_furnished'), 
+                                                                               
                3 => lang('furnish_type_not_furnished') 
+                                                                               
        );
+                       
+               return self::$furnish_types_arr;
+       }
 
         public function set_area($area) {
             $this->area = $area;
@@ -210,6 +304,14 @@
         public function get_status() {
             return $this->status;
         }
+        
+               public function set_contracts($contracts) {
+            $this->contracts = $contracts;
+        }
+        
+        public function get_contracts() {
+            return $this->contracts;
+        }
                
                /**
                 * Return a string representation of the composite.
@@ -230,6 +332,7 @@
                        $addresses = '';
                        $location_codes = '';
                        $gab_ids = '';
+                       $contract_dates = '';
                        foreach($this->get_units() as $unit) // Runs through 
all of the composites units
                        {
                                $location = $unit->get_location();
@@ -249,6 +352,25 @@
                                        $gab_ids .= $location->get_gab_id() . 
"<br>\n";
                                }
                        }
+                       
+                       // Adds info about contracts to a string 
+                       foreach($this->get_contracts() as $contract)
+                       {
+                               $start_date = 
$contract->get_contract_date()->get_start_date();
+                               $end_date = 
$contract->get_contract_date()->get_end_date();
+
+                               if($end_date == 0)
+                                       $contract_dates .= date("d-m-Y", 
$start_date) . " - løpende";   
+                               else
+                                       $contract_dates .= date("d-m-Y", 
$start_date) . " - " . date("d-m-Y", $end_date);
+                               
+                               $contract_dates .= " (" . 
$contract->get_old_contract_id() . ")" . "<br/>\n";
+                       }
+                       
+                       if( count( $this->get_contracts() ) == 0 ){
+                               $contract_dates .= "Ingen<br/>\n";      
+                       }
+                       
                        if($this->has_custom_address())
                        {
                                $addresses = $this->get_custom_address_1() . ' 
' . $this->get_custom_house_number();
@@ -263,7 +385,9 @@
                                'gab_id' => $gab_ids,
                                'area_gros' => $this->get_area_gros(),
                                'area_net' => $this->get_area_net(),
-                               'status' => $this->get_status()
+                               'status' => $this->get_status(),
+                               'contracts' => $contract_dates,
+                               'furnished_status' => $this->get_furnish_type()
                        );
                }
                

Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2011-07-04 
07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2011-07-04 
07:36:43 UTC (rev 7470)
@@ -146,6 +146,7 @@
 contract_type_eksternleie_2    rental  no      Utført eksternleieregulering av 
kontrakter som reguleres hvert annet år
 contract_type_eksternleie_10   rental  no      Utført eksternleieregulering av 
kontrakter som reguleres hvert tiende år
 contracts_closing_due_date     rental  no      Kontrakter nær opsjonsfrist
+contract_future_info   rental  no      Fremtidig kontraktsinformasjon
 Could not find specified billing job.  rental  no      Kunne ikke finne 
spesifisert fakturering.
 count decimal places   rental  no      Antall desimaler for opptelling
 count  rental  no      Antall
@@ -241,6 +242,11 @@
 frontpage_was_reset    rental  no      Oppsettet på forsiden ble nullstilt
 frontpage_reset_setup  rental  no      Nullstill oppsett 
 f_select_columns       rental  no      Velg kolonner
+furnish_type   rental  no      Møbleringsstatus
+furnish_type_not_specified     rental  no      Ikke spesifisert
+furnish_type_furnished rental  no      Møblert
+furnish_type_partly_furnished  rental  no      Delvis møblert
+furnish_type_not_furnished     rental  no      Ikke møblert
 gab    rental  no      GAB
 gab_id rental  no      GAB
 Generate export        rental  no      Generér eksport

Modified: branches/Version-1_0-branch/rental/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/setup.inc.php      2011-07-04 
07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/setup/setup.inc.php      2011-07-04 
07:36:43 UTC (rev 7470)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['rental']['name'] = 'rental';               // Module 
identifier
-       $setup_info['rental']['version'] = '0.1.0.13';  // Current module 
version
+       $setup_info['rental']['version'] = '0.1.0.14';  // Current module 
version
        $setup_info['rental']['app_order'] = 51;                // (?)
        $setup_info['rental']['tables'] = array(
                'rental_party',                                         // All 
contract participants, tenants etc.

Modified: branches/Version-1_0-branch/rental/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/tables_current.inc.php     
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/setup/tables_current.inc.php     
2011-07-04 07:36:43 UTC (rev 7470)
@@ -27,7 +27,8 @@
                                        'place' =>                              
array('type' => 'varchar','precision' => '255'),
                                        'has_custom_address' => array('type' => 
'bool','nullable' => false,'default' => 'false'),
                     'object_type_id' =>     array('type' => 'int', 'precision' 
=> 2, 'nullable' => true, 'default' => null),
-                    'area' =>               array('type' => 'decimal', 
'precision' => '20','scale' => '2', 'nullable' => true)
+                    'area' =>               array('type' => 'decimal', 
'precision' => '20','scale' => '2', 'nullable' => true),
+                                       'furnish_type_id' =>    array('type' => 
'int', 'precision' => 4, 'nullable' => true)
                                ),
                                'pk' => array('id'),
                                'fk' => array(),
@@ -49,7 +50,6 @@
                                        array('composite_id','location_code')
                                )
                ),
-               
                'rental_contract_responsibility' => array(
                        'fd' => array(
                                'id'            => array('type' => 'auto', 
'nullable' => false),

Modified: branches/Version-1_0-branch/rental/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/tables_update.inc.php      
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/setup/tables_update.inc.php      
2011-07-04 07:36:43 UTC (rev 7470)
@@ -240,5 +240,17 @@
                $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.13';
                return $GLOBALS['setup_info']['rental']['currentver'];
        }
-       
+               
+       $test[] = '0.1.0.13';
+       function rental_upgrade0_1_0_13()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite','furnish_type_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => 'True'
+               ));
+               
+               $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.14';
+               return $GLOBALS['setup_info']['rental']['currentver'];
+       }
 ?>
\ No newline at end of file

Modified: branches/Version-1_0-branch/rental/templates/base/composite.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/composite.php     
2011-07-04 07:28:05 UTC (rev 7469)
+++ branches/Version-1_0-branch/rental/templates/base/composite.php     
2011-07-04 07:36:43 UTC (rev 7470)
@@ -72,7 +72,31 @@
                                                        }
                                                ?>
                                        </dd>
+                                       <dt>
+                                               <!-- Furnish status  -->
+                                               <label 
for="furnish_type_id"><?php echo lang('furnish_type') ?></label>
+                                                       <?php
+                                                               
$furnish_types_arr = $composite->get_furnish_types();
+                                                               
$cur_furnish_type_id = $composite->get_furnish_type_id();
 
+                                                       // Edit composite
+                                                       if ($editable) { ?>
+                                                               <select 
name="furnish_type_id">
+                                                               <?php 
+                                                                       
foreach($furnish_types_arr as $id => $title){
+                                                                               
if($cur_furnish_type_id == $id)
+                                                                               
        echo "<option selected='true' value='$id'>" . $title . "</option>";
+                                                                               
else 
+                                                                               
        echo "<option value='$id'>" . $title . "</option>";
+                                                                       }
+                                                               ?>
+                                                               </select>       
                
+                                                       <?php 
+                                                       // View composite
+                                                       }else{ ?>
+                                                               <input 
type="text" id="furnish_type_id" value='<?php echo 
$furnish_types_arr[$cur_furnish_type_id]; ?>' disabled="disabled" />
+                                                       <?php } ?>
+                                       </dt>   
                                        <?php if ($editable) { // Only show 
custom address fields if we're in edit mode ?>
                                        <dt>
                                                <label 
for="has_custom_address"><?php echo lang('has_custom_address') ?></label>

Modified: 
branches/Version-1_0-branch/rental/templates/base/composite_list_partial.php
===================================================================
--- 
branches/Version-1_0-branch/rental/templates/base/composite_list_partial.php    
    2011-07-04 07:28:05 UTC (rev 7469)
+++ 
branches/Version-1_0-branch/rental/templates/base/composite_list_partial.php    
    2011-07-04 07:36:43 UTC (rev 7470)
@@ -1,7 +1,7 @@
 <script type="text/javascript">
 
 function checkAvailabitily()
-{
+{ 
        if(document.forms[0].availability_date_to.value == '')
        {
                document.forms[0].availability_date_to.value = 
document.forms[0].availability_date_from.value;
@@ -54,6 +54,16 @@
                    sortable: true
                },
                {
+                       key: "contracts",
+                       label: "<?php echo lang('contract_future_info') ?>",
+                   sortable: false
+               },
+               {
+                       key: "furnished_status",
+                       label: "<?php echo lang('furnish_type') ?>",
+                   sortable: false
+               },
+               {
                        key: "actions",
                        hidden: true
                },
@@ -71,7 +81,7 @@
                
'index.php?menuaction=rental.uicomposite.query&amp;phpgw_return_as=json<?php 
echo $url_add_on; ?>&amp;editable=<?php echo isset($editable) && $editable ? 
"true" : "false"; ?>',
                columnDefs,
                '<?php echo $list_id ?>_form',
-               ['<?php echo $list_id 
?>_ctrl_toggle_active_rental_composites','<?php echo $list_id 
?>_ctrl_toggle_occupancy_of_rental_composites','<?php echo $list_id 
?>_ctrl_toggle_has_contract_rental_composites','<?php echo $list_id 
?>_ctrl_search_query'],
+               ['<?php echo $list_id 
?>_ctrl_toggle_furnished_status_rental_composites','<?php echo $list_id 
?>_ctrl_toggle_active_rental_composites','<?php echo $list_id 
?>_ctrl_toggle_occupancy_of_rental_composites','<?php echo $list_id 
?>_ctrl_toggle_has_contract_rental_composites','<?php echo $list_id 
?>_ctrl_search_query'],
                '<?php echo $list_id ?>_container',
                '<?php echo $list_id ?>_paginator',
                '<?php echo $list_id ?>',
@@ -95,6 +105,9 @@
         var availabilityselect = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_active_rental_composites');
         var availabilityoption = 
availabilityselect.options[availabilityselect.selectedIndex].value;
 
+        var furnished_select = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_furnished_status_rental_composites');
+        var furnished_status_id = 
furnished_select.options[furnished_select.selectedIndex].value;
+
         var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
 
         var sSelect = document.getElementById('<?php echo $list_id 
?>_ctrl_search_option');
@@ -102,6 +115,7 @@
 
         window.location = 'index.php?menuaction=rental.uicomposite.download'+
             '<?php echo $url_add_on ?>'+
+            '&amp;furnished_status='+furnished_status_id+
             '&amp;is_active='+availabilityoption+
             '&amp;type='+compType+
             '&amp;query='+query+
@@ -149,6 +163,19 @@
        <fieldset>
                <!-- Filters -->
                <h3><?php echo lang('filters') ?></h3>
+               
+               <!-- Møbleringsstatus -->
+               <label for="furnished_status"><?php echo lang('furnish_type') 
?></label>
+               <select name="furnished_status" id="<?php echo $list_id 
?>_ctrl_toggle_furnished_status_rental_composites">
+                       <?php
+                               $furnish_types_arr = 
rental_composite::get_furnish_types();
+                                
+                               echo "<option value='4'>Alle</option>";
+                               foreach($furnish_types_arr as $id => $title){
+                                       echo "<option value='$id'>" . $title . 
"</option>";
+                               }
+                       ?>
+               </select>
                <label for="ctrl_toggle_active_rental_composites"><?php echo 
lang('availability') ?></label>
                <select name="is_active" id="<?php echo $list_id 
?>_ctrl_toggle_active_rental_composites">
                        <option value="both" <?php echo ($status == 'both') ? 
'selected' : ''?>><?php echo lang('all') ?></option>




reply via email to

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