fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8813] Merge 8798:8812 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8813] Merge 8798:8812 from trunk
Date: Thu, 09 Feb 2012 09:22:34 +0000

Revision: 8813
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8813
Author:   sigurdne
Date:     2012-02-09 09:22:33 +0000 (Thu, 09 Feb 2012)
Log Message:
-----------
Merge 8798:8812 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/js/yahoo/common.js
    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/calendar/view_calendar_year.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php

Added Paths:
-----------
    branches/Version-1_0-branch/controller/inc/class.uitest.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,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797
   + 
/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,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-02-09 09:22:33 UTC (rev 8813)
@@ -60,7 +60,7 @@
                                                'children' => array(
                                                                                
        'location_for_check_list' => array
                                                                                
        (
-                                                                               
                'text'  => lang('Location'),
+                                                                               
                'text'  => lang('location_connections'),
                                                                                
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicontrol_location.index') ),
                                                                                
                'image' => array('property', 'location_1')
                                                                                
        ),
@@ -72,12 +72,12 @@
                                                                                
        )
                                                                                
)
                                        ),
-                                       'location_for_check_list' => array
+/*                                     'location_for_check_list' => array
                                        (
                                                'text'  => 
lang('location_connections'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_location.index') ),
                                                'image' => array('property', 
'location_1')
-                                       ),
+                                       ),*/
                                        'control_item' => array
                                        (
                                                'text'  => lang('Control_item'),

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-02-09 09:22:33 UTC (rev 8813)
@@ -66,7 +66,7 @@
 
                        $values = array(
                                
$this->marshal($check_item->get_control_item_id(), 'int'),
-                               $this->marshal($check_item->get_status(), 
'int'),
+                               $check_item->get_status(),
                                $this->marshal($check_item->get_comment(), 
'string'),
                                
$this->marshal($check_item->get_check_list_id(), 'int'),
                                $this->marshal($check_item->get_measurement(), 
'int')
@@ -83,7 +83,7 @@
 
                        $values = array(
                                'control_item_id = ' . 
$this->marshal($check_item->get_control_item_id(), 'int'),
-                               'status = ' . 
$this->marshal($check_item->get_status(), 'int'),
+                               'status = ' . $check_item->get_status(),
                                'comment = ' . 
$this->marshal($check_item->get_comment(), 'string'),
                                'check_list_id = ' . 
$this->marshal($check_item->get_check_list_id(), 'int'),
                                'measurement = ' . 
$this->marshal($check_item->get_measurement(), 'string')

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-02-09 09:22:33 UTC (rev 8813)
@@ -302,11 +302,15 @@
                }
        }
        
-       function get_agg_check_lists_for_location( $location_code, 
$from_date_ts, $to_date_ts ){
-               
+       function get_agg_check_lists_for_location( $location_code, 
$from_date_ts, $to_date_ts, $control_id = 0 ){
+                               
                $sql =  "SELECT c.id as c_id, title, start_date, end_date, 
cl.id as cl_id, c.repeat_type, c.repeat_interval, cl.deadline, count(ci.id) ";
                $sql .= "FROM controller_check_list cl, controller_control c, 
controller_check_item ci ";
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
+               if($control_id > 0)
+               {
+                       $sql .= "AND c.id = {$control_id} ";
+               }
                $sql .= "AND c.repeat_type < 2 ";
                $sql .= "AND cl.control_id = c.id ";
                $sql .= "AND cl.id = ci.check_list_id ";
@@ -314,7 +318,7 @@
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "GROUP BY c.id, title, start_date, end_date, cl.id, 
cl.deadline, c.repeat_type, c.repeat_interval ";
                $sql .= "ORDER BY c.id";
-
+//var_dump($sql);
                $this->db->query($sql);
                
                $control_id = 0;
@@ -381,17 +385,26 @@
                return $control_array;
        }
        
-       function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type ){
+       function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type = null, $control_id = 0 ){
+               $use_location_inparam = false;
                $sql =  "SELECT c.id as c_id, title, description, start_date, 
end_date, control_area_id, c.location_code as c_location_code, repeat_type, 
repeat_interval, ";
                $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases "; 
                $sql .= "FROM controller_control c ";
                $sql .= "LEFT JOIN controller_check_list cl on cl.control_id = 
c.id ";
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
-               $sql .= "AND c.repeat_type = $repeat_type ";
+               if($control_id > 0)
+               {
+                       $sql .= "AND c.id={$control_id} ";
+                       $use_location_inparam = true;
+               }
+               if($repeat_type != null)
+               {
+                       $sql .= "AND c.repeat_type = $repeat_type ";
+               }
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";
-
+//var_dump($sql);
                $this->db->query($sql);
                
                $control_id = 0;
@@ -412,7 +425,14 @@
                                
$control->set_start_date($this->unmarshal($this->db->f('start_date', true), 
'int'));
                                
$control->set_end_date($this->unmarshal($this->db->f('end_date', true), 'int'));
                                
$control->set_control_area_id($this->unmarshal($this->db->f('control_area_id', 
true), 'int'));
-                               
$control->set_location_code($this->unmarshal($this->db->f('c_location_code', 
true), 'string'));
+                               if($use_location_inparam)
+                               {
+                                       
$control->set_location_code($location_code);
+                               }
+                               else
+                               {
+                                       
$control->set_location_code($this->unmarshal($this->db->f('c_location_code', 
true), 'string'));
+                               }
                                
$control->set_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
                                                                
@@ -666,7 +686,7 @@
                $values = array(
                        'control_id = ' . 
$this->marshal($check_list->get_control_id(), 'int'),
                        'status = ' . $check_list->get_status(),
-                       'comment = ' . $check_list->get_comment(),
+                       'comment = ' . 
$this->marshal($check_list->get_comment(), 'string'),
                        'deadline = ' . 
$this->marshal($check_list->get_deadline(), 'int'),
                        'planned_date = ' . 
$this->marshal($check_list->get_planned_date(), 'int'),
                        'completed_date = ' . 
$this->marshal($check_list->get_completed_date(), 'int'),

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    
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2012-02-09 09:22:33 UTC (rev 8813)
@@ -68,7 +68,7 @@
                                
$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'),
+                               
$this->marshal($control_group->get_building_part_id(), 'string'),
                        );
 
                        $result = $this->db->query('INSERT INTO 
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
@@ -100,7 +100,7 @@
                                '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'),
-                               'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'int')
+                               'building_part_id = ' . 
$this->marshal($control_group->get_building_part_id(), 'string')
                        );
 
                        //var_dump('UPDATE activity_activity SET ' . join(',', 
$values) . " WHERE id=$id");
@@ -119,7 +119,7 @@
                {
                        $id = (int)$id;
 
-                       $joins = "      {$this->left_join} fm_building_part ON 
(p.building_part_id = CAST(fm_building_part.id AS INT))";
+                       $joins = "      {$this->left_join} fm_building_part ON 
(p.building_part_id = fm_building_part.id)";
                        $joins .= "     {$this->left_join} controller_procedure 
ON (p.procedure_id = controller_procedure.id)";
                        //$joins .= "   {$this->left_join} 
controller_control_area ON (p.control_area_id = controller_control_area.id)";
 
@@ -135,7 +135,7 @@
                        $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                        
$control_group->set_control_area_name($category[0]['name']);
                        
//$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_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                        
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
 
                        return $control_group;
@@ -304,7 +304,7 @@
                        $condition =  join(' AND ', $clauses);
 
                        $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} fm_building_part ON 
(building_part_id = fm_building_part.id)";
                        $joins .= "     {$this->left_join} controller_procedure 
ON (controller_control_group.procedure_id = controller_procedure.id)";
 //                     $joins .= "     {$this->left_join} 
controller_control_area ON (controller_control_group.control_area_id = 
controller_control_area.id)";
                        //$joins .= "   {$this->left_join} 
rental_contract_composite ON (rental_contract_composite.composite_id = 
rental_composite.id)";
@@ -340,7 +340,7 @@
                                $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                                
$control_group->set_control_area_name($category[0]['name']);
                                
//$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_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                                
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
                        }
                        //var_dump($control_group);
@@ -364,7 +364,7 @@
                                $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                                
$control_group->set_control_area_name($category[0]['name']);
                                
//$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_id($this->unmarshal($this->db->f('building_part_id'),
 'string'));
                                
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
 'string'));
 
                                $control_groups_array[] = 
$control_group->toArray();

Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-02-09 09:22:33 UTC (rev 8813)
@@ -52,7 +52,8 @@
                (
                        'index' =>      true,
                        'view_calendar_for_month'                       =>      
true,
-                       'view_calendar_for_year'                        =>      
true
+                       'view_calendar_for_year'                        =>      
true,
+                       'view_calendar_for_locations'           =>  true
                );
 
                public function __construct()
@@ -232,5 +233,73 @@
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                }
                
+               public function view_calendar_for_locations()
+               {
+                       $control_id = phpgw::get_var('control_id');
+                       $control = $this->so_control->get_single($control_id);
+                       
+                       if(is_numeric($control_id) & $control_id > 0)
+                       {
+                               $locations_for_control_array = 
$this->so_control->get_locations_for_control($control_id);
+                       }
+                       
+                       $year = date("Y");
+                       
+                       $year = intval($year);
+                                               
+                       $from_date_ts = strtotime("01/01/$year");
+                       $to_year = $year + 1;
+                       $to_date_ts = strtotime("01/01/$to_year");      
+
+                       $this->calendar_builder = new 
calendar_builder($from_date_ts, $to_date_ts);
+               
+                       $controls_calendar_array = array();
+                       foreach($locations_for_control_array as $location)
+                       {
+                               
$control->set_location_code($location["location_code"]);
+                               $controls_calendar_array = 
$this->calendar_builder->build_agg_calendar_array($controls_calendar_array, 
$control, $location["location_code"], $year);
+                               //_debug_array($controls_calendar_array);
+                               $control_check_list_array = 
$this->so->get_check_lists_for_location( $location["location_code"], 
$from_date_ts, $to_date_ts, $control->get_repeat_type(), $control->get_id() );
+                               //_debug_array($controls_check_list_array);
+                       }
+                       
+                       $controls_calendar_array = 
$this->calendar_builder->build_calendar_array( $controls_calendar_array, 
$control_check_list_array, 12, "view_months" );
+                       //_debug_array($controls_calendar_array);
+                       
+                       foreach($controls_calendar_array as &$inst)
+                       {       
+                               $curr_control = &$inst['control'];
+                               //var_dump($control['location_code']);
+                               foreach($locations_for_control_array as $loc1)
+                               {
+                                       if($curr_control["location_code"] == 
$loc1["location_code"])
+                                               $curr_control["location_name"] 
= $loc1["loc1_name"];
+                               }
+                       }
+                       
+                       //_debug_array($controls_calendar_array);
+                       
+                       $heading_array = array("Jan", "Feb", "Mar", "Apr", 
"Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des");
+                       
+                       $data = array
+                       (
+                               'my_locations'                    => 
$locations_for_control_array,
+                               'view_location_code'      => null,
+                               'location_array'                  => 
$locations_for_control_array,
+                               'heading_array'                   => 
$heading_array,
+                               'controls_calendar_array' => 
$controls_calendar_array,
+                               'date_format'                     => 
$date_format,
+                               'period'                                  => 
$year,
+                               'year'                                    => 
$year,
+                               'show_location'                   => 'yes',
+                               'control_name'                    => 
$control->get_title()
+                       );
+                       
+                       
self::render_template_xsl('calendar/view_calendar_year', $data);
+                       
+                       self::add_javascript('controller', 'controller', 
'jquery.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+               }
+               
                public function query(){}
        }
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-02-09 09:22:33 UTC (rev 8813)
@@ -45,11 +45,12 @@
                private $so_control;
                
                var $public_functions = array(
-                                                                       
'register_case'                 => true,
-                                                                       
'create_case_message'   => true,
-                                                                       
'view_case_message'     => true,
-                                                                       
'register_case_message' => true,
-                                                                       
'updateStatusForCases'  => true,
+                                                                       
'register_case'                         => true,
+                                                                       
'create_case_message'           => true,
+                                                                       
'view_case_message'             => true,
+                                                                       
'register_case_message'         => true,
+                                                                       
'register_measurement_case' => true,
+                                                                       
'updateStatusForCases'          => true,
                                                                        
'delete_case'                           => true
                                                                );
 
@@ -90,7 +91,7 @@
                                $new_check_item->set_check_list_id( 
$check_list_id );
                                $new_check_item->set_control_item_id( 
$control_item_id );
                                $new_check_item->set_status( 0 );
-                               $new_check_item->set_comment( "" );
+                               $new_check_item->set_comment( null );
                                
                                $saved_check_item_id = 
$this->so_check_item->store( $new_check_item );
                                $check_item = 
$this->so_check_item->get_single($saved_check_item_id);
@@ -116,11 +117,52 @@
                                $status_checker = new status_checker();
                                $status_checker->update_check_list_status( 
$check_list_id );
                                                
-                               return json_encode( array( "saveStatus" => 
"saved" ) );
+                               return json_encode( array( "status" => "saved" 
) );
                        }
                        else
-                               return json_encode( array( "saveStatus" => 
"not_saved" ) );     
+                               return json_encode( array( "status" => 
"not_saved" ) ); 
+               }
+               
+               function register_measurement_case(){
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $control_item_id = phpgw::get_var('control_item_id');
+                       $case_descr = phpgw::get_var('case_descr');
+                       $measurement = phpgw::get_var('measurement');
+                       $status = (int)phpgw::get_var('status');
+                                                                               
        
+                       $check_list = 
$this->so_check_list->get_single($check_list_id);
+                                               
+                       $control_id = $check_list->get_control_id();
+                       $control = $this->so_control->get_single( $control_id );
                        
+                       /*
+                       
+                       $db_check_item = $this->so_check_item->get_db();
+                       $db_check_item->transaction_begin();
+
+                       $db_check_item->transaction_commit();
+                       $db_check_item->transaction_abort();
+                       
+                       */
+       
+                       $new_check_item = new controller_check_item();
+                       $new_check_item->set_check_list_id( $check_list_id );
+                       $new_check_item->set_control_item_id( $control_item_id 
);
+                       $new_check_item->set_status( $status );
+                       $new_check_item->set_comment($case_descr);
+                       $new_check_item->set_measurement($measurement);
+
+                       $saved_check_item_id = 0;
+                       $saved_check_item_id = $this->so_check_item->store( 
$new_check_item );
+
+                       if($saved_check_item_id > 0){
+                               $status_checker = new status_checker();
+                               $status_checker->update_check_list_status( 
$check_list_id );
+                                               
+                               return json_encode( array( "status" => "saved" 
) );
+                       }
+                       else
+                               return json_encode( array( "status" => 
"not_saved" ) ); 
                }
                
                function create_case_message(){

Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-02-09 09:22:33 UTC (rev 8813)
@@ -34,10 +34,10 @@
        phpgw::import_class('controller.socheck_list');
        
        include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'check_item', 'inc/model/');
        include_class('controller', 'date_generator', 'inc/component/');
        include_class('controller', 'status_checker', 'inc/helper/');
        include_class('controller', 'date_helper', 'inc/helper/');
-       include_class('controller', 'check_item', 'inc/model/');
        
        class controller_uicheck_list extends controller_uicommon
        {
@@ -216,7 +216,7 @@
                        $data = array
                        (
                                'location_array'        => $location_array,
-                               'control_array'         => $control->toArray(),
+                               'control'                       => 
$control->toArray(),
                                'deadline'                      => 
$calendar_array[0],
                                'date_format'           => $date_format         
        
                        );
@@ -235,6 +235,7 @@
                        $check_list_id = phpgw::get_var('check_list_id');
                        
                        $check_list = $this->so->get_single($check_list_id);
+                       
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -409,12 +410,19 @@
                        $deadline_date = phpgw::get_var('deadline_date');
                        $completed_date = phpgw::get_var('completed_date');
                        $planned_date = phpgw::get_var('planned_date');
+
+                       if($planned_date != ''){
+                               $planned_date_ts = 
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" );
+                       }else{
+                               $planned_date_ts = 0;
+                       } 
                        
-                       $planned_date_ts = 
date_helper::get_timestamp_from_date( $planned_date, "d/m-Y" ); 
-                       $completed_date_ts = 
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
+                       if($completed_date != ''){
+                               $completed_date_ts = 
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
+                       }else{
+                               $completed_date_ts = 0;
+                       }
                        
-                       echo " comment: " . $comment; 
-                       
                        // Fetches check_list from DB
                        $update_check_list = 
$this->so->get_single($check_list_id);
                        $update_check_list->set_status( $status );
@@ -425,9 +433,9 @@
                        $check_list_id = $this->so->update( $update_check_list 
);
                        
                        if($check_list_id > 0)
-                               return json_encode( array( "saveStatus" => 
"updated" ) );
+                               return json_encode( array( "status" => 
"updated" ) );
                        else
-                               return json_encode( array( "saveStatus" => 
"not_updated" ) );
+                               return json_encode( array( "status" => 
"not_updated" ) );
                }
                
                public function print_check_list(){
@@ -493,29 +501,33 @@
                        
self::render_template_xsl('check_list/view_control_details', $data);
                }
                                                
+               // Function that displays control items 
                function register_case(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        
                        $check_list = $this->so->get_single($check_list_id);
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                                                                
-                       // Fetches all control items for check list
                        $control_items_for_check_list = array();
+                       $remove_control_item_ids_array = array();
                        
+                       // Fetches all control items for a check list
                        $control_items = 
$this->so_control_item_list->get_control_items_by_control($check_list->get_control_id());
+                       
+                       // Fetches all check items for a check list as objects 
                        $check_items = 
$this->so_check_item->get_check_items($check_list_id, null, null, 
"return_object");
                        
-                       $remove_control_item_ids_array = array();
-                       
+                       // Puts closed check items of type measurement into 
array  
                        foreach($check_items as $check_item){
                                if($check_item->get_control_item()->get_type() 
== "control_item_type_2" & $check_item->get_status() == 1){
                                        $remove_control_item_ids_array[] = 
$check_item->get_control_item_id();
                                }
                        }
                        
+                       // Makes control items list stripped for closed check 
items of type measurement                 
                        foreach($control_items as $control_item){
                                if( !in_array($control_item->get_id(), 
$remove_control_item_ids_array) ){
-                                       $control_items_for_check_list[] = 
$control_item->toArray(); 
+                                       $control_items_for_check_list[] = 
$control_item->toArray();
                                }
                        }
                        
@@ -525,14 +537,15 @@
                        (
                                'control'                                       
        => $control->toArray(),
                                'check_list'                                    
=> $check_list->toArray(),
-                               'location_array'        => $location_array,
+                               'location_array'                                
=> $location_array,
                                'control_items_for_check_list'  => 
$control_items_for_check_list,
                        );
                        
-                       
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'check_list/register_case'), $data);
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
+                       
+                       
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'check_list/register_case'), $data);
                }
                
                function view_open_cases(){
@@ -633,9 +646,9 @@
                        $check_item_id = $this->so_check_item->store( 
$check_item_obj );
 
                        if($check_item_id > 0)
-                               return json_encode( array( "saveStatus" => 
"saved" ) );
+                               return json_encode( array( "status" => "saved" 
) );
                        else
-                               return json_encode( array( "saveStatus" => 
"not_saved" ) );
+                               return json_encode( array( "status" => 
"not_saved" ) );
                }
                
                public function save_check_items(){
@@ -682,7 +695,7 @@
                                $status_checker = new status_checker();
                                $status_checker->update_check_list_status( 
$check_item->get_check_list_id() );
                                
-                               return json_encode( array( "saveStatus" => 
"saved" ) );
+                               return json_encode( array( "status" => "saved" 
) );
                        }
                        else
                                return json_encode( array( "status" => 
"not_saved" ) );

Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-02-09 09:22:33 UTC (rev 8813)
@@ -174,11 +174,6 @@
                                                        ),
                                                        array(
                                                                'type' => 
'link',
-                                                               'value' => 
$_SESSION['showall'] ? lang('Show only active') : lang('Show all'),
-                                                               'href' => 
self::link(array('menuaction' => $this->url_prefix.'.toggle_show_inactive'))
-                                                       ),
-                                                       array(
-                                                               'type' => 
'link',
                                                                'value' => 
lang('New control'),
                                                                'href' => 
self::link(array('menuaction' => 'controller.uicontrol.view_control_details')),
                                                                'class' => 
'new_item'
@@ -218,11 +213,55 @@
                                                array(
                                                        'key' => 'link',
                                                        'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 
'show_locations',
+                                                       'label' => '',
+                                                       'sortable' => false,
+                                                       'formatter' => 
'YAHOO.portico.formatGenericLink'
                                                )
                                        )
                                ),
                        );
-//_debug_array($data);
+/*     
+ *                                             ,
+                                               array(
+                                                       'key' => 'actions',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'labels',
+                                                       'hidden' => true
+                                               ),
+                                               array(
+                                                       'key' => 'ajax',
+                                                       'hidden' => true
+                                               )               
+ * 
+ * $parameters3 = array
+                                       (
+                                               'parameter' => array
+                                               (
+                                                       array
+                                                       (
+                                                               'name'          
=> 'search_for',
+                                                               'source'        
=> 'location_code'
+                                                       ),
+                                               )
+                                       );
+                       $data['rowactions']['action'][] = array
+                                               (
+                                                       'my_name'               
        => 'view',
+                                                       'text'                  
=> lang('composites'),
+                                                       'action'                
=> $GLOBALS['phpgw']->link('/index.php',array
+                                                       (
+                                                               'menuaction'    
  => 'rental.uicomposite.index',
+                                                               'search_type'   
  => 'location_id',
+                                                               'populate_form' 
  => 'yes'
+                                                       )),
+                                                       'parameters'    => 
$parameters3
+                                               );*/
+//_debug_array($data); 
 
                        self::render_template_xsl('datatable', $data);
                }
@@ -635,12 +674,22 @@
                        $value['ajax'] = array();
                        $value['actions'] = array();
                        $value['labels'] = array();
-                       $value['parameters'] = array();
+                       //$value['parameters'] = array();
                        
                        $value['ajax'][] = false;
+                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_control_details', 'id' => $value['control_id'])));
+                       $value['labels'][] = lang('View control');
+                       //$value['parameters'][] = "control_id";
+                       
+                       $value['ajax'][] = false;
+                       $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_locations_for_control', 'id' => 
$value['control_id'])));
+                       $value['labels'][] = lang('View locations for control');
+                       //$value['parameters'][] = "control_id";
+                       
+                       $value['ajax'][] = false;
                        $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicheck_list.add_check_list', 'location_code' => 
$value['location_code'])));
                        $value['labels'][] = lang('add_check_list_to_location');
-                       $value['parameters'][] = "control_id";
+                       //$value['parameters'][] = "control_id";
                }
                
                public function register_control_to_location()
@@ -710,6 +759,12 @@
                        
                        foreach($result_objects as $control_obj)
                        {
+/*                             $obj_serialized = $control_obj->serialize();
+                               $obj_serialized['show_locations'] = array(
+                                       'href' => 
html_entity_decode(self::link(array('menuaction' => 
'controller.uicontrol.view_locations_for_control', 'id' => 
$result['location_id']))),
+                                       'label' => 
lang('show_controls_for_location')
+                               );
+                               $results['results'][] = $obj_serialized;*/
                                $results['results'][] = 
$control_obj->serialize();      
                        }
                        
@@ -718,9 +773,16 @@
                        $results['sort'] = $params['sort'];
                        $results['dir'] = $params['dir'];
 
+                       //array_walk($results["results"], array($this, 
"add_actions"), array($type));
                        array_walk($results["results"], array($this, 
"_add_links"), "controller.uicontrol.view_control_details");
+                       
+                       foreach($results["results"] as &$res) {
+                               $res['show_locations'] = array(
+                                       'href' => self::link(array('menuaction' 
=> 'controller.uicalendar.view_calendar_for_locations', 'control_id' => 
$res['id'])),
+                                       'label' => 
lang('show_controls_for_location'),
+                               );
+                       }
 
                        return $this->yui_results($results);
                }
-
        }

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php 
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_location.inc.php 
2012-02-09 09:22:33 UTC (rev 8813)
@@ -182,7 +182,7 @@
                
                function register_control_to_location()
                {
-                       if(phpgw::get_var('save_component'))
+                       if(phpgw::get_var('save_location'))
                        {
                                //add component to control using component item 
ID
                                $items_checked = array();
@@ -210,11 +210,12 @@
                                        }
                                }
                                
-                               if($control_location_id > 0)
+/*                             if($control_location_id > 0)
                                        return json_encode( array( "status" => 
"saved" ) );
                                else
                                        return json_encode( array( "status" => 
"not_saved" ) );
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicheck_list_for_component.index'));
+*/
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'controller.uicontrol_location.index'));
 
                        }
                        else

Copied: branches/Version-1_0-branch/controller/inc/class.uitest.inc.php (from 
rev 8812, trunk/controller/inc/class.uitest.inc.php)
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uitest.inc.php             
                (rev 0)
+++ branches/Version-1_0-branch/controller/inc/class.uitest.inc.php     
2012-02-09 09:22:33 UTC (rev 8813)
@@ -0,0 +1,58 @@
+<?php 
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.uicontrol.inc.php 8744 2012-01-31 18:38:02Z vator 
$
+       */      
+       
+       phpgw::import_class('controller.socheck_list');
+       
+       include_class('controller', 'control', 'inc/model/');
+       include_class('controller', 'check_list', 'inc/model/');
+               
+       class controller_uitest
+       {
+               
+               public $public_functions = array
+               (
+                       'index' =>      true
+               );
+               
+               public function index()
+               {
+                       $so_check_list = 
CreateObject('controller.socheck_list');
+                       
+                       $location_code = "1101";
+                       $from_date_ts = "";
+                       $end_date_ts = "";
+                       $repeat_type = "";
+                       
+                       $control_check_list_array = 
$so_check_list->get_check_lists_for_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type);
+                       
+                       print_r( $control_check_list_array );
+               }
+       }
+       
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.calendar_builder.inc.php
 2012-02-09 09:22:33 UTC (rev 8813)
@@ -19,8 +19,6 @@
 
                        $calendar_array = $this->init_calendar( $control, 
$calendar_array, $num, $period_type );
 
-                       echo " Kontroll: " . $control->get_title();
-                       
                        // Inserts check_list object on deadline month in 
twelve_months_array
                        foreach($control->get_check_lists_array() as 
$check_list){
                                
@@ -29,8 +27,6 @@
                
                                $todays_date_ts = mktime(0,0,0,date("m"), 
date("d"), date("Y"));
 
-                               echo " Dato: "  . $check_list->get_id() . "  
deadline: " .      date("d/m-Y", $check_list->get_deadline());
-               
                                if( $check_list->get_status() == 0 & 
$check_list->get_planned_date() > 0 & $check_list->get_deadline() > 
$todays_date_ts)
                                {
                                        $status = "control_planned";

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
   2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
   2012-02-09 09:22:33 UTC (rev 8813)
@@ -64,55 +64,58 @@
                                $interval_date = mktime(0,0,0, date("m", 
$interval_date), date("d", $interval_date), date("Y", 
$interval_date)+$this->repeat_interval);
                        }
                }
-       
        }
        
        public function find_control_start_date(){
        
                if( $this->repeat_type == 0 ){
-                       $search_date = $this->start_date;
+                       $control_start_date = $this->start_date;
                }
                else if( $this->repeat_type == 1 ){
-                       $search_date = $this->start_date;
+                       $control_start_date = $this->start_date;
        
-                       while(date("l", $search_date) != "Sunday")
+                       while(date("l", $control_start_date) != "Sunday")
                        {
-                               $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, date("m", $search_date), date("y", 
$search_date));
+                               $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, date("m", $control_start_date), date("y", 
$control_start_date));
                                
-                               if($num_days_in_month <= date("d", 
$search_date) )
+                               if($num_days_in_month <= date("d", 
$control_start_date) )
                                {
-                                       $search_date = mktime(0,0,0, date("m", 
$search_date)+1, 1, date("Y", $search_date));
+                                       $control_start_date = mktime(0,0,0, 
date("m", $control_start_date)+1, 1, date("Y", $control_start_date));
                                }       
                                else
                                {
-                                       $search_date = mktime(0,0,0, date("m", 
$search_date), date("d", $search_date)+1, date("Y", $search_date));
+                                       $control_start_date = mktime(0,0,0, 
date("m", $control_start_date), date("d", $control_start_date)+1, date("Y", 
$control_start_date));
                                }
                        }
                }
                else if( $this->repeat_type == 2 ){
                        $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
date("m", $this->start_date), date("y", $this->start_date));
-                       $search_date = mktime(0,0,0, date("m", 
$this->start_date), $num_days_in_month, date("y", $this->start_date));
+                       $control_start_date = mktime(0,0,0, date("m", 
$this->start_date), $num_days_in_month, date("y", $this->start_date));
                }
                else if( $this->repeat_type == 3 ){
                        $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
12, date("y", $this->start_date));
-                       $search_date = mktime(0,0,0, 12, $num_days_in_month, 
date("y", $this->start_date));
+                       $control_start_date = mktime(0,0,0, 12, 
$num_days_in_month, date("y", $this->start_date));
                }
                
-               return $search_date;
+               return $control_start_date;
        }
        
-       public function find_start_date_for_period( $trail_date ){
-               
-               while( $trail_date < $this->period_start_date ){
+       public function find_start_date_for_period( $trail_period_start_date ){
+                               
+               while( $trail_period_start_date < $this->period_start_date ){
 
-                       if($this->repeat_type == 1 || $this->repeat_type == 0)
+                       if($this->repeat_type == 0)
                        {
-                               $trail_date = mktime(0,0,0, date("m", 
$trail_date), date("d", $trail_date)+$this->repeat_interval, date("Y", 
$trail_date));
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date) + 
$this->repeat_interval, date("Y", $trail_period_start_date));
                        }
+                       else if($this->repeat_type == 1)
+                       {
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date) + 
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
+                       }
                        else if($this->repeat_type == 2)
                        {
-                               $month = date("m", $trail_date) + 
$this->repeat_interval;
-                               $year = date("Y", $trail_date);
+                               $month = date("m", $trail_period_start_date) + 
$this->repeat_interval;
+                               $year = date("Y", $trail_period_start_date);
                                
                                if($month > 12){
                                        $month = $month % 12;
@@ -120,15 +123,15 @@
                                }
 
                                $num_days_in_month = 
cal_days_in_month(CAL_GREGORIAN, $month, $year);
-                               $trail_date = mktime(0,0,0, $month, 
$num_days_in_month, $year);
+                               $trail_period_start_date = mktime(0,0,0, 
$month, $num_days_in_month, $year);
                        }
                        else if($this->repeat_type == 3)
                        {
-                               $trail_date = mktime(0,0,0, date("m", 
$trail_date), date("d", $trail_date), date("Y", 
$trail_date)+$this->repeat_interval);     
+                               $trail_period_start_date = mktime(0,0,0, 
date("m", $trail_period_start_date), date("d", $trail_period_start_date), 
date("Y", $trail_period_start_date)+$this->repeat_interval); 
                        }
                }
                
-               return $trail_date;
+               return $trail_period_start_date;
        }
        
                

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-02-09 09:22:33 UTC (rev 8813)
@@ -10,9 +10,19 @@
                 var month = $(thisForm).find("input[name='month']").val();
                 
                 if(period_type == 'view_month')
-                var requestUrl = 
"index.php?menuaction=controller.uicalendar.view_calendar_for_month&location_code="
 + location_code + "&year=" + year + "&month=" + month;
+                {
+                        var oArgs = 
{menuaction:'controller.uicalendar.view_calendar_for_month'};
+                        var baseUrl = phpGWLink('index.php', oArgs, true);
+                        var requestUrl = baseUrl + "&location_code=" + 
location_code + "&year=" + year + "&month=" + month;
+                //var requestUrl = 
"index.php?menuaction=controller.uicalendar.view_calendar_for_month&location_code="
 + location_code + "&year=" + year + "&month=" + month;
+                }
                 else
-                        var requestUrl = 
"index.php?menuaction=controller.uicalendar.view_calendar_for_year&location_code="
 + location_code + "&year=" + year;
+                {
+                        var oArgs = 
{menuaction:'controller.uicalendar.view_calendar_for_year'};
+                        var baseUrl = phpGWLink('index.php', oArgs, true);
+                        var requestUrl = baseUrl +  "&location_code=" + 
location_code + "&year=" + year;
+                        //var requestUrl = 
"index.php?menuaction=controller.uicalendar.view_calendar_for_year&location_code="
 + location_code + "&year=" + year;
+                }
                
                 window.location.href = requestUrl;
     });
@@ -21,8 +31,9 @@
        // When control area is selected, controls are fetched from db and 
control select list is populated
        $("#control_area_list option").click(function () {
                 var control_area_id = $(this).val();
-                
-         var requestUrl = 
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
+                var oArgs = 
{menuaction:'controller.uicontrol.get_controls_by_control_area', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+         //var requestUrl = 
"index.php?menuaction=controller.uicontrol.get_controls_by_control_area&phpgw_return_as=json"
          
          var htmlString = "";
          
@@ -52,8 +63,10 @@
        // When control area is selected, controls are fetched from db and 
control select list is populated
        $("#control_group_area_list option").click(function () {
                 var control_area_id = $(this).val();
-                
-         var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+            var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+         //var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
          
          var htmlString = "";
          
@@ -85,7 +98,9 @@
        $("#ifc option").click(function () {
                 var ifc_id = $(this).val();
                 
-         var requestUrl = 
"index.php?menuaction=controller.uicheck_list_for_component.get_component_types_by_category&phpgw_return_as=json"
+                var oArgs = 
{menuaction:'controller.uicheck_list_for_component.get_component_types_by_category',
 phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+         //var requestUrl = 
"index.php?menuaction=controller.uicheck_list_for_component.get_component_types_by_category&phpgw_return_as=json"
          
          var htmlString = "";
          
@@ -115,7 +130,10 @@
        // When control area is selected, procedures are fetched from db and 
procedure select list is populated
        $("#control_area_id option").click(function () {
                 var control_area_id = $(this).val();
-         var requestUrl = 
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
+                
+                var oArgs = 
{menuaction:'controller.uiprocedure.get_procedures'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+         //var requestUrl = 
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
          
          var htmlString = "";
          
@@ -262,8 +280,12 @@
                
                var add_param = $(thisA).find("span").text();
                
-               var requestUrl = 
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list";
 + add_param;
+               var oArgs = 
{menuaction:'controller.uicheck_list.get_cases_for_check_list'};
+               var baseUrl = phpGWLink('index.php', oArgs, true);
+               var requestUrl = baseUrl + add_param
                
+               //var requestUrl = 
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list";
 + add_param;
+               
                $.ajax({
                          type: 'POST',
                          url: requestUrl,
@@ -307,7 +329,7 @@
                $(infoBox).hide();
        });
        
-       $("#frm_save_check_item").live("submit", function(e){
+       $(".frm_save_check_item").live("submit", function(e){
                e.preventDefault();
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");
@@ -320,7 +342,7 @@
                                  if(data){
                                  var obj = jQuery.parseJSON(data);
                                
-                                 if(obj.saveStatus == "saved"){
+                                 if(obj.status == "saved"){
                                          var submitBnt = 
$(thisForm).find("input[type='submit']");
                                          $(submitBnt).val("Lagret");   
                                                  
@@ -349,7 +371,7 @@
                                  if(data){
                                  var obj = jQuery.parseJSON(data);
                                  
-                                 if(obj.saveStatus == "saved"){
+                                 if(obj.status == "saved"){
                                          $(liWrp).fadeOut('3000', function() {
                                                  $(liWrp).addClass("hidden");
                                          });
@@ -373,7 +395,7 @@
                                  if(data){
                                  var obj = jQuery.parseJSON(data);
                                
-                                 if(obj.saveStatus == "updated"){
+                                 if(obj.status == "updated"){
                                          var submitBnt = 
$(thisForm).find("input[type='submit']");
                                          $(submitBnt).val("Lagret");   
                                                  
@@ -388,7 +410,7 @@
                });
        });
        
-       $("#frm_register_case").live("submit", function(e){
+       $(".frm_register_case").live("submit", function(e){
                e.preventDefault();
 
                var thisForm = $(this);
@@ -402,7 +424,7 @@
                                  if(data){
                                  var obj = jQuery.parseJSON(data);
                                
-                                 if(obj.saveStatus == "saved"){
+                                 if(obj.status == "saved"){
                                          var submitBnt = 
$(thisForm).find("input[type='submit']");
                                          $(submitBnt).val("Lagret");   
                                          
@@ -434,6 +456,35 @@
                });
        });
        
+       $(".frm_register_measurement_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var thisRow = $(this).parents("li");
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl + "&" + $(thisForm).serialize(),
+                         success: function(data) {
+                                 if(data){
+                                 var obj = jQuery.parseJSON(data);
+                               
+                                 if(obj.status == "saved"){
+                                         var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                         $(submitBnt).val("Lagret");
+                                         
+                                         // Changes text on save button back 
to original
+                                         window.setTimeout(function() {
+                                                       $(thisRow).remove();
+                                         }, 1000);
+                                         }
+                                 }
+                               }
+               });
+       });
+       
        // Delete a case item from list
        $(".delete_case").live("click", function(){
                var clickElem = $(this);
@@ -487,17 +538,23 @@
                $(submitBnt).removeClass("not_active");
        });
        
-       $("#frm_save_check_item").live("click", function(e){
+       $(".frm_save_check_item").live("click", function(e){
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");
                $(submitBnt).removeClass("not_active");
        });
        
-       $("#frm_register_case").live("click", function(e){
+       $(".frm_register_case").live("click", function(e){
                var thisForm = $(this);
                var submitBnt = $(thisForm).find("input[type='submit']");
                $(submitBnt).removeClass("not_active");
        });
+       
+       $(".frm_register_measurement_case").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
 });
 
 

Modified: branches/Version-1_0-branch/controller/js/yahoo/common.js
===================================================================
--- branches/Version-1_0-branch/controller/js/yahoo/common.js   2012-02-08 
09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/js/yahoo/common.js   2012-02-09 
09:22:33 UTC (rev 8813)
@@ -118,10 +118,21 @@
        elCell.innerHTML = '<a href="' + link + '">' + name + '</a>'; 
 };
 
+YAHOO.portico.formatGenericLink = function(elCell, oRecord, oColumn, oData)
+{
+       var data = oRecord.getData(oColumn.key);
+       //console.log(data['href']);
+       var link = data['href'];
+       var name = data['label'];
+       
+       elCell.innerHTML = '<a href="' + link + '">' + name + '</a>';
+};
+
+/*
 YAHOO.portico.formatGenericLink = function() {
        var links = [];
        var nOfLinks = arguments.length;
-       
+
        for (var i=0; i < nOfLinks; i++) { links[i] = arguments[i]; }
        
        return function(elCell, oRecord, oColumn, oData)
@@ -150,7 +161,7 @@
                elCell.innerHTML = linksHtml;
        };
 };
-
+*/
 YAHOO.portico.autocompleteHelper = function(url, field, hidden, container, 
label_attr) {
        label_attr = label_attr || 'name';
        var myDataSource = new YAHOO.util.DataSource(url);

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-02-08 
09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-02-09 
09:22:33 UTC (rev 8813)
@@ -4,7 +4,7 @@
 controller     common  no      Kontroll
 control_helptext       controller      no      Her kommer hjelpetekst for å 
opprette en kontroll
 Check_list     controller      no      Sjekkliste
-Calendar_overview      controller      no      Kalenderoversikt
+Calendar_overview      controller      no      Kontrollplan
 Check_lists    controller      no      Sjekklister
 Choose_control_groups  controller      no      Velg kontrollgrupper
 Choose_control_items   controller      no      Velg kontrollpunkt
@@ -57,7 +57,6 @@
 location_code  controller      no      Enhetsnummer
 included_units controller      no      Kontrollens enheter
 floor  controller      no      Etasje
-register_error controller      no      Registrer avvik
 section        controller      no      Seksjon
 room   controller      no      Rom
 save   controller      no      Lagre
@@ -314,4 +313,8 @@
 select value   controller      no      Velg
 component_for_control_group    controller      no      Utstyr tilknyttet 
kontrollgrupper
 View_component_for_control_group       controller      no      Vis knytning 
mot utstyr
-Add_component_for_control_group        controller      no      Legg til 
knytning mot utstyr
\ No newline at end of file
+Add_component_for_control_group        controller      no      Legg til 
knytning mot utstyr
+show_controls_for_location     controller      no      Vis lokasjoner
+Property name  controller      no      Lokasjonsnavn
+Address        controller      no      Adresse
+Zip code       controller      no      Postnummer
\ 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  2012-02-08 
09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-02-09 
09:22:33 UTC (rev 8813)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.26';
+       $setup_info['controller']['version'] = '0.1.27';
        $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 
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-02-09 09:22:33 UTC (rev 8813)
@@ -111,7 +111,7 @@
                                '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),
-                               'building_part_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'building_part_id' => array('type' => 
'varchar', 'precision' => 30, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-02-09 09:22:33 UTC (rev 8813)
@@ -554,3 +554,24 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.26';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+       
+       $test[] = '0.1.26';
+       function controller_upgrade0_1_26()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               //Drop and reinsert because og the datatype int can't be 
altered to varchar
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group', array(), 
'building_part_id');
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','building_part_id',array(
+                       'type' => 'varchar',
+                       'precision' => 30,
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.27';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }               
+       }

Modified: 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-02-09 09:22:33 UTC (rev 8813)
@@ -7,37 +7,49 @@
 <div id="main_content">
                
                <div style="float:left;">
-                       <h1><xsl:value-of 
select="location_array/loc1_name"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="show_location">
+                                       <h1><xsl:value-of 
select="control_name"/></h1>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <h1><xsl:value-of 
select="location_array/loc1_name"/></h1>
+                               </xsl:otherwise>
+                       </xsl:choose>
                        <h3 style="margin:0;font-size:19px;">Kalenderoversikt 
for <xsl:value-of select="period"/></h3>
                </div>
 
                <div style="float:right;width:300px;margin-top:40px;">
-                       <form action="#">
-                               <input type="hidden" name="period_type" 
value="view_year" />
-                               <input type="hidden" name="year">
-                             <xsl:attribute name="value">
-                               <xsl:value-of select="year"/>
-                             </xsl:attribute>
-                               </input>
-
-                               <select id="choose_my_location">
-                                       <xsl:for-each select="my_locations">
-                                               <xsl:variable 
name="loc_code"><xsl:value-of select="location_code"/></xsl:variable>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="location_code = $view_location_code">
-                                                               <option 
value="{$loc_code}" selected="selected">
-                                                                       
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-                                                               </option>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                               <option 
value="{$loc_code}">
-                                                                       
<xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
-                                                               </option>
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </xsl:for-each>
-                               </select>                                       
-                       </form>
+                       <xsl:choose>
+                               <xsl:when test="show_location">&nbsp;</xsl:when>
+                               <xsl:otherwise>
+                                       <form action="#">
+                                               <input type="hidden" 
name="period_type" value="view_year" />
+                                               <input type="hidden" 
name="year">
+                                             <xsl:attribute name="value">
+                                               <xsl:value-of select="year"/>
+                                             </xsl:attribute>
+                                               </input>
+               
+                                               <select id="choose_my_location">
+                                                       <xsl:for-each 
select="my_locations">
+                                                               <xsl:variable 
name="loc_code"><xsl:value-of select="location_code"/></xsl:variable>
+                                                               <xsl:choose>
+                                                                       
<xsl:when test="location_code = $view_location_code">
+                                                                               
<option value="{$loc_code}" selected="selected">
+                                                                               
        <xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
+                                                                               
</option>
+                                                                       
</xsl:when>
+                                                                       
<xsl:otherwise>
+                                                                               
<option value="{$loc_code}">
+                                                                               
        <xsl:value-of disable-output-escaping="yes" select="loc1_name"/>
+                                                                               
</option>
+                                                                       
</xsl:otherwise>
+                                                               </xsl:choose>
+                                                       </xsl:for-each>
+                                               </select>                       
                
+                                       </form>
+                               </xsl:otherwise>
+                       </xsl:choose>
                                        
                        <ul id="icon_color_map">
                                <li><img height="15" 
src="controller/images/status_icon_yellow_ring.png" /><span>Kontroller satt 
opp</span></li>
@@ -49,12 +61,14 @@
                
                <ul class="calendar">
                                <li class="heading">
-                                       <div class="id">ID</div>
+                                       <xsl:if test="show_location">
+                                       <div class="location">Lokasjon</div>
+                                       </xsl:if>
                                        <div class="title">Tittel</div>
+                                       <div class="assigned">Tildelt</div>
                                        <div class="date">Start dato</div>
                                        <div class="date">Slutt dato</div>
-                                       <div 
class="frequency">Frekvenstype</div>
-                                       <div 
class="frequency">Frekvensintervall</div>
+                                       <div class="frequency">Frekvens</div>
                                        <div class="months">
                                        <xsl:for-each select="heading_array">
                                                <div>
@@ -81,12 +95,17 @@
                                <xsl:for-each select="controls_calendar_array">
                                        <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
                                        <li>
-                                       <div class="id">
-                                               <xsl:value-of 
select="control/id"/>
-                                               </div>
+                                               <xsl:if test="//show_location">
+                                                       <div class="location">
+                                                               <xsl:value-of 
select="control/location_name"/>
+                                                       </div>
+                                               </xsl:if>
                                                <div class="title">
                                                <xsl:value-of 
select="control/title"/>
                                                </div>
+                                               <div class="assigned">
+                                               <xsl:value-of 
select="control/responsibility_name"/>
+                                               </div>
                                                <div class="date">
                                                <xsl:value-of 
select="php:function('date', $date_format, number(control/start_date))"/>
                                                </div>
@@ -102,9 +121,6 @@
                                                </div>
                                                <div class="frequency">
                                                <xsl:value-of 
select="control/repeat_type"/>
-                                               </div>
-                                               <div class="frequency">
-                                               <xsl:value-of 
select="control/repeat_interval"/>
                                                </div>                          
                        
                                                <div class="months">
                                                <xsl:for-each 
select="calendar_array">
@@ -134,7 +150,7 @@
                                                                                
<div>
                                                                                
<a>
                                                                                
        <xsl:attribute name="href">
-                                                                               
                
<xsl:text>index.php?menuaction=controller.uicheck_list.edit_check_list_for</xsl:text>
+                                                                               
                
<xsl:text>index.php?menuaction=controller.uicheck_list.edit_check_list</xsl:text>
                                                                                
                <xsl:text>&amp;check_list_id=</xsl:text>
                                                                                
                <xsl:value-of select="info/check_list_id"/>
                                                                                
        </xsl:attribute>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-02-09 09:22:33 UTC (rev 8813)
@@ -75,7 +75,7 @@
                                                <input type="file" id="file" 
name="file" />
                                        </div>
                        
-                                       <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i avviksmelding</h3>                             
    
+                                       <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i melding</h3>                                   
    
                                        <ul class="check_items">
                                                <xsl:for-each 
select="check_items_and_cases">
                                                        <xsl:choose>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-02-09 09:22:33 UTC (rev 8813)
@@ -4,7 +4,7 @@
 
 <div id="main_content">
        
-               <h1>Avviksmelding registrert</h1>
+               <h1>Melding registrert</h1>
                
                <xsl:call-template name="check_list_tab_menu" />
                
@@ -35,7 +35,7 @@
                        </div>
        
        
-                       <h3 class="check_item_details">Avviksmeldingen omfattet 
følgende saker</h3>                                     
+                       <h3 class="check_item_details">Meldingen omfattet 
følgende saker</h3>                                   
                        <ul class="check_items">
                                <xsl:for-each select="check_items_and_cases">
                                        <xsl:choose>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-02-09 09:22:33 UTC (rev 8813)
@@ -23,10 +23,19 @@
        
        <h1>Registrere sjekkliste for <xsl:value-of 
select="location_array/loc1_name"/></h1>
 
-       <xsl:call-template name="check_list_tab_menu">
-               <xsl:with-param name="active_tab">view_details</xsl:with-param>
-       </xsl:call-template>
+       <div id="edit_check_list_menu" class="hor_menu">
+               <a href="#" class="active">
+                       Vis detaljer for sjekkliste
+               </a>
+               <a href="#">
+                       Vis saker
+               </a>                    
+               <a href="#">
+                       Vis info om kontroll
+               </a>
+       </div>
        
+       
        <h3 class="box_header">Sjekklistedetaljer</h3>
        <fieldset class="check_list_details">
                <form id="frm_add_check_list" 
action="index.php?menuaction=controller.uicheck_list.save_check_list" 
method="post">
@@ -40,7 +49,7 @@
                        </div>
                
                        <xsl:variable name="location_code"><xsl:value-of 
select="location_array/location_code"/></xsl:variable>
-                       <xsl:variable name="control_id"><xsl:value-of 
select="control_array/id"/></xsl:variable>
+                       <xsl:variable name="control_id"><xsl:value-of 
select="control/id"/></xsl:variable>
                
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
                        <input type="hidden" name="location_code" 
value="{$location_code}" />

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/check_list_tab_menu.xsl
    2012-02-09 09:22:33 UTC (rev 8813)
@@ -3,7 +3,6 @@
 <xsl:param name="active_tab" />
 
 <div id="edit_check_list_menu" class="hor_menu">
-               
                <a>
                        <xsl:if test="$active_tab = 'view_details'">
                                <xsl:attribute 
name="class">active</xsl:attribute>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
        2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
        2012-02-09 09:22:33 UTC (rev 8813)
@@ -63,7 +63,7 @@
                                </select>
                        </div>
                        <div>
-                               <label>Antall åpne avvik</label>
+                               <label>Antall åpne saker</label>
                             <xsl:value-of select="check_list/num_open_cases"/>
                    </div>
                        <div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-02-09 09:22:33 UTC (rev 8813)
@@ -25,7 +25,7 @@
                                                <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="title"/></span></h4>   
                                                        <xsl:choose>
                                                                <xsl:when 
test="type = 'control_item_type_1'">
-                                                                       <form 
id="frm_register_case" 
action="index.php?menuaction=controller.uicase.register_case&amp;phpgw_return_as=json"
 method="post">
+                                                                       <form 
class="frm_register_case" 
action="index.php?menuaction=controller.uicase.register_case&amp;phpgw_return_as=json"
 method="post">
                                                                                
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
<input type="hidden" name="control_item_id" value="{$control_item_id}" /> 
                                                                                
<input name="check_list_id" type="hidden"><xsl:attribute 
name="value"><xsl:value-of select="//check_list/id"/></xsl:attribute></input>
@@ -46,14 +46,22 @@
                                                                        </form>
                                                                </xsl:when>
                                                                <xsl:when 
test="type = 'control_item_type_2'">
-                                                               <form 
id="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item&amp;phpgw_return_as=json"
 method="post">
+                                                               <form 
class="frm_register_measurement_case" 
action="index.php?menuaction=controller.uicase.register_measurement_case&amp;phpgw_return_as=json"
 method="post">
                                                                        
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                       <input 
type="hidden" name="control_item_id" value="{$control_item_id}" /> 
-                                                                       <input 
name="status" type="hidden" value="1" />
-                                                                       <input 
name="type" type="hidden" value="control_item_type_2" />
-                                                                       <input 
name="check_list_id" type="hidden"><xsl:attribute name="value"><xsl:value-of 
select="//check_list/id"/></xsl:attribute></input>
+                                                                               
<input type="hidden" name="control_item_id" value="{$control_item_id}" /> 
+                                                                               
<input name="check_list_id" type="hidden"><xsl:attribute 
name="value"><xsl:value-of select="//check_list/id"/></xsl:attribute></input>
+                                                                           
<input name="status" type="hidden" value="0" />
+                                                                               
<input name="type" type="hidden" value="control_item_type_2" />
                                                                
                                                                        <div 
class="check_item">
+                                                                               
<div>
+                                                                               
        <label>Status</label>
+                                                                               
        <select name="status">
+                                                                               
                <option value="0" SELECTED="SELECTED">Ikke utført</option>
+                                                                               
                <option value="1" >Utført</option>
+                                                                               
                <option value="2" >Venter på tilbakemelding</option>
+                                                                               
        </select>
+                                                                          
</div>
                                                                       <div>
                                                                         <label 
class="comment">Registrer målingsverdi</label>
                                                                           
<input>
@@ -83,7 +91,7 @@
                                </ul>                   
                                </xsl:when>
                                <xsl:otherwise>
-                                       Alle sjekkpunkter for kontroll er 
registert som åpent/håndtert avvik eller måling 
+                                       Alle sjekkpunkter for kontroll er 
registert som åpne/håndterte saker 
                                </xsl:otherwise>
                </xsl:choose>
        </div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
      2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
      2012-02-09 09:22:33 UTC (rev 8813)
@@ -18,7 +18,7 @@
                                        <xsl:for-each 
select="measurement_check_items">
                                                        <li>
                                                                <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="control_item/title"/></span></h4>                                       
       
-                                                               <form 
id="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
+                                                               <form 
class="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
                                                                        
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                        <input 
type="hidden" name="check_item_id" value="{$check_item_id}" />
                                                                        <input 
type="hidden" name="type" value="control_item_type_2" />

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-02-09 09:22:33 UTC (rev 8813)
@@ -87,7 +87,7 @@
                        
                        </xsl:when>
                        <xsl:otherwise>
-                               Ingen registrerte åpne avvik
+                               Ingen åpne saker
                        </xsl:otherwise>
                </xsl:choose>
        </div>

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-02-08 09:51:35 UTC (rev 8812)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-02-09 09:22:33 UTC (rev 8813)
@@ -851,6 +851,17 @@
 ul.calendar div.title, ul.calendar.info div.title {
        width: 200px;
 }
+ul.calendar div.title {
+       width: 150px;
+}
+ul.calendar div.location {
+       width: 150px;
+       text-align: left;
+}
+ul.calendar div.assigned {
+       width: 80px;
+       text-align: left;
+}
 ul.calendar div.id, ul.calendar.info div.id {
        width: 50px;
 }
@@ -861,7 +872,7 @@
        text-align: center;
 }
 ul.calendar div.frequency, ul.calendar.info div.frequency {
-       width: 120px;   
+       width: 100px;   
 }
 ul.calendar.month {
        margin-top:0;

Modified: 
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
  2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/controller/templates/base/view_component_for_control_group.xsl
  2012-02-09 09:22:33 UTC (rev 8813)
@@ -39,7 +39,7 @@
                                 
                                 <form id="loc_form" action="" method="GET">
                        
-                                       <select id="control_group_id" 
name="control_group_id">
+                                       <select id="control_group_id" 
name="control_group_id" style="width: 250px;">
                                        <xsl:choose>
                                                <xsl:when 
test="control_group_array/child::node()">
                                                        <xsl:for-each 
select="control_group_array">

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-02-08 09:51:35 UTC (rev 8812)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-02-09 09:22:33 UTC (rev 8813)
@@ -49,6 +49,8 @@
                var $default_kostra_id = 9999; //dummy
                var $debug = false;
                var $skip_import = false;
+               protected $export;
+               protected $receipt = array();
 
 
                function __construct()
@@ -65,6 +67,9 @@
                        $this->datetimeformat   = $this->db->datetime_format();
                        $this->config                   = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
                        $this->send                             = 
CreateObject('phpgwapi.send');
+
+                       include (PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/Basware_X114");
+                       $this->export           = new export_conv;
                }
 
                function pre_run($data = array())
@@ -119,9 +124,8 @@
 
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
 
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
 
-                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
-
                        $data = array
                        (
                                'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -185,6 +189,7 @@
                                                $movefrom = 
"{$dirname}/{$_file}";
                                                $moveto = 
"{$dirname}/archive/{$_file}";
 
+                                               @unlink($moveto);//in case of 
duplicates
                                                $ok = @rename($movefrom, 
$moveto);
                                                if(!$ok) // Should never happen.
                                                {
@@ -204,7 +209,7 @@
                                $this->confirm($execute=false);
                        }
 
-                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
 
                        $insert_values= array
                        (
@@ -302,6 +307,10 @@
                                                                if(fclose($fp))
                                                                {
                                                                        echo 
"File remote: {$file_remote} was copied to local: $file_local<br/>";
+                                                                       if( 
ssh2_sftp_unlink ($sftp, "{$directory_remote}/archive/{$file_name}" ))
+                                                                       {
+                                                                               
echo "Deleted duplicate File remote: 
{$directory_remote}/archive/{$file_name}<br/>";                                 
                                   
+                                                                       }
                                                                        if( 
ssh2_sftp_rename ($sftp, $file_remote, 
"{$directory_remote}/archive/{$file_name}" ))
                                                                        {
                                                                                
echo "File remote: {$file_remote} was moved to remote: 
{$directory_remote}/archive/{$file_name}<br/>";
@@ -419,35 +428,42 @@
                                        }
 
                                        $duplicate = false;
-                                       $sql = "SELECT external_ref FROM 
fm_ecobilag WHERE external_ref = '{$_data['SCANNINGNO']}'";
+                                       $sql = "SELECT bilagsnr, external_ref 
FROM fm_ecobilag WHERE external_ref = '{$_data['SCANNINGNO']}'";
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                        if($this->db->next_record())
                                        {
                                                $duplicate = true;
+                                               $bilagsnr = 
$this->db->f('bilagsnr');
+                                               $this->receipt['message'][] = 
array('msg' => "Ikke importert duplikat til arbeidsregister: 
{$_data['SCANNINGNO']}");
                                        }
 
-                                       $sql = "SELECT external_ref FROM 
fm_ecobilagoverf WHERE external_ref = '{$_data['SCANNINGNO']}'";
+                                       $sql = "SELECT bilagsnr, bilagsnr_ut 
FROM fm_ecobilagoverf WHERE external_ref = '{$_data['SCANNINGNO']}'";
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                        if($this->db->next_record())
                                        {
                                                $duplicate = true;
+                                               $_bilagsnr_ut = 
$this->db->f('bilagsnr_ut');
+                                               $bilagsnr = 
$this->db->f('bilagsnr');
+                                               
$this->export->RullTilbake(false,false,$_bilagsnr_ut);
+                                               $this->receipt['message'][] = 
array('msg' => "Bilag rullet tilbake fra historikk : {$_bilagsnr_ut}");
+                                               unset($_bilagsnr_ut);
                                        }
-                                       
-                                       
-                                       if($duplicate)
-                                       {
-                                               $this->receipt['error'][] = 
array('msg' => "Ikke importert duplikat : {$_data['SCANNINGNO']}");
-                                               $this->skip_import = true;
-                                       }
-                                       
+
                                        $vendor_id = $_data['SUPPLIER.CODE'];
 
                                        $sql = 'SELECT id FROM fm_vendor WHERE 
id = ' . (int) $vendor_id;
                                        
$this->db->query($sql,__LINE__,__FILE__);
-                                       if(!$this->db->next_record())
+
+                                       
+                                       if(!$_data['SUPPLIER.CODE'])
                                        {
-                                               $this->receipt['error'][] = 
array('msg' => "Ikke gyldig leverandør id: {$_data['SUPPLIER.CODE']}");
+                                               $this->receipt['error'][] = 
array('msg' => "LeverandørId ikke angitt for faktura: {$_data['SCANNINGNO']}");
                                                $this->skip_import = true;
+                                       }
+                                       else if(!$this->db->next_record())
+                                       {
+                                               $this->receipt['error'][] = 
array('msg' => "Ikke gyldig LeverandørId: {$_data['SUPPLIER.CODE']}, Faktura: 
{$_data['SCANNINGNO']}");
+                                               $this->skip_import = true;
 
                                                $to = 
isset($this->config->config_data['import']['email_on_error']) && 
$this->config->config_data['import']['email_on_error'] ? 
$this->config->config_data['import']['email_on_error'] : '';
 
@@ -461,7 +477,7 @@
                                                                $rc = 
$this->send->msg('email', $to, 'Ikke gyldig leverandør ved import av faktura 
til Portico', $body, '', '', '','','','html');
                                                                if($rc)
                                                                {
-                                                                       
$this->receipt['error'][] = array('msg'=> "epost sendt til {$to}");             
                                        
+                                                                       
$this->receipt['message'][] = array('msg'=> "epost sendt til {$to}");           
                                        
                                                                }
                                                        }
                                                        catch 
(phpmailerException $e)
@@ -518,7 +534,7 @@
 
 //_debug_array($buffer);
 //_debug_array($this->receipt);
-
+//_debug_array($order_info['toarray']);
                        if(!$this->skip_import)
                        {
                                if(!$bilagsnr)
@@ -555,7 +571,15 @@
                                        }
                                }
 
-                               return $this->import_end_file($buffer);
+                               if(!$duplicate)
+                               {
+                                       return $this->import_end_file($buffer);
+                               }
+                               else
+                               {
+                                       $duplicate  = false;
+                                       return $bilagsnr;
+                               }
                        }
                        $this->skip_import = false;
                        return false;




reply via email to

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