fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9727] Merge 9701:9726 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9727] Merge 9701:9726 from trunk
Date: Tue, 03 Jul 2012 13:24:07 +0000

Revision: 9727
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9727
Author:   sigurdne
Date:     2012-07-03 13:24:05 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
Merge 9701:9726 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.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.uicheck_list_for_component.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
    
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
    
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/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_cases_for_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location/control_locations.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/js/yahoo/project.edit.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang

Removed Paths:
-------------
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.schedule.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,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700
   + 
/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,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726

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-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-07-03 13:24:05 UTC (rev 9727)
@@ -416,7 +416,7 @@
                    $sql .= "WHERE cl.location_code = 
'{$cl_criteria->get_location_code()}' ";
                }
                
-               $sql .= "AND c.id = $control_id ";
+               $sql .= "AND c.id = {$cl_criteria->get_control_id()} ";
                $sql .= "AND cl.control_id = c.id ";
                $sql .= "AND cl.deadline >= $from_date_ts AND $to_date_ts > 
cl.deadline ";
                $sql .= "GROUP BY c.id";
@@ -433,82 +433,8 @@
                return $control_array;
        }
        
-       
-       // Fetches all controls as objects with check lists
-       /* DET SER UT TIL AT DENNE IKKE BRUKES: TORSTEIN 18.06.2012 
-       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, num_pending_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}' ";
-               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;";
-
-               $this->db->query($sql);
-               
-               $control_id = 0;
-               $control = null;
-               $controls_array = array();
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id', true) != $control_id ){
-                               
-                               if($control_id != 0){
-                                       
$control->set_check_lists_array($check_lists_array);
-                                       $controls_array[] = $control;
-                               }
-                       
-                               $control = new 
controller_control($this->unmarshal($this->db->f('c_id', true), 'int'));
-                               
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
-                               
$control->set_description($this->unmarshal($this->db->f('description', true), 
'boolean'));
-                               
$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_repeat_type($this->unmarshal($this->db->f('repeat_type', true), 
'int'));
-                               
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval', 
true), 'int'));
-                                                               
-                               $check_lists_array = array();
-                       }
-
-                       $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id', true), 'int'));
-                       
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'int'));
-                       
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                       
$check_list->set_deadline($this->unmarshal($this->db->f('deadline', true), 
'int'));
-                       
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date', 
true), 'int'));
-                       
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date', 
true), 'int')); 
-                       
$check_list->set_component_id($this->unmarshal($this->db->f('cl_component_id', 
true), 'int'));
-                       
$check_list->set_location_code($this->unmarshal($this->db->f('cl_location_code',
 true), 'string'));
-                       
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases', 
true), 'int')); 
-                       
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases',
 true), 'int'));
-                       
-                       $check_lists_array[] = $check_list;
-
-                       $control_id =  $control->get_id();
-               }
-               
-               if($control != null){
-                       $control->set_check_lists_array($check_lists_array);
-                       $controls_array[] = $control;
-               }       
-               
-               return $controls_array;
-       }
-       */
-       
        // Fetches control id and check lists for period and location
-       function get_check_lists_for_location_2( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null ){
+       function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null ){
                $sql =  "SELECT c.id as c_id, ";
                $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, num_pending_cases "; 

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-07-03 13:24:05 UTC (rev 9727)
@@ -109,25 +109,6 @@
                                return 0;
                        }
                }
-
-/*             function get_controls_for_location($location_code, $role_id, 
$from_date, $to_date, $repeat_type)
-               {
-                   $controls = array();
-                   $controls_loc = 
$this->get_controls_by_location($location_code, $from_date, $to_date, 
$repeat_type, '', $role_id );
-                   $controls_comp = 
$this->get_controls_for_components_by_location($location_code, $from_date, 
$to_date, $repeat_type, '', $role_id );
-                   
-                   foreach($controls_loc as $cl)
-                   {
-                       $controls[] = $cl;
-                   }
-                   foreach($controls_comp as $cc)
-                   {
-                       $controls[] = $cc;
-                   }
-                   
-                   return $controls;
-               }
-*/
                
                public function get_controls_by_location($location_code, 
$from_date, $to_date, $repeat_type, $return_type = "return_object", $role_id = 
'')
                {
@@ -862,8 +843,9 @@
                        $joins = " {$this->left_join} 
controller_control_component_list ON (c.id = 
controller_control_component_list.control_id)";
                        $joins .= " {$this->left_join} fm_bim_item ON 
(controller_control_component_list.component_id = fm_bim_item.id)";
                        $joins .= " {$this->left_join} fm_bim_type ON 
(fm_bim_item.type= fm_bim_type.id)";
-                       //$joins .= " {$this->left_join} fm_responsibility_role 
ON (c.responsibility_id = fm_responsibility_role.id)";
+
                        $sql  = "SELECT c.id AS control_id, c.title AS 
control_title, fm_bim_type.name AS type_name, fm_bim_item.id AS bim_id, 
fm_bim_item.guid as bim_item_guid FROM controller_control c {$joins} {$limit}";
+                       
                        $controlArray = array();
                        $this->db->query($sql, __LINE__, __FILE__);
                        $i=1;
@@ -879,7 +861,7 @@
 
                        return $controlArray;
                }
-
+               
                public function getBimItemAttributeValue($bimItemGuid, 
$attribute) 
                {
                        $columnAlias = "attribute_values";
@@ -894,6 +876,8 @@
                        }
                }
                
+               
+               
                public function getLocationCodeFromControl($control_id)
                {
                        $sql = "select location_code from 
controller_control_location_list where control_id={$control_id}";

Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-07-03 13:24:05 UTC (rev 9727)
@@ -100,10 +100,10 @@
                        $role = $this->validate_role($role);
                        
                        // Gets timestamp value of first day in month
-                       $from_date_ts = 
month_calendar::get_start_month_date_ts($year, intval( $month ));
+                       $from_date_ts = 
month_calendar::get_start_date_month_ts($year, intval( $month ));
 
                        // Gets timestamp value of first day in month
-                       $to_date_ts = 
month_calendar::get_end_month_date_ts($year, intval( $month ));
+                       $to_date_ts = 
month_calendar::get_next_start_date_month_ts($year, intval( $month ));
 
                        // Validates location_code. If not set, first location 
among assigned locations
                        $location_code = 
$this->validate_location_code($location_code);
@@ -116,10 +116,13 @@
       $buildings_on_property = $this->get_buildings_on_property($user_role, 
$location_code, $level);
                        
                        // Fetches controls for location within specified time 
period
-                       $controls_for_location_array = 
$this->so_control->get_controls_by_location($location_code, $from_date_ts, 
$to_date_ts);
+                       $controls_for_location_array = 
$this->so_control->get_controls_by_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type, "return_object", $role );
 
+                       // Fetches all controls for the components for a 
location within time period
+                       $components_with_controls_array = 
$this->so_control->get_controls_by_component($location_code, $from_date_ts, 
$to_date_ts, $repeat_type, "return_object", $role);
+                       
                        // Fetches all control ids with check lists for 
specified time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts);
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location($location_code, $from_date_ts, 
$to_date_ts);
                        
                        // Loops through all controls for location and 
populates controls with check lists
                        $controls_with_check_list_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
@@ -127,7 +130,7 @@
                        $controls_calendar_array = array();
                        foreach($controls_with_check_list_array as $control)
                        {
-                               $month_calendar = new month_calendar($control, 
$year, $month);
+                               $month_calendar = new month_calendar($control, 
$year, $month, null, $location_code, "location");
                                $calendar_array = 
$month_calendar->build_calendar( $control->get_check_lists_array() );
 
                                $controls_calendar_array[] = array("control" => 
$control->toArray(), "calendar_array" => $calendar_array);
@@ -136,19 +139,25 @@
                        // COMPONENTS
                        foreach($components_with_controls_array as $component)
                        {
-                               $controls_for_component_array = 
$component->get_controls_array(); 
-                               $controls_components_calendar_array = array();
+                               $location_id = $component->get_location_id();
+                               $component_id = $component->get_id();
+      
+               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               $component->set_xml_short_desc( $short_desc );
                                
+                               $controls_for_component_array = 
$component->get_controls_array();
+                               $controls_components_calendar_array = array();
+                                                               
                          foreach($controls_for_component_array as $control)
                          {
                            // Fetches control ids with check lists for 
specified time period
-                                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+                                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_location_id(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=0");
 
                                        // Loops through all controls for 
location and populates controls with check lists
                                        $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
 
-                                       $year_calendar = new year_calendar( 
$control, $year, $component, null, "component" );
-                                       $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
+                                       $month_calendar = new month_calendar( 
$control, $year, $month, $component, null, "component" );
+                                       $calendar_array = 
$month_calendar->build_calendar( $control->get_check_lists_array() );
                                                                                
                                
                                        $controls_components_calendar_array[] = 
array("control" => $control->toArray(), "calendar_array" => $calendar_array);
                          }
@@ -156,6 +165,8 @@
                          $components_calendar_array[] = array("component" => 
$component->toArray(), "controls_calendar" => 
$controls_components_calendar_array);
                        }
                        
+                       print_r( $components_calendar_array );
+                       
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                
                        $property_array = 
execMethod('property.solocation.read', array('type_id' => 1, 'allrows' => 
true));
@@ -176,20 +187,21 @@
                        
                        $data = array
                        (               
-                               'buildings_on_property'         => 
$buildings_on_property,
-                               'my_locations'                          => 
$my_locations,
-                               'property_array'                        => 
$property_array,
-                               'current_location'                      => 
$location_array,
-                               'heading_array'                         => 
$heading_array,
-                               'controls_calendar_array' => 
$controls_calendar_array,
-                               'date_format'                                   
=> $date_format,
-                               'current_year'                                  
=> $year,
-                               'current_month_nr'                      => 
$month,
-                               'location_level'                                
=> $level,
-                               'roles_array'                                   
        => $roles_array,
-                               'repeat_type_array'                     => 
$repeat_type_array,
-                               'current_role'                                  
        => $role,
-                               'current_repeat_type'           => $repeat_type
+                               'buildings_on_property'                 => 
$buildings_on_property,
+                               'my_locations'                                  
=> $my_locations,
+                               'property_array'                                
=> $property_array,
+                               'current_location'                              
=> $location_array,
+                               'heading_array'                                 
=> $heading_array,
+                               'controls_calendar_array'       => 
$controls_calendar_array,
+                               'components_calendar_array'     => 
$components_calendar_array,
+                               'date_format'                                   
        => $date_format,
+                               'location_level'                                
        => $level,
+                               'roles_array'                                   
                => $roles_array,
+                               'repeat_type_array'                             
=> $repeat_type_array,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'current_role'                                  
                => $role,
+                               'current_repeat_type'                   => 
$repeat_type
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -213,7 +225,7 @@
                        // Validates year. If year is not set, current year is 
chosen
                        $year = $this->validate_year($year);
 
-                       // Validates year. 
+                       // Validates repeat type. 
                        $repeat_type = 
$this->validate_repeat_type($repeat_type);
                        
                        // Validates role. 
@@ -243,14 +255,12 @@
                        
                        // Fetches all controls for the components for a 
location within time period
                        $components_with_controls_array = 
$this->so_control->get_controls_by_component($location_code, $from_date_ts, 
$to_date_ts, $repeat_type, "return_object", $role);
-               
-                       $controls_calendar_array = array();
-                       
+                 
                        // Loops through controls with repeat type day or week
                        // and populates array that contains aggregated open 
cases pr month.
                        foreach($controls_for_location_array as $control)
                        {
-                               if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1)
+                               if($control->get_repeat_type() == 
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() == 
controller_control::REPEAT_TYPE_WEEK)
                                {
                                        $cl_criteria = new 
controller_check_list();
                                        
$cl_criteria->set_control_id($control->get_id());
@@ -271,14 +281,14 @@
                        
                        $repeat_type_expr = ">=2";
                        // Fetches control ids with check lists for specified 
time period
-                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location_2($location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr);
+                       $control_id_with_check_list_array = 
$this->so->get_check_lists_for_location($location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr);
                        
                        // Loops through all controls for location and 
populates controls with check lists
                        $controls_for_location_array = 
$this->populate_controls_with_check_lists($controls_for_location_array, 
$control_id_with_check_list_array);
                        
                        foreach($controls_for_location_array as $control)
                        {
-                               if($control->get_repeat_type() == 2 | 
$control->get_repeat_type() == 3)
+                               if($control->get_repeat_type() == 
controller_control::REPEAT_TYPE_MONTH | $control->get_repeat_type() == 
controller_control::REPEAT_TYPE_YEAR)
                                {
                                        $year_calendar = new 
year_calendar($control, $year, null, $location_code, "location" );
                                        $calendar_array = 
$year_calendar->build_calendar( $control->get_check_lists_array() );
@@ -291,36 +301,22 @@
                        foreach($components_with_controls_array as $component)
                        {
                                $location_id = $component->get_location_id();
- 
-                               $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $id = $component->get_id();
+      
+               $short_desc_arr = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $id));
+               $component->set_xml_short_desc( $short_desc_arr );
                                
-                               $filters = array("short_description" => "IS NOT 
NULL");
-                               $attributes['attributes'] = 
$GLOBALS['phpgw']->custom_fields->find($system_location['appname'],$system_location['location'],
 0, '', 'ASC', 'short_description', true, true,$filters);
-               
-                               $params = array
-                               (
-                                       'location_id' => 
$component->get_location_id(),
-                                       'id' => $component->get_id()
-                               );
-                       
-                               $soentity         = 
createObject('property.soentity');
-        $prop_array = $soentity->read_single_eav($params, $attributes);
-                               
-                               $attr_arr = 
array_pop($prop_array['attributes']);
-                               $xml_short_desc = $attr_arr['value'];           
-                               $component->set_xml_short_desc($xml_short_desc);
-                               
                                $controls_for_component_array = 
$component->get_controls_array();
                                $controls_components_calendar_array = array();
                                
                          foreach($controls_for_component_array as $control)
                          {
-                                 if($control->get_repeat_type() == 0 | 
$control->get_repeat_type() == 1)
+                                 if($control->get_repeat_type() == 
controller_control::REPEAT_TYPE_DAY | $control->get_repeat_type() == 
controller_control::REPEAT_TYPE_WEEK)
                                  {
                                        $cl_criteria = new 
controller_check_list();
                                                $cl_criteria->set_control_id( 
$control->get_id() );
                                                $cl_criteria->set_component_id( 
$component->get_id() );
-                                       $cl_criteria->set_location_id( 
$component->get_type() );
+                                       $cl_criteria->set_location_id( 
$component->get_location_id() );
                                        
                                        $from_month = 
$this->get_start_month_for_control($control);
                                                $to_month = 
$this->get_end_month_for_control($control);
@@ -335,7 +331,7 @@
                                  else 
                                  {
                                    // Fetches control ids with check lists for 
specified time period
-                                               
$control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_type(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
+                                               
$control_id_with_check_list_array = 
$this->so->get_check_lists_for_component($component->get_location_id(), 
$component->get_id(), $from_date_ts, $to_date_ts, $repeat_type = ">=2");
 
                                                // Loops through all controls 
for location and populates controls with check lists
                                                $controls_for_component_array = 
$this->populate_controls_with_check_lists($controls_for_component_array, 
$control_id_with_check_list_array);
@@ -375,10 +371,10 @@
                                'controls_calendar_array'       => 
$controls_calendar_array,
                                'components_calendar_array'     => 
$components_calendar_array,
                                'date_format'                                   
        => $date_format,
-                               'current_year'                                  
        => $year,
                                'location_level'                                
        => $level,
                                'roles_array'                                   
                => $roles_array,
                                'repeat_type_array'                             
=> $repeat_type_array,
+                               'current_year'                                  
        => $year,
                                'current_role'                                  
                => $role,
                                'current_repeat_type'                   => 
$repeat_type
                        );
@@ -418,7 +414,7 @@
                        $locations_with_calendar_array = array();
                        
                        // Process aggregated values for controls with repeat 
type day or week 
-                       if($control->get_repeat_type() <= 1 )
+                       if($control->get_repeat_type() <= 
controller_control::REPEAT_TYPE_WEEK )
                        {
                                foreach($locations_for_control_array as 
$location)
                                {
@@ -461,7 +457,7 @@
                                }
                        }
                        // Process values for controls with repeat type month 
or year
-                       else if($control->get_repeat_type() > 1)
+                       else if($control->get_repeat_type() > 
controller_control::REPEAT_TYPE_WEEK)
                        {
                                foreach($locations_for_control_array as 
$location)
                                {
@@ -538,10 +534,10 @@
                        $month = $this->validate_month($month);
                        
                        // Gets timestamp value of first day in month
-                       $from_date_ts = 
month_calendar::get_start_month_date_ts($year, intval( $month ));
+                       $from_date_ts = 
month_calendar::get_start_date_month_ts($year, intval( $month ));
 
                        // Gets timestamp value of first day in month
-                       $to_date_ts = 
month_calendar::get_end_month_date_ts($year, intval( $month ));
+                       $to_date_ts = 
month_calendar::get_next_start_date_month_ts($year, intval( $month ));
                        
                        $locations_with_calendar_array = array();
                        
@@ -614,8 +610,8 @@
                        // Fetches aggregate value for open cases in each month 
in time period
                        for($from_month; $from_month <= $to_month; 
$from_month++)
                        {
-                               $month_start_ts = 
$this->get_month_start_date_ts($year, $from_month);
-                               $month_end_ts   = 
$this->get_month_start_date_ts($year, $from_month+1);
+                               $month_start_ts = 
$this->get_month_start_ts($year, $from_month);
+                               $month_end_ts   = 
$this->get_month_start_ts($year, $from_month+1);
                                
                                $num_open_cases_for_control_array = array();
                                
@@ -818,6 +814,6 @@
                        
                        return $month;
                }
-
+               
                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-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-07-03 13:24:05 UTC (rev 9727)
@@ -36,6 +36,7 @@
        phpgw::import_class('controller.socontrol');
        
        include_class('controller', 'check_item_case', 'inc/model/');
+       include_class('controller', 'component', 'inc/model/');
        include_class('controller', 'check_list_status_updater', 'inc/helper/');
                        
        class controller_uicase extends phpgwapi_uicommon
@@ -47,16 +48,15 @@
                private $so_check_item;
                
                var $public_functions = array(
-                                                                       
'register_case'                         => true,
-                                                                       
'save_case'                             => true,
-                                                                       
'create_case_message'           => true,
+                                                                       
'register_case'                                 => true,
+                                                                       
'save_case'                                             => true,
+                                                                       
'create_case_message'   => true,
                                                                        
'view_case_message'             => true,
-                                                                       
'register_case_message'         => true,
-                                                                       
'register_measurement_case' => true,
-                                                                       
'updateStatusForCases'          => true,
-                                                                       
'delete_case'                           => true,
-                                                                       
'close_case'                            => true,
-                                                                       
'open_case'                             => true
+                                                                       
'send_case_message'             => true,
+                                                                       
'updateStatusForCases'  => true,
+                                                                       
'delete_case'                                   => true,
+                                                                       
'close_case'                                            => true,
+                                                                       
'open_case'                                             => true
                                                                );
 
                function __construct()
@@ -83,17 +83,7 @@
                        $control = $this->so_control->get_single( $control_id );
                        
                        $check_item = 
$this->so_check_item->get_check_item_by_check_list_and_control_item($check_list_id,
 $control_item_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();
-                       
-                       */
-                       
+                                                       
                        // Makes a check item if there isn't already made one  
                        if($check_item == null){
                                $new_check_item = new controller_check_item();
@@ -185,37 +175,60 @@
 
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
-                       
-                       $location_code = $check_list->get_location_code();
 
-                       $level = count(explode('-',location_code));
-                       
-                       if($level == 1)
-                               $buildings_array = 
execMethod('property.solocation.get_children',$location_code);
-                       
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
        
-                       $building = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                       
                        $catsObj = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
                        $catsObj->supress_info = true;
                        
                        $categories     = 
$catsObj->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id, 'use_acl' => 
$this->_category_acl));
 
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                       $component_id = $check_list->get_component_id();
                        
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+                                       
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                                                       
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                               $type = 'component';
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                       }
+
+                       $level = $this->get_location_level();
+                       
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                       
                        $data = array
                        (
-                               'location_array'        => $location_array,
-                               'categories'                    => $categories,
-                               'check_list'                    => 
$check_list->toArray(),
-                               'control'                               => 
$control->toArray(),
-                               'check_items_and_cases' => 
$check_items_and_cases,
-                               'buildings_array'               => 
$buildings_array,
-                               'building'                              => 
$building,
-                               'date_format'                   => $date_format
+                               'categories'                                    
                => $categories,
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'control'                                       
                                => $control->toArray(),
+                               'check_items_and_cases'         => 
$check_items_and_cases,
+                               'date_format'                                   
        => $date_format,
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'building_location_code'        => 
$building_location_code,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'type'                                          
                                => $type,
+                               'location_level'                                
        => $level
                        );
-                       
+                                               
                        if(count( $buildings_array ) > 0){
                                $data['buildings_array']  = $buildings_array;
                        }else{
@@ -232,7 +245,7 @@
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'case/create_case_message'), $data);
                }
                
-               function register_case_message(){
+               function send_case_message(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $location_code = phpgw::get_var('location_code');
                        $message_title = phpgw::get_var('message_title');
@@ -244,12 +257,8 @@
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
                        
-                       $location_code = $check_list->get_location_code();
-                                
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
        
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-
                        $message_details = "Kontroll: " .  
$control->get_title() . "\n";
                        
                        $cats = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
@@ -278,13 +287,13 @@
                        
                        $ticket = array
                        (
-                               'origin_id'             => $location_id,
+                               'origin_id'                     => $location_id,
                                'origin_item_id'        => $check_list_id, 
                                'location_code'         => $location_code,
-                               'cat_id'                        => 
$message_cat_id,
-                               'priority'                      => $priority, 
//valgfri (1-3)
-                               'title'                         => 
$message_title,
-                               'details'                       => 
$message_details,
+                               'cat_id'                                        
=> $message_cat_id,
+                               'priority'                              => 
$priority, //valgfri (1-3)
+                               'title'                                         
=> $message_title,
+                               'details'                                       
=> $message_details,
                                'file_input_name'       => 'file' // navn på 
felt som inneholder fil
                        );
                        
@@ -315,13 +324,7 @@
                                                
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
-                       
-                       $location_code = $check_list->get_location_code();
-                                
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-       
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-
+               
                        $check_items_and_cases = 
$this->so_check_item->get_check_items_with_cases_by_message($message_ticket_id, 
"return_array");
                                                
                        $botts = CreateObject('property.botts',true);
@@ -331,17 +334,52 @@
                        
                        $category = 
$catsObj->return_single($message_ticket["cat_id"]);
                        
+                       $component_id = $check_list->get_component_id();
+                       
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+                                       
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                                                       
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                       }
+                       
+                       $level = $this->get_location_level($location_code);
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                       
                        $data = array
                        (
-                               'control'                                       
                => $control->toArray(),
-                               'message_ticket_id'                             
        => $message_ticket_id,
+                               'control'                                       
                                => $control->toArray(),
+                               'message_ticket_id'                             
=> $message_ticket_id,
                                'message_ticket'                                
        => $message_ticket,
-                               'category'                                      
                => $category[0]['name'],
+                               'category'                                      
                        => $category[0]['name'],
                                'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
                                'control_array'                                 
        => $control->toArray(),
-                               'check_list'                                    
        => $check_list->toArray(),
-                               'check_items_and_cases'                         
=> $check_items_and_cases,
-                               'date_format'                                   
        => $date_format
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'check_items_and_cases'         => 
$check_items_and_cases,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'date_format'                                   
        => $date_format,
+                               'type'                                          
                                => $type,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -441,5 +479,32 @@
                        }
                }
                
+               function get_location_level($location_code)
+               {
+                       $level = count(explode('-', $location_code));
+
+                       return $level;
+               }
+
+               function get_building_location_code($location_code)
+               {
+                       if( strlen( $location_code ) == 6 )
+                       {
+                               $location_code_arr = explode('-', 
$location_code, 2);
+                               $building_location_code = $location_code_arr[0];
+                       }
+                       else if( strlen( $location_code ) > 6 )
+                       {
+                               $location_code_arr = explode('-', 
$location_code, 3);
+                               $building_location_code = $location_code_arr[0] 
. "-" . $location_code_arr[1];
+                       }
+                       else
+                       {
+                               $building_location_code = $location_code;
+                       }
+                       
+                       return $building_location_code; 
+               }
+               
                public function query(){}
        }

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-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-07-03 13:24:05 UTC (rev 9727)
@@ -52,37 +52,36 @@
                private $so_control_item_list;
        
                var $public_functions = array(
-                                                                               
'index'                                                 => true,
-                                                                               
'add_check_list'                                => true,
-                                                                               
'save_check_list'                               => true,
-                                                                               
'edit_check_list'                               => true,
+                                                                               
'index'                                                                         
        => true,
+                                                                               
'add_check_list'                                                => true,
+                                                                               
'save_check_list'                                       => true,
+                                                                               
'edit_check_list'                                       => true,
                                                                                
'create_case_message'                   => true,
-                                                                               
'view_control_info'                     => true,
-                                                                               
'view_cases_for_check_list'             => true,
-                                                                               
'update_check_list'                             => true,
-                                                                               
'print_check_list'                              => true,
-                                                                               
'register_case'                                 => true,
-                                                                               
'view_open_cases'                               => true,
-                                                                               
'view_closed_cases'                             => true,
+                                                                               
'view_control_info'                             => true,
+                                                                               
'view_cases_for_check_list'     => true,
+                                                                               
'print_check_list'                                      => true,
+                                                                               
'register_case'                                                 => true,
+                                                                               
'view_open_cases'                                               => true,
+                                                                               
'view_closed_cases'                                     => true,
                                                                                
'view_control_details'                  => true,
-                                                                               
'view_control_items'                    => true,
-                                                                               
'get_check_list_info'                   => true, 
-                                                                               
'get_cases_for_check_list'              => true
+                                                                               
'view_control_items'                            => true,
+                                                                               
'get_check_list_info'                           => true, 
+                                                                               
'get_cases_for_check_list'      => true
                                                                        );
 
                function __construct()
                {
                        parent::__construct();
 
-                       $this->so_control_area          = 
CreateObject('controller.socontrol_area');
-                       $this->so_control                       = 
CreateObject('controller.socontrol');
-                       $this->so                                       = 
CreateObject('controller.socheck_list');
-                       $this->so_control_item          = 
CreateObject('controller.socontrol_item');
-                       $this->so_check_item            = 
CreateObject('controller.socheck_item');
-                       $this->so_procedure                     = 
CreateObject('controller.soprocedure');
-                       $this->so_control_group_list = 
CreateObject('controller.socontrol_group_list');
-                       $this->so_control_group         = 
CreateObject('controller.socontrol_group');
-                       $this->so_control_item_list = 
CreateObject('controller.socontrol_item_list');
+                       $this->so_control_area                          = 
CreateObject('controller.socontrol_area');
+                       $this->so_control                                       
        = CreateObject('controller.socontrol');
+                       $this->so                                               
                                        = 
CreateObject('controller.socheck_list');
+                       $this->so_control_item                          = 
CreateObject('controller.socontrol_item');
+                       $this->so_check_item                                    
= CreateObject('controller.socheck_item');
+                       $this->so_procedure                                     
        = CreateObject('controller.soprocedure');
+                       $this->so_control_group_list    = 
CreateObject('controller.socontrol_group_list');
+                       $this->so_control_group                         = 
CreateObject('controller.socontrol_group');
+                       $this->so_control_item_list     = 
CreateObject('controller.socontrol_item_list');
 
                        
self::set_active_menu('controller::control::check_list');
                }       
@@ -185,7 +184,7 @@
                }
                
                /**
-                * Public function for displaying the add check list form  
+                * Public function for displaying the add check list form
                 * 
                 * @param HTTP:: location code, control id, date
                 * @return data array
@@ -199,26 +198,50 @@
                        $check_list->set_control_id($control_id);
                        $check_list->set_deadline($deadline_ts);
                        
-                       if($type == "component"){
+                       if($type == "component")
+                       {
                                $location_id = phpgw::get_var('location_id');
                                $check_list->set_location_id($location_id);
                                $component_id = phpgw::get_var('component_id');
                                $check_list->set_component_id($component_id);
-                       }else{
+                                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               
+                               $component_array = $component->toArray();
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                               $type = "component";
+                       }
+                       else
+                       {
                                $location_code = 
phpgw::get_var('location_code');       
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $level = 
$this->get_location_level($location_code);
+                               $type = "location";
                        }
                        
                        $control = $this->so_control->get_single($control_id);
                        
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                       $year = date("Y", $deadline_ts);
+                       $month = date("n", $deadline_ts);
+               
                        
                        $data = array
                        (
-                               'location_array'        => $location_array,
-                               'control'                                       
=> $control->toArray(),
-                               'date_format'           => $date_format,
-                               'check_list'                    => 
$check_list->toArray(),
-                               'type'                                          
=> $type
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'control'                                       
                                => $control->toArray(),
+                               'date_format'                                   
        => $date_format,
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -237,7 +260,8 @@
                 * @param HTTP:: location code, control id, status etc.. (check 
list details) 
                 * @return data array
                */
-               function save_check_list(){
+               function save_check_list()
+               {
                        $control_id = phpgw::get_var('control_id');
                        $status = (int)phpgw::get_var('status');
                        $type = phpgw::get_var('type');
@@ -245,7 +269,8 @@
                        $planned_date = phpgw::get_var('planned_date', 
'string');
                        $completed_date = phpgw::get_var('completed_date', 
'string');
                        $comment = phpgw::get_var('comment', 'string');
-                       
+                       $return_format = phpgw::get_var('phpgw_return_as');
+                                               
                        $deadline_date_ts = 
date_helper::get_timestamp_from_date( $deadline_date, "d/m-Y" );
                        
                        if($planned_date != ''){
@@ -281,9 +306,19 @@
                        
                        $check_list_id = $this->so->store($check_list);
                        
-                       if( $check_list_id > 0 ){
+                       
+                       if( ($check_list_id > 0) & ($return_format != 'json') )
+                       {
                                $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id'=>$check_list_id));   
  
                        }
+                       else if( ($check_list_id > 0) & ($return_format == 
'json') )
+                       {
+                               return json_encode( array( "status" => 
"updated" ) );
+                       }
+                       else
+                       {
+                               return json_encode( array( "status" => 
"not_updated" ) );
+                       } 
                }
                
                /**
@@ -305,20 +340,45 @@
                        
                        $component_id = $check_list->get_component_id();
 
-                       if($component_id > 0){
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
                                
-                       }else{
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
                                $location_code = 
$check_list->get_location_code();
-       
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));      
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->get_location_level($location_code);
                        }
                        
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                       
                        $data = array
                        (
-                               'control'                               => 
$control->toArray(),
-                               'check_list'                    => 
$check_list->toArray(),
-                               'location_array'        => $location_array,
-                               'date_format'           => $date_format
+                               'control'                                       
                        => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'date_format'                                   
        => $date_format,
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -339,18 +399,53 @@
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                                
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $location_code = $check_list->get_location_code();
-       
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->get_location_level($location_code);
+                       }       
                        
+                       $level = $this->get_location_level($location_code);
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                                                       
                        $data = array
                        (
-                               'control'                               => 
$control->toArray(),
-                               'check_list'                    => 
$check_list->toArray(),
-                               'location_array'        => $location_array,
-                               'date_format'           => $date_format
+                               'control'                                       
                        => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'date_format'                                   
        => $date_format,
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month
                        );
-                       
+
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
@@ -360,7 +455,7 @@
                        
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'check_list/view_cases_for_check_list'), $data);
                }
-               
+               /*
                function create_case_message()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -370,11 +465,33 @@
                        $control_id = 
$check_list_with_check_items["control_id"];
                        $control = $this->so_control->get_single( $control_id );
                        
-                       $location_code = 
$check_list_with_check_items["location_code"];  
-                                
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->get_location_level($location_code);
+                       }
+                       
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-       
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $data = array
                        (
@@ -393,44 +510,7 @@
                        
                        self::render_template_xsl('create_case_messsage', 
$data);
                }
-               
-               // Saves a check list that already exists. Returns status for 
update as a JSON array with values update/not updated  
-               public function update_check_list()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $status = (int)phpgw::get_var('status');
-                       $comment = phpgw::get_var('comment');
-                       $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;
-                       } 
-                       
-                       if($completed_date != ''){
-                               $completed_date_ts = 
date_helper::get_timestamp_from_date( $completed_date, "d/m-Y" );
-                       }else{
-                               $completed_date_ts = 0;
-                       }
-                       
-                       // Fetches check_list from DB
-                       $update_check_list = 
$this->so->get_single($check_list_id);
-                       $update_check_list->set_status( $status );
-                       $update_check_list->set_comment( $comment );
-                       $update_check_list->set_completed_date( 
$completed_date_ts );
-                       $update_check_list->set_planned_date( $planned_date_ts 
);
-
-                       $check_list_id = $this->so->update( $update_check_list 
);
-                       
-                       if($check_list_id > 0)
-                               return json_encode( array( "status" => 
"updated" ) );
-                       else
-                               return json_encode( array( "status" => 
"not_updated" ) );
-               }
-               
+               */
                public function print_check_list()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -467,14 +547,47 @@
                        $check_list = $this->so->get_single($check_list_id);
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        
-                       $location_code = $check_list->get_location_code();  
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->get_location_level($location_code);
+                       }
                        
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                       
                        $data = array
                        (
-                               'location_array'                                
=> $location_array,
-                               'control'                                       
                        => $control->toArray(),
-                               'check_list'                                    
        => $check_list->toArray(),
+                               'control'                                       
                        => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'date_format'                                   
        => $date_format,
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level
                        );
 
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -559,15 +672,48 @@
                        }
                        
=====================================================================*/
                        //_debug_array($control_group_check_items);
-                                       
-                       $location_array = execMethod( 
'property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()) );
                        
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                       }
+                       
+                       $level = $this->get_location_level($location_code);
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+                                                       
                        $data = array
                        (
-                               'control'                                       
                                                        => $control->toArray(),
-                               'check_list'                                    
                                                => $check_list->toArray(),
-                               'location_array'                                
                                        => $location_array,
-                               'control_groups_with_items_array' => 
$control_groups_with_items_array
+                               'control'                                       
                                                                => 
$control->toArray(),
+                               'check_list'                                    
                                                        => 
$check_list->toArray(),
+                               'location_array'                                
                                                => $location_array,
+                               'component_array'                               
                                                => $component_array,
+                               'control_groups_with_items_array'       => 
$control_groups_with_items_array,
+                               'type'                                          
                                                                        => 
$type,
+                               'location_level'                                
                                                => $level,
+                               'building_location_code'                        
                        => $building_location_code,
+                               'current_year'                                  
                                                => $year,
+                               'current_month_nr'                              
                                        => $month
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');
@@ -668,5 +814,32 @@
                        return json_encode( $check_items_with_cases );
                }
                
+               function get_building_location_code($location_code)
+               {
+                       if( strlen( $location_code ) == 6 )
+                       {
+                               $location_code_arr = explode('-', 
$location_code, 2);
+                               $building_location_code = $location_code_arr[0];
+                       }
+                       else if( strlen( $location_code ) > 6 )
+                       {
+                               $location_code_arr = explode('-', 
$location_code, 3);
+                               $building_location_code = $location_code_arr[0] 
. "-" . $location_code_arr[1];
+                       }
+                       else
+                       {
+                               $building_location_code = $location_code;
+                       }
+                       
+                       return $building_location_code; 
+               }
+               
+               function get_location_level($location_code)
+               {
+                       $level = count(explode('-', $location_code));
+
+                       return $level;
+               }       
+               
                public function query(){}
        }

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
 2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_component.inc.php
 2012-07-03 13:24:05 UTC (rev 9727)
@@ -263,7 +263,6 @@
                                )
                        );
 
-
                        phpgwapi_yui::load_widget('paginator');
 
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
@@ -474,7 +473,6 @@
                                        $ifc = false;
                        }
 
-
                        $bim_types = $this->so_control->get_bim_types($ifc);
                        if(count($bim_types)>0)
                                return json_encode( $bim_types );

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2012-07-03 13:24:05 UTC (rev 9727)
@@ -49,13 +49,13 @@
 
                public $public_functions = array
                (
-                       'index'                                                 
                =>      true,
-                       'query'                                                 
                =>      true,
-                       'edit'                                                  
                =>      true,
-                       'view'                                                  
                =>      true,
-                       'add'                                                   
                =>      true,
-                       'save_group_and_item_order'                             
=>      true,
-                       'get_control_groups_by_control_area'    => true
+                       'index'                                                 
                                                                        =>      
true,
+                       'query'                                                 
                                                                        =>      
true,
+                       'edit'                                                  
                                                                        =>      
true,
+                       'view'                                                  
                                                                        =>      
true,
+                       'add'                                                   
                                                                                
=>      true,
+                       'save_group_and_item_order'                             
                =>      true,
+                       'get_control_groups_by_control_area'    =>  true
                );
 
                public function __construct()

Deleted: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php  
    2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item_option.inc.php  
    2012-07-03 13:24:05 UTC (rev 9727)
@@ -1,104 +0,0 @@
-<?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_item.inc.php 9082 2012-03-29 12:58:24Z 
vator $
-       */
-
-       phpgw::import_class('phpgwapi.uicommon');
-       phpgw::import_class('controller.socontrol_item_option');
-               
-       include_class('controller', 'control_item_option', 'inc/model/');
-
-       class controller_uicontrol_item_option extends phpgwapi_uicommon
-       {
-               private $so;
-               private $so_control_item;
-       
-               public $public_functions = array
-               (
-                       'add'           => true,
-                       'edit'          => true,
-                       'save'          => true,
-                       'delete'        => true,
-                       'query'         => true
-               );
-
-               public function __construct()
-               { 
-                       parent::__construct();
-                       $this->so = 
CreateObject('controller.socontrol_item_option');
-                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
-               }
-
-               public function add()
-               {
-                       $control_item_id = phpgw::get_var('control_item_id');
-                       
-                       $control_item = 
$this->so_control_item->get_single($control_item_id);   
-                       
-                       $data = array
-                       (
-                               'control_item'  => $control_item->toArray()
-                       );
-                       
-                       self::add_javascript('controller', 'controller', 
'jquery.js');
-                       self::add_javascript('controller', 'controller', 
'ajax.js');
-                       self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
-
-                       
self::render_template_xsl('control_item/control_item_option', $data);
-               }
-               
-               public function save()
-               {       
-                       $option_value = phpgw::get_var('option_value');
-                       $control_item_id = phpgw::get_var('control_item_id');
-                       
-                       $control_item_option = new 
controller_control_item_option($option_value, $control_item_id);
-                       $control_item_option_id = $this->so->store( 
$control_item_option );
-                       
-                       if($control_item_option_id > 0){
-                               $control_item_option = 
$this->so->get_single($control_item_option_id);   
-                               
-                               return json_encode( array( "status" => "saved", 
"saved_object" => $control_item_option->toArray() ) );
-                       }
-                       else{
-                               return json_encode( array("status" => 
"not_saved") );
-                       }
-               }
-
-               public function edit()
-               {
-                       $control_item_option_id = phpgw::get_var('id');
-                       $label = phpgw::get_var('label');
-                       $control_item_id = phpgw::get_var('control_item_id');
-                       
-                       $control_item_option = new 
controller_control_item_option($label, $control_item_id);
-                       $control_item_option_id = $this->so->store( 
$control_item_option );
-               }
-               
-               public function query(){}
-       }

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
   2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
   2012-07-03 13:24:05 UTC (rev 9727)
@@ -9,63 +9,82 @@
 */  
 
 class month_calendar {
-       
-       private $period_start_date_ts;
-    private $period_end_date_ts;
        private $year;
        private $month;
        private $control;
+       private $type;
+       private $component;
+       private $location_code;
        private $calendar_array = array();
        
-       public function __construct($control, $year, $month){
-        $this->year = $year;
-        $this->month = $month;
-        $this->control = $control;
-        
-       $from_month = $month;
-                       
-               $from_date_ts = strtotime("$from_month/01/$year");
+       public function __construct($control, $year, $month, $component, 
$location_code, $type){
+    $this->year = $year;
+    $this->month = $month;
+    $this->control = $control;
+    $this->component = $component;
+    $this->location_code = $location_code;
+    $this->type = $type;
                
-               if(($from_month + 1) > 12){
-                       $to_month = 1;
-                       $to_year = $year + 1;
-               }else{
-                       $to_month = $from_month + 1;
-                       $to_year = $year;
-               }
-               
-               $to_date_ts = strtotime("$to_month/01/$to_year");
-        
-               $this->period_start_date_ts = $from_date_ts;
-               $this->period_end_date_ts = $to_date_ts;
-                       
-        $this->init_calendar();
-       }
+    $this->init_calendar();
+  }
        
        function init_calendar(){
+               $ctr_start_date_ts = $this->control->get_start_date();
+    $ctr_end_date_ts = $this->control->get_end_date();
+    $period_start_date_ts = $this->get_start_date_month_ts($this->year, 
$this->month);
+    $period_end_date_ts = $this->get_next_start_date_month_ts($this->year, 
$this->month);
+    $repeat_type = $this->control->get_repeat_type();
+    $repeat_interval = $this->control->get_repeat_interval();
 
                $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, 
$this->month, $this->year);
                
-               for($i=1;$i<=$num_days_in_month;$i++){
+               for($i=1;$i<=$num_days_in_month;$i++)
+               {
                        $this->calendar_array[$i] = null;
                }
                
-               $date_generator = new 
date_generator($this->control->get_start_date(), 
$this->control->get_end_date(), $this->period_start_date_ts, 
$this->period_end_date_ts, $this->control->get_repeat_type(), 
$this->control->get_repeat_interval());
+               $date_generator = new date_generator($ctr_start_date_ts, 
$ctr_end_date_ts, $period_start_date_ts, $period_end_date_ts, $repeat_type, 
$repeat_interval);
                $dates_array = $date_generator->get_dates();
                
                // Inserts dates 
-               foreach($dates_array as $date){
-                       
+               foreach($dates_array as $date_ts)
+               {
+                       $check_list = new controller_check_list();
+       $check_list->set_deadline( $date_ts );
+       $check_list->set_control_id( $this->control->get_id() );
+       
+       if($this->type == "component")
+       {
+               $check_list->set_component_id( $this->component->get_id() );
+               $check_list->set_location_id( 
$this->component->get_location_id() );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
+       }
+       else 
+       {
+               $check_list->set_location_code( $this->location_code );
+               $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
+       } 
+       
+                       $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
+       
+      $this->calendar_array[ date("j", $date_ts) ]["status"] = 
$check_list_status_info->get_status();
+      $this->calendar_array[ date("j", $date_ts) ]["info"]   = 
$check_list_status_info->serialize();
+      
+                       /*
                        $todays_date = mktime(0,0,0,date("m"), date("d"), 
date("Y"));
                        
-                       if($date < $todays_date){
+                       if($date < $todays_date)
+                       {
                                $status = "CONTROL_NOT_DONE";
-                       }else{
+                       }
+                       else
+                       {
                                $status = "CONTROL_REGISTERED";
                        }
                        
                        $this->calendar_array[ date("j", $date) ]["status"]  = 
$status;
-                       $this->calendar_array[ date("j", $date) ]["info"]  = 
array("date" => $date, "control_id" => $this->control->get_id());  
+                       $this->calendar_array[ date("j", $date) ]["info"]  = 
array("date" => $date, "control_id" => $this->control->get_id());
+                       */
                }
        }
        
@@ -82,32 +101,36 @@
                return $this->calendar_array;
        }
        
-       public static function get_heading_array($year, $month){
+       public static function get_heading_array($year, $month)
+       {
                $num_days_in_month = cal_days_in_month(CAL_GREGORIAN, $month, 
$year);           
                $heading_array = array();
                
-               for($i=1;$i<=$num_days_in_month;$i++){
+               for($i=1;$i<=$num_days_in_month;$i++)
+               {
                        $heading_array[$i] = "$i";      
                }
                
                return $heading_array;
        }
        
-       public static function get_start_month_date_ts($year, $from_month){
-               return strtotime("$from_month/01/$year");
+       public static function get_start_date_month_ts($year, $month){
+               return strtotime("$month/01/$year");
        }
        
-       public static function get_end_month_date_ts($year, $from_month){
-               if(($from_month + 1) > 12){
+       public static function get_next_start_date_month_ts($year, $month)
+       {
+               if(($month + 1) > 12)
+               {
                        $to_month = 1;
                        $to_year = $year + 1;
-               }else{
-                       $to_month = $from_month + 1;
+               }
+               else
+               {
+                       $to_month = $month + 1;
                        $to_year = $year;
                }
                
-               $to_date_ts = strtotime("$to_month/01/$to_year");
-               
-               return $to_date_ts; 
+               return strtotime("$to_month/01/$to_year");
        }
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
    2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
    2012-07-03 13:24:05 UTC (rev 9727)
@@ -13,10 +13,10 @@
        private $type;
        private $component;
        private $location_code;
-       
        private $calendar_array = array();
        
-  public function __construct($control, $year, $component, $location_code, 
$type){
+  public function __construct($control, $year, $component, $location_code, 
$type)
+  {
     $this->year = $year;
     $this->control = $control;
     $this->component = $component;
@@ -29,8 +29,10 @@
   /* Initializes calendar by setting status for each month in calendar array. 
    *   - CONTROL_NOT_DONE if month date is in the past 
    *   - CONTROL_REGISTERED if month date is in the future */ 
-       function init_calendar(){
-    for($i = 1;$i <= 12;$i++){
+       function init_calendar()
+       {
+    for($i = 1;$i <= 12;$i++)
+    {
                  $this->calendar_array[$i] = null;
     }
                
@@ -45,16 +47,20 @@
     $dates_array = $date_generator->get_dates();
                
     // Inserts dates 
-    foreach($dates_array as $date_ts){
+    foreach($dates_array as $date_ts)
+    {
        $check_list = new controller_check_list();
        $check_list->set_deadline( $date_ts );
        $check_list->set_control_id( $this->control->get_id() );
        
-       if($this->type == "component"){
+       if($this->type == "component")
+       {
                $check_list->set_component_id( $this->component->get_id() );
-               $check_list->set_location_id( $this->component->get_type() );
+               $check_list->set_location_id( 
$this->component->get_location_id() );
                $check_list_status_manager = new check_list_status_manager( 
$check_list, "component" );
-       }else {
+       }
+       else 
+       {
                $check_list->set_location_code( $this->location_code );
                $check_list_status_manager = new check_list_status_manager( 
$check_list, "location" );
        } 
@@ -68,9 +74,10 @@
                }
        }
        
-       public function build_calendar( $check_lists_array ){
-               
-               foreach($check_lists_array as $check_list){
+       public function build_calendar( $check_lists_array )
+       {
+               foreach($check_lists_array as $check_list)
+               {
                        $check_list_status_manager = new 
check_list_status_manager( $check_list );
                        $check_list_status_info = 
$check_list_status_manager->get_status_for_check_list(); 
 
@@ -83,7 +90,8 @@
                return $this->calendar_array;
        }
        
-       public function build_agg_month_calendar( 
$agg_open_cases_pr_month_array ){
+       public function build_agg_month_calendar( 
$agg_open_cases_pr_month_array )
+       {
                
                foreach($agg_open_cases_pr_month_array as 
$status_agg_month_info)
                {

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2012-07-03 13:24:05 UTC (rev 9727)
@@ -169,17 +169,22 @@
                public function serialize()
                {
                        return array(
-                               'id' => $this->get_id(),
-                               'control_id' => $this->get_control_id(),
-                               'status' => $this->get_status(),
-                               'comment' => $this->get_comment(),
-                               'deadline' => $this->get_deadline(),
-                               'planned_date' => $this->get_planned_date(),
-                               'completed_date' => $this->get_completed_date(),
-                               'location_code' => $this->get_location_code(),
-                               'component_id' => $this->get_component_id(),
-                               'location_id' => $this->get_location_id(),
-                               'num_open_cases' => $this->get_num_open_cases()
+                               'id'                                            
        => $this->get_id(),
+                               'control_id'                    => 
$this->get_control_id(),
+                               'status'                                        
=> $this->get_status(),
+                               'comment'                               => 
$this->get_comment(),
+                               'deadline'                              => 
$this->get_deadline(),
+                               'planned_date'          => 
$this->get_planned_date(),
+                               'completed_date'        => 
$this->get_completed_date(),
+                               'location_code'         => 
$this->get_location_code(),
+                               'component_id'          => 
$this->get_component_id(),
+                               'location_id'           => 
$this->get_location_id(),
+                               'num_open_cases'        => 
$this->get_num_open_cases()
                        );
                }
+               
+               public function validate(){
+                       
+               
+               }
        }

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.component.inc.php    
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/model/class.component.inc.php    
2012-07-03 13:24:05 UTC (rev 9727)
@@ -41,6 +41,7 @@
                // Not a table column
                protected $xml_short_desc;
                protected $location_code;
+               protected $p_location_code;
                protected $loc_1;
                protected $address;
                

Deleted: branches/Version-1_0-branch/controller/inc/model/class.schedule.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.schedule.inc.php     
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/inc/model/class.schedule.inc.php     
2012-07-03 13:24:05 UTC (rev 9727)
@@ -1,94 +0,0 @@
-<?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$
-       */
-
-       include_class('controller', 'model', 'inc/model/');
-
-       class controller_schedule extends controller_model
-       {
-               public static $so;
-               
-               protected $id;
-               protected $control_id;
-               protected $schedule_time;
-               
-               /**
-                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
-                * the database the ID should be empty so the database can add 
one according to its logic.
-                * 
-                * @param int $id the id of this composite
-                */
-               public function __construct(int $id = null)
-               {
-                       $this->id = (int)$id;
-               }
-               
-               public function set_id($id)
-               {
-                       $this->id = $id;
-               }
-               
-               public function get_id() { return $this->id; }
-               
-               public function set_title($title)
-               {
-                       $this->title = $title;
-               }
-               
-               public function get_title() { return $this->title; }
-               
-               public function set_control_id($control_id)
-               {
-                       $this->control_id = $control_id;
-               }
-               
-               public function get_control_id() { return $this->control_id; }
-               
-               public function set_schedule_time($schedule_time)
-               {
-                       $this->schedule_time = $schedule_time;
-               }
-               
-               public function get_schedule_time() { return 
$this->schedule_time; }
-               
-               /**
-                * Get a static reference to the storage object associated with 
this model object
-                * 
-                * @return the storage object
-                */
-               public static function get_so()
-               {
-                       if (self::$so == null)
-                       {
-                               self::$so = 
CreateObject('controller.soschedule');
-                       }
-                       
-                       return self::$so;
-               }
-       }

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-07-03 
13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-07-03 
13:24:05 UTC (rev 9727)
@@ -5,7 +5,7 @@
 Register control item  controller      no      Legg til nytt kontrollpunkt
 Edit control item      controller      no      Endre kontrollpunkt
 View control item      controller      no      Vis kontrollpunkt
-control_item_type_1    controller      no      Ved innskriving av kommentar i 
et kommentarfelt
+control_item_type_1    controller      no      Ved innskriving av kommentar
 control_item_type_2    controller      no      Ved innskriving av måling i et 
tekstfelt
 control_item_type_3    controller      no      Ved valg av verdi fra 
nedtrekksliste
 control_item_type_4    controller      no      Ved valg av verdi fra 
radioknapper

Modified: 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
      2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
      2012-07-03 13:24:05 UTC (rev 9727)
@@ -100,7 +100,7 @@
                
                        <!-- =====================  SELECT LIST FOR MY ASSIGNED 
LOCATIONS  ================= -->
                        <div id="choose-my-location" class="select-box">
-                               <label>Velg et annet bygg du har ansvar 
for</label>
+                               <label>Velg et annet bygg/eiendom du har ansvar 
for</label>
                                
                                <form action="#">
                                        <input type="hidden" name="period_type" 
value="view_month" />
@@ -183,6 +183,9 @@
                </div>
                        
                <div id="cal_wrp">
+               
+                       <!-- ================================  BUILDINGS TABLE  
====================================  -->
+                       <h2>Bygg/eiendom</h2>
                        <table id="calendar" class="month">
                                <tr class="heading">
                                        <th 
class="title"><span>Tittel</span></th>
@@ -194,59 +197,126 @@
                                </tr>
                                <xsl:choose>    
                                        <xsl:when 
test="controls_calendar_array/child::node()">
-                               <xsl:for-each select="controls_calendar_array">
-
-                                       <tr>                            
-                                       <xsl:choose>
-                                       <xsl:when test="(position() mod 2) != 
1">
-                                           <xsl:attribute 
name="class">odd</xsl:attribute>
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                           <xsl:attribute 
name="class">even</xsl:attribute>
-                                       </xsl:otherwise>
-                                   </xsl:choose>
-                                       
-                                               <td class="title">
-                                               <span><xsl:value-of 
select="control/title"/></span>
-                                               </td>
-                                               <td class="assigned">
-                                               <span><xsl:value-of 
select="control/responsibility_name"/></span>
-                                               </td>
-                                               <td class="frequency">
-                                               <span>
-                                                       <xsl:choose>
-                                                               <xsl:when 
test="control/repeat_interval = 1">
-                                                                       <span 
class="pre">Hver</span>
-                                                               </xsl:when>
-                                                               <xsl:when 
test="control/repeat_interval = 2">
-                                                                       <span 
class="pre">Annenhver</span>
-                                                               </xsl:when>
-                                                               <xsl:when 
test="control/repeat_interval > 2">
-                                                                       <span 
class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
-                                                               </xsl:when>
-                                                       </xsl:choose>
-                                                       
-                                                       <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
-                                               </span>
-                                               </td>
-                               
-                               <xsl:for-each select="calendar_array">
-                                       
-                                       <xsl:call-template 
name="check_list_status_checker" >
-                                               <xsl:with-param 
name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
-                                       </xsl:call-template>
-                                       
-                               </xsl:for-each>
-                               </tr>
-                               </xsl:for-each>
-                               
-                                       </xsl:when>
-                                       <xsl:otherwise>
-                                               <tr class="cal_info_msg"><td 
colspan="3">Ingen sjekklister for bygg i angitt periode</td></tr>
-                                       </xsl:otherwise>
-                               </xsl:choose>
+                                       <xsl:for-each 
select="controls_calendar_array">
+                                                       <tr>                    
        
+                                                       <xsl:choose>
+                                                       <xsl:when 
test="(position() mod 2) != 1">
+                                                           <xsl:attribute 
name="class">odd</xsl:attribute>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                           <xsl:attribute 
name="class">even</xsl:attribute>
+                                                       </xsl:otherwise>
+                                                   </xsl:choose>
+                                                       
+                                                               <td 
class="title">
+                                                               
<span><xsl:value-of select="control/title"/></span>
+                                                               </td>
+                                                               <td 
class="assigned">
+                                                               
<span><xsl:value-of select="control/responsibility_name"/></span>
+                                                               </td>
+                                                               <td 
class="frequency">
+                                                               <span>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="control/repeat_interval = 1">
+                                                                               
        <span class="pre">Hver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval = 2">
+                                                                               
        <span class="pre">Annenhver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval > 2">
+                                                                               
        <span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                                       
+                                                                       <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
+                                                               </span>
+                                                               </td>
+                                               
+                                                       <xsl:for-each 
select="calendar_array">
+                                                               
<xsl:call-template name="check_list_status_checker" >
+                                                                       
<xsl:with-param name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
+                                                               
</xsl:call-template>
+                                                       </xsl:for-each>
+                                               </tr>
+                                       </xsl:for-each>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <tr class="cal_info_msg"><td 
colspan="3">Ingen sjekklister for bygg i angitt periode</td></tr>
+                               </xsl:otherwise>
+                       </xsl:choose>
+                       </table>
+               
+               <!-- ================================  COMPONENTS TABLE  
====================================  -->
+               <h2 class="components">Komponenter</h2>
+               <xsl:choose>
+                               <xsl:when 
test="components_calendar_array/child::node()">
+               <xsl:for-each select="components_calendar_array">
+                 <h3><xsl:value-of select="component/xml_short_desc"/></h3>
+                 
+                       <table id="calendar" class="month">
+                                       <tr class="heading">
+                                                       <th 
class="title"><span>Tittel</span></th>
+                                                       <th 
class="assigned"><span>Tildelt</span></th>
+                                                       <th 
class="frequency"><span>Frekvens</span></th>
+                                       <xsl:for-each select="//heading_array">
+                                               <th><span><xsl:value-of 
select="."/></span></th>
+                                       </xsl:for-each>
+                                       </tr>
                        
-                       </table>
+                               <xsl:for-each select="controls_calendar">
+                                               <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
+                                       
+                                               <tr>
+                                                       <xsl:choose>
+                                                       <xsl:when 
test="(position() mod 2) != 1">
+                                                           <xsl:attribute 
name="class">odd</xsl:attribute>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                           <xsl:attribute 
name="class">even</xsl:attribute>
+                                                       </xsl:otherwise>
+                                                   </xsl:choose>
+                                                               <td 
class="title">
+                                                               
<span><xsl:value-of select="control/title"/></span>
+                                                               </td>
+                                                               <td 
class="assigned">
+                                                               
<span><xsl:value-of select="control/responsibility_name"/></span>
+                                                               </td>
+                                                               <td 
class="frequency">
+                                                               <span>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="control/repeat_interval = 1 and control/repeat_type &lt; 3">
+                                                                               
        <span class="pre">Hver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
+                                                                               
        <span class="pre">Hvert</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval = 2">
+                                                                               
        <span class="pre">Annenhver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval > 2">
+                                                                               
        <span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                                       
+                                                                       <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
+                                                               </span>
+                                                               </td>
+                                                               <xsl:for-each 
select="calendar_array">
+                                                                       
<xsl:call-template name="check_list_status_checker" >
+                                                                               
<xsl:with-param name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
+                                                                       
</xsl:call-template>
+                                                               </xsl:for-each>
+                                               </tr>   
+                                       </xsl:for-each>
+                               </table>        
+               </xsl:for-each>
+               </xsl:when>
+                       <xsl:otherwise>
+                               <div id="calendar">
+                                       <p class="no-comp-msg">Ingen 
komponenter tilknyttet kontroll</p>
+                               </div>
+                       </xsl:otherwise>
+                       </xsl:choose>
                </div>
        </div>
 </div>

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-07-03 13:24:05 UTC (rev 9727)
@@ -94,7 +94,7 @@
                        
                        <!-- =====================  SELECT LIST FOR MY 
LOCATIONS  ================= -->
                        <div id="choose-my-location" class="select-box">
-                               <label>Velg et annet bygg du har ansvar 
for</label>
+                               <label>Velg et annet bygg/eiendom du har ansvar 
for</label>
                                <xsl:call-template name="select_my_locations" />
                        </div>
                </div>
@@ -162,18 +162,16 @@
                        
                        <xsl:choose>
                                <xsl:when 
test="controls_calendar_array/child::node()">
-                               
                                <xsl:for-each select="controls_calendar_array">
                                        <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
-                               
                                        <tr>                            
-                                               <xsl:choose>
-                                               <xsl:when test="(position() mod 
2) != 1">
-                                                   <xsl:attribute 
name="class">odd</xsl:attribute>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                   <xsl:attribute 
name="class">even</xsl:attribute>
-                                               </xsl:otherwise>
+                                                       <xsl:choose>
+                                                   <xsl:when test="(position() 
mod 2) != 1">
+                                                    <xsl:attribute 
name="class">odd</xsl:attribute>
+                                                   </xsl:when>
+                                                   <xsl:otherwise>
+                                                       <xsl:attribute 
name="class">even</xsl:attribute>
+                                                   </xsl:otherwise>
                                            </xsl:choose>
                                                        <td class="title">
                                                        <span><xsl:value-of 
select="control/title"/></span>
@@ -182,31 +180,31 @@
                                                        <span><xsl:value-of 
select="control/responsibility_name"/></span>
                                                        </td>
                                                        <td class="frequency">
-                                                       <span>
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="control/repeat_interval = 1 and control/repeat_type &lt; 3">
-                                                                               
<span class="pre">Hver</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
-                                                                               
<span class="pre">Hvert</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval = 2">
-                                                                               
<span class="pre">Annenhver</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval > 2">
-                                                                               
<span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                               
-                                                               <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
-                                                       </span>
+                                       <span>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="control/repeat_interval = 1 and control/repeat_type &lt; 3">
+                                                               <span 
class="pre">Hver</span>
+                                                       </xsl:when>
+                                                       <xsl:when 
test="control/repeat_interval = 1 and control/repeat_type = 3">
+                                                               <span 
class="pre">Hvert</span>
+                                                       </xsl:when>
+                                                       <xsl:when 
test="control/repeat_interval = 2">
+                                                               <span 
class="pre">Annenhver</span>
+                                                       </xsl:when>
+                                                       <xsl:when 
test="control/repeat_interval > 2">
+                                                               <span 
class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                               
+                                               <span class="val"><xsl:value-of 
select="control/repeat_type_label"/></span>
+                                       </span>
                                                        </td>
                                                        <xsl:for-each 
select="calendar_array">
                                                                
<xsl:call-template name="check_list_status_checker" >
                                                                        
<xsl:with-param name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
                                                                
</xsl:call-template>
                                                        </xsl:for-each>
-                                       </tr>   
+                                               </tr>   
                                </xsl:for-each> 
                        </xsl:when>
                        <xsl:otherwise>
@@ -217,86 +215,87 @@
                
                <h2 class="components">Komponenter</h2>
                <xsl:choose>
-                               <xsl:when 
test="components_calendar_array/child::node()">
-               <xsl:for-each select="components_calendar_array">
+                       <xsl:when 
test="components_calendar_array/child::node()">
+                       <xsl:for-each select="components_calendar_array">
+                 <h3><xsl:value-of select="component/xml_short_desc"/></h3>
                  
-                           <h3><xsl:value-of 
select="component/xml_short_desc"/></h3>
-                 
-               <table id="calendar" class="year">
-                               <tr class="heading">
-                                               <th 
class="title"><span>Tittel</span></th>
-                                               <th 
class="assigned"><span>Tildelt</span></th>
-                                               <th 
class="frequency"><span>Frekvens</span></th>
-                                       <xsl:for-each select="//heading_array">
-                                               <th>
-                                                       <a>
-                                                               <xsl:attribute 
name="href">
-                                                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
-                                                                       
<xsl:text>&amp;year=</xsl:text>
-                                                                       
<xsl:value-of select="//current_year"/>
-                                                                       
<xsl:text>&amp;location_code=</xsl:text>
-                                                                       
<xsl:value-of select="//current_location/location_code"/>
-                                                                       
<xsl:text>&amp;month=</xsl:text>
-                                                                       
<xsl:number/>
-                                                               </xsl:attribute>
-                                                               
-                                                               <xsl:variable 
name="month_str">short_month <xsl:number/> capitalized</xsl:variable>
-                                                               <xsl:value-of 
select="php:function('lang', $month_str)" />
-                                                       </a>                    
        
-                                               </th>
+                       <table id="calendar" class="year">
+                                       <tr class="heading">
+                                                       <th 
class="title"><span>Tittel</span></th>
+                                                       <th 
class="assigned"><span>Tildelt</span></th>
+                                                       <th 
class="frequency"><span>Frekvens</span></th>
+                                               <xsl:for-each 
select="//heading_array">
+                                                       <th>
+                                                               <a>
+                                                                       
<xsl:attribute name="href">
+                                                                               
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                                                               
<xsl:text>&amp;year=</xsl:text>
+                                                                               
<xsl:value-of select="//current_year"/>
+                                                                               
<xsl:text>&amp;location_code=</xsl:text>
+                                                                               
<xsl:value-of select="//current_location/location_code"/>
+                                                                               
<xsl:text>&amp;month=</xsl:text>
+                                                                               
<xsl:number/>
+                                                                       
</xsl:attribute>
+                                                                       
+                                                                       
<xsl:variable name="month_str">short_month <xsl:number/> 
capitalized</xsl:variable>
+                                                                       
<xsl:value-of select="php:function('lang', $month_str)" />
+                                                               </a>            
                
+                                                       </th>
+                                               </xsl:for-each>
+                                       </tr>
+                       
+                               <xsl:for-each select="controls_calendar">
+                                               <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
+                                       
+                                               <tr>
+                                                       <xsl:choose>
+                                                       <xsl:when 
test="(position() mod 2) != 1">
+                                                           <xsl:attribute 
name="class">odd</xsl:attribute>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                           <xsl:attribute 
name="class">even</xsl:attribute>
+                                                       </xsl:otherwise>
+                                                   </xsl:choose>
+                                                               <td 
class="title">
+                                                               
<span><xsl:value-of select="control/title"/></span>
+                                                               </td>
+                                                               <td 
class="assigned">
+                                                               
<span><xsl:value-of select="control/responsibility_name"/></span>
+                                                               </td>
+                                                               <td 
class="frequency">
+                                                               <span>
+                                                                       
<xsl:choose>
+                                                                               
<xsl:when test="control/repeat_interval = 1 and control/repeat_type &lt; 3">
+                                                                               
        <span class="pre">Hver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
+                                                                               
        <span class="pre">Hvert</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval = 2">
+                                                                               
        <span class="pre">Annenhver</span>
+                                                                               
</xsl:when>
+                                                                               
<xsl:when test="control/repeat_interval > 2">
+                                                                               
        <span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
+                                                                               
</xsl:when>
+                                                                       
</xsl:choose>
+                                                                       
+                                                                       <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
+                                                               </span>
+                                                               </td>
+                                                               <xsl:for-each 
select="calendar_array">
+                                                                       
<xsl:call-template name="check_list_status_checker" >
+                                                                               
<xsl:with-param name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
+                                                                       
</xsl:call-template>
+                                                               </xsl:for-each>
+                                               </tr>   
                                        </xsl:for-each>
-                               </tr>
-               
-                       <xsl:for-each select="controls_calendar">
-                                       <xsl:variable 
name="control_id"><xsl:value-of select="control/id"/></xsl:variable>
-                               
-                                       <tr>
-                                               <xsl:choose>
-                                               <xsl:when test="(position() mod 
2) != 1">
-                                                   <xsl:attribute 
name="class">odd</xsl:attribute>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                   <xsl:attribute 
name="class">even</xsl:attribute>
-                                               </xsl:otherwise>
-                                           </xsl:choose>
-                                                       <td class="title">
-                                                       <span><xsl:value-of 
select="control/title"/></span>
-                                                       </td>
-                                                       <td class="assigned">
-                                                       <span><xsl:value-of 
select="control/responsibility_name"/></span>
-                                                       </td>
-                                                       <td class="frequency">
-                                                       <span>
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="control/repeat_interval = 1 and control/repeat_type &lt; 3">
-                                                                               
<span class="pre">Hver</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval = 1 and control/repeat_type = 3">
-                                                                               
<span class="pre">Hvert</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval = 2">
-                                                                               
<span class="pre">Annenhver</span>
-                                                                       
</xsl:when>
-                                                                       
<xsl:when test="control/repeat_interval > 2">
-                                                                               
<span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                               
-                                                               <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
-                                                       </span>
-                                                       </td>
-                                                       <xsl:for-each 
select="calendar_array">
-                                                               
<xsl:call-template name="check_list_status_checker" >
-                                                                       
<xsl:with-param name="location_code"><xsl:value-of 
select="//current_location/location_code"/></xsl:with-param>
-                                                               
</xsl:call-template>
-                                                       </xsl:for-each>
-                                       </tr>   
-                               </xsl:for-each>
                                </table>        
                </xsl:for-each>
                </xsl:when>
                        <xsl:otherwise>
-                               <p class="no-comp-msg">Ingen komponenter 
tilknyttet kontroll</p>
+                               <div id="calendar">
+                                       <p class="no-comp-msg">Ingen 
komponenter tilknyttet kontroll</p>
+                               </div>
                        </xsl:otherwise>
                        </xsl:choose>
        </div>

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-07-03 13:24:05 UTC (rev 9727)
@@ -4,10 +4,67 @@
 
 <div id="main_content" class="medium">
        
-               <h1>Utførelse av kontroll: <xsl:value-of 
select="control/title"/></h1>
-               <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
                
+               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
                <xsl:call-template name="check_list_tab_menu" />
+       </div>
        
                <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
                <h3 class="box_header ext">Registrer melding</h3>
@@ -15,7 +72,7 @@
                        <xsl:choose>
                                <xsl:when 
test="check_items_and_cases/child::node()">
                                
-                               <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" 
action="index.php?menuaction=controller.uicase.register_case_message" 
method="post">
+                               <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" 
action="index.php?menuaction=controller.uicase.send_case_message" method="post">
                                        <input>
                                                <xsl:attribute 
name="name">check_list_id</xsl:attribute>
                                            <xsl:attribute 
name="type">hidden</xsl:attribute>
@@ -23,6 +80,20 @@
                                                <xsl:value-of 
select="check_list/id"/>
                                            </xsl:attribute>
                                        </input>
+                                               <input>
+                                               <xsl:attribute 
name="name">location_code</xsl:attribute>
+                                           <xsl:attribute 
name="type">hidden</xsl:attribute>
+                                           <xsl:attribute name="value">
+                                                       <xsl:choose>
+                                                         <xsl:when test="type 
= 'component'">
+                                                                 <xsl:value-of 
select="component_array/location_code"/>
+                                                               </xsl:when>
+                                                               <xsl:otherwise>
+                                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                                               </xsl:otherwise>
+                                                       </xsl:choose>
+                                         </xsl:attribute>
+                                       </input>
                                        
                                        <!-- === TITLE === -->
                                    <div class="row">
@@ -30,28 +101,6 @@
                                                <input name="message_title" 
type="text" class="required" />
                                        </div>
                                                                        
-                                       <!-- ==================  BYGG  
===================== -->
-                                       <div class="row">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="buildings_array/child::node()">
-                                                               
<label>Bygg:</label>
-                                                               <select 
id="building_id" name="building_id" class="required">
-                                                                               
<option value="0">
-                                                                               
        Velg bygning
-                                                                               
</option>
-                                                                               
<xsl:for-each select="buildings_array">
-                                                                               
        <option value="{id}">
-                                                                               
                <xsl:value-of disable-output-escaping="yes" select="name"/>
-                                                                               
        </option>
-                                                                               
</xsl:for-each>
-                                                                       
</select>
-                                                       </xsl:when>
-                                                       <xsl:otherwise>
-                                                               
<label>Bygg:</label> <xsl:value-of select="building/loc1_name"/>        
-                                                       </xsl:otherwise>
-                                               </xsl:choose>
-                                       </div>
-                                       
                                        <!-- === CATEGORY === -->
                                        <div class="row">
                                                <label>Kategori:</label>

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-07-03 13:24:05 UTC (rev 9727)
@@ -4,11 +4,68 @@
 
 <div id="main_content" class="medium">
        
-       <h1>Utførelse av kontroll: <xsl:value-of select="control/title"/></h1>
-       <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
+               
+               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
+               <xsl:call-template name="check_list_tab_menu" />
+       </div>
        
-       <xsl:call-template name="check_list_tab_menu" />
-       
        <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
        <h3 class="box_header ext">Melding registrert</h3>
        <div id="caseMessage" class="box ext">
@@ -21,12 +78,7 @@
                                </xsl:attribute>
                        Vis melding
                        </a>
-               
-                       <!-- ===  BYGG  === -->
-                       <div class="row">
-                               <label>Bygg:</label><span><xsl:value-of 
select="location_array/loc1_name"/></span>
-                       </div>
-                       
+                               
                    <!-- === TITLE === -->
                    <div class="row">                           
                                <label>Tittel på 
melding:</label><span><xsl:value-of select="message_ticket/subject"/></span>

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-07-03 13:24:05 UTC (rev 9727)
@@ -25,9 +25,64 @@
 <!-- ==================  ADD CHECKLIST  ========================= -->
 
 <div id="main_content" class="medium">
-       
-       <h1>Kontroll: <xsl:value-of select="control/title"/></h1>
-       <h2>Bygg: <xsl:value-of select="location_array/loc1_name"/></h2>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
+       </div>
                
        <div id="check_list_menu">
                <a href="#" class="active">

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
        2012-07-03 13:24:05 UTC (rev 9727)
@@ -34,9 +34,63 @@
        
        <!-- ==================  EDIT CHECKLIST  ========================= -->
        
-       <div>
-               <h1>Kontroll: <xsl:value-of select="control/title"/></h1>
-               <h2>Bygg: <xsl:value-of select="location_array/loc1_name"/></h2>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
                
                <!-- ==================  CHECKLIST TAB MENU  
===================== -->
                <xsl:call-template name="check_list_tab_menu">
@@ -47,9 +101,10 @@
        <!-- ==================  CHECKLIST DETAILS  ===================== -->
        <div id="check_list_details">
                <h3 class="box_header">Sjekklistedetaljer</h3>
-                       <form id="frm_update_check_list" 
action="index.php?menuaction=controller.uicheck_list.update_check_list" 
method="post"> 
+                       <form id="frm_update_check_list" 
action="index.php?menuaction=controller.uicheck_list.save_check_list" 
method="post">   
                        <xsl:variable name="check_list_id"><xsl:value-of 
select="check_list/id"/></xsl:variable>
                        <input id="check_list_id" type="hidden" 
name="check_list_id" value="{$check_list_id}" />
+                       <input type="hidden" name="phpgw_return_as" 
value="json" />
                        
                        <fieldset class="col_1">
                        <div class="row">

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-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-07-03 13:24:05 UTC (rev 9727)
@@ -4,10 +4,69 @@
 
 <div id="main_content" class="medium">
        
-       <h1>Utførelse av kontroll: <xsl:value-of select="control/title"/></h1>
-       <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
+               
+               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
+               <xsl:call-template name="check_list_tab_menu" />
+       </div>
+               
        
-       <xsl:call-template name="check_list_tab_menu" />
 
        <div id="view_cases">
 

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
      2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_cases_for_check_list.xsl
      2012-07-03 13:24:05 UTC (rev 9727)
@@ -60,13 +60,70 @@
                }
        </script>
                
-               <h1>Utførelse av kontroll: <xsl:value-of 
select="control/title"/></h1>
-               <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
+               <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
                
+               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
                <xsl:call-template name="check_list_tab_menu">
                        <xsl:with-param 
name="active_tab">view_cases</xsl:with-param>
                </xsl:call-template>
-               
+       </div>
+       
                <a id="view_open_cases">
                        <xsl:attribute name="href">
                                
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
      2012-07-03 13:24:05 UTC (rev 9727)
@@ -67,12 +67,69 @@
                                
        </script>
                
-       <h1>Utførelse av kontroll: <xsl:value-of select="control/title"/></h1>
-       <h2>Sjekkliste for: <xsl:value-of 
select="location_array/loc1_name"/></h2>
-       
-       <xsl:call-template name="check_list_tab_menu">
-               <xsl:with-param 
name="active_tab">view_control_info</xsl:with-param>
-       </xsl:call-template>
+       <div id="check-list-heading">
+               <div class="box-1">
+                       <h1>Kontroll: <xsl:value-of 
select="control/title"/></h1>
+                       <xsl:choose>
+                               <xsl:when test="type = 'component'">
+                                       <h2><xsl:value-of 
select="component_array/xml_short_desc"/></h2>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:choose>
+                                               <xsl:when test="location_level 
= 1">
+                                                       <h2>Eiendom: 
<xsl:value-of select="location_array/loc1_name"/></h2>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                               <h2>Bygg: 
<xsl:value-of select="location_array/loc2_name"/></h2>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               <div class="box-2 select-box">
+                       <a>
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_year</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (år)
+                       </a>
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uicalendar.view_calendar_for_month</xsl:text>
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrolplan for bygg/eiendom (måned)
+                       </a>
+               </div>
+               
+               <!-- ==================  CHECKLIST TAB MENU  
===================== -->
+               <xsl:call-template name="check_list_tab_menu">
+                       <xsl:with-param 
name="active_tab">view_control_info</xsl:with-param>
+               </xsl:call-template>
+       </div>
                                
        <div class="tab_menu">
                <a id="view_control_details" class="active">

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
 2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item.xsl
 2012-07-03 13:24:05 UTC (rev 9727)
@@ -81,25 +81,29 @@
                                                                <xsl:choose>
                                                                <xsl:when 
test="control_item/type = ''">
                                                                                
<xsl:for-each select="control_item/control_item_types">
-                                                                               
        <xsl:variable name="classes">
                                                                                
                <xsl:choose>
                                                                                
                        <xsl:when test="position() = 1">
-                                                                               
                                btn active
+                                                                               
                                <div class="control_item_type">
+                                                                               
                                        <xsl:variable 
name="lang_type"><xsl:value-of select="." /></xsl:variable>
+                                                                               
                                        <xsl:variable 
name="current_control_item_type"><xsl:value-of select="." /></xsl:variable>
+                                                                               
                                        
+                                                                               
                                        <input class="btn active" type="button" 
value="Velg" />
+                                                                               
                                        <input type="radio" 
name="control_item_type" value="{$current_control_item_type}" 
checked="checked"/>
+                                                                               
                                        <xsl:value-of 
select="php:function('lang', $lang_type)" />
+                                                                               
                                </div>
                                                                                
                        </xsl:when>
                                                                                
                        <xsl:otherwise>
-                                                                               
                                btn
+                                                                               
                                <div class="control_item_type">
+                                                                               
                                        <xsl:variable 
name="lang_type"><xsl:value-of select="." /></xsl:variable>
+                                                                               
                                        <xsl:variable 
name="current_control_item_type"><xsl:value-of select="." /></xsl:variable>
+                                                                               
                                        
+                                                                               
                                        <input class="btn" type="button" 
value="Velg" />
+                                                                               
                                        <input type="radio" 
name="control_item_type" value="{$current_control_item_type}" />
+                                                                               
                                        <xsl:value-of 
select="php:function('lang', $lang_type)" />
+                                                                               
                                </div>
                                                                                
                        </xsl:otherwise>
                                                                                
                </xsl:choose>
-                                                                               
        </xsl:variable>
-                                                                               
-                                                                               
<div class="control_item_type">
-                                                                               
        <xsl:variable name="lang_type"><xsl:value-of select="." 
/></xsl:variable>
-                                                                               
        <xsl:variable name="current_control_item_type"><xsl:value-of select="." 
/></xsl:variable>
-                                                                               
        
-                                                                               
        <input class="{$classes}" type="button" value="Velg" />
-                                                                               
        <input type="radio" name="control_item_type" 
value="{$current_control_item_type}" />
-                                                                               
        <xsl:value-of select="php:function('lang', $lang_type)" />
-                                                                               
</div>
+                                                                       
                                                                        
</xsl:for-each>
                                                                </xsl:when>
                                                                <xsl:otherwise>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_location/control_locations.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_location/control_locations.xsl
        2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_location/control_locations.xsl
        2012-07-03 13:24:05 UTC (rev 9727)
@@ -1,7 +1,7 @@
 <!-- $Id$ -->
 <xsl:template name="control_locations" xmlns:php="http://php.net/xsl";>
 
-<div class="yui-content">
+<div class="content-wrp">
        <div>
                  
           <!-- ===========================  CHOOSE CONTROL LOCATIONS  
=============================== -->

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_component.xsl
    2012-07-03 13:24:05 UTC (rev 9727)
@@ -32,7 +32,7 @@
 </xsl:template>
 
 <xsl:template name="register_control_to_component" 
xmlns:php="http://php.net/xsl";>
-       <div class="yui-content">
+       <div class="content-wrp">
                <div id="invoice-layout">
                                <div class="header">
                                        <h2><xsl:value-of 
select="php:function('lang', 'invoice')"/></h2>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
     2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_location/register_control_to_location.xsl
     2012-07-03 13:24:05 UTC (rev 9727)
@@ -20,7 +20,7 @@
        <!-- IMPORTANT!!! Loads YUI javascript -->
        <xsl:call-template name="common"/>
 
-       <div class="yui-content">
+       <div class="content-wrp">
                <div>
                        <xsl:call-template name="yui_phpgw_i18n"/>
                        <xsl:call-template name="control_filters" />

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
       2012-07-03 13:11:50 UTC (rev 9726)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_location/view_locations_for_control.xsl
       2012-07-03 13:24:05 UTC (rev 9727)
@@ -21,7 +21,7 @@
        <!-- IMPORTANT!!! Loads YUI javascript -->
        <xsl:call-template name="common"/>
 
-       <div class="yui-content">
+       <div class="content-wrp">
                <div id="control_details">
                        <div id="choose_control">
                                

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-07-03 13:24:05 UTC (rev 9727)
@@ -655,6 +655,10 @@
        padding: 5px;
 }
 
+#control_items form{
+       margin-bottom: 20px;
+}
+
 /* =======================================  DRAG LIST  
========================================= */
 
 .drag_group{
@@ -786,17 +790,7 @@
 }
 
 /* =======================================  GENERAL CLASSES  
========================================= */
-.content-wrp {
-  background: none repeat scroll 0 0 #EDF5FF;
-  border: 1px solid #eee;
-  margin-bottom: 20px;
-  padding: 15px;
-}
 
-.content-wrp .yui-skin-sam .yui-dt table {
-    border: 1px solid #CCCCCC;
-}
-
 .box {
     background: none repeat scroll 0 0 #EDF5FF;
     border: 1px solid #eee;
@@ -879,12 +873,16 @@
 }
 
 .content-wrp {
-  background: none repeat scroll 0 0 #EDF5FF;
-  border: 1px solid #DBE5EF;
-  margin-top: 1em;
-  padding: 0;
+    background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #DEE1E4;
+    margin-top: 1em;
+    padding: 0;
 }
 
+.content-wrp .yui-skin-sam .yui-dt table {
+    border: 1px solid #CCCCCC;
+}
+
 /* =======================================  CHECK LIST DETAILS 
========================================= */
 
 input.id {
@@ -900,7 +898,22 @@
 }
 
 /* =======================================  CHECK LIST  
========================================= */
+#check-list-heading .box-1 {
+       float:left; 
+       width:71%;
+}
 
+#check-list-heading .box-2 {
+       float:right; 
+       width:25%;
+}
+
+#check-list-heading .box-2 a{
+       font-weight: normal;
+  padding: 0 0 5px;
+  text-align: center;
+}
+               
 .check_list li div {
     float: left;
     margin: 5px;
@@ -1088,7 +1101,7 @@
 #control_plan h2 {
   background: none repeat scroll 0 0 #FFFFFF;
   color: #000000;
-  display: inline-block;
+  float: left;
   font-size: 23px;
   padding: 0.2em 0.5em;
 }
@@ -1108,8 +1121,9 @@
 }
 
 #cal_wrp h3 {
-    font-size: 1.4em;
-    margin-bottom: 5px;
+  clear: both;
+  font-size: 1.4em;
+  margin-bottom: 5px;
 }
 
 /* =============================  SEARCH LOCATION BOX  ======================= 
*/
@@ -1174,6 +1188,10 @@
   text-align: justify; 
 }
 
+.select-box a.last{
+  padding: 0;
+}
+
 #choose-loc .btn {
     display: inline-block;
     font-size: 0.9em;
@@ -1211,6 +1229,7 @@
 }
 
 #calendar {
+  clear: both;
   table-layout: fixed;
   width: 100%;
 }
@@ -1556,9 +1575,11 @@
 
 /* ======================== CHECK LIST MENU ========================== */
 #check_list_menu {
+    clear: both;
     margin: 0 0 20px;
     overflow: hidden;
 }
+
 #check_list_menu a {
     background: none repeat scroll 0 0 #F4EDE3;
     border: 1px solid #EDE4D8;
@@ -1572,16 +1593,20 @@
     text-decoration: none;
     width: 185px;
 }
+
 #check_list_menu a.active {
        background: none repeat scroll 0 0 #CAE3FB;
     border: 1px solid #CAE3FB;
 }
+
 #check_list_menu .left_btns {
     float: left;
 }
+
 #check_list_menu .right_btns {
     float: right;
 }
+
 #check_list_menu .right_btns a {
     background: none repeat scroll 0 0 #F57056;
     border-color: #EE836F -moz-use-text-color #CB563F;

Modified: branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2012-07-03 13:24:05 UTC (rev 9727)
@@ -531,7 +531,7 @@
                        $config->read();
                        $tax = 1+($config->config_data['fm_tax'])/100;
                        $workorder['calculation']       = 
$workorder['calculation'] * $tax;
-                       $workorder['actual_cost']       = 
$workorder['act_mtrl_cost'] + $workorder['act_vendor_cost'];
+       //              $workorder['actual_cost']       = 
$workorder['act_mtrl_cost'] + $workorder['act_vendor_cost'];
 
                        $vfs = CreateObject('phpgwapi.vfs');
                        $vfs->override_acl = 1;

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-07-03 13:24:05 UTC (rev 9727)
@@ -866,9 +866,10 @@
                                . " GROUP BY fm_b_account.{$b_account_field}, 
district_id, dimb, mvakode";
 
                        $this->db->query($sql,__LINE__,__FILE__);
-
+//_debug_array($sql);
                        while ($this->db->next_record())
                        {
+//continue;
                                $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
                                $_actual_cost = 
round($this->db->f('actual_cost')/$_taxfactor);
                                $sum_actual_cost += $_actual_cost;
@@ -895,6 +896,7 @@
 
                        while ($this->db->next_record())
                        {
+//continue;
                                $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
                                $_actual_cost = 
round($this->db->f('actual_cost')/$_taxfactor);
                                $sum_actual_cost += $_actual_cost;

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-07-03 13:24:05 UTC (rev 9727)
@@ -1610,6 +1610,52 @@
                        return  $values;
                }
 
+               public function get_short_description($data = array() )
+               {
+                       $location_id    = (int)$data['location_id'];
+                       $id                             = (int)$data['id'];
+                       
+                       if(!$location_id && !$id)
+                       {
+                               throw new 
Exception("property_soentity::get_short_description() - Missing entity 
information info in input");   
+                       }
+
+                       $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                       $filters = array("short_description" => "IS NOT NULL");
+                       $attributes['attributes'] = 
$GLOBALS['phpgw']->custom_fields->find($system_location['appname'],$system_location['location'],
 0, '', 'ASC', 'short_description', true, true,$filters);
+
+                       $params = array
+                       (
+                               'location_id'   => $location_id,
+                               'id'                    => $id
+                       );
+
+                       if( substr($system_location['location'], 1, 6) == 
'entity' )
+                       {
+                               $type                                   = 
explode('.',$system_location['location']);
+                               $params['entity_id']    = $type[2];
+                               $params['cat_id']               = $type[3];
+                       }
+                       else
+                       {
+                               throw new 
Exception("property_soentity::get_short_description() - entity not found");   
+                       }
+
+                       $prop_array = $this->read_single($params, $attributes);
+
+                       $_short_description = array();
+                       foreach ($prop_array['attributes'] as $attribute)
+                       {
+                               $short_description[] = 
"{$attribute['input_text']}: {$attribute['value']}";
+                       }
+                       
+                       $short_description = implode(', ', $short_description);
+
+                       return $short_description;
+               }
+
+
                function check_entity($entity_id,$cat_id,$num)
                {
                        $table = "fm_{$this->type}_{$entity_id}_{$cat_id}";

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2012-07-03 13:24:05 UTC (rev 9727)
@@ -197,6 +197,7 @@
                        
if($GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                        {
                                $sql_count = 'SELECT count(bilagsnr) as cnt, 
sum(godkjentbelop) AS sum_amount FROM (SELECT DISTINCT bilagsnr, 
sum(godkjentbelop) as godkjentbelop '. substr($sql2,strripos($sql2,'FROM')) .' 
GROUP BY bilagsnr) AS t';
+               //_debug_array($sql_count);
                                $this->db->query($sql_count,__LINE__,__FILE__);
                                $this->db->next_record();
                                $this->total_records            = 
$this->db->f('cnt');

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-07-03 13:24:05 UTC (rev 9727)
@@ -231,7 +231,7 @@
                                $cols_return[]                          = 
'budget';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'budget';
-                               $uicols['descr'][]                      = 
lang('Project budget');
+                               $uicols['descr'][]                      = 
lang('budget');
                                $uicols['statustext'][]         = lang('Project 
budget');
                                $uicols['exchange'][]           = false;
                                $uicols['align'][]                      = '';
@@ -244,7 +244,7 @@
 //                             $cols_return[] = 'combined_cost';
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'combined_cost';
-                               $uicols['descr'][]                      = 
lang('Sum workorder');
+                               $uicols['descr'][]                      = 
lang('sum orders');
                                $uicols['statustext'][]         = lang('Cost - 
either budget or calculation');
                                $uicols['exchange'][]           = false;
                                $uicols['align'][]                      = '';
@@ -266,18 +266,18 @@
 
 //                             $cols .= ',planned_cost';
 //                             $cols_return[] = 'planned_cost';
-/*
+
                                $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 
'planned_cost';
-                               $uicols['descr'][]                      = 
lang('planned cost');
-                               $uicols['statustext'][]         = lang('ordered 
minus paid');
+                               $uicols['name'][]                       = 
'diff';
+                               $uicols['descr'][]                      = 
lang('difference');
+                               $uicols['statustext'][]         = 
lang('difference');
                                $uicols['exchange'][]           = false;
                                $uicols['align'][]                      = '';
                                $uicols['datatype'][]           = '';
                                $uicols['formatter'][]          = 
'myFormatCount2';
                                $uicols['classname'][]          = 'rightClasss';
                                $uicols['sortable'][]           = '';
-*/
+
                                $cols.= ",$entity_table.user_id";
 
 //                             $cols .= ',sum(fm_workorder.billable_hours) as 
billable_hours';
@@ -677,15 +677,15 @@
                                                        $_sum = 0;
                                                        $closed = true;
                                                }
-                                               else 
if($this->db->f('contract_sum') > 0)
+                                               else 
if(abs($this->db->f('contract_sum')) > 0)
                                                {
                                                        $_sum = 
$this->db->f('contract_sum') * ( 1 + ((int)$this->db->f('addition')/100));
                                                }
-                                               else 
if($this->db->f('calculation') > 0)
+                                               else 
if(abs($this->db->f('calculation')) > 0)
                                                {
                                                        $_sum = 
$this->db->f('calculation');
                                                }
-                                               else if($this->db->f('budget') 
> 0)
+                                               else 
if(abs($this->db->f('budget')) > 0)
                                                {
                                                        $_sum = 
$this->db->f('budget');
                                                }
@@ -722,11 +722,24 @@
                                                $project['actual_cost']         
+= $_actual_cost;
                                        }
 
-                                       if($project['combined_cost'] < 0)
+                                       if($project['budget'] > 0)
                                        {
-                                               $project['combined_cost'] = 0;
+                                               if($project['combined_cost'] < 
0)
+                                               {
+                                                       
$project['combined_cost'] = 0;
+                                               }
                                        }
+                                       else
+                                       {
+                                               if($project['combined_cost'] > 
0)
+                                               {
+                                                       
$project['combined_cost'] = 0;
+                                               }
+                                       }
+
+                                       $project['diff'] =  $project['budget'] 
- $project['combined_cost'] - $project['actual_cost'];
                                }
+
                                unset($project);
 
                                $_datatype = array();
@@ -1543,23 +1556,23 @@
                        $sql = "SELECT id AS order_id FROM fm_workorder WHERE 
project_id = {$project_id}";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $orders = array();
+                       $_orders = array();
                        while ($this->db->next_record())
                        {
-                               $orders[] = $this->db->f('order_id');
+                               $_orders[] = $this->db->f('order_id');
                        }
 
-                       $actual_cost = array();
-                       foreach($orders as $order)
+                       foreach($_orders as $_order)
                        {
-                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilagoverf WHERE pmwrkord_code = '{$order}' 
GROUP BY periode ORDER BY periode ASC ";
+                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilagoverf WHERE pmwrkord_code = '{$_order}' 
GROUP BY periode ORDER BY periode ASC ";
                                $this->db->query($sql,__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
                                        $year = substr( 
$this->db->f('periode'), 0, 4 );
-                                       $cost_info[$year]['actual_cost'] += 
$this->db->f('actual_cost');
+                                       $orders[$year][$_order]['actual_cost'] 
+= $this->db->f('actual_cost');
                                }
 
-                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilag WHERE pmwrkord_code = '{$order}' GROUP BY 
periode ORDER BY periode ASC ";
+                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilag WHERE pmwrkord_code = '{$_order}' GROUP 
BY periode ORDER BY periode ASC ";
                                $this->db->query($sql,__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
@@ -1568,7 +1581,7 @@
                                        {
                                                $year = date('Y');
                                        }
-                                       $cost_info[$year]['actual_cost'] += 
$this->db->f('actual_cost');
+                                       $orders[$year][$_order]['actual_cost'] 
+= $this->db->f('actual_cost');
                                }
                        }
 
@@ -1584,20 +1597,19 @@
                        $this->db->query($sql,__LINE__,__FILE__);
 
 
-                       $orders = array();
                        while ($this->db->next_record())
                        {
-                               $year = $this->db->f('year');
+                               $year = date('Y');//$this->db->f('year');
 
-                               if($this->db->f('contract_sum') > 0)
+                               if(abs($this->db->f('contract_sum')) > 0)
                                {
                                        $_amount = $this->db->f('contract_sum') 
* ( 1 + ((int)$this->db->f('addition')/100));
                                }
-                               else if($this->db->f('calculation') > 0)
+                               else if(abs($this->db->f('calculation')) > 0)
                                {
                                        $_amount = $this->db->f('calculation') 
* $tax;
                                }
-                               else if($this->db->f('budget') > 0)
+                               else if(abs($this->db->f('budget')) > 0)
                                {
                                        $_amount = $this->db->f('budget');
                                }
@@ -1606,79 +1618,98 @@
                                        $_amount = 0;
                                }
 
-                               $orders[] = array
-                               (
-                                       'order_id'      => $this->db->f('id'),
-                                       'year'          => $year,
-                                       'amount'        => $_amount
-                               );
+                               $orders[$year][$this->db->f('id')]['amount'] = 
$_amount;
                        }
 
-                       foreach ($orders as $order)
-                       {
-                               $cost_info[$year]['sum_orders'] += 
$order['amount'];
-                               $sql = "SELECT godkjentbelop as amount FROM 
fm_ecobilagoverf WHERE pmwrkord_code = '{$order['order_id']}'";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               while ($this->db->next_record())
-                               {
-                                       $cost_info[$year]['sum_orders'] -= 
$this->db->f('amount');
-                               }
 
-                               $sql = "SELECT godkjentbelop as amount FROM 
fm_ecobilag WHERE pmwrkord_code = '{$order['order_id']}'";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               while ($this->db->next_record())
-                               {
-                                       $cost_info[$year]['sum_orders'] -= 
$this->db->f('amount');
-                               }
-                       }
-
                        $sort_year = array();
                        $values = array();
 
                        $sql = "SELECT * FROM fm_project_budget WHERE 
project_id = {$project_id}";
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $project_budget = array();
                        while ($this->db->next_record())
                        {
-                               $year = $this->db->f('year');
-                               $_actual_cost = 
isset($cost_info[$year]['actual_cost']) &&  $cost_info[$year]['actual_cost'] ? 
$cost_info[$year]['actual_cost'] : 0;
-                               $_sum_orders = 
isset($cost_info[$year]['sum_orders']) &&  $cost_info[$year]['sum_orders'] > 0 
? $cost_info[$year]['sum_orders'] : 0;
-                               if(isset($cost_info[$year]))
+                               $project_budget[$this->db->f('year')] = 
(int)$this->db->f('budget');
+                       }
+                       
+                       foreach ($project_budget as $year => $budget)
+                       {
+                               if(isset($orders[$year]))
                                {
-                                       unset($cost_info[$year]);
+                                       
+                                       $_sum_orders = 0;
+                                       $_actual_cost= 0;
+
+                                       foreach ($orders[$year] as $order_id => 
$order)
+                                       {
+                                               $_sum_orders += 
$order['amount'];
+                                               $_sum_orders -= 
$order['actual_cost'];
+
+                                               if($budget > 0)
+                                               {
+                                                       $_sum_orders = 
$_sum_orders > 0 ? $_sum_orders : 0;
+                                               }
+                                               else // income
+                                               {
+                                                       $_sum_orders = 
$_sum_orders < 0 ? $_sum_orders : 0;                                            
 
+                                               }
+                                               
+                                               $_actual_cost += 
$order['actual_cost'];
+                                       }
+
+                                       unset($orders[$year]);
+
                                }
+                               else
+                               {
+                                       $_sum_orders = 0;
+                                       $_actual_cost = 0;
+                               }
 
-                               $sort_year[] = $year;
                                $values[] = array
                                (
                                        'project_id'            => $project_id,
-                                       'year'                          => 
$this->db->f('year'),
-                                       'budget'                        => 
(int)$this->db->f('budget'),
+                                       'year'                          => 
$year,
+                                       'budget'                        => 
$budget,
                                        'sum_orders'            => $_sum_orders,
                                        'actual_cost'           => 
$_actual_cost,
-                                       'user_id'                       => 
$this->db->f('user_id'),
-                                       'entry_date'            => 
$this->db->f('entry_date'),
-                                       'modified_date'         => 
$this->db->f('modified_date')
                                );
+
+                               $sort_year[] = $year;
                        }
 
-                       if($cost_info && count($cost_info))
+                       unset($order);
+                       unset($order_id);
+                       unset($year);
+
+                       reset($orders);
+
+                       //remaining
+                       foreach ($orders as $year => $_orders)
                        {
-                               foreach($cost_info as $year => $cost_info)
+                               $_sum_orders = 0;
+                               $_actual_cost = 0;
+
+                               foreach ($_orders as $order_id => $order)
                                {
-                                       $sort_year[] = $year;
-                                       $values[] = array
-                                       (
-                                               'project_id'            => 
$project_id,
-                                               'year'                          
=> $year ,
-                                               'budget'                        
=> 0,
-                                               'sum_orders'            => 
isset($cost_info['sum_orders']) && $cost_info['sum_orders'] > 0 ? 
$cost_info['sum_orders'] : 0,
-                                               'actual_cost'           => 
isset($cost_info['actual_cost']) && $cost_info['actual_cost'] ? 
$cost_info['actual_cost'] : 0,
-                                               'user_id'                       
=> 0,
-                                               'entry_date'            => 0,
-                                               'modified_date'         => 0
-                                       );
+                                       $_sum_orders += $order['amount'];
+                                       $_sum_orders -= $order['actual_cost'];
+                                       $_sum_orders = $_sum_orders > 0 ? 
$_sum_orders : 0;
+                                       $_actual_cost += $order['actual_cost'];
                                }
+
+                               $values[] = array
+                               (
+                                       'project_id'            => $project_id,
+                                       'year'                          => 
$year,
+                                       'budget'                        => 0,
+                                       'sum_orders'            => $_sum_orders,
+                                       'actual_cost'           => 
$_actual_cost,
+                               );
+
+                               $sort_year[] = $year;
                        }
 
                        if($values)
@@ -1686,6 +1717,13 @@
                                array_multisort($sort_year, SORT_ASC, $values);
                        }
 
+
+                       foreach ($values as &$entry)
+                       {
+                               $entry['diff'] = $entry['budget'] - 
$entry['sum_orders'] - $entry['actual_cost'];
+                       }
+
+//_debug_array( $values);die();
                        return $values;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2012-07-03 13:24:05 UTC (rev 9727)
@@ -326,6 +326,17 @@
                                $uicols['classname'][]          = 'rightClasss';
                                $uicols['sortable'][]           = true;
 
+                               $uicols['input_type'][]         = 'text';
+                               $uicols['name'][]                       = 
'diff';
+                               $uicols['descr'][]                      = 
lang('difference');
+                               $uicols['statustext'][]         = 
lang('difference');
+                               $uicols['exchange'][]           = false;
+                               $uicols['align'][]                      = '';
+                               $uicols['datatype'][]           = '';
+                               $uicols['formatter'][]          = 
'myFormatCount2';
+                               $uicols['classname'][]          = 'rightClasss';
+                               $uicols['sortable'][]           = '';
+
                                $joinmethod .= " {$this->left_join} fm_vendor 
ON (fm_workorder.vendor_id = fm_vendor.id))";
                                $paranthesis .='(';
 
@@ -700,6 +711,8 @@
                                {
                                        $workorder[$cols_return[$i]] = 
$this->db->f($cols_return[$i]);
                                }
+                               $workorder['budget'] = 
$workorder['combined_cost'];
+                               $workorder['combined_cost'] = 
$workorder['combined_cost'] - $workorder['actual_cost'];
                                $workorder['grants'] = 
(int)$this->grants[$this->db->f('project_owner')];
 
                                $location_code= $this->db->f('location_code');
@@ -723,10 +736,24 @@
                                        $workorder['actual_cost']       += 
$_actual_cost;
                                }
 
-                               if($workorder['combined_cost'] < 0)
+
+
+                               if($workorder['budget'] > 0)
                                {
-                                       $workorder['combined_cost'] = 0;
+                                       if($workorder['combined_cost'] < 0)
+                                       {
+                                               $workorder['combined_cost'] = 0;
+                                       }
                                }
+                               else
+                               {
+                                       if($workorder['combined_cost'] > 0)
+                                       {
+                                               $workorder['combined_cost'] = 0;
+                                       }
+                               }
+
+                               $workorder['diff'] =  $workorder['budget'] - 
$workorder['combined_cost'] - $workorder['actual_cost'];
                        }
 
                        return $workorder_list;
@@ -794,6 +821,7 @@
                                                'contract_sum'                  
=> $this->db->f('contract_sum'),
                                                'approved'                      
        => $this->db->f('approved'),
                                                'mail_recipients'               
=> explode(',', trim($this->db->f('mail_recipients'),',')),
+                                               'actual_cost'                   
=> $this->db->f('actual_cost')
                                        );
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-07-03 13:24:05 UTC (rev 9727)
@@ -1712,6 +1712,7 @@
                                                                                
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
                                                                                
                                array('key' => 'sum_orders','label'=>lang('sum 
orders'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
                                                                                
                                array('key' => 
'actual_cost','label'=>lang('actual 
cost'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'diff','label'=>lang('difference'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
                                                                                
                                array('key' => 
'delete_year','label'=>lang('Delete'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
                                );
 

Modified: branches/Version-1_0-branch/property/js/yahoo/project.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-07-03 13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-07-03 13:24:05 UTC (rev 9727)
@@ -96,6 +96,7 @@
                tmp_sum1 = getTotalSum('budget',0,paginator,datatable);
                tmp_sum2 = getTotalSum('sum_orders',0,paginator,datatable);
                tmp_sum3 = getTotalSum('actual_cost',2,paginator,datatable);
+               tmp_sum4 = getTotalSum('diff',2,paginator,datatable);
 
                if(typeof(tableYUI0)=='undefined')
                {
@@ -114,6 +115,7 @@
                td_sum(tmp_sum1);
                td_sum(tmp_sum2);
                td_sum(tmp_sum3);
+               td_sum(tmp_sum4);
                td_empty(1);
 
                myfoot = tableYUI0.createTFoot();

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2012-07-03 
13:11:50 UTC (rev 9726)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2012-07-03 
13:24:05 UTC (rev 9727)
@@ -513,7 +513,7 @@
 deviation has been added       property        no      Avvik er lagt til
 deviation has been edited      property        no      Avvik er rettet
 deviation id   property        no      Avvik ID
-difference     property        no      Differanse
+difference     property        no      Rest
 dim a  property        no      Dim A
 dim a is missing       property        no      Dim A mangler
 dima is missing from sub invoice in:   property        no      Dim A mangler 
fra underbilag i :
@@ -1666,7 +1666,7 @@
 subject has been updated       property        no      Overskrift er oppdatert
 submit the search string       property        no      Send søkestrengen
 sum estimated cost     property        no      Sum estimert kostnad
-sum orders     property        no      Forpliktet, ikke betalt
+sum orders     property        no      Forpliktet
 sum    property        no      Sum
 sum calculation        property        no      Sum kalkulasjon
 sum deviation  property        no      Sum avvik




reply via email to

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