fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7746]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7746]
Date: Wed, 28 Sep 2011 08:13:40 +0000

Revision: 7746
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7746
Author:   erikhl
Date:     2011-09-28 08:13:37 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/controller/inc/class.socontrol.inc.php
    trunk/controller/inc/class.socontrol_group.inc.php
    trunk/controller/inc/class.uicontrol.inc.php
    trunk/controller/inc/class.uicontrol_group.inc.php
    trunk/controller/inc/model/class.check_item.inc.php
    trunk/controller/inc/model/class.control_group.inc.php
    trunk/controller/setup/tables_current.inc.php
    trunk/controller/templates/base/control_group.xsl

Modified: trunk/controller/inc/class.socontrol.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol.inc.php        2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/inc/class.socontrol.inc.php        2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -65,6 +65,7 @@
                        'description = ' . 
$this->marshal($control->get_description(), 'string'),
                        'start_date = ' . 
$this->marshal($control->get_start_date(), 'int'),
                        'end_date = ' . 
$this->marshal($control->get_end_date(), 'int'),
+                       'control_area_id = ' . 
$this->marshal($control->get_control_area_id()),
                        'repeat_type = ' . 
$this->marshal($control->get_repeat_type(), 'string'),
                        'repeat_interval = ' . 
$this->marshal($control->get_repeat_interval(), 'string'),
                        'procedure_id = ' . 
$this->marshal($control->get_procedure_id(), 'int')

Modified: trunk/controller/inc/class.socontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.socontrol_group.inc.php  2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/inc/class.socontrol_group.inc.php  2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -31,13 +31,15 @@
                $cols = array(
                                'group_name',
                                'procedure_id',
-                               'control_area_id'
+                               'control_area_id',
+                               'building_part_id'
                );
                        
                $values = array(
                        $this->marshal($control_group->get_group_name(), 
'string'),
                        $this->marshal($control_group->get_procedure_id(), 
'int'),
                        $this->marshal($control_group->get_control_area_id(), 
'int'),
+                       $this->marshal($control_group->get_building_part_id(), 
'int'),
                );
                
                $result = $this->db->query('INSERT INTO 
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
@@ -67,7 +69,8 @@
                $values = array(
                        'group_name = ' . 
$this->marshal($control_group->get_group_name(), 'string'),
                        'procedure_id = '. 
$this->marshal($control_group->get_procedure_id(), 'int'),
-                       'control_area_id = ' . 
$this->marshal($control_group->get_control_area_id(), 'int')
+                       'control_area_id = ' . 
$this->marshal($control_group->get_control_area_id(), 'int'),
+                       'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'int')
                );
                
                //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
@@ -142,6 +145,19 @@
                        return $results;
        }
        
+       function get_building_part_select_array()
+       {
+            $results = array();
+                       $results[] = array('id' =>  0,'name' => lang('Not 
selected'));
+                       $this->db->query("SELECT id, descr as name FROM 
fm_building_part ORDER BY id ASC", __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $results[] = array('id' => $this->db->f('id', 
false),
+                                                          'name' => 
$this->db->f('name', false));
+                       }
+                       return $results;
+       }
+       
        function get_control_groups($control_area_id)
        {
                $results = array();
@@ -302,7 +318,7 @@
                $condition =  join(' AND ', $clauses);
 
                $tables = "controller_control_group";
-               //$joins = "    {$this->left_join} rental_unit ON 
(rental_composite.id = rental_unit.composite_id)";
+               $joins = "      {$this->left_join} fm_building_part ON 
(building_part_id = CAST(fm_building_part.id AS INT))";
                //$joins .= "   {$this->left_join} rental_contract_composite ON 
(rental_contract_composite.composite_id = rental_composite.id)";
                //$joins .= "   {$this->left_join} rental_contract ON 
(rental_contract.id = rental_contract_composite.contract_id)";
                
@@ -312,14 +328,14 @@
                }
                else
                {
-                       $cols .= "id, group_name, procedure_id, control_area_id 
";
+                       $cols .= "controller_control_group.id, group_name, 
procedure_id, control_area_id, building_part_id, fm_building_part.descr AS 
building_part_descr ";
                }
                $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}");    
            
-               return "SELECT {$cols} FROM {$tables} WHERE {$condition} 
{$order}";
+               return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
        }
        
        function populate(int $control_group_id, &$control_group)
@@ -330,6 +346,8 @@
                        
$control_group->set_group_name($this->unmarshal($this->db->f('group_name'), 
'string'));
                        
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
                        
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
 'int'));
+                       
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
+                       
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
                }
                //var_dump($control_group);
                return $control_group;

Modified: trunk/controller/inc/class.uicontrol.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol.inc.php        2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/inc/class.uicontrol.inc.php        2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -230,11 +230,11 @@
                        
                        if(isset($control)) // Edit control
                        {
-                               $control = $this->populate($control);
+                               $control = $this->so->populate($control);
                                //$this->so->add($control);
                        }else{
                                $new_control = new controller_control();
-                               $control = $this->populate($new_control);
+                               $control = $this->so->populate($new_control);
                                $saved_control_id = $this->so->add($control);
                        }
                        

Modified: trunk/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- trunk/controller/inc/class.uicontrol_group.inc.php  2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/inc/class.uicontrol_group.inc.php  2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -123,6 +123,11 @@
                                                        'sortable'      => false
                                                ),
                                                array(
+                                                       'key' => 
'building_part',
+                                                       'label' => 
lang('Building part'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -162,6 +167,7 @@
                                        
$control_group->set_group_name(phpgw::get_var('group_name'));
                                        $control_group->set_procedure_id( 
phpgw::get_var('procedure') );
                                        $control_group->set_control_area_id( 
phpgw::get_var('control_area') );
+                                       $control_group->set_building_part_id( 
phpgw::get_var('building_part') );
                                                                        
                                        //$this->so->store($control_item);
                                        
@@ -236,6 +242,8 @@
                                        );
                                }
                                
+                               $building_part_options = 
$this->so->get_building_part_select_array();
+                               
                                $control_group_array = 
$control_group->toArray();
        
                                $data = array
@@ -246,6 +254,7 @@
                                        'procedure'                             
=> array('options' => $procedure_options),
                                        'control_area'                  => 
array('options' => $control_area_options),
                                        'control_group'                 => 
$control_group_array,
+                                       'building_part'                 => 
array('options' => $building_part_options),
                                );
        
        

Modified: trunk/controller/inc/model/class.check_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item.inc.php 2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/inc/model/class.check_item.inc.php 2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -57,11 +57,11 @@
                 */
                public static function get_so()
                {
-                       if (self::$so == null) {
-                               self::$so = 
CreateObject('controller.sopurpose');
+/*                     if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol_item');
                        }
                        
-                       return self::$so;
+                       return self::$so;*/
                }
        }
 ?>
\ No newline at end of file

Modified: trunk/controller/inc/model/class.control_group.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group.inc.php      2011-09-28 
06:27:25 UTC (rev 7745)
+++ trunk/controller/inc/model/class.control_group.inc.php      2011-09-28 
08:13:37 UTC (rev 7746)
@@ -9,6 +9,8 @@
                protected $group_name;
                protected $procedure_id;
                protected $control_area_id;
+               protected $building_part_id;
+               protected $building_part_descr;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -48,6 +50,20 @@
                }
                
                public function get_control_area_id(){ return 
$this->control_area_id; }
+               
+               public function set_building_part_id($building_part_id)
+               {
+                       $this->building_part_id = $building_part_id;
+               }
+               
+               public function get_building_part_id(){ return 
$this->building_part_id; }
+               
+               public function set_building_part_descr($building_part_descr)
+               {
+                       $this->building_part_descr = $building_part_descr;
+               }
+               
+               public function get_building_part_descr(){ return 
$this->building_part_descr; }
 
                public function serialize()
                {
@@ -56,6 +72,7 @@
                        $result['group_name'] = $this->get_group_name();
                        $result['procedure_id'] = $this->get_procedure_id();
                        $result['control_area_id'] = 
$this->get_control_area_id();
+                       $result['building_part'] = 
$this->get_building_part_descr();
                        
                        return $result;
                }

Modified: trunk/controller/setup/tables_current.inc.php
===================================================================
--- trunk/controller/setup/tables_current.inc.php       2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/setup/tables_current.inc.php       2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -97,7 +97,8 @@
                                'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
                                'group_name' => array('type' => 
'varchar','precision' => '255','nullable' => false),
                                'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'control_area_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'control_area_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'building_part_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/controller/templates/base/control_group.xsl
===================================================================
--- trunk/controller/templates/base/control_group.xsl   2011-09-28 06:27:25 UTC 
(rev 7745)
+++ trunk/controller/templates/base/control_group.xsl   2011-09-28 08:13:37 UTC 
(rev 7746)
@@ -57,7 +57,22 @@
                                                        <xsl:value-of 
select="control_group/procedure_id" />
                                                </xsl:otherwise>
                                        </xsl:choose>
-                                       </dd>                           
+                                       </dd>
+                                       <dt>
+                                               <label 
for="building_part">Bygningsdel</label>
+                                       </dt>
+                                       <dd>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <select 
id="building_part" name="building_part">
+                                                               
<xsl:apply-templates select="building_part/options"/>
+                                                       </select>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="control_group/building_part_descr" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                       </dd>
                                </dl>
                                
                                <div class="form-buttons">




reply via email to

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