fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11031] Merge 11002:11030 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11031] Merge 11002:11030 from trunk
Date: Fri, 05 Apr 2013 13:37:17 +0000

Revision: 11031
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11031
Author:   sigurdne
Date:     2013-04-05 13:37:16 +0000 (Fri, 05 Apr 2013)
Log Message:
-----------
Merge 11002:11030 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/bookingfrontend/inc/class.bouser.inc.php
    
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn_Bergen_kommune.php
    branches/Version-1_0-branch/property/inc/class.boentity.inc.php
    branches/Version-1_0-branch/property/inc/class.boproject.inc.php
    branches/Version-1_0-branch/property/inc/class.interlink.inc.php
    branches/Version-1_0-branch/property/inc/class.menu.inc.php
    branches/Version-1_0-branch/property/inc/class.soXport.inc.php
    branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.sotts.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
    branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
    branches/Version-1_0-branch/property/inc/class.uientity.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
    branches/Version-1_0-branch/property/inc/soap_client/braarkiv/soap.php
    branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
    branches/Version-1_0-branch/property/js/yahoo/budget.index.js
    branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/config.tpl
    branches/Version-1_0-branch/property/templates/base/entity.xsl
    branches/Version-1_0-branch/property/templates/base/request.xsl
    branches/Version-1_0-branch/property/templates/base/workorder.xsl
    
branches/Version-1_0-branch/property/tutorials/property/examples/install.apache.sh

Added Paths:
-----------
    
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
    branches/Version-1_0-branch/property/js/yahoo/entity.edit_inventory.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,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,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001
   + 
/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,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030

Modified: branches/Version-1_0-branch/bookingfrontend/inc/class.bouser.inc.php
===================================================================
--- branches/Version-1_0-branch/bookingfrontend/inc/class.bouser.inc.php        
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/bookingfrontend/inc/class.bouser.inc.php        
2013-04-05 13:37:16 UTC (rev 11031)
@@ -2,14 +2,15 @@
        class bookingfrontend_bouser
        {
                const ORGNR_SESSION_KEY = 'orgnr';
-               
+
                public
                        $orgnr = null;
 
                protected
                        $default_module = 'bookingfrontend',
-                       $module;
-               
+                       $module,
+                       $config;
+
                /**
                 * Debug for testing
                 * @access public
@@ -20,33 +21,44 @@
                public function __construct() {
                        $this->set_module();
                        $this->orgnr = $this->get_user_orgnr_from_session();
+                       $this->config           = 
CreateObject('phpgwapi.config','bookingfrontend');
+                       $this->config->read();
                }
-               
+
                protected function set_module($module = null)
                {
                        $this->module = is_string($module) ? $module : 
$this->default_module;
                }
-               
+
                public function get_module()
                {
                        return $this->module;
                }
-               
+
                public function log_in()
                {
                        $this->log_off();
-                       $this->orgnr = $this->get_user_orgnr_from_auth_header();
 
-/*
-                       try 
+                       $authentication_method  = 
isset($this->config->config_data['authentication_method']) && 
$this->config->config_data['authentication_method'] ? 
$this->config->config_data['authentication_method'] : '';
+                       
+                       if(!$authentication_method)
                        {
-                               
createObject('booking.sfValidatorNorwegianOrganizationNumber')->clean($this->orgnr);
+                               throw new LogicException('authentication_method 
not chosen');                   
                        }
-                       catch (sfValidatorError $e)
+                       
+                       $file = 
PHPGW_SERVER_ROOT."/bookingfrontend/inc/custom/default/{$authentication_method}";
+
+                       if(!is_file($file))
                        {
-//                             return null;
+                               throw new LogicException("authentication method 
\"{$authentication_method}\" not available");                   
                        }
-*/
+
+                       require_once $file;
+
+                       $external_user = new bookingfrontend_external_user();
+                       
+                       $this->orgnr = $external_user->get_user_org_id();
+
                        if ($this->is_logged_in())
                        {
                                $this->write_user_orgnr_to_session();
@@ -63,18 +75,18 @@
 
                        return $this->is_logged_in();
                }
-               
+
                public function log_off()
                {
                        $this->clear_user_orgnr();
                        $this->clear_user_orgnr_from_session();
                }
-               
+
                protected function clear_user_orgnr()
                {
                        $this->orgnr = null;
                }
-               
+
                public function get_user_orgnr()
                {
                        if(!$this->orgnr)
@@ -83,12 +95,12 @@
                        }
                        return $this->orgnr;
                }
-               
+
                public function is_logged_in()
                {
                        return !!$this->get_user_orgnr();
                }
-               
+
                public function is_organization_admin($organization_id = null)
                {
                        // FIXME!!!!!! REMOVE THIS ONCE ALTINN IS OPERATIONAL
@@ -126,7 +138,7 @@
                        $group = $so->read_single($group_id);
                        return 
$this->is_organization_admin($group['organization_id']);
                }
-               
+
                protected function write_user_orgnr_to_session()
                {
                        if (!$this->is_logged_in())
@@ -136,12 +148,12 @@
 
                        phpgwapi_cache::session_set($this->get_module(), 
self::ORGNR_SESSION_KEY, $this->get_user_orgnr());
                }
-               
+
                protected function clear_user_orgnr_from_session()
                {
                        phpgwapi_cache::session_clear($this->get_module(), 
self::ORGNR_SESSION_KEY);
                }
-               
+
                protected function get_user_orgnr_from_session()
                {
                        try {
@@ -150,84 +162,4 @@
                                return null;
                        }
                }
-               
-               protected function get_user_orgnr_from_auth_header()
-               {
-                       $config         = 
CreateObject('phpgwapi.config','bookingfrontend');
-                       $config->read();
-
-                       $header_key = isset($config->config_data['header_key']) 
&& $config->config_data['header_key'] ? $config->config_data['header_key'] : 
'Osso-User-Dn';
-                       $header_regular_expression = 
isset($config->config_data['header_regular_expression']) && 
$config->config_data['header_regular_expression'] ? 
$config->config_data['header_regular_expression'] : '/^cn=(.*),cn=users.*$/';
-
-                       $headers = getallheaders();
-
-                       if(isset($config->config_data['debug']) && 
$config->config_data['debug'])
-                       {
-                               $this->debug = true;
-                               echo 'headers:<br>';
-                               _debug_array($headers);
-                       }
-
-                       if(isset($headers[$header_key]) && 
$headers[$header_key])
-                       {
-                               $matches = array();
-                               
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
-                               $userid = $matches[1][0];
-
-                               if($this->debug)
-                               {
-                                       echo 'matches:<br>';
-                                       _debug_array($matches);
-                               }
-
-                       }
-
-                       $options = array();
-                       $options['soap_version'] = SOAP_1_1;
-                       $options['location']    = 
isset($config->config_data['soap_location']) && 
$config->config_data['soap_location'] ? $config->config_data['soap_location'] : 
'';// 'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1';
-                       $options['uri']                 = 
isset($config->config_data['soap_uri']) && $config->config_data['soap_uri'] ? 
$config->config_data['soap_uri'] : '';// 'http://soat1a.srv.bergenkom.no';
-                       $options['trace']               = 1;
-
-                       if(isset($config->config_data['soap_proxy_host']) && 
$config->config_data['soap_proxy_host'])
-                       {
-                               $options['proxy_host']  = 
$config->config_data['soap_proxy_host'];
-                       }
-
-                       if(isset($config->config_data['soap_proxy_port']) && 
$config->config_data['soap_proxy_port'])
-                       {
-                               $options['proxy_port']  = 
$config->config_data['soap_proxy_port'];
-                       }
-                       $options['encoding']    = 
isset($config->config_data['soap_encoding']) && 
$config->config_data['soap_encoding'] ? $config->config_data['soap_encoding'] : 
'UTF-8';
-                       $options['login']               = 
isset($config->config_data['soap_login']) && $config->config_data['soap_login'] 
? $config->config_data['soap_login'] : '';
-                       $options['password']    = 
isset($config->config_data['soap_password']) && 
$config->config_data['soap_password'] ? $config->config_data['soap_password'] : 
'';
-
-                       $wsdl = isset($config->config_data['soap_wsdl']) && 
$config->config_data['soap_wsdl'] ? $config->config_data['soap_wsdl'] : '';// 
'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1?wsdl';
-
-                       $authentication_method  = 
isset($config->config_data['authentication_method']) && 
$config->config_data['authentication_method'] ? 
$config->config_data['authentication_method'] : '';
-
-                       require_once 
PHPGW_SERVER_ROOT."/bookingfrontend/inc/custom/default/{$authentication_method}";
-                       
-                       $external_user = new booking_external_user($wsdl, 
$options, $userid, $this->debug);
-                       // test values
-                       //$external_user = (object) 'ciao'; 
$external_user->login = 994239929;
-
-                       if($this->debug)
-                       {
-                               echo 'External user:<br>';
-                               _debug_array($external_user);
-                       }
-                       try
-                       {
-                               return 
createObject('booking.sfValidatorNorwegianOrganizationNumber')->clean($external_user->login);
-                       }
-                       catch (sfValidatorError $e)
-                       {
-                               if($this->debug)
-                               {
-                                       echo $e->getMessage();
-                                       die();
-                               }
-                               return null;
-                       }
-               }
        }

Copied: 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
 (from rev 11030, 
trunk/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php)
===================================================================
--- 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
                           (rev 0)
+++ 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn2_Bergen_kommune.php
   2013-04-05 13:37:16 UTC (rev 11031)
@@ -0,0 +1,206 @@
+<?php
+       /**
+       * phpGroupWare
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package phpgroupware
+       * @subpackage communication
+       * @category core
+       * @version $Id: Altinn_Bergen_kommune.php 4887 2010-02-23 10:33:44Z 
sigurd $
+       */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /**
+        * Wrapper for custom methods
+        *
+        * @package phpgroupware
+        * @subpackage bookingfrontend
+        */
+
+       class bookingfrontend_external_user extends bookingfrontend_bouser
+       {
+
+               public function __construct()
+               {
+                       parent::__construct();
+               }
+
+               public function get_user_org_id()
+               {
+               
+                       $headers = getallheaders();
+                       if(isset($this->config->config_data['debug']) && 
$this->config->config_data['debug'])
+                       {
+                               $this->debug = true;
+                               echo 'headers:<br>';
+                               _debug_array($headers);
+                       }
+
+                       $fodsels_nr = substr($headers['Osso-User-Dn'],2, 11);
+       //              $fodsels_nr = '02035701829'; // test
+
+                       if($this->debug)
+                       {
+                               echo 'fødselsnr:<br>';
+                               _debug_array($fodsels_nr);
+                       }
+
+                       $request =
+                       "<soapenv:Envelope
+                                
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\";
+                                xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\";
+                                
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\";
+                                
xmlns:v1=\"http://bergen.kommune.no/biz/bk/altinn/altinnreporteesservice/v1\";>
+                               <soapenv:Body>
+                                       <v1:getOrganisasjonsAvgivere>
+                                               
<fodselsNr>{$fodsels_nr}</fodselsNr>
+                                       </v1:getOrganisasjonsAvgivere>
+                               </soapenv:Body>
+                       </soapenv:Envelope>";
+
+                       $location_URL = 
isset($this->config->config_data['soap_location']) && 
$this->config->config_data['soap_location'] ? 
$this->config->config_data['soap_location'] : 
"http://wsm01e-t.usrv.ubergenkom.no:8888/gateway/services/AltinnReporteesService";;
 #A-test
+               
+                       $client = new SoapClient(null, array(
+                                               'location' => $location_URL,
+                                               'uri'      => "",
+                                               'trace'    => 1,
+                                               ));
+       
+                       try
+                       {
+                               $response = 
$client->__doRequest($request,$location_URL,$location_URL,1);
+
+                               $reader = new XMLReader();
+                               $reader->xml($response);
+
+                               $orgs = array();
+                               $orgs_validate = array();
+                               while ($reader->read())
+                               {
+                                       if ($reader->nodeType == 
XMLREADER::ELEMENT && $reader->localName == 'return')
+                                       {
+                                               $xml = new DOMDocument('1.0', 
'utf-8');
+                                               $xml->formatOutput = true;
+                                               $domnode = $reader->expand();
+                                               $xml->appendChild($domnode);
+                                               unset($domnode);
+                                               $_org_id = 
$xml->getElementsByTagName('organizationNumber')->item(0)->nodeValue;
+                                               $orgs[] = array
+                                               (
+                                                       'id'    => $_org_id,
+                                                       'name'  => 
$xml->getElementsByTagName('name')->item(0)->nodeValue,
+                                               );
+                                               $orgs_validate[] = $_org_id;
+                                       }
+                               }
+                       }
+                       catch (SoapFault $exception)
+                       {
+                               echo "Dette gikk ikke så bra.";
+                               var_dump(get_class($exception));
+                               var_dump($exception);
+                       }
+
+                       $stage = phpgw::get_var('stage');
+                       $org_id = phpgw::get_var('org_id');
+
+                       if($stage == 2 && $fodsels_nr && in_array($org_id, 
$orgs_validate))
+                       {
+                               try
+                               {
+                                       return 
createObject('booking.sfValidatorNorwegianOrganizationNumber')->clean($org_id);
+                               }
+                               catch (sfValidatorError $e)
+                               {
+                                       if($this->debug)
+                                       {
+                                               echo $e->getMessage();
+                                               die();
+                                       }
+                                       return null;
+                               }
+
+                       }
+
+                       foreach ( $orgs as $org)
+                       {
+                               $selected = '';
+                               if ( $org_id == $org['id'])
+                               {
+                                       $selected = 'selected = "selected"';
+                               }
+
+                               $org_option .=  <<<HTML
+                               <option 
value='{$org['id']}'{$selected}>{$org['name']}</option>
+
+HTML;
+                       }
+
+                       if($orgs)
+                       {
+                               $action =  
$GLOBALS['phpgw']->link('/bookingfrontend/login.php', array('stage' => 2));
+                               $message = 'Velg organisasjon';
+
+                               $org_select =  <<<HTML
+                                                       <p>
+                                                               <label 
for="org_id">Velg Organisasjon:</label>
+                                                               <select 
name="org_id" id="org_id">
+                                                                       
{$org_option}
+                                                               </select>
+                                                       </p>
+HTML;
+
+                       }
+                       else
+                       {
+                               $action =  
$GLOBALS['phpgw']->link('/bookingfrontend/index.php');
+                               $message = 'Ikke representant for noen 
organisasjon';
+                               $org_select = '';
+                       }
+
+                       $html = <<<HTML
+                       <!DOCTYPE html>
+                       <html>
+                               <head>
+                                       <title>Velg organisasjon</title>
+                                       <meta http-equiv="Content-Type" 
content="text/html; charset=utf-8">
+                               </head>
+                               <body>
+                                       <h2>{$message}</h2>
+                                       <form action="{$action}" method="post">
+                                               <fieldset>
+                                                       <legend>
+                                                               Organisasjon
+                                                       </legend>
+                                                       $org_select
+                                                       <p>
+                                                               <input 
type="submit" name="submit" value="Fortsett"  />
+                                                       </p>
+                                               </fieldset>
+                                       </form>
+                               </body>
+                       </html>
+HTML;
+
+                       echo $html;
+
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+       }

Modified: 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn_Bergen_kommune.php
===================================================================
--- 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn_Bergen_kommune.php
    2013-04-05 13:05:30 UTC (rev 11030)
+++ 
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/Altinn_Bergen_kommune.php
    2013-04-05 13:37:16 UTC (rev 11031)
@@ -34,32 +34,63 @@
         * @subpackage bookingfrontend
         */
 
-       /**
-       * START WRAPPER
-       */
-
-       class booking_external_user
+       class bookingfrontend_external_user extends bookingfrontend_bouser
        {
-               /**
-                * The resulting external user
-                * @access public
-                * @var string
-                */
-               public $login = 0;
+               public function __construct()
+               {
+                       parent::__construct();
+               }
 
-               /**
-                * Debug for testing
-                * @access public
-                * @var bool
-                */
-               public $debug = false;
+               public function get_user_org_id()
+               {
 
-               public function __construct($wsdl, $options, $userid, $debug = 
false)
-               {
-                       if($debug)
+                       $header_key = 
isset($this->config->config_data['header_key']) && 
$this->config->config_data['header_key'] ? 
$this->config->config_data['header_key'] : 'Osso-User-Dn';
+                       $header_regular_expression = 
isset($this->config->config_data['header_regular_expression']) && 
$this->config->config_data['header_regular_expression'] ? 
$this->config->config_data['header_regular_expression'] : 
'/^cn=(.*),cn=users.*$/';
+
+                       $headers = getallheaders();
+
+                       if(isset($this->config->config_data['debug']) && 
$this->config->config_data['debug'])
                        {
                                $this->debug = true;
+                               echo 'headers:<br>';
+                               _debug_array($headers);
                        }
+
+                       if(isset($headers[$header_key]) && 
$headers[$header_key])
+                       {
+                               $matches = array();
+                               
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
+                               $userid = $matches[1][0];
+
+                               if($this->debug)
+                               {
+                                       echo 'matches:<br>';
+                                       _debug_array($matches);
+                               }
+
+                       }
+
+                       $options = array();
+                       $options['soap_version'] = SOAP_1_1;
+                       $options['location']    = 
isset($this->config->config_data['soap_location']) && 
$this->config->config_data['soap_location'] ? 
$this->config->config_data['soap_location'] : '';// 
'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1';
+                       $options['uri']                 = 
isset($this->config->config_data['soap_uri']) && 
$this->config->config_data['soap_uri'] ? $this->config->config_data['soap_uri'] 
: '';// 'http://soat1a.srv.bergenkom.no';
+                       $options['trace']               = 1;
+
+                       if(isset($this->config->config_data['soap_proxy_host']) 
&& $this->config->config_data['soap_proxy_host'])
+                       {
+                               $options['proxy_host']  = 
$this->config->config_data['soap_proxy_host'];
+                       }
+
+                       if(isset($this->config->config_data['soap_proxy_port']) 
&& $this->config->config_data['soap_proxy_port'])
+                       {
+                               $options['proxy_port']  = 
$this->config->config_data['soap_proxy_port'];
+                       }
+                       $options['encoding']    = 
isset($this->config->config_data['soap_encoding']) && 
$this->config->config_data['soap_encoding'] ? 
$this->config->config_data['soap_encoding'] : 'UTF-8';
+                       $options['login']               = 
isset($this->config->config_data['soap_login']) && 
$this->config->config_data['soap_login'] ? 
$this->config->config_data['soap_login'] : '';
+                       $options['password']    = 
isset($this->config->config_data['soap_password']) && 
$this->config->config_data['soap_password'] ? 
$this->config->config_data['soap_password'] : '';
+
+                       $wsdl = isset($this->config->config_data['soap_wsdl']) 
&& $this->config->config_data['soap_wsdl'] ? 
$this->config->config_data['soap_wsdl'] : '';// 
'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1?wsdl';
+
                        try
                        {
                                $BrukerService  = new BrukerService($wsdl, 
$options);
@@ -75,31 +106,37 @@
                                }
                        }
 
-                       if(isset($BrukerService) && $BrukerService)
-                       {
-                               $ctx                    = new UserContext();
+                       $ctx                    = new UserContext();
 
-                               $ctx->appid = 'portico';
-                               $ctx->onBehalfOfId= $userid;
-                               $ctx->userid = $userid;
-                               $ctx->transactionid = 
$GLOBALS['phpgw_info']['server']['install_id']; // KAN UTELATES. BENYTTES I.F.M 
SUPPORT. LEGG INN EN FOR DEG UNIK ID.
+                       $ctx->appid = 'portico';
+                       $ctx->onBehalfOfId= $userid;
+                       $ctx->userid = $userid;
+                       $ctx->transactionid = 
$GLOBALS['phpgw_info']['server']['install_id']; // KAN UTELATES. BENYTTES I.F.M 
SUPPORT. LEGG INN EN FOR DEG UNIK ID.
 
-                               $request = new retrieveBruker();
-                               $request->userContext = $ctx;
-                               $request->userid = $userid;
+                       $request = new retrieveBruker();
+                       $request->userContext = $ctx;
+                       $request->userid = $userid;
 
-                               $response = 
$BrukerService->retrieveBruker($request);
-                               $Bruker = $response->return;
-                               $this->login = $Bruker->ou; // organisasjons nr
+                       $response = $BrukerService->retrieveBruker($request);
+                       $Bruker = $response->return;
+
+                       try
+                       {
+                               return 
createObject('booking.sfValidatorNorwegianOrganizationNumber')->clean($Bruker->ou);
                        }
+                       catch (sfValidatorError $e)
+                       {
+                               if($this->debug)
+                               {
+                                       echo $e->getMessage();
+                                       die();
+                               }
+                               return null;
+                       }
                }
        }
 
        /**
-       * END WRAPPER - custom code beyond this point
-       */
-
-       /**
         * soap client for altinn supported external login service at Bergen 
Kommune
         * this code is generated by the 
http://code.google.com/p/wsdl2php-interpreter/ 
         *

Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php     
2013-04-05 13:37:16 UTC (rev 11031)
@@ -680,18 +680,35 @@
                        return $this->so->read_entity_to_link($data);
                }
 
-               public function get_inventory($id = 0)
+               public function get_inventory($location_id, $id, $inventory_id 
= 0)
                {
-                       $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
-                       $values = $this->so->get_inventory( array('id' => $id, 
'location_id' => $location_id) );
+                       $values = $this->so->get_inventory( array('id' => $id, 
'location_id' => $location_id, 'inventory_id' => $inventory_id) );
+
+                       $interlink      = CreateObject('property.interlink');
+
+                       foreach ($values as &$entry)
+                       {
+                               $link_info = 
$interlink->get_location_link($entry['p_location_id'], $entry['p_id'],'view');
+                               $entry['where'] = "<a 
href='{$link_info['link']}'>{$link_info['name']}</a>";
+                               $entry['location_id'] = $location_id;
+                               $entry['id'] = $id;
+                       }
+
                        return $values;
                }
 
-               public function save_inventory($values)
+               public function add_inventory($values)
                {
                        $values['active_from']  = 
$this->bocommon->date_to_timestamp($values['active_from']);
                        $values['active_to']    = 
$this->bocommon->date_to_timestamp($values['active_to']);
-                       return $this->so->save_inventory($values);
+                       return $this->so->add_inventory($values);
                }
 
+               public function edit_inventory($values)
+               {
+                       $values['active_from']  = 
$this->bocommon->date_to_timestamp($values['active_from']);
+                       $values['active_to']    = 
$this->bocommon->date_to_timestamp($values['active_to']);
+                       return $this->so->edit_inventory($values);
+               }
+
        }

Modified: branches/Version-1_0-branch/property/inc/class.boproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.boproject.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -925,4 +925,10 @@
                        $values = $this->so->get_order_time_span($id);
                        return $this->bocommon->select_list(date('Y'), $values);
                }
+
+               public function get_missing_project_budget()
+               {
+                       return $this->so->get_missing_project_budget();
+               }
+               
        }

Modified: branches/Version-1_0-branch/property/inc/class.interlink.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.interlink.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.interlink.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -191,6 +191,47 @@
                /**
                 * Get relation of the interlink
                 *
+                * @param integer $location_id the location
+                * @param integer $id                   the id of the 
referenced item
+                *
+                * @return string the linkt to the the related item
+                */
+
+               public function get_location_link($location_id, $id, $action = 
'view')
+               {
+                       $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                       $name = 'N∕A';
+                       if( preg_match('/.location./i', 
$system_location['location']) )
+                       {
+                               $id = 
execMethod('property.solocation.get_location_code',$id);
+                               $name = $id;
+                       }
+                       else if( preg_match('/.entity./i', 
$system_location['location']) )
+                       {
+                               $name = 
execMethod('property.soentity.get_short_description', 
+                                                       array('location_id' => 
$location_id, 'id' => $id));
+                       }
+
+                       $link = 
$this->get_relation_link($system_location['location'], $id, $action);
+                       if ($link)
+                       {
+                               return array
+                               (
+                                       'name'  => $name,
+                                       'link'  => $link
+                               );
+                       }
+                       else
+                       {
+                               return array();
+                       }
+               }
+
+
+               /**
+                * Get relation of the interlink
+                *
                 * @param array   $linkend_location the location
                 * @param integer $id                      the id of the 
referenced item
                 *
@@ -273,6 +314,15 @@
                        {
                                $link = array('menuaction' => 
'controller.uicheck_list.view_control_info', 'check_list_id' => $id);
                        }
+                       else if( substr($type, 1, 8) == 'location' )
+                       {
+                               $type           = explode('.',$type);
+                               $link = array
+                                       (
+                                               'menuaction'    => 
"property.uilocation.{$function}",
+                                               'location_code' => $id,
+                                       );
+                       }
 
                        return $GLOBALS['phpgw']->link('/index.php',$link);     
                }

Modified: branches/Version-1_0-branch/property/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.menu.inc.php 2013-04-05 
13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.menu.inc.php 2013-04-05 
13:37:16 UTC (rev 11031)
@@ -275,7 +275,16 @@
                                                (
                                                        'text'  => 
lang('Accounting voucher type'),
                                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.index', 'type' => 'voucher_type') )
+                                               ),
+                                               'check_missing_project_budget'  
=> array
+                                               (
+                                                       'text'  => lang('check 
missing project budget'),
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiproject.check_missing_project_budget') )
                                                )
+
+
+
+
                                        );
 
                                $admin_children_agreement = array

Modified: branches/Version-1_0-branch/property/inc/class.soXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soXport.inc.php      
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.soXport.inc.php      
2013-04-05 13:37:16 UTC (rev 11031)
@@ -769,6 +769,8 @@
 
                public function 
update_actual_cost_from_archive($orders_affected)
                {
+                       $soworkorder = CreateObject('property.soworkorder');
+
                        $orders = array();
                        if($orders_affected)
                        {
@@ -788,6 +790,29 @@
                                {
                                        
phpgwapi_cache::system_clear('property', "budget_order_{$order['order_id']}");
                                        $this->db->query("UPDATE fm_workorder 
SET actual_cost = '{$order['actual_cost']}' WHERE id = 
'{$order['order_id']}'",__LINE__,__FILE__);
+
+
+                                       $this->db->query("SELECT max(periode) 
AS period, max(amount) AS amount FROM fm_orders_paid_or_pending_view WHERE 
order_id =  {$order['order_id']}",__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $period         =       
$this->db->f('period');
+                                       $amount         =       
$this->db->f('amount');
+                                       $year           =       $period ? (int) 
substr($period,0,4) : date('Y');
+
+                                       $this->db->query("SELECT order_id FROM 
fm_workorder_budget WHERE order_id = {$order['order_id']} AND year = 
{$year}",__LINE__,__FILE__);
+                                       if(!$this->db->next_record())
+                                       {
+                                               try
+                                               {
+                                                       
$soworkorder->transfer_budget($order['order_id'], array('budget_amount' => 
$amount, 'latest_year' => ($year -1)), $year);
+                                               }
+                                               catch(Exception $e)
+                                               {
+                                                       if ( $e )
+                                                       {
+                                                               
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                                       }
+                                               }
+                                       }
                                }
                        }
                }

Modified: branches/Version-1_0-branch/property/inc/class.sobudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.sobudget.inc.php     
2013-04-05 13:37:16 UTC (rev 11031)
@@ -576,7 +576,7 @@
 
                        if($cat_ids)
                        {
-                               $filtermethod .= " $where fm_project.category 
IN (". implode(',', $cat_ids) . ')';
+                               $filtermethod .= " $where fm_workorder.category 
IN (". implode(',', $cat_ids) . ')';
                                $where = 'AND';
                        }
 
@@ -611,7 +611,7 @@
 
                        if ($grouping > 0)
                        {
-                               $filtermethod .= " $where 
fm_b_account.category='$grouping' ";
+                               $filtermethod .= " $where 
fm_b_account.category='{$grouping}' ";
                                $where = 'AND';
                        }
 
@@ -704,6 +704,8 @@
                        foreach ($_temp_paid_info as $order_id => &$order_info)
                        {
                                $order_budget = 
$soworkorder->get_budget($order_id);
+//_debug_array($order_budget);
+                               $_count = false;
                                foreach($order_budget as $budget)
                                {
                                        if($budget['year'] == $year)
@@ -713,33 +715,31 @@
 $projects3[$projects2[$order_id]]['budget']+= $budget['budget'];
 $projects3[$projects2[$order_id]]['obligation']+= $budget['sum_oblications'];
 
-                                               $order_info['actual_cost']      
        += $budget['actual_cost'];
-                                               $order_info['combined_cost']    
+= $budget['sum_orders'];
-                                               $order_info['budget']           
        += $budget['budget'];
-                                               $order_info['obligation']       
        += $budget['sum_oblications'];
+                                       //      $order_info['actual_cost']      
        = $budget['actual_cost'];
+                                       //      $order_info['combined_cost']    
= $budget['sum_orders'];
+                                       //      $order_info['budget']           
        = $budget['budget'];
+                                       //      $order_info['obligation']       
        = $budget['sum_oblications'];
 
                                                $sum_obligation_cost += 
$budget['sum_oblications'];
                                                
$obligations[$order_info['b_account']][$order_info['district_id']][$order_info['ecodimb']]
 += $budget['sum_oblications'];
 
-
                                                $_taxfactor             = 1 + 
($_taxcode[(int)$order_info['mva']]/100);
-                                               $_actual_cost   = 
round($order_info['actual_cost']/$_taxfactor);
+                                               $_actual_cost   = 
round($budget['actual_cost']/$_taxfactor);
 
 //_debug_array($_test);
 
                                                $sum_actual_cost += 
$_actual_cost;
                                                
$actual_cost[$order_info['b_account']][$order_info['district_id']][$order_info['ecodimb']]
 += $_actual_cost;
+                                       }
 
-
-
+                                       if(!$_count)
+                                       {
+                                               
$hits[$order_info['b_account']][$order_info['district_id']][$order_info['ecodimb']]
 += 1;
+                                               
$accout_info[$order_info['b_account']] = true;
+                                               
$district[$order_info['district_id']] = true;
+                                               
$ecodimb[$order_info['ecodimb']] = true;
+                                               $_count = true;
                                        }
-
-                                       
$hits[$order_info['b_account']][$order_info['district_id']][$order_info['ecodimb']]
 += 1;
-                                       $accout_info[$order_info['b_account']] 
= true;
-                                       $district[$order_info['district_id']] = 
true;
-                                       $ecodimb[$order_info['ecodimb']] = true;
-
-
                                }
                        }
 //_debug_array($projects3);

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2013-04-05 13:37:16 UTC (rev 11031)
@@ -2359,25 +2359,38 @@
 
                public function get_inventory($data = array())
                {
-
                        $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
                        $id                             = (int)$data['id'];
+                       $inventory_id   = isset($data['inventory_id']) && 
$data['inventory_id'] ? (int)$data['inventory_id'] : 0;
 
                        if(!$location_id || ! $id)
                        {
                                return array();
                        }
+                       
+                       if($inventory_id)
+                       {
+                               $filtermethod = "WHERE fm_bim_item_inventory.id 
= {$inventory_id}";
+                       }
+                       else
+                       {
+                               $filtermethod = "WHERE location_id = 
{$location_id} AND fm_bim_item_inventory.item_id = {$id} AND expired_on IS 
NULL";                  
+                       }
 
                        $sql = "SELECT fm_bim_item_inventory.*, 
fm_standard_unit.name AS unit FROM fm_bim_item_inventory"
                        . " {$this->join} fm_standard_unit ON 
fm_bim_item_inventory.unit_id = fm_standard_unit.id"
-                       . "  WHERE location_id = {$location_id} AND 
fm_bim_item_inventory.item_id = {$id} AND expired_on IS NULL";
+                       . " {$filtermethod}"
+                       . " ORDER BY p_location_id, p_id";
+
                        $this->db->query($sql,__LINE__,__FILE__);
                        $inventory = array();
                        while ($this->db->next_record())
                        {
                                $inventory[] = array
                                (
+                                       'inventory_id'  => $this->db->f('id'),
                                        'inventory'             => 
$this->db->f('inventory'),
+                                       'unit_id'               => 
$this->db->f('unit_id'),
                                        'unit'                  => 
$this->db->f('unit', true),
                                        'remark'                => 
$this->db->f('remark', true),
                                        'p_location_id' => 
$this->db->f('p_location_id'),
@@ -2389,38 +2402,14 @@
                                );
                        }
 
-//_debug_array($inventory);
                        return $inventory;
-/*
-  id integer NOT NULL DEFAULT nextval('seq_fm_bim_item_inventory'::regclass),
-  location_id integer NOT NULL,
-  item_id integer NOT NULL,
-  p_location_id integer,
-  p_id integer,
-  unit_id integer NOT NULL,
-  inventory integer NOT NULL,
-  write_off integer NOT NULL,
-  bookable smallint NOT NULL,
-  active_from bigint,
-  active_to bigint,
-  created_on bigint NOT NULL,
-  created_by integer NOT NULL,
-  expired_on bigint,
-  expired_by bigint,
-  remark text,
-
-*/
-
                }
 
-               public function save_inventory($values)
+               public function add_inventory($values)
                {
                        $p_location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.location.' . 
count(explode('-', $values['location_code'])));
                        
-                       $sql = "SELECT id FROM fm_locations WHERE location_code 
= '{$values['location_code']}'";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $p_id   = $this->db->f('id');
+                       $p_id = 
execMethod('property.solocation.get_item_id',$values['location_code']);
                        
                        if(!$p_location_id && !$p_id)
                        {
@@ -2452,4 +2441,59 @@
                                 . 
$this->db->validate_insert(array_values($value_set)) . ')',__LINE__,__FILE__);
 
                }
+
+
+               public function edit_inventory($values)
+               {
+                       $inventory_id = (int)$values['inventory_id'];
+                       if(!$inventory_id)
+                       {
+                               throw new Exception('ERROR: Not a valid id');   
                
+                       }
+                       
+                       $this->db->transaction_begin();
+
+                       $table = 'fm_bim_item_inventory';
+
+                       $value_set = array
+                       (
+                               'expired_on'            => time(),
+                               'expired_by'            => $this->account,
+                       );
+
+                       $value_set      = 
$this->db->validate_update($value_set);
+                       $this->db->query("UPDATE {$table} SET $value_set WHERE 
id = {$inventory_id}",__LINE__,__FILE__);
+
+                       if(!(int)$values['inventory'])
+                       {
+                               return $this->db->transaction_commit();         
        
+                       }
+
+                       $sql = "SELECT * FROM fm_bim_item_inventory WHERE id = 
{$inventory_id}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $value_set = array
+                       (
+                               'location_id'           => 
$this->db->f('location_id'),
+                               'item_id'                       => 
$this->db->f('item_id'),
+                               'p_location_id'         => 
$this->db->f('p_location_id'),
+                               'p_id'                          => 
$this->db->f('p_id'),
+                               'unit_id'                       => 
$this->db->f('unit_id'),
+                               'inventory'                     => 
(int)$values['inventory'],
+                               'write_off'                     => 
(int)$values['write_off'],
+                               'bookable'                      => 
(int)$values['bookable'],
+                               'active_from'           => 
$values['active_from'],
+                               'active_to'                     => 
$values['active_to'],
+                               'created_on'            => time(),
+                               'created_by'            => $this->account,
+                               'remark'                        => 
$this->db->db_addslashes($values['remark'])
+                       );
+
+                       $this->db->query("INSERT INTO {$table} (" . 
implode(',',array_keys($value_set)) . ') VALUES ('
+                                . 
$this->db->validate_insert(array_values($value_set)) . ')',__LINE__,__FILE__);
+
+                       return $this->db->transaction_commit();
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -515,6 +515,7 @@
                        $order          = isset($data['order']) ? 
$data['order'] : '';
                        $voucher_id     = isset($data['voucher_id']) && 
$data['voucher_id'] ? (int)$data['voucher_id'] : 0;
                        $paid           = isset($data['paid']) ? $data['paid'] 
: '';
+                       $year           = isset($data['year']) ? $data['year'] 
: '';
                        $project_id     = isset($data['project_id']) && 
$data['project_id'] ? (int)$data['project_id'] : 0;
                        $order_id       = isset($data['order_id']) && 
$data['order_id'] ? $data['order_id'] : 0 ;//might be bigint
 
@@ -562,12 +563,18 @@
                                $where = 'AND';
                        }
 
+                       if ($year)
+                       {
+                               $filtermethod .= " {$where} ({$table}.periode > 
{$year}00 AND {$table}.periode < {$year}13 OR {$table}.periode IS NULL)";
+                               $where = 'AND';
+                       }
+
                        $groupmethod = "GROUP BY 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,"
                                . " 
currency,budsjettansvarligid,org_name,periode";
 
                        $sql = "SELECT DISTINCT 
pmwrkord_code,bilagsnr,bilagsnr_ut,fakturanr,sum(belop) as belop, 
sum(godkjentbelop) as godkjentbelop,"
                                . " 
currency,budsjettansvarligid,org_name,periode"
-                               . " FROM $table"
+                               . " FROM {$table}"
                                . " {$this->join} fm_ecoart ON fm_ecoart.id = 
$table.artid"
                                . " {$this->join} fm_workorder ON 
fm_workorder.id = $table.pmwrkord_code"
                                . " {$this->join} fm_project ON 
fm_workorder.project_id = fm_project.id"

Modified: branches/Version-1_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2013-04-05 13:37:16 UTC (rev 11031)
@@ -1820,6 +1820,15 @@
                        return $this->db->f('id');
                }
 
+
+               public function get_location_code($id)
+               {
+                       $sql = "SELECT location_code FROM fm_locations WHERE id 
= '{$id}'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f('location_code');
+               }
+
                function get_children($criteria = '')
                {
                        $join_method = '';

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -757,6 +757,40 @@
                                        }
                                        else
                                        {
+
+                                               $year = (int)$filter_year;
+                                               $project_budget = 
$this->get_budget($project['project_id']);
+                                               foreach ($project_budget as 
$entry)
+                                               {
+                                                       if($year && 
$entry['year'] == $year)
+                                                       {
+                                                               
if($entry['active'])
+                                                               {
+                                                                       
$project['combined_cost'] += $entry['sum_orders'];
+                                                                       
$project['budget'] += $entry['budget'];
+                                                                       
if(!$entry['closed'])
+                                                                       {
+                                                                               
$project['obligation']  += $entry['sum_oblications'];
+                                                                       }
+                                                               }
+                                                               
$project['actual_cost'] += $entry['actual_cost'];
+                                                       }
+                                                       else if (!$year)
+                                                       {
+                                                               
if($entry['active'])
+                                                               {
+                                                                       
$project['combined_cost'] += $entry['sum_orders'];
+                                                                       
$project['budget'] += $entry['budget'];
+                                                                       
if(!$entry['closed'])
+                                                                       {
+                                                                               
$project['obligation']  += $entry['sum_oblications'];
+                                                                       }
+                                                               }
+                                                               
$project['actual_cost'] += $entry['actual_cost'];
+                                                       }
+                                               }
+/*
+
                                                $workorder_data = 
$this->project_workorder_data(array('project_id' => $project['project_id'], 
'year' => (int)$filter_year));
                                                foreach($workorder_data as 
$entry)
                                                {
@@ -765,9 +799,18 @@
                                                        $project['budget']      
                += $entry['budget'];
                                                        $project['obligation']  
        += $entry['obligation'];
                                                }
+
                                                unset($entry);
+*/
                                                $_diff_start = 
abs($project['budget']) > 0 ? $project['budget'] : $project['combined_cost'];
-                                               $project['diff'] = $_diff_start 
- $project['obligation'] - $project['actual_cost'];
+                                               if(abs($_diff_start) > 0)
+                                               {
+                                                       $project['diff'] = 
$_diff_start - $project['obligation'] - $project['actual_cost'];
+                                               }
+                                               else
+                                               {
+                                                       $project['diff'] = 0;
+                                               }
                                        }
                                }
 
@@ -790,7 +833,9 @@
                {
                        $project_id = (int) $project_id;
                        $project = array();
-                       $sql = "SELECT * FROM fm_project WHERE 
id={$project_id}";
+                       $sql = "SELECT fm_project.*, fm_project_status.closed 
FROM fm_project"
+                       . " {$this->join} fm_project_status ON 
fm_project.status = fm_project_status.id" 
+                       . " WHERE fm_project.id={$project_id}";
 
                        $this->db->query($sql,__LINE__,__FILE__);
 
@@ -810,6 +855,7 @@
                                        'key_responsible'               => 
$this->db->f('key_responsible'),
                                        'descr'                                 
=> $this->db->f('descr', true),
                                        'status'                                
=> $this->db->f('status'),
+                                       'closed'                                
=> $this->db->f('closed'),
                                        'budget'                                
=> (int)$this->db->f('budget'),
                        //              'planned_cost'                  => 
(int)$this->db->f('planned_cost'),
                                        'reserve'                               
=> (int)$this->db->f('reserve'),
@@ -848,7 +894,7 @@
 
                        if($project)
                        {
-                               $this->db->query("SELECT sum(budget) AS 
sum_budget FROM fm_project_budget WHERE project_id = 
$project_id",__LINE__,__FILE__);
+                               $this->db->query("SELECT sum(budget) AS 
sum_budget FROM fm_project_budget WHERE project_id = $project_id AND active = 
1",__LINE__,__FILE__);
                                $this->db->next_record();
                                $project['budget'] 
=(int)$this->db->f('sum_budget');
                        }
@@ -959,115 +1005,7 @@
                        return $values;
                }
 
-               //FIXME
-               function project_workorder_data_old($data = array())
-               {
-                       $project_id = (int) $data['project_id'];
-                       $year = (int) $data['year'];
-                       $values = array();
 
-                       $filter_year = '';
-                       if($year)
-                       {
-//                             $start_date = mktime(0, 0, 0, 1, 1, $year)
-//                             $end_date = mktime(23, 59, 59, 12, 31, $year)
-                               $filter_year = "AND fm_workorder_budget.year = 
{$year}";
-                       }
-
-                       $this->db->query("SELECT DISTINCT fm_workorder.title, 
fm_workorder.actual_cost, fm_workorder.id as 
workorder_id,fm_workorder.contract_sum,"
-                               . " fm_workorder.vendor_id, 
fm_workorder.calculation,fm_workorder.rig_addition,fm_workorder.addition,fm_workorder.deviation,fm_workorder.charge_tenant,"
-                               . " fm_workorder_status.descr as status, 
fm_workorder_status.closed, fm_workorder.account_id as b_account_id"
-                               . " FROM fm_workorder"
-                               . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
-                               . " {$this->join} fm_workorder_budget ON 
fm_workorder.id = fm_workorder_budget.order_id"
-                               . " WHERE project_id={$project_id} 
{$filter_year}",__LINE__,__FILE__);
-
-                       $_orders = array();
-
-                       while ($this->db->next_record())
-                       {
-                               $values[] = array(
-                                       'workorder_id'          => 
$this->db->f('workorder_id'),
-                                       'title'                         => 
$this->db->f('title',true),
-                                       'deviation'                     => 
$this->db->f('deviation'),
-                                       'calculation'           => 
$this->db->f('calculation'),
-                                       'actual_cost'           => 0,
-                                       'obligation'            => 0,
-                                       'vendor_id'                     => 
$this->db->f('vendor_id'),
-                                       'charge_tenant'         => 
$this->db->f('charge_tenant'),
-                                       'status'                        => 
$this->db->f('status'),
-                                       'closed'                        => 
!!$this->db->f('closed'),
-                                       'b_account_id'          => 
$this->db->f('b_account_id'),
-                                       'contract_sum'          => 
(int)$this->db->f('contract_sum'),
-                                       'addition_percentage'   => 
(int)$this->db->f('addition')
-                               );
-                               $_orders[] = $this->db->f('workorder_id');
-                       }
-
-                       if($_orders)
-                       {
-                               $_actual_cost_arr = array();
-
-                               $sql_cost = "SELECT order_id, sum(amount) AS 
actual_cost"
-                               . " FROM fm_workorder {$this->join} 
fm_orders_paid_or_pending_view ON fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id"
-                               . ' WHERE order_id IN (' . implode(',', 
$_orders ) .') GROUP BY order_id';
-                               $this->db->query($sql_cost,__LINE__,__FILE__);
-                               while ($this->db->next_record())
-                               {
-                                       
$_actual_cost_arr[$this->db->f('order_id')] = $this->db->f('actual_cost');
-                               }
-                       }
-
-                       foreach ($values as &$entry)
-                       {
-                               $this->db2->query("SELECT 
sum(fm_workorder_budget.budget) AS budget,"
-                                . " sum(fm_workorder_budget.combined_cost) AS 
combined_cost"
-                                . " FROM fm_workorder_budget WHERE active =1 
AND order_id ='{$entry['workorder_id']}'",__LINE__,__FILE__);
-                                $this->db2->next_record();
-
-                               $entry['combined_cost'] = 
$this->db2->f('combined_cost');
-                               $entry['budget'] = $this->db2->f('budget');
-
-
-                               $_combined_cost = 
round($entry['combined_cost']);
-
-                               $_actual_cost = 
isset($_actual_cost_arr[$entry['workorder_id']]) && 
$_actual_cost_arr[$entry['workorder_id']] ? 
$_actual_cost_arr[$entry['workorder_id']] : 0;
-
-               //              FIXME
-               //              $_taxfactor = 1 + 
($_taxcode[(int)$this->db->f('mvakode')]/100);
-               //              $_actual_cost = round($actual_cost/$_taxfactor);
-
-                               $entry['actual_cost'] = $_actual_cost;
-
-                               $_obligation = 0;
-                               if(!$entry['closed'])
-                               {
-                                       $_obligation = $_combined_cost - 
$_actual_cost;
-                                       if($entry['budget'] >= 0)
-                                       {
-                                               if($_obligation < 0)
-                                               {
-                                                       $_obligation = 0;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               if($_obligation > 0)
-                                               {
-                                                       $_obligation = 0;
-                                               }
-                                       }
-                                       $entry['obligation'] = $_obligation;
-                               }
-
-                               $_diff_start = abs($entry['budget']) > 0 ? 
$entry['budget'] : $_combined_cost;
-                               $entry['diff'] = $_diff_start - 
$entry['obligation'] - $entry['actual_cost'];
-//                             $entry['diff'] =  $entry['budget'] - 
$entry['obligation'] - $entry['actual_cost'];
-                       }
-
-                       return $values;
-               }
-
                function branch_p_list($project_id = '')
                {
                        $selected = array();
@@ -1503,7 +1441,9 @@
 
                                while ($this->db->next_record())
                                {
-                                       $workorders[] = $this->db->f('id');
+                                       $workorder_id = $this->db->f('id');
+                                       $workorders[] = $workorder_id;
+                                       
phpgwapi_cache::system_clear('property', "budget_order_{$workorder_id}");
                                }
 
                                if ($workorders)
@@ -2265,35 +2205,15 @@
                        }
 
                        ksort($_values);
+//_debug_array($_values);die();
 
                        $values = array();
-                       $_current_period = (int)date('Ym');
-                       $_delay_period = 0;
+
                        foreach ($_values as $period => $_budget)
                        {
-                               if ($_current_period > (int)$period)
-                               {
-                                       $_delay_period += 
$_budget['sum_oblications'];
-                                       $_budget['sum_oblications'] = 0;
-                               }
-
-                               if( $_delay_period &&  $_current_period < 
(int)$period)
-                               {
-                                       $_budget['sum_oblications'] += 
$_delay_period;
-                                       $_delay_period =0;
-                               }
-
                                $values[] = $_budget;
                        }
 
-
-                       if($_delay_period && $values)
-                       {
-                               $i = count($values) -1;
-                               //last one
-                               $values[$i]['sum_oblications'] += 
$_delay_period;
-                       }
-
 //_debug_array($values);die();
 
                        $deviation_acc = 0;
@@ -2303,21 +2223,30 @@
                                $entry['year'] = substr( $entry['period'], 0, 4 
);
                                $month = substr( $entry['period'], 4, 2 );
                                $entry['month'] = $month == '00' ? '' : $month;
-                               if($active_period[$entry['period']])
+
+       //                      if($active_period[$entry['period']])
+                               if($closed_period[$entry['period']])
                                {
                                        $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
                                        $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
+
+                                       $_deviation = $entry['budget'] - 
$entry['actual_cost'];
+       //                              $deviation = abs($entry['actual_cost']) 
> 0 ? $_deviation : 0;
+                                       $deviation = $_deviation;
+
+
                                }
                                else
                                {
                                        $entry['diff'] =  0;
+                                       $deviation = 0;
                                }
-                               $_deviation = $entry['budget'] - 
$entry['actual_cost'];
-                               $deviation = abs($entry['actual_cost']) > 0 ? 
$_deviation : 0;
+
                                $entry['deviation_period'] = $deviation;
                                $budget_acc +=$entry['budget'];
 
-                               if($active_period[$entry['period']])
+       //                      if($active_period[$entry['period']])
+                               if($closed_period[$entry['period']])
                                {
                                        $deviation_acc += $deviation;
                                }
@@ -2335,344 +2264,7 @@
 
                }
 
-               function get_budget_old($project_id)
-               {
-                       $project_id = (int) $project_id;
-                       $closed_period = array();
-                       $active_period = array();
-                       $project_budget = array();
-                       $project_total_budget = 0;
 
-                       $sql = "SELECT fm_project_budget.year, 
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed, 
fm_project_budget.active, sum(combined_cost) AS order_amount"
-                       . " FROM fm_project_budget {$this->left_join} 
fm_workorder ON fm_project_budget.project_id = fm_workorder.project_id WHERE 
fm_project_budget.project_id = {$project_id}"
-                       . " GROUP BY fm_project_budget.year, 
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed, 
fm_project_budget.active"
-                       . " ORDER BY fm_project_budget.year, 
fm_project_budget.month";
-                       $this->db->query($sql,__LINE__,__FILE__);
-//     _debug_array($sql);
-                       while ($this->db->next_record())
-                       {
-                               $period = $this->db->f('year') . 
sprintf("%02s", $this->db->f('month'));
-
-                               $project_budget[$period] = 
(int)$this->db->f('budget');
-                               $closed_period[$period] = 
!!$this->db->f('closed');
-                               $active_period[$period] = 
!!$this->db->f('active');
-                       }
-
-                       $project_total_budget = array_sum($project_budget);
-
-                       $sql = "SELECT fm_workorder.id AS order_id, 
sum(fm_workorder_budget.combined_cost) AS combined_cost, 
sum(fm_workorder_budget.budget) AS budget, fm_workorder_budget.year, 
fm_workorder_budget.month, fm_workorder_status.closed"
-                               . " FROM fm_workorder"
-                               . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
-                               . " {$this->join} fm_workorder_budget ON 
fm_workorder.id = fm_workorder_budget.order_id"
-                               . " WHERE fm_workorder_budget.active = 1 AND 
project_id = {$project_id}"
-                               . " GROUP BY fm_workorder.id, 
fm_workorder_budget.year, fm_workorder_budget.month, fm_workorder_status.closed"
-                               . " ORDER BY fm_workorder_budget.year, 
fm_workorder_budget.month";
-//     _debug_array($sql);die();
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $_order_list = array();
-                       $_orders = array();
-                       $_order_info = array();
-                       while ($this->db->next_record())
-                       {
-                               $period = $this->db->f('year') . 
sprintf("%02s", $this->db->f('month'));
-                               $_order_id = $this->db->f('order_id');
-                               $_order_list[] = $_order_id;
-                               $_temp_info = array
-                               (
-                                       'combined_cost' => 
$this->db->f('combined_cost'),
-                                       'budget'                => 
$this->db->f('budget'),
-                                       'actual_cost'   => 0, //for now..
-                                       'closed'                => 
!!$this->db->f('closed')
-                               );
-
-                               $_orders[$period][$_order_id] = $_temp_info;
-                               $_order_info[$_order_id] = $_temp_info;
-                       }
-
-//_debug_array($_orders);
-//die();
-$test = 0;
-                       if ( $_order_list )
-                       {
-                               $sql = "SELECT order_id, periode, amount AS 
actual_cost"
-                               . " FROM fm_workorder {$this->join} 
fm_orders_paid_or_pending_view ON fm_workorder.id = 
fm_orders_paid_or_pending_view.order_id"
-                               . ' WHERE order_id IN (' . implode(',', 
$_order_list ) .') ORDER BY periode ASC';
-//_debug_array($sql);
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               while ($this->db->next_record())
-                               {
-                                       $_order_id = $this->db->f('order_id');
-                                       $periode = $this->db->f('periode');
-                                       if(!$periode)
-                                       {
-                                               $periode = date('Ym');
-                                       }
-
-                                       $year = substr( $periode, 0, 4 );
-
-                                       $_found = false;
-                                       if(isset($project_budget[$periode]))
-                                       {
-                                               
$_orders[$periode][$_order_id]['actual_cost'] += $this->db->f('actual_cost');
-                                               $_found = true;
-                                       }
-                                       else
-                                       {
-                                               for ($i=0;$i<13;$i++)
-                                               {
-                                                       $_period = $year . 
sprintf("%02s", $i);
-                                                       
if(isset($project_budget[$_period]))
-                                                       {
-                                                               
$_orders[$_period][$_order_id]['actual_cost'] += $this->db->f('actual_cost');
-//_debug_array($test+=$this->db->f('actual_cost'));
-                                                               $_found = true;
-                                                               break;
-                                                       }
-                                               }
-                                       }
-
-                                       if(!$_found)
-                                       {
-                                               
$_orders[$periode][$_order_id]['actual_cost'] += $this->db->f('actual_cost');
-                                       }
-                               }
-                       }
-
-
-                       if($_orders)
-                       {
-                               ksort($_orders);
-                       }
-
-
-//_debug_array($_orders);
-//die();
-
-                       $sort_period = array();
-                       $values = array();
-//_debug_array($project_budget);die();
-//$test = 0;
-                       $_current_period = date('Ym');
-                       $_delay_period = 0;
-                       foreach ($project_budget as $period => $_budget)
-                       {
-                               $_sum_orders = array();
-                               $_sum_oblications = array();
-                               $_actual_cost = 0;
-
-                               if(isset($_orders[$period]))
-                               {
-//_debug_array($_orders[$period]);//die();
-
-                                       foreach ($_orders[$period] as $order_id 
=> $order)
-                                       {
-                                               $_actual_cost += 
$order['actual_cost'];
-//_debug_array( $test+= $order['actual_cost']);
-                                               $_sum_orders[$order_id] += 
$order['combined_cost'];
-
-                                               
if(!$_order_info[$order_id]['closed'])
-                                               {
-//_debug_array($order_id);
-                                                       
$_sum_oblications[$order_id] += $order['combined_cost'];
-                                                       
$_sum_oblications[$order_id] -= $order['actual_cost'];
-//_debug_array($_sum_oblications[$order_id]);
-                                       //              
if($project_total_budget >= 0)
-                                       //              if($_budget >= 0)
-                                                       
if($_order_info[$order_id]['budget'] >= 0)
-                                                       {
-
-                                                               
if($_sum_oblications[$order_id] < 0)
-                                                               {
-                                                                       
$_sum_oblications[$order_id] = 0;
-                                                               }
-                                                       }
-                                                       else // income
-                                                       {
-                                                               
if($_sum_oblications[$order_id] > 0)
-                                                               {
-                                                                       
$_sum_oblications[$order_id] = 0;
-                                                               }
-                                                       }
-                                               }
-
-                                               //override if periode is closed
-                                               
if(!isset($active_period[$period]) || !$active_period[$period])
-                                               {
-                                                       $_delay_period += 
$_sum_oblications[$order_id];
-                                                       
$_sum_oblications[$order_id] = 0;
-                                               }
-                                               else if ((int)$_current_period 
> (int)$period)
-                                               {
-                                                       $_delay_period += 
$_sum_oblications[$order_id];
-                                                       
$_sum_oblications[$order_id] = 0;
-                                               }
-
-                                               //override if periode is closed
-                                               
if(isset($closed_period[$period]) && $closed_period[$period])
-                                               {
-                                                       
$_sum_oblications[$order_id] = 0;
-                                               }
-                                       }
-
-                                       unset($_orders[$period]);
-                               }
-
-                               if(isset($active_period[$period]) && 
$active_period[$period] && $_delay_period && (int) $_current_period < 
(int)$period)
-                               {
-                                       $_sum_oblications[] += $_delay_period;
-                                       $_delay_period =0;
-                               }
-//die();
-                               $values[] = array
-                               (
-                                       'project_id'                    => 
$project_id,
-                                       'period'                                
=> $period,
-                                       'budget'                                
=> $_budget,
-                                       'sum_orders'                    => 
array_sum($_sum_orders),
-                                       'sum_oblications'               => 
array_sum($_sum_oblications),
-                                       'actual_cost'                   => 
$_actual_cost,
-                                       'deviation_acc'                 => 0
-                               );
-
-                               $sort_period[] = $period;
-                       }
-
-                       if($_delay_period && $values)
-                       {
-                               $i = count($values) -1;
-                               //last one
-                               $values[$i]['sum_oblications'] += 
$_delay_period;
-                               $_delay_period = 0;
-                       }
-
-//_debug_array( $values);die();
-                       unset($order);
-                       unset($order_id);
-                       unset($period);
-
-                       reset($_orders);
-
-                       //remaining
-
-
-                       foreach ($_orders as $period => $orders)
-                       {
-                               $_sum_orders = array();
-                               $_sum_oblications = array();
-                               $_actual_cost = 0;
-
-                               foreach ($orders as $order_id => $order)
-                               {
-                                       $_actual_cost += $order['actual_cost'];
-
-                                       $_sum_orders[$order_id] += 
$order['combined_cost'];
-
-                                       if(!$_order_info[$order_id]['closed'])
-                                       {
-                                               $_sum_oblications[$order_id] -= 
$order['actual_cost'];
-                                               $_sum_oblications[$order_id] += 
$order['combined_cost'];
-
-                                               if($project_total_budget >= 0)
-                                               {
-                                                       
if($_sum_oblications[$order_id] < 0)
-                                                       {
-                                                               
$_sum_oblications[$order_id] = 0;
-                                                       }
-                                               }
-                                               else // income
-                                               {
-                                                       
if($_sum_oblications[$order_id] > 0)
-                                                       {
-                                                               
$_sum_oblications[$order_id] = 0;
-                                                       }
-                                               }
-                                       }
-
-                                       //override if periode is closed
-                                       if(!isset($active_period[$period]) || 
!$active_period[$period])
-                                       {
-                                               $_delay_period += 
$_sum_oblications[$order_id];
-                                               $_sum_oblications[$order_id] = 
0;
-                                       }
-                                       else if ((int)$_current_period > 
(int)$period)
-                                       {
-                                               $_delay_period += 
$_sum_oblications[$order_id];
-                                               $_sum_oblications[$order_id] = 
0;
-                                       }
-
-                                       //override if periode is closed
-                                       if(isset($closed_period[$period]) && 
$closed_period[$period])
-                                       {
-                                               $_sum_oblications[$order_id] = 
0;
-                                       }
-                               }
-
-                               if(isset($active_period[$period]) && 
$active_period[$period] && $_delay_period && (int) $_current_period < 
(int)$period)
-                               {
-                                       $_sum_oblications[] += $_delay_period;
-                                       $_delay_period =0;
-                               }
-
-                               $values[] = array
-                               (
-                                       'project_id'                    => 
$project_id,
-                                       'period'                                
=> $period,
-                                       'budget'                                
=> 0,
-                                       'sum_orders'                    => 
array_sum($_sum_orders),
-                                       'sum_oblications'               => 
array_sum($_sum_oblications),
-                                       'actual_cost'                   => 
$_actual_cost,
-                                       'deviation_acc'                 => 0
-                               );
-
-                               $sort_period[] = $period;
-                       }
-
-                       if($_delay_period && $values)
-                       {
-                               $i = count($values) -1;
-                               //last one
-                               $values[$i]['sum_oblications'] += 
$_delay_period;
-                       }
-
-
-                       if($values)
-                       {
-                               array_multisort($sort_period, SORT_ASC, 
$values);
-                       }
-
-
-                       $deviation_acc = 0;
-                       $budget_acc = 0;
-                       foreach ($values as &$entry)
-                       {
-                               $entry['year'] = substr( $entry['period'], 0, 4 
);
-                               $month = substr( $entry['period'], 4, 2 );
-                               $entry['month'] = $month == '00' ? '' : $month;
-                               if($active_period[$entry['period']])
-                               {
-                                       $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
-                                       $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
-                               }
-                               else
-                               {
-                                       $entry['diff'] =  0;
-                               }
-                               $_deviation = $entry['budget'] - 
$entry['actual_cost'];
-                               $deviation = abs($entry['actual_cost']) > 0 ? 
$_deviation : 0;
-                               $entry['deviation_period'] = $deviation;
-                               $budget_acc +=$entry['budget'];
-                               $deviation_acc += $deviation;
-                               $entry['deviation_acc'] = abs($deviation) > 0 ? 
$deviation_acc : 0;
-                               $entry['deviation_percent_period'] = 
$deviation/$entry['budget'] * 100;
-                               $entry['deviation_percent_acc'] = 
$entry['deviation_acc']/$budget_acc * 100;
-                               $entry['closed'] = 
$closed_period[$entry['period']];
-                               $entry['active'] = 
$active_period[$entry['period']];
-                       }
-
-                       return $values;
-               }
-
                function delete_period_from_budget($project_id, $data)
                {
                        $project_id = (int) $project_id;
@@ -3446,4 +3038,28 @@
 
                        return $year_list;
                }
+
+
+               public function get_missing_project_budget()
+               {
+                       $values = array();
+
+                       $sql = "SELECT 
fm_project_budget_year_from_order_view.project_id,fm_project_budget_year_from_order_view.year"
+                       . " FROM fm_project_budget_year_from_order_view"
+                       . " {$this->left_join} fm_project_budget_year_view ON 
(fm_project_budget_year_from_order_view.project_id = 
fm_project_budget_year_view.project_id AND 
fm_project_budget_year_from_order_view.year = fm_project_budget_year_view.year)"
+                       . " WHERE fm_project_budget_year_view.project_id IS 
NULL"
+                       . " ORDER BY 
fm_project_budget_year_from_order_view.project_id,fm_project_budget_year_from_order_view.year";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while($this->db->next_record())
+                       {
+                               $values[] = array
+                               (
+                                       'project_id'    => 
$this->db->f('project_id'),
+                                       'year'                  => 
$this->db->f('year'),
+                               );
+                       }
+                       return $values;
+               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -330,6 +330,8 @@
 
                        $entity_table = 'fm_request';
 
+                       $GLOBALS['phpgw']->config->read();
+
                        $uicols = array();
                        $cols .= "{$entity_table}.location_code";
                        $cols_return[]                          = 
'location_code';
@@ -566,7 +568,7 @@
                        $cols_group[]                           = 'coordinator';
                        $uicols['input_type'][]         = 'text';
                        $uicols['name'][]                       = 'coordinator';
-                       $uicols['descr'][]                      = 
lang('Coordinator');
+                       $uicols['descr'][]                      = 
isset($GLOBALS['phpgw']->config->config_data['lang_request_coordinator']) && 
$GLOBALS['phpgw']->config->config_data['lang_request_coordinator'] ? 
$GLOBALS['phpgw']->config->config_data['lang_request_coordinator'] : 
lang('Coordinator');
                        $uicols['statustext'][]         = lang('Project 
coordinator');
                        $uicols['exchange'][]           = '';
                        $uicols['align'][]                      = '';
@@ -575,7 +577,6 @@
                        $uicols['classname'][]          = '';
                        $uicols['sortable'][]           = false;
 
-
                        $paranthesis = '(';
                        $joinmethod = "{$this->_left_join} fm_request_status ON 
{$entity_table}.status = fm_request_status.id)";
 
@@ -587,7 +588,6 @@
                        $paranthesis .= '(';
                        $joinmethod .= "{$this->_left_join} 
fm_request_condition ON {$entity_table}.id = fm_request_condition.request_id)";
 
-                       $GLOBALS['phpgw']->config->read();
                        $_location_level = 
isset($GLOBALS['phpgw']->config->config_data['request_location_level']) && 
$GLOBALS['phpgw']->config->config_data['request_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['request_location_level'] : 0;
                        $sql    = 
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols'=>$cols,'cols_return'=>$cols_return,
                                
'uicols'=>array(),'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,
@@ -1387,4 +1387,10 @@
 
                        return $values;
                }
+
+               public function update_status_from_related($data = array())
+               {
+
+               }
+
        }

Modified: branches/Version-1_0-branch/property/inc/class.sotts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sotts.inc.php        
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.sotts.inc.php        
2013-04-05 13:37:16 UTC (rev 11031)
@@ -920,20 +920,28 @@
                                }
                                $this->check_pending_action($ticket, $id);
 
-                               //Close cases at controller
-                               
if(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
+                               //Close cases
+                               $check_new_custom = (int) 
trim($ticket['status'],'C');
+                               $this->db->query("SELECT closed from 
fm_tts_status WHERE id = {$check_new_custom}",__LINE__,__FILE__);
+                               $this->db->next_record();
+
+                               if(($this->db->f('closed') || $ticket['status'] 
== 'X') && ($old_status!='X' && !$old_closed))
                                {
-                                       $check_new_custom = (int) 
trim($ticket['status'],'C');
-                                       $this->db->query("SELECT closed from 
fm_tts_status WHERE id = {$check_new_custom}",__LINE__,__FILE__);
-                                       $this->db->next_record();
-
-                                       if(($this->db->f('closed') || 
$ticket['status'] == 'X') && ($old_status!='X' && !$old_closed))
+                                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+                                       // at controller
+                                       
if(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
                                        {
-                                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
-                                               $controller = 
CreateObject('controller.uicase'); 
-                                               
$controller->updateStatusForCases($location_id, $id, 1);
+                                               $controller = 
CreateObject('controller.uicase'); 
+                                               
$controller->updateStatusForCases($location_id, $id, 1);
                                        }
+                                       // at request
+                                       
execMethod('property.sorequest.update_status_from_related', array(
+                                               'location_id'   => $location_id,
+                                               'id'                    => $id,
+                                               'status'                => 
'closed')
+                                       );
                                }
+
                        }
 
                        if ($this->fields_updated)
@@ -1109,19 +1117,26 @@
                                }
                                $this->check_pending_action($ticket, $id);
 
-                               //Close cases at controller
-                               
if(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
+                               //Close cases at related
+                               $check_new_custom = (int) 
trim($ticket['status'],'C');
+                               $this->db->query("SELECT closed from 
fm_tts_status WHERE id = {$check_new_custom}",__LINE__,__FILE__);
+                               $this->db->next_record();
+
+                               if(($this->db->f('closed') || $ticket['status'] 
== 'X') && ($old_status!='X' && !$old_closed))
                                {
-                                       $check_new_custom = (int) 
trim($ticket['status'],'C');
-                                       $this->db->query("SELECT closed from 
fm_tts_status WHERE id = {$check_new_custom}",__LINE__,__FILE__);
-                                       $this->db->next_record();
-
-                                       if(($this->db->f('closed') || 
$ticket['status'] == 'X') && ($old_status!='X' && !$old_closed))
+                                       $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+                                       // at controller
+                                       
if(isset($GLOBALS['phpgw_info']['user']['apps']['controller']))
                                        {
-                                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
-                                               $controller = 
CreateObject('controller.uicase'); 
-                                               
$controller->updateStatusForCases($location_id, $id, 1);
+                                               $controller = 
CreateObject('controller.uicase'); 
+                                               
$controller->updateStatusForCases($location_id, $id, 1);
                                        }
+                                       // at request
+                                       
execMethod('property.sorequest.update_status_from_related', array(
+                                               'location_id'   => $location_id,
+                                               'id'                    => $id,
+                                               'status'                => 
'closed')
+                                       );
                                }
                        }
 

Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2013-04-05 13:37:16 UTC (rev 11031)
@@ -511,7 +511,7 @@
                                {
                                        $cat_filter[] = $_category['id'];
                                }
-                               $filtermethod .= " {$where} fm_project.category 
IN (" .  implode(',', $cat_filter) .')';
+                               $filtermethod .= " {$where} 
fm_workorder.category IN (" .  implode(',', $cat_filter) .')';
 
                                $where= 'AND';
                        }
@@ -1714,12 +1714,13 @@
                                        'year'                          => 
(int)$this->db->f('year'),
                                        'month'                         => 
(int)$this->db->f('month'),
                                        'actual_cost'           => 0, //for 
now..
-                                       'closed_order'          => 
$this->db->f('closed'),
+                                       'closed_order'          => 
(int)$this->db->f('closed'),
+                                       'active_period'         => 
(int)$this->db->f('active'),
                                );
 
                                $active_period[$period] = 
$this->db->f('active');
                        }
-
+//_debug_array($order_budget);die();
                        foreach ($order_budget as $period => $_budget)
                        {
                                $this->db->query("SELECT closed FROM 
fm_workorder"
@@ -1729,7 +1730,7 @@
                                . " AND fm_project_budget.year = 
{$_budget['year']}"
                                . " AND fm_project_budget.month = 
{$_budget['month']}" ,__LINE__,__FILE__);
                                $this->db->next_record();
-                               $closed_period[$period] = 
$this->db->f('closed');
+                               $closed_period[$period] = 
(int)$this->db->f('closed');
                        }
 
                        $sql = "SELECT order_id, periode, amount AS actual_cost"
@@ -1783,7 +1784,10 @@
                        $values = array();
 //_debug_array($order_budget);die();
 //$test = 0;
-                       $_delay_period = 0;
+                       $_current_period = date('Ym');
+                       $_delay_period_sum = 0;
+                       $_delay_period = false;
+
                        foreach ($order_budget as $period => $_budget)
                        {
                                $_sum_orders = 0;
@@ -1794,8 +1798,10 @@
 //_debug_array( $test+= $_budget['actual_cost']);
                                $_sum_orders += $_budget['combined_cost'];
 
-                               if(!$_budget['closed_order'])
+                               if(!$_budget['closed_order'])// && 
$active_period[$period])
                                {
+                                       if($active_period[$period])
+                                       {
                                        $_sum_oblications += 
$_budget['combined_cost'];
                                        $_sum_oblications -= 
$_budget['actual_cost'];
 
@@ -1814,25 +1820,35 @@
                                                        $_sum_oblications = 0;
                                                }
                                        }
+                                       }
                                }
 
+/*
+                               if(($period < $_current_period) && 
$active_period[$period] && !$closed_period[$period])
+                               {
+                                       $_delay_period = true;
+                                       $_delay_period_sum += $_sum_oblications;
+                                       $_sum_oblications = 0;
+                               }
+*/
                                //override if periode is closed
                                if(!isset($active_period[$period]) || 
!$active_period[$period])
                                {
-                                       $_delay_period += $_sum_oblications;
                                        $_sum_oblications = 0;
                                }
+
                                //override if periode is closed
                                if(isset($closed_period[$period]) && 
$closed_period[$period])
                                {
                                        $_sum_oblications = 0;
                                }
 
-                               if(isset($active_period[$period]) && 
$active_period[$period] && $_delay_period)
+                               if(isset($active_period[$period]) && 
$active_period[$period] && $_delay_period_sum && !$_delay_period)
                                {
-                                       $_sum_oblications[] += $_delay_period;
-                                       $_delay_period =0;
+                                       $_sum_oblications += $_delay_period_sum;
+                                       $_delay_period_sum =0;
                                }
+                               $_delay_period = false;
 //die();
                                $values[] = array
                                (
@@ -1840,6 +1856,7 @@
                                        'month'                                 
=> $_budget['month'] > 0 ? sprintf("%02s", $_budget['month']) : '',
                                        'period'                                
=> $period,
                                        'budget'                                
=> $_budget['budget'],
+                                       'combined_cost'                 => 
$_budget['combined_cost'],
                                        'sum_orders'                    => 
$_sum_orders,
                                        'sum_oblications'               => 
$_sum_oblications,
                                        'actual_cost'                   => 
$_actual_cost,
@@ -1859,21 +1876,28 @@
                        $budget_acc = 0;
                        foreach ($values as &$entry)
                        {
-                               if($active_period[$entry['period']])
+                       //      if($active_period[$entry['period']])
+                               if($closed_period[$entry['period']])
                                {
                                        $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
                                        $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
+
+                                       $_deviation = $entry['budget'] - 
$entry['actual_cost'];
+       //                              $deviation = abs($entry['actual_cost']) 
> 0 ? $_deviation : 0;
+                                       $deviation = $_deviation;
+
                                }
                                else
                                {
                                        $entry['diff'] =  0;
+                                       $deviation = 0;
                                }
-                               $_deviation = $entry['budget'] - 
$entry['actual_cost'];
-                               $deviation = abs($entry['actual_cost']) > 0 ? 
$_deviation : 0;
+
                                $entry['deviation_period'] = $deviation;
                                $budget_acc +=$entry['budget'];
 
-                               if($active_period[$entry['period']])
+       //                      if($active_period[$entry['period']])
+                               if($closed_period[$entry['period']])
                                {
                                        $deviation_acc += $deviation;
                                }
@@ -2012,65 +2036,9 @@
 
                        
execMethod('property.soXport.update_actual_cost_from_archive',$orders);
 
-                       $config = CreateObject('phpgwapi.config','property');
-                       $config->read_repository();
-                       $tax = 1+(($config->config_data['fm_tax'])/100);
 
-//                     $this->db->query("UPDATE fm_project_budget SET 
order_amount = 0",__LINE__,__FILE__);
-/**
- * FIXME: won't work for periodized order that last several years
- *
- **/
 
-/*
-                       foreach ($orders as $id => $dummy)
-                       {
-                               $this->db->query("SELECT project_id, 
start_date, combined_cost, budget,calculation,contract_sum,addition,ecodimb 
FROM fm_workorder WHERE id = {$id}",__LINE__,__FILE__);
-                               $this->db->next_record();
 
-                               $old_combined_cost      = 
$this->db->f('combined_cost');
-                               $budget                         = 
$this->db->f('budget');
-                               $calculation            = 
$this->db->f('calculation');
-                               $contract_sum           = 
$this->db->f('contract_sum');
-                               $addition                       = 
$this->db->f('addition');
-                               $project_id                     = 
$this->db->f('project_id');
-                               $start_date                     = 
$this->db->f('start_date');
-                               $old_ecodimb            = 
(int)$this->db->f('ecodimb');
-
-                               if ( abs((int)$contract_sum) > 0)
-                               {
-                                       $addition = 1 + ((int)$addition/100);
-                                       $combined_cost = (int)$contract_sum * 
$addition;
-                               }
-                               else if (abs($calculation) > 0)
-                               {
-                                       $combined_cost = $calculation * $tax;
-                               }
-                               else
-                               {
-                                       $combined_cost = (int)$budget;
-                               }
-
-                               if($old_combined_cost != $combined_cost)
-                               {
-                                       
//_debug_array(array($old_combined_cost,$combined_cost));
-                                       $this->db->query("UPDATE fm_workorder 
SET combined_cost = '{$combined_cost}' WHERE id = {$id}",__LINE__,__FILE__);
-                               }
-
-                               $this->db->query("SELECT 
periodization_id,ecodimb FROM fm_project WHERE id = 
{$project_id}",__LINE__,__FILE__);
-                               $this->db->next_record();
-                               $periodization_id       = 
$this->db->f('periodization_id');
-                               $ecodimb                        = 
(int)$this->db->f('ecodimb');
-
-                               if($old_ecodimb != $ecodimb)
-                               {
-                                       $this->db->query("UPDATE fm_workorder 
SET ecodimb = {$ecodimb} WHERE id = {$id}",__LINE__,__FILE__);
-                               }
-
-               //              $this->_update_project_budget($project_id, 
date('Y', $start_date), $periodization_id, $combined_cost);
-                               $this->_update_order_budget($id, date('Y', 
$start_date), $periodization_id, $budget, $contract_sum, $combined_cost);
-                       }
-*/
                        $config = CreateObject('phpgwapi.config','property');
                        $config->read_repository();
 
@@ -2150,8 +2118,14 @@
 
                public function transfer_budget($id, $budget, $year)
                {
-//_debug_array($budget);die();
-                       $this->db->transaction_begin();
+                       if ( $this->db->get_transaction() )
+                       {
+                               $this->global_lock = true;
+                       }
+                       else
+                       {
+                               $this->db->transaction_begin();
+                       }
 
                        $id = (int) $id;
                        $year = (int) $year;
@@ -2173,6 +2147,7 @@
 //~ * For Driftsbestillinger settes Betalt til null, Budsjett settes til 
restforpliktelse (budsjett tidligere trekkes ned med restforpliktelse)
 //~ * For Investeringsbestillinger skal disse ikke se på år
 
+                       phpgwapi_cache::system_clear('property', 
"budget_order_{$id}");
 
                        if($continuous)
                        {
@@ -2211,7 +2186,11 @@
                                if( !abs( $last_budget ) > 0 )
                                {
                                        $this->_update_order_budget($id, $year, 
$periodization_id, 0, 0, 0, 'update', true);
-                                       $this->db->transaction_commit();
+                                       if ( !$this->global_lock )
+                                       {
+                                               $this->db->transaction_commit();
+                                       }
+
                                        return;
 //                                     throw new 
Exception('property_workorder::transfer_budget() - no budget to transfer for 
this investment order: ' . $id);
                                }
@@ -2255,7 +2234,11 @@
                                $this->_update_order_budget($id, $year, 
$periodization_id, $new_budget, $new_budget, $new_budget, $action = 'update', 
true);
                        }
 //die();
-                       $this->db->transaction_commit();
+                       if ( !$this->global_lock )
+                       {
+                               $this->db->transaction_commit();
+                       }
+
                }
 
                /**

Modified: branches/Version-1_0-branch/property/inc/class.uibudget.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uibudget.inc.php     
2013-04-05 13:37:16 UTC (rev 11031)
@@ -188,14 +188,28 @@
                                        $values_combo_box[3][] = $default_value;
                                }
 
-                               $values_combo_box[4] = 
$this->cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => True));
-                               $default_value = array ('cat_id'=>'','name'=> 
lang('no category'));
-                               array_unshift 
($values_combo_box[4]['cat_list'],$default_value);
+                               $cat_filter =  
$this->cats->formatted_xslt_list(array('select_name' => 'cat_id','selected' => 
$this->cat_id,'globals' => True,'link_data' => $link_data));
+                               foreach($cat_filter['cat_list'] as $_cat)
+                               {
+                                       $values_combo_box[4][] = array
+                                       (
+                                               'id' => $_cat['cat_id'],
+                                               'name' => $_cat['name'],
+                                               'selected' => $_cat['selected'] 
? 1 : 0
+                                       );
+                               }
+                               
+                               array_unshift ($values_combo_box[4],array 
('id'=>'', 'name'=>lang('no category')));
 
                                $values_combo_box[5]  = 
$this->bocommon->select_category_list(array('type'=>'dimb'));
+                               foreach($values_combo_box[5] as & $_dimb)
+                               {
+                                       $_dimb['name'] = 
"{$_dimb['id']}-{$_dimb['name']}";
+                               }
                                $default_value = array 
('id'=>'','name'=>lang('no dimb'));
                                array_unshift 
($values_combo_box[5],$default_value);
 
+
                                $datatable['actions']['form'] = array
                                        (
                                                array
@@ -247,21 +261,26 @@
                                                                        
'tab_index' => 4
                                                                ),
                                                                array
-                                                               ( //boton       
GROUPING
-                                                                       'id'    
        => 'btn_cat_id',
-                                                                       'name'  
        => 'cat_id',
-                                                                       'value' 
        => lang('category'),
-                                                                       'type'  
        => 'button',
-                                                                       'style' 
        => 'filter',
+                                                               ( //boton       
USER
+                                                                       //      
'id' => 'btn_user_id',
+                                                                       'id' => 
'sel_cat_id',
+                                                                       'name' 
=> 'cat_id',
+                                                                       'value' 
=> lang('Category'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $values_combo_box[4],
+                                                                       
'onchange'=> 'onChangeSelect("cat_id");',
                                                                        
'tab_index' => 5
                                                                ),
                                                                array
-                                                               ( //boton       
GROUPING
-                                                                       'id'    
        => 'btn_dimb_id',
-                                                                       'name'  
        => 'dimb_id',
-                                                                       'value' 
        => lang('dimb'),
-                                                                       'type'  
        => 'button',
-                                                                       'style' 
        => 'filter',
+                                                               ( 
+                                                                       'id' => 
'sel_dimb_id',
+                                                                       'name' 
=> 'dimb_id',
+                                                                       'value' 
=> lang('dimb'),
+                                                                       'type' 
=> 'select',
+                                                                       'style' 
=> 'filter',
+                                                                       
'values' => $values_combo_box[5],
+                                                                       
'onchange'=> 'onChangeSelect("dimb_id");',
                                                                        
'tab_index' => 6
                                                                ),
                                                                array
@@ -320,6 +339,7 @@
                                                                        'id' => 
'values_combo_box_3',
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[3])
                                                                ),
+/*
                                                                array
                                                                ( //div values  
combo_box_4
                                                                        'id' => 
'values_combo_box_4',
@@ -330,6 +350,7 @@
                                                                        'id' => 
'values_combo_box_5',
                                                                        'value' 
=> $this->bocommon->select2String($values_combo_box[5])
                                                                )
+*/
                                                        )
                                                )
                                        )

Modified: 
branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php   
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php   
2013-04-05 13:37:16 UTC (rev 11031)
@@ -393,7 +393,7 @@
                                array('key' => 
'url','label'=>lang('id'),'sortable'=>true,'resizeable'=>true),
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true,'width' => 
'100'),//width not working...
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
-                               array('key' => 
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
+//                             array('key' => 
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
                                array('key' => 
'condition_degree','label'=>lang('condition 
degree'),'sortable'=>false,'resizeable'=>true),
                                array('key' => 
'score','label'=>lang('score'),'sortable'=>true,'resizeable'=>true),
                                array('key' => 
'amount_investment','label'=>lang('investment'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),

Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2013-04-05 13:37:16 UTC (rev 11031)
@@ -33,6 +33,12 @@
         */
        phpgw::import_class('phpgwapi.yui');
 
+       /**
+       * Import the jQuery class
+       */
+       phpgw::import_class('phpgwapi.jquery');
+
+
        class property_uientity
        {
                var $grants;
@@ -48,19 +54,21 @@
 
                var $public_functions = array
                        (
-                               'columns'               => true,
-                               'download'              => true,
-                               'view'                  => true,
-                               'edit'                  => true,
-                               'delete'                => true,
-                               'view_file'             => true,
-                               'attrib_history'=> true,
-                               'attrib_help'   => true,
-                               'print_pdf'             => true,
-                               'index'                 => true,
-                               'addfiles'              => true,
-                               'get_files'             => true,
-                               'add_inventory' => true
+                               'columns'                       => true,
+                               'download'                      => true,
+                               'view'                          => true,
+                               'edit'                          => true,
+                               'delete'                        => true,
+                               'view_file'                     => true,
+                               'attrib_history'        => true,
+                               'attrib_help'           => true,
+                               'print_pdf'                     => true,
+                               'index'                         => true,
+                               'addfiles'                      => true,
+                               'get_files'                     => true,
+                               'get_inventory'         => true,
+                               'add_inventory'         => true,
+                               'edit_inventory'        => true
                        );
 
                function property_uientity()
@@ -1755,10 +1763,14 @@
                                }
 
                                
phpgwapi_yui::tabview_setup('entity_edit_tabview');
+                               
+                                                               
+                               $active_tab = phpgw::get_var('active_tab');
+                               
                                if($category['location_level'] > 0)
                                {
-                                       $tabs['location']       = array('label' 
=> lang('location'), 'link' => '#location');
-                                       $active_tab = 'location';
+                                       $tabs['location']       = array('label' 
=> lang('location'), 'link' => '#location', 'function' => 
"set_tab('location')");
+                                       $active_tab = $active_tab ? $active_tab 
: 'location';
                                }
 
                                $location = 
".{$this->type}.{$this->entity_id}.{$this->cat_id}";
@@ -1775,7 +1787,7 @@
                                                {
                                                        $_tab_name = 
str_replace(' ', '_', $group['name']);
                                                        $active_tab = 
$active_tab ? $active_tab : $_tab_name;
-                                                       $tabs[$_tab_name] = 
array('label' => $group['name'], 'link' => '#' . $_tab_name);
+                                                       $tabs[$_tab_name] = 
array('label' => $group['name'], 'link' => "#{$_tab_name}", 'function' => 
"set_tab('{$_tab_name}')");
                                                        $group['link'] = 
$_tab_name;
                                                        $attributes[] = $group;
                                                        $i ++;
@@ -1802,7 +1814,7 @@
 
                                if($category['fileupload'] || 
(isset($values['files']) &&  $values['files']))
                                {
-                                       $tabs['files']  = array('label' => 
lang('files'), 'link' => '#files');
+                                       $tabs['files']  = array('label' => 
lang('files'), 'link' => '#files', 'function' => "set_tab('files')");
                                }
 /*
                                if($category['jasperupload'])
@@ -2039,12 +2051,12 @@
 
                                        if($documents)
                                        {
-                                               $tabs['document']       = 
array('label' => lang('document'), 'link' => '#document');
+                                               $tabs['document']       = 
array('label' => lang('document'), 'link' => '#document', 'function' => 
"set_tab('document')");
                                                $documents = 
json_encode($documents);                           
                                        }
                                }
 
-                               $tabs['related']        = array('label' => 
lang('log'), 'link' => '#related');
+                               $tabs['related']        = array('label' => 
lang('log'), 'link' => '#related', 'function' => "set_tab('related')");
                                $_target = array();
                                if(isset($values['target']) && 
$values['target'])
                                {
@@ -2128,7 +2140,7 @@
 
                                if($category['enable_bulk'])
                                {
-                                       $tabs['inventory']      = array('label' 
=> lang('inventory'), 'link' => '#inventory');
+                                       $tabs['inventory']      = array('label' 
=> lang('inventory'), 'link' => '#inventory', 'function' => 
"set_tab('inventory')");
 
                                        $_inventory = $this->get_inventory($id);
 
@@ -2139,7 +2151,7 @@
                                                'total_records'                 
=> count($_inventory),
                                                'edit_action'                   
=> "''",
                                                'is_paginator'                  
=> 1,
-                                               'footer'                        
        => 0
+                                               'footer'                        
        => 1
                                        );
 
        
@@ -2148,11 +2160,16 @@
                                                'name'          => "3",
                                                'values'        =>      
json_encode(array(      
                                                                array('key' => 
'where','label'=>lang('where'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'edit','label'=>lang('edit'),'sortable'=>false,'resizeable'=>true, 'formatter' 
=> 'FormatterEdit'),
+                                                       //      array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterCenter'),
                                                                array('key' => 
'unit','label'=>lang('unit'),'sortable'=>false,'resizeable'=>true),
-                                                               array('key' => 
'inventory','label'=>lang('count'),'sortable'=>false,'resizeable'=>true),
-                                                               array('key' => 
'bookable','label'=>lang('bookable'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'inventory','label'=>lang('count'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterAmount0'),
+                                                               array('key' => 
'bookable','label'=>lang('bookable'),'sortable'=>false,'resizeable'=>true, 
'formatter' => 'FormatterCenter'),
                                                                array('key' => 
'calendar','label'=>lang('calendar'),'sortable'=>false,'resizeable'=>true),
                                                                array('key' => 
'remark','label'=>lang('remark'),'sortable'=>false,'resizeable'=>true),
+                                                               array('key' => 
'location_id','hidden'=>true),
+                                                               array('key' => 
'id','hidden'=>true),
+                                                               array('key' => 
'inventory_id','hidden'=>true),
                                                        )
                                                )
                                        );
@@ -2228,6 +2245,7 @@
                                        'textareacols'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textareacols'] : 40,
                                        'textarearows'                          
        => 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] ? 
$GLOBALS['phpgw_info']['user']['preferences']['property']['textarearows'] : 6,
                                        'tabs'                                  
                => phpgwapi_yui::tabview_generate($tabs, $active_tab),
+                                       'active_tab'                            
        => $active_tab,
                                        'integration'                           
        => $integration,
                                //      'value_integration_src'                 
=> $integration_src,
                                        'base_java_url'                         
        =>      "{menuaction:'property.uientity.get_files',".
@@ -2852,19 +2870,168 @@
 
                public function get_inventory($id = 0)
                {
-                       return $this->bo->get_inventory($id);
+                       if(!$id)
+                       {
+                               $location_id    = phpgw::get_var('location_id', 
'int');
+                               $id                     = phpgw::get_var('id', 
'int');
+                               $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $location = 
explode('.',$system_location['location']);
+                               $this->bo->type = $location[1];
+                               $this->bo->entity_id = $location[1];
+                               $this->bo->cat_id = $location[3];
+                       }
+                       else
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type], 
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
+                       }
+
+                       $inventory =  $this->bo->get_inventory($location_id, 
$id);
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+
+                               if(count($inventory))
+                               {
+                                       return json_encode($inventory);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+                       
+                       return $inventory;
                }
 
+               public function edit_inventory()
+               {
+                       $location_id    = phpgw::get_var('location_id', 'int');
+                       $id                             = phpgw::get_var('id', 
'int');
+                       $inventory_id   = phpgw::get_var('inventory_id', 'int');
+
+                       $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                       $this->acl_add  = 
$this->acl->check($system_location['location'], PHPGW_ACL_ADD, 
$system_location['appname']);
+
+                       if(!$this->acl_add)
+                       {
+                               echo lang('No Access');
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+                       $unit_id = '';
+                       if( $inventory = $this->bo->get_inventory($location_id, 
$id, $inventory_id) )
+                       {
+                               $unit_id        = $inventory[0]['unit_id'];     
                
+                       }
+
+                       $location_code = 
execMethod('property.solocation.get_location_code',$inventory[0]['p_id']);
+
+                       $lock_unit = !!$unit_id;
+
+                       $receipt = array();
+                       $values         = phpgw::get_var('values');
+
+                       $bolocation             = 
CreateObject('property.bolocation');
+                       $values['location_data'] = 
$bolocation->read_single($location_code,array('view' => true));
+
+                       
+                       $values['unit_id'] = $values['unit_id'] ? 
$values['unit_id'] : $unit_id;
+                       
+
+                       if (isset($values['save']) && $values['save'])
+                       {
+                               $values['location_id']  = $location_id;
+                               $values['item_id']              = $id;
+                               $values['inventory_id'] = $inventory_id;
+                               if(!isset($receipt['error']))
+                               {
+                                       $this->bo->edit_inventory($values);
+                                       $receipt['message'][]=array('msg'=> 
'Ok');
+                                       $values = array();                      
                
+                               }
+
+
+                               if( phpgw::get_var('phpgw_return_as') == 'json' 
)
+                               {
+
+                                       if(!$receipt['error'])
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'updated'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'error'
+                                               );
+                                       }
+
+                                       $result['receipt'] = $receipt;
+                                       return $result;
+                               }
+
+                       }
+
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
+                       
+                       $unit_list = execMethod('property.bogeneric.get_list', 
array('type' => 'unit',  'selected' => $unit_id));
+
+                       $location_data = 
execMethod('property.bolocation.initiate_ui_location', array
+                       (
+                               'values'                => 
$values['location_data'],
+                               'type_id'               => 5,
+                               'no_link'               => false,
+                               'lookup_type'   => 'view',
+                               'tenant'                => false,
+                               'lookup_entity' => $lookup_entity,
+                               'entity_data'   => 
isset($values['p'])?$values['p']:''
+                       ));
+                       
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $data = array
+                       (
+                               'msgbox_data'           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'location_data'         => $location_data,
+                               'system_location'       => $system_location,
+                               'location_id'           => $location_id,
+                               'item_id'                       => $id,
+                               'inventory_id'          => $inventory_id,
+                               'unit_list'                     => 
array('options' => $unit_list),
+                               'lock_unit'                     => $lock_unit,
+                               'value_inventory'       => $values['inventory'] 
? $values['inventory'] : $inventory[0]['inventory'],
+                               'value_write_off'       => $values['write_off'],
+                               'bookable'                      => 
$values['bookable'] ? $values['bookable'] : $inventory[0]['bookable'],
+                               'value_active_from'     => 
$values['active_from'] ? $values['active_from'] : 
$GLOBALS['phpgw']->common->show_date($inventory[0]['active_from'],$dateformat ),
+                               'value_active_to'       => $values['active_to'] 
? $values['active_to'] : 
$GLOBALS['phpgw']->common->show_date($inventory[0]['active_to'],$dateformat ),
+                               'value_remark'          => $values['remark'] ? 
$values['remark'] : $inventory[0]['remark'],
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_from');
+                       $GLOBALS['phpgw']->jqcal->add_listener('active_to');
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('entity','attributes_form', 
'files'));
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+                       phpgwapi_jquery::load_widget('core');
+
+                       $GLOBALS['phpgw']->js->validate_file( 'yahoo', 
'entity.edit_inventory', 'property' );
+
+                       $function_msg   = lang('add inventory');
+
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
$system_location['appname'] . '::' . $system_location['descr'] . '::' . 
$function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('edit_inventory' => $data));
+               
+               }
+
                public function add_inventory()
                {
                        $location_id    = phpgw::get_var('location_id', 'int');
-                       $item_id                = phpgw::get_var('id', 'int');
+                       $id                             = phpgw::get_var('id', 
'int');
                        $system_location = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-/*
-_debug_array($location_id);
-_debug_array($item_id);
-_debug_array($system_location);
-*/
+
                        $this->acl_add  = 
$this->acl->check($system_location['location'], PHPGW_ACL_ADD, 
$system_location['appname']);
 
                        if(!$this->acl_add)
@@ -2873,13 +3040,24 @@
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
 
+                       $unit_id = '';
+                       if( $inventory = $this->bo->get_inventory($location_id, 
$id) )
+                       {
+                               $unit_id        = $inventory[0]['unit_id'];     
                
+                       }
+
+                       $lock_unit = !!$unit_id;
+
+                       $receipt = array();
                        $values         = phpgw::get_var('values');
                        
+                       $values['unit_id'] = $values['unit_id'] ? 
$values['unit_id'] : $unit_id;
+                       
 
                        if (isset($values['save']) && $values['save'])
                        {
                                $values['location_id']  = $location_id;
-                               $values['item_id']              = $item_id;
+                               $values['item_id']              = $id;
                                $insert_record                  = 
$GLOBALS['phpgw']->session->appsession('insert_record','property');
 
                                if(is_array($insert_record_entity))
@@ -2897,30 +3075,19 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location !'));
                                }
 
-                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               if(!$values['unit_id'])
                                {
-                                       foreach ($values_attribute as 
$attribute )
-                                       {
-                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
-                                               {
-                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
-                                               }
-
-                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'I' && ! 
ctype_digit($attribute['value']))
-                                               {
-                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));                                              
-                                               }
-                                       }
+                                       
$receipt['error'][]=array('msg'=>lang('Please select a unit !'));
                                }
-
                                if(!isset($receipt['error']))
                                {
-                                       $receipt = 
$this->bo->save_inventory($values);
+                                       $this->bo->add_inventory($values);
+                                       $receipt['message'][]=array('msg'=> 
'Ok');
+                                       $values = array();                      
                
                                }
                        }
 
-
-                       $unit_id        = $values['unit_id'];
+                       $msgbox_data = $this->bocommon->msgbox_data($receipt);
                        
                        $unit_list = execMethod('property.bogeneric.get_list', 
array('type' => 'unit',  'selected' => $unit_id));
 
@@ -2934,15 +3101,16 @@
                                'lookup_entity' => $lookup_entity,
                                'entity_data'   => 
isset($values['p'])?$values['p']:''
                        ));
-                       
+
                        $data = array
                        (
+                               'msgbox_data'           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'location_data'         => $location_data,
                                'system_location'       => $system_location,
                                'location_id'           => $location_id,
-                               'item_id'                       => $item_id,
+                               'item_id'                       => $id,
                                'unit_list'                     => 
array('options' => $unit_list),
-
+                               'lock_unit'                     => $lock_unit,
                                'value_inventory'       => $values['inventory'],
                                'value_write_off'       => $values['write_off'],
                                'bookable'                      => 
$values['bookable'],

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php   
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice2.inc.php   
2013-04-05 13:37:16 UTC (rev 11031)
@@ -132,6 +132,15 @@
 
                        if($values = phpgw::get_var('values'))
                        {
+                               $order = 
execMethod('property.soworkorder.read_single',$values['order_id']);
+                               $project = 
execMethod('property.soproject.read_single', $order['project_id']);
+                               
+                               if($project['closed'])
+                               {
+                                       $receipt['error'][]=true;               
                
+                                       
phpgwapi_cache::message_set(lang('Project is closed'), 'error');
+                               }
+                               
                                $approve = 
execMethod('property.boinvoice.get_approve_role',  $values['dim_b']);
 
                                if(!$approve)

Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -58,17 +58,19 @@
 
                var $public_functions = array
                        (
-                               'download'                              => true,
-                               'index'                                 => true,
-                               'view'                                  => true,
-                               'edit'                                  => true,
-                               'delete'                                => true,
-                               'date_search'                   => true,
-                               'columns'                               => true,
-                               'bulk_update_status'    => true,
-                               'project_group'                 => true,
-                               'view_file'                             => true,
-                               'get_orders'                    => true
+                               'download'                                      
        => true,
+                               'index'                                         
        => true,
+                               'view'                                          
        => true,
+                               'edit'                                          
        => true,
+                               'delete'                                        
        => true,
+                               'date_search'                                   
=> true,
+                               'columns'                                       
        => true,
+                               'bulk_update_status'                    => true,
+                               'project_group'                                 
=> true,
+                               'view_file'                                     
        => true,
+                               'get_orders'                                    
=> true,
+                               'get_vouchers'                                  
=> true,
+                               'check_missing_project_budget'  => true
                        );
 
                function property_uiproject()
@@ -129,11 +131,17 @@
                {
                        $start_date = urldecode(phpgw::get_var('start_date'));
                        $end_date       = urldecode(phpgw::get_var('end_date'));
-                       $list           = $this->bo->read(array('start_date' => 
$start_date, 'end_date' => $end_date, 'allrows' => true, 'skip_origin' => 
true));
+                       $values         = $this->bo->read(array('start_date' => 
$start_date, 'end_date' => $end_date, 'allrows' => true, 'skip_origin' => 
true));
                        $uicols         = $this->bo->uicols;
-                       
$this->bocommon->download($list,$uicols['name'],$uicols['descr'],$uicols['input_type']);
+                       
$this->bocommon->download($values,$uicols['name'],$uicols['descr'],$uicols['input_type']);
                }
 
+               function check_missing_project_budget()
+               {
+                       $values         = 
$this->bo->get_missing_project_budget();
+                       $this->bocommon->download( $values, array('project_id', 
'year'), array(lang('project'), lang('year')) );
+               }
+
                function view_file()
                {
                        if(!$this->acl_read)
@@ -1945,40 +1953,13 @@
 
 
                        $invoices = array();
+                       $content_invoice = array();
+
                        if ($id)
                        {
-                               $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' => 
$id));
-                               $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' => 
$id, 'paid' => true));
-                               $invoices = 
array_merge($active_invoices,$historical_invoices);
+                               $content_invoice = $this->get_vouchers($id, 
date('Y'));
                        }
 
-                       $content_invoice = array();
-                       foreach($invoices as $entry)
-                       {
-                               $content_invoice[] = array
-                               (
-                                       'voucher_id'                    => 
$entry['transfer_time'] ? -1*$entry['voucher_id'] : $entry['voucher_id'],
-                                       'voucher_out_id'                => 
$entry['voucher_out_id'],
-                                       'workorder_id'                  => 
$entry['workorder_id'],
-                                       'status'                                
=> $entry['status'],
-                                       'period'                                
=> $entry['period'],
-                                       'invoice_id'                    => 
$entry['invoice_id'],
-                                       'budget_account'                => 
$entry['budget_account'],
-                                       'dima'                                  
=> $entry['dima'],
-                                       'dimb'                                  
=> $entry['dimb'],
-                                       'dimd'                                  
=> $entry['dimd'],
-                                       'type'                                  
=> $entry['type'],
-                                       'amount'                                
=> $entry['amount'],
-                                       'approved_amount'               => 
$entry['approved_amount'],
-                                       'vendor'                                
=> $entry['vendor'],
-                                       'project_group'                 => 
$entry['project_id'],
-                                       'currency'                              
=> $entry['currency'],
-                                       'budget_responsible'    => 
$entry['budget_responsible'],
-                                       'budsjettsigndato'              => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
 : '',
-                                       'transfer_time'                 => 
$entry['transfer_time'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
 : '',
-                               );
-                       }
-
                        $datavalues[2] = array
                                (
                                        'name'                                  
=> "2",
@@ -1998,18 +1979,18 @@
                                (
                                        'name'          => "2",
                                        'values'        =>      
json_encode(array(      array('key' => 
'workorder_id','label'=>lang('Workorder'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.widget.DataTable.formatLink'),
-                                                                               
                                array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>false,'resizeable'=>true,'formatter'=>$_formatter_voucher_link),
+                                                                               
                                array('key' => 
'voucher_id','label'=>lang('bilagsnr'),'sortable'=>true,'resizeable'=>true,'formatter'=>$_formatter_voucher_link),
                                                                                
                                array('key' => 'voucher_out_id','hidden'=>true),
                                                                                
                                array('key' => 
'invoice_id','label'=>lang('invoice 
number'),'sortable'=>false,'resizeable'=>true),
                                                                                
                                array('key' => 
'vendor','label'=>lang('vendor'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'amount','label'=>lang('amount'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'approved_amount','label'=>lang('approved 
amount'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterRight'),
-                                                                               
                                array('key' => 
'period','label'=>lang('period'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'approved_amount','label'=>lang('approved 
amount'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'period','label'=>lang('period'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                array('key' => 
'currency','label'=>lang('currency'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'type','label'=>lang('type'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'budget_responsible','label'=>lang('budget 
responsible'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>false,'resizeable'=>true),
-                                                                               
                                array('key' => 
'transfer_time','label'=>lang('transfer 
time'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget_responsible','label'=>lang('budget 
responsible'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budsjettsigndato','label'=>lang('budsjettsigndato'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'transfer_time','label'=>lang('transfer 
time'),'sortable'=>true,'resizeable'=>true),
                                                                                
                                ))
 
                                );
@@ -2388,6 +2369,62 @@
                        return $content;
                }
 
+               public function get_vouchers($project_id = 0, $year = 0)
+               {
+                       if(!$project_id)
+                       {
+                               $project_id = phpgw::get_var('project_id', 
'int');
+                       }
+                       if(!$year)
+                       {
+                               $year = phpgw::get_var('year', 'int');
+                       }
+
+                       $active_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' => 
$project_id, 'year' => $year));
+                       $historical_invoices = 
execMethod('property.soinvoice.read_invoice_sub_sum', array('project_id' => 
$project_id, 'year' => $year, 'paid' => true));
+                       $invoices = 
array_merge($active_invoices,$historical_invoices);
+
+                       foreach($invoices as $entry)
+                       {
+                               $content[] = array
+                               (
+                                       'voucher_id'                    => 
$entry['transfer_time'] ? -1*$entry['voucher_id'] : $entry['voucher_id'],
+                                       'voucher_out_id'                => 
$entry['voucher_out_id'],
+                                       'workorder_id'                  => 
$entry['workorder_id'],
+                                       'status'                                
=> $entry['status'],
+                                       'period'                                
=> $entry['period'],
+                                       'invoice_id'                    => 
$entry['invoice_id'],
+                                       'budget_account'                => 
$entry['budget_account'],
+                                       'dima'                                  
=> $entry['dima'],
+                                       'dimb'                                  
=> $entry['dimb'],
+                                       'dimd'                                  
=> $entry['dimd'],
+                                       'type'                                  
=> $entry['type'],
+                                       'amount'                                
=> $entry['amount'],
+                                       'approved_amount'               => 
$entry['approved_amount'],
+                                       'vendor'                                
=> $entry['vendor'],
+                                       'project_group'                 => 
$entry['project_id'],
+                                       'currency'                              
=> $entry['currency'],
+                                       'budget_responsible'    => 
$entry['budget_responsible'],
+                                       'budsjettsigndato'              => 
$entry['budsjettsigndato'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['budsjettsigndato']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
 : '',
+                                       'transfer_time'                 => 
$entry['transfer_time'] ? 
$GLOBALS['phpgw']->common->show_date(strtotime($entry['transfer_time']),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'])
 : '',
+                               );
+                       }
+
+                       if( phpgw::get_var('phpgw_return_as') == 'json' )
+                       {
+
+                               if(count($content))
+                               {
+                                       return json_encode($content);
+                               }
+                               else
+                               {
+                                       return "";
+                               }
+                       }
+                       return $content;
+               }
+
                function delete()
                {
                        if(!$this->acl_delete)

Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -57,7 +57,8 @@
                                'priority_key'  => true,
                                'view_file'             => true,
                                'download'              => true,
-                               'columns'               => true
+                               'columns'               => true,
+                               'get_related'   => true
                        );
 
                function property_uirequest()
@@ -1548,11 +1549,13 @@
 
                        $msgbox_data = $this->bocommon->msgbox_data($receipt);
 
+                       $related = $this->get_related($id);
+
                        $datavalues[2] = array
                                (
                                        'name'                                  
=> "2",
-                                       'values'                                
=> json_encode($values['planning']),
-                                       'total_records'                 => 
count($values['planning']),
+                                       'values'                                
=> json_encode($related),
+                                       'total_records'                 => 
count($related),
                                        'edit_action'                   => "''",
                                        'is_paginator'                  => 0,
                                        'footer'                                
=> 0
@@ -1563,32 +1566,15 @@
                        $myColumnDefs[2] = array
                                (
                                        'name'          => "2",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter' => FormatterRight),
-                                                                               
                                array('key' => 
'date','label'=>lang('date'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
+                                       'values'        =>      
json_encode(array(      array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>false),
+                                                                               
                                array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'start_date','label'=>lang('start date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 'end_date','label'=>lang('end 
date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>false)))
                                );
 
-                       $datavalues[3] = array
-                               (
-                                       'name'                                  
=> "3",
-                                       'values'                                
=> json_encode($values['consume']),
-                                       'total_records'                 => 
count($values['consume']),
-                                       'edit_action'                   => "''",
-                                       'is_paginator'                  => 0,
-                                       'footer'                                
=> 0
-                               );
-
-
-
-                       $myColumnDefs[3] = array
-                               (
-                                       'name'          => "3",
-                                       'values'        =>      
json_encode(array(      array('key' => 
'amount','label'=>lang('amount'),'sortable'=>true,'resizeable'=>true, 
'formatter' => FormatterRight),
-                                                                               
                                array('key' => 
'date','label'=>lang('date'),'sortable'=>true,'resizeable'=>true),
-                                                                               
                                array('key' => 
'delete','label'=>lang('delete'),'sortable'=>false,'resizeable'=>false)))
-                               );
-
-
                        if (isset($values['attributes']) && 
is_array($values['attributes']))
                        {
                                foreach ($values['attributes'] as & $attribute)
@@ -1739,7 +1725,8 @@
 
                                        'cat_select'                            
                => $this->cats->formatted_xslt_list(array('select_name' => 
'values[cat_id]','selected' => $values['cat_id'])),
 
-                                       'lang_coordinator'                      
                => lang('Coordinator'),
+                                       'lang_coordinator'                      
                => 
isset($this->config->config_data['lang_request_coordinator']) && 
$this->config->config_data['lang_request_coordinator'] ? 
$this->config->config_data['lang_request_coordinator'] : lang('coordinator'),
+
                                        'lang_user_statustext'                  
        => lang('Select the coordinator the request belongs to. To do not use a 
category select NO USER'),
                                        'select_user_name'                      
                => 'values[coordinator]',
                                        'lang_no_user'                          
                => lang('Select coordinator'),
@@ -1858,6 +1845,100 @@
                        $this->edit($mode = 'view');
                }
 
+
+               function get_related($id)
+               {
+                       if( !$this->acl_read)
+                       {
+                               return array();
+                       }
+               
+                       $interlink      = CreateObject('property.interlink');
+                       $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
+
+                       $values = array();
+                       if($target)
+                       {
+                               foreach($target as $_target_section)
+                               {
+
+                                       foreach ($_target_section['data'] as 
$_target_entry)
+                                       {
+                                               
switch($_target_section['location'])
+                                               {
+                                                       case '.ticket':
+                                                               $ticket         
= execMethod('property.sotts.read_single',(int)$_target_entry['id']);
+                                                               $budget         
= $ticket['budget'];
+                                                               $start_date = 
$GLOBALS['phpgw']->common->show_date($ticket['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                                                               break;
+                                                       case '.project':
+                                                               $project        
= execMethod('property.soproject.read_single',(int)$_target_entry['id']);
+                                                               $budget         
= $project['budget'];
+                                                               $start_date = 
$GLOBALS['phpgw']->common->show_date($project['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                                                               $end_date = 
$GLOBALS['phpgw']->common->show_date($project['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                                                               break;
+                                                       case 
'.project.workorder':
+                                                               $workorder      
= execMethod('property.soworkorder.read_single',(int)$_target_entry['id']);
+                                                               $budget         
= $workorder['budget'];
+                                                               $start_date = 
$GLOBALS['phpgw']->common->show_date($workorder['start_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                                                               $end_date = 
$GLOBALS['phpgw']->common->show_date($workorder['end_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+                                                               break;
+                                                       default:
+                                                       // nothing
+                                               }
+
+                                               $values[] = array
+                                               (
+                                                       'id'                    
=> "<a href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
+                                                       'type'                  
=> ucfirst($_target_section['descr']),
+                                                       'title'                 
=> $_target_entry['title'],
+                                                       'status'                
=> $_target_entry['statustext'],
+                                                       'budget'                
=> $budget,
+                                                       'start_date'    => 
$start_date,
+                                                       'end_date'              
=> $end_date,
+                                               );
+                                       }
+                               }
+                       }
+
+//_debug_Array($values);die();
+
+/*
+                                       'values'        =>      
json_encode(array(      array('key' => 
'id','label'=>lang('id'),'sortable'=>true,'resizeable'=>false, 'formatter' => 
FormatterRight),
+                                                                               
                                array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'start_date','label'=>lang('start date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 'end_date','label'=>lang('end 
date'),'sortable'=>true,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>false)))
+
+*/
+
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
+
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+//------ End pagination
+
+                       return $out;
+               }
+
+
+
                protected function _generate_tabs()
                {
                        $tabs = array

Modified: branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2013-04-05 13:37:16 UTC (rev 11031)
@@ -1843,6 +1843,20 @@
                        $lang_close = lang('Check to close period');
                        $lang_active = lang('Check to activate period');
 
+                       $rows_per_page = 10;
+                       $initial_page = 1;
+
+                       if($content_budget && $project['periodization_id'])
+                       {
+                               $_year_count = array();
+                               foreach ($content_budget as $key => $row)
+                               {
+                                       $_year_count[$row['year']]  +=1;
+                                       $rows_per_page = 
$_year_count[$row['year']];
+                               }
+                               $initial_page = 
floor(count($content_budget)/$rows_per_page);
+                       }
+
                        foreach($content_budget as & $b_entry)
                        {
                                $checked = $b_entry['active'] ? 
'checked="checked"' : '';
@@ -1864,6 +1878,8 @@
                                        'total_records'                 => 
count($content_budget),
                                        'edit_action'                   => "''",
                                        'is_paginator'                  => 1,
+                                       'rows_per_page'                 => 
$rows_per_page,
+                                       'initial_page'                  => 
$initial_page,
                                        'footer'                                
=> 0
                                );
 

Modified: branches/Version-1_0-branch/property/inc/soap_client/braarkiv/soap.php
===================================================================
--- branches/Version-1_0-branch/property/inc/soap_client/braarkiv/soap.php      
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/inc/soap_client/braarkiv/soap.php      
2013-04-05 13:37:16 UTC (rev 11031)
@@ -43,6 +43,8 @@
                'noapi'                                         => true         
// this stops header.inc.php to include phpgwapi/inc/function.inc.php
        );
 
+       $GLOBALS['phpgw_info']['flags']['session_name'] = 'soapclientsession';
+
        /**
        * Include phpgroupware header
        */

Modified: branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js        
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js        
2013-04-05 13:37:16 UTC (rev 11031)
@@ -27,8 +27,10 @@
 
        $("#order_time_span").change(function(){
                var oArgs = {menuaction:'property.uiproject.get_orders', 
project_id:project_id, year:$(this).val()};
-               var requestUrl = phpGWLink('index.php', oArgs, true);
+//             var requestUrl = phpGWLink('index.php', oArgs, true);
                execute_async(myDataTable_1, oArgs);
+               oArgs = {menuaction:'property.uiproject.get_vouchers', 
project_id:project_id, year:$(this).val()};
+               execute_async(myDataTable_2, oArgs);
        });
 });
 

Modified: branches/Version-1_0-branch/property/js/yahoo/budget.index.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/budget.index.js       
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/js/yahoo/budget.index.js       
2013-04-05 13:37:16 UTC (rev 11031)
@@ -8,9 +8,9 @@
                {order:0, var_URL:'year',                       
name:'btn_year',                        style:'',dependiente:[1,3]},
                {order:1, var_URL:'revision',           name:'btn_revision',    
        style:'',dependiente:[]},
                {order:2, var_URL:'district_id',        name:'btn_district_id', 
        style:'',dependiente:[]},
-               {order:3, var_URL:'grouping',           name:'btn_grouping',    
        style:'',dependiente:[]},
-               {order:4, var_URL:'cat_id',                     
name:'btn_cat_id',                      style:'',dependiente:[]},
-               {order:5, var_URL:'dimb_id',            name:'btn_dimb_id',     
                style:'',dependiente:[]}
+               {order:3, var_URL:'grouping',           name:'btn_grouping',    
        style:'',dependiente:[]}
+//             {order:4, var_URL:'cat_id',                     
name:'btn_cat_id',                      style:'',dependiente:[]},
+//             {order:5, var_URL:'dimb_id',            name:'btn_dimb_id',     
                style:'',dependiente:[]}
                ]
 
                // define buttons
@@ -40,6 +40,22 @@
                }
 
                var tableYUI;
+
+               this.onChangeSelect = function(type)
+               {
+                       var myselect=document.getElementById("sel_"+ type);
+                       for (var i=0; i<myselect.options.length; i++)
+                       {
+                               if (myselect.options[i].selected==true)
+                               {
+                                       break;
+                               }
+                       }
+                       eval("path_values." +type 
+"='"+myselect.options[i].value+"'");
+                       execute_ds();
+               }
+
+
        
/********************************************************************************/
                var myFormatDate = function(elCell, oRecord, oColumn, oData)
                {

Modified: branches/Version-1_0-branch/property/js/yahoo/entity.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.edit.js        
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.edit.js        
2013-04-05 13:37:16 UTC (rev 11031)
@@ -1,7 +1,8 @@
 var  myDataSource, myDataTable, myContextMenu;
 var  myPaginator_0, myDataTable_0
 var  myPaginator_1, myDataTable_1;
-
+var  myPaginator_2, myDataTable_2;
+var  myPaginator_3, myDataTable_3;
 
/********************************************************************************/
 var FormatterCenter = function(elCell, oRecord, oColumn, oData)
 {
@@ -12,8 +13,58 @@
 
        this.myParticularRenderEvent = function()
        {
+               this.addFooterDatatable3(myPaginator_3,myDataTable_3);
        }
 
+       var FormatterEdit = function(elCell, oRecord, oColumn, oData)
+       {
+               var location_id = oRecord.getData('location_id');
+               var id = oRecord.getData('id');
+               var inventory_id = oRecord.getData('inventory_id');
+               elCell.innerHTML = "<a 
href=\"javascript:showlightbox_edit_inventory(" + location_id + ',' + id + ',' 
+ inventory_id + ')">' + 'Editer' + "</a>";
+       }       
+
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+
+       var FormatterAmount0 = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+
+       this.addFooterDatatable3 = function(paginator,datatable)
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum1 = getTotalSum('inventory',0,paginator,datatable);
+
+               if(typeof(tableYUI)=='undefined')
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[3].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+               }
+               else
+               {
+                       tableYUI.deleteTFoot();
+               }
+
+               //Create ROW
+               newTR = document.createElement('tr');
+
+               td_sum('Sum');
+               td_empty(2);
+               td_sum(tmp_sum1);
+               td_empty(5);
+
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+
+
        this.fileuploader = function()
        {
                var sUrl = phpGWLink('index.php', fileuploader_action);
@@ -40,14 +91,32 @@
                var oArgs = {menuaction:'property.uientity.add_inventory', 
location_id:location_id, id: id};
                var sUrl = phpGWLink('index.php', oArgs);
 
-               TINY.box.show({iframe:sUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true,
-               close: true
-       //      closejs:function(){closeJS_local()}
+               TINY.box.show({iframe:sUrl, 
boxid:'frameless',width:750,height:550,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true,
+               close: true,
+               closejs:function(){refresh_inventory(location_id, id)}
                });
        }
 
+       this.showlightbox_edit_inventory = function(location_id, id, 
inventory_id)
+       {
+               var oArgs = {menuaction:'property.uientity.edit_inventory', 
location_id:location_id, id: id, inventory_id: inventory_id};
+               var sUrl = phpGWLink('index.php', oArgs);
 
+               TINY.box.show({iframe:sUrl, 
boxid:'frameless',width:750,height:550,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true,
+               close: true,
+               closejs:function(){refresh_inventory(location_id, id)}
+               });
+       }
 
+       this.refresh_inventory = function(location_id, id)
+       {
+               var oArgs = {menuaction:'property.uientity.get_inventory', 
location_id:location_id, id: id};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+//alert(requestUrl);
+               execute_async(myDataTable_3, oArgs);
+       }
+
+
 YAHOO.util.Event.addListener(window, "load", function()
                {
                        var loader = new YAHOO.util.YUILoader();
@@ -138,3 +207,95 @@
        
 })();
 
+
+// jquery
+$(document).ready(function(){
+
+       $("#edit_inventory").live("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)
+                               {
+                                       if(data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                               var obj = data;
+                       
+                               var submitBnt = 
$(thisForm).find("input[type='submit']");
+                               if(obj.status == "updated")
+                               {
+                                       $(submitBnt).val("Lagret");
+                                       }
+                                       else
+                                       {
+                                       $(submitBnt).val("Feil ved lagring");   
                                
+                                       }
+                                                
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                               }, 1000);
+
+                                       var ok = true;
+                                       var htmlString = "";
+                                       if(data['receipt'] != null)
+                                       {
+                                               if(data['receipt']['error'] != 
null)
+                                               {
+                                                       ok = false;
+                                                       for ( var i = 0; i < 
data['receipt']['error'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"error\">";
+                                                               htmlString += 
data['receipt']['error'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               
if(typeof(data['receipt']['message']) != 'undefined')
+                                               {
+                                                       for ( var i = 0; i < 
data['receipt']['message'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"msg_good\">";
+                                                               htmlString += 
data['receipt']['message'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               $("#receipt").html(htmlString);
+                                       }
+                                       
+                                       if(ok)
+                                       {
+                                               parent.closeJS_remote();
+                                       //      parent.hide_popupBox();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("#workorder_cancel").live("submit", function(e){
+               if($("#lean").val() == 0)
+               {
+                       return;
+               }
+               e.preventDefault();
+               parent.closeJS_remote();
+//             parent.hide_popupBox();
+       });
+
+});
+
+

Copied: branches/Version-1_0-branch/property/js/yahoo/entity.edit_inventory.js 
(from rev 11030, trunk/property/js/yahoo/entity.edit_inventory.js)
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.edit_inventory.js      
                        (rev 0)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.edit_inventory.js      
2013-04-05 13:37:16 UTC (rev 11031)
@@ -0,0 +1,90 @@
+// jquery
+$(document).ready(function(){
+
+       $("#edit_inventory").live("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)
+                               {
+                                       if(data.sessionExpired)
+                                       {
+                                               alert('Sesjonen er utløpt - du 
må logge inn på nytt');
+                                               return;
+                                       }
+
+                               var obj = data;
+                       
+                               var submitBnt = 
$(thisForm).find("input[type='submit']");
+                               if(obj.status == "updated")
+                               {
+                                       $(submitBnt).val("Lagret");
+                                       }
+                                       else
+                                       {
+                                       $(submitBnt).val("Feil ved lagring");   
                                
+                                       }
+                                                
+                               // Changes text on save button back to original
+                               window.setTimeout(function() {
+                                               $(submitBnt).val('Lagre');
+                                               
$(submitBnt).addClass("not_active");
+                               }, 1000);
+
+                                       var ok = true;
+                                       var htmlString = "";
+                                       if(data['receipt'] != null)
+                                       {
+                                               if(data['receipt']['error'] != 
null)
+                                               {
+                                                       ok = false;
+                                                       for ( var i = 0; i < 
data['receipt']['error'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"error\">";
+                                                               htmlString += 
data['receipt']['error'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               
if(typeof(data['receipt']['message']) != 'undefined')
+                                               {
+                                                       for ( var i = 0; i < 
data['receipt']['message'].length; ++i )
+                                                       {
+                                                               htmlString += 
"<div class=\"msg_good\">";
+                                                               htmlString += 
data['receipt']['message'][i]['msg'];
+                                                               htmlString += 
'</div>';
+                                                       }
+                                       
+                                               }
+                                               $("#receipt").html(htmlString);
+                                       }
+                                       
+                                       if(ok)
+                                       {
+                                               parent.TINY.box.hide();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("#workorder_cancel").live("submit", function(e){
+               if($("#lean").val() == 0)
+               {
+                       return;
+               }
+               e.preventDefault();
+               parent.closeJS_remote();
+//             parent.hide_popupBox();
+       });
+
+});
+
+

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2013-04-05 
13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2013-04-05 
13:37:16 UTC (rev 11031)
@@ -79,7 +79,7 @@
 add a project  property        no      leg til prosjekt
 add a property property        no      legg til eiendom
 add a rental agreement property        no      Legg til en utleieavtale
-add a request  property        no      legg til anmodning
+add a request  property        no      legg til behov
 add a service agreement        property        no      Legg til en service 
avtale
 add a standard property        no      legg til standard
 add a template property        no      legg til mal
@@ -309,7 +309,7 @@
 choose columns common  no      Velg kolonner
 choose copy hour to copy this hour to a new hour       property        no      
Kryss av for å kopiere denne posten til en ny post
 choose copy project to copy this project to a new project      property        
no      Kryss av for å kopiere dette prosjektet til et nytt prosjekt
-choose copy request to copy this request to a new request      property        
no      Kryss av for å kopiere denne anmodningen til en ny anmodning
+choose copy request to copy this request to a new request      property        
no      Kryss av for å kopiere dette behovet til et nytt behov
 choose copy workorder to copy this workorder to a new workorder        
property        no      Kryss av for å kopiere denne bestillingen til en ny 
bestilling
 choose generate id to automaticly assign new id based on type-prefix   
property        no      Kryss av for generere ny ID basert på type-prefiks
 choose the end date for the next period        property        no      Velg 
slutt-dato for neste periode
@@ -337,7 +337,7 @@
 click this link to select vendor       property        no      klikk her for å 
velge leverandør
 click this link to view the remark     property        no      klikk her for å 
vise merknad
 click this to add an order to an existing project      property        no      
klikk her for å legge til en ny bestilling til et eksisterende prosjekt
-click this to generate a request with this information property        no      
klikk her for å generere en anmodning med basis denne informasjonen
+click this to generate a request with this information property        no      
klikk her for å generere et behov med basis i denne informasjonen
 click this to generate a project with this information property        no      
klikk her for å lage ett nytt prosjekt med informasjon fra denne saken
 click to view file     property        no      Klikk for vise fil
 close  property        no      Avslutt
@@ -404,7 +404,7 @@
 coordinator changed    property        no      endret koordinator
 copy hour ?    property        no      kopier post ?
 copy project ? property        no      kopier prosjekt ?
-copy request ? property        no      kopier anmodning ?
+copy request ? property        no      kopier behov ?
 copy workorder ?       property        no      Kopier bestilling ?
 correct error  property        no      Rett opp feil
 cost   property        no      kostnad
@@ -474,7 +474,7 @@
 delete prize-index     property        no      slett pris-indeks
 delete project property        no      slett prosjekt
 delete property        property        no      slett eiendom
-delete request property        no      slett anmodning
+delete request property        no      slett behov
 delete template        property        no      slett mal
 delete the actor       property        no      Slett aktør
 delete the agreement   property        no      Slett avtale
@@ -515,7 +515,7 @@
 delete this hour       property        no      slett post
 delete this item       property        no      Slett denne posten
 delete this project    property        no      slett prosjekt
-delete this request    property        no      slett anmodning
+delete this request    property        no      slett behov
 delete this value from the list of multiple choice     property        no      
Slett denne verdien fra listen over fler-valg
 delete this vendor from this activity  property        no      slett denne 
leverandøren fra denne aktiviteten
 delete this workorder  property        no      slett bestilling
@@ -611,10 +611,10 @@
 edit period    property        no      rette periode
 edit pricing   property        no      rette prising
 edit priority key      property        no      rette prioriterings nøkkel
-edit project   property        no      rette prosjekt
-edit property  property        no      rette eiendom
-edit request   property        no      rette anmodning
-edit standard  property        no      rette standard
+edit project   property        no      editer prosjekt
+edit property  property        no      editer eiendom
+edit request   property        no      editer behov
+edit standard  property        no      editer standard
 edit status    property        no      Endre status
 edit template  property        no      rette mal
 edit the account       property        no      Endre kontoen
@@ -643,7 +643,7 @@
 edit the project       property        no      rette prosjekt
 edit the property      property        no      rette eiendom
 edit the r_agreement   property        no      Rette utleieavtalen
-edit the request       property        no      rette anmodning
+edit the request       property        no      endre behov
 edit the s_agreement   property        no      Rette serviceavtalen
 edit the standard      property        no      rette standard
 edit the template      property        no      rette mal
@@ -652,8 +652,8 @@
 edit this entity       property        no      Endre entiteten
 edit this entry        property        no      rette post
 edit this entry equipment      property        no      rett utstyr
-edit this entry project        property        no      rette prosjekt
-edit this entry request        property        no      rett anmodning
+edit this entry project        property        no      endre prosjekt
+edit this entry request        property        no      endre behov
 edit this entry workorder      property        no      rett bestilling
 edit this meter        property        no      rett måler
 edit workorder property        no      Endre bestilling
@@ -848,7 +848,7 @@
 generic        property        no      Generelt
 general address        property        no      Generell adresse
 general info   property        no      generell informasjon
-generate a project from this request   property        no      generer et 
prosjekt basert på denne anmodningen
+generate a project from this request   property        no      generer et 
prosjekt basert på dette behovet
 generate id ?  property        no      generer ID
 generate order property        no      Lag bestilling
 generate project       property        no      Lag nytt prosjekt
@@ -1016,7 +1016,7 @@
 list pricebook per vendor      property        no      List prisbok pr 
leverandør
 list project   property        no      List Prosjekt
 list property  property        no      List eiendom
-list request   property        no      List Anmodning
+list request   property        no      List Behov
 list standard description      property        no      List standard 
beskrivelse
 list status    property        no      List status
 list street    property        no      List gate
@@ -1251,7 +1251,7 @@
 Please - enter a invoice number        property        no      Angi FakturaNr
 please enter a project name !  property        no      Angi prosjekt navn
 please enter a property id !   property        no      Angi eiendoms ID
-please enter a request title ! property        no      Angi tittel for 
anmodning
+please enter a request title ! property        no      Angi tittel for Behov
 please enter a sql query !     property        no      Angi en sql-spørring
 please enter a value for either material cost, labour cost or both !   
property        no      angi enten material kostnader, arbeidskostnader eller 
begge
 please enter a workorder title !       property        no      Angi en 
bestillings tittel
@@ -1302,7 +1302,7 @@
 popup calendar property        no      Kalender
 post   property        no      post
 power meter    property        no      Strømmåler
-potential grants       property        no      Potensiell offentlig støtte
+potential grants       property        no      Pos.Off.St
 precision      property        no      Presisjon
 prefix property        no      prefiks
 preview html   property        no      Forhåndsvis som HTML
@@ -1330,6 +1330,7 @@
 project group  property        no      Agresso prosjekt
 project id     property        no      Prosjekt ID
 project info   property        no      Prosjekt info.
+Project is closed      property        no      Prosjektet er avsluttet.
 project name   property        no      Prosjekt navn
 .project.request       property        no      Behov
 project start date     property        no      prosjekt startdato
@@ -1371,21 +1372,22 @@
 repeat type    property        no      type serie
 repeat day     property        no      gjenta dag
 request        property        no      Behov
+set the status of the request  property        no      Sett status for Behovet
 reset approval property        no      Nullstill
 project.request        property        no      Behov
 request attributes     property        no      Behov::attributter
 request an email receipt       property        no      Be om kvittering
 request a confirmation email when your email is opened by the recipient        
property        no      Be om epost som kvittering når mottaker åpner eposten.
-request %1 has been edited     property        no      anmodning %1 er oppdater
-request %1 has been saved      property        no      anmodning %1 er lagret
+request %1 has been edited     property        no      Behov %1 er oppdatert
+request %1 has been saved      property        no      Behov %1 er lagret
 request budget property        no      Budsjett for tiltak
 request condition type property        no      Behov::konsekvenstype
 request descr  property        no      Beskrivelse av tiltak
-request end date       property        no      anmodning frist
+request end date       property        no      Behov frist
 request entry date     property        no      Registreringsdato for tiltak
-request id     property        no      Anmodnings ID
-request start date     property        no      anmodning startdato
-request status property        no      Behov::status
+request id     property        no      Behov ID
+request start date     property        no      Behov startdato
+request status property        no      Status Behov
 request title  property        no      Tiltak tittel
 request description    property        no      Tilstandbeskrivelse
 requirement    property        no      Behov/pålegg
@@ -1440,7 +1442,7 @@
 save the project       property        no      lagre prosjekt
 save the property      property        no      lagre eiendom
 save the rental agreement and return back to the list  property        no      
Lagre utleieavtale og returner til oversikten
-save the request       property        no      lagre anmodning
+save the request       property        no      lagre Behov
 save the service agreement and return back to the list property        no      
Lagre serviceavtale og returner til oversikten
 save the standard      property        no      lagre standard
 save the status        property        no      Lagre status
@@ -1524,7 +1526,7 @@
 select the appropriate propability for worsening of the condition      
property        no      velg sannsynlighet for forverring
 select the appropriate tax code        property        no      velg mva-kode
 select the branches for this project   property        no      velg fag for 
dette prosjektet
-select the branches for this request   property        no      velg fag for 
denne anmodningen
+select the branches for this request   property        no      velg fag for 
dette behovet
 select the branch for this activity.   property        no      velg fag for 
denne aktiviteten
 select the branch for this document    property        no      velg fag for 
dette dokumentet
 select the budget responsible  property        no      Velg anviser
@@ -1548,7 +1550,7 @@
 select the category the project belongs to. to do not use a category select no 
category        property        no      velg kategori prosjekt tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
 select the category the property belongs to. to do not use a category select 
no category       property        no      velg kategori eiendom tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
 select the category the r_agreement belongs to. to do not use a category 
select no category    property        no      Velg kategorien denne 
utleieavtalen tilhører
-select the category the request belongs to. to do not use a category select no 
category        property        no      velg kategori anmodning tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
+select the category the request belongs to. to do not use a category select no 
category        property        no      velg kategori behovet tilhører. For 
ikke å bruke kategori velg KATEGORI IKKE VALGT
 select the category the s_agreement belongs to. to do not use a category 
select no category    property        no      Velg kategorien denne 
serviceavtalen tilhører
 select the category the ticket belongs to. to do not use a category select no 
category property        no      velg kategori melding tilhører. For ikke å 
bruke kategori velg KATEGORI IKKE VALGT
 select the category the workorder belongs to. to do not use a category select 
no category      property        no      velg kategori bestillingen tilhører. 
For ikke å bruke kategori velg KATEGORI IKKE VALGT
@@ -1556,7 +1558,7 @@
 select the chapter (for tender) for this activity.     property        no      
velg tilbudskapittel for denne posten
 select the coordinator the document belongs to. to do not use a category 
select no user        property        no      velg koordinator dokument 
tilhører. For ikke å bruke koordinator velg BRUKER IKKE VALG
 select the coordinator the project belongs to. to do not use a category select 
no user property        no      velg koordinator prosjekt tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
-select the coordinator the request belongs to. to do not use a category select 
no user property        no      velg koordinator anmodning tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
+select the coordinator the request belongs to. to do not use a category select 
no user property        no      velg koordinator behovet tilhører. For ikke å 
bruke koordinator velg BRUKER IKKE VALG
 select the customer by clicking this link      property        no      Velg 
kunde
 select the date for the first value    property        no      angi dato for 
første verdi
 select the date for the update property        no      angi dato for 
oppdatering
@@ -1569,7 +1571,7 @@
 select the estimated date for closing the task property        no      Velg 
beregnet dato for lukking av oppgave
 select the estimated end date for the agreement        property        no      
Angi estimert slutt-dato for avtalen
 select the estimated end date for the project  property        no      Angi 
estimert sluttdato for prosjektet
-select the estimated end date for the request  property        no      Angi 
estimert sluttdato for anmodningen
+select the estimated end date for the request  property        no      Angi 
estimert sluttdato for behovet
 select the estimated termination date  property        no      Angi estimert 
terminerings-dato
 select the file to import from property        no      velg fil å importere
 select the filter. to show all entries select show all property        no      
Velg filter. For å vise alle - velg VIS ALLE
@@ -1605,7 +1607,7 @@
 select the user the alarm belongs to.  property        no      Velg bruker
 select the user the document belongs to. to do not use a category select no 
user       property        no      velg bruker dokument tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
 select the user the project belongs to. to do not use a category select no 
user        property        no      velg bruker prosjekt tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
-select the user the request belongs to. to do not use a category select no 
user        property        no      velg bruker anmodning tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
+select the user the request belongs to. to do not use a category select no 
user        property        no      velg bruker behovet tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
 select the user the selection belongs to. to do not use a user select no user  
property        no      velg bruker utvalg tilhører. For ikke å bruke bruker 
velg BRUKER IKKE VALG
 select the user the template belongs to. to do not use a category select no 
user       property        no      velg bruker mal tilhører. For ikke å bruke 
bruker velg BRUKER IKKE VALG
 select the user the workorder belongs to. to do not use a category select no 
user      property        no      velg bruker bestillingen tilhører. For ikke å 
bruke bruker velg BRUKER IKKE VALG
@@ -1875,7 +1877,7 @@
 view or edit prizing history of this element   property        no      vis 
eller oppdater pris-historikk for dette elementet
 view project   property        no      vis prosjekt
 view property  property        no      vis eiendom
-view request   property        no      vis anmodning
+view request   property        no      vis behov
 view template detail   property        no      vis mal-detaljer
 view tender    property        no      Vis beskrivelse
 view the apartment     property        no      vis leilighet
@@ -1897,7 +1899,7 @@
 view the part of town  property        no      Vis bydelen
 view the project       property        no      vis prosjekt
 view the property      property        no      vis eiendom
-view the request       property        no      vis anmodning
+view the request       property        no      vis behov
 view the standard      property        no      vis standard
 view the template      property        no      vis mal
 view the ticket        property        no      vis melding
@@ -1923,7 +1925,7 @@
 what is the current status of this document ?  property        no      hva er 
status for dette dokumentet ?
 what is the current status of this equipment ? property        no      hva er 
status for dette utstyret ?
 what is the current status of this project ?   property        no      hva er 
status for dette prosjektet ?
-what is the current status of this request ?   property        no      hva er 
status for denne anmodningen ?
+what is the current status of this request ?   property        no      hva er 
status for dette behovet ?
 what is the current status of this workorder ? property        no      hva er 
status for denne bestillingen ?
 where  property        no      Hvor
 where to deliver the key       property        no      Nøkler leveres

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2013-04-05 
13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2013-04-05 
13:37:16 UTC (rev 11031)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.667';
+       $setup_info['property']['version']              = '0.9.17.668';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2013-04-05 13:37:16 UTC (rev 11031)
@@ -7510,9 +7510,10 @@
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }
+
        /**
        * Update property version from 0.9.17.667 to 0.9.17.668
-       * Add inventory for bulk items
+       * Add check for missing budgets
        */
        $test[] = '0.9.17.667';
        function property_upgrade0_9_17_667()
@@ -7521,24 +7522,25 @@
 
                $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
 
-               $GLOBALS['phpgw_setup']->oProc->CreateTable(
-                       'fm_bim_item_inventory',  array(
-                               'fd' => array(
-                                       'id' => array('type' => 
'int','precision' => 4,'nullable' => False),
-                                       'name' => array('type' => 
'varchar','precision' => 50,'nullable' => False),
-                                       'descr' => array('type' => 
'text','nullable' => True)
-                               ),
-                               'pk' => array('id'),
-                               'fk' => array(),
-                               'ix' => array(),
-                               'uc' => array()
-                       )
-               );
+               $sql = 'CREATE OR REPLACE VIEW 
fm_project_budget_year_from_order_view AS'
+                       . ' SELECT DISTINCT fm_workorder.project_id, 
fm_workorder_budget.year'
+                       . ' FROM fm_workorder_budget'
+                       . ' JOIN fm_workorder ON fm_workorder.id = 
fm_workorder_budget.order_id'
+                       . ' ORDER BY fm_workorder.project_id';
 
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
 
+
+               $sql = 'CREATE OR REPLACE VIEW fm_project_budget_year_view AS' 
+                       . ' SELECT DISTINCT fm_project_budget.project_id, 
fm_project_budget.year'
+                       . ' FROM fm_project_budget'
+                       . ' ORDER BY fm_project_budget.project_id';
+
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
-                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.667';
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.668';
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
        }

Modified: branches/Version-1_0-branch/property/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/config.tpl      
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/templates/base/config.tpl      
2013-04-05 13:37:16 UTC (rev 11031)
@@ -410,6 +410,11 @@
 
 
                <tr class="row_on">
+                       <td>{lang_lang_request_coordinator}:</td>
+                       <td><input name="newsettings[lang_request_coordinator]" 
value="{value_lang_request_coordinator}"></td>
+               </tr>
+
+               <tr class="row_on">
                        <td>{lang_meter_table}:</td>
                        <td><input name="newsettings[meter_table]" 
value="{value_meter_table}"></td>
                </tr>

Modified: branches/Version-1_0-branch/property/templates/base/entity.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/entity.xsl      
2013-04-05 13:05:30 UTC (rev 11030)
+++ branches/Version-1_0-branch/property/templates/base/entity.xsl      
2013-04-05 13:37:16 UTC (rev 11031)
@@ -7,6 +7,9 @@
                        <xsl:when test="empty">
                                <xsl:apply-templates select="empty"/>
                        </xsl:when>
+                       <xsl:when test="edit_inventory">
+                               <xsl:apply-templates select="edit_inventory"/>
+                       </xsl:when>
                        <xsl:when test="add_inventory">
                                <xsl:apply-templates select="add_inventory"/>
                        </xsl:when>
@@ -14,6 +17,196 @@
        </xsl:template>
 
 
+       <!-- edit inventory -->
+       <xsl:template xmlns:php="http://php.net/xsl"; match="edit_inventory">
+               <script type="text/javascript">
+                       function edit_inventory()
+                       {
+                               var location_id = '<xsl:value-of 
select="location_id"/>';
+                               var item_id = '<xsl:value-of 
select="item_id"/>';
+                               document.form.submit();
+               //              parent.refresh_inventory(location_id, item_id);
+                               parent.TINY.box.hide();
+                       }
+               </script>
+
+        <div align = 'left'>
+
+               <xsl:variable name="action_url">
+                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:property.uientity.edit_inventory')" />
+               </xsl:variable>
+               <xsl:variable name="lang_inventory">
+                               <xsl:value-of select="php:function('lang', 
'inventory')" />
+               </xsl:variable>
+
+               <form name="form" id="edit_inventory" action="{$action_url}" 
method="post">
+
+        <fieldset>
+               <legend>
+                       <xsl:value-of select="system_location/descr"/>
+                       <xsl:text>::</xsl:text>                 
+                       <xsl:value-of select="php:function('lang', 'edit 
inventory')" />
+               </legend>
+
+                       <div id="receipt"></div>
+                       <table>
+                               <xsl:choose>
+                                       <xsl:when test="msgbox_data != ''">
+                                               <tr>
+                                                       <td align="left" 
colspan="3">
+                                                               
<xsl:call-template name="msgbox"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
+                               <tr>
+                                       <td>
+                                       <label><xsl:value-of 
select="php:function('lang', 'id')" /></label>
+                                       </td>
+                                       <td>
+                                               <xsl:value-of select="item_id"/>
+                                               <input type="hidden" 
name="location_id" value="{location_id}"/>
+                                               <input type="hidden" name="id" 
value="{item_id}"/>
+                                               <input type="hidden" 
name="inventory_id" value="{inventory_id}"/>
+                                       </td>
+                               </tr>
+
+                               <xsl:call-template name="location_view"/>
+                               <tr>
+                                       <td>
+                                               <label 
for="unit_id"><xsl:value-of select="php:function('lang', 'unit')" /></label>
+                                       </td>
+                                       <td>
+                                               <select id = 'unit_id' 
name="values[unit_id]" class="forms">
+                                                       <xsl:if test="lock_unit 
= 1">
+                                                               <xsl:attribute 
name="disabled" value="disabled"/>
+                                                       </xsl:if>
+                                                       <xsl:apply-templates 
select="unit_list/options"/>
+                                               </select>
+                                       </td>
+                                       </tr>
+                                       <tr>
+                                       <td>
+                                               <label for="old_inventory">
+                                                       <xsl:value-of 
select="$lang_inventory"/>
+                                               </label>
+                                       </td>
+                                       <td>
+                                               <xsl:value-of 
select="value_inventory"/>
+                                       </td>
+                                       </tr>
+                                       <tr>
+                                       <td>
+                                               <label for="inventory">
+                                                       <xsl:value-of 
select="php:function('lang', 'new')" />
+                                                       <xsl:text> </xsl:text>
+                                                       <xsl:value-of 
select="$lang_inventory"/>
+                                               </label>
+                                       </td>
+                                       <td>
+
+                                               <input type="text" id = 
'inventory' name="values[inventory]" value="{value_inventory}" size="12">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_inventory_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                                       </tr>
+
+                                       <tr>
+                                       <td>
+                                               <label><xsl:value-of 
select="php:function('lang', 'bookable')" /></label>
+                                       </td>
+                                       <td>
+                                               <input type="checkbox" 
name="values[bookable]" value="1">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'bookable')"/>
+                                                       </xsl:attribute>
+                                                       <xsl:if test="bookable 
= '1'">
+                                                               <xsl:attribute 
name="checked">
+                                                                       
<xsl:text>checked</xsl:text>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
+                                               </input>
+                                       </td>
+                                       </tr>
+                                       <tr>
+                                       <td>
+                                               <label>
+                                                       <xsl:value-of 
select="php:function('lang', 'active from')"/>
+                                               </label>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
id="active_from" name="values[active_from]" size="10" 
value="{value_active_from}" readonly="readonly">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_active_from_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                                       </tr>
+                                       <tr>
+                                       <td>
+                                       <label>
+                                               <xsl:value-of 
select="php:function('lang', 'active to')"/>
+                                       </label>
+                                       </td>
+                                       <td>
+                                               <input type="text" 
id="active_to" name="values[active_to]" size="10" value="{value_active_to}" 
readonly="readonly">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="lang_active_to_statustext"/>
+                                                       </xsl:attribute>
+                                               </input>
+                                       </td>
+                                       </tr>
+                                       <tr>
+
+                                       <td>
+                                               <label><xsl:value-of 
select="php:function('lang', 'remark')" /></label>
+                                       </td>
+                                       <td>
+                                               <textarea cols="60" rows="4" 
name="values[remark]">
+                                                       <xsl:attribute 
name="title">
+                                                               <xsl:value-of 
select="php:function('lang', 'remark')"/>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_remark"/>
+                                               </textarea>
+                                       </td>
+                                       </tr>
+                       </table>
+                        </fieldset>
+               <table>
+                       <tr>
+                               <td valign="bottom">
+                                       <xsl:variable name="lang_save">
+                                               <xsl:value-of 
select="php:function('lang', 'save')"/>
+                                       </xsl:variable>
+                                       <input type="hidden" 
name="values[save]" value="1"/>
+                                       <input type="submit" name="send" 
value="{$lang_save}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'save values and exit')"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                               <td align="right" valign="bottom">
+                                       <xsl:variable name="lang_cancel">
+                                               <xsl:value-of 
select="php:function('lang', 'cancel')"/>
+                                       </xsl:variable>
+                                       <input type="button" 
name="values[cancel]" value="{$lang_cancel}" onClick="parent.TINY.box.hide();">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="$lang_cancel"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </td>
+                       </tr>
+               </table>
+
+                       </form>
+
+
+        </div>
+       </xsl:template>
+
+
        <!-- add inventory -->
        <xsl:template xmlns:php="http://php.net/xsl"; match="add_inventory">
 
@@ -23,7 +216,7 @@
                        <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:property.uientity.add_inventory')" />
                </xsl:variable>
 
-                       <form name="form" id="form" action="{$action_url}" 
method="post">
+               <form name="form" id="form" action="{$action_url}" 
method="post">
 
         <fieldset>
                <legend>
@@ -33,6 +226,15 @@
                </legend>
 
                        <table>
+                               <xsl:choose>
+                                       <xsl:when test="msgbox_data != ''">
+                                               <tr>
+                                                       <td align="left" 
colspan="3">
+                                                               
<xsl:call-template name="msgbox"/>
+                                                       </td>
+                                               </tr>
+                                       </xsl:when>
+                               </xsl:choose>
                                <tr>
                                        <td>
                                        <label><xsl:value-of 
select="php:function('lang', 'id')" /></label>
@@ -51,6 +253,9 @@
                                        </td>
                                        <td>
                                                <select id = 'unit_id' 
name="values[unit_id]" class="forms">
+                                                       <xsl:if test="lock_unit 
= 1">
+                                                               <xsl:attribute 
name="disabled" value="disabled"/>
+                                                       </xsl:if>
                                                        <xsl:apply-templates 
select="unit_list/options"/>
                                                </select>
                                        </td>
@@ -68,7 +273,7 @@
                                                </input>
                                        </td>
                                        </tr>
-
+<!--
                                        <tr>
                                        <td>
                                                <label ><xsl:value-of 
select="php:function('lang', 'write off')" /></label>
@@ -81,6 +286,7 @@
                                                </input>
                                        </td>
                                        </tr>
+-->
                                        <tr>
                                        <td>
                                                <label><xsl:value-of 
select="php:function('lang', 'bookable')" /></label>
@@ -132,7 +338,7 @@
                                                <label><xsl:value-of 
select="php:function('lang', 'remark')" /></label>
                                        </td>
                                        <td>
-                                               <textarea cols="60" rows="10" 
name="values[remark]">
+                                               <textarea cols="60" rows="4" 
name="values[remark]">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'remark')"/>
                                                        </xsl:attribute>
@@ -158,7 +364,7 @@
                                        <xsl:variable name="lang_cancel">
                                                <xsl:value-of 
select="php:function('lang', 'cancel')"/>
                                        </xsl:variable>
-                                       <input type="submit" 
name="values[cancel]" value="{$lang_cancel}">
+                                       <input type="button" 
name="values[cancel]" value="{$lang_cancel}" onClick="parent.TINY.box.hide();">
                                                <xsl:attribute name="title">
                                                        <xsl:value-of 
select="php:function('lang', 'Back to the list')"/>
                                                </xsl:attribute>
@@ -194,6 +400,11 @@
                        </xsl:when>
                </xsl:choose>
                <script type="text/javascript">
+                       function set_tab(active_tab)
+                       {
+                               document.form.active_tab.value = active_tab;    
                
+                       }
+
                        var property_js = <xsl:value-of select="property_js"/>;
                        var base_java_url = <xsl:value-of 
select="base_java_url"/>;
                        var datatable = new Array();
@@ -220,6 +431,7 @@
                                <xsl:value-of select="form_action"/>
                        </xsl:variable>

@@ Diff output truncated at 153600 characters. @@



reply via email to

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