fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7953] Merge 7936:7952 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [7953] Merge 7936:7952 from trunk
Date: Wed, 26 Oct 2011 13:59:09 +0000

Revision: 7953
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7953
Author:   sigurdne
Date:     2011-10-26 13:59:09 +0000 (Wed, 26 Oct 2011)
Log Message:
-----------
Merge 7936:7952 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.yui.inc.php
    branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php

Added Paths:
-----------
    
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
    
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.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,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935
   + 
/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,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952

Modified: 
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php
===================================================================
--- branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php    
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php    
2011-10-26 13:59:09 UTC (rev 7953)
@@ -6,16 +6,19 @@
        {
                throw new Exception("notify_accounting_by_email: missing 
'notify_email' in config for this catch schema:{$schema_text}");
        }
-       else if( !$validator->check_email_address($config_data['notify_email']) 
)
+
+       $to_array = explode(',', $config_data['notify_email']);
+
+//_debug_array($to_array);
+/*
+       foreach($to_array as $_to)
        {
-               throw new Exception("notify_accounting_by_email: not a valid 
'notify_email' in config for this catch schema:{$schema_text}");
+               if( !$validator->check_email_address($_to) )
+               {
+                       throw new Exception("notify_accounting_by_email: an 
unvalid 'notify_email': {$_to} in config for schema:{$schema_text}");
+               }
        }
-
-       $to_array = array
-       (
-               $config_data['notify_email']
-       );
-                                       
+*/                                     
        $socommon               = CreateObject('property.socommon');
        $prefs = $socommon->create_preferences('property',$user_id);
 //_debug_array($prefs);
@@ -59,7 +62,14 @@
        //$body = "<a href='{$_link_to_item}'>{$subject}</a>";
        unset($_link_to_item);
 
-       $body ="<H2>Det er registrert ny post i {$schema_text}</H2>";
+       if(isset($config_data['email_message']) && 
$config_data['email_message'])
+       {
+               $body = str_replace(array('[', ']'), array('<', '>'), 
$config_data['email_message']);
+       }
+       else
+       {
+               $body ="<H2>Det er registrert ny post i {$schema_text}</H2>";
+       }
 
        $jasper_id = isset($config_data['jasper_id']) && 
$config_data['jasper_id'] ? $config_data['jasper_id'] : 0;
 
@@ -74,7 +84,7 @@
                $jasper_parameters = '';
                $_parameters = array();
 
-               $_parameters[] =  "id|{$id}";
+               $_parameters[] =  "ID|{$id}";
                $jasper_parameters = '"' . implode(';', $_parameters) . '"';
 
                unset($_parameters);

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2011-10-26 13:59:09 UTC (rev 7953)
@@ -12,7 +12,7 @@
                                'controller' => array
                                (
                                        'text'  => lang('Controller'),
-                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.index') ),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol.view_control_details') ),
                     'image'    => array('property', 'location'),
                                        'order' => 10,
                                        'group' => 'office'

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2011-10-26 13:59:09 UTC (rev 7953)
@@ -168,7 +168,7 @@
                }
                else
                {
-                       $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, procedure_id, 
control_area_id, requirement_id, costresponsibility_id, responsibility_id, 
equipment_type_id, equipment_id, location_code, repeat_type, repeat_interval, 
enabled, controller_control_area.title AS control_area_name, 
controller_procedure.title AS procedure_name ';
+                       $cols = 'controller_control.id, 
controller_control.title, controller_control.description, 
controller_control.start_date, controller_control.end_date, 
controller_control.procedure_id, controller_control.control_area_id, 
controller_control.requirement_id, controller_control.costresponsibility_id, 
controller_control.responsibility_id, controller_control.equipment_type_id, 
controller_control.equipment_id, controller_control.location_code, 
controller_control.repeat_type, controller_control.repeat_interval, 
controller_control.enabled, controller_control_area.title AS control_area_name, 
controller_procedure.title AS procedure_name ';
                }
                
                $dir = $ascending ? 'ASC' : 'DESC';

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2011-10-26 13:59:09 UTC (rev 7953)
@@ -176,7 +176,7 @@
                        return $results;
        }
        
-       function get_control_groups($control_area_id)
+       function get_control_groups($control_area_id, $limit)
        {
                $results = array();
                
@@ -195,7 +195,7 @@
                return $results;
        }
        
-       function get_control_groups_as_array($control_area_id = null)
+       function get_control_groups_as_array($control_area_id = null, $limit)
        {
                $results = array();
                
@@ -360,7 +360,7 @@
 
                $tables = "controller_control_group";
                $joins = "      {$this->left_join} fm_building_part ON 
(building_part_id = CAST(fm_building_part.id AS INT))";
-               $joins .= "     {$this->left_join} controller_procedure ON 
(procedure_id = controller_procedure.id)";
+               $joins .= "     {$this->left_join} controller_procedure ON 
(controller_control_group.procedure_id = controller_procedure.id)";
                $joins .= "     {$this->left_join} controller_control_area ON 
(control_area_id = controller_control_area.id)";
                //$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)";
@@ -371,7 +371,7 @@
                }
                else
                {
-                       $cols .= "controller_control_group.id, group_name, 
procedure_id, control_area_id, building_part_id, fm_building_part.descr AS 
building_part_descr, controller_procedure.title as procedure_title, 
controller_control_area.title as control_area_name ";
+                       $cols .= "controller_control_group.id, group_name, 
controller_control_group.procedure_id, control_area_id, building_part_id, 
fm_building_part.descr AS building_part_descr, controller_procedure.title as 
procedure_title, controller_control_area.title as control_area_name ";
                }
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';

Copied: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php 
(from rev 7952, trunk/controller/inc/class.socontrol_group_list.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
                            (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
    2011-10-26 13:59:09 UTC (rev 7953)
@@ -0,0 +1,148 @@
+<?php
+phpgw::import_class('controller.socommon');
+
+include_class('controller', 'control_group_list', 'inc/model/');
+
+class controller_socontrol_group_list extends controller_socommon
+{
+       protected static $so;
+
+       /**
+        * Get a static reference to the storage object associated with this 
model object
+        *
+        * @return controller_socontrol_group the storage object
+        */
+       public static function get_instance()
+       {
+               if (self::$so == null) {
+                       self::$so = 
CreateObject('controller.socontrol_group_list');
+               }
+               return self::$so;
+       }
+
+       /**
+        * Function for adding a new control group to the database.
+        *
+        * @param controller_control_group $control_group the control group to 
be added
+        * @return int id of the new control group object
+        */
+       function add(&$control_group_list)
+       {
+               $cols = array(
+                               'control_id',
+                               'control_group_id',
+                               'order_nr'
+               );
+                       
+               $values = array(
+                       $this->marshal($control_group_list->get_control_id(), 
'int'),
+                       
$this->marshal($control_group_list->get_control_group_id(), 'int'),
+                       $this->marshal($control_group_list->get_order_nr(), 
'int')
+               );
+               
+               $result = $this->db->query('INSERT INTO 
controller_control_group_list (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
+               
+               if(isset($result)) {
+                       // Get the new control group ID and return it
+                       return 
$this->db->get_last_insert_id('controller_control_group_list', 'id');
+               }
+               else
+               {
+                       return 0;
+               }
+                       
+       }
+
+       /**
+        * Update the database values for an existing activity object.
+        *
+        * @param $activity the activity to be updated
+        * @return boolean true if successful, false otherwise
+        */
+
+       function update($control_group_list)
+       {       
+               $id = intval($control_group_list->get_id());
+                       
+               $values = array(
+                       'control_id = ' . 
$this->marshal($control_group_list->get_control_id(), 'string'),
+                       'control_group_id = '. 
$this->marshal($control_group_list->get_control_group_id(), 'int'),
+                       'order_nr = ' . 
$this->marshal($control_group_list->get_order_nr(), 'int')
+               );
+               
+               //var_dump('UPDATE activity_activity SET ' . join(',', $values) 
. " WHERE id=$id");
+               $result = $this->db->query('UPDATE 
controller_control_group_list SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
+               
+               return isset($result);
+       }
+       
+       /**
+        * Get single procedure
+        * 
+        * @param       $id     id of the procedure to return
+        * @return a controller_procedure
+        */
+       function get_single($id)
+       {
+               $id = (int)$id;
+               
+               $sql = "SELECT p.* FROM controller_control_group_list p WHERE 
p.id = " . $id;
+               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+               if($this->db->next_record()){
+                       $control_group_list = new 
controller_control_group_list($this->unmarshal($this->db->f('id', true), 
'int'));
+                       
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id', 
true), 'int'));
+                       
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
 'int'));
+                       
$control_group_list->set_order_nr($this->unmarshal($this->db->f('order_nr'), 
'int'));
+
+                       return $control_group_list; 
+               }
+               else
+               {
+                       return null;
+               }
+       }
+       
+       function get_single_2($control_id, $control_group_id)
+       {
+               $sql = "SELECT p.* FROM controller_control_group_list p WHERE 
p.control_id=" . $control_id . " AND p.control_group_id=" . $control_group_id;
+               $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+               
+               if($this->db->next_record()){
+                       $control_group_list = new 
controller_control_group_list($this->unmarshal($this->db->f('id', true), 
'int'));
+                       
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id', 
true), 'int'));
+                       
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
 'int'));
+                       
$control_group_list->set_order_nr($this->unmarshal($this->db->f('order_nr'), 
'int'));
+
+                       return $control_group_list; 
+               }
+               else
+               {
+                       return null;
+               }
+       }
+       
+       protected function get_query(string $sort_field, boolean $ascending, 
string $search_for, string $search_type, array $filters, boolean 
$return_count){}
+       
+       function get_id_field_name($extended_info = false){}
+       
+       function populate(int $control_group_id, &$control_group)
+       {
+               /*
+               if($control_group == null) {
+                       $control_group = new controller_control_group((int) 
$control_group_id);
+
+                       
$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_procedure_name($this->unmarshal($this->db->f('procedure_title'),
 'string'));
+                       
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
 'int'));
+                       
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
+                       
$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: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2011-10-26 13:59:09 UTC (rev 7953)
@@ -206,6 +206,14 @@
                {
                        $filter_clauses[] = 
"(controller_control_item.control_group_id IS NULL OR 
controller_control_item.control_group_id=0)";
                }
+               if(isset($filters['control_groups']))
+               {
+                       $filter_clauses[] = 
"controller_control_item.control_group_id = 
{$this->marshal($filters['control_groups'],'int')}";
+               }
+               if(isset($filters['control_areas']))
+               {
+                       $filter_clauses[] = 
"controller_control_item.control_area_id = 
{$this->marshal($filters['control_areas'],'int')}";
+               }
                
                if(count($filter_clauses))
                {

Modified: branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2011-10-26 13:59:09 UTC (rev 7953)
@@ -39,7 +39,8 @@
                                'end_date',
                                'procedure_id',
                                'revision_no',
-                               'revision_date'
+                               'revision_date',
+                               'control_area_id'
                );
                        
                $values = array(
@@ -53,7 +54,8 @@
                        $this->marshal($procedure->get_end_date(), 'int'),
                        $this->marshal($procedure->get_procedure_id(), 'int'),
                        $this->marshal($procedure->get_revision_no(), 'int'),
-                       $this->marshal($procedure->get_revision_date(), 'int')
+                       $this->marshal($procedure->get_revision_date(), 'int'),
+                       $this->marshal($procedure->get_control_area_id(), 'int')
                );
                
                $result = $this->db->query('INSERT INTO controller_procedure (' 
. join(',', $cols) . ') VALUES (' . join(',', $values) . ')', 
__LINE__,__FILE__);
@@ -91,7 +93,8 @@
                        'end_date = ' . 
$this->marshal($procedure->get_end_date(), 'int'),
                        'procedure_id = ' . 
$this->marshal($procedure->get_procedure_id(), 'int'),
                        'revision_no = ' . 
$this->marshal($procedure->get_revision_no(), 'int'),
-                       'revision_date = ' . 
$this->marshal($procedure->get_revision_date(), 'int')
+                       'revision_date = ' . 
$this->marshal($procedure->get_revision_date(), 'int'),
+                       'control_area_id = ' . 
$this->marshal($procedure->get_control_area_id(), 'int')
                );
                
                $result = $this->db->query('UPDATE controller_procedure SET ' . 
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -109,7 +112,8 @@
        {
                $id = (int)$id;
                
-               $sql = "SELECT p.* FROM controller_procedure p WHERE p.id = " . 
$id;
+               $joins = " {$this->left_join} controller_control_area ON 
(p.control_area_id = controller_control_area.id)";
+               $sql = "SELECT p.*, controller_control_area.title AS 
control_area_name FROM controller_procedure p {$joins} WHERE p.id = " . $id;
                $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
                $this->db->next_record();
                
@@ -125,6 +129,8 @@
                
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
                
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
                
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
+               
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_aera_id',
 'int')));
+               
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 'string')));
                
                return $procedure;
        }
@@ -191,6 +197,37 @@
                return $results;
        }
        
+       function get_old_revisions($id)
+       {
+               $results = array();
+               
+               $joins = " {$this->left_join} controller_control_area ON 
(p.control_area_id = controller_control_area.id)";
+               
+               $sql = "SELECT p.*, controller_control_area.title AS 
control_area_name FROM controller_procedure p {$joins} WHERE procedure_id = 
{$id} ORDER BY end_date DESC";
+               $this->db->limit_query($sql, $start, __LINE__, __FILE__, 
$limit);
+               
+               while ($this->db->next_record()) {
+                       $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id', true), 'int'));
+                       
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
+                       
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
+                       
$procedure->set_responsibility($this->unmarshal($this->db->f('responsibility', 
true), 'string'));
+                       
$procedure->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
+                       
$procedure->set_reference($this->unmarshal($this->db->f('reference', true), 
'string'));
+                       
$procedure->set_attachment($this->unmarshal($this->db->f('attachment', true), 
'string'));
+                       
$procedure->set_start_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 $this->unmarshal($this->db->f('start_date'), 'int')));
+                       
$procedure->set_end_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 $this->unmarshal($this->db->f('end_date'), 'int')));
+                       
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
+                       
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
+                       
$procedure->set_revision_date(date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 $this->unmarshal($this->db->f('revision_date'), 'int')));
+                       
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
 'int'));
+                       
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
 'string'));
+                       
+                       $results[] = $procedure->toArray();;
+               }
+               
+               return $results;
+       }
+       
        function get_id_field_name($extended_info = false)
        {
                
@@ -230,99 +267,26 @@
                }
 
                $filter_clauses = array();
-               /*switch($filters['is_active']){
-                       case "active":
-                               $filter_clauses[] = "rental_composite.is_active 
= TRUE";
-                               break;
+               $filter_clauses[] = "controller_procedure.end_date IS NULL";
+               /*
+               switch($filters['is_active']){
                        case "non_active":
-                               $filter_clauses[] = "rental_composite.is_active 
= FALSE";
+                               $filter_clauses[] = "NOT 
controller_procedure.end_date IS NULL";
                                break;
-                       case "both":
+                       default:
+                               $filter_clauses[] = 
"controller_procedure.end_date IS NULL";
                                break;
-               }*/
-               /*
-               $special_query = false; //specify if the query should use 
distinct on rental_composite.id (used for selecting composites that has an 
active or inactive contract)
-               $ts_query = strtotime(date('Y-m-d')); // timestamp for query 
(today)
-               $availability_date_from = $ts_query;
-               $availability_date_to = $ts_query;
-               
-               if(isset($filters['availability_date_from']) && 
$filters['availability_date_from'] != ''){
-                       $availability_date_from = 
strtotime($filters['availability_date_from']); 
                }
-               
-               if(isset($filters['availability_date_to']) && 
$filters['availability_date_to'] != ''){
-                       $availability_date_to = 
strtotime($filters['availability_date_to']); 
-               }
                */
-               /*switch($filters['has_contract']){
-                       case "has_contract":
-                               $filter_clauses[] = "NOT 
rental_contract_composite.contract_id IS NULL"; // Composite must have a 
contract
-                               $filter_clauses[] = "NOT 
rental_contract.date_start IS NULL"; // The contract must have start date
-                       */      
-                               /* The contract's start date not after the end 
of the period if there is no end date */
-/*                             $filter_clauses[] = "
-                                       ((NOT rental_contract.date_start > 
$availability_date_to AND rental_contract.date_end IS NULL)
-                                        OR
-                                       (NOT rental_contract.date_start > 
$availability_date_to AND NOT rental_contract.date_end IS NULL AND NOT 
rental_contract.date_end < $availability_date_from))";
-                               $special_query=true;
-                               break;
-                       case "has_no_contract":
-                               $filter_clauses[] = "
-                               (
-                                       rental_contract_composite.contract_id 
IS NULL OR 
-                                       NOT rental_composite.id IN 
-                                       (
-                                               SELECT rental_composite.id FROM 
rental_composite 
-                                               LEFT JOIN  
rental_contract_composite ON (rental_contract_composite.composite_id = 
rental_composite.id) 
-                                               LEFT JOIN  rental_contract ON 
(rental_contract.id = rental_contract_composite.contract_id) 
-                                               WHERE  
-                                               (
-                                                       NOT 
rental_contract_composite.contract_id IS NULL AND
-                                                       NOT 
rental_contract.date_start IS NULL AND
-                                                       ((NOT 
rental_contract.date_start > $availability_date_to AND rental_contract.date_end 
IS NULL)
-                                                       OR
-                                                       (NOT 
rental_contract.date_start > $availability_date_to AND NOT 
rental_contract.date_end IS NULL AND NOT rental_contract.date_end < 
$availability_date_from))
-                                               )
-                                       )
-                               )
-                               ";
-                               $special_query=true;
-                               break;
-                       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)";
-               }
-               
-               if(isset($filters['location_code'])){
-                       $filter_clauses[] = "rental_unit.location_code = '". 
$filters['location_code'] . "'";
-               }
-               
-               if(isset($filters['contract_id']))
-               {
-                       $filter_clauses[] = "contract_id = 
{$this->marshal($filters['contract_id'],'int')}";
-               }
-               
                if(isset($filters[$this->get_id_field_name()]))
                {
-                       $filter_clauses[] = "rental_composite.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
-               }*/
-               
-               if(isset($filters[$this->get_id_field_name()]))
-               {
                        $filter_clauses[] = "controller_procedure.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
                }
+               if(isset($filters['control_areas']))
+               {
+                       $filter_clauses[] = 
"controller_procedure.control_area_id = 
{$this->marshal($filters['control_areas'], 'int')}";
+               }
 
                if(count($filter_clauses))
                {
@@ -330,11 +294,10 @@
                }
 
                $condition =  join(' AND ', $clauses);
+               
+               $joins = " {$this->left_join} controller_control_area ON 
(controller_procedure.control_area_id = controller_control_area.id)";
 
                $tables = "controller_procedure";
-               //$joins = "    {$this->left_join} rental_unit ON 
(rental_composite.id = rental_unit.composite_id)";
-               //$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)";
                
                if($return_count) // We should only return a count
                {
@@ -342,7 +305,7 @@
                }
                else
                {
-                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment, 
controller_procedure.start_date, controller_procedure.end_date, 
controller_procedure.procedure_id, controller_procedure.revision_no, 
controller_procedure.revision_date ";
+                       $cols .= "controller_procedure.id, 
controller_procedure.title, controller_procedure.purpose, 
controller_procedure.responsibility, controller_procedure.description, 
controller_procedure.reference, controller_procedure.attachment, 
controller_procedure.start_date, controller_procedure.end_date, 
controller_procedure.procedure_id, controller_procedure.revision_no, 
controller_procedure.revision_date, controller_control_area.title AS 
control_area_name ";
                }
                $dir = $ascending ? 'ASC' : 'DESC';
                $order = $sort_field ? "ORDER BY {$this->marshal($sort_field, 
'field')} $dir ": '';
@@ -369,6 +332,8 @@
                        
$procedure->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
                        
$procedure->set_revision_no($this->unmarshal($this->db->f('revision_no'), 
'int'));
                        
$procedure->set_revision_date($this->unmarshal($this->db->f('revision_date'), 
'int'));
+                       
$procedure->set_control_area_id($this->unmarshal($this->db->f('control_aera_id',
 'int')));
+                       
$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 'string')));
                }
                
                return $procedure;

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2011-10-26 13:59:09 UTC (rev 7953)
@@ -3,7 +3,7 @@
        phpgw::import_class('property.boevent');
        phpgw::import_class('controller.socontrol');
        phpgw::import_class('controller.socontrol_item');
-       phpgw::import_class('controller.socontrol_group');
+       phpgw::import_class('controller.socontrol_group_list');
        phpgw::import_class('controller.socontrol_area');
        
        include_class('controller', 'control_group', 'inc/model/');
@@ -14,6 +14,7 @@
                private $so_procedure;
                private $so_control_area;
                private $so_control_item;
+               private $so_control_group_list;
                
                public $public_functions = array
                (
@@ -21,7 +22,8 @@
                        'query' =>      true,
                        'edit'  =>      true,
                        'view'  =>      true,
-                       'add'   =>      true
+                       'add'   =>      true,
+                       'save_group_order'      =>      true
                );
 
                public function __construct()
@@ -31,6 +33,7 @@
                        $this->so_procedure = 
CreateObject('controller.soprocedure');
                        $this->so_control_area = 
CreateObject('controller.socontrol_area');
                        $this->so_control_item = 
CreateObject('controller.socontrol_item');
+                       $this->so_control_group_list = 
CreateObject('controller.socontrol_group_list');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::control_group";
                }
                
@@ -461,6 +464,33 @@
                        }
                }
 
+               public function save_group_order(){
+                       $control_group_id = phpgw::get_var('control_group_id');
+                       $control_id = phpgw::get_var('control_id');
+                       $group_order_nr = phpgw::get_var('group_order_nr');
+                       
+                       $status = true;
+                       
+                       $control_group_list = 
$this->so_control_group_list->get_single_2($control_id, $control_group_id);
+                       
+                       var_dump("Skriver ut control_group_list");
+                       var_dump($control_group_list);
+                       
+                       if( $control_group_list == null ){
+                               $control_group_list = new 
controller_control_group_list();
+                               
$control_group_list->set_control_id($control_id);
+                               
$control_group_list->set_control_group_id($control_group_id);
+                               $control_group_list->set_order_nr( 
$group_order_nr );
+                               $this->so_control_group_list->add( 
$control_group_list );
+                       }else{
+                               $control_group_list->set_order_nr( 
$group_order_nr );
+                               $this->so_control_group_list->update( 
$control_group_list );    
+                       }
+                       
+                       return status;                  
+               }
+               
+               
                public function query()
                {
                        $params = array(

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2011-10-26 13:59:09 UTC (rev 7953)
@@ -502,6 +502,17 @@
                                'filters' => $filters
                        );
                        
+                       $ctrl_area = phpgw::get_var('control_areas');
+                       if(isset($ctrl_area) && $ctrl_area > 0)
+                       {
+                               $filters['control_areas'] = $ctrl_area; 
+                       }
+                       $ctrl_group = phpgw::get_var('control_groups');
+                       if(isset($ctrl_group) && $ctrl_group > 0)
+                       {
+                               $filters['control_groups'] = $ctrl_group; 
+                       }
+                       
                        $search_for = phpgw::get_var('query');
 
                        
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)

Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2011-10-26 13:59:09 UTC (rev 7953)
@@ -1,12 +1,14 @@
 <?php
        phpgw::import_class('controller.uicommon');
        phpgw::import_class('controller.soprocedure');
+       phpgw::import_class('controller.socontrol_area');
        
        include_class('controller', 'procedure', 'inc/model/');
 
        class controller_uiprocedure extends controller_uicommon
        {
                private $so;
+               private $so_control_area;
                
                public $public_functions = array
                (
@@ -22,6 +24,7 @@
                        parent::__construct();
 
                        $this->so = CreateObject('controller.soprocedure');
+                       $this->so_control_area = 
CreateObject('controller.socontrol_area');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"controller::procedure";
                        //$this->bo = CreateObject('property.boevent',true);
                }
@@ -45,6 +48,11 @@
                                                                'value' => 
lang('f_new_procedure'),
                                                                'href' => 
self::link(array('menuaction' => 'controller.uiprocedure.add'))
                                                        ),
+                                                       array('type' => 
'filter',
+                                                               'name' => 
'control_areas',
+                                'text' => lang('Control_area').':',
+                                'list' => 
$this->so_control_area->get_control_area_select_array(),
+                                                       ),
                                                        array('type' => 'text', 
                                 'text' => lang('search'),
                                                                'name' => 
'query'
@@ -77,6 +85,16 @@
                                                        'sortable'      => false
                                                ),
                                                array(
+                                                       'key' => 'control_area',
+                                                       'label' => 
lang('Control area'),
+                                                       'sortable'      => false
+                                               ),
+                                               array(
+                                                       'key' => 
'revision_date',
+                                                       'label' => 
lang('Procedure revision date'),
+                                                       'sortable'      => true
+                                               ),
+                                               array(
                                                        'key' => 'link',
                                                        'hidden' => true
                                                )
@@ -113,6 +131,8 @@
                                        
$procedure->set_attachment(phpgw::get_var('attachment'));
                                        
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
                                        
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
+                                       
$procedure->set_revision_date(strtotime(phpgw::get_var('revision_date_hidden')));
+                                       
$procedure->set_control_area_id(phpgw::get_var('control_area'));
                                        
                                        if(isset($procedure_id) && 
$procedure_id > 0)
                                        {
@@ -146,13 +166,16 @@
                                $old_procedure = 
$this->so->get_single($procedure_id);
                                if(isset($procedure)) // Edit procedure
                                {
-                                       $revision = 
$procedure->get_revision_no();
+                                       $revision = 
(int)$procedure->get_revision_no();
                                        if($revision && is_numeric($revision))
                                        {
-                                               $revision = (int)$revision;
-                                               $new_revision = $revision++;
-                                               
$procedure->set_revision_no($new_revision);
+                                               $revision++;
+                                               
$procedure->set_revision_no($revision);
                                        }
+                                       else
+                                       {
+                                               $procedure->set_revision_no(1);
+                                       }
                                        
$procedure->set_title(phpgw::get_var('title'));
                                        
$procedure->set_purpose(phpgw::get_var('purpose','html'));
                                        
$procedure->set_responsibility(phpgw::get_var('responsibility'));
@@ -161,6 +184,7 @@
                                        
$procedure->set_attachment(phpgw::get_var('attachment'));
                                        
$procedure->set_start_date(strtotime(phpgw::get_var('start_date_hidden')));
                                        
$procedure->set_end_date(strtotime(phpgw::get_var('end_date_hidden')));
+                                       
$procedure->set_control_area_id(phpgw::get_var('control_area'));
                                        
                                        if(isset($procedure_id) && 
$procedure_id > 0)
                                        {
@@ -202,7 +226,27 @@
                                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
                                        $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
                                }
-                               
+                               $control_area_array = 
$this->so_control_area->get_control_area_array();
+                               foreach ($control_area_array as $control_area)
+                               {
+                                       if($procedure->get_control_area_id() && 
$control_area->get_id() == $procedure->get_control_area_id())
+                                       {
+                                               $control_area_options[] = array
+                                               (
+                                                       'id'    => 
$control_area->get_id(),
+                                                       'name'  => 
$control_area->get_title(),
+                                                       'selected' => 'yes'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $control_area_options[] = array
+                                               (
+                                                       'id'    => 
$control_area->get_id(),
+                                                       'name'  => 
$control_area->get_title()
+                                               );
+                                       }
+                               }
                                $procedure_array = $procedure->toArray();
                                //_debug_array($procedure_array);
        
@@ -211,9 +255,11 @@
                                        'value_id'                              
=> !empty($procedure) ? $procedure->get_id() : 0,
                                        'start_date'                    => 
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_start_date())?$procedure->get_start_date():time())),
                                        'end_date'                              
=> 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_end_date())?$procedure->get_end_date():'')),
+                                       'revision_date'                 => 
$GLOBALS['phpgw']->yuical->add_listener('revision_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_revision_date())?$procedure->get_revision_date():'')),
                                        'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
=> true,
                                        'procedure'                             
=> $procedure_array,
+                                       'control_area'                          
=> array('options' => $control_area_options),
                                );
        
        
@@ -221,10 +267,11 @@
        
        
                                
$GLOBALS['phpgw']->richtext->replace_element('purpose');
+                               //$this->use_yui_editor();
                                
$GLOBALS['phpgw']->richtext->replace_element('description');
+                               
//$GLOBALS['phpgw']->richtext->generate_script(true);
                                $GLOBALS['phpgw']->richtext->generate_script();
        
-       
        //                      $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'controller.item', 'controller' );
        
                                self::render_template_xsl('procedure_item', 
$data);
@@ -246,6 +293,7 @@
                public function view()
                {
                        $GLOBALS['phpgw_info']['flags']['app_header'] .= 
'::'.lang('view');
+                       $view_revision = phpgw::get_var('view_revision');
                        //Retrieve the procedure object
                        $procedure_id = (int)phpgw::get_var('id');
                        if(isset($_POST['edit_procedure']))
@@ -275,7 +323,25 @@
                                        $procedure_start_date = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_start_date());
                                if($procedure->get_end_date() && 
$procedure->get_end_date() != null)
                                        $procedure_end_date     = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_end_date());
+                               if($procedure->get_revision_date() && 
$procedure->get_revision_date() != null)
+                                       $procedure_revision_date        = 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$procedure->get_revision_date());
                                //_debug_array($procedure_array);
+                               
+                               if(!$view_revision)
+                               {
+                                       $table_header[] = array('header' => 
lang('Procedure revision'));
+                                       $table_header[] = array('header' => 
lang('Procedure title'));
+                                       $table_header[] = array('header' => 
lang('Procedure start date'));
+                                       $table_header[] = array('header' => 
lang('Procedure end date'));
+                                       
+                                       $revised_procedures = 
$this->so->get_old_revisions($procedure->get_id());
+                                       //var_dump($revised_procedures);
+                                       foreach($revised_procedures as $rev)
+                                       {
+                                               $rev['link'] = 
self::link(array('menuaction' => 'controller.uiprocedure.view', 'id' => 
$rev['id'], 'view_revision' => 'yes'));
+                                               $table_values[] = array('row' 
=> $rev);
+                                       }
+                               }
        
                                $data = array
                                (
@@ -283,8 +349,16 @@
                                        'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'procedure'                             
=> $procedure_array,
                                        'start_date'                    => 
$procedure_start_date,
-                                       'end_date'                              
=> $procedure_end_date
+                                       'end_date'                              
=> $procedure_end_date,
+                                       'revision_date'                 => 
$procedure_revision_date,
+                                       'values'                                
=> $table_values,
+                                       'table_header'                  => 
$table_header,
                                );
+                               
+                               if($procedure->get_end_date())
+                               {
+                                       $data['inactive'] = true;
+                               }
        
        
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('controller') . '::' . lang('Procedure');
@@ -304,6 +378,12 @@
                                'filters' => $filters
                        );
                        
+                       $ctrl_area = phpgw::get_var('control_areas');
+                       if(isset($ctrl_area) && $ctrl_area > 0)
+                       {
+                               $filters['control_areas'] = $ctrl_area; 
+                       }
+                       
                        
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
                        {
                                $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
@@ -339,7 +419,7 @@
                        {
                                default: // ... all composites, filters (active 
and vacant)
                                        
phpgwapi_cache::session_set('controller', 'procedure_query', $search_for);
-                                       $filters = array();
+                                       //$filters = array();
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
                                        break;

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php    
    2011-10-26 13:57:02 UTC (rev 7952)
+++ 
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php    
    2011-10-26 13:59:09 UTC (rev 7953)
@@ -13,7 +13,8 @@
                protected $control_area_name;
                protected $building_part_id;
                protected $building_part_descr;
-               
+               protected $order_nr;
+                               
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
                 * the database the ID should be empty so the database can add 
one according to its logic.
@@ -80,6 +81,13 @@
                }
                
                public function get_building_part_descr(){ return 
$this->building_part_descr; }
+               
+               public function set_order_nr($order_nr)
+               {
+                       $this->order_nr = $order_nr;
+               }
+               
+               public function get_order_nr(){ return $this->order_nr; }
 
                public function serialize()
                {
@@ -89,6 +97,7 @@
                        $result['procedure'] = $this->get_procedure_name();
                        $result['control_area'] = 
$this->get_control_area_name();
                        $result['building_part'] = 
$this->get_building_part_descr();
+                       $result['order_nr'] = $this->get_order_nr();
                        
                        return $result;
                }

Copied: 
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.php
 (from rev 7952, trunk/controller/inc/model/class.control_group_list.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.php
                           (rev 0)
+++ 
branches/Version-1_0-branch/controller/inc/model/class.control_group_list.inc.php
   2011-10-26 13:59:09 UTC (rev 7953)
@@ -0,0 +1,77 @@
+<?php
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_group_list extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $control_id;
+               protected $control_group_id;
+               protected $order_nr;
+                               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_control_group_id($control_group_id)
+               {
+                       $this->control_group_id = $control_group_id;
+               }
+               
+               public function get_control_group_id() { return 
$this->control_group_id; }
+               
+               public function set_order_nr($order_nr)
+               {
+                       $this->order_nr = $order_nr;
+               }
+               
+               public function get_order_nr() { return $this->order_nr; }
+                       
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol_group_list');
+                       }
+                       
+                       return self::$so;
+               }
+               
+                public function serialize()
+                {
+                       $result = array();
+                       $result['id'] = $this->get_id();
+                       $result['control_id'] = $this->get_control_id();
+                       $result['control_group_id'] = 
$this->get_control_group_id();
+                       $result['order_nr'] = $this->get_order_nr();
+                                               
+                       return $result;
+               }
+}
+?>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php    
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/inc/model/class.procedure.inc.php    
2011-10-26 13:59:09 UTC (rev 7953)
@@ -17,6 +17,8 @@
                protected $procedure_id;
                protected $revision_no;
                protected $revision_date;
+               protected $control_area_id;
+               protected $control_area_name;
                
                /**
                 * Constructor.  Takes an optional ID.  If a procedure is 
created from outside
@@ -113,6 +115,20 @@
                
                public function get_revision_date() { return 
$this->revision_date; }
                
+               public function set_control_area_id($control_area_id)
+               {
+                       $this->control_area_id = $control_area_id;
+               }
+               
+               public function get_control_area_id() { return 
$this->control_area_id; }
+               
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name() { return 
$this->control_area_name; }
+               
                /**
                 * Get a static reference to the storage object associated with 
this model object
                 * 
@@ -141,7 +157,8 @@
                                        'end_date' => $this->get_end_date(),
                                        'procedure_id' => 
$this->get_procedure_id(),
                                        'revision_no' => 
$this->get_revision_no(),
-                                       'revision_date' => 
$this->get_revision_date()
+                                       'revision_date' => 
($this->get_revision_date())?date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 $this->get_revision_date()):'',
+                                       'control_area'  => 
$this->get_control_area_name()
                        );
                }
        }

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2011-10-26 
13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2011-10-26 
13:59:09 UTC (rev 7953)
@@ -256,4 +256,6 @@
 Control_locations      controller      no      Lokasjoner
 Control_equipment      controller      no      Utstyr
 New control    controller      no      Ny kontroll
-revisit        controller      no      Revidér
\ No newline at end of file
+revisit        controller      no      Revidér
+Procedure revision     controller      no      Revisjon
+Procedure revision date        controller      no      Revisjonsdato
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2011-10-26 
13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2011-10-26 
13:59:09 UTC (rev 7953)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.1';
+       $setup_info['controller']['version'] = '0.1.5';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2011-10-26 13:59:09 UTC (rev 7953)
@@ -91,7 +91,8 @@
                                'end_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
                                'procedure_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
                                'revision_no' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'revision_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
+                               'revision_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True),
+                               'control_area_id' => array('type' => 'int', 
'presicion' => 4, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -120,5 +121,17 @@
                        'fk' => array(),
                        'ix' => array(),
                        'uc' => array()
-               )
-       );
+               ),
+               'controller_control_group_list', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => false),
+                                       'control_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                                       'control_group_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => false),
+                                       'order_nr' => array('type' => 
'varchar', 'precision' => '3', 'nullable' => false)
+                               ),
+                       'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+       );
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2011-10-26 13:59:09 UTC (rev 7953)
@@ -1,7 +1,6 @@
 <?php
 
-        /* Update Controller from v 0.1 to 0.1.1
-        */
+        /* Update Controller from v 0.1 to 0.1.1 */
 
        $test[] = '0.1';
        function controller_upgrade0_1()
@@ -27,5 +26,64 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.1';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+
+       $test[] = '0.1.1';
+       function controller_upgrade0_1_1()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','order_nr',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+               ));
+               
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.2';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
        
+       $test[] = '0.1.2';
+       function controller_upgrade0_1_2()
+       {
+               $GLOBALS['phpgw_setup']->oProc->CreateTable(
+                       'controller_control_group_list', array(
+                               'fd' => array(
+                                       'id' => array('type' => 'auto', 
'nullable' => false),
+                                       'control_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => false),
+                                       'control_group_id' => array('type' => 
'int', 'precision' => '4', 'nullable' => false),
+                                       'order_nr' => array('type' => 
'varchar', 'precision' => '3', 'nullable' => false)
+                               ),
+                               'pk' => array('id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+                       )
+               );      
+               
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.3';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
+       
+       $test[] = '0.1.3';
+       function controller_upgrade0_1_3()
+       {
+               $GLOBALS['phpgw_setup']->oProc->query("ALTER TABLE 
controller_control_group DROP COLUMN order_nr");     
+                       
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.4';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
+       
+       /* Update Controller from v 0.1.4 to 0.1.5
+        */
+
+       $test[] = '0.1.4';
+       function controller_upgrade0_1_4()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_procedure','control_area_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => True
+               ));
+               
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.5';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
 ?>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl    
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/controller/templates/base/procedure_item.xsl    
2011-10-26 13:59:09 UTC (rev 7953)
@@ -29,6 +29,12 @@
                                        </xsl:choose>
                                        </dd>
                                        <dt>
+                                               <label 
for="revision_no"><xsl:value-of select="php:function('lang','Procedure 
revision')" /></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
select="procedure/revision_no" />
+                                       </dd>
+                                       <dt>
                                                <label 
for="purpose"><xsl:value-of select="php:function('lang','Procedure purpose')" 
/></label>
                                        </dt>
                                        <dd>
@@ -55,6 +61,21 @@
                                        </xsl:choose>
                                        </dd>
                                        <dt>
+                                               <label 
for="control_area"><xsl:value-of select="php:function('lang','Control area')" 
/></label>
+                                       </dt>
+                                       <dd>
+                                       <xsl:choose>
+                                               <xsl:when test="editable">
+                                                       <select 
id="control_area" name="control_area">
+                                                               
<xsl:apply-templates select="control_area/options"/>
+                                                       </select>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="procedure/control_area_name" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                                       </dd>
+                                       <dt>
                                                <label 
for="description"><xsl:value-of select="php:function('lang','Procedure 
description')" /></label>
                                        </dt>
                                        <dd>
@@ -74,11 +95,19 @@
                                                <xsl:value-of 
disable-output-escaping="yes" select="start_date"/>
                                        </dd>
                                        <dt>
+                                               <label 
for="revision_date"><xsl:value-of select="php:function('lang','Procedure 
revision date')" /></label>
+                                       </dt>
+                                       <dd>
+                                               <xsl:value-of 
disable-output-escaping="yes" select="revision_date"/>
+                                       </dd>
+                                       <xsl:if test="end_date != ''">
+                                       <dt>
                                                <label 
for="end_date"><xsl:value-of select="php:function('lang','Procedure end date')" 
/></label>
                                        </dt>
                                        <dd>
                                                <xsl:value-of 
disable-output-escaping="yes" select="end_date"/>
                                        </dd>
+                                       </xsl:if>
                                        <dt>
                                                <label 
for="reference"><xsl:value-of select="php:function('lang','Procedure 
Reference')" /></label>
                                        </dt>
@@ -117,6 +146,10 @@
                                                        <input type="submit" 
name="revisit_procedure" value="{$lang_revisit}" title = "{$lang_revisit}" />
                                                        <input type="submit" 
name="cancel_procedure" value="{$lang_cancel}" title = "{$lang_cancel}" />
                                                </xsl:when>
+                                               <xsl:when test="inactive">
+                                                       <xsl:variable 
name="lang_back"><xsl:value-of select="php:function('lang', 'back')" 
/></xsl:variable>
+                                                       <input type="button" 
value="{$lang_back}" title="{$lang_back}" onclick="javascript: history.go(-1);" 
style="margin: 0 0 15px 15px; padding: 1px 15px;"/>
+                                               </xsl:when>
                                                <xsl:otherwise>
                                                        <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
                                                        <input type="submit" 
name="edit_procedure" value="{$lang_edit}" title = "{$lang_edit}" />
@@ -124,7 +157,55 @@
                                        </xsl:choose>
                                </div>
                        </form>
-                                               
+                       <xsl:choose>
+                               <xsl:when test="values != ''">
+                                       <table cellpadding="10" 
cellspacing="10" align="left" style="margin-left: 1em;">
+                                               <xsl:call-template 
name="table_header_history"/>
+                                               <xsl:call-template 
name="values_history"/>
+                                       </table>
+                               </xsl:when>
+                       </xsl:choose>
                </div>
        </div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>
+
+<xsl:template name="table_header_history">
+               <tr class="th">
+                       <xsl:for-each select="table_header" >
+                               <td class="th_text" style="padding-right: 
10px;">
+                                       <xsl:value-of select="header"/>
+                               </td>
+                       </xsl:for-each>
+               </tr>
+       </xsl:template>
+
+       <xsl:template name="values_history">
+               <xsl:for-each select="values" >
+                       <tr>
+                               <xsl:for-each select="row" >
+                                       <xsl:variable 
name="proc_link"><xsl:value-of select='link'/></xsl:variable>
+                                       <td align="right" style="padding-right: 
10px;">
+                                               <a 
href="{$proc_link}"><xsl:value-of select="revision_no"/></a>
+                                       </td>
+                                       <td align="left" style="padding-right: 
10px;">
+                                               <xsl:value-of select="title"/>
+                                       </td>
+                                       <td align="left" style="padding-right: 
10px;">
+                                               <xsl:value-of 
select="start_date"/>
+                                       </td>
+                                       <td align="left" style="padding-right: 
10px;">
+                                               <xsl:value-of 
select="end_date"/>
+                                       </td>
+                               </xsl:for-each>
+                       </tr>
+               </xsl:for-each>
+       </xsl:template>
+       
+       <xsl:template match="options">
+               <option value="{id}">
+                       <xsl:if test="selected != 0">
+                               <xsl:attribute name="selected" value="selected" 
/>
+                       </xsl:if>
+                       <xsl:value-of disable-output-escaping="yes" 
select="name"/>
+               </option>
+       </xsl:template>
\ No newline at end of file

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.yui.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.yui.inc.php  2011-10-26 
13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.yui.inc.php  2011-10-26 
13:59:09 UTC (rev 7953)
@@ -225,10 +225,21 @@
                                {
                                        $_function = " onclick=\"javascript: 
{$tab['function']};\"";
                                }
-                               $output .= <<<HTML
-                                       <li{$selected}><a 
href="{$tab['link']}"{$_function}><em>{$label}</em></a></li>
 
+                               if(!isset($tab['link']) && 
!isset($tab['function']))
+                               {
+                                       $selected = $selected ? $selected : ' 
class="disabled"';
+                                       $output .= <<<HTML
+                                               
<li{$selected}><a><em>{$label}</em></a></li>
 HTML;
+                               }
+                               else
+                               {
+                                       $output .= <<<HTML
+                                               <li{$selected}><a 
href="{$tab['link']}"{$_function}><em>{$label}</em></a></li>
+HTML;
+                               
+                               }
                        }
                        $output .= <<<HTML
                                </ul>

Modified: branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php 
2011-10-26 13:57:02 UTC (rev 7952)
+++ branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php 
2011-10-26 13:59:09 UTC (rev 7953)
@@ -296,31 +296,7 @@
 
                                                $i++;
 
-                                               // finishing
-                                               $criteria = array
-                                               (
-                                                       'appname'       => 
'catch',
-                                                       'location'      => 
'.catch.' . str_replace('_','.',$target),
-                                                       'allrows'       => true
-                                               );
 
-                                               $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
-
-                                               foreach ( $custom_functions as 
$entry )
-                                               {
-                                                       // prevent path 
traversal
-                                                       if ( 
preg_match('/\.\./', $entry['file_name']) )
-                                                       {
-                                                               continue;
-                                                       }
-
-                                                       $file = 
PHPGW_SERVER_ROOT . 
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
-                                                       if ( $entry['active'] 
&& is_file($file) )
-                                                       {
-                                                               require $file;
-                                                       }
-                                               }
-                                               
                                                $ok = false;
                                                
if($this->db->transaction_commit())
                                                {
@@ -329,12 +305,41 @@
                                                                $ok = 
@rename($movefrom, $moveto);
                                                        }
                                                }
+
                                                if(!$ok)
                                                {
                                                        
$this->db->query("DELETE FROM $target_table WHERE id =" . 
(int)$id,__LINE__,__FILE__);
                                                        $i--;
                                                        
$this->receipt['error'][]=array('msg'=>lang('There was a problem moving the 
file(s), imported records are reverted'));
                                                }
+                                               else
+                                               {
+
+                                                       // finishing
+                                                       $criteria = array
+                                                       (
+                                                               'appname'       
=> 'catch',
+                                                               'location'      
=> '.catch.' . str_replace('_','.',$target),
+                                                               'allrows'       
=> true
+                                                       );
+
+                                                       $custom_functions = 
$GLOBALS['phpgw']->custom_functions->find($criteria);
+
+                                                       foreach ( 
$custom_functions as $entry )
+                                                       {
+                                                               // prevent path 
traversal
+                                                               if ( 
preg_match('/\.\./', $entry['file_name']) )
+                                                               {
+                                                                       
continue;
+                                                               }
+
+                                                               $file = 
PHPGW_SERVER_ROOT . 
"/catch/inc/custom/{$GLOBALS['phpgw_info']['user']['domain']}/{$entry['file_name']}";
+                                                               if ( 
$entry['active'] && is_file($file) )
+                                                               {
+                                                                       require 
$file;
+                                                               }
+                                                       }
+                                               }
                                        }
                                }
                                
$this->receipt['message'][]=array('msg'=>lang('%1 records imported to %2', $i, 
$schema_text));




reply via email to

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