fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8474] Merge 8465:8473 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [8474] Merge 8465:8473 from trunk
Date: Mon, 02 Jan 2012 17:07:48 +0000

Revision: 8474
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8474
Author:   sigurdne
Date:     2012-01-02 17:07:47 +0000 (Mon, 02 Jan 2012)
Log Message:
-----------
Merge 8465:8473 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.menu.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.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_location.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uierror_report_message.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
    branches/Version-1_0-branch/controller/js/controller/ajax.js
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    branches/Version-1_0-branch/controller/setup/setup.inc.php
    branches/Version-1_0-branch/controller/setup/tables_current.inc.php
    branches/Version-1_0-branch/controller/setup/tables_update.inc.php
    
branches/Version-1_0-branch/controller/templates/base/create_error_report_message.xsl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl
    
branches/Version-1_0-branch/controller/templates/base/view_error_report_message.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.db_adodb.inc.php
    branches/Version-1_0-branch/property/inc/class.bobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
    branches/Version-1_0-branch/property/js/yahoo/budget.obligations.js

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

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-01-02 17:07:47 UTC (rev 8474)
@@ -163,8 +163,37 @@
                                );
                        }
 
-                       $menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
+                       if ( 
isset($GLOBALS['phpgw_info']['user']['apps']['preferences']) )
+                       {
+                               $menus['preferences'] = array
+                               (
+                                       // in case of userprefs - need a hook 
for 'settings'
+/*
+                                       array
+                                       (
+                                               'text'  => 
$GLOBALS['phpgw']->translation->translate('Preferences', array(), true),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' => 
'controller', 'type'=> 'user') )
+                                       ),
+*/
+                                       array
+                                       (
+                                               'text'  => 
$GLOBALS['phpgw']->translation->translate('Grant Access', array(), true),
+                                               'url'   => 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'preferences.uiadmin_acl.aclprefs', 'acl_app'=> 'controller') )
+                                       )
+                               );
+/*
+                               $menus['toolbar'][] = array
+                               (
+                                       'text'  => 
$GLOBALS['phpgw']->translation->translate('Preferences', array(), true),
+                                       'url'   => 
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname'      => 
'controller')),
+                                       'image' => array('hrm', 'preferences')
+                               );
+*/
+                       }
 
+                       //Nothing...
+                       //$menus['folders'] = 
phpgwapi_menu::get_categories('bergen');
+
                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 
$incoming_app;
 
                        return $menus;

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-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-01-02 17:07:47 UTC (rev 8474)
@@ -51,7 +51,7 @@
        }
        
        public function get_single($check_list_id){
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, ci.id as ci_id, ci.status as 
ci_status, control_item_id, ci.comment as ci_comment, check_list_id FROM 
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id 
AND cl.id = ci.check_list_id;";
+               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, 
completed_date, location_code, ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id FROM 
controller_check_list cl, controller_check_item ci WHERE cl.id = $check_list_id 
AND cl.id = ci.check_list_id;";
                $this->db->query($sql);
                
                $counter = 0;
@@ -63,7 +63,10 @@
                                
$check_list->set_control_id($this->unmarshal($this->db->f('control_id', true), 
'int'));
                                
$check_list->set_status($this->unmarshal($this->db->f('cl_status', true), 
'bool'));
                                
$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_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_location_code($this->unmarshal($this->db->f('location_code', 
true), 'int'));   
                        }
                        
                        $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id', true), 'int'));
@@ -72,32 +75,39 @@
                        
$check_item->set_comment($this->unmarshal($this->db->f('ci_comment', true), 
'string'));
                        
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id', 
true), 'int'));
                        
-                       $check_items_array[] = $check_item->toArray();
+                       $check_items_array[] = $check_item;
                        
                        $counter++;
                }
                
                if($check_list != null){
                        $check_list->set_check_item_array($check_items_array);
-                       return $check_list->toArray();
+                       return $check_list;
                }else {
                        return null;
                }
        }
                
-       public function get_single_with_check_items($check_list_id, $status){
+       public function get_single_with_check_items($check_list_id, $status, 
$type){
                $sql  = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.control_id, cl.comment as cl_comment, deadline, planned_date, 
completed_date, location_code, ";
                $sql .= "ci.id as ci_id, ci.status as ci_status, 
control_item_id, ci.comment as ci_comment, check_list_id, "; 
                $sql .= "coi.title as coi_id, coi.title as coi_title, 
coi.required as coi_required, coi.required as coi_required, ";
                $sql .= "coi.what_to_do as coi_what_to_do, coi.how_to_do as 
coi_how_to_do, coi.control_group_id as coi_control_group_id "; 
                $sql .= "FROM controller_check_list cl "; 
                $sql .= "LEFT JOIN controller_check_item as ci ON cl.id = 
ci.check_list_id ";
-               $sql .= "LEFT JOIN controller_control_item as coi ON 
ci.control_item_id=coi.id ";
-               $sql .= "WHERE cl.id = $check_list_id";
+               $sql .= "LEFT JOIN controller_control_item as coi ON 
ci.control_item_id = coi.id ";
+               $sql .= "WHERE cl.id = $check_list_id ";
                
                if($status == 'open')
-                       $sql .= "AND ci.status = 0";
+                       $sql .= "AND ci.status = 0 ";
+               else if($status == 'handled')
+                       $sql .= "AND ci.status = 1 ";
+                       
+               if($type != null)
+                       $sql .= "AND coi.type = '$type'";
                                
+               
+                       
                $this->db->query($sql);
                
                $counter = 0;
@@ -480,7 +490,25 @@
                return isset($result) ? 
$this->db->get_last_insert_id('controller_check_list', 'id') : 0;
        }
        
-       function update($object){}
+       function update($check_list)
+       {
+               $id = intval($check_list->get_id());
+                       
+               $values = array(
+                       'control_id = ' . 
$this->marshal($check_list->get_control_id(), 'int'),
+                       'status = ' . $this->marshal($check_list->get_status(), 
'int'),
+                       'comment = ' . 
$this->marshal($check_list->get_comment(), 'string'),
+                       'deadline = ' . 
$this->marshal($check_list->get_deadline(), 'int'),
+                       'planned_date = ' . 
$this->marshal($check_list->get_planned_date(), 'int'),
+                       'completed_date = ' . 
$this->marshal($check_list->get_completed_date(), 'int'),
+                       'location_code = ' . 
$this->marshal($check_list->get_location_code(), 'int'),
+                       'component_id = ' . 
$this->marshal($check_list->get_component_id(), 'int'),
+               );
+
+               $result = $this->db->query('UPDATE controller_check_list SET ' 
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+               return isset($result);
+       }
        
        function get_id_field_name($extended_info = false)
        {

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-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-01-02 17:07:47 UTC (rev 8474)
@@ -55,7 +55,8 @@
                        'save_check_item'                                       
=>      true,
                        'get_check_list_info'                           =>      
true,
                        'control_calendar_status_overview'      =>      true,
-                       'add_check_item_to_list'                        =>      
true
+                       'add_check_item_to_list'                        =>      
true,
+                       'update_check_list'                                     
=>      true
                );
 
                public function __construct()
@@ -195,7 +196,7 @@
                {
                        $check_list_id = phpgw::get_var('check_list_id');
                        $check_list = 
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
-
+                       
                        return json_encode( $check_list );
                }
 
@@ -214,7 +215,33 @@
 
                        self::render_template_xsl('edit_check_list', $data);
                }
+               
+               public function update_check_list(){
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $status = 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');
+                       
+                       $planned_date_ts = $this->get_timestamp_from_date( 
$planned_date ); 
+                       $completed_date_ts = $this->get_timestamp_from_date( 
$completed_date );
+                       
+                       // Fetches check_list from DB
+                       $update_check_list = 
$this->so_check_list->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_check_list->update( 
$update_check_list );
+                       
+                       if($check_list_id > 0)
+                               return json_encode( array( "saveStatus" => 
"updated" ) );
+                       else
+                               return json_encode( array( "saveStatus" => 
"not_updated" ) );
+               }
+
                public function control_calendar_status_overview()
                {
                        $control_id = phpgw::get_var('control_id');
@@ -338,7 +365,7 @@
                        if($check_item_id > 0)
                                return json_encode( array( "saveStatus" => 
"saved" ) );
                        else
-                               return json_encode( array( "status" => 
"not_saved" ) );
+                               return json_encode( array( "saveStatus" => 
"not_saved" ) );
                }
 
                public function save_check_list(){
@@ -487,4 +514,17 @@
 
                        return $this->yui_results($results);
                }
+               
+               function get_timestamp_from_date( $date_string ){
+                       $pos_day = strpos($date_string, "/"); 
+                       $day =  substr($date_string, 0, $pos_day);
+                       
+                       $pos_month = strpos($date_string, "-");
+                       $len_month = $pos_month - $pos_day -1;
+                       $month = substr($date_string, $pos_day+1, $len_month);
+                       
+                       $year = substr($date_string, $pos_month + $len_month-1, 
strlen($date_string)-1);
+                       
+                       return mktime(0, 0, 0, $month, $day, $year);
+               }
        }

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
  2012-01-02 15:15:55 UTC (rev 8473)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicheck_list_for_location.inc.php
  2012-01-02 17:07:47 UTC (rev 8474)
@@ -361,37 +361,47 @@
                
                function edit_check_list_for_location(){
                        $check_list_id = phpgw::get_var('check_list_id');
+
+                       // Fetches check list with check items
+                       $open_check_list_with_check_items = 
$this->so_check_list->get_single_with_check_items($check_list_id, 'open');
+
+                       // Fetches check list with check items
+                       $handled_check_list_with_check_items = 
$this->so_check_list->get_single_with_check_items($check_list_id, 'handled');
                                                
-                       $check_list_with_check_items = 
$this->so_check_list->get_single_with_check_items($check_list_id);
-                                               
-                       $location_code = 
$check_list_with_check_items["location_code"];  
+                       $location_code = 
$open_check_list_with_check_items["location_code"];
                                
-                       $control_item_list_all = 
$this->so_control_item->get_control_items_by_control_id($check_list_with_check_items["control_id"]);
+                       // Fetches all control items for check list
+                       $control_items_for_check_list = 
$this->so_control_item->get_control_items_by_control_id($open_check_list_with_check_items["control_id"]);
                        
+                       // Puts ids for control items that is registered as 
check item in an array   
                        $control_item_ids = array();
-                       
foreach($check_list_with_check_items["check_item_array"] as $check_item){
+                       
foreach($open_check_list_with_check_items["check_item_array"] as $check_item){
                                $control_item_ids[] = 
$check_item["control_item_id"];
                        }
                        
-                       $control_item_list_stripped = array();
-                       
-                       foreach($control_item_list_all as $control_item){
-                               
+                       // Puts control items not registered as check item in 
an array
+                       $control_items_not_registered = array();
+                       foreach($control_items_for_check_list as $control_item){
                                if( !in_array($control_item->get_id(), 
$control_item_ids) ){
-                                       $control_item_list_stripped[] = 
$control_item->toArray(); 
+                                       $control_items_not_registered[] = 
$control_item->toArray();
                                }
-                       } 
+                       }
                        
+                       // Fetches check items that registeres measurement
+                       $measurement_check_items = 
$this->so_check_list->get_single_with_check_items($check_list_id, null, 
'control_item_type_2');
+                                               
                        $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
        
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $data = array
                        (
-                               'location_array'        => $location_array,
-                               'check_list'                    => 
$check_list_with_check_items,
-                               'control_items_list'    => 
$control_item_list_stripped,
-                               'date_format'                   => $date_format
+                               'open_check_list_with_check_items'              
=> $open_check_list_with_check_items,
+                               'handled_check_list_with_check_items'   => 
$handled_check_list_with_check_items,
+                               'control_items_not_registered'                  
=> $control_items_not_registered,
+                               'measurement_check_items'                       
        => $measurement_check_items,
+                               'location_array'                                
                => $location_array,
+                               'date_format'                                   
                => $date_format
                        );
                        
                        self::add_javascript('controller', 'controller', 
'jquery.js');

Modified: 
branches/Version-1_0-branch/controller/inc/class.uierror_report_message.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uierror_report_message.inc.php 
    2012-01-02 15:15:55 UTC (rev 8473)
+++ 
branches/Version-1_0-branch/controller/inc/class.uierror_report_message.inc.php 
    2012-01-02 17:07:47 UTC (rev 8474)
@@ -80,12 +80,10 @@
                        $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
                        
                        $catsObj = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
-                                                       
-                       $this->cat_id = 89;
-                       $this->cats->supress_info       = true;                 
+                       $catsObj->supress_info = true;
+                       
                        $categories     = 
$catsObj->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $this->cat_id, 'use_acl' => 
$this->_category_acl));
 
-                       
                        $data = array
                        (
                                'categories'                    => $categories,
@@ -110,6 +108,7 @@
                        $check_item_ids = phpgw::get_var('check_item_ids');
                        $location_code = phpgw::get_var('location_code');
                        $message_title = phpgw::get_var('message_title');
+                       $message_cat_id = phpgw::get_var('message_cat_id');
                        
                        $check_list_with_check_items = 
$this->so_check_list->get_single_with_check_items($check_list_id);
                                                
@@ -130,13 +129,13 @@
                        
                        $ticket = array
                        (
-                               'origin'                => $location_id,
-                               'origin_id'             => $location_item_id,
-                               'location_code' => $location_code,
-                               'cat_id'                => $cat_id,
-                               'priority'              => $priority, //valgfri 
(1-3)
-                               'title'                 => $message_title,
-                               'details'               => $details,
+                               'origin'                        => $location_id,
+                               'origin_id'                     => 
$location_item_id,
+                               'location_code'         => $location_code,
+                               'cat_id'                        => 
$message_cat_id,
+                               'priority'                      => $priority, 
//valgfri (1-3)
+                               'title'                         => 
$message_title,
+                               'details'                       => $details,
                                'file_input_name'       => 'file' // default, 
men valgfri
                        );
                        
@@ -151,9 +150,15 @@
                        
                        $message_ticket = 
$botts->read_single($message_ticket_id);
                        
+                       $catsObj = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
+                       $catsObj->supress_info = true;
+                       
+                       $category = 
$catsObj->return_single($message_ticket["cat_id"]);
+                       
                        $data = array
                        (
                                'message_ticket'                => 
$message_ticket,
+                               'category'                              => 
$category[0]['name'],
                                'location_array'                => 
$location_array,
                                'control_array'                 => 
$control->toArray(),
                                'check_list'                    => 
$check_list_with_check_items,

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php   
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_item.inc.php   
2012-01-02 17:07:47 UTC (rev 8474)
@@ -40,7 +40,8 @@
                protected $comment;
                protected $check_list_id;
                protected $message_ticket_id;
-               
+               protected $measurement;
+                               
                // Objects
                protected $control_item;
                
@@ -97,7 +98,14 @@
                
                public function get_message_ticket_id() { return 
$this->message_ticket_id; }
                
+               public function set_measurement($measurement)
+               {
+                       $this->measurement = $measurement;
+               }
                
+               public function get_measurement() { return $this->measurement; }
+               
+               
                // =================  Getters and setters for objects 
=================
                
                public function set_control_item($control_item)

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-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php   
2012-01-02 17:07:47 UTC (rev 8474)
@@ -43,6 +43,8 @@
                protected $completed_date;
                protected $location_code;
                protected $component_id;
+               
+               // Objects
                protected $check_item_array = array();
                protected $control;
                

Modified: 
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php 
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php 
2012-01-02 17:07:47 UTC (rev 8474)
@@ -40,6 +40,7 @@
                protected $what_to_do;
                protected $how_to_do;
                protected $control_group_id;
+               protected $type;
                
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -100,6 +101,13 @@
                }
                
                public function get_control_group_name() { return 
$this->control_group_name; }
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
+               public function get_type() { return $this->type; }
                        
                /**
                 * Get a static reference to the storage object associated with 
this model object

Modified: branches/Version-1_0-branch/controller/js/controller/ajax.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/js/controller/ajax.js        
2012-01-02 17:07:47 UTC (rev 8474)
@@ -257,4 +257,40 @@
                        });
        });
        
+       // file: edit_check_list.xsl
+       $("#frm_update_check_list").submit(function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+               
+               $.ajax({
+                         type: 'POST',
+                         url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                         success: function(data) {
+                                 if(data){
+                                 var obj = jQuery.parseJSON(data);
+                               
+                                 if(obj.saveStatus == "updated"){
+                                         var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                         $(submitBnt).val("Lagret");   
+                                                 
+                                         // Changes text on save button back 
to original
+                                         window.setTimeout(function() {
+                                                       $(submitBnt).val('Lagre 
sjekkpunkt');
+                                                       
$(submitBnt).addClass("not_active");
+                                         }, 1000);
+                                         }
+                                 }
+                               }
+               });
+       });
+       
+       // file: edit_check_list.xsl
+       $("#frm_update_check_list").click(function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
 });
\ No newline at end of file

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-01-02 
15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-01-02 
17:07:47 UTC (rev 8474)
@@ -17,6 +17,7 @@
 DATATABLE_MSG_LOADING  controller      no      Laster data
 Sort_check_list        controller      no      Sorter sjekkliste
 Show_check_lists       controller      no      Vis sjekklister
+save_check_list        controller      no      Lagre sjekkliste
 title  controller      no      kontroll
 close  controller      no      Lukk
 clear  controller      no      Nullstill

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-01-02 
15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-01-02 
17:07:47 UTC (rev 8474)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.14';
+       $setup_info['controller']['version'] = '0.1.15';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-01-02 17:07:47 UTC (rev 8474)
@@ -44,7 +44,8 @@
                                'what_to_do' => array('type' => 
'text','nullable' => false),
                                'how_to_do' => array('type' => 
'text','nullable' => false),
                                'control_group_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'control_area_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'control_area_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'type' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),
@@ -58,7 +59,8 @@
                                'status' => array('type' => 'bool','nullable' 
=> true,'default' => 'false'),
                                'comment' => array('type' => 
'varchar','precision' => '255','nullable' => False),
                                'check_list_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
-                               'message_ticket_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True)
+                               'message_ticket_id' => array('type' => 'int', 
'precision' => 4, 'nullable' => True),
+                               'measurement' => array('type' => 'int', 
'precision' => 8, 'nullable' => True)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-01-02 17:07:47 UTC (rev 8474)
@@ -296,3 +296,25 @@
                $GLOBALS['setup_info']['controller']['currentver'] = '0.1.14';
                return $GLOBALS['setup_info']['controller']['currentver'];
        }
+
+       $test[] = '0.1.14';
+       function controller_upgrade0_1_14()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item', 
'measurement',array(
+                       'type' => 'int',
+                       'precision' => 8,
+                       'nullable' => true,
+                       'default' => 0
+               ));
+               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_item', 
'type',array(
+                       'type' => 'varchar',
+                       'precision' => 255,
+                       'nullable' => true,
+                       'default' => 0
+               ));
+
+               $GLOBALS['setup_info']['controller']['currentver'] = '0.1.15';
+               return $GLOBALS['setup_info']['controller']['currentver'];
+       }
+       
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/create_error_report_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/create_error_report_message.xsl
       2012-01-02 15:15:55 UTC (rev 8473)
+++ 
branches/Version-1_0-branch/controller/templates/base/create_error_report_message.xsl
       2012-01-02 17:07:47 UTC (rev 8474)
@@ -4,12 +4,22 @@
 
 <div id="main_content">
        
-               <h1>Send avviksmelding på bygg: <xsl:value-of 
select="location_array/loc1_name"/></h1>
+               <h1>Send avviksmelding</h1>
                
-               <h2>Kontroll <xsl:value-of select="control_array/title"/></h2>
-               <h2>Utført dato <xsl:value-of select="php:function('date', 
$date_format, number(check_list/completed_date))"/></h2>
+               <div id="error_report_message_details">
+                       <h3>Bygg: <xsl:value-of 
select="location_array/loc1_name"/></h3>
+                       <h3>Tittel på kontroll: <xsl:value-of 
select="control_array/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>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <h3>Kontroll ble utført dato:  Ikke 
registrert utført</h3>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
                                
-               <div id="error_report_message_details">
+               <fieldset id="error_report_message_details">
                        
 
                        <xsl:choose>
@@ -31,40 +41,45 @@
                                      </xsl:attribute>
                                    </input>
                                    
-                                       <label style="font-size: 
15px;font-weight: bold;">Tittel på melding</label>
-                                       <input name="message_title" type="text" 
/>
+                                   <div>
+                                               <label style="font-size: 
15px;font-weight: bold;">Tittel på melding</label>
+                                               <input name="message_title" 
type="text" />
+                                       </div>
                                        
-                                        <select>
-                                               <xsl:for-each 
select="categories/cat_list">
-                                                       <xsl:variable 
name="cat_id"><xsl:value-of select="./cat_id"/></xsl:variable>
-                                                       <option 
value="{$cat_id}">
-                                                               <xsl:value-of 
select="./name"/>
-                                                       </option>               
        
-                                               </xsl:for-each>
-                                       </select>
+                                       <div>
+                                               <label style="font-size: 
15px;font-weight: bold;">Kategori</label>
+                                                <select name="message_cat_id">
+                                                       <option value="0">Velg 
kategori</option>
+                                                       <xsl:for-each 
select="categories/cat_list">
+                                                               <xsl:variable 
name="cat_id"><xsl:value-of select="./cat_id"/></xsl:variable>
+                                                               <option 
value="{$cat_id}">
+                                                                       
<xsl:value-of select="./name"/>
+                                                               </option>       
                
+                                                       </xsl:for-each>
+                                               </select>
+                                       </div>
                        
-                       
                                        <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i avviksmelding</h3>                             
    
-                                       <ul class="check_items expand_list">
+                                       <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>
-                                                               <h4><input 
type="checkbox" name="check_item_ids[]" value="{$check_item_id}" 
/><span><xsl:value-of select="control_item/title"/></span></h4>                 
                            
+                                                               <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>
                                        </ul>
                                        
                                          <div class="form-buttons">
                                                <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                               <input type="submit" 
name="save_control" value="{$lang_save}" title="{$lang_save}" />
+                                               <input class="btn" 
type="submit" name="save_control" value="{$lang_save}" title="{$lang_save}" />
                                          </div>
                                </form>                 
                                </xsl:when>
                                <xsl:otherwise>
-                                       Ingen sjekkpunkter
+                                       Ingen registrerte avvik
                                </xsl:otherwise>
                        </xsl:choose>
-               </div>
+               </fieldset>
                
                
                        

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-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css  
2012-01-02 17:07:47 UTC (rev 8474)
@@ -692,7 +692,7 @@
 }
 #main_content fieldset.check_list_details {
     background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #CCCCCC;
+    border: 1px solid #A3A3A3;
     padding: 15px;
 }
 #main_content fieldset.check_item_details{
@@ -775,8 +775,8 @@
     margin: 5px 0;
     clear:left;
 }
-h2.check_item_details{
-       margin-bottom:5px;      
+h3.check_item_details{
+       margin-bottom:0;        
 }
 .check_item textarea{
        width:400px;
@@ -969,7 +969,7 @@
     font-weight: normal;
     height: 22px;
     margin-right: 10px;
-    padding-top: 5px;
+    padding-top: 4px;
     text-align: center;
     width: 66px;
 }
@@ -1013,57 +1013,46 @@
 .frm_save_check_item input[type='submit']{
        width: 130px;   
 }
-ul.check_items{
-       width: 800px;
+ul.check_items {
+    width: 625px;
 }
-.tab_menu div.active{
-       background: url('../../../images/bg_tab_menu_active.png') no-repeat;
+
+ul.check_items h5{
+       margin:10px;
+       font-size: 12px;
 }
-.tab_menu div.active a{
-       color: #FFF;
-}
 .tab_menu {
     height: 29px;
-    margin: 15px 0 0;
     overflow: hidden;
 }
-.tab_menu div {
-    background: url("../../../images/bg_tab_menu_not_active.png") no-repeat 
scroll 0 0 transparent;
+.tab_menu a {
+       background: none repeat scroll 0 0 #FAFAFA;
     color: #000000;
     cursor: pointer;
+    display: block;
+    height: 30px;
+    width: 130px;
+    padding-top: 9px;
+    text-align: center;
+    text-decoration: none;
+    border: 1px solid #A3A3A3;
     float: left;
     font-size: 12px;
     font-weight: normal;
-    height: 30px;
-    padding-top: 9px;
-    text-align: center;
-    width: 93px;
-    word-wrap: normal;
+    margin-right: 3px;
 }
-.tab_menu div.ext {
-    padding-top: 0px;
+.tab_menu a.active {
+       background: #2647A0;
+       border: none;
+       color: #FFF;
 }
-.tab_menu div a{
-    text-decoration:none;
-    color:#333;
-}
-.tab_menu div.ext a{
-       display:block;
-    font-size: 11px;
-    line-height: 12px;
-    margin: 0;
-    padding: 3px 0 0 9px;
-    text-align: center;
-    width: 75px;
-    text-decoration:none;
-}
 .tab_item {
-       display:none;
-       background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #ddd;
-    margin: 0;
+    background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #A3A3A3;
+    display: none;
+    margin: 0 318px 0 0;
     padding: 15px;
-    width: 800px;      
+    width: 628px;
 }
 .tab_item h2{
        margin:0 0 10px;
@@ -1112,10 +1101,47 @@
        position:absolute;
     z-index: 1;
 }
-#error_report_message_details{
-       background: none repeat scroll 0 0 #EDF5FF;
-    border: 1px solid #ddd;
-    margin: 0;
+#main_content #error_report_message_details {
+    background: none repeat scroll 0 0 #EDF5FF;
+    border: 1px solid #DDDDDD;
+    margin: 20px 0;
     padding: 15px;
-    width: 800px;      
+    width: 800px;
+}
+#error_report_message_details label{
+       display: inline-block;
+       width: 130px;   
+}
+.btn{
+       background: none repeat scroll 0 0 #2647A0;
+    color: #FFFFFF;
+    display: inline-block;
+    margin-right: 5px;
+    padding: 5px 10px;
+    text-decoration: none;
+    border: 1px solid #173073;
+    cursor: pointer;
+}
+#frm_update_check_list input[type="submit"]{
+       width: 140px;   
+}
+#error_message_menu {
+    float: left;
+    margin-top: 50px;
+}
+#error_message_menu a {
+    text-align: center;
+    width: 130px;
+    margin: 2px 0;  
+    display:block;
+}
+
+#view_errors {
+       float:left;
+    margin: 20px 0 0 20px;   
+}
+#register_errors {
+       display:none;
+    float: right;
+    margin-top: 20px;   
 }
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl   
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/controller/templates/base/edit_check_list.xsl   
2012-01-02 17:07:47 UTC (rev 8474)
@@ -23,28 +23,37 @@
                        });
                        
                        $(".tab_menu a").click(function(){
+                               var thisTabA = $(this);
+                               var thisTabMenu = $(this).parent(".tab_menu");
+                                                               
+                               var showId = $(thisTabA).attr("href");
+                               var hideId = $(".tab_menu 
a.active").attr("href");
+                                                               
+                               $(".tab_menu a").removeClass("active");
+                               $(".tab_item").removeClass("active");
+                               $(thisTabA).addClass('active');
+                                                               
+                               $(hideId).hide();
+                               $(showId).fadeIn('10', function(){
+                                       $(showId).addClass('active');
+                                       
+                               });
                        
+                               return false;
+                       });
+                                               
+                       $("#reg_errors").click(function(){
                                var thisA = $(this);
-                               var wrpDiv = $(this).parent();
                                var showId = $(thisA).attr("href");
-                               
-                               var activeA = $(".tab_menu").find("div.active");
-                               var hideId = $(activeA).find("a").attr("href");
-                               
-                                                               
-                               
$(".tab_menu").find("div.active").removeClass("active");
-                               
-                               $(wrpDiv).addClass("active");
-                               
-                               $(hideId).fadeOut('1000', function(){
-                                       $(showId).fadeIn('1000');
-                               });                     
-                                                       
-                                                       
-                       
+                               var hideId = "#view_errors";
+                                                                       
+                               $(hideId).hide();
+                               $(showId).fadeIn('10');
+                               $(thisA).fadeOut('10');
+
                                return false;
                        });
-                                               
+                       
                });
        </script>
                
@@ -52,40 +61,42 @@
                
                <fieldset class="check_list_details">
                
-                       <xsl:variable name="check_list_id"><xsl:value-of 
select="check_list/id"/></xsl:variable>
-                       <input type="hidden" name="check_list_id" 
value="{$check_list_id}" />   
+               <form id="frm_update_check_list" 
action="index.php?menuaction=controller.uicheck_list.update_check_list" 
method="post">
                                
+                       <xsl:variable name="check_list_id"><xsl:value-of 
select="open_check_list_with_check_items/id"/></xsl:variable>
+                       <input type="hidden" name="check_list_id" 
value="{$check_list_id}" />
+                               
                        <div>
                                <label>ID</label>
                                <input>
                             <xsl:attribute 
name="name">check_list_id</xsl:attribute>
-                             <xsl:attribute name="value"><xsl:value-of 
select="check_list/id"/></xsl:attribute>
+                            <xsl:attribute name="value"><xsl:value-of 
select="open_check_list_with_check_items/id"/></xsl:attribute>
                            </input>
                    </div>
                        <div>
                                <label>Status</label>
-                                       <xsl:variable 
name="status"><xsl:value-of select="check_list/status"/></xsl:variable>
-                                       <select name="status">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="check_list/status = 0">
-                                                               <option 
value="0" SELECTED="SELECTED">Ikke utført</option>
-                                                               <option 
value="1" >Utført</option>
-                                                       </xsl:when>
-                                                       <xsl:when 
test="check_list/status = 1">
-                                                               <option 
value="0">Ikke utført</option>
-                                                               <option 
value="1" SELECTED="SELECTED">Utført</option>
-                                                       </xsl:when>
-                                               </xsl:choose>
-                                       </select>
+                               <xsl:variable name="status"><xsl:value-of 
select="open_check_list_with_check_items/status"/></xsl:variable>
+                               <select name="status">
+                                       <xsl:choose>
+                                               <xsl:when 
test="open_check_list_with_check_items/status = 0">
+                                                       <option value="0" 
SELECTED="SELECTED">Ikke utført</option>
+                                                       <option value="1" 
>Utført</option>
+                                               </xsl:when>
+                                               <xsl:when 
test="open_check_list_with_check_items/status = 1">
+                                                       <option value="0">Ikke 
utført</option>
+                                                       <option value="1" 
SELECTED="SELECTED">Utført</option>
+                                               </xsl:when>
+                                       </xsl:choose>
+                               </select>
                        </div>
                        <div>
                                <label>Skal utføres innen</label>
                                <input>
-                             <xsl:attribute name="id">deadline</xsl:attribute>
-                             <xsl:attribute 
name="name">deadline</xsl:attribute>
+                             <xsl:attribute 
name="id">deadline_date</xsl:attribute>
+                             <xsl:attribute 
name="name">deadline_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                             <xsl:if test="check_list/deadline != 0">
-                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/deadline))"/></xsl:attribute>
+                             <xsl:if 
test="open_check_list_with_check_items/deadline != 0">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(open_check_list_with_check_items/deadline))"/></xsl:attribute>
                                  </xsl:if>
                            </input>
                        </div>
@@ -95,8 +106,8 @@
                              <xsl:attribute 
name="id">planned_date</xsl:attribute>
                              <xsl:attribute 
name="name">planned_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                             <xsl:if test="check_list/planned_date != 0">
-                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/planned_date))"/></xsl:attribute>
+                             <xsl:if 
test="open_check_list_with_check_items/planned_date != 0">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(open_check_list_with_check_items/planned_date))"/></xsl:attribute>
                              </xsl:if>
                            </input>
                    </div>
@@ -106,45 +117,59 @@
                              <xsl:attribute 
name="id">completed_date</xsl:attribute>
                              <xsl:attribute 
name="name">completed_date</xsl:attribute>
                              <xsl:attribute name="type">text</xsl:attribute>
-                                 <xsl:if test="check_list/completed_date != 0">
-                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(check_list/completed_date))"/></xsl:attribute>
+                                 <xsl:if 
test="open_check_list_with_check_items/completed_date != 0">
+                               <xsl:attribute name="value"><xsl:value-of 
select="php:function('date', $date_format, 
number(open_check_list_with_check_items/completed_date))"/></xsl:attribute>
                              </xsl:if>
                            </input>
                    </div>
                        <div>
                                <label class="comment">Kommentar</label>
                                <textarea>
-                                 <xsl:attribute 
name="name">check_list_comment</xsl:attribute>
-                                 <xsl:value-of select="check_list/comment"/>
+                                 <xsl:attribute 
name="name">comment</xsl:attribute>
+                                 <xsl:value-of 
select="open_check_list_with_check_items/comment"/>
                                </textarea>
                        </div>
+                       
+                       <div class="form-buttons">
+                               <xsl:variable name="lang_save"><xsl:value-of 
select="php:function('lang', 'save_check_list')" /></xsl:variable>
+                               <input class="btn not_active" type="submit" 
name="save_control" value="{$lang_save}" title="{$lang_save}" />
+                       </div>
+                       </form>
                </fieldset>
                
-               <a>
-                       <xsl:attribute name="href">
-                               
<xsl:text>index.php?menuaction=controller.uierror_report_message.create_error_report_message</xsl:text>
-                               <xsl:text>&amp;check_list_id=</xsl:text>
-                               <xsl:value-of select="check_list/id"/>
-                       </xsl:attribute>
-                       Send avviksmelding
-               </a>
-               
-               <div class="tab_menu">
-                       <div class="active ext"><a 
href="#control_items_list">Registrer avvik</a></div>
-                       <div><a href="#check_list_not_fixed_list">Vis åpne 
avvik</a></div>
-                       <div><a href="#check_list_fixed_list">Vis håndterte 
avvik</a></div>
+               <div id="error_message_menu">
+                       <a class="btn">
+                               <xsl:attribute name="id">
+                                       <xsl:text>reg_errors</xsl:text>
+                               </xsl:attribute>                                
        
+                               <xsl:attribute name="href">
+                                       <xsl:text>#register_errors</xsl:text>
+                               </xsl:attribute>
+                               Registrer avvik
+                       </a>
+                       <a class="btn">
+                               <xsl:attribute name="href">
+                                       
<xsl:text>index.php?menuaction=controller.uierror_report_message.create_error_report_message</xsl:text>
+                                       <xsl:text>&amp;check_list_id=</xsl:text>
+                                       <xsl:value-of 
select="open_check_list_with_check_items/id"/>
+                               </xsl:attribute>
+                               Send avviksmelding
+                       </a>
                </div>
                
-               <div id="control_items_list" class="tab_item active">
+               <div id="register_errors">
+                       <div class="tab_menu"><a class="active">Registrer 
avvik</a></div>
+                                       
+                       <div class="tab_item active">
                        <h2 class="check_item_details">Velg sjekkpunkter som 
skal registreres som avvik</h2>
 
                        <xsl:choose>
-                               <xsl:when 
test="control_items_list/child::node()">
+                               <xsl:when 
test="control_items_not_registered/child::node()">
                                
                                        <ul id="control_items_list" 
class="check_items expand_list">
-                                               <xsl:for-each 
select="control_items_list">
+                                               <xsl:for-each 
select="control_items_not_registered">
                                                        <li>
-                                                       <h4><img 
src="controller/images/arrow_right.png" width="14"/><xsl:number/>. 
<span><xsl:value-of select="title"/></span></h4>                                
            
+                                                       <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="title"/></span></h4>                                           
                                                                <form 
class="frm_save_control_item" 
action="index.php?menuaction=controller.uicheck_list.add_check_item_to_list" 
method="post">
                                                                        
<xsl:variable name="control_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                        <input 
type="hidden" name="control_item_id" value="{$control_item_id}" /> 
@@ -152,7 +177,7 @@
                                                                      
<xsl:attribute name="name">check_list_id</xsl:attribute>
                                                                      
<xsl:attribute name="type">hidden</xsl:attribute>
                                                                      
<xsl:attribute name="value">
-                                                                       
<xsl:value-of select="//check_list/id"/>
+                                                                       
<xsl:value-of select="//open_check_list_with_check_items/id"/>
                                                                      
</xsl:attribute>
                                                                    </input>
                                                                    <input>
@@ -203,21 +228,27 @@
                                        </xsl:otherwise>
                        </xsl:choose>
                </div>
+               </div>
                
+               <div id="view_errors">
                
-               <div id="check_list_not_fixed_list" class="tab_item">
-                       <h2 class="check_item_details">Åpne avvik</h2>
+               <div class="tab_menu">
+                       <a class="active" href="#view_open_errors">Vis åpne 
avvik</a>
+                       <a href="#view_handled_errors">Vis håndterte avvik</a>
+                       <a href="#view_measurements">Vis målinger</a>
+               </div>  
                
+               <div id="view_open_errors" class="tab_item active">
                        <xsl:choose>
-                               <xsl:when 
test="check_list/check_item_array/child::node()">
+                               <xsl:when 
test="open_check_list_with_check_items/check_item_array/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="check_list/check_item_array">
+                                               <xsl:for-each 
select="open_check_list_with_check_items/check_item_array">
                                                                <li>
                                                                <xsl:if 
test="status = 0">
-                                                                       
<h4><img src="controller/images/arrow_right.png" width="14"/><xsl:number />. 
<span><xsl:value-of select="control_item/title"/></span></h4>                   
                           
+                                                                       
<h4><img src="controller/images/arrow_right.png" 
width="14"/><span><xsl:value-of select="control_item/title"/></span></h4>       
                                       
                                                                        <form 
class="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
                                                                                
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
<input type="hidden" name="check_item_id" value="{$check_item_id}" /> 
@@ -227,12 +258,12 @@
                                                                                
       <select name="status">
                                                                                
                <xsl:choose>
                                                                                
                        <xsl:when test="status = 0">
-                                                                               
                                <option value="0" SELECTED="SELECTED">Feil på 
sjekkpunkt</option>
-                                                                               
                                <option value="1">Feil fikset</option>
+                                                                               
                                <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">Feil på sjekkpunkt</option>
-                                                                               
                                <option value="1" SELECTED="SELECTED">Feil 
fikset</option>
+                                                                               
                                <option value="0">Avvik er åpent</option>
+                                                                               
                                <option value="1" SELECTED="SELECTED">Avvik er 
håndtert</option>
                                                                                
                        </xsl:when>
                                                                                
                </xsl:choose>
                                                                                
           </select>
@@ -263,24 +294,22 @@
                                        </ul>                   
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               Ingen sjekkpunkter
+                                               Ingen registrerte åpne avvik
                                        </xsl:otherwise>
                        </xsl:choose>
                </div>
                
-               <div id="check_list_fixed_list" class="tab_item"> 
-                       <h2 class="check_item_details">Avvik som er 
håndterte</h2>
-               
+               <div id="view_handled_errors" class="tab_item"> 
                        <xsl:choose>
-                               <xsl:when 
test="check_list/check_item_array/child::node()">
+                               <xsl:when 
test="handled_check_list_with_check_items/check_item_array/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="check_list/check_item_array">
+                                               <xsl:for-each 
select="handled_check_list_with_check_items/check_item_array">
                                                                <xsl:if 
test="status = 1">
                                                                <li>
-                                                               <h4><img 
src="controller/images/arrow_right.png" width="14"/><xsl:number/>. 
<span><xsl:value-of select="control_item/title"/></span></h4>                   
                            
+                                                               <h4><img 
src="controller/images/arrow_right.png" width="14"/><span><xsl:value-of 
select="control_item/title"/></span></h4>                                       
       
                                                                        <form 
class="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
                                                                                
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
                                                                                
<input type="hidden" name="check_item_id" value="{$check_item_id}" /> 
@@ -326,9 +355,72 @@
                                        </ul>                   
                                        </xsl:when>
                                        <xsl:otherwise>
-                                               Ingen sjekkpunkter
+                                               Ingen registrerte håndterte 
avvik
                                        </xsl:otherwise>
                        </xsl:choose>
-               </div>  
+               </div>
+               
+               <div id="view_measurements" class="tab_item">
+                       <xsl:choose>
+                               <xsl:when 
test="measurement_check_items/check_item_array/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="handled_check_list_with_check_items/check_item_array">
+                                                               <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 
class="frm_save_check_item" 
action="index.php?menuaction=controller.uicheck_list.save_check_item" 
method="post">
+                                                                               
<xsl:variable name="check_item_id"><xsl:value-of select="id"/></xsl:variable>
+                                                                               
<input type="hidden" name="check_item_id" value="{$check_item_id}" /> 
+                                                                               
<div class="check_item">
+                                                                               
  <div>
+                                                                               
       <label>Status</label>
+                                                                               
       <select name="status">
+                                                                               
                <xsl:choose>
+                                                                               
                        <xsl:when test="status = 0">
+                                                                               
                                <option value="0" SELECTED="SELECTED">Feil på 
sjekkpunkt</option>
+                                                                               
                                <option value="1">Feil fikset</option>
+                                                                               
                        </xsl:when>
+                                                                               
                        <xsl:when test="status = 1">
+                                                                               
                                <option value="0">Feil på sjekkpunkt</option>
+                                                                               
                                <option value="1" SELECTED="SELECTED">Feil 
fikset</option>
+                                                                               
                        </xsl:when>
+                                                                               
                </xsl:choose>
+                                                                               
           </select>
+                                                                              
</div>
+                                                                              
<div>
+                                                                               
 <label class="comment">Kommentar</label>
+                                                                               
 <textarea name="comment">
+                                                                               
                <xsl:value-of select="comment"/>
+                                                                               
         </textarea>
+                                                                              
</div>
+                                                                              
<div>
+                                                                               
 <label>Hva skal gjøres</label>
+                                                                               
 <textarea><xsl:value-of select="control_item/what_to_do"/></textarea>
+                                                                              
</div>
+                                                                              
<div>
+                                                                               
 <label>Utførelsesbeskrivelse</label>
+                                                                               
 <textarea><xsl:value-of select="control_item/what_to_do"/></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="{$lang_save}" 
class="not_active" title="{$lang_save}" />
+                                                                               
        </div>
+                                                                               
</div>
+                                                                       </form>
+                                                               </xsl:if>
+                                                   </li>
+                                               </xsl:for-each>
+                                       </ul>                   
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               Ingen registrerte målinger
+                                       </xsl:otherwise>
+                       </xsl:choose>
+               </div>
+               
+       </div>
 </div>
 </xsl:template>

Modified: 
branches/Version-1_0-branch/controller/templates/base/view_error_report_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/view_error_report_message.xsl
 2012-01-02 15:15:55 UTC (rev 8473)
+++ 
branches/Version-1_0-branch/controller/templates/base/view_error_report_message.xsl
 2012-01-02 17:07:47 UTC (rev 8474)
@@ -4,14 +4,23 @@
 
 <div id="main_content">
        
-               <h1>Send avviksmelding på bygg: <xsl:value-of 
select="location_array/loc1_name"/></h1>
+               <h1>Send avviksmelding</h1>
                
-               <h2>Kontroll <xsl:value-of select="control_array/title"/></h2>
-               <h2>Utført dato <xsl:value-of select="php:function('date', 
$date_format, number(check_list/completed_date))"/></h2>
-                               
+               <h3>Følgende meldingsdata ble sendt</h3>
                <div id="error_report_message_details">
+                       <h3>Bygg: <xsl:value-of 
select="location_array/loc1_name"/></h3>
+                       <h3>Tittel på kontroll: <xsl:value-of 
select="control_array/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>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <h3>Kontroll ble utført dato:  Ikke 
registrert utført</h3>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </div>
                        
-
+               <div id="error_report_message_details">
                        <xsl:choose>
                                <xsl:when 
test="check_list/check_item_array/child::node()">
                                        
@@ -30,38 +39,27 @@
                                        <xsl:value-of 
select="location_array/location_code"/>
                                      </xsl:attribute>
                                    </input>
-                                   
-                                       <label style="font-size: 
15px;font-weight: bold;">Tittel på melding</label>
-                                       <xsl:value-of 
select="message_ticket/subject"/>
                        
-                                       <h3 class="check_item_details">Velg 
sjekkpunkter som skal være med i avviksmelding</h3>                             
    
-                                       <ul class="check_items expand_list">
+                                       <div>       
+                                               <label style="font-size: 
15px;font-weight: bold;">Tittel på melding</label>
+                                               <xsl:value-of 
select="message_ticket/subject"/>
+                                       </div>
+                                       
+                                       <div>
+                                               <label style="font-size: 
15px;font-weight: bold;">Kategori</label>
+                                               <span><xsl:value-of 
select="category"/></span> 
+                                       </div>
+                       
+                       
+                                       <h3 
class="check_item_details">Avviksmeldingen omfattet følgende sjekkpunkter</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>
-                                                               
<h4><xsl:value-of select="control_item/title"/></h4>                            
                
+                                                               
<h5><xsl:value-of select="control_item/title"/></h5>                            
                
                                                        </li>
                                                </xsl:for-each>
                                        </ul>
-                                       
-                                       <a>
-                                               <xsl:attribute name="href">
-                                                       
<xsl:text>index.php?menuaction=controller.uierror_report_message.create_error_report_message</xsl:text>
-                                                       
<xsl:text>&amp;check_list_id=</xsl:text>
-                                                       <xsl:value-of 
select="check_list/id"/>
-                                               </xsl:attribute>
-                                     Registrer ny melding
-                                   </a>
-                                   
-                                   <a>
-                                               <xsl:attribute name="href">
-                                                       
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
-                                                       
<xsl:text>&amp;check_list_id=</xsl:text>
-                                                       <xsl:value-of 
select="check_list/id"/>
-                                               </xsl:attribute>
-                                     Endre sjekkliste
-                                   </a>
-                                       
                                </form>                 
                                </xsl:when>
                                <xsl:otherwise>
@@ -70,7 +68,21 @@
                        </xsl:choose>
                </div>
                
-               
-                       
+               <a class="btn">
+                       <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uierror_report_message.create_error_report_message</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
+                       </xsl:attribute>
+             Registrer ny melding
+           </a>
+               <a class="btn">
+               <xsl:attribute name="href">
+                               
<xsl:text>index.php?menuaction=controller.uicheck_list_for_location.edit_check_list_for_location</xsl:text>
+                               <xsl:text>&amp;check_list_id=</xsl:text>
+                               <xsl:value-of select="check_list/id"/>
+                       </xsl:attribute>
+             Endre sjekkliste
+           </a>
 </div>
 </xsl:template>

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.db_adodb.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.db_adodb.inc.php     
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.db_adodb.inc.php     
2012-01-02 17:07:47 UTC (rev 8474)
@@ -64,7 +64,7 @@
                */
                function link_id()
                {
-                       if(!$this->adodb->isConnected())
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -220,7 +220,7 @@
                */
                public function query($sql, $line = '', $file = '',$exec = 
false, $fetch_single = false)
                {
-                       if ( !$this->adodb->isConnected() )
+                       if ( !$this->adodb || $this->adodb->IsConnected() )
                        {
                                $this->connect();
                        }
@@ -272,7 +272,7 @@
                                $num_rows = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }
                        
-                       if ( !$this->adodb->isConnected() )
+                       if ( !$this->adodb || $this->adodb->IsConnected() )
                        {
                                $this->connect();
                        }
@@ -355,7 +355,7 @@
                */
                public function transaction_begin()
                {
-                       if(!$this->adodb)
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -605,7 +605,7 @@
                                //echo "depi: metadata";
                        }
                        
-                       if(!$this->adodb->IsConnected())
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -626,7 +626,7 @@
                */  
                public function MetaForeignKeys($table, $owner=false, 
$upper=false)
                {
-                       if(!$this->adodb->IsConnected())
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -647,7 +647,7 @@
 
                public function metaindexes($table, $primary = false)
                {
-                       if(!$this->adodb->IsConnected())
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -677,7 +677,7 @@
                */
                public function table_names()
                {
-                       if(!$this->adodb->IsConnected())
+                       if(!$this->adodb || $this->adodb->IsConnected())
                        {
                                $this->connect();
                        }
@@ -701,7 +701,7 @@
                public function create_database($adminname = '', $adminpasswd = 
'')
                {
                        //THIS IS CALLED BY SETUP DON'T KILL IT!
-                       if ( $this->adodb->IsConnected() )
+                       if ( $this->adodb && $this->adodb->IsConnected() )
                        {
                                $this->adodb->Disconnect(); //close the dead 
connection to be safe
                        }
@@ -709,7 +709,7 @@
                        $this->adodb = 
newADOConnection($GLOBALS['phpgw_info']['server']['db_type']);
                        $this->adodb->NConnect($this->Host, $adminname, 
$adminpasswd);
                        
-                       if ( !$this->adodb->IsConnected() )
+                       if ( !$this->adodb || $this->adodb->IsConnected() )
                        {
                                echo 'Connection FAILED<br />';
                                return False;

Modified: branches/Version-1_0-branch/property/inc/class.bobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bobudget.inc.php     
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/property/inc/class.bobudget.inc.php     
2012-01-02 17:07:47 UTC (rev 8474)
@@ -46,6 +46,11 @@
                var $revision;
                var $allrows;
                var $details;
+               var     $sum_budget_cost                = 0;
+               var     $sum_obligation_cost    = 0;
+               var     $sum_actual_cost                = 0;
+               var $sum_hits                           = 0;
+               var     $total_records                  = 0;
 
                var $public_functions = array
                        (
@@ -177,7 +182,12 @@
                                'year' => $this->year, 'grouping' => 
$this->grouping, 'revision' => $this->revision,
                                'details' => $this->details,'dimb_id' => 
$this->dimb_id));
 
-                       $this->total_records = $this->so->total_records;
+                       $this->total_records            = 
$this->so->total_records;
+                       $this->sum_budget_cost          = 
$this->so->sum_budget_cost;
+                       $this->sum_obligation_cost      = 
$this->so->sum_obligation_cost;
+                       $this->sum_actual_cost          = 
$this->so->sum_actual_cost;
+                       $this->sum_hits                         = 
$this->so->sum_hits;
+
                        return $obligations;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-01-02 17:07:47 UTC (rev 8474)
@@ -34,7 +34,11 @@
 
        class property_sobudget
        {
-               var $sum_actual_cost = 0;
+               var     $sum_budget_cost                = 0;
+               var     $sum_obligation_cost    = 0;
+               var     $sum_actual_cost                = 0;
+               var $sum_hits                           = 0;
+
                function __construct()
                {
                        $this->cats                                     = 
CreateObject('phpgwapi.categories', -1,  'property', '.project');
@@ -527,7 +531,7 @@
                        $start_date = mktime(1, 1, 1, 1, 1, $year);
                        $end_date = mktime  (23, 59, 59, 12, 31, $year);
 //                     $filtermethod .= " AND fm_workorder.start_date >= 
$start_date AND fm_workorder.start_date <= $end_date";
-                       $filtermethod .= " AND fm_workorder_status.closed IS 
NULL AND fm_workorder.start_date <= $end_date";
+                       $filtermethod .= " AND fm_workorder_status.closed IS 
NULL AND fm_workorder.start_date >= $start_date AND fm_workorder.start_date <= 
$end_date";
 
                        $where = 'AND';
 
@@ -582,12 +586,18 @@
                        //_debug_array($sql);die();
                        $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
 
+                       $sum_obligation_cost = 0;
                        $obligations = array();
-
+                       $sum_hits = 0;
                        while ($this->db->next_record())
                        {
-                               
$obligations[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 = round($this->db->f('combined_cost'));
-                               
$hits[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 = $this->db->f('hits');
+                               $_combined_cost = 
round($this->db->f('combined_cost'));
+                               $sum_obligation_cost += $_combined_cost;
+                               $_hits = $this->db->f('hits');
+                               $sum_hits += $_hits;
+
+                               
$obligations[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_combined_cost;
+                               
$hits[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_hits;
                                $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[$this->db->f('district_id')] = true;
                                $ecodimb[(int)$this->db->f('ecodimb')] = true;
@@ -641,8 +651,13 @@
 
                        while ($this->db->next_record())
                        {
-                               
$obligations[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += round($this->db->f('budget'));
-                               
$hits[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $this->db->f('hits');
+                               $_budget = round($this->db->f('budget'));
+                               $sum_obligation_cost += $_budget;
+                               $_hits = $this->db->f('hits');
+                               $sum_hits += $_hits;
+
+                               
$obligations[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_budget;
+                               
$hits[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_hits;
                                $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[$this->db->f('district_id')] = true;
                                $ecodimb[(int)$this->db->f('ecodimb')] = true;
@@ -660,10 +675,14 @@
                        $sql = str_replace('budget', 'actual_cost', $sql);
                        $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
 
+                       $sum_actual_cost = 0;
                        $actual_cost = array();
                        while ($this->db->next_record())
                        {
-                               
$actual_cost[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 = round($this->db->f('actual_cost'));
+                               $_actual_cost = 
round($this->db->f('actual_cost'));
+                               $sum_actual_cost += 
round($this->db->f('actual_cost'));
+
+                               
$actual_cost[$this->db->f($b_account_field)][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_actual_cost;
                                $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[$this->db->f('district_id')] = true;
                                $ecodimb[(int)$this->db->f('ecodimb')] = true;
@@ -719,10 +738,13 @@
                        //_debug_array($sql);
                        $this->db->query($sql,__LINE__,__FILE__);
 
+                       $sum_budget_cost = 0;
                        $budget_cost = array();
                        while ($this->db->next_record())
                        {
-                               
$budget_cost[$this->db->f('b_account_field')][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 = round($this->db->f('budget_cost'));
+                               $_budget_cost = 
round($this->db->f('budget_cost'));
+                               $sum_budget_cost += $_budget_cost;
+                               
$budget_cost[$this->db->f('b_account_field')][$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_budget_cost;
                                $accout_info[$this->db->f('b_account_field')] = 
true;
                                $district[$this->db->f('district_id')] = true;
                                $ecodimb[(int)$this->db->f('ecodimb')] = true;
@@ -771,7 +793,6 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
-                       $sum_actual_cost = 0;
                        while ($this->db->next_record())
                        {
                                $_actual_cost = 
round($this->db->f('actual_cost'));
@@ -782,7 +803,11 @@
                                $ecodimb[(int)$this->db->f('dimb')] = true;
                        }
                
-                       $this->sum_actual_cost = $sum_actual_cost;
+                       $this->sum_budget_cost          = $sum_budget_cost;
+                       $this->sum_obligation_cost      = $sum_obligation_cost;
+                       $this->sum_actual_cost          = $sum_actual_cost;
+                       $this->sum_hits                         = $sum_hits;
+
                        //_debug_array($actual_cost);die();
                        $result = array();
 

Modified: branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2012-01-02 17:07:47 UTC (rev 8474)
@@ -46,13 +46,13 @@
                        (
                                'index'                 => true,
                                'basis'                 => true,
-                               'obligations'           => true,
+                               'obligations'   => true,
                                'view'                  => true,
                                'edit'                  => true,
-                               'edit_basis'            => true,
-                               'download'                      => true,
+                               'edit_basis'    => true,
+                               'download'              => true,
                                'delete'                => true,
-                               'delete_basis'          => true
+                               'delete_basis'  => true
                        );
                function property_uibudget()
                {
@@ -1321,7 +1321,12 @@
                                        'startIndex'            => 
$datatable['pagination']['records_start'],
                                        'sort'                          => 
$datatable['sorting']['order'],
                                        'dir'                           => 
$datatable['sorting']['sort'],
-                                       'records'                       => 
array()
+                                       'records'                       => 
array(),
+                                       'sum_budget'            => 
$this->bo->sum_budget_cost,
+                                       'sum_obligation'        => 
$this->bo->sum_obligation_cost,
+                                       'sum_actual'            => 
$this->bo->sum_actual_cost,
+                                       'sum_diff'                      => 
$this->bo->sum_budget_cost - $this->bo->sum_actual_cost - 
$this->bo->sum_obligation_cost,
+                                       'sum_hits'                      => 
$this->bo->sum_hits
                                );
 
                        // values for datatable

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-01-02 15:15:55 UTC (rev 8473)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-01-02 17:07:47 UTC (rev 8474)
@@ -44,7 +44,7 @@
                var $soXport;
                var $invoice;
                var $bestiller = 85; //cat_id for rolle
-               var $attestant = 83; //cat_id for rolle
+               var $attestant = 150; //cat_id for rolle
                var $budsjettansvarlig = 146; //cat_id for rolle
                var $default_kostra_id = 9999; //dummy
                var $debug = false;
@@ -515,7 +515,6 @@
                        $criteria_supervisor                            = 
array('ecodimb' => $order_info['dimb'], 'cat_id' => $this->attestant); // 
attestere
                        $supervisor_contact_id                          = 
$this->responsible->get_responsible($criteria_supervisor);
                        $supervisor_user_id                                     
= $this->responsible->get_contact_user_id($supervisor_contact_id);
-
                        $order_info['supervisor']                       = 
$GLOBALS['phpgw']->accounts->get($supervisor_user_id)->lid;
 
                        $criteria_budget_responsible            = 
array('ecodimb' => $order_info['dimb'], 'cat_id' => $this->budsjettansvarlig); 
//anviser

Modified: branches/Version-1_0-branch/property/js/yahoo/budget.obligations.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/budget.obligations.js 
2012-01-02 15:15:55 UTC (rev 8473)
+++ branches/Version-1_0-branch/property/js/yahoo/budget.obligations.js 
2012-01-02 17:07:47 UTC (rev 8474)
@@ -133,21 +133,26 @@
 
                this.addFooterDatatable = function()
                {
-               
                        //Create ROW
                        newTR = document.createElement('tr');
+
+                       tmp_sum_budget = 
YAHOO.util.Number.format(values_ds.sum_budget, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});                       
+                       tmp_sum_obligation = 
YAHOO.util.Number.format(values_ds.sum_obligation, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+                       tmp_sum_actual = 
YAHOO.util.Number.format(values_ds.sum_actual, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+                       tmp_sum_diff = 
YAHOO.util.Number.format(values_ds.sum_diff, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+                       tmp_sum_hits = 
YAHOO.util.Number.format(values_ds.sum_hits, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
                        
                        td_empty(5);
-                       td_sum(getSumPerPage("hits_ex",0));
+                       td_sum(tmp_sum_hits);
                        td_empty(1);
-                       td_sum(getSumPerPage("budget_cost_ex",0));
+                       td_sum(tmp_sum_budget);
                        td_empty(1);
-                       td_sum(getSumPerPage("obligation_ex",0));
+                       td_sum(tmp_sum_obligation);
                        td_empty(2);
-                       td_sum(getSumPerPage("actual_cost_ex",0));
+                       td_sum(tmp_sum_actual);
                        td_empty(2);                    
-                       td_sum(getSumPerPage("diff_ex",0));
-                       
+                       td_sum(tmp_sum_diff);
+
                        //Add to Table
                        myfoot = tableYUI.createTFoot();
                        myfoot.setAttribute("id","myfoot");




reply via email to

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