fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8555] Merge 8551:8554 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8555] Merge 8551:8554 from trunk
Date: Wed, 11 Jan 2012 10:01:53 +0000

Revision: 8555
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8555
Author:   sigurdne
Date:     2012-01-11 10:01:53 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Merge 8551:8554 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.socase.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.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/model/class.check_item_case.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    
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/register_case.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_errors_for_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/property/inc/export/default/Basware_X114

Added Paths:
-----------
    
branches/Version-1_0-branch/controller/templates/base/check_list/cases_tab_menu.xsl

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
   + 
/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

Modified: branches/Version-1_0-branch/controller/inc/class.socase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socase.inc.php     
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/inc/class.socase.inc.php     
2012-01-11 10:01:53 UTC (rev 8555)
@@ -53,6 +53,34 @@
 
                function populate(int $object_id, &$object){}
 
+               public function get_single($case_id)
+               {
+                       $sql = "SELECT * FROM controller_check_item_case "; 
+                       $sql .= "WHERE id = $case_id";
+                       
+
+                       $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+                       if($this->db->next_record()) {
+                               $case = new 
controller_check_item_case($this->unmarshal($this->db->f('id', true), 'int'));
+                               
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id', true), 
'int'));
+                               
$case->set_location_id($this->unmarshal($this->db->f('location_id', true), 
'int'));
+                               
$case->set_location_item_id($this->unmarshal($this->db->f('location_item_id', 
true), 'int'));
+                               
$case->set_descr($this->unmarshal($this->db->f('descr', true), 'string'));
+                               
$case->set_user_id($this->unmarshal($this->db->f('user_id', true), 'int'));     
+                               
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
+                               
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
+                               
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
+                                       
+                               return $case;
+                       }
+                       else
+                       {
+                               return null;
+                       }
+               }
+               
+               
                function add(&$case)
                {
                        $cols = array(
@@ -72,7 +100,7 @@
                                $case->get_status(),
                                $this->marshal($case->get_location_id(), 'int'),
                                $this->marshal($case->get_location_item_id(), 
'int'),
-                               $this->marshal($case->get_descr(), 'int'),
+                               $this->marshal($case->get_descr(), 'string'),
                                $this->marshal($case->get_user_id(), 'int'),
                                $this->marshal($case->get_entry_date(), 'int'),
                                $this->marshal($case->get_modified_date(), 
'int'),

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-01-11 10:01:53 UTC (rev 8555)
@@ -31,6 +31,7 @@
        phpgw::import_class('controller.socommon');
 
        include_class('controller', 'check_item', 'inc/model/');
+       include_class('controller', 'check_item_case', 'inc/model/');
 
        class controller_socheck_item extends controller_socommon
        {
@@ -212,11 +213,23 @@
                        return $check_items_array;
                }
                
-               public function get_check_items_and_cases($check_list_id, 
$returnType = "object"){
-                       $sql  = "SELECT ci.id as ci_id, ci.status, 
control_item_id, ci.comment, ci.measurement, check_list_id, cic.id as cic_id, 
cic.* "; 
+               public function get_check_items_and_cases($check_list_id, 
$status = "open", $messageStatus = null, $returnType = "return_object"){
+                       $sql  = "SELECT ci.id as ci_id, ci.status, 
control_item_id, ci.comment, ci.measurement, check_list_id, cic.id as cic_id, 
cic.*, ";
+                       $sql .= "coi.id as coi_id, coi.* ";
                        $sql .= "FROM controller_check_item ci "; 
+                       $sql .= "LEFT JOIN controller_control_item as coi ON 
ci.control_item_id = coi.id ";
                        $sql .= "LEFT JOIN controller_check_item_case as cic ON 
ci.id = cic.check_item_id ";
                        $sql .= "WHERE ci.check_list_id = $check_list_id ";
+                       
+                       if($status == 'open')
+                               $sql .= "AND cic.status = 0 ";
+                       else if($status == 'closed')
+                               $sql .= "AND cic.status = 1 ";
+                               
+                       if($messageStatus != null & $messageStatus == 
'no_message_registered')
+                               $sql .= "AND cic.location_item_id IS NULL ";
+                       else if($messageStatus != null &  $messageStatus == 
'message_registered')
+                               $sql .= "AND cic.location_item_id > 0 ";
                                                                                
        
                        $this->db->query($sql);
                        
@@ -229,7 +242,7 @@
                                        if($check_item_id != 0){
                                                
$check_item->set_cases_array($cases_array);
                                                
-                                               if($returnType == "array")
+                                               if($returnType == 
"return_array")
                                                        $check_items_array[] = 
$check_item->toArray();
                                                else
                                                        $check_items_array[] = 
$check_item;
@@ -241,25 +254,118 @@
                                        
$check_item->set_comment($this->unmarshal($this->db->f('comment', true), 
'string'));
                                        
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
                                        
$check_item->set_measurement($this->unmarshal($this->db->f('measurement', 
true), 'int'));
+                                       
+                                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
+                                       
$control_item->set_title($this->db->f('title', true), 'string');
+                                       
$control_item->set_required($this->db->f('required', true), 'string');
+                                       
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
+                                       
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
+                                       
$control_item->set_control_group_id($this->db->f('control_group_id', true), 
'string');
+                                       
$control_item->set_type($this->db->f('type', true), 'string');
+                               
+                                       
$check_item->set_control_item($control_item->toArray());
                                                                        
                                        $cases_array = array();
                                }
                                
-                               $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id', true), 
'int'));
-                               
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id', true), 
'int'));
-                               
$case->set_location_id($this->unmarshal($this->db->f('location_id', true), 
'int'));
-                               
$case->set_location_item_id($this->unmarshal($this->db->f('location_item_id', 
true), 'int'));
-                               
$case->set_descr($this->unmarshal($this->db->f('descr', true), 'string'));
-                               
$case->set_user_id($this->unmarshal($this->db->f('user_id', true), 'int'));     
-                               
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
-                               
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
-                               
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
+                               if($this->db->f('cic_id', true) != ''){
+                                       $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id', true), 
'int'));
+                                       
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id', true), 
'int'));
+                                       
$case->set_location_id($this->unmarshal($this->db->f('location_id', true), 
'int'));
+                                       
$case->set_location_item_id($this->unmarshal($this->db->f('location_item_id', 
true), 'int'));
+                                       
$case->set_descr($this->unmarshal($this->db->f('descr', true), 'string'));
+                                       
$case->set_user_id($this->unmarshal($this->db->f('user_id', true), 'int'));     
+                                       
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
+                                       
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
+                                       
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
+                               
+                               
+                                       if($returnType == "return_array")
+                                               $cases_array[] = 
$case->toArray();
+                                       else
+                                               $cases_array[] = $case;
+                               }
+                               
+                               $check_item_id =  $check_item->get_id();
+                       }
                        
-                               if($returnType == "array")
-                                       $cases_array[] = $case->toArray();
+                       if($check_item != null){
+                               $check_item->set_cases_array($cases_array);
+                               
+                               if($returnType == "return_array")
+                                       $check_items_array[] = 
$check_item->toArray();
                                else
-                                       $cases_array[] = $case;
-       
+                                       $check_items_array[] = $check_item;
+                               
+                               return $check_items_array;
+                       }else {
+                               return null;
+                       }
+               }
+               
+               public function 
get_check_items_and_cases_by_message($message_ticket_id, $returnType = 
"object"){
+                       $sql  = "SELECT ci.id as ci_id, ci.status, 
control_item_id, ci.comment, ci.measurement, check_list_id, cic.id as cic_id, 
cic.*, ";
+                       $sql .= "coi.id as coi_id, coi.* ";
+                       $sql .= "FROM controller_check_item ci "; 
+                       $sql .= "LEFT JOIN controller_control_item as coi ON 
ci.control_item_id = coi.id ";
+                       $sql .= "LEFT JOIN controller_check_item_case as cic ON 
ci.id = cic.check_item_id ";
+                       $sql .= "WHERE cic.location_item_id = 
$message_ticket_id";
+                                                                               
        
+                       $this->db->query($sql);
+                       
+                       $check_item_id = 0;
+                       $check_item = null;
+                       while ($this->db->next_record()) {
+                               
+                               if( $this->db->f('ci_id', true) != 
$check_item_id ){
+                                       
+                                       if($check_item_id != 0){
+                                               
$check_item->set_cases_array($cases_array);
+                                               
+                                               if($returnType == "array")
+                                                       $check_items_array[] = 
$check_item->toArray();
+                                               else
+                                                       $check_items_array[] = 
$check_item;
+                                       }
+                               
+                                       $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
+                                       
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id',
 true), 'int'));
+                                       
$check_item->set_status($this->unmarshal($this->db->f('status', true), 'bool'));
+                                       
$check_item->set_comment($this->unmarshal($this->db->f('comment', true), 
'string'));
+                                       
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
+                                       
$check_item->set_measurement($this->unmarshal($this->db->f('measurement', 
true), 'int'));
+                                       
+                                       $control_item = new 
controller_control_item($this->unmarshal($this->db->f('coi_id', true), 'int'));
+                                       
$control_item->set_title($this->db->f('title', true), 'string');
+                                       
$control_item->set_required($this->db->f('required', true), 'string');
+                                       
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
+                                       
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
+                                       
$control_item->set_control_group_id($this->db->f('control_group_id', true), 
'string');
+                                       
$control_item->set_type($this->db->f('type', true), 'string');
+                               
+                                       
$check_item->set_control_item($control_item->toArray());
+                                                                       
+                                       $cases_array = array();
+                               }
+                               
+                               if($this->db->f('cic_id', true) != ''){
+                                       $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id', true), 
'int'));
+                                       
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id', true), 
'int'));
+                                       
$case->set_location_id($this->unmarshal($this->db->f('location_id', true), 
'int'));
+                                       
$case->set_location_item_id($this->unmarshal($this->db->f('location_item_id', 
true), 'int'));
+                                       
$case->set_descr($this->unmarshal($this->db->f('descr', true), 'string'));
+                                       
$case->set_user_id($this->unmarshal($this->db->f('user_id', true), 'int'));     
+                                       
$case->set_entry_date($this->unmarshal($this->db->f('entry_date', true), 
'int'));
+                                       
$case->set_modified_date($this->unmarshal($this->db->f('modified_date', true), 
'int'));
+                                       
$case->set_modified_by($this->unmarshal($this->db->f('modified_by', true), 
'int'));
+                               
+                               
+                                       if($returnType == "array")
+                                               $cases_array[] = 
$case->toArray();
+                                       else
+                                               $cases_array[] = $case;
+                               }
+                               
                                $check_item_id =  $check_item->get_id();
                        }
                        

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-01-11 10:01:53 UTC (rev 8555)
@@ -44,10 +44,10 @@
                private $so_control;
                
                var $public_functions = array(
-                                                                       
'register_case' => true,
-                                                                       
'create_case_message' => true,
-                                                                       
'view_case_message' => true,
-                                                                       
'save_case_message' => true
+                                                                       
'register_case'                 => true,
+                                                                       
'create_case_message'   => true,
+                                                                       
'view_case_message'     => true,
+                                                                       
'register_case_message' => true
                                                                );
 
                function __construct()
@@ -63,6 +63,7 @@
                function register_case(){
                        $check_list_id = phpgw::get_var('check_list_id');
                        $control_item_id = phpgw::get_var('control_item_id');
+                       $case_descr = phpgw::get_var('case_descr');
                                                
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                                                
@@ -79,24 +80,32 @@
                        $case = new controller_check_item_case();
                        $case->set_check_item_id( $check_item->get_id() );
                        $case->set_status($status);
+                       $case->set_descr($case_descr);
                        $case->set_location_id($location_id);
                        $case->set_user_id($user_id);
                        $case->set_entry_date($todays_date);
                        $case->set_modified_date($todays_date);
                        $case->set_modified_by($user_id);
                                
-                       return $this->so->store($case);
+                       $case_id = $this->so->store($case);
+                       
+                       if($case_id > 0)
+                               return json_encode( array( "saveStatus" => 
"saved" ) );
+                       else
+                               return json_encode( array( "saveStatus" => 
"not_saved" ) );     
+                       
                }
                
                function create_case_message(){
                        $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list = 
$this->so_check_list->get_single($check_list_id);
                                                
-                       $check_items_and_cases = 
$this->so_check_item->get_check_items_and_cases($check_list_id, "array");
+                       $check_items_and_cases = 
$this->so_check_item->get_check_items_and_cases($check_list_id, "open", 
"no_message_registered", "return_array");
 
-                       $control_id = 
$check_list_with_check_items["control_id"];
+                       $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
                        
-                       $location_code = 
$check_list_with_check_items["location_code"];
+                       $location_code = $check_list->get_location_code();
 
                        $level = count(explode('-',location_code));
                        
@@ -105,7 +114,7 @@
                        
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
        
-                       $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                       $building = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $catsObj = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
                        $catsObj->supress_info = true;
@@ -115,9 +124,11 @@
                        $data = array
                        (
                                'categories'                    => $categories,
-                               'control_array'                 => 
$control->toArray(),
+                               'check_list'                    => 
$check_list->toArray(),
+                               'control'                               => 
$control->toArray(),
                                'check_items_and_cases' => 
$check_items_and_cases,
-                               'buildings_array'               => 
$buildings_array,
+                               'buildings_array'               => 
$buildings_array,
+                               'building'                              => 
$building,
                                'date_format'                   => $date_format
                        );
                        
@@ -134,15 +145,15 @@
                        
                        
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
                        
-                       self::render_template_xsl('case/create_case', $data);
+                       self::render_template_xsl('case/create_case_message', 
$data);
                }
                
-               function save_case_message(){
+               function register_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');
                        $message_cat_id = phpgw::get_var('message_cat_id');
-                       $check_item_ids = phpgw::get_var('check_item_ids');
+                       $case_ids = phpgw::get_var('case_ids');
                        
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                                                
@@ -156,12 +167,13 @@
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 
                        $message_details = "Kontroll: " .  
$control->get_title() . "\n\n";
+                       //$message_details = "Kontrollområde: " .  
$control->get_title() . "\n\n";
                        
                        // Generates message details from comment field in 
check item 
-                       foreach($check_item_ids as $check_item_id){
-                               $check_item = 
$this->so_check_item->get_single($check_item_id);
+                       foreach($case_ids as $case_id){
+                               $case = $this->so->get_single($case_id);
                                $message_details .= "Gjøremål: ";
-                               $message_details .=  $check_item->get_comment() 
. "<br>";
+                               $message_details .=  $case->get_descr() . 
"<br>";
                        }
                        
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id("controller", ".checklist");
@@ -187,23 +199,13 @@
                        $status = 0;
                        
                        // Registers message and updates check items with 
message ticket id
-                       foreach($check_item_ids as $check_item_id){
-                               $check_item = 
$this->so_check_item->get_single($check_item_id);
-                               
-                               $case = new controller_check_item_case();
-                               $case->set_check_item_id($check_item_id);
-                               $case->set_status($status);
-                               $case->set_location_id($location_id);
+                       foreach($case_ids as $case_id){
+                               $case = $this->so->get_single($case_id);
                                $case->set_location_item_id($message_ticket_id);
-                               $case->set_user_id($user_id);
-                               $case->set_entry_date($todays_date);
-                               $case->set_modified_date($todays_date);
-                               $case->set_modified_by($user_id);
-                               
                                $this->so->store($case);
                        }                       
                        
-                       $this->redirect(array('menuaction' => 
'controller.uicase.view_case', 'check_list_id'=>$check_list_id, 
'message_ticket_id'=>$message_ticket_id));
+                       $this->redirect(array('menuaction' => 
'controller.uicase.view_case_message', 'check_list_id'=>$check_list_id, 
'message_ticket_id'=>$message_ticket_id));
                }
                
                function view_case_message(){
@@ -221,8 +223,8 @@
        
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 
-                       $registered_message_check_items = 
$this->so_check_item->get_check_items_by_message($message_ticket_id);
-                       
+                       $check_items_and_cases = 
$this->so_check_item->get_check_items_and_cases_by_message($message_ticket_id, 
"array");
+                                               
                        $botts = CreateObject('property.botts',true);
                        $message_ticket = 
$botts->read_single($message_ticket_id);
                        
@@ -238,7 +240,7 @@
                                'location_array'                                
        => $location_array,
                                'control_array'                                 
        => $control->toArray(),
                                'check_list'                                    
        => $check_list->toArray(),
-                               'registered_message_check_items'        => 
$registered_message_check_items,
+                               'check_items_and_cases'                         
=> $check_items_and_cases,
                                'date_format'                                   
        => $date_format
                        );
                        
@@ -249,7 +251,7 @@
                        
                        
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
                        
-                       self::render_template_xsl('case/view_case', $data);
+                       self::render_template_xsl('case/view_case_message', 
$data);
                }
                
                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-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-01-11 10:01:53 UTC (rev 8555)
@@ -371,7 +371,7 @@
                                
                        // Fetches all control items for check list
                        $control_items_for_check_list = 
$this->so_control_item->get_control_items_by_control($check_list->get_control_id(),
 "array");
-
+               
                        $data = array
                        (
                                'control_items_for_check_list'  => 
$control_items_for_check_list,
@@ -386,16 +386,15 @@
                        
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                        
-                       // Fetches with check items
-                       $open_check_items = 
$this->so_check_item->get_check_items($check_list_id, 'open', 
'control_item_type_1');
-
+                       $open_check_items_and_cases = 
$this->so_check_item->get_check_items_and_cases($check_list_id, 'open', null, 
'return_array');
+                       
                        $data = array
                        (
-                               'open_check_items'      => $open_check_items,
-                               'check_list'            => 
$check_list->toArray()
+                               'open_check_items_and_cases'    => 
$open_check_items_and_cases,
+                               'check_list'                                    
=> $check_list->toArray()
                        );
                        
-                       self::render_template_xsl('check_list/view_open_cases', 
$data);
+                       self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_open_cases'), $data );      
             
                }
                
                function view_closed_cases(){
@@ -403,16 +402,15 @@
                        
                        $check_list = 
$this->so_check_list->get_single($check_list_id);
                        
-                       // Fetches check list with check items
-                       $handled_check_items = 
$this->so_check_item->get_check_items($check_list_id, 'handled', 
'control_item_type_1');
+                       $closed_check_items_and_cases = 
$this->so_check_item->get_check_items_and_cases($check_list_id, 'closed', 
'return_array');
                                                        
                        $data = array
                        (
-                               'handled_check_items'   => $handled_check_items,
-                               'check_list'    => $check_list->toArray()
+                               'closed_check_items_and_cases'  => 
$closed_check_items_and_cases,
+                               'check_list'                                    
=> $check_list->toArray()
                        );
                        
-                       
self::render_template_xsl('check_list/view_closed_cases', $data);
+                       self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_closed_cases'), $data );
                }
                
                function view_measurements(){
@@ -429,7 +427,7 @@
                                'check_list'    => $check_list->toArray()
                        );
                        
-                       
self::render_template_xsl('check_list/view_measurements', $data);
+                       self::render_template_xsl( 
array('check_list/cases_tab_menu', 'check_list/view_measurements'), $data );
                }
                                
                public function view_check_lists_for_control()

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php  
    2012-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php  
    2012-01-11 10:01:53 UTC (rev 8555)
@@ -91,7 +91,7 @@
                        $this->location_item_id = $location_item_id;
                }
 
-               public function get_descr() { return (int)$this->descr; }
+               public function get_descr() { return $this->descr; }
                
                public function set_descr($descr)
                {

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-01-11 10:01:53 UTC (rev 8555)
@@ -298,13 +298,30 @@
                                  if(data){
                                  var obj = jQuery.parseJSON(data);
                                
-                                 if(obj.saveStatus == "updated"){
+                                 if(obj.saveStatus == "saved"){
                                          var submitBnt = 
$(thisForm).find("input[type='submit']");
                                          $(submitBnt).val("Lagret");   
+                                         
+                                         
$(thisForm).find(':input').each(function() {
+                                               switch(this.type) {
+                                                   case 'password':
+                                                   case 'select-multiple':
+                                                   case 'select-one':
+                                                   case 'text':
+                                                       $(this).val('');
+                                                       break;
+                                                   case 'textarea':
+                                                       $(this).val('');
+                                                       break;
+                                                   case 'checkbox':
+                                                   case 'radio':
+                                                       this.checked = false;
+                                               }
+                                           });
                                                  
                                          // Changes text on save button back 
to original
                                          window.setTimeout(function() {
-                                                       $(submitBnt).val('Lagre 
sjekkpunkt');
+                                                       
$(submitBnt).val('Registrer sak');
                                                        
$(submitBnt).addClass("not_active");
                                          }, 1000);
                                          }

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-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-01-11 10:01:53 UTC (rev 8555)
@@ -8,7 +8,7 @@
                        
                <h3 class="box_header">Meldingen gjelder</h3>
                <div id="case_details">
-                       <h3 class="first">Tittel på kontroll: <xsl:value-of 
select="control_array/title"/></h3>
+                       <h3 class="first">Tittel på kontroll: <xsl:value-of 
select="control/title"/></h3>
                        <xsl:choose>
                                <xsl:when test="check_list/completed_date != 0">
                                        <h3>Kontroll ble utført 
dato:<xsl:value-of select="php:function('date', $date_format, 
number(check_list/completed_date))"/></h3>
@@ -31,18 +31,17 @@
                                                </select>
                                </xsl:when>
                                <xsl:otherwise>
-                                       <h3 class="last">Bygg: <xsl:value-of 
select="building_array/loc1_name"/></h3>   
+                                       <h3 class="last">Bygg: <xsl:value-of 
select="building/loc1_name"/></h3> 
                                </xsl:otherwise>
                        </xsl:choose>
-                       
                </div>
                
                <h3 class="box_header">Detaljer for meldingen</h3>
                <fieldset id="case_details">
                        <xsl:choose>
-                               <xsl:when 
test="check_list/check_item_array/child::node()">
+                               <xsl:when 
test="check_items_and_cases/child::node()">
                                        
-                               <form class="frm_save_case" 
action="index.php?menuaction=controller.uicase.save_case" method="post">
+                               <form class="frm_save_case" 
action="index.php?menuaction=controller.uicase.register_case_message" 
method="post">
                                        <input>
                                      <xsl:attribute 
name="name">check_list_id</xsl:attribute>
                                      <xsl:attribute 
name="type">hidden</xsl:attribute>
@@ -67,21 +66,35 @@
                                                        </xsl:for-each>
                                                </select>
                                        </div>
+                                       
+                                       <div>
+                                               <label>Last opp filvedlegg til 
meldingen:</label>
+                                               <input type="file" id="file" 
name="file" />
+                                       </div>
                        
                                        <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i avviksmelding</h3>                             
    
                                        <ul class="check_items">
-                                               <xsl:for-each 
select="check_list/check_item_array">
-                                                       <li>
-                                                               <xsl:variable 
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
-                                                               <h5><input 
type="checkbox" name="check_item_ids[]" value="{$check_item_id}" 
/><span><xsl:value-of select="control_item/title"/></span></h5>                 
                            
-                                                       </li>
+                                               <xsl:for-each 
select="check_items_and_cases">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="cases_array/child::node()">
+                                                                       <li 
class="check_item_cases">
+                                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                                               
<ul>            
+                                                                               
        <xsl:for-each select="cases_array">
+                                                                               
                <xsl:variable name="cases_id"><xsl:value-of 
select="id"/></xsl:variable>
+                                                                               
                <li style="list-style:none;"><input type="checkbox"  
name="case_ids[]" value="{$cases_id}" /><xsl:value-of select="descr"/></li>
+                                                                               
        </xsl:for-each>
+                                                                               
</ul>
+                                                                       </li>
+                                                               </xsl:when>
+                                                       </xsl:choose>
                                                </xsl:for-each>
                                        </ul>
                                        
-                                         <div class="form-buttons">
+                                       <div class="form-buttons">
                                                <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
                                                <input class="btn focus" 
type="submit" name="save_control" value="Registrer avviksmelding" 
title="{$lang_save}" />
-                                         </div>
+                                       </div>
                                </form>                 
                                </xsl:when>
                                <xsl:otherwise>

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-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-01-11 10:01:53 UTC (rev 8555)
@@ -34,20 +34,29 @@
                        </div>
        
        
-                       <h3 class="check_item_details">Avviksmeldingen omfattet 
følgende punkter</h3>                                   
+                       <h3 class="check_item_details">Avviksmeldingen omfattet 
følgende saker</h3>                                     
                        <ul class="check_items">
-                               <xsl:for-each 
select="registered_message_check_items">
-                                       <li>
-                                               <xsl:variable 
name="check_item_id"><xsl:value-of select="id" /></xsl:variable>
-                                               <h5><xsl:value-of 
select="control_item/title"/></h5>                                            
-                                       </li>
+                               <xsl:for-each select="check_items_and_cases">
+                                       <xsl:choose>
+                                               <xsl:when 
test="cases_array/child::node()">
+                                                       <li 
class="check_item_cases">
+                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                               <ul>            
+                                                                       
<xsl:for-each select="cases_array">
+                                                                               
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                               
<li><xsl:value-of select="descr"/></li>
+                                                                       
</xsl:for-each>
+                                                               </ul>
+                                                       </li>
+                                               </xsl:when>
+                                       </xsl:choose>
                                </xsl:for-each>
                        </ul>
                </div>
                
                <a class="btn">
                        <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicase.create_case</xsl:text>
+                               
<xsl:text>index.php?menuaction=controller.uicase.create_case_message</xsl:text>
                                <xsl:text>&amp;check_list_id=</xsl:text>
                                <xsl:value-of select="check_list/id"/>
                        </xsl:attribute>

Copied: 
branches/Version-1_0-branch/controller/templates/base/check_list/cases_tab_menu.xsl
 (from rev 8554, trunk/controller/templates/base/check_list/cases_tab_menu.xsl)
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/cases_tab_menu.xsl
                         (rev 0)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/cases_tab_menu.xsl
 2012-01-11 10:01:53 UTC (rev 8555)
@@ -0,0 +1,43 @@
+<xsl:template name="cases_tab_menu" xmlns:php="http://php.net/xsl";>
+
+<xsl:param name="active_tab" />
+
+<div class="tab_menu">
+               <a id="view_open_cases">
+                       <xsl:if test="$active_tab = 'view_open_cases'">
+                               <xsl:attribute 
name="class">active</xsl:attribute>
+                       </xsl:if>                               
+                       <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
+                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
+                       </xsl:attribute>
+                       Vis åpne saker
+               </a>
+               <a id="view_closed_cases">
+                       <xsl:if test="$active_tab = 'view_closed_cases'">
+                               <xsl:attribute 
name="class">active</xsl:attribute>
+                       </xsl:if>                                       
+                       <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_closed_cases</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
+                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
+                       </xsl:attribute>
+                       Vis lukkede saker
+               </a>
+               <a id="view_measurements">
+                       <xsl:if test="$active_tab = 'view_measurements'">
+                               <xsl:attribute 
name="class">active</xsl:attribute>
+                       </xsl:if>                                       
+                       <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_measurements</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
+                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
+                       </xsl:attribute>
+                       Vis målinger
+               </a>
+       </div>
+</xsl:template>

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-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/register_case.xsl
  2012-01-11 10:01:53 UTC (rev 8555)
@@ -3,9 +3,9 @@
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
 
 <div id="error_message_menu">
-       <a class="btn" id="view_open_errors">                                   
+       <a class="btn" id="view_open_cases">                                    
                <xsl:attribute name="href">
-                       
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_errors</xsl:text>
+                       
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>
                        <xsl:text>&amp;check_list_id=</xsl:text>
                        <xsl:value-of select="check_list/id"/>
                        <xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
@@ -50,8 +50,8 @@
                                                                            
                                                                                
<div class="check_item">
                                                                               
<div>
-                                                                               
         <label class="comment">Kommentar</label>
-                                                                               
         <textarea name="comment">
+                                                                               
         <label class="comment">Beskrivelse av sak</label>
+                                                                               
         <textarea name="case_descr">
                                                                                
                        <xsl:value-of select="comment"/>
                                                                                
                 </textarea>
                                                                                
   </div>
@@ -75,14 +75,14 @@
                                                                                
            </input>
                                                                               
</div>
                                                                               
<div>
-                                                                               
         <label class="comment">Kommentar</label>
-                                                                               
         <textarea name="comment">
+                                                                               
         <label class="comment">Beskrivelse av sak</label>
+                                                                               
         <textarea name="case_descr">
                                                                                
                        <xsl:value-of select="comment"/>
                                                                                
                 </textarea>
                                                                                
   </div>
                                                                               
<div class="form-buttons">
                                                                                
                <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'register_error')" /></xsl:variable>
-                                                                               
                <input type="submit" name="save_control" value="Registrer 
avvik" class="not_active" title="{$lang_save}" />
+                                                                               
                <input type="submit" name="save_control" value="Registrer sak" 
class="not_active" title="{$lang_save}" />
                                                                                
        </div>
                                                                                
</div>
                                                                        
</xsl:when>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
      2012-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_closed_cases.xsl
      2012-01-11 10:01:53 UTC (rev 8555)
@@ -24,86 +24,40 @@
        
 <div id="view_errors">
        
-       <div class="tab_menu">
-               <a id="view_open_errors">                                       
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis åpne saker
-               </a>
-               <a class="active" id="view_closed_errors">                      
                
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_closed_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis lukkede saker
-               </a>
-               <a id="view_measurements">                                      
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_measurements</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis målinger
-               </a>
-       </div>  
+       <xsl:call-template name="cases_tab_menu">
+               <xsl:with-param 
name="active_tab">view_closed_cases</xsl:with-param>
+       </xsl:call-template>    
        
-       <div class="tab_item"> 
+       <div class="tab_item active">
                <xsl:choose>
-                       <xsl:when test="handled_check_items/child::node()">
+                       <xsl:when 
test="closed_check_items_and_cases/child::node()">
                                
                        <div class="expand_menu"><div class="expand_all">Vis 
alle</div><div class="collapse_all focus">Skjul alle</div></div>
-                               
-                               <ul id="check_list_fixed_list" 
class="check_items expand_list">
-                                       <xsl:for-each 
select="handled_check_items">
-                                                       <xsl:if test="status = 
1">
-                                                       <li>
-                                                       <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="control_item/title"/></span></h4>                                       
       
-                                                               <form 
id="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
-                                                                       
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                       <input 
type="hidden" name="check_item_id" value="{$check_item_id}" /> 
-                                                                       <div 
class="check_item">
-                                                                         <div>
-                                                                              
<label>Status</label>
-                                                                              
<select name="status">
-                                                                               
        <xsl:choose>
-                                                                               
                <xsl:when test="status = 0">
-                                                                               
                        <option value="0" SELECTED="SELECTED">Avvik er 
åpent</option>
-                                                                               
                        <option value="1">Avvik er håndtert</option>
-                                                                               
                </xsl:when>
-                                                                               
                <xsl:when test="status = 1">
-                                                                               
                        <option value="0">Avvik er åpent</option>
-                                                                               
                        <option value="1" SELECTED="SELECTED">Avvik er 
lukket</option>
-                                                                               
                </xsl:when>
-                                                                               
        </xsl:choose>
-                                                                               
   </select>
-                                                                      </div>
-                                                                      <div>
-                                                                        <label 
class="comment">Kommentar</label>
-                                                                        
<textarea name="comment">
-                                                                               
        <xsl:value-of select="comment"/>
-                                                                               
 </textarea>
-                                                                      </div>
-                                                                      <div 
class="form-buttons">
-                                                                               
        <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save_check_item')" /></xsl:variable>
-                                                                               
        <input type="submit" name="save_control" value="Oppdater håndtert 
avvik" class="not_active" title="{$lang_save}" />
-                                                                               
</div>
-                                                                       </div>
-                                                               </form>
-                                                   </li>
-                                               </xsl:if>
-                                       </xsl:for-each>
-                               </ul>                   
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       Ingen registrerte håndterte avvik
-                               </xsl:otherwise>
+               
+                       <ul class="check_items">
+                               <xsl:for-each 
select="closed_check_items_and_cases">
+                                       <xsl:choose>
+                                               <xsl:when 
test="cases_array/child::node()">
+                                                       <li 
class="check_item_cases">
+                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                               <ul>            
+                                                                       
<xsl:for-each select="cases_array">
+                                                                               
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                               
<li><xsl:number/>.  <input type="checkbox"  name="case_ids[]" 
value="{$cases_id}" /><xsl:value-of select="descr"/>
+                                                                               
        <div><xsl:value-of select="location_item_id"/></div>
+                                                                               
</li>
+                                                                       
</xsl:for-each>
+                                                               </ul>
+                                                       </li>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </xsl:for-each>
+                       </ul>
+                                       
+                       </xsl:when>
+                       <xsl:otherwise>
+                               Ingen lukkede saker
+                       </xsl:otherwise>
                </xsl:choose>
        </div>
 </div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_errors_for_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_errors_for_check_list.xsl
     2012-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_errors_for_check_list.xsl
     2012-01-11 10:01:53 UTC (rev 8555)
@@ -14,7 +14,7 @@
                        
                // ======================  FUNKSJONALITET FOR LASTING AV TABS 
===================
                $(function() {
-                                       
+       
                        $("#register_case").live("click", function(){
                                var requestUrl = $(this).attr("href");
                                load_tab(requestUrl);

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
      2012-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_measurements.xsl
      2012-01-11 10:01:53 UTC (rev 8555)
@@ -24,35 +24,9 @@
        
 <div id="view_errors">
        
-       <div class="tab_menu">
-               <a id="view_open_errors">                                       
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis åpne saker
-               </a>
-               <a id="view_closed_errors">                                     
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_closed_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis lukkede saker
-               </a>
-               <a class="active" id="view_measurements">                       
                
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_measurements</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis målinger
-               </a>
-       </div>  
+       <xsl:call-template name="cases_tab_menu">
+               <xsl:with-param 
name="active_tab">view_measurements</xsl:with-param>
+       </xsl:call-template>
        
        <div class="tab_item">
                <xsl:choose>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-01-11 09:58:05 UTC (rev 8554)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/view_open_cases.xsl
        2012-01-11 10:01:53 UTC (rev 8555)
@@ -24,86 +24,56 @@
        
 <div id="view_errors">
        
-       <div class="tab_menu">
-               <a class="active" id="view_open_cases">                         
        
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_open_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis åpne saker
-               </a>
-               <a id="view_closed_cases">                                      
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_closed_cases</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis lukkede saker
-               </a>
-               <a id="view_measurements">                                      
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uicheck_list.view_measurements</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                               
<xsl:text>&amp;phpgw_return_as=stripped_html</xsl:text>
-                       </xsl:attribute>
-                       Vis målinger
-               </a>
-       </div>  
+       <xsl:call-template name="cases_tab_menu">
+               <xsl:with-param 
name="active_tab">view_open_cases</xsl:with-param>
+       </xsl:call-template>
        
        <div class="tab_item active">
                <xsl:choose>
-                       <xsl:when test="open_check_items/child::node()">
+                       <xsl:when 
test="open_check_items_and_cases/child::node()">
                                
                        <div class="expand_menu"><div class="expand_all">Vis 
alle</div><div class="collapse_all focus">Skjul alle</div></div>
                
-                               <ul id="check_list_not_fixed_list" 
class="check_items expand_list">
-                                       <xsl:for-each select="open_check_items">
-                                                       <li>
-                                                       <xsl:if test="status = 
0">
-                                                               <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="control_item/title"/></span></h4>                                       
       
-                                                               <form 
id="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
-                                                                       
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
-                                                                       <input 
type="hidden" name="check_item_id" value="{$check_item_id}" /> 
-                                                                       <div 
class="check_item">
-                                                                         <div>
-                                                                              
<label>Status</label>
-                                                                              
<select name="status">
-                                                                               
        <xsl:choose>
-                                                                               
                <xsl:when test="status = 0">
-                                                                               
                        <option value="0" SELECTED="SELECTED">Avvik er 
åpent</option>
-                                                                               
                        <option value="1">Avvik er håndtert</option>
-                                                                               
                </xsl:when>
-                                                                               
                <xsl:when test="status = 1">
-                                                                               
                        <option value="0">Avvik er åpent</option>
-                                                                               
                        <option value="1" SELECTED="SELECTED">Avvik er 
håndtert</option>
-                                                                               
                </xsl:when>
-                                                                               
        </xsl:choose>
-                                                                               
   </select>
-                                                                      </div>
-                                                                      <div>
-                                                                        <label 
class="comment">Kommentar</label>
-                                                                        
<textarea name="comment">
-                                                                               
        <xsl:value-of select="comment"/>
-                                                                               
 </textarea>
-                                                                      </div>
-                                                                      <div 
class="form-buttons">
-                                                                               
        <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save_check_item')" /></xsl:variable>
-                                                                               
        <input style="width: 200px;" type="submit" name="save_control" 
value="Oppdater registrert avvik" class="not_active" title="{$lang_save}" />
-                                                                               
</div>
-                                                                       </div>
-                                                               </form>
-                                                       </xsl:if>
-                                           </li>
-                                       </xsl:for-each>
-                               </ul>                   
-                               </xsl:when>
-                               <xsl:otherwise>
-                                       Ingen registrerte åpne avvik
-                               </xsl:otherwise>
+                       <ul class="check_items">
+                               <xsl:for-each 
select="open_check_items_and_cases">
+                                       <xsl:choose>
+                                               <xsl:when 
test="cases_array/child::node()">
+                                                       <li 
class="check_item_cases">
+                                                               
<h4><span><xsl:value-of select="control_item/title"/></span></h4>
+                                                               <ul>            
+                                                                       
<xsl:for-each select="cases_array">
+                                                                               
<xsl:variable name="cases_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                               
<li><xsl:value-of select="descr"/>
+                                                                               
        <xsl:choose>
+                                                                               
                <xsl:when test="location_item_id > 0">
+                                                                               
                        <div style="float:right;">
+                                                                               
                        <a>
+                                                                               
                                <xsl:attribute name="href">
+                                                                               
                                        
<xsl:text>index.php?menuaction=property.uitts.view</xsl:text>
+                                                                               
                                        <xsl:text>&amp;id=</xsl:text>
+                                                                               
                                        <xsl:value-of 
select="location_item_id"/>
+                                                                               
                                </xsl:attribute>
+                                                                               
                                Vis melding
+                                                                               
                        </a>
+                                                                               
                        </div>
+                                                                               
                </xsl:when>
+                                                                               
                <xsl:otherwise>
+                                                                               
                        <div style="float:right;"><span style="color:red">Ingen 
melding registrert!</span></div>
+                                                                               
                </xsl:otherwise>
+                                                                               
        </xsl:choose>
+                                                                               
</li>
+                                                                       
</xsl:for-each>
+                                                               </ul>
+                                                       </li>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </xsl:for-each>
+                       </ul>
+                                       
+                       </xsl:when>
+                       <xsl:otherwise>
+                               Ingen registrerte åpne avvik
+                       </xsl:otherwise>
                </xsl:choose>
        </div>
 </div>

Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-01-11 10:01:53 UTC (rev 8555)
@@ -1045,7 +1045,8 @@
     width: 150px;
 }
 .hor_menu a {
-       border-bottom: 1px solid #A3A3A3;
+       border:1px solid #d0d9f1;
+       background: #ecf1ff;
 }
 .tab_menu a.active, .hor_menu a.active {
        background: #2647A0;
@@ -1198,7 +1199,6 @@
     padding: 15px;
     width: 800px;
 }
-
 .box_header {
     background: none repeat scroll 0 0 #2647A0;
     border-left: 1px solid #173073;
@@ -1211,4 +1211,14 @@
     padding: 3px 0 3px 15px;
     text-align: left;
     width: 815px;
+}
+li.check_item_cases h4{
+       margin:5px 0;           
+}
+li.check_item_cases ul{
+       margin:10px;            
+}
+li.check_item_cases ul li {
+    list-style: disc outside none;
+    margin: 5px 0 0 20px;
 }
\ No newline at end of file

Modified: branches/Version-1_0-branch/property/inc/export/default/Basware_X114
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Basware_X114        
2012-01-11 09:58:05 UTC (rev 8554)
+++ branches/Version-1_0-branch/property/inc/export/default/Basware_X114        
2012-01-11 10:01:53 UTC (rev 8555)
@@ -581,24 +581,27 @@
                                $this->db->transaction_begin();
                        }
 
-                       $bilagsnr_ut = '';
-                       $get_bilagsnr_ut = false;
-                       foreach ($oRsBilag as $line)
+                       $bilagsnr_ut = $oRsBilag[0]['bilagsnr_ut'];
+                       if(!$bilagsnr_ut)
                        {
-                               if(abs($line['godkjentbelop']) > 0)
+                               $get_bilagsnr_ut = false;
+                               foreach ($oRsBilag as $line)
                                {
-                                       $get_bilagsnr_ut = true;
+                                       if(abs($line['godkjentbelop']) > 0)
+                                       {
+                                               $get_bilagsnr_ut = true;
+                                       }
                                }
-                       }
 
-                       if($get_bilagsnr_ut)
-                       {
-                               $this->db->query("UPDATE fm_idgenerator SET 
value = value + 1 WHERE name = 'bilagsnr_ut'");
-                               $this->db->query("SELECT value FROM 
fm_idgenerator WHERE name = 'bilagsnr_ut'");
-                               $this->db->next_record();
-                               $bilagsnr_ut = $this->db->f('value');
-
-                               $this->db->query("UPDATE fm_ecobilag SET 
bilagsnr_ut = {$bilagsnr_ut} WHERE bilagsnr = '$voucher_id'");
+                               if($get_bilagsnr_ut)
+                               {
+                                       $this->db->query("UPDATE fm_idgenerator 
SET value = value + 1 WHERE name = 'bilagsnr_ut'");
+                                       $this->db->query("SELECT value FROM 
fm_idgenerator WHERE name = 'bilagsnr_ut'");
+                                       $this->db->next_record();
+                                       $bilagsnr_ut = $this->db->f('value');
+       
+                                       $this->db->query("UPDATE fm_ecobilag 
SET bilagsnr_ut = {$bilagsnr_ut} WHERE bilagsnr = '$voucher_id'");
+                               }
                        }
 
                        $tranfser_bilag = array($bilagsnr_ut);




reply via email to

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