fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9750] Merge 9730:9749 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9750] Merge 9730:9749 from trunk
Date: Thu, 05 Jul 2012 13:18:05 +0000

Revision: 9750
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9750
Author:   sigurdne
Date:     2012-07-05 13:18:03 +0000 (Thu, 05 Jul 2012)
Log Message:
-----------
Merge 9730:9749 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.soseason.inc.php
    branches/Version-1_0-branch/booking/js/booking/datatable.js
    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/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/property/inc/class.boproject.inc.php
    branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
    branches/Version-1_0-branch/property/js/yahoo/project.edit.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749

Modified: branches/Version-1_0-branch/booking/inc/class.soseason.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soseason.inc.php      
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/booking/inc/class.soseason.inc.php      
2012-07-05 13:18:03 UTC (rev 9750)
@@ -190,6 +190,8 @@
                                "bb_season s2 JOIN bb_season_resource AS sr2 
ON(s2.id=sr2.season_id) ".
                                "WHERE (s1.from_ <= s2.to_) AND (s2.from_ <= 
s1.to_) ".
                                "AND sr1.resource_id=sr2.resource_id ".
+                               "AND s1.active=1".
+                               "AND s2.active=1".
                                "AND s1.id=$season_id";
 
                        $this->db->query("SELECT 1 FROM bb_season_boundary AS 
sb1 ".

Modified: branches/Version-1_0-branch/booking/js/booking/datatable.js
===================================================================
--- branches/Version-1_0-branch/booking/js/booking/datatable.js 2012-07-05 
10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/booking/js/booking/datatable.js 2012-07-05 
13:18:03 UTC (rev 9750)
@@ -168,10 +168,10 @@
        
        var initialRequest = History.getBookmarkedState("state") || getState();
        History.register("state", initialRequest, handleHistoryNavigation);
-       History.onReady(function() {
-               var state = YAHOO.util.History.getCurrentState('state');
-               handleHistoryNavigation(state);
-       });
+//     History.onReady(function() {
+//             var state = YAHOO.util.History.getCurrentState('state');
+//             handleHistoryNavigation(state);
+//     });
        History.initialize("yui-history-field", "yui-history-iframe");
 };
 

Modified: branches/Version-1_0-branch/controller/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/inc/class.menu.inc.php       
2012-07-05 13:18:03 UTC (rev 9750)
@@ -83,14 +83,14 @@
                                                'text'  => 
lang('Control_group'),
                                                'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'controller.uicontrol_group.index') ),
                                                'image' => array('property', 
'location_1'),
-/*                                             'children' => array(
+                                               'children' => array(
                                                                                
        'component_for_control_group' => array
                                                                                
        (
                                                                                
                'text'  => lang('component'),
                                                                                
                'url'   => $GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=> 'controller.uicontrol_group_component.index') ),
                                                                                
                'image' => array('property', 'entity_1')
                                                                                
        )
-                                                                               
)*/
+                                                                               
)
                                        ),
                                        'procedure' => array
                                        (

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-07-05 13:18:03 UTC (rev 9750)
@@ -343,67 +343,6 @@
                }
        }
        
-       /* 
-        * TROR IKKE VI BRUKER DENNE: TORSTEIN 18.06.2012
-        function get_agg_check_lists_for_location( $location_code, 
$from_date_ts, $to_date_ts, $control_id = 0 ){
-                               
-               $sql =  "SELECT c.id as c_id, title, start_date, end_date, 
cl.id as cl_id, c.repeat_type, c.repeat_interval, cl.deadline, 
count(cl.num_open_cases) ";
-               $sql .= "FROM controller_check_list cl, controller_control c, 
controller_check_item ci ";
-               $sql .= "WHERE cl.location_code = '{$location_code}' ";
-               
-               if($control_id > 0)
-               {
-                       $sql .= "AND c.id = {$control_id} ";
-               }
-               
-               $sql .= "AND c.repeat_type < 2 ";
-               $sql .= "AND cl.control_id = c.id ";
-               $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
-               $sql .= "GROUP BY c.id, title, start_date, end_date, cl.id, 
cl.deadline, c.repeat_type, c.repeat_interval ";
-               $sql .= "ORDER BY c.id";
-
-               $this->db->query($sql);
-               
-               $control_id = 0;
-               $controls_array = array();
-               $check_list_array = array();
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id', true) != $control_id ){
-                               if($control_id != 0){
-                                       $controls_array[] = array( "control" => 
$control_array, "check_list" => $check_list_array);
-                                       $check_list_array = array();
-                               }
-                               
-                               $control_array = array(
-                                                                               
                                                "id"                            
                => $this->unmarshal($this->db->f('c_id', true), 'int'),
-                                                                               
                                                "title"                         
        => $this->unmarshal($this->db->f('title', true), 'string'),
-                                                                               
                                                "repeat_type"     => 
$this->unmarshal($this->db->f('repeat_type', true), 'int'),
-                                                                               
                                                "repeat_interval" => 
$this->unmarshal($this->db->f('repeat_interval', true), 'int'),
-                                                                               
                                                "start_date"                    
=> $this->unmarshal($this->db->f('start_date', true), 'int'),
-                                                                               
                                                "end_date"                      
        => $this->unmarshal($this->db->f('end_date', true), 'int')
-                                                                               
                                        );
-                       }
-
-                       $check_list_array[] = array(
-                                                                               
"cl_id"         => $this->db->f('cl_id', true),
-                                                                               
"deadline"      => $this->db->f('deadline', true),
-                                                                               
"count"         => $this->db->f('count', true)
-                                                                       );
-                       
-                       $control_id = $this->db->f('c_id', true);
-               }               
-               
-               if( !empty( $control_array ) ){
-                       $controls_array[] = array( "control" => $control_array, 
"check_list" => $check_list_array);
-                       
-                       return $controls_array;
-               }else {
-                       return null;
-               }       
-       }
-*/ 
-       
        function get_num_open_cases_for_control( $cl_criteria, $from_date_ts, 
$to_date_ts ){
                
                $sql =  "SELECT c.id as c_id, sum(cl.num_open_cases) as count ";

Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-07-05 13:18:03 UTC (rev 9750)
@@ -56,7 +56,6 @@
                                                                                
'add_check_list'                                                => true,
                                                                                
'save_check_list'                                       => true,
                                                                                
'edit_check_list'                                       => true,
-                                                                               
'create_case_message'                   => true,
                                                                                
'view_control_info'                             => true,
                                                                                
'view_cases_for_check_list'     => true,
                                                                                
'print_check_list'                                      => true,
@@ -455,62 +454,7 @@
                        
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'check_list/view_cases_for_check_list'), $data);
                }
-               /*
-               function create_case_message()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                                               
-                       $check_list_with_check_items = 
$this->so->get_single_with_check_items($check_list_id);
-                                               
-                       $control_id = 
$check_list_with_check_items["control_id"];
-                       $control = $this->so_control->get_single( $control_id );
-                       
-                       $component_id = $check_list->get_component_id();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_id = $check_list->get_component_id();
-                               
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-               
-                               $component = new controller_component();
-                               $component->set_location_code( 
$component_arr['location_code'] );
-               $component->set_xml_short_desc( $short_desc );
-                               $component_array = $component->toArray();
-                               
-                               $type = 'component';
-                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
-                       }
-                       else
-                       {
-                               $location_code = 
$check_list->get_location_code();
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                               $type = 'location';
-                               $level = 
$this->get_location_level($location_code);
-                       }
-                       
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       
-                       $data = array
-                       (
-                               'location_array'        => $location_array,
-                               'control_array'         => $control->toArray(),
-                               'check_list'                    => 
$check_list_with_check_items,
-                               'date_format'           => $date_format
-                       );
-                       
-                       self::add_javascript('controller', 'controller', 
'jquery.js');
-                       self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
-                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
-                       self::add_javascript('controller', 'controller', 
'ajax.js');
-                       
-                       
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
-                       
-                       self::render_template_xsl('create_case_messsage', 
$data);
-               }
-               */
+               
                public function print_check_list()
                {
                        $check_list_id = phpgw::get_var('check_list_id');
@@ -622,6 +566,31 @@
                
                        $control_groups_with_items_array = array();
                        
+               $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+               
+                               $component = new controller_component();
+                               $component->set_location_code( 
$component_arr['location_code'] );
+               $component->set_xml_short_desc( $short_desc );
+                               $component_array = $component->toArray();
+                               
+                               $type = 'component';
+                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                       }
+                       
                        //Populating array with saved control items for each 
group
                        foreach ($saved_control_groups as $control_group)
                        {       
@@ -673,31 +642,8 @@
                        
=====================================================================*/
                        //_debug_array($control_group_check_items);
                        
-                       $component_id = $check_list->get_component_id();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_id = $check_list->get_component_id();
-                               
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-                               $short_desc = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-               
-                               $component = new controller_component();
-                               $component->set_location_code( 
$component_arr['location_code'] );
-               $component->set_xml_short_desc( $short_desc );
-                               $component_array = $component->toArray();
-                               
-                               $type = 'component';
-                               $building_location_code = 
$this->get_building_location_code($component_arr['location_code']);
-                       }
-                       else
-                       {
-                               $location_code = 
$check_list->get_location_code();
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                               $type = 'location';
-                       }
                        
+                       
                        $level = $this->get_location_level($location_code);
                        $year = date("Y", $check_list->get_deadline());
                        $month = date("n", $check_list->get_deadline());

Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-07-05 
10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php  2012-07-05 
13:18:03 UTC (rev 9750)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['controller']['name'] = 'controller';
-       $setup_info['controller']['version'] = '0.1.39';
+       $setup_info['controller']['version'] = '0.1.41';
        $setup_info['controller']['app_order'] = 100;
        $setup_info['controller']['enable'] = 1;
        $setup_info['controller']['app_group']  = 'office';
@@ -45,7 +45,6 @@
                'controller_check_item',
                'controller_check_list',
                'controller_procedure',
-               'controller_control_area',
                'controller_control_group_list',
                'controller_control_location_list',
                'controller_control_component_list',

Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php 
2012-07-05 13:18:03 UTC (rev 9750)
@@ -114,16 +114,6 @@
                        'ix' => array(),
                        'uc' => array()
                ),
-               'controller_control_area' => array(
-                       'fd' => array(
-                               'id' => array('type' => 'auto','precision' => 
4,'nullable' => False),
-                               'title' => array('type' => 'varchar', 
'precision' => 255, 'nullable' => False)
-                       ),
-                       'pk' => array('id'),
-                       'fk' => array(),
-                       'ix' => array(),
-                       'uc' => array()
-               ),
                'controller_control_group_list' => array(
                        'fd' => array(
                                'id' => array('type' => 'auto', 'nullable' => 
false),
@@ -163,7 +153,7 @@
                                'fd' => array(
                                        'id'                                    
                        => array('type' => 'auto', 'nullable' => false),
                                        'control_group_id'      => array('type' 
=> 'int', 'precision' => '4', 'nullable' => false),
-                                       'component_id'                  => 
array('type' => 'int', 'precision' => '4', 'nullable' => false)
+                                       'location_id'                   => 
array('type' => 'int', 'precision' => '4', 'nullable' => false)
                                ),
                        '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-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php  
2012-07-05 13:18:03 UTC (rev 9750)
@@ -787,4 +787,37 @@
                        return 
$GLOBALS['setup_info']['controller']['currentver'];
                }
        }
-
+       
+       $test[] = '0.1.39';
+       function controller_upgrade0_1_39()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
+               
$GLOBALS['phpgw_setup']->oProc->DropColumn('controller_control_group_component_list',
 array(), 'component_id');
+                               
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group_component_list','location_id',array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => false
+               ));
+               
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.40';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }
+       
+       $test[] = '0.1.40';
+       function controller_upgrade0_1_40()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+               
+       $GLOBALS['phpgw_setup']->oProc->DropTable('controller_control_area');
+               
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['controller']['currentver'] = 
'0.1.41';
+                       return 
$GLOBALS['setup_info']['controller']['currentver'];
+               }
+       }

Modified: branches/Version-1_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2012-07-05 13:18:03 UTC (rev 9750)
@@ -507,27 +507,37 @@
                        }
 
                        $dateformat                             = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       $values['start_date']                   = 
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
-                       $values['end_date']                     = 
isset($values['end_date']) && $values['end_date'] ? 
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat) : '';
-                       $workorder_data                         = 
$this->so->project_workorder_data($project_id);
+                       $values['start_date']   = 
$GLOBALS['phpgw']->common->show_date($values['start_date'],$dateformat);
+                       $values['end_date']             = 
isset($values['end_date']) && $values['end_date'] ? 
$GLOBALS['phpgw']->common->show_date($values['end_date'],$dateformat) : '';
+                       $workorder_data                 = 
$this->so->project_workorder_data($project_id);
 
-                       $sum_workorder_budget = 0;
                        $sum_deviation = 0;
-                       $sum_workorder_calculation = 0;
-                       $sum_workorder_actual_cost = 0;
 
                        for ($i=0;$i<count($workorder_data);$i++)
                        {
-                               $sum_workorder_budget+= 
$workorder_data[$i]['budget'];
                                $sum_deviation+= 
$workorder_data[$i]['deviation'];
-                               $sum_workorder_calculation+= 
$workorder_data[$i]['calculation'];
-                               $sum_workorder_actual_cost+= 
$workorder_data[$i]['actual_cost'];
 
+                               $_cost = (float)number_format(0, 2, ',', '');
+                               if(abs($workorder_data[$i]['contract_sum']) > 0)
+                               {
+                                       $_cost = 
(float)number_format($workorder_data[$i]['contract_sum'] * 
(1+(((int)$workorder_data[$i]['addition_percentage'])/100)), 2, ',', '');
+                               }
+                               else if(abs($workorder_data[$i]['calculation']) 
> 0)
+                               {
+                                       $_cost = 
(float)number_format($workorder_data[$i]['calculation'] * $tax, 2, ',', '');
+                               }
+                               else if(abs($workorder_data[$i]['budget']) > 0)
+                               {
+                                       $_cost = 
(float)number_format($workorder_data[$i]['budget'] * $tax, 2, ',', '');
+                               }
+                               
+                               $values['workorder_budget'][$i]['cost'] = 
$_cost;
+                               
                                
$values['workorder_budget'][$i]['title']=htmlspecialchars_decode($workorder_data[$i]['title']);
                                
$values['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
-                               
$values['workorder_budget'][$i]['contract_sum']=(float)number_format($workorder_data[$i]['contract_sum']
 * (1+(((int)$workorder_data[$i]['addition_percentage'])/100)), 2, ',', '');
-                               $values['workorder_budget'][$i]['budget']= 
$workorder_data[$i]['budget'];
-                               
$values['workorder_budget'][$i]['calculation']=(float)number_format($workorder_data[$i]['calculation']*$tax,
 2, ',', '');
+       //                      
$values['workorder_budget'][$i]['contract_sum']=(float)number_format($workorder_data[$i]['contract_sum']
 * (1+(((int)$workorder_data[$i]['addition_percentage'])/100)), 2, ',', '');
+       //                      $values['workorder_budget'][$i]['budget']= 
$workorder_data[$i]['budget'];
+       //                      
$values['workorder_budget'][$i]['calculation']=(float)number_format($workorder_data[$i]['calculation']*$tax,
 2, ',', '');
                                
$values['workorder_budget'][$i]['charge_tenant'] = 
$workorder_data[$i]['charge_tenant'];
                                $values['workorder_budget'][$i]['status'] = 
$workorder_data[$i]['status'];
                                $values['workorder_budget'][$i]['actual_cost'] 
= (float)number_format($workorder_data[$i]['actual_cost'] ? 
$workorder_data[$i]['actual_cost'] : 0, 2, ',', '');
@@ -552,10 +562,7 @@
                        }
                        if($workorder_data)
                        {
-                               $values['sum_workorder_budget']= 
number_format($sum_workorder_budget, 2, ',', '');
                                $values['deviation']= $sum_deviation;
-                               $values['sum_workorder_calculation']= 
number_format($sum_workorder_calculation*$tax, 2, ',', '');
-                               $values['sum_workorder_actual_cost']= 
number_format($sum_workorder_actual_cost, 2, ',', '');
                        }
 
                        if($values['location_code'])

Modified: branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2012-07-05 13:18:03 UTC (rev 9750)
@@ -229,6 +229,13 @@
                                        'sortable'      => true
                                );
 
+                       $columns['approved'] = array
+                               (
+                                       'id'            => 'approved',
+                                       'name'          => lang('approved'),
+                                       'sortable'      => true
+                               );
+
                        return $columns;
                }
 
@@ -805,4 +812,14 @@
                        }
                        return $ser_list;
                }
+
+               /**
+               * Recalculate actual cost from payment history for all 
workorders
+               *
+               * @return void
+               */
+               function recalculate()
+               {
+                       $this->so->recalculate();
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.menu.inc.php 2012-07-05 
10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.menu.inc.php 2012-07-05 
13:18:03 UTC (rev 9750)
@@ -402,6 +402,11 @@
                                                        'text'  => 
lang('Workorder Detail Categories'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'wo_hours') )
                                                ),
+                                               'workorder_recalculate' => array
+                                               (
+                                                       'text'  => 
lang('Workorder recalculate actual cost'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiworkorder.recalculate') )
+                                               ),
                                                'ticket'        => array
                                                (
                                                        'text'  => 
lang('helpdesk'),

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2012-07-05 13:18:03 UTC (rev 9750)
@@ -635,14 +635,14 @@
                                $_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;
+                               
$obligations[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_combined_cost;
+                               
$hits[$this->db->f($b_account_field)][(int)$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;
                        }
 
-                       //_debug_array($obligations);die();
+//                     _debug_array($obligations);
 
                        //----------- ad hoc order
                        $filtermethod = "WHERE fm_tts_tickets.vendor_id > 0 AND 
budget > 0";
@@ -701,8 +701,8 @@
                                $_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;
+                               
$obligations[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('ecodimb')]
 += $_budget;
+                               
$hits[$this->db->f($b_account_field)][(int)$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;
@@ -854,7 +854,7 @@
                                $_taxcode[$this->db->f('id')] = 
$this->db->f('percent');
                        }
                        
-//-------start check paid-----------
+//-------start check paid workorder-----------
                        $sql = "SELECT fm_b_account.{$b_account_field} as 
{$b_account_field}, district_id, sum(godkjentbelop) as actual_cost,dimb,mvakode"
                                . " FROM fm_ecobilagoverf"
                                . " {$this->join} fm_b_account ON 
fm_ecobilagoverf.spbudact_code =fm_b_account.id"
@@ -873,6 +873,7 @@
                                $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
                                $_actual_cost = 
round($this->db->f('actual_cost')/$_taxfactor);
                                $sum_actual_cost += $_actual_cost;
+                               
$obligations[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('dimb')]
 -= $_actual_cost;
                                
$actual_cost[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('dimb')]
 += $_actual_cost;
                                $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[(int)$this->db->f('district_id')] = 
true;
@@ -881,7 +882,7 @@
                
 //-------end check paid-----------
 
-//-------start check active invoices-----------
+//-------start check active invoices, workorder-----------
                        $sql = "SELECT fm_b_account.{$b_account_field} as 
{$b_account_field}, district_id, sum(godkjentbelop) as actual_cost,dimb,mvakode"
                                . " FROM fm_ecobilag"
                                . " {$this->join} fm_b_account ON 
fm_ecobilag.spbudact_code =fm_b_account.id"
@@ -900,6 +901,7 @@
                                $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
                                $_actual_cost = 
round($this->db->f('actual_cost')/$_taxfactor);
                                $sum_actual_cost += $_actual_cost;
+                               
$obligations[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('dimb')]
 -= $_actual_cost;
                                
$actual_cost[$this->db->f($b_account_field)][(int)$this->db->f('district_id')][(int)$this->db->f('dimb')]
 += $_actual_cost;
                                $accout_info[$this->db->f($b_account_field)] = 
true;
                                $district[(int)$this->db->f('district_id')] = 
true;
@@ -962,7 +964,7 @@
                        }
 
 
-//-------start check paid-----------
+//-------start check paid service agreement-----------
 
                        $sql = "SELECT fm_b_account.{$b_account_field} as 
{$b_account_field}, sum(fm_ecobilagoverf.godkjentbelop) as 
actual_cost,fm_s_agreement_budget.ecodimb"
                                . " FROM fm_ecobilagoverf"
@@ -990,7 +992,7 @@
 
 //-------end check paid-----------
 
-//-------start check active invoices-----------
+//-------start check active invoices service agreement-----------
 
                        $filtermethod = '';
                        $where = 'WHERE';

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-07-05 13:18:03 UTC (rev 9750)
@@ -1555,24 +1555,28 @@
 
                        $sql = "SELECT id AS order_id FROM fm_workorder WHERE 
project_id = {$project_id}";
                        $this->db->query($sql,__LINE__,__FILE__);
-                       $orders = array();
+
                        $_orders = array();
                        while ($this->db->next_record())
                        {
                                $_orders[] = $this->db->f('order_id');
                        }
 
-                       foreach($_orders as $_order)
+
+                       $orders = array();
+                       if($_orders)
                        {
-                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilagoverf WHERE pmwrkord_code = '{$_order}' 
GROUP BY periode ORDER BY periode ASC ";
+                               $_order_filter = implode(',', $_orders);
+                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, pmwrkord_code AS order, periode FROM fm_ecobilagoverf WHERE 
pmwrkord_code IN ({$_order_filter}) GROUP BY pmwrkord_code, periode ORDER BY 
periode ASC ";
+
                                $this->db->query($sql,__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
                                        $year = substr( 
$this->db->f('periode'), 0, 4 );
-                                       $orders[$year][$_order]['actual_cost'] 
+= $this->db->f('actual_cost');
+                                       
$orders[$year][$this->db->f('order')]['actual_cost'] += 
$this->db->f('actual_cost');
                                }
 
-                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, periode FROM fm_ecobilag WHERE pmwrkord_code = '{$_order}' GROUP 
BY periode ORDER BY periode ASC ";
+                               $sql = "SELECT sum(godkjentbelop) AS 
actual_cost, pmwrkord_code AS order, periode FROM fm_ecobilag WHERE 
pmwrkord_code IN ({$_order_filter}) GROUP BY pmwrkord_code, periode ORDER BY 
pmwrkord_code, periode ASC ";
                                $this->db->query($sql,__LINE__,__FILE__);
                                while ($this->db->next_record())
                                {
@@ -1581,7 +1585,7 @@
                                        {
                                                $year = date('Y');
                                        }
-                                       $orders[$year][$_order]['actual_cost'] 
+= $this->db->f('actual_cost');
+                                       
$orders[$year][$this->db->f('order')]['actual_cost'] += 
$this->db->f('actual_cost');
                                }
                        }
 
@@ -1621,7 +1625,6 @@
                                $orders[$year][$this->db->f('id')]['amount'] = 
$_amount;
                        }
 
-
                        $sort_year = array();
                        $values = array();
 
@@ -1636,23 +1639,40 @@
                        
                        foreach ($project_budget as $year => $budget)
                        {
+                               $_sum_orders = 0;
+                               $_actual_cost = 0;
+
                                if(isset($orders[$year]))
                                {
-                                       
-                                       $_sum_orders = 0;
-                                       $_actual_cost= 0;
-
                                        foreach ($orders[$year] as $order_id => 
$order)
                                        {
                                                $_sum_orders += 
$order['amount'];
-                                               $_sum_orders -= 
$order['actual_cost'];
+                       //                      $_sum_orders -= 
$order['actual_cost'];
 
-                                               if($budget > 0)
+                                               if($budget >= 0)
                                                {
+                                                       
if($order['actual_cost'] >= 0)
+                                                       {
+                                                               $_sum_orders -= 
$order['actual_cost'];
+                                                       }
+                                                       else
+                                                       {
+                                                               $_sum_orders += 
$order['actual_cost'];                                                  
+                                                       }
+
                                                        $_sum_orders = 
$_sum_orders > 0 ? $_sum_orders : 0;
                                                }
                                                else // income
                                                {
+                                                       
if($order['actual_cost'] >= 0)
+                                                       {
+                                                               $_sum_orders += 
$order['actual_cost'];
+                                                       }
+                                                       else
+                                                       {
+                                                               $_sum_orders -= 
$order['actual_cost'];                                                  
+                                                       }
+
                                                        $_sum_orders = 
$_sum_orders < 0 ? $_sum_orders : 0;                                            
 
                                                }
                                                
@@ -1660,13 +1680,7 @@
                                        }
 
                                        unset($orders[$year]);
-
                                }
-                               else
-                               {
-                                       $_sum_orders = 0;
-                                       $_actual_cost = 0;
-                               }
 
                                $values[] = array
                                (
@@ -1679,7 +1693,7 @@
 
                                $sort_year[] = $year;
                        }
-
+//_debug_array($values);die();
                        unset($order);
                        unset($order_id);
                        unset($year);
@@ -1687,6 +1701,7 @@
                        reset($orders);
 
                        //remaining
+//_debug_array($orders);
                        foreach ($orders as $year => $_orders)
                        {
                                $_sum_orders = 0;
@@ -1695,8 +1710,18 @@
                                foreach ($_orders as $order_id => $order)
                                {
                                        $_sum_orders += $order['amount'];
-                                       $_sum_orders -= $order['actual_cost'];
-                                       $_sum_orders = $_sum_orders > 0 ? 
$_sum_orders : 0;
+                                       
+                                       if($order['actual_cost'] > 0 && 
($order['amount'] - $order['actual_cost']) > 0)
+                                       {
+                                               $_sum_orders -= 
$order['actual_cost'];
+                                               $_sum_orders = $_sum_orders > 0 
? $_sum_orders : 0;
+                                       }
+                                       else if($order['actual_cost'] < 0 && 
($order['amount'] - $order['actual_cost']) < 0)//income
+                                       {
+                                               $_sum_orders -= 
$order['actual_cost'];
+                                               $_sum_orders = $_sum_orders < 0 
? $_sum_orders : 0;
+                                       }
+
                                        $_actual_cost += $order['actual_cost'];
                                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2012-07-05 13:18:03 UTC (rev 9750)
@@ -215,6 +215,9 @@
                                $cols_return[]                          = 
'ecodimb';
                                $cols.= ",fm_workorder.contract_sum";
                                $cols_return[]                          = 
'contract_sum';
+                               $cols.= ",fm_workorder.approved";
+                               $cols_return[]                          = 
'approved';
+
 /*
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
'entry_date';
@@ -461,6 +464,9 @@
                                        case 'budget':
                                                $order_field = ", 
fm_workorder.budget";
                                                break;
+                                       case 'approved':
+                                               $order_field = ", 
fm_workorder.approved";
+                                               break;
                                        default:
                                                $order_field = ", {$order}";
                                }
@@ -1512,4 +1518,23 @@
                                $this->db->transaction_commit();
                        }
                }
+
+               /**
+               * Recalculate actual cost from payment history for all 
workorders
+               *
+               * @return void
+               */
+
+               function recalculate()
+               {
+                       $this->db->query("SELECT id FROM 
fm_workorder",__LINE__,__FILE__);
+
+                       $orders = array();
+                       while ($this->db->next_record())
+                       {
+                               $orders[$this->db->f('id')] = true;
+                       }
+
+                       
execMethod('property.soXport.update_actual_cost_from_archive',$orders);
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uicommon.inc.php     
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.uicommon.inc.php     
2012-07-05 13:18:03 UTC (rev 9750)
@@ -58,17 +58,6 @@
        }
 
        /**
-        * Generates a javascript translator object/hash for the specified 
fields.
-        */
-       function js_lang()
-       {
-               $keys = func_get_args();
-               $strings = array();
-               foreach($keys as $key) { $strings[$key] = is_string($key) ? 
lang($key) : call_user_func_array('lang', $key); }
-               return json_encode($strings);
-       }
-       
-       /**
         * Creates an array of translated strings.
         */
        function lang_array()

Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-07-05 13:18:03 UTC (rev 9750)
@@ -1664,14 +1664,8 @@
                        }
 
                        $value_remainder = $values['sum'];
-                       if(isset($values['sum_workorder_actual_cost']))
-                       {
-                               $value_remainder = $values['sum'] - 
$values['sum_workorder_actual_cost'];
-                       }
-                       $values['sum']  = number_format($values['sum'], 0, ',', 
' ');
-                       $value_remainder = number_format($value_remainder, 0, 
',', ' ');
-//                     $values['planned_cost']  = 
number_format($values['planned_cost'], 0, ',', ' ');
 
+
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_start_date');
                        
$GLOBALS['phpgw']->jqcal->add_listener('values_end_date');
 
@@ -1690,8 +1684,15 @@
                                foreach($content_budget as & $b_entry)
                                {
                                        $b_entry['delete_year'] = "<input 
type='checkbox' name='values[delete_b_year][]' value='{$b_entry['year']}' 
title='{$lang_delete}'>";
+                                       $value_remainder -= 
$b_entry['sum_orders'];
+                                       $value_remainder -= 
$b_entry['actual_cost'];
                                }
                        }
+
+                       $values['sum']  = number_format($values['sum'], 0, ',', 
' ');
+                       $value_remainder = number_format($value_remainder, 0, 
',', ' ');
+
+
 //_debug_array($content_budget);die();
                        $datavalues[0] = array
                                (
@@ -1733,9 +1734,10 @@
                                        'values'        =>      
json_encode(array(      array('key' => 
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
                                                                                
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'b_account_id','label'=>lang('Budget 
account'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'budget','label'=>lang('Budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
-                                                                               
                                array('key' => 
'calculation','label'=>lang('Calculation'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'contract_sum','label'=>lang('contract 
sum'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'cost','label'=>lang('cost'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                //              array('key' => 
'budget','label'=>lang('Budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                //              array('key' => 
'calculation','label'=>lang('Calculation'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterRight'),
+                                                                               
                //              array('key' => 
'contract_sum','label'=>lang('contract 
sum'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
                                                                                
                                array('key' => 'addition_percentage','label'=> 
'%','sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterRight'),
                                                                                
                                array('key' => 
'actual_cost','label'=>lang('actual 
cost'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
                                                                                
                //              array('key' => 
'charge_tenant','label'=>lang('charge 
tenant'),'sortable'=>true,'resizeable'=>true),

Modified: branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2012-07-05 13:18:03 UTC (rev 9750)
@@ -66,7 +66,8 @@
                                'delete'                => true,
                                'view_file'             => true,
                                'columns'               => true,
-                               'add_invoice'   => true
+                               'add_invoice'   => true,
+                               'recalculate'   => true
                        );
 
                function property_uiworkorder()
@@ -2393,6 +2394,48 @@
 
                }
 
+               function recalculate()
+               {
+                       if ( !$GLOBALS['phpgw']->acl->check('run', 
phpgwapi_acl::READ, 'admin')
+                               && !$GLOBALS['phpgw']->acl->check('admin', 
phpgwapi_acl::ADD, 'property'))
+                       {
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=> 
'property.uilocation.stop','perm'=>8, 'acl_location'=> $this->acl_location));
+                       }
+
+                       $confirm        = phpgw::get_var('confirm', 'bool', 
'POST');
+
+                       $link_data = array
+                       (
+                               'menuaction' => 'property.uiworkorder.index'
+                       );
+
+                       if (phpgw::get_var('confirm', 'bool', 'POST'))
+                       {
+                               $this->bo->recalculate();
+                               
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
+                       }
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('app_delete'));
+
+                       $data = array
+                               (
+                                       'done_action'                           
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
+                                       'delete_action'                         
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiworkorder.recalculate')),
+                                       'lang_confirm_msg'                      
=> lang('do you really want to recalculate all actual cost for all workorders'),
+                                       'lang_yes'                              
        => lang('yes'),
+                                       'lang_yes_statustext'           => 
lang('recalculate'),
+                                       'lang_no_statustext'            => 
lang('Back to the list'),
+                                       'lang_no'                               
        => lang('no')
+                               );
+
+                       $appname                                        = 
lang('workorder');
+                       $function_msg                           = lang('delete 
workorder');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('delete' => $data));
+               
+               }
+
                protected function _generate_tabs($tabs_ = array(), $suppress = 
array(), $selected = 'general')
                {
                        $tabs = array

Modified: branches/Version-1_0-branch/property/js/yahoo/project.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-07-05 10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-07-05 13:18:03 UTC (rev 9750)
@@ -126,9 +126,12 @@
        this.addFooterDatatable1 = function(paginator,datatable)
        {
                //call getTotalSum(name of column) in property.js
+               tmp_sum0 = getTotalSum('cost',2,paginator,datatable);
+/*
                tmp_sum1 = getTotalSum('budget',0,paginator,datatable);
                tmp_sum2 = getTotalSum('calculation',2,paginator,datatable);
                tmp_sum3 = getTotalSum('contract_sum',2,paginator,datatable);
+*/
                tmp_sum4 = getTotalSum('actual_cost',2,paginator,datatable);
 
                if(typeof(tableYUI1)=='undefined')
@@ -146,9 +149,10 @@
 
                td_sum('Sum');
                td_empty(2);
-               td_sum(tmp_sum1);
-               td_sum(tmp_sum2);
-               td_sum(tmp_sum3);
+               td_sum(tmp_sum0);
+//             td_sum(tmp_sum1);
+//             td_sum(tmp_sum2);
+//             td_sum(tmp_sum3);
                td_empty(1);
                td_sum(tmp_sum4);
                td_empty(5);

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2012-07-05 
10:43:53 UTC (rev 9749)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2012-07-05 
13:18:03 UTC (rev 9750)
@@ -27,11 +27,11 @@
 activity id    property        no      Aktivitet ID
 activity num   property        no      Aktivitet num
 actor  property        no      Aktør
-actual cost    property        no      Faktisk kostnad
-actual_cost    property        no      Faktisk kostnad
-actual cost changed    property        no      Faktisk kostnad er endret
-actual cost has been updated   property        no      Faktisk kostnad er 
oppdatert
-actual cost - paid so far      property        no      Faktisk betalt - pr dd
+actual cost    property        no      Betalt
+actual_cost    property        no      Betalt
+actual cost changed    property        no      Betalt sum er endret
+actual cost has been updated   property        no      Betalt sum er oppdatert
+actual cost - paid so far      property        no      Betalt sum - pr dd
 add a apartment        property        no      Legg til leilighet
 add a attrib   property        no      Legg til en attibutt
 add a budget account   property        no      Legg til en kostnadsart
@@ -682,7 +682,7 @@
 enter a statustext for the inputfield in forms property        no      Angi en 
statustekst for inputfeltet
 enter a value for the labour cost      property        no      angi arbeids 
kostnader
 enter a value for the material cost    property        no      angi 
materialkostnader
-Enter actual cost      property        no      Angi faktisk kostnad
+Enter actual cost      property        no      Angi betalt sum
 enter building id      property        no      angi bygnings ID
 enter document name    property        no      angi dokument ID
 enter document title   property        no      angi dokument tittel




reply via email to

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