fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10373] Merge 10312:10372 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [10373] Merge 10312:10372 from trunk
Date: Tue, 30 Oct 2012 07:43:55 +0000

Revision: 10373
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10373
Author:   sigurdne
Date:     2012-10-30 07:43:54 +0000 (Tue, 30 Oct 2012)
Log Message:
-----------
Merge 10312:10372 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/setup/setup.inc.php
    branches/Version-1_0-branch/booking/setup/tables_current.inc.php
    branches/Version-1_0-branch/booking/setup/tables_update.inc.php
    branches/Version-1_0-branch/catch/setup/setup.inc.php
    branches/Version-1_0-branch/catch/setup/tables_current.inc.php
    branches/Version-1_0-branch/catch/setup/tables_update.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
    branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
    branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
    branches/Version-1_0-branch/controller/setup/phpgw_no.lang
    
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
    branches/Version-1_0-branch/controller/templates/base/control/control.xsl
    
branches/Version-1_0-branch/controller/templates/base/control/control_details.xsl
    
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
    
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
    
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
    
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
    
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
    branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
    branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php
    
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
    
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
    
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
    branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
    branches/Version-1_0-branch/logistic/templates/base/css/base.css
    
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_values.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.custom_functions.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.js.inc.php
    branches/Version-1_0-branch/phpgwapi/setup/setup.inc.php
    branches/Version-1_0-branch/phpgwapi/setup/tables_current.inc.php
    branches/Version-1_0-branch/phpgwapi/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php
    branches/Version-1_0-branch/property/inc/class.uientity.inc.php
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/admin_entity.xsl
    branches/Version-1_0-branch/property/templates/base/attributes_form.xsl
    branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php

Added Paths:
-----------
    
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_suggestions.xsl
    
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl

Removed Paths:
-------------
    
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl

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


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,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
   + 
/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-10372

Modified: branches/Version-1_0-branch/booking/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/setup.inc.php     2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/booking/setup/setup.inc.php     2012-10-30 
07:43:54 UTC (rev 10373)
@@ -1,6 +1,6 @@
 <?php
        $setup_info['booking']['name'] = 'booking';
-       $setup_info['booking']['version'] = '0.2.10';
+       $setup_info['booking']['version'] = '0.2.11';
        $setup_info['booking']['app_order'] = 9;
        $setup_info['booking']['enable'] = 1;
        $setup_info['booking']['app_group'] = 'office';

Modified: branches/Version-1_0-branch/booking/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/booking/setup/tables_current.inc.php    
2012-10-30 07:43:54 UTC (rev 10373)
@@ -175,7 +175,7 @@
                                'created' => array('type' => 'timestamp', 
'nullable'=> False, 'default' => 'current_timestamp'),
                                'modified' => array('type' => 'timestamp', 
'nullable'=> False),
                                'frontend_modified' => array('type' => 
'timestamp', 'nullable'=> True),
-                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False, 'default' => 'changeme'),
                                'activity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'description' => array('type' => 'text', 
'nullable' => False),
                                'contact_name' => array('type' => 'text', 
'nullable' => False),
@@ -203,7 +203,7 @@
                                'id' => array('type' => 'auto', 'nullable' => 
False),
                                'id_string' => array('type' => 
'varchar','precision' => '20', 'nullable' => False, 'default' => '0'),
                                'active' => array('type' => 'int', 'nullable' 
=> False,'precision' => '4', 'default' => 1),
-                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False, 'default' => 'changeme'),
                                'application_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'organization_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'from_' => array('type' => 
'timestamp','nullable' => False),
@@ -226,7 +226,7 @@
                                'group_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'from_' => array('type' => 
'timestamp','nullable' => False),
                                'to_' => array('type' => 'timestamp','nullable' 
=> False),
-                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False, 'default' => 'changeme'),
                                'allocation_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'season_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> 4,'nullable' => False,'default' => '1'),
@@ -523,7 +523,7 @@
                                'from_' => array('type' => 
'timestamp','nullable' => False),
                                'to_' => array('type' => 'timestamp','nullable' 
=> False),
                                'cost' => array('type' => 'decimal', 
'precision' => 10, 'scale' => 2,'nullable' => True,'default' => '0.0'),
-                               'building_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False, 'default' => 'changeme'),
                                'contact_name' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'contact_email' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
                                'contact_phone' => array('type' => 'varchar', 
'precision' => 50,'nullable' => False),
@@ -757,7 +757,7 @@
                                'created' => array('type' => 'timestamp', 
'nullable' => False,'default' => 'current_timestamp'),
                                'display_in_dashboard' => array('type' => 
'int', 'nullable' => False, 'precision' => '4', 'default' => 1),
                                'building_id' => array('type' => 'int', 
'precision' => '4'),
-                               'building_name' => array('type' => 'varchar', 
'precision' => '50','nullable' => False),
+                               'building_name' => array('type' => 'varchar', 
'precision' => '100','nullable' => False),
                                'name' => array('type' => 'varchar','precision' 
=> '50','nullable' => False),
                                'phone' => array('type' => 
'varchar','precision' => '50','nullable' => true),
                                'email' => array('type' => 
'varchar','precision' => '50','nullable' => true),

Modified: branches/Version-1_0-branch/booking/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/booking/setup/tables_update.inc.php     
2012-10-30 07:43:54 UTC (rev 10373)
@@ -2657,4 +2657,56 @@
                }
        }
 
+       $test[] = '0.2.10';
+       /**
+       * Update booking version from 0.2.10 to 0.2.11
+       * add description to bb_office
+       * 
+       */
+       function booking_upgrade0_2_10()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('bb_application','building_name',array(
+                       'type' => 'varchar',
+                       'precision' => 100,
+                       'nullable' => False,
+                       'default' => 'changeme'
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('bb_allocation','building_name',array(
+                       'type' => 'varchar',
+                       'precision' => 100,
+                       'nullable' => False,
+                       'default' => 'changeme'
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('bb_booking','building_name',array(
+                       'type' => 'varchar',
+                       'precision' => 100,
+                       'nullable' => False,
+                       'default' => 'changeme'
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('bb_event','building_name',array(
+                       'type' => 'varchar',
+                       'precision' => 100,
+                       'nullable' => False,
+                       'default' => 'changeme'
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('bb_system_message','building_name',array(
+                       'type' => 'varchar',
+                       'precision' => 100,
+                       'nullable' => False,
+                       'default' => 'changeme'
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['booking']['currentver'] = 
'0.2.11';
+                       return $GLOBALS['setup_info']['booking']['currentver'];
+               }
+       }

Modified: branches/Version-1_0-branch/catch/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/setup.inc.php       2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/catch/setup/setup.inc.php       2012-10-30 
07:43:54 UTC (rev 10373)
@@ -27,7 +27,7 @@
         */
 
        $setup_info['catch']['name']                    = 'catch';
-       $setup_info['catch']['version']                 = '0.9.17.513';
+       $setup_info['catch']['version']                 = '0.9.17.514';
        $setup_info['catch']['app_order']               = 20;
        $setup_info['catch']['enable']                  = 1;
        $setup_info['catch']['globals_checked'] = True;

Modified: branches/Version-1_0-branch/catch/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_current.inc.php      
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/catch/setup/tables_current.inc.php      
2012-10-30 07:43:54 UTC (rev 10373)
@@ -29,6 +29,7 @@
        $phpgw_baseline = array(
                'fm_catch' => array(
                        'fd' => array(
+                               'location_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'name' => array('type' => 'varchar','precision' 
=> '20','nullable' => False),
                                'descr' => array('type' => 
'varchar','precision' => '50','nullable' => True),
@@ -43,6 +44,7 @@
                ),
                'fm_catch_category' => array(
                        'fd' => array(
+                               'location_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'entity_id' => array('type' => 
'int','precision' => '4','nullable' => False),
                                'id' => array('type' => 'int','precision' => 
'4','nullable' => False),
                                'name' => array('type' => 'varchar','precision' 
=> '100','nullable' => True),

Modified: branches/Version-1_0-branch/catch/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_update.inc.php       
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/catch/setup/tables_update.inc.php       
2012-10-30 07:43:54 UTC (rev 10373)
@@ -383,4 +383,83 @@
                }
        }
 
+       /**
+       * Update catch version from 0.9.17.513 to 0.9.17.514
+       * Add location_id to entities
+       */
 
+       $test[] = '0.9.17.513';
+       function catch_upgrade0_9_17_513()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch','location_id',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => true
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_catch_category','location_id',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => true
+                       )
+               );
+
+               $sql = 'SELECT id, entity_id FROM fm_catch_category';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $categories = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $categories[] = array
+                       (
+                               'entity_id'     => 
$GLOBALS['phpgw_setup']->oProc->f('entity_id'),
+                               'cat_id'        => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                       );
+               }
+
+
+               $sql = 'SELECT id FROM fm_catch';
+               $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+               $entities = array();
+               while ($GLOBALS['phpgw_setup']->oProc->next_record())
+               {
+                       $entities[] = array
+                       (
+                               'entity_id'     => 
$GLOBALS['phpgw_setup']->oProc->f('id'),
+                       );
+               }
+
+               foreach ($categories as $category)
+               {
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('catch', 
".catch.{$category['entity_id']}.{$category['cat_id']}");
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE 
fm_catch_category SET location_id = {$location_id} WHERE entity_id = 
{$category['entity_id']} AND id = {$category['cat_id']}",__LINE__,__FILE__);
+               }
+
+               foreach ($entities as $entity)
+               {
+                       $location_id    = 
$GLOBALS['phpgw']->locations->get_id('catch', ".catch.{$entity['entity_id']}");
+                       $GLOBALS['phpgw_setup']->oProc->query("UPDATE fm_catch 
SET location_id = {$location_id} WHERE id = 
{$entity['entity_id']}",__LINE__,__FILE__);
+               }
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_catch','location_id',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => false
+                       )
+               );
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_catch_category','location_id',array(
+                       'type'          => 'int',
+                       'precision'     => 4,
+                       'nullable'      => false
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['catch']['currentver'] = 
'0.9.17.514';
+                       return $GLOBALS['setup_info']['catch']['currentver'];
+               }
+       }

Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php 
2012-10-30 07:43:54 UTC (rev 10373)
@@ -207,7 +207,6 @@
                                'heading_array'                                 
=> $heading_array,
                                'controls_calendar_array'       => 
$controls_calendar_array,
                                'components_calendar_array'     => 
$components_calendar_array,
-                               'date_format'                                   
        => $date_format,
                                'location_level'                                
        => $level,
                                'roles_array'                                   
                => $roles_array,
                                'repeat_type_array'                             
=> $repeat_type_array,
@@ -392,7 +391,6 @@
                                'heading_array'                                 
=> $heading_array,
                                'controls_calendar_array'       => 
$controls_calendar_array,
                                'components_calendar_array'     => 
$components_calendar_array,
-                               'date_format'                                   
        => $date_format,
                                'location_level'                                
        => $level,
                                'roles_array'                                   
                => $roles_array,
                                'repeat_type_array'                             
=> $repeat_type_array,
@@ -528,7 +526,6 @@
                                'heading_array'                                 
                        => $heading_array,
                                'locations_with_calendar_array'         => 
$locations_with_calendar_array,
                          'components_with_calendar_array'      => 
$components_with_calendar_array,
-                               'date_format'                                   
                                => $date_format,
                                'current_year'                                  
                => $year,
                        );
                        
@@ -613,7 +610,6 @@
                                'heading_array'                                 
                        => $heading_array,
                                'locations_with_calendar_array'         => 
$locations_with_calendar_array,
                                'components_with_calendar_array'        => 
$components_with_calendar_array,
-                               'date_format'                                   
                                => $date_format,
                                'current_year'                                  
                                => $year,
                                'current_month_nr'                              
                        => $month,
                        );

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2012-10-30 07:43:54 UTC (rev 10373)
@@ -181,8 +181,6 @@
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
 
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-       
                        $catsObj = CreateObject('phpgwapi.categories', -1, 
'property', '.ticket');
                        $catsObj->supress_info = true;
                        
@@ -220,35 +218,17 @@
                        
                        $data = array
                        (
-                               'categories'                            => 
$categories,
-                               'check_list'                            => 
$check_list->toArray(),
-                               'control'                                       
=> $control->toArray(),
+                               'categories'                                    
                => $categories,
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'control'                                       
                                => $control->toArray(),
                                'check_items_and_cases'         => 
$check_items_and_cases,
-                               'date_format'                           => 
$date_format,
-                               'location_array'                        => 
$location_array,
-                               'component_array'                       => 
$component_array,
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
                                'building_location_code'        => 
$building_location_code,
-               //              'current_year'                          => 
$year,
-               //              'current_month_nr'                      => 
$month,
-                               'type'                                          
=> $type,
-                               'location_level'                        => 
$level,
-                               'dateformat'                            => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
-                               'action'                                        
=>      $GLOBALS['phpgw']->link('/index.php', array('menuaction'        => 
'controller.uicase.send_case_message')),
-                               'url_calendar_for_year'         =>      
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_year', 
-                                                                               
                                                                                
        'year'                  => $year,
-                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
-                               'url_calendar_for_month'        =>      
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_month', 
-                                                                               
                                                                                
        'year'                  => $year,
-                                                                               
                                                                                
        'month'                 => $month,
-                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'type'                                          
                                => $type,
+                               'location_level'                                
        => $level,
                        );
                                                
                        if(count( $buildings_array ) > 0)
@@ -262,13 +242,9 @@
                                                
                        phpgwapi_jquery::load_widget('core');
 
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        
-//                     
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
-                       
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'case/create_case_message'), $data);
                }
                
@@ -284,8 +260,6 @@
                        $control_id = $check_list->get_control_id();
                        $control = $this->so_control->get_single( $control_id );
                        
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-       
                        $message_details = "Kontroll: " .  
$control->get_title() . "\n";
                        
                        $cats = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
@@ -417,61 +391,27 @@
                        
                        $data = array
                        (
-                               'control'                                       
        => $control->toArray(),
-                       //      'message_ticket_id'                             
=> $message_ticket_id,
-                               'message_ticket'                                
=> $message_ticket,
-                               'category'                                      
        => $category[0]['name'],
-                               'location_array'                                
=> $location_array,
-                               'component_array'                               
=> $component_array,
-                               'control_array'                                 
=> $control->toArray(),
-                               'check_list'                                    
=> $check_list->toArray(),
-                               'check_items_and_cases'                 => 
$check_items_and_cases,
-                       //      'current_year'                                  
=> $year,
-                       //      'current_month_nr'                              
=> $month,
-                               'date_format'                                   
=> $date_format,
-                               'type'                                          
        => $type,
-                               'building_location_code'                => 
$building_location_code,
-                               'location_level'                                
=> $level,
-                               'dateformat'                                    
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
-                               'url_calendar_for_year'                 =>      
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_year', 
-                                                                               
                                                                                
        'year'                  => $year,
-                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
-                               'url_calendar_for_month'                =>      
$GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'controller.uicalendar.view_calendar_for_month', 
-                                                                               
                                                                                
        'year'                  => $year,
-                                                                               
                                                                                
        'month'                 => $month,
-                                                                               
                                                                                
        'location_code' => $type == 'component' ? $building_location_code : 
$location_array['location_code']
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
-                               'url_ticket_view'                               
=>      $GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'property.uitts.view', 
-                                                                               
                                                                                
        'id'                    => $message_ticket_id
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
-
-                               'url_ticket_new'                                
=>      $GLOBALS['phpgw']->link('/index.php', array
-                                                                               
                                                                                
(
-                                                                               
                                                                                
        'menuaction'    => 'controller.uicase.create_case_message', 
-                                                                               
                                                                                
        'check_list_id' => $check_list->get_id()
-                                                                               
                                                                                
)
-                                                                               
                                                                        ),
+                               'control'                                       
                                => $control->toArray(),
+                               'message_ticket_id'                             
=> $message_ticket_id,
+                               'message_ticket'                                
        => $message_ticket,
+                               'category'                                      
                        => $category[0]['name'],
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'control_array'                                 
        => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'check_items_and_cases'         => 
$check_items_and_cases,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
+                               'type'                                          
                                => $type,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                                
        => $level
                        );
                        
                        phpgwapi_jquery::load_widget('core');
 
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        
-//                     
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
-                       
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'case/view_case_message'), $data);
                }
                

Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2012-10-30 07:43:54 UTC (rev 10373)
@@ -258,22 +258,17 @@
                        
                        $data = array
                        (
-                               'action_url'                            => 
self::link(array('menuaction' => 'controller.uicheck_list.save_check_list')),
-                               'calendar_for_year_url'         => 
self::link(array('menuaction' => 
'controller.uicalendar.view_calendar_for_year')),
-                               'calendar_for_month_url'        => 
self::link(array('menuaction' => 
'controller.uicalendar.view_calendar_for_month')),
-                               'location_array'                        => 
$location_array,
-                               'component_array'                       => 
$component_array,
-                               'control'                                       
=> $control->toArray(),
-                               'date_format'                           => 
$date_format,
-                               'check_list'                            => 
$check_list->toArray(),
-                               'type'                                          
=> $type,
-                               'current_year'                          => 
$year,
-                               'current_month_nr'                      => 
$month_nr,
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'control'                                       
                                => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month_nr,
                                'building_location_code'        => 
$building_location_code,
-                               'location_level'                        => 
$level
+                               'location_level'                                
        => $level
                        );
                        
-       //              phpgwapi_jquery::load_widget('core');
                        $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
                        
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
 
@@ -295,14 +290,11 @@
                                $check_list = 
$this->so->get_single($check_list_id);
                        }
                        
-                       
                        $cl_status_updater = new check_list_status_updater();
                        $cl_status_updater->update_check_list_status( 
$check_list_id );
                
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                        
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                       
                        $component_id = $check_list->get_component_id();
 
                        if($component_id > 0)
@@ -338,7 +330,6 @@
                                'check_list'                                    
                => $check_list->toArray(),
                                'location_array'                                
        => $location_array,
                                'component_array'                               
        => $component_array,
-                               'date_format'                                   
        => $date_format,
                                'type'                                          
                                => $type,
                                'current_year'                                  
        => $year,
                                'current_month_nr'                              
=> $month,
@@ -373,7 +364,6 @@
                        $completed_date = phpgw::get_var('completed_date', 
'string');
                        $comment = phpgw::get_var('comment', 'string');
                                        
-                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
                        $deadline_date_ts = 
phpgwapi_datetime::date_to_timestamp( $deadline_date );
                        
                        if($planned_date != '')
@@ -453,8 +443,6 @@
                        $check_list = $this->so->get_single($check_list_id);
                        $control = 
$this->so_control->get_single($check_list->get_control_id());
                                
-                       $date_format = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-                               
                        $component_id = $check_list->get_component_id();
 
                        if($component_id > 0)
@@ -491,7 +479,6 @@
                                'check_list'                                    
                => $check_list->toArray(),
                                'location_array'                                
        => $location_array,
                                'component_array'                               
        => $component_array,
-                               'date_format'                                   
        => $date_format,
                                'type'                                          
                                => $type,
                                'current_year'                                  
        => $year,
                                'current_month_nr'                              
=> $month,
@@ -502,13 +489,9 @@
                        );
 
                        phpgwapi_jquery::load_widget('core');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        
-//                     
$GLOBALS['phpgw']->css->add_external_file('controller/templates/base/css/jquery-ui.custom.css');
-                       
                        
self::render_template_xsl(array('check_list/check_list_tab_menu', 
'check_list/view_cases_for_check_list'), $data);
                }
                
@@ -579,21 +562,18 @@
                        
                        $data = array
                        (
-                               'control'                                       
=> $control->toArray(),
-                               'check_list'                            => 
$check_list->toArray(),
-                               'location_array'                        => 
$location_array,
-                               'component_array'                       => 
$component_array,
-               //              'date_format'                           => 
$date_format,
-                               'type'                                          
=> $type,
-                               'current_year'                          => 
$year,
-                               'current_month_nr'                      => 
$month,
+                               'control'                                       
                        => $control->toArray(),
+                               'check_list'                                    
                => $check_list->toArray(),
+                               'location_array'                                
        => $location_array,
+                               'component_array'                               
        => $component_array,
+                               'type'                                          
                                => $type,
+                               'current_year'                                  
        => $year,
+                               'current_month_nr'                              
=> $month,
                                'building_location_code'        => 
$building_location_code,
-                               'location_level'                        => 
$level
+                               'location_level'                                
        => $level
                        );
 
                        phpgwapi_jquery::load_widget('core');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
                        
                        
self::render_template_xsl(array('check_list/check_list_tab_menu','check_list/view_control_info'),
 $data);
                }
@@ -722,7 +702,6 @@
                        
                        phpgwapi_jquery::load_widget('core');
 
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        

Modified: branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol.inc.php  
2012-10-30 07:43:54 UTC (rev 10373)
@@ -286,16 +286,14 @@
                        
                        $data = array
                        (
-                               'tabs'                                          
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
-                               'view'                                          
=> "control_details",
-                               'editable'                                      
=> true,
-                               'control'                                       
=> ($control != null) ? $control->toArray() : null,
+                               'tabs'                                          
                        => $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
+                               'view'                                          
                        => "control_details",
+                               'editable'                                      
                => true,
+                               'control'                                       
                        => ($control != null) ? $control->toArray() : null,
                                'control_areas_array'           => 
$control_areas_array,
                                'procedures_array'                      => 
$procedures_array,
-                               'role_array'                            => 
$role_array,
-                               'repeat_type_array'                     => 
$repeat_type_array,
-                               'dateformat'                            => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
-                               'action'                                        
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicontrol.save_control_details'))
+                               'role_array'                                    
        => $role_array,
+                               'repeat_type_array'                     => 
$repeat_type_array
                        );
                        
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
@@ -413,7 +411,6 @@
                        
                        phpgwapi_jquery::load_widget('core');
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        self::render_template_xsl(array('control/control_tabs', 
'control_group/control_groups'), $data);
                }
@@ -533,7 +530,6 @@
                        phpgwapi_jquery::load_widget('core');
 
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
                        self::render_template_xsl(array('control/control_tabs', 
'control_item/choose_control_items'), $data); 
@@ -603,16 +599,15 @@
                        
                        $data = array
                        (
-                               'tabs'                                          
        => $GLOBALS['phpgw']->common->create_tabs($tabs, 3),
-                               'view'                                          
        => "sort_check_list",
-                               'control'                                       
        => $control->toArray(),
+                               'tabs'                                          
                                                        => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 3),
+                               'view'                                          
                                                        => "sort_check_list",
+                               'control'                                       
                                                        => $control->toArray(),
                                'saved_groups_with_items_array' => 
$saved_groups_with_items_array
                        );
                        
                        phpgwapi_jquery::load_widget('core');
 
                        self::add_javascript('controller', 'yahoo', 
'control_tabs.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'custom_ui.js');
                        self::add_javascript('controller', 'controller', 
'custom_drag_drop.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
@@ -626,8 +621,7 @@
 
                        $data = array
                        (
-                               'control'                                       
        => $control->toArray(),
-                               'dateformat'                                    
=> $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
+                               'control'       => $control->toArray(),
                        );
                  
                        self::render_template_xsl('control/control_details', 
$data);

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php    
2012-10-30 07:43:54 UTC (rev 10373)
@@ -368,7 +368,6 @@
                                (
                                        'tabs'                                  
        => phpgwapi_yui::tabview_generate($tabs, 'control_items'),
                                        'value_id'                              
        => !empty($control_group) ? $control_group->get_id() : 0,
-                                       'img_go_home'                           
=> 'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
        => true,
                                        'procedure'                             
        => array('options' => $procedure_options),
                                        'control_area'                          
=> array('options' => $control_area_array),
@@ -507,7 +506,6 @@
                                (
                                        'tabs'                                  
        => phpgwapi_yui::tabview_generate($tabs, $tab_to_display),
                                        'value_id'                              
        => !empty($control_group) ? $control_group->get_id() : 0,
-                                       'img_go_home'                           
=> 'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
        => true,
                                        'procedure'                             
        => array('options' => $procedure_options),
                                        'control_area'                          
=> array('options' => $control_area_array),
@@ -736,7 +734,6 @@
                                (
                                        'tabs'                                  
        => phpgwapi_yui::tabview_generate($tabs, 'control_group'),
                                        'value_id'                              
        => !empty($control_group) ? $control_group->get_id() : 0,
-                                       'img_go_home'                           
=> 'rental/templates/base/images/32x32/actions/go-home.png',
                                        'control_group'                         
=> $control_group_array,
                                        'selected_control_items'        => 
$control_items,
                                );

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_item.inc.php     
2012-10-30 07:43:54 UTC (rev 10373)
@@ -52,14 +52,14 @@
 
                public $public_functions = array
                (
-                       'index' =>      true,
-                       'query' =>      true,
-                       'edit'  =>      true,
-                       'view'  =>      true,
-                       'add'           =>      true,
-                       'save'  =>      true,
+                       'index'                                                 
                =>      true,
+                       'query'                                                 
                =>      true,
+                       'edit'                                                  
                =>      true,
+                       'view'                                                  
                =>      true,
+                       'add'                                                   
                        =>      true,
+                       'save'                                                  
                =>      true,
                        'display_control_items' => true,
-                       'delete_item_list'      => true
+                       'delete_item_list'                      => true
                );
 
                public function __construct()
@@ -242,9 +242,7 @@
                        $this->use_yui_editor(array('what_to_do','how_to_do'));
                        
                        phpgwapi_jquery::load_widget('core');
-//                     self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('controller', 'controller', 
'ajax.js');
-//                     self::add_javascript('controller', 'controller', 
'jquery-ui.custom.min.js');
 
                        self::render_template_xsl('control_item/control_item', 
$data);
                }

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    2012-10-30 07:43:54 UTC (rev 10373)
@@ -55,12 +55,12 @@
        
                var $public_functions = array
                (
-                       'index'                                                 
        => true,
-                       'query'                                                 
        => true,
+                       'index'                                                 
                        => true,
+                       'query'                                                 
                        => true,
                        'edit_component'                                        
=> true,
-                       'get_location_category'                         => true,
-                       'get_category_by_entity'                        => true,
-                       'get_entity_table_def'                          => true,
+                       'get_location_category'         => true,
+                       'get_category_by_entity'        => true,
+                       'get_entity_table_def'          => true,
                );
 
                function __construct()
@@ -73,17 +73,17 @@
                        
                        $this->type_id                          = 
$this->bo->type_id;
                        
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
-                       $this->filter                           = 
$this->bo->filter;
-                       $this->cat_id                           = 
$this->bo->cat_id;
-                       $this->part_of_town_id          = 
$this->bo->part_of_town_id;
+                       $this->start                                            
= $this->bo->start;
+                       $this->query                                            
= $this->bo->query;
+                       $this->sort                                             
        = $this->bo->sort;
+                       $this->order                                            
= $this->bo->order;
+                       $this->filter                                           
= $this->bo->filter;
+                       $this->cat_id                                           
= $this->bo->cat_id;
+                       $this->part_of_town_id  = $this->bo->part_of_town_id;
                        $this->district_id                      = 
$this->bo->district_id;
-                       $this->status                           = 
$this->bo->status;
-                       $this->allrows                          = 
$this->bo->allrows;
-                       $this->lookup                           = 
$this->bo->lookup;
+                       $this->status                                           
= $this->bo->status;
+                       $this->allrows                                  = 
$this->bo->allrows;
+                       $this->lookup                                           
= $this->bo->lookup;
                        $this->location_code            = 
$this->bo->location_code;
                        
                        
self::set_active_menu('controller::control::location_for_check_list');

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
     2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
     2012-10-30 07:43:54 UTC (rev 10373)
@@ -55,15 +55,15 @@
        
                var $public_functions = array
                (
-                       'index'                                                 
        => true,
-                       'query'                                                 
        => true,
-                       'edit_location'                                         
=> true,
+                       'index'                                                 
                                        => true,
+                       'query'                                                 
                                        => true,
+                       'edit_location'                                         
                => true,
                        'get_location_category'                         => true,
-                       'get_district_part_of_town'                     => true,
+                       'get_district_part_of_town'             => true,
                        'get_category_by_entity'                        => true,
                        'get_entity_table_def'                          => true,
-                       'get_locations'                                         
=> true,
-                       'get_location_type_category'            => true
+                       'get_locations'                                         
                => true,
+                       'get_location_type_category'    => true
                );
 
                function __construct()
@@ -76,17 +76,17 @@
                        
                        $this->type_id                          = 
$this->bo->type_id;
                        
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
-                       $this->filter                           = 
$this->bo->filter;
-                       $this->cat_id                           = 
$this->bo->cat_id;
-                       $this->part_of_town_id          = 
$this->bo->part_of_town_id;
+                       $this->start                                            
= $this->bo->start;
+                       $this->query                                            
= $this->bo->query;
+                       $this->sort                                             
        = $this->bo->sort;
+                       $this->order                                            
= $this->bo->order;
+                       $this->filter                                           
= $this->bo->filter;
+                       $this->cat_id                                           
= $this->bo->cat_id;
+                       $this->part_of_town_id  = $this->bo->part_of_town_id;
                        $this->district_id                      = 
$this->bo->district_id;
-                       $this->status                           = 
$this->bo->status;
-                       $this->allrows                          = 
$this->bo->allrows;
-                       $this->lookup                           = 
$this->bo->lookup;
+                       $this->status                                           
= $this->bo->status;
+                       $this->allrows                                  = 
$this->bo->allrows;
+                       $this->lookup                                           
= $this->bo->lookup;
                        $this->location_code            = 
$this->bo->location_code;
                        
                        
self::set_active_menu('controller::control::location_for_check_list');

Modified: branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php 
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uidocument.inc.php 
2012-10-30 07:43:54 UTC (rev 10373)
@@ -40,11 +40,11 @@
 
         public $public_functions = array
         (
-                               'query'         => true,
-                               'add'           => true,
-                               'view'          => true,
-                               'delete'        => true,
-                               'show'          => true,
+                               'query'                                         
=> true,
+                               'add'                                           
        => true,
+                               'view'                                          
=> true,
+                               'delete'                                        
=> true,
+                               'show'                                          
=> true,
                                'document_types'        => true
         );
 
@@ -458,9 +458,7 @@
                        'tabs'                                  => 
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
                        'view'                                  => 
"view_documents_for_procedure",
                        'procedure_id'                  => !empty($procedure) ? 
$procedure->get_id() : 0,
-                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                        'procedure'                             => 
$procedure_array,
-                       'dateformat'                    => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
                        'values'                                => 
$table_values,
                        'table_header'                  => $table_header,
                 );

Modified: branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/class.uiprocedure.inc.php        
2012-10-30 07:43:54 UTC (rev 10373)
@@ -386,7 +386,6 @@
                                        'start_date'                    => 
$GLOBALS['phpgw']->yuical->add_listener('start_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_start_date())?$procedure->get_start_date():time())),
                                        'end_date'                              
=> 
$GLOBALS['phpgw']->yuical->add_listener('end_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_end_date())?$procedure->get_end_date():'')),
                                        'revision_date'                 => 
$GLOBALS['phpgw']->yuical->add_listener('revision_date',date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 ($procedure->get_revision_date())?$procedure->get_revision_date():'')),
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable'                              
=> true,
                                        'procedure'                             
=> $procedure_array,
                                        //'control_area'                        
        => array('options' => $control_area_options),
@@ -511,9 +510,7 @@
                                        'tabs'                                  
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
                                        'view'                                  
=> "view_procedure",
                                        'value_id'                              
=> !empty($procedure) ? $procedure->get_id() : 0,
-                                       'img_go_home'                   => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'procedure'                             
=> $procedure_array,
-                                       'dateformat'                    => 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
                                        'values'                                
=> $table_values,
                                        'table_header'                  => 
$table_header,
                                );

Modified: branches/Version-1_0-branch/controller/inc/model/class.control.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/inc/model/class.control.inc.php      
2012-10-30 07:43:54 UTC (rev 10373)
@@ -250,8 +250,6 @@
                
                public function populate()
                {
-                               $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
-
                                
$this->set_title(phpgw::get_var('title','string'));
                                
$this->set_description(phpgw::get_var('description','html'));
                                

Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang  2012-10-30 
07:43:54 UTC (rev 10373)
@@ -361,3 +361,5 @@
 error_msg_no_controls_in_period        controller      no      Ingen 
kontroller for bygg i denne perioden
 error_msg_no_controls_for_component    controller      no      Ingen 
kontroller for komponent i denne perioden
 role at location       controller      no      Tildeling av rolle
+Register new message   controller      no      Registrer ny melding
+Show message   controller      no      Vis melding
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2012-10-30 07:43:54 UTC (rev 10373)
@@ -1,6 +1,5 @@
 <!-- $Id$ -->
 <xsl:template match="data"  xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
 <xsl:variable name="session_url">&amp;<xsl:value-of 
select="php:function('get_phpgw_session_url')" /></xsl:variable>
        
 <script>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/create_case_message.xsl
  2012-10-30 07:43:54 UTC (rev 10373)
@@ -1,6 +1,5 @@
 <!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
 
 <div id="main_content" class="medium">
        
@@ -24,10 +23,41 @@
                        </xsl:choose>
                </div>
                <div class="box-2 select-box">
-                       <a href="{url_calendar_for_year}">
-                               Kontrolplan for bygg/eiendom (Ã¥r)
+                       <a>
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrollplan for bygg/eiendom (Ã¥r)
                        </a>
-                       <a class="last" href="{url_calendar_for_month}">
+                               
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
                                Kontrolplan for bygg/eiendom (måned)
                        </a>
                </div>
@@ -42,7 +72,11 @@
                        <xsl:choose>
                                <xsl:when 
test="check_items_and_cases/child::node()">
                                
-                               <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" action="{action}" method="post">
+                               <xsl:variable name="action_url">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicase.send_case_message')" />
+                               </xsl:variable>
+               
+                               <form ENCTYPE="multipart/form-data" 
id="frmRegCaseMessage" action="{$action_url}" method="post">
                                        <input>
                                                <xsl:attribute 
name="name">check_list_id</xsl:attribute>
                                            <xsl:attribute 
name="type">hidden</xsl:attribute>

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/case/view_case_message.xsl
    2012-10-30 07:43:54 UTC (rev 10373)
@@ -1,6 +1,5 @@
 <!-- $Id: edit_check_list.xsl 8374 2011-12-20 07:45:04Z vator $ -->
 <xsl:template match="data" name="view_check_list" 
xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
 
 <div id="main_content" class="medium">
        
@@ -23,11 +22,43 @@
                                </xsl:otherwise>
                        </xsl:choose>
                </div>
+               
                <div class="box-2 select-box">
-                       <a href="{url_calendar_for_year}">
-                               Kontrolplan for bygg/eiendom (Ã¥r)
+                       <a>
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
+                               Kontrollplan for bygg/eiendom (Ã¥r)
                        </a>
-                       <a class="last" href="{url_calendar_for_month}">
+                               
+                       <a class="last">
+                               <xsl:attribute name="href">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
+                                       <xsl:text>&amp;year=</xsl:text>
+                                       <xsl:value-of select="current_year"/>
+                                       <xsl:text>&amp;month=</xsl:text>
+                                       <xsl:value-of 
select="current_month_nr"/>
+                                       <xsl:text>&amp;location_code=</xsl:text>
+                                       <xsl:choose>
+                                         <xsl:when test="type = 'component'">
+                                                 <xsl:value-of 
select="building_location_code"/>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                 <xsl:value-of 
select="location_array/location_code"/>
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+                               </xsl:attribute>
                                Kontrolplan for bygg/eiendom (måned)
                        </a>
                </div>
@@ -37,12 +68,18 @@
        </div>
        
        <!-- =======================  INFO ABOUT MESSAGE  
========================= -->
-       <h3 class="box_header ext">Melding registrert</h3>
+       <h3 class="box_header ext">Registrert melding</h3>
        <div id="caseMessage" class="box ext">
                
-                       <a id="showMessage" target="_blank" 
href="{url_ticket_view}">
-                       Vis melding
-                       </a>
+                               <xsl:variable name="show_ticket_params">
+                                       
<xsl:text>menuaction:property.uitts.view, id:</xsl:text>
+                                       <xsl:value-of 
select="message_ticket_id" />
+                               </xsl:variable>
+                               <xsl:variable name="show_ticket_url">
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $show_ticket_params )" />
+                               </xsl:variable>
+                               <a id="showMessage" target="_blank" 
href="{$show_ticket_url}"><xsl:value-of select="php:function('lang', 'Show 
message')" /></a>
+               
                    <!-- === TITLE === -->
                    <div class="row">                           
                                <label>Tittel på 
melding:</label><span><xsl:value-of select="message_ticket/subject"/></span>
@@ -77,9 +114,15 @@
                                </xsl:choose>
                        </xsl:for-each>
                </ul>
-               <a class="btn" href="{url_ticket_new}">
-             Registrer ny melding
-               </a>
+               
+               <xsl:variable name="new_ticket_params">
+                       
<xsl:text>menuaction:controller.uicase.create_case_message, 
check_list_id:</xsl:text>
+                       <xsl:value-of select="check_list/id" />
+               </xsl:variable>
+               <xsl:variable name="new_ticket_url">
+                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', $new_ticket_params)" />
+               </xsl:variable>
+               <a class="btn" href="{$new_ticket_url}"><xsl:value-of 
select="php:function('lang', 'Register new message')" /></a>
        </div>
 </div>
 </xsl:template>

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
 2012-10-30 07:43:54 UTC (rev 10373)
@@ -26,9 +26,10 @@
                        </xsl:choose>
                </div>
                <div class="box-2 select-box">
+               
                        <a>
                                <xsl:attribute name="href">
-                                       <xsl:value-of 
select="calendar_for_year_url"/>
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_year' )" />
                                        <xsl:text>&amp;year=</xsl:text>
                                        <xsl:value-of select="current_year"/>
                                        <xsl:text>&amp;location_code=</xsl:text>
@@ -43,9 +44,10 @@
                                </xsl:attribute>
                                Kontrollplan for bygg/eiendom (Ã¥r)
                        </a>
+                               
                        <a class="last">
                                <xsl:attribute name="href">
-                                       <xsl:value-of 
select="calendar_for_month_url"/>
+                                       <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicalendar.view_calendar_for_month' )" />
                                        <xsl:text>&amp;year=</xsl:text>
                                        <xsl:value-of select="current_year"/>
                                        <xsl:text>&amp;month=</xsl:text>
@@ -80,7 +82,12 @@
        <!-- ==================  CHECKLIST DETAILS  ===================== -->
        <div id="check_list_details">
                <h3 class="box_header">Sjekklistedetaljer</h3>
-               <form id="frm_add_check_list" action="{action_url}" 
method="post">
+               
+               <xsl:variable name="action_url">
+                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:controller.uicheck_list.save_check_list')" />
+               </xsl:variable>
+               
+               <form id="frm_add_check_list" action="{$action_url}" 
method="post">
                        <xsl:variable name="control_id"><xsl:value-of 
select="control/id"/></xsl:variable>
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
                        <xsl:variable name="type"><xsl:value-of 
select="type"/></xsl:variable>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control/control.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control/control.xsl   
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/controller/templates/base/control/control.xsl   
2012-10-30 07:43:54 UTC (rev 10373)
@@ -6,11 +6,15 @@
 <xsl:variable name="control_procedure_id"><xsl:value-of 
select="control/procedure_id"/></xsl:variable>
 <xsl:variable name="control_repeat_type"><xsl:value-of 
select="control/repeat_type"/></xsl:variable>
 <xsl:variable name="control_role"><xsl:value-of 
select="control/responsibility_id"/></xsl:variable>
-<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
 
 <div class="yui-content">
        <div id="control_details">
-               <form id="frm_save_control_details" action="{action}" 
method="post">
+               
+               <xsl:variable name="action_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uicontrol.save_control_details')" />
+                       </xsl:variable>
+               <form id="frm_save_control_details" action="{$action_url}" 
method="post">
                        <input type="hidden" name="control_id" 
value="{$control_id}" />
                        <input type="hidden" name="saved_control_area_id" 
value="{$control_area_id}" /> 
        

Modified: 
branches/Version-1_0-branch/controller/templates/base/control/control_details.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control/control_details.xsl
   2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/control/control_details.xsl
   2012-10-30 07:43:54 UTC (rev 10373)
@@ -1,41 +1,40 @@
 <!-- $Id: control.xsl 9951 2012-08-31 10:14:12Z vator $ -->
 <xsl:template match="data" name="control_details" 
xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="dateformat"/></xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
        <div id="show-control-details-box">
         <h3>Detaljer for kontroll</h3>
                
                <ul class='elem-wrp'>
-                                 
-                                 
<li><label>Kontrollområde</label><xsl:value-of 
select="control/control_area_name" /></li>
-                                 <li><label>Prosedyre</label><xsl:value-of 
select="control/procedure_name" /></li>
-                               <li><label for="start_date">Startdato</label>
-                                               <xsl:value-of 
select="php:function('date', $date_format, number(control/start_date))"/>
-                               </li>
-                                 <li>
-                                       <label for="end_date">Sluttdato</label>
-                                       <xsl:choose>
-                                                               <xsl:when 
test="control/end_date != 0">
-                                                                       
<xsl:value-of select="php:function('date', $date_format, 
number(control/end_date))"/>
-                                                               </xsl:when>
-                                                               <xsl:otherwise>
-                                                                       Løpende
-                                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                 </li>
-                                 <li><label>Frekvens</label>
-                                               <xsl:choose>
-                                                                       
<xsl:when test="control/repeat_interval = 1">
-                                                               <span 
class="pre">Hver</span>
-                                                       </xsl:when>
-                                                       <xsl:when 
test="control/repeat_interval = 2">
-                                                               <span 
class="pre">Annenhver</span>
-                                                       </xsl:when>
-                                                       <xsl:when 
test="control/repeat_interval > 2">
-                                                               <span 
class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
-                                                       </xsl:when>
-                                                     </xsl:choose>
-                                                     <span 
class="val"><xsl:value-of select="control/repeat_type_label"/></span>
-                                 </li>
-                                               </ul>
-                       </div>
+                 <li><label>Kontrollområde</label><xsl:value-of 
select="control/control_area_name" /></li>
+                 <li><label>Prosedyre</label><xsl:value-of 
select="control/procedure_name" /></li>
+               <li><label for="start_date">Startdato</label>
+                               <xsl:value-of select="php:function('date', 
$date_format, number(control/start_date))"/>
+               </li>
+                 <li>
+                       <label for="end_date">Sluttdato</label>
+                       <xsl:choose>
+                               <xsl:when test="control/end_date != 0">
+                                       <xsl:value-of 
select="php:function('date', $date_format, number(control/end_date))"/>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       Løpende
+                               </xsl:otherwise>
+                       </xsl:choose>
+                 </li>
+                 <li><label>Frekvens</label>
+                               <xsl:choose>
+                               <xsl:when test="control/repeat_interval = 1">
+                       <span class="pre">Hver</span>
+               </xsl:when>
+               <xsl:when test="control/repeat_interval = 2">
+                       <span class="pre">Annenhver</span>
+               </xsl:when>
+               <xsl:when test="control/repeat_interval > 2">
+                       <span class="pre">Hver</span><span><xsl:value-of 
select="control/repeat_interval"/>.</span>
+               </xsl:when>
+            </xsl:choose>
+            <span class="val"><xsl:value-of 
select="control/repeat_type_label"/></span>
+                 </li>
+       </ul>
+       </div>
 </xsl:template>

Modified: 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
  2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/control_item/control_item_option.xsl
  2012-10-30 07:43:54 UTC (rev 10373)
@@ -2,9 +2,6 @@
 <!-- item  -->
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
-
-
-
 <xsl:call-template name="yui_phpgw_i18n"/>
 
 <div id="main_wrp">

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/print_procedure.xsl
 2012-10-30 07:43:54 UTC (rev 10373)
@@ -2,7 +2,7 @@
 <!-- item  -->
 
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
-<xsl:variable name="dateformat"><xsl:value-of select="dateformat" 
/></xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
 
 <div id="procedure">
                <h1><xsl:value-of select="procedure/title" /></h1>
@@ -18,13 +18,13 @@
                <div>
                        <label for="start_date"><xsl:value-of 
select="php:function('lang','Procedure valid from date')" /></label>
                        <xsl:variable name="startdate"><xsl:value-of 
select="procedure/start_date" /></xsl:variable>
-                       <xsl:value-of select="php:function('date', $dateformat, 
$startdate)" />
+                       <xsl:value-of select="php:function('date', 
$date_format, $startdate)" />
                </div>
                <div>
                        <label for="revision_date"><xsl:value-of 
select="php:function('lang','Procedure revision date')" /></label>
                        <xsl:if test="procedure/revision_date != 0">
                                <xsl:variable name="revisiondate"><xsl:value-of 
select="procedure/revision_date" /></xsl:variable>
-                               <xsl:value-of select="php:function('date', 
$dateformat, $revisiondate)" />
+                               <xsl:value-of select="php:function('date', 
$date_format, $revisiondate)" />
                        </xsl:if>
                </div>
                <div>
@@ -32,7 +32,7 @@
                                <label for="end_date"><xsl:value-of 
select="php:function('lang','Procedure end date')" /></label>
                        
                                <xsl:variable name="enddate"><xsl:value-of 
select="procedure/end_date" /></xsl:variable>
-                               <xsl:value-of select="php:function('date', 
$dateformat, $enddate)" />
+                               <xsl:value-of select="php:function('date', 
$date_format, $enddate)" />
                        </xsl:if>
                </div>
                <div>

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
     2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_documents.xsl
     2012-10-30 07:43:54 UTC (rev 10373)
@@ -3,8 +3,6 @@
 
 <xsl:template name="view_procedure_documents" xmlns:php="http://php.net/xsl";>
 
-<xsl:variable name="dateformat"><xsl:value-of select="dateformat" 
/></xsl:variable>
-
 <div class="yui-content">
                <div id="details">
                        <xsl:variable name="action_url"><xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:controller.uidocument.add')" /></xsl:variable>

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
  2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_item.xsl
  2012-10-30 07:43:54 UTC (rev 10373)
@@ -4,7 +4,7 @@
 <xsl:template name="view_procedure" xmlns:php="http://php.net/xsl";>
 
 <xsl:call-template name="yui_phpgw_i18n"/>
-<xsl:variable name="dateformat"><xsl:value-of select="dateformat" 
/></xsl:variable>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 'user|preferences|common|dateformat')" 
/></xsl:variable>
 
 <div class="yui-content">
                <div id="details">
@@ -56,7 +56,7 @@
                                                </xsl:when>
                                                <xsl:otherwise>
                                                        <xsl:variable 
name="startdate"><xsl:value-of select="procedure/start_date" /></xsl:variable>
-                                                       <xsl:value-of 
select="php:function('date', $dateformat, $startdate)" />
+                                                       <xsl:value-of 
select="php:function('date', $date_format, $startdate)" />
                                                </xsl:otherwise>
                                        </xsl:choose>
                                        </dd>
@@ -71,7 +71,7 @@
                                                <xsl:otherwise>
                                                        <xsl:if 
test="procedure/revision_date != 0">
                                                                <xsl:variable 
name="revisiondate"><xsl:value-of select="procedure/revision_date" 
/></xsl:variable>
-                                                               <xsl:value-of 
select="php:function('date', $dateformat, $revisiondate)" />
+                                                               <xsl:value-of 
select="php:function('date', $date_format, $revisiondate)" />
                                                        </xsl:if>
                                                </xsl:otherwise>
                                        </xsl:choose>
@@ -87,7 +87,7 @@
                                                </xsl:when>
                                                <xsl:otherwise>
                                                        <xsl:variable 
name="enddate"><xsl:value-of select="procedure/end_date" /></xsl:variable>
-                                                       <xsl:value-of 
select="php:function('date', $dateformat, $enddate)" />
+                                                       <xsl:value-of 
select="php:function('date', $date_format, $enddate)" />
                                                </xsl:otherwise>
                                        </xsl:choose>
                                        </dd>

Modified: 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
  2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/controller/templates/base/procedure/procedure_tabs.xsl
  2012-10-30 07:43:54 UTC (rev 10373)
@@ -7,9 +7,7 @@
        <xsl:choose>
                <xsl:when test="view = 'view_procedure'">
                        <div class="identifier-header">
-                               <h1><img src="{img_go_home}" /> 
-                                               <xsl:value-of 
select="php:function('lang', 'Procedure')" />
-                               </h1>
+                               <h1><xsl:value-of select="php:function('lang', 
'Procedure')" /></h1>
                        </div>
                        <!-- Prints tabs array -->
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs" />
@@ -18,9 +16,7 @@
                </xsl:when>
                <xsl:when test="view = 'view_documents_for_procedure'">
                        <div class="identifier-header">
-                               <h1><img src="{img_go_home}" /> 
-                                               <xsl:value-of 
select="php:function('lang', 'Procedure')" />
-                               </h1>
+                               <h1><xsl:value-of select="php:function('lang', 
'Procedure')" /></h1>
                        </div>
                        <!-- Prints tabs array -->
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs" />

Modified: branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-30 
07:43:54 UTC (rev 10373)
@@ -41,19 +41,38 @@
                                (
                                        'text'  => lang('logistic'),
                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uiproject.index') ),
-          'image'      => array('property', 'location'),
+                                       'image' => array('property', 
'location'),
                                        'order' => 10,
                                        'group' => 'office'
                                )
                        );
 
+
+                       $favorites_children = array();
+                       
if(isset($GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
 && $GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
+                       {
+                               $menu_favorites = 
$GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'];
+                               foreach ($menu_favorites as $type => $targets)
+                               {
+                                       foreach ($targets as $target => 
$target_name)
+                                       {
+                                               
$favorites_children["{$type}{$target}"] = array
+                                               (
+                                                       'text'  => $target_name,
+                                                       'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
"logistic.ui{$type}.index", 'filter' =>$target ) ),
+                                                       'image' => 
array('property', 'location_tenant')
+                                               );
+                                       }
+                               }
+                       }
+
                        $menus['navigation'] =  array
                        (
                                'project' => array
                                (
                                        'text'  => lang('project'),
                                        'url'   => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uiproject.index') ),
-          'image'      => array('property', 'location_tenant'),
+                                       'image' => array('property', 
'location_tenant'),
                                        'children'      => array(
                                                        'activity' => array
                                                                (
@@ -74,6 +93,13 @@
                                                                                
'image' => array('property', 'location_tenant'),
                                                                ),*/
                                                )
+                               ),
+                               'favorites' => array
+                               (
+                                       'text'          => lang('favorites'),
+                                       'url'           => 
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=> 
'logistic.uiactivity.index') ),
+                                       'image'         => array('property', 
'location_tenant'),
+                                       'children'      => $favorites_children
                                )
                        );
 
@@ -126,4 +152,4 @@
 
                        return $menus;
                }
-       }
\ No newline at end of file
+       }

Modified: branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php   
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php   
2012-10-30 07:43:54 UTC (rev 10373)
@@ -33,6 +33,7 @@
        class logistic_soactivity extends logistic_socommon
        {
                protected static $so;
+               protected $activity_tree = array();
 
                /**
                 * Get a static reference to the storage object associated with 
this model object
@@ -181,7 +182,6 @@
 
                        $condition =  join(' AND ', $clauses);
 
-                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_procedure.control_area_id = controller_control_area.id)";
                        $tables = "lg_activity activity";
 
                        if($return_count) // We should only return a count
@@ -196,11 +196,193 @@
                        $dir = $ascending ? 'ASC' : 'DESC';
                        $order = $sort_field ? "ORDER BY 
{$this->marshal($sort_field, 'field')} $dir ": '';
 
-                       //var_dump("SELECT {$cols} FROM {$tables} {$joins} 
WHERE {$condition} {$order}");
-
                        return "SELECT {$cols} FROM {$tables} WHERE 
{$condition} {$order}";
                }
 
+
+               /**
+                * Method for retreiving objects.
+                * 
+                * @param $start_index int with index of first object.
+                * @param $num_of_objects int with max number of objects to 
return.
+                * @param $sort_field string representing the object field to 
sort on.
+                * @param $ascending boolean true for ascending sort on sort 
field, false
+                * for descending.
+                * @param $search_for string with free text search query.
+                * @param $search_type string with the query type.
+                * @param $filters array with key => value of filters.
+                * @return array of objects. May return an empty
+                * array, never null. The array keys are the respective index 
numbers.
+                */
+               public function get(int $start_index, int $num_of_objects, 
string $sort_field, boolean $ascending, string $search_for, string 
$search_type, array $filters)
+               {
+                       $results = array();                     // Array to 
store result objects
+                       $map = array();                         // Array to 
hold number of records per target object
+                       $check_map = array();           // Array to hold the 
actual number of record read per target object
+                       $object_ids = array();          // All of the object 
ids encountered
+                       $added_object_ids = array();// All of the added objects 
ids
+
+                       // Retrieve information about the table name and the 
name and alias of id column
+                       // $break_on_limit -    flag indicating whether to 
break the loop when the number of records 
+                       //                                              for all 
the result objects are traversed
+                       $id_field_name_info = $this->get_id_field_name(true);
+                       if(is_array($id_field_name_info))
+                       {
+                               $break_on_limit = true;
+                               $id_field_name = 
$id_field_name_info['translated'];
+                       }
+                       else
+                       {
+                               $break_on_limit = false;
+                               $id_field_name = $id_field_name_info;
+                       }
+
+                       // Special case: Sort on id field. Always changed to 
the id field name.
+                       // $break_when_num_of_objects_reached - flag indicating 
to break the loop when the number of 
+                       //              results are reached and we are sure 
that the records are ordered by the id
+                       if($sort_field == null || $sort_field == 'id' || 
$sort_field == '')
+                       {
+                               $sort_field = $id_field_name;
+                               $break_when_num_of_objects_reached = true;
+                       }
+                       else
+                       {
+                               $break_when_num_of_objects_reached = false;
+                       }
+
+                       // Only allow positive start index
+                       if($start_index < 0)
+                       {
+                               $start_index = 0;
+                       }
+
+                       $sql = $this->get_query($sort_field, $ascending, 
$search_for, $search_type, $filters, false);
+                       $ret = $this->read_tree($sql, $filters);
+
+                       return $ret;
+               }
+
+               /**
+                * used for retrive the path for a particular node from a 
hierarchy
+                *
+                * @param integer $node is the id of the node we want the path 
of
+                * @return array $path Path
+                */
+
+               public function get_path($node)
+               {
+                       $node = (int) $node;
+                       $table = "lg_activity";
+                       $sql = "SELECT id, name, parent_activity_id FROM 
{$table} WHERE id = {$node}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $parent_id = $this->db->f('parent_activity_id');
+                       $name = $this->db->f('name', true);
+                       $path = array($name);
+                       if ($parent_id)
+                       {
+                               $path = 
array_merge($this->get_path($parent_id), $path);
+                       }
+                       return $path;
+               }
+
+
+               /**
+                * Method for retreiving hierarchy.
+                * 
+                * @param $sql string database query.
+                * @param $filters array with key => value of filters.
+                * @return array of objects. May return an empty
+                * array, never null. The array keys are the respective index 
numbers.
+                */
+
+               public function read_tree($sql, $filters)
+               {
+                       if($filters['activity'])
+                       {
+                               $filter_clause = "activity.id = 
{$this->marshal($filters['activity'], 'int')}";
+                       }
+                       else if($filters['id'])
+                       {
+                               $filter_clause = "activity.id = 
{$this->marshal($filters['id'], 'int')}";
+                       }
+                       else
+                       {
+                               $filter_clause = "(parent_activity_id = 0 OR 
parent_activity_id IS NULL)";
+                       }
+
+                       $sql_parts = explode('1=1',$sql); // Split the query to 
insert extra condition on test for break
+                       $sql = "{$sql_parts[0]} {$filter_clause} 
{$sql_parts[1]}";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $this->activity_tree = array();
+                       while ($this->db->next_record())
+                       {
+                               $id     = $this->db->f('id');
+                               $activities[$id] = array
+                                       (
+                                               'id'                    => $id,
+                                               'name'                  => 
$this->db->f('name',true),
+                                               'parent_id'             => 0
+                                       );
+                       }
+
+                       foreach($activities as $activity)
+                       {
+                               $this->activity_tree[] = array
+                                       (
+                                               'id'    => $activity['id'],
+                                               'name'  => $activity['name']
+                                       );
+                               $this->get_children($activity['id'], 1);
+                       }
+
+                       $result = array();
+                       foreach($this->activity_tree as $_activity)
+                       {
+                               $this->db->query("SELECT * FROM lg_activity 
WHERE id ={$_activity['id']}",__LINE__,__FILE__);
+                               $this->db->next_record();
+                               $activity_obj = 
$this->populate($_activity['id']);
+                               $activity_obj->set_name($_activity['name']);
+                               $result[] = $activity_obj;
+                       }
+
+                       return $result;
+               }
+
+               /**
+                * Method for retreiving sublevels of a hierarchy.
+                * 
+                * @param $parent int any children belong to this parent
+                * @param $level int which level to search.
+                * @return array of children
+                */
+
+               protected function get_children($parent, $level)
+               {
+                       $db = clone($this->db);
+                       $table = "lg_activity";
+                       $sql = "SELECT id, name FROM {$table} WHERE 
parent_activity_id = {$parent} ORDER BY name ASC";
+                       $db->query($sql,__LINE__,__FILE__);
+
+                       while ($db->next_record())
+                       {
+                               $id     = $db->f('id');
+                               $this->activity_tree[] = array
+                                       (
+                                               'id'            => $id,
+                                               'name'          => 
str_repeat('..',$level).$db->f('name',true),
+                                               'parent_id'     => $parent
+                                       );
+                               $this->get_children($id, $level+1);
+                       }
+                       return $this->activity_tree;
+               } 
+
+
                protected function populate(int $activity_id, &$activity)
                {
                        if($activity == null)
@@ -252,4 +434,4 @@
                                }
                        }
                }
-       }
\ No newline at end of file
+       }

Modified: 
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
    2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
    2012-10-30 07:43:54 UTC (rev 10373)
@@ -43,36 +43,82 @@
                        $this->local_db = clone $this->db;
                }
 
-               protected function add(&$object)
+               protected function add(&$resource_alloc)
                {
+                       $cols = array(
+                               'requirement_id',
+                               'resource_id',
+                               'location_id',
+                               'create_user',
+                               'create_date'
+                       );
 
+                       $values = array(
+                               
$this->marshal($resource_alloc->get_requirement_id(), 'int'),
+                               
$this->marshal($resource_alloc->get_resource_id(), 'int'),
+                               
$this->marshal($resource_alloc->get_location_id(), 'int'),
+                               
$this->marshal($resource_alloc->get_create_user(), 'int'),
+                               $this->marshal(strtotime('now'), 'int')
+                       );
+
+                       $sql = 'INSERT INTO lg_requirement_resource_allocation 
(' . join(',', $cols) . ') VALUES (' . join(',', $values) . ')';
+                       $result = $this->db->query($sql, __LINE__,__FILE__);
+
+                       if($result)
+                       {
+                               return 
$this->db->get_last_insert_id('lg_requirement_resource_allocation', 'id');
+                       }
+                       else
+                       {
+                               return 0;
+                       }
                }
 
+               protected function update($resource_alloc)
+               {
+                       $id = intval($resource_alloc->get_id());
+               
+                       $values = array(
+                               'requirement_id=' . 
$this->marshal($resource_alloc->get_requirement_id(), 'string'),
+                               'resource_id=' . 
$this->marshal($resource_alloc->get_resource_id(), 'string'),
+                               'location_id=' . 
$this->marshal($resource_alloc->get_location_id(), 'int')
+                       );
+
+                       $result = $this->db->query('UPDATE 
lg_requirement_resource_allocation SET ' . join(',', $values) . " WHERE 
id=$id", __LINE__,__FILE__);
+
+                       if($result)
+                       {
+                               return $id;
+                       }
+                       else
+                       {
+                               return 0;
+                       }
+               }
+
                protected function get_id_field_name()
                {
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 
'lg_requirement_resource_allocation', // alias
+                                       'field'                 => 'id',
+                                       'translated'    => 'id'
+                               );
+                       }
 
+                       return $ret;
                }
 
                protected function get_query(string $sort_field, boolean 
$ascending, string $search_for, string $search_type, array $filters, boolean 
$return_count)
                {
                        $clauses = array('1=1');
 
-                       /*if($search_for)
-                       {
-                               $like_pattern = "'%" . 
$this->db->db_addslashes($search_for) . "%'";
-                               $like_clauses = array();
-                               switch($search_type)
-                               {
-                                       default:
-                                               $like_clauses[] = 
"{$table_alias}.name $this->like $like_pattern";
-                                               break;
-                               }
-                               if(count($like_clauses))
-                               {
-                                       $clauses[] = '(' . join(' OR ', 
$like_clauses) . ')';
-                               }
-                       }*/
-
                        $filter_clauses = array();
                        if(isset($filters[$this->get_id_field_name()]))
                        {
@@ -94,11 +140,10 @@
 
                        $condition =  join(' AND ', $clauses);
 
-                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_procedure.control_area_id = controller_control_area.id)";
 
                        $tables = "lg_requirement_resource_allocation 
allocation";
 
-                       if($return_count) // We should only return a count
+                       if($return_count)
                        {
                                $cols = 'COUNT(DISTINCT(allocation.id)) AS 
count';
                        }
@@ -127,11 +172,6 @@
                        return $allocation;
                }
 
-               protected function update($object)
-               {
-
-               }
-
                public static function get_instance()
                {
                        if (self::$so == null)

Modified: branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php   
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php   
2012-10-30 07:43:54 UTC (rev 10373)
@@ -38,12 +38,13 @@
                private $so;
                private $so_project;
                public $public_functions = array(
-                       'query' => true,
-                       'add'   => true,
-                       'edit'  => true,
-                       'view'  => true,
-                       'index' => true,
-                       'save'  => true
+                       'query'                 => true,
+                       'add'                   => true,
+                       'edit'                  => true,
+                       'view'                  => true,
+                       'index'                 => true,
+                       'save'                  => true,
+                       'edit_favorite' => true
                );
 
                public function __construct()
@@ -97,7 +98,7 @@
                                        ),
                                ),
                                'datatable' => array(
-                                       'source' => 
self::link(array('menuaction' => 'logistic.uiactivity.index', 'phpgw_return_as' 
=> 'json')),
+                                       'source' => 
self::link(array('menuaction' => 'logistic.uiactivity.index', 'phpgw_return_as' 
=> 'json', 'filter' => phpgw::get_var('filter', 'int'))),
                                        'field' => array(
                                                array(
                                                        'key' => 'name',
@@ -189,27 +190,17 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
-                       $data['datatable']['actions'][] = array
+                               $data['datatable']['actions'][] = array
                                        (
-                                               'my_name'               => 
'new_allocation',
-                                               'text'                  => 
lang('t_new_allocation'),
+                                               'my_name'               => 
'add_favorite',
+                                               'text'                  => 
lang('toggle as favorite'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'    => 
'logistic.uiallocation.edit'
+                                                       'menuaction'    => 
'logistic.uiactivity.edit_favorite'
                                                )),
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
-                       $data['datatable']['actions'][] = array
-                                       (
-                                               'my_name'               => 
'view_allocations',
-                                               'text'                  => 
lang('t_view_allocations'),
-                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
-                                               (
-                                                       'menuaction'    => 
'logistic.uiallocation.index'
-                                               )),
-                                               'parameters'    => 
json_encode($parameters)
-                                       );
 
                        self::render_template_xsl(array('datatable_common'), 
$data);
                }
@@ -246,7 +237,6 @@
                        $result_count = 0;
 
                        //Retrieve a contract identifier and load corresponding 
contract
-                       //$activity_id = phpgw::get_var('activity_id');
 
                        $exp_param = phpgw::get_var('export');
                        $export = false;
@@ -263,7 +253,7 @@
                        {
                                default: // ... all activities, filters (active 
and vacant)
                                        phpgwapi_cache::session_set('logistic', 
'activity_query', $search_for);
-                                       $filters = array('project' => 
phpgw::get_var('project'), 'user' => phpgw::get_var('user'));
+                                       $filters = array('project' => 
phpgw::get_var('project'), 'user' => phpgw::get_var('user'), 'activity' => 
phpgw::get_var('filter', 'int'));
                                        $result_objects = 
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending, 
$search_for, $search_type, $filters);
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
                                        break;
@@ -441,6 +431,39 @@
                        }
                }
 
+               public function edit_favorite()
+               {
+                       if($activity_id = phpgw::get_var('activity_id'))
+                       {
+                               $activity = $this->so->get_single($activity_id);
+
+                               
if(isset($GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
 && $GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
+                               {
+                                       $menu_favorites = 
$GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'];
+                               }
+                               else
+                               {
+                                       $menu_favorites = array();
+                               }
+
+                               
if(isset($menu_favorites['activity'][$activity_id]))
+                               {
+                                       
unset($menu_favorites['activity'][$activity_id]);
+                               }
+                               else
+                               {
+                                       
$menu_favorites['activity'][$activity_id] = $activity->get_name();
+                               }
+
+                               $GLOBALS['phpgw']->preferences->account_id = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                               $GLOBALS['phpgw']->preferences->read();
+                               
$GLOBALS['phpgw']->preferences->add('logistic','menu_favorites',$menu_favorites,'user');
+                               
$GLOBALS['phpgw']->preferences->save_repository();
+                               execMethod('phpgwapi.menu.clear');
+                       }
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uiactivity.index'));     
+               }
+
                private function get_user_array()
                {
                        $user_array = array();
@@ -456,4 +479,4 @@
 
                        return $user_array;
                }
-       }
\ No newline at end of file
+       }

Modified: branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php        
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php        
2012-10-30 07:43:54 UTC (rev 10373)
@@ -271,7 +271,7 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
-                       self::render_template_xsl('datatable_common', $data);
+                       self::render_template_xsl( 
'requirement/requirement_overview', $data);
                }
 
                public function view()

Modified: 
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
    2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
    2012-10-30 07:43:54 UTC (rev 10373)
@@ -32,6 +32,7 @@
        include_class('logistic', 'activity', '/inc/model/');
        include_class('logistic', 'requirement', '/inc/model/');
        include_class('logistic', 'requirement_value', '/inc/model/');
+       include_class('logistic', 'requirement_resource_allocation', 
'/inc/model/');
 
 
        class logistic_uirequirement_resource_allocation extends 
phpgwapi_uicommon
@@ -58,37 +59,36 @@
                        'add'   => true,
                        'edit' => true,
                        'view' => true,
-                       'index' => true
+                       'index' => true,
+                       'save' => true
                );
 
                public function __construct()
                {
                        parent::__construct();
 
-                       $this->so = 
createObject('logistic.sorequirement_resource_allocation');
-                 $this->bo                                     = 
CreateObject('property.bolocation',true);
-                       $this->bocommon                         = & 
$this->bo->bocommon;
-
-                       $this->so_activity = 
createObject('logistic.soactivity');
-                       $this->so_requirement = 
createObject('logistic.sorequirement');
+                       $this->so                                               
                        = 
createObject('logistic.sorequirement_resource_allocation');
+                       $this->so_activity                                      
= createObject('logistic.soactivity');
+                       $this->so_requirement                   = 
createObject('logistic.sorequirement');
                        $this->so_requirement_value = 
CreateObject('logistic.sorequirement_value');
+                       
+                 $this->bo                                                     
                        = CreateObject('property.bolocation',true);
+                       $this->bocommon                                         
        = & $this->bo->bocommon;
 
-                       $this->type_id                          = 
$this->bo->type_id;
+                       $this->type_id                                          
        = $this->bo->type_id;
 
-                       $this->start                            = 
$this->bo->start;
-                       $this->query                            = 
$this->bo->query;
-                       $this->sort                                     = 
$this->bo->sort;
-                       $this->order                            = 
$this->bo->order;
-                       $this->filter                           = 
$this->bo->filter;
-                       $this->cat_id                           = 
$this->bo->cat_id;
-                       $this->part_of_town_id          = 
$this->bo->part_of_town_id;
-                       $this->district_id                      = 
$this->bo->district_id;
-                       $this->status                           = 
$this->bo->status;
-                       $this->allrows                          = 
$this->bo->allrows;
-                       $this->lookup                           = 
$this->bo->lookup;
-                       $this->location_code            = 
$this->bo->location_code;
-
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"logistic::project::activity";
+                       $this->start                                            
                = $this->bo->start;
+                       $this->query                                            
                = $this->bo->query;
+                       $this->sort                                             
                        = $this->bo->sort;
+                       $this->order                                            
                = $this->bo->order;
+                       $this->filter                                           
                = $this->bo->filter;
+                       $this->cat_id                                           
                = $this->bo->cat_id;
+                       $this->part_of_town_id                  = 
$this->bo->part_of_town_id;
+                       $this->district_id                                      
= $this->bo->district_id;
+                       $this->status                                           
                = $this->bo->status;
+                       $this->allrows                                          
        = $this->bo->allrows;
+                       $this->lookup                                           
                = $this->bo->lookup;
+                       $this->location_code                            = 
$this->bo->location_code;
                }
 
                public function index()
@@ -134,15 +134,20 @@
                                                        'sortable' => true,
                                                ),
                                                array(
-                                                       'key' => 
'location_code',
-                                                       'label' => 
lang('Location code'),
+                                                       'key' => 
'requirement_id',
+                                                       'label' => 
lang('Requirememnt id'),
                                                        'sortable' => true
                                                ),
                                                array(
-                                                       'key' => 'address',
-                                                       'label' => 
lang('Address'),
-                                                       'sortable' => false
-                                               )
+                                                       'key' => 'location_id',
+                                                       'label' => 
lang('Location id'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'resource_id',
+                                                       'label' => 
lang('Resource id'),
+                                                       'sortable' => true
+                                               ),
                                        )
                                ),
                        );
@@ -152,51 +157,7 @@
 
                public function query()
                {
-/*                     $params = array(
-                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
-                               'query' => phpgw::get_var('query'),
-                               'sort' => phpgw::get_var('sort'),
-                               'dir' => phpgw::get_var('dir'),
-                               'filters' => $filters
-                       );
 
-                 $entity_id                    = phpgw::get_var('entity_id', 
'int');
-                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
-                       $district_id            = phpgw::get_var('district_id', 
'int');
-                       $part_of_town_id        = 
phpgw::get_var('part_of_town_id', 'int');
-                       $control_id                     = 
phpgw::get_var('control_id', 'int');
-                       $results                        = 
phpgw::get_var('results', 'int');
-
-
-                       if(!$entity_id && !$cat_id)
-                       {
-                               $values = array();
-                       }
-                       else
-                       {
-
-                       $entity_id = 3;
-                       $cat_id = 1;
-                               $location_id = 
2295;//$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
-                               //$boentity     = 
CreateObject('property.boentity',false, 'entity');
-                               $boentity       = 
CreateObject('property.boentity',false, 'entity', $entity_id, $cat_id);
-                               $boentity->results = $results;
-                               //$values = 
$boentity->read(array('control_registered' => $control_registered, 'control_id' 
=> $control_id));
-                               $values = $boentity->read();
-                       //}
-
-                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
-
-                       $result_data = array('results' => $values);
-
-                       $result_data['total_records'] = 
$boentity->total_records;
-                       $result_data['start'] = $params['start'];
-                       $result_data['sort'] = $params['sort'];
-                       $result_data['dir'] = $params['dir'];
-
-                       return $this->yui_results($result_data);
- *
- */
                        $params = array(
                                'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
                                'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
@@ -214,14 +175,17 @@
                        {
                                $user_rows_per_page = 10;
                        }
+                       
                        // YUI variables for paging and sorting
                        $start_index = phpgw::get_var('startIndex', 'int');
                        $num_of_objects = phpgw::get_var('results', 'int', 
'GET', $user_rows_per_page);
                        $sort_field = phpgw::get_var('sort');
                        $sort_ascending = phpgw::get_var('dir') == 'desc' ? 
false : true;
+                       
                        // Form variables
                        $search_for = phpgw::get_var('query');
                        $search_type = phpgw::get_var('search_option');
+
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
@@ -236,7 +200,7 @@
 
                        //Retrieve the type of query and perform type specific 
logic
                        $query_type = phpgw::get_var('type');
-                       //var_dump($query_type);
+
                        switch ($query_type)
                        {
                                default: // ... all composites, filters (active 
and vacant)
@@ -244,8 +208,7 @@
                                        $object_count = 
$this->so->get_count($search_for, $search_type, $filters);
                                        break;
                        }
-                       //var_dump($result_objects);
-                       //Create an empty row set
+
                        $rows = array();
                        foreach ($result_objects as $result)
                        {
@@ -281,9 +244,6 @@
 
                public function edit()
                {
-                       $entity_admin_so        = 
CreateObject('property.soadmin_entity');
-                       $entity_so      = CreateObject('property.soentity');
-                       $custom = createObject('phpgwapi.custom_fields');
                        $activity_id = phpgw::get_var('activity_id');
                        $requirement_id = phpgw::get_var('requirement_id');
                        $allocation_id = phpgw::get_var('id');
@@ -292,6 +252,7 @@
                        {
                                $activity = 
$this->so_activity->get_single($activity_id);
                        }
+                       
                        if($requirement_id && is_numeric($requirement_id))
                        {
                                $requirement = 
$this->so_requirement->get_single($requirement_id);
@@ -306,146 +267,103 @@
                                $allocation = new 
logistic_requirement_resource_allocation();
                        }
 
+                       $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
 
-                       if (isset($_POST['save_allocation']))
+                       if($requirement)
                        {
-                               
$allocation->set_requirement_id(phpgw::get_var('requirement_id'));
-                               
$allocation->set_article_id(phpgw::get_var('article_id'));
-                               $allocation->set_type(phpgw::get_var('type'));
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
+                               $entity_arr = explode('.',$loc_arr['location']);
 
-       //                      $allocation_id = $this->so->store($allocation);
+                               $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
 
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id' 
=> $allocation_id));
-                       }
-                       else if (isset($_POST['cancel_allocation']))
-                       {
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id' 
=> $allocation_id));
-                       }
-                       else
-                       {
-                               $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
+                               $criterias_array = array();
+                               
+                               $location_id = $requirement->get_location_id();
+                               
+                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                               $entity_arr = explode('.',$loc_arr['location']);
 
-                               if($requirement)
+                               $entity_id = $entity_arr[2];
+                               $cat_id = $entity_arr[3];
+                               
+                               $criterias_array['location_id'] = $location_id;
+                               $criterias_array['allrows'] = true;
+                               
+                               foreach($requirement_values as 
$requirement_value)
                                {
-                                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
-                                       $entity_arr = 
explode('.',$loc_arr['location']);
-                                       //_debug_array($entity_arr);
-                                       //$entity = 
$entity_admin_so->read_single($entity_arr[2]);
-                                       //$category = 
$entity_admin_so->read_single_category($entity_arr[2],$entity_arr[3]);
-                                       $all_attributes = 
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0, 
'','','',true, true);
-                                       $attributes = array();
-
-                                       $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
-                                       //_debug_array($requirement_values);
-                                       foreach($requirement_values as 
$requirement_value)
+                                       $attrib_value = 
$requirement_value->get_value();
+                                       $operator = 
$requirement_value->get_operator();
+                                       $cust_attribute_id = 
$requirement_value->get_cust_attribute_id();
+                                       
+                                       if($operator == "eq")
                                        {
-                                               foreach ($all_attributes as 
&$attr)
-                                               {
-                                                       if($attr['id'] == 
$requirement_value->get_cust_attribute_id())
-                                                       {
-                                                               
$attr['req_value'] = $requirement_value->get_value();
-                                                               $attr['op'] = 
$requirement_value->get_operator();
-                                                               $attributes[] = 
$attr;
-                                                       }
-                                               }
+                                               $operator_str = "=";
                                        }
-
-                                       //_debug_array($attributes);
-                                       $items = 
$entity_so->read(array('allrows' => true, 'entity_id' => $entity_arr[2], 
'cat_id' => $entity_arr[3]));
-                                       //_debug_array($items);
-                                       $list_items = array();
-                                       for($index=0; 
$index<count($attributes); $index++)
+                                       else if($operator == "lt")
                                        {
-                                               $curr_attr = 
$attributes[$index];
-                                               $column_name = 
$curr_attr['column_name'];
-                                               if($curr_attr['choice'] && 
count($curr_attr['choice'])>0)
-                                               {
-                                                       $curr_choice = 
$curr_attr['choice'];
-                                                       $curr_attr_req_value = 
$curr_attr['req_value'];
-                                                       foreach ($curr_choice 
as $ch)
-                                                       {
-                                                               $col_val = 
$ch['value'];
-                                                               if($col_val == 
$curr_attr_req_value)
-                                                               {
-                                                                       foreach 
($items as $it)
-                                                                       {
-                                                                               
if($it[$column_name] == $col_val)
-                                                                               
{
-                                                                               
        $list_items[] = $it;
-                                                                               
}
-                                                                       }
-                                                               }
-                                                       }
-                                               }
-                                               else
-                                               {
-                                                       foreach ($items as $it)
-                                                       {
-                                                               
//var_dump($it[$column_name]);
-                                                               
//var_dump($curr_attr['op']);
-                                                               
//var_dump($it[$column_name]);
-                                                               $operator = 
$curr_attr['op'];
-                                                               if($operator)
-                                                               {
-                                                                       
var_dump($operator);
-                                                                       
var_dump($it[$column_name]);
-                                                                       
var_dump($col_val);
-                                                                       
if($operator == "eq")
-                                                                       {
-                                                                               
if($it[$column_name] == $col_val)
-                                                                               
{
-                                                                               
        $list_items[] = $it;
-                                                                               
}
-                                                                       }
-                                                                       else 
if($operator == 'gt')
-                                                                       {
-                                                                               
if(is_numeric($it[$column_name]) && $it[$column_name] > $col_val)
-                                                                               
{
-                                                                               
        $list_items[] = $it;
-                                                                               
}
-                                                                       }
-                                                                       else 
if($operator == 'lt')
-                                                                       {
-                                                                               
if(is_numeric($it[$column_name]) && $it[$column_name] < $col_val)
-                                                                               
{
-                                                                               
        $list_items[] = $it;
-                                                                               
}
-                                                                       }
-                                                               }
-/*                                                             
if($it[$column_name] == $col_val)
-                                                               {
-                                                                       
$list_items[] = $it;
-                                                               } */
-                                                       }
-
-                                                       
//var_dump($curr_attr[$column_name]);
-                                               }
+                                               $operator_str = "<";
                                        }
-                               }
+                                       else if($operator == "gt")
+                                       {
+                                               $operator_str = ">";
+                                       }
+                                       
+                                       $criteria_str = $column_name . " " . 
$operator_str . " " . $attrib_value;
 
-                               //_debug_array($list_items);
-
-                               $data = array
-                               (
-                                       'editable' => true,
-                               );
-
-                               if($activity_id > 0)
-                               {
-                                       $data['activity'] = $activity;
+                                       $condition = array(
+                                               'operator'              => 
$operator_str,
+                                               'value'                         
=> $attrib_value,
+                                               'attribute_id' => 
$cust_attribute_id
+                                       );
+                                       
+                                       $criterias_array['conditions'][] = 
$condition;
                                }
-                               //if($requirement_id > 0)
-                               //{
-                                       $data['requirement'] = $requirement;
-                               //}
-                               $data['requirement_value'] = $requirement_value;
-                               $data['attributes'] = $attributes;
-                               $data['elements'] = $list_items;
-
-                               
self::render_template_xsl(array('allocation/allocation_item'), $data);
                        }
+                   
+                       $so_entity      = 
CreateObject('property.soentity',$entity_id,$cat_id);
+                       $allocation_suggestions = 
$so_entity->get_eav_list($criterias_array);
+
+                       print_r($allocation_suggestions);
+                       
+                       $data = array
+                       (
+                               'requirement'                                   
        => $requirement,
+                               'activity'                                      
                        => $activity,
+                               'allocation_suggestions'        => 
$allocation_suggestions,
+                               'editable'                                      
                        => true
+                       );
+               
+                       
self::render_template_xsl(array('allocation/allocation_suggestions'), $data);
                }
 
+               public function save()
+               {
+                       $requirement_id = phpgw::get_var('requirement_id');
+                       
+                       if($requirement_id && is_numeric($requirement_id))
+                       {
+                               $requirement = 
$this->so_requirement->get_single($requirement_id);
+                       }
+                       
+                       $chosen_resources = phpgw::get_var('chosen_resources');
+                       
+                       $user_id = $GLOBALS['phpgw_info']['user']['id'];
+                       
+                       foreach($chosen_resources as $resource_id)
+                       {
+                               $resource_alloc = new 
logistic_requirement_resource_allocation();
+                               $resource_alloc->set_requirement_id( 
$requirement->get_id() );
+                               $resource_alloc->set_resource_id( $resource_id 
);
+                               $resource_alloc->set_location_id( 
$requirement->get_location_id() );
+                               $resource_alloc->set_create_user( $user_id );
+                               
+                               $resource_alloc_id = $this->so->store( 
$resource_alloc );
+                       }
+                       
+
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id' 
=> $allocation_id));
+               }
+               
                function convert_to_array($object_list)
                {
                        $converted_array = array();

Modified: 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
        2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
        2012-10-30 07:43:54 UTC (rev 10373)
@@ -33,10 +33,11 @@
        {
                public static $so;
 
-               protected static $id;
-               protected static $requirement_id;
-               protected static $resource_id;
-               protected static $location_id;
+               protected $id;
+               protected $requirement_id;
+               protected $resource_id;
+               protected $location_id;
+               protected $create_user;
 
                /**
                 * Constructor.  Takes an optional ID.  If a contract is 
created from outside
@@ -88,7 +89,17 @@
                {
                        return $this->location_id;
                }
+               
+               public function set_create_user($create_user)
+               {
+                       $this->create_user = $create_user;
+               }
 
+               public function get_create_user()
+               {
+                       return $this->create_user;
+               }
+
                /**
                * Get a static reference to the storage object associated with 
this model object
                *
@@ -105,23 +116,11 @@
 
                public function serialize()
                {
-                       $entity_so      = 
CreateObject('property.soadmin_entity');
-                       $project_so = CreateObject('logistic.soproject');
-                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($this->get_location_id());
-                       $entity_arr = explode('.',$loc_arr['location']);
-
-                       $entity = $entity_so->read_single($entity_arr[2]);
-                       $category = 
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
-                       $entity_label = $entity['name'];
-                       $category_label = $category['name'];
-                       $project_type_label  = 
$project_so->get_project_type_label($this->get_project_type_id());
-
                        return array(
                                'id' => $this->get_id(),
-                               'location_id' => $this->get_location_id(),
-                               'entity_label' => $entity_label,
-                               'category_label' => $category_label,
-                               'project_type_label' => $project_type_label
+                               'requirement_id' => $this->get_requirement_id(),
+                               'resource_id' => $this->get_resource_id(),
+                               'location_id' => $this->get_location_id()
                        );
                }
        }
\ No newline at end of file

Modified: branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/logistic/setup/phpgw_no.lang    2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/setup/phpgw_no.lang    2012-10-30 
07:43:54 UTC (rev 10373)
@@ -61,4 +61,6 @@
 error_msg_2    logistic        no      Vennligst velg en verdi i listen
 error_msg_3    logistic        no      Vennligst angi sluttdato etter startdato
 Criterias      logistic        no      Kriterier
-Add criterias  logistic        no      Legg til kriterier
\ No newline at end of file
+Add criterias  logistic        no      Legg til kriterier
+favorites      logistic        no      Favoritter
+toggle as favorite     logistic        no      Legg til / fjern som favoritt

Deleted: 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
===================================================================
--- 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
  2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
  2012-10-30 07:43:54 UTC (rev 10373)
@@ -1,87 +0,0 @@
-<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
-<!-- item  -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl";>
-<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
-
-<xsl:call-template name="yui_phpgw_i18n"/>
-<div class="yui-navset yui-navset-top">
-       <div style="clear: both;margin-bottom: 0;overflow: hidden;padding: 
1em;" class="identifier-header">
-               <xsl:choose>
-                       <xsl:when test="activity/id != '' or activity/id != 0">
-                               <h1 style="float:left;">
-                                       <span>
-                                               <xsl:value-of 
select="php:function('lang', 'Add resources to activity')"/>: <xsl:value-of 
select="activity/name"/>
-                                       </span>
-                               </h1>
-                       </xsl:when>
-                       <xsl:otherwise>
-                               <h1 style="float:left;">
-                                       <xsl:value-of 
select="php:function('lang', 'Add requirement')" />
-                               </h1>
-                       </xsl:otherwise>
-               </xsl:choose>
-       </div>
-
-       <div class="yui-content" style="padding: 20px;">
-               <div id="details">
-                       <form action="#" method="post">
-                               <input type="hidden" name="id" value = 
"{activity/id}" />
-
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label 
for="start_date">Startdato</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="end_date">Sluttdato</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="no_of_items">Antall</label>
-                                       </dt>
-                                       <dd>
-                                               <span><xsl:value-of 
select="requirement/no_of_items" /></span>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="bim_item">ELEMENTER</label>
-                                       </dt>
-                                       <dd>
-                                               <xsl:for-each select="elements">
-                                                       <input type="checkbox" 
value="{id}" /> <xsl:value-of select="location_code" /> - <xsl:value-of 
select="type" /><br/>
-                                               </xsl:for-each>
-                                       </dd>
-                               </dl>
-
-                               <div class="form-buttons">
-                                       <xsl:choose>
-                                               <xsl:when test="editable">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_activity" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_activity" value="{$lang_cancel}" title = "{$lang_cancel}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="edit_activity" value="{$lang_edit}" title = "{$lang_edit}" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                               </div>
-                       </form>
-               </div>
-       </div>
-</div>
-</xsl:template>
-
-<xsl:template match="options">
-       <option value="{id}">
-               <xsl:if test="selected">
-                       <xsl:attribute name="selected" value="selected" />
-               </xsl:if>
-               <xsl:value-of disable-output-escaping="yes" select="name"/>
-       </option>
-</xsl:template>

Copied: 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_suggestions.xsl
 (from rev 10372, 
trunk/logistic/templates/base/allocation/allocation_suggestions.xsl)
===================================================================
--- 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_suggestions.xsl
                           (rev 0)
+++ 
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_suggestions.xsl
   2012-10-30 07:43:54 UTC (rev 10373)
@@ -0,0 +1,72 @@
+<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
+<!-- item  -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+<xsl:variable name="date_format"><xsl:value-of 
select="php:function('get_phpgw_info', 
'user|preferences|common|dateformat')"/></xsl:variable>
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div id="resource-allocation" class="yui-navset yui-navset-top">
+       <h1>
+               <xsl:value-of select="php:function('lang', 'Add resources to 
activity')"/>: <xsl:value-of select="activity/name"/>
+       </h1>
+       
+       <div class="content-wrp">
+               
+               <div id="requirement-wrp">
+               
+               <h2>Krav til aktiviteten</h2>
+               
+                       <ul>
+                               <li>
+                                       <label 
for="start_date">Startdato</label><span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/start_date))"/></span>
+                               </li>
+                               <li>
+                                       <label for="end_date">Sluttdato</label>
+                                       <span><xsl:value-of 
select="php:function('date', $date_format, 
number(requirement/end_date))"/></span>
+                               </li>
+                               <li>
+                                       <label for="no_of_items">Antall</label>
+                                       <span><xsl:value-of 
select="requirement/no_of_items" /></span>
+                               </li>
+                               </ul>
+                       </div>
+                       
+                       <xsl:variable name="action_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:logistic.uirequirement_resource_allocation.save')" />
+                       </xsl:variable>
+                       <form action="{$action_url}" method="post">
+                               <input type="hidden" name="requirement_id" 
value="{requirement/id}" />
+
+                               <div id="resource-list">
+                                       <div class="resource heading">
+                                                       <span class="desc">Kort 
beskrivelse</span>
+                                                       <span 
class="loc_id">Lokasjons id</span>
+                                                       <span 
class="type">Type</span>
+                                                       <span 
class="loc_code">Lokasjons kode</span>
+                                       </div>
+                                       <xsl:for-each 
select="allocation_suggestions">
+                                               
+                                               <div>                           
+                                                       <xsl:choose>
+                                                       <xsl:when 
test="(position() mod 2) != 1">
+                                                       <xsl:attribute 
name="class">resource odd</xsl:attribute>
+                                                   </xsl:when>
+                                                   <xsl:otherwise>
+                                                       <xsl:attribute 
name="class">resource even</xsl:attribute>
+                                                   </xsl:otherwise>
+                                                 </xsl:choose>
+                                               
+                                                       <input type="checkbox" 
value="{id}" name="chosen_resources[]" />
+                                                       <span 
class="desc"><xsl:value-of select="short_description" /></span>
+                                                       <span 
class="loc_id"><xsl:value-of select="location_id" /></span>
+                                                       <span 
class="type"><xsl:value-of select="type_lokale" /></span>
+                                                       <span 
class="loc_code"><xsl:value-of select="location_code" /></span>
+                                               </div>
+                                       </xsl:for-each>
+                               </div>                  
+                               
+                               <input type="submit" value="Lagre" />
+                       </form>
+       </div>
+</div>
+</xsl:template>
\ No newline at end of file

Modified: branches/Version-1_0-branch/logistic/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/logistic/templates/base/css/base.css    
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/logistic/templates/base/css/base.css    
2012-10-30 07:43:54 UTC (rev 10373)
@@ -761,9 +761,7 @@
 
 #toolbar {
   display: inline-block;
-  padding: 10px;
-  background-color: #DEEAF8;
-  border: 1px solid #CEE3F9;
+  padding: 10px 0;
 }
 
 #toolbar input[type="text"] {
@@ -2267,4 +2265,59 @@
 
 .yui-navset .content-wrp {
        margin-top: 0;
+}
+
+
+/* REQUIOREMENT RESOUCRCE ALLOCATION */
+
+#requirement-wrp {
+  font-size: 15px;
+  padding: 20px;
+}
+
+#requirement-wrp label{
+  font-size: 16px;
+    
+}
+
+#requirement-wrp h2 {
+    margin: 0 0 15px;
+}
+
+#requirement-wrp ul li{
+       margin:0 0 10px;
+}
+
+#resource-allocation form{
+       margin: 20px;
+       border: 1px solid #B0D9FF;
+}
+
+#resource-list .resource{
+       padding: 5px 0;
+}
+
+#resource-list .resource.odd{
+       background: #fff;
+}
+
+#resource-list .resource span, #resource-list .resource input {
+       vertical-align: middle;
+}
+
+#resource-list .resource span {
+       display: inline-block;
+       width: 200px;
+}
+
+#resource-list .resource span.desc {
+       font-weight:bold;
+       width: 300px;
+}
+
+#resource-list .resource.heading {
+    background: none repeat scroll 0 0 #B0D9FF;
+    color: #092845;
+    font-weight: bold;
+    padding: 5px 8px;
 }
\ No newline at end of file

Copied: 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
 (from rev 10372, 
trunk/logistic/templates/base/requirement/requirement_overview.xsl)
===================================================================
--- 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
                            (rev 0)
+++ 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
    2012-10-30 07:43:54 UTC (rev 10373)
@@ -0,0 +1,55 @@
+<xsl:template  match="data" xmlns:php="http://php.net/xsl";>
+       <xsl:call-template name="yui_phpgw_i18n"/>
+       
+       <div class="content-wrp">
+               
+                 <form action="" name="acl_form" id="acl_form" method="post">
+                               <div id="paging"></div>
+       
+                               <div id="requirement-container"></div>
+
+                               <div id="allocation-container"></div>
+                       </form>
+
+                       <xsl:apply-templates select="datasource-definition"/>
+       </div>
+</xsl:template>
+
+<xsl:template match="datasource-definition">
+       <script>
+       
+       YAHOO.portico.columnDefs = [
+                               <xsl:for-each select="//datatable/field">
+                                       {
+                                               resizeable: true,
+                                               key: "<xsl:value-of 
select="key"/>",
+                                               <xsl:if test="label">
+                                               label: "<xsl:value-of 
select="label"/>",
+                                               </xsl:if>
+                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                               <xsl:if test="hidden">
+                                               hidden: true,
+                                               </xsl:if>
+                                               <xsl:if test="formatter">
+                                               formatter: <xsl:value-of 
select="formatter"/>,
+                                               </xsl:if>
+                                               <xsl:if test="editor">
+                                               editor: <xsl:value-of 
select="editor"/>,
+                                           </xsl:if>
+                                               className: "<xsl:value-of 
select="className"/>"
+                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                               </xsl:for-each>
+                       ];
+                       
+                       YAHOO.portico.dataSourceUrl = '<xsl:value-of 
select="source"/>';
+       
+       
+               YAHOO.portico.inlineTableHelper('requirement-container', 
YAHOO.portico.dataSourceUrl, YAHOO.portico.columnDefs, null, null);
+
+
+               YAHOO.portico.inlineTableHelper('allocation-container', 
YAHOO.portico.dataSourceUrl, YAHOO.portico.columnDefs, null, null);
+       
+       
+
+       </script>
+</xsl:template>
\ No newline at end of file

Modified: 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_values.xsl
===================================================================
--- 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_values.xsl
      2012-10-29 14:42:31 UTC (rev 10372)
+++ 
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_values.xsl
      2012-10-30 07:43:54 UTC (rev 10373)
@@ -93,12 +93,12 @@
                                                                                
                        <xsl:for-each select="cust_attribute/choice">
                                                                                
                                <xsl:choose>
                                                                                
                                        <xsl:when test="value = //attrib_value">
-                                                                               
                                                <option selected='true' 
value="{value}">
+                                                                               
                                                <option selected='true' 
value="{id}">
                                                                                
                                                        <xsl:value-of 
select="value"/>
                                                                                
                                                </option>
                                                                                
                                        </xsl:when>
                                                                                
                                        <xsl:otherwise>
-                                                                               
                                                <option value="{value}">
+                                                                               
                                                <option value="{id}">
                                                                                
                                                        <xsl:value-of 
select="value"/>
                                                                                
                                                </option>
                                                                                
                                        </xsl:otherwise>        
@@ -119,7 +119,7 @@
                                                                        <div 
id="attributes">
                                                                                
<xsl:for-each select="requirement_attributes_array">
                                                                                
<div class="attribute">
-                                                                               
        <label style="margin-left:10px;"><xsl:value-of 
select="cust_attribute/input_text" /></label>
+                                                                               
        <label><xsl:value-of select="cust_attribute/input_text" /></label>
                                                                                
        <xsl:choose>
                                                                                
                <xsl:when test="cust_attribute/column_info/type = 'T'">
                                                                                
                        <span style="margin-left:10px;"><xsl:value-of 
select="attrib_value" /></span>

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2012-10-30 07:43:54 UTC (rev 10373)
@@ -77,6 +77,8 @@
                protected $_total_records = 0;
 
                protected $global_lock = false;
+               
+               protected $attribute_group_tree = array();
 
                /**
                 * Constructor
@@ -172,17 +174,24 @@
                        (
                                'location_id'   => $location_id,
                                'id'                    => 0,
-                               'name'  => 
$this->_db->db_addslashes(strtolower($group['group_name'])),
-                               'descr' => 
$this->_db->db_addslashes($group['descr']),
-                               'remark'        => 
$this->_db->db_addslashes($group['remark']),
+                               'name'                  => 
$this->_db->db_addslashes(strtolower($group['group_name'])),
+                               'descr'                 => 
$this->_db->db_addslashes($group['descr']),
+                               'remark'                => 
$this->_db->db_addslashes($group['remark']),
                                'group_sort'    => 0,
+                               'parent_id'             => $group['parent_id']
                        );
 
+                       $filter_parent = '';
+                       if($group['parent_id'])
+                       {
+                               $filter_parent = ' AND parent_id = ' . (int) 
$group['parent_id'];
+                       }
 
                        unset($group);
 
                        $this->_db->transaction_begin();
 
+/*
                        $sql = "SELECT id FROM phpgw_cust_attribute_group"
                                . " WHERE location_id = 
{$values['location_id']}"
                                        . " AND name = '{$values['name']}'";
@@ -191,14 +200,22 @@
                        {
                                return -1;
                        }
-
-                       $sql = 'SELECT MAX(group_sort) AS max_sort, MAX(id) AS 
current_id'
+*/
+                       
+                       $sql = 'SELECT MAX(id) AS current_id'
                                . ' FROM phpgw_cust_attribute_group '
                                . " WHERE location_id 
='{$values['location_id']}'";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        $this->_db->next_record();
+                       $values['id']   = $this->_db->f('current_id') + 1;      
        
+
+                       $sql = 'SELECT MAX(group_sort) AS max_sort'
+                               . ' FROM phpgw_cust_attribute_group '
+                               . " WHERE location_id 
='{$values['location_id']}'{$filter_parent}";
+
+                       $this->_db->query($sql, __LINE__, __FILE__);
+                       $this->_db->next_record();
                        $values['group_sort']   = $this->_db->f('max_sort') + 1;
-                       $values['id']   = $this->_db->f('current_id') + 1;      
        
                        
                        $cols = implode(', ', array_keys($values));
                        $vals = $this->_db->validate_insert($values);
@@ -625,7 +642,8 @@
                        (
                                'name'          => 
$this->_db->db_addslashes($group['group_name']),
                                'descr'         => 
$this->_db->db_addslashes($group['descr']),
-                               'remark'        => 
$this->_db->db_addslashes($group['remark'])
+                               'remark'        => 
$this->_db->db_addslashes($group['remark']),
+                               'parent_id'     => $group['parent_id']
                        );
 
                        $value_set      = 
$this->_db->validate_update($value_set);
@@ -850,8 +868,49 @@
                                }
 
                                $attrib['column_info']['type']  = 
$this->_translate_datatype_insert($attrib['column_info']['type']);
+                               
+                               $incompatible_char_types = array
+                               (
+                                       'int'           => true,
+                                       'decimal'       => true,
+                                       'timestamp'     => true
+                               );
+
                                if($attrib_table)
                                {
+                                       $incompatible_type = false;
+                                       $OldDataType = 
$this->_translate_datatype_insert($OldDataType);
+                                       
+                                       if ($OldDataType == 'varchar' && 
isset($incompatible_char_types[$attrib['column_info']['type']]) && 
$incompatible_char_types[$attrib['column_info']['type']])
+                                       {
+                                               $incompatible_type = true;
+                                       }
+                                       else if ($OldDataType == 'char' && 
isset($incompatible_char_types[$attrib['column_info']['type']]) && 
$incompatible_char_types[$attrib['column_info']['type']])
+                                       {
+                                               $incompatible_type = true;
+                                       }
+                                       else if ($OldDataType == 'text' && 
isset($incompatible_char_types[$attrib['column_info']['type']]) && 
$incompatible_char_types[$attrib['column_info']['type']])
+                                       {
+                                               $incompatible_type = true;
+                                       }
+
+                                       if($incompatible_type)
+                                       {
+                                               $metadata = 
$this->_db->metadata($attrib_table);
+
+                                               $found_column = true;
+                                               $i = 0;
+                                               do
+                                               {
+                                                       $backup_column_name = 
"{$attrib['column_name']}_backup_{$i}";
+                                                       $i++;
+                                               }
+                                               while 
(isset($metadata[$backup_column_name]));
+                                               
+                                               
$this->_oProc->RenameColumn($attrib_table,$attrib['column_name'], 
$backup_column_name);
+                                               
$this->_oProc->AddColumn($attrib_table, $attrib['column_name'], 
$attrib['column_info']);
+                                       }
+                                       
                                        
$this->_oProc->AlterColumn($attrib_table,$attrib['column_name'],$attrib['column_info']);
                                }
                        }
@@ -945,11 +1004,32 @@
                                $order = 'attrib_sort', $allrows = false, 
$inc_choices = false, $filter = array())
                {
                        $location_id    = 
$GLOBALS['phpgw']->locations->get_id($appname, $location);
+                       return $this->find2($location_id, $start, $query, 
$sort, $order, $allrows, $inc_choices, $filter);
+               }
+
+               /**
+                * Get a list of attributes
+                *
+                * @param integer $location_id   the system location
+                * @param integer $start
+                * @param string query
+                * @param string $sort
+                * @param string $order
+                * @param bool   $allrows
+                * @param bool   $inc_choices
+                * @param array $filtermethod
+                *
+                * @return array attributes at location
+                */
+
+               public function find2($location_id, $start = 0, $query = '', 
$sort = 'ASC',
+                               $order = 'attrib_sort', $allrows = false, 
$inc_choices = false, $filter = array())
+               {
+                       $location_id    = (int) $location_id;
                        $start                  = (int) $start;
                        $query                  = 
$this->_db->db_addslashes($query);
                        $order                  = 
$this->_db->db_addslashes($order);
                        $allrows                = !!$allrows;
-
                        
                        $filtermethod   = '';
                        if ($filter && is_array($filter))
@@ -1080,6 +1160,8 @@
 
                        return $attribs;
                }
+
+
                /**
                 * Get a list of groups availlable for attributes within a 
location
                 *
@@ -1093,6 +1175,7 @@
                 *
                 * @return ???? something
                 */
+
                public function find_group($appname, $location, $start = 0, 
$query = '', $sort = 'ASC',
                                $order = 'group_sort', $allrows = false)
                {
@@ -1119,45 +1202,107 @@
                                $querymethod = "AND 
(phpgw_cust_attribute_group.name {$this->_like} '%{$query}%'";
                        }
 
-                       $sql = "FROM phpgw_cust_attribute_group "
-                               . " WHERE location_id = {$location_id} 
{$querymethod}";
+                       $sql = "SELECT * FROM phpgw_cust_attribute_group "
+                               . " WHERE location_id = {$location_id} AND 
(parent_id = 0 OR parent_id IS NULL) {$querymethod} {$ordermethod}";
 
-                       $this->_total_records = 0;
-                       $this->_db->query("SELECT COUNT(*) AS cnt_rec 
{$sql}",__LINE__,__FILE__);
-                       if ( !$this->_db->next_record() )
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $this->attribute_group_tree = array();
+                       while ($this->_db->next_record())
                        {
-                               return array();
+                               $id                     = $this->_db->f('id');
+                               $group_sort = (int) $this->_db->f('group_sort');
+                               $groups[$id] = array
+                               (
+                                       'id'                            => $id,
+                                       'name'                          => 
$this->_db->f('name',true),
+                                       'parent_id'                     => 0,
+                                       'group_sort'            => $group_sort,
+                                       'group_sort_text'       => $group_sort,
+                                       'descr'                         => 
$this->_db->f('descr', true),
+                                       'remark'                        => 
$this->_db->f('remark', true),
+                               );
                        }
 
-                       $this->_total_records = $this->_db->f('cnt_rec');
+                       foreach($groups as $group)
+                       {
+                               $this->attribute_group_tree[] = array
+                               (
+                                       'id'                            => 
$group['id'],
+                                       'name'                          => 
$group['name'],
+                                       'parent_id'                     => 0,
+                                       'level'                         => 0,
+                                       'group_sort'            => 
$group['group_sort'],
+                                       'group_sort_text'       => 
$group['group_sort'],
+                                       'descr'                         => 
$group['descr'],
+                                       'remark'                        => 
$group['remark'],
+                               );
+                               
$this->get_attribute_group_children($location_id, 
$group['id'],$group['group_sort'], 1, false);
+                       }
 
-                       $sql = "SELECT * {$sql} {$ordermethod}";
+                       $this->_total_records = 
count($this->attribute_group_tree);
+                       $result = $this->attribute_group_tree;
 
-                       if ( $allrows )
+                       if($this->total_records == 0)
                        {
-                               $this->_db->query($sql, __LINE__, __FILE__);
+                               return $result;
                        }
+
+                       if(!$allrows)
+                       {
+                               $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) ? 
(int) $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']:15;
+
+                               $page = ceil( ( $start / $this->total_records ) 
* ($this->total_records/ $num_rows) );
+
+                               $out = array_chunk($result, $num_rows);
+
+                               return $out[$page];
+                       }
                        else
                        {
-                               $this->_db->limit_query($sql, $start, __LINE__, 
__FILE__);
+                               return $result;
                        }
 
-                       $attrib_groups = array();
-                       while ( $this->_db->next_record() )
+                       return $this->attribute_group_tree;
+               }
+
+
+               function get_attribute_group_children($location_id, $parent, 
$parent_sort, $level, $reset = false)
+               {
+                       if($reset)
                        {
-                               $attrib_groups[] = array
+                               $this->attribute_group_tree = array();
+                       }
+
+                       $filtermethod = 'WHERE location_id =' . 
(int)$location_id;                      
+
+                       $db = clone($this->_db);
+                       $sql = "SELECT * FROM phpgw_cust_attribute_group 
$filtermethod AND parent_id = {$parent} ORDER BY group_sort ASC";
+
+                       $db->query($sql,__LINE__,__FILE__);
+
+                       while ($db->next_record())
+                       {
+                               $id                                     = 
$db->f('id');
+                               $group_sort                     = 
$db->f('group_sort');
+                               $group_sort_text        = $parent_sort ? 
"{$parent_sort}::{$group_sort}" : $group_sort;
+                               $this->attribute_group_tree[] = array
                                (
-                                       'id'                            => 
$this->_db->f('id'),
-                                       'group_sort'            => (int) 
$this->_db->f('group_sort'),
-                                       'name'                          => 
$this->_db->f('name', true),
-                                       'descr'                         => 
$this->_db->f('descr', true),
-                                       'remark'                        => 
$this->_db->f('remark', true)
+                                       'id'                            => $id,
+                                       'name'                          => 
str_repeat('..',$level).$db->f('name'),
+                                       'parent_id'                     => 
$db->f('parent_id'),
+                                       'level'                         => 
$level,
+                                       'group_sort'            => $group_sort,
+                                       'group_sort_text'       => 
$group_sort_text,
+                                       'descr'                         => 
$db->f('descr'),
+                                       'remark'                        => 
$db->f('remark'),
                                );
+                               
$this->get_attribute_group_children($location_id, $id, $group_sort_text, 
$level+1);
                        }
+                       return $this->attribute_group_tree;
+               } 
 
-                       return $attrib_groups;
-               }
-
                /**
                * Read a single attribute group record
                *
@@ -1187,7 +1332,8 @@
                                'group_name'    => $this->_db->f('name', true),
                                'descr'                 => 
$this->_db->f('descr', true),
                                'remark'                => 
$this->_db->f('remark', true),
-                               'group_sort'    => $this->_db->f('group_sort')
+                               'group_sort'    => $this->_db->f('group_sort'),
+                               'parent_id'             => 
$this->_db->f('parent_id'),
                        );
 
                        return $group;
@@ -1427,14 +1573,24 @@
 
                        $this->_db->transaction_begin();
 
-                       $sql = "SELECT group_sort FROM 
phpgw_cust_attribute_group "
+                       $sql = "SELECT group_sort,parent_id FROM 
phpgw_cust_attribute_group "
                                . " WHERE location_id = {$location_id} AND id = 
{$id}";
                        $this->_db->query($sql, __LINE__, __FILE__);
                        $this->_db->next_record();
                        $attrib_sort    = $this->_db->f('group_sort');
+                       $parent_id              = 
(int)$this->_db->f('parent_id');
+                       if($parent_id)
+                       {
+                               $filter_parent = "AND parent_id = {$parent_id}";
+                       }
+                       else
+                       {
+                               $filter_parent = "AND (parent_id = 0 OR 
parent_id IS NULL)";
+                       }
 
                        $sql = "SELECT MAX(group_sort) AS max_sort FROM 
phpgw_cust_attribute_group "
-                               . " WHERE location_id = {$location_id}";
+                               . " WHERE location_id = {$location_id} 
{$filter_parent}";
+
                        $this->_db->query($sql,__LINE__,__FILE__);
                        $this->_db->next_record();
                        $max_sort       = $this->_db->f('max_sort');
@@ -1467,7 +1623,7 @@
                        }
 
                        $sql = "UPDATE phpgw_cust_attribute_group SET 
group_sort = {$attrib_sort}"
-                               . " WHERE location_id = {$location_id} AND 
group_sort = {$new_sort}";
+                               . " WHERE location_id = {$location_id} AND 
group_sort = {$new_sort} {$filter_parent}";
                        $this->_db->query($sql, __LINE__, __FILE__);
 
                        $sql = "UPDATE phpgw_cust_attribute_group SET 
group_sort = {$new_sort}"

Modified: 
branches/Version-1_0-branch/phpgwapi/inc/class.custom_functions.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_functions.inc.php     
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_functions.inc.php     
2012-10-30 07:43:54 UTC (rev 10373)
@@ -130,6 +130,7 @@
                                'file_name'             => 
$this->_db->db_addslashes($custom_function['custom_function_file']),
                                'descr'                 => 
$this->_db->db_addslashes($custom_function['descr']),
                                'active'                => 
!!$custom_function['active'],
+                               'client_side'   => 
!!$custom_function['client_side'],
                                'custom_sort'   => $custom_sort
                        );
 
@@ -214,9 +215,10 @@
 
                        $values = array
                        (
-                               'descr'         => 
$this->_db->db_addslashes($custom_function['descr']),
-                               'file_name'     => 
$custom_function['custom_function_file'],
-                               'active'        => $custom_function['active']
+                               'descr'                 => 
$this->_db->db_addslashes($custom_function['descr']),
+                               'file_name'             => 
$custom_function['custom_function_file'],
+                               'active'                => 
$custom_function['active'],
+                               'client_side'   => 
$custom_function['client_side'],
                        );
                        unset($custom_function);
 
@@ -313,11 +315,12 @@
                                $id = $this->_db->f('id');
                                $custom_functions[] = array
                                (
-                                       'id'            => $id,
-                                       'file_name'     => 
$this->_db->f('file_name'),
-                                       'sorting'       => 
$this->_db->f('custom_sort'),
-                                       'descr'         => 
$this->_db->f('descr'),
-                                       'active'        => 
!!$this->_db->f('active')
+                                       'id'                    => $id,
+                                       'file_name'             => 
$this->_db->f('file_name'),
+                                       'sorting'               => 
$this->_db->f('custom_sort'),
+                                       'descr'                 => 
$this->_db->f('descr'),
+                                       'active'                => 
!!$this->_db->f('active'),
+                                       'client_side'   => 
!!$this->_db->f('client_side')
                                );
                        }
 
@@ -358,7 +361,8 @@
                                'id'                                    => 
(int)$this->_db->f('id'),
                                'descr'                                 => 
$this->_db->f('descr', true),
                                'custom_function_file'  => 
$this->_db->f('file_name'),
-                               'active'                                => 
!!$this->_db->f('active')
+                               'active'                                => 
!!$this->_db->f('active'),
+                               'client_side'                   => 
!!$this->_db->f('client_side')
                        );
                }
 

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.js.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.js.inc.php   2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.js.inc.php   2012-10-30 
07:43:54 UTC (rev 10373)
@@ -63,7 +63,16 @@
                */
                protected $files = array();
 
+
                /**
+                *
+                * @var array list of "external files to be included in the 
head section of a page
+                * Some times while using libs and such its not fesable to move 
js files to /app/js/package/
+                * because the js files are using relative paths
+                */
+               protected $external_files;
+
+               /**
                * Constructor
                */
                public function __construct()
@@ -171,6 +180,20 @@
                                unset($jsfiles);
                        }
 
+
+                       if ( !empty($this->external_files) && 
is_array($this->external_files) )
+                       {
+                               foreach($this->external_files as $file)
+                               {                                       
+                                       $links .= <<<HTML
+                                       <script type="text/javascript" 
src="{$GLOBALS['phpgw_info']['server']['webserver_url']}/{$file}" >
+
+HTML;
+                               }
+                       }
+
+
+
                        return $links;
                }
 
@@ -277,4 +300,17 @@
                                . '//]]' ."\n"
                                . "</script>\n";
                }
+
+               /**
+                * Adds js file to external files.
+                *
+                * @param string $file Full path to js file relative to root of 
phpgw install 
+                */
+               function add_external_file($file)
+               {
+                       if ( is_file(PHPGW_SERVER_ROOT . "/$file") )
+                       {
+                               $this->external_files[] = $file;
+                       }
+               }
        }

Modified: branches/Version-1_0-branch/phpgwapi/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/setup/setup.inc.php    2012-10-29 
14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/setup/setup.inc.php    2012-10-30 
07:43:54 UTC (rev 10373)
@@ -12,7 +12,7 @@
        // Basic information about this app
        $setup_info['phpgwapi']['name']      = 'phpgwapi';
        $setup_info['phpgwapi']['title']     = 'phpgwapi';
-       $setup_info['phpgwapi']['version']   = '0.9.17.540';
+       $setup_info['phpgwapi']['version']   = '0.9.17.542';
        $setup_info['phpgwapi']['versions']['current_header'] = '1.31';
        $setup_info['phpgwapi']['versions']['system'] = '1.0';
        $setup_info['phpgwapi']['enable']    = 3;

Modified: branches/Version-1_0-branch/phpgwapi/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/setup/tables_current.inc.php   
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/setup/tables_current.inc.php   
2012-10-30 07:43:54 UTC (rev 10373)
@@ -545,6 +545,7 @@
                        (
                                'location_id'   => array('type' => 
'int','precision' => 4,'nullable' => false),
                                'id'                    => array('type' => 
'int','precision' => 4,'nullable' => false),
+                               'parent_id'                     => array('type' 
=> 'int','precision' => 4,'nullable' => true),
                                'name'                  => array('type' => 
'varchar','precision' => 100,'nullable' => false),
                                'group_sort'    => array('type' => 
'int','precision' => 2,'nullable' => false),
                                'descr'                 => array('type' => 
'varchar','precision' => 150,'nullable' => true),
@@ -563,8 +564,8 @@
                                'group_id' => array('type' => 'int','precision' 
=> 2,'nullable' => true, 'default' => 0),
                                'id' => array('type' => 'int','precision' => 
2,'nullable' => false),
                                'column_name' => array('type' => 
'varchar','precision' => 50,'nullable' => false),
-                               'input_text' => array('type' => 
'varchar','precision' => 50,'nullable' => false),
-                               'statustext' => array('type' => 
'varchar','precision' => '150','nullable' => false),
+                               'input_text' => array('type' => 
'varchar','precision' => 255,'nullable' => false),
+                               'statustext' => array('type' => 
'varchar','precision' => '255','nullable' => false),
                                'datatype' => array('type' => 
'varchar','precision' => '10','nullable' => false),
                                'search' => array('type' => 'int','precision' 
=> 2,'nullable' => true),
                                'history' => array('type' => 'int','precision' 
=> 2,'nullable' => true),
@@ -616,6 +617,7 @@
                                'descr' => array('type' => 'text','nullable' => 
true),
                                'file_name' => array('type' => 
'varchar','precision' => 255,'nullable' => false),
                                'active' => array('type' => 'int','precision' 
=> 2,'nullable' => true),
+                               'client_side' => array('type' => 
'int','precision' => 2,'nullable' => true),//otherwise: server-side
                                'custom_sort' => array('type' => 
'int','precision' => 4,'nullable' => true)
                        ),
                        'pk' => array('location_id', 'id'),

Modified: branches/Version-1_0-branch/phpgwapi/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/setup/tables_update.inc.php    
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/phpgwapi/setup/tables_update.inc.php    
2012-10-30 07:43:54 UTC (rev 10373)
@@ -3094,4 +3094,65 @@
                }
        }
 
+       $test[] = '0.9.17.540';
+       /**
+       * Add custom attibute type that allows attribute used as part of short 
description
+       * Add support for clien-side custom functions
+       *
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_540()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
 
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cust_attribute','input_text',array(
+                       'type' => 'varchar',
+                       'precision' => 255,
+                       'nullable' => false,
+               ));
+
+               
$GLOBALS['phpgw_setup']->oProc->AlterColumn('phpgw_cust_attribute','statustext',array(
+                       'type' => 'varchar',
+                       'precision' => 255,
+                       'nullable' => false,
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.541';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+
+       $test[] = '0.9.17.541';
+       /**
+       * Allow groups within groups
+       *
+       * @return string the new version number
+       */
+       function phpgwapi_upgrade0_9_17_541()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cust_attribute_group','parent_id',
 array(
+                       'type' => 'int',
+                       'precision' => 4,
+                       'nullable' => true
+               ));
+
+
+               //otherwise: server-side
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_cust_function','client_side', 
array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => true
+               ));
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['phpgwapi']['currentver'] = 
'0.9.17.542';
+                       return $GLOBALS['setup_info']['phpgwapi']['currentver'];
+               }
+       }
+
+

Modified: branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php       
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php       
2012-10-30 07:43:54 UTC (rev 10373)
@@ -120,7 +120,7 @@
                        $this->type                      = isset( $type ) && 
$type && isset( $this->type_app[$type] ) ? $type : 'entity';
                        $this->cat_id            = isset( $cat_id ) && $cat_id 
? $cat_id : '';
                        $this->entity_id         = isset( $entity_id ) && 
$entity_id ? $entity_id : '';
-                       $this->allrows           = isset( $allrows ) && 
$allrows ? $allrows : '';
+                       $this->allrows           = phpgw::get_var( 'allrows', 
'bool' );
                        $this->so                        = CreateObject( 
'property.soadmin_entity', '', '',
                                                                $this->bocommon 
);
                        $this->so->type          = $this->type;
@@ -538,6 +538,7 @@
 
                function save_custom_function( $custom_function, $action = '' )
                {
+                       $receipt = array();
                        $custom_function['appname'] = 
$this->type_app[$this->type];
                        if ( !$custom_function['location'] && 
$custom_function['entity_id'] && $custom_function['cat_id'] )
                        {
@@ -549,12 +550,27 @@
                                if ( $custom_function['id'] != '' )
                                {
 
-                                       $receipt = 
$GLOBALS['phpgw']->custom_functions->edit( $custom_function );
+                                       $receipt['id'] = $custom_function['id'];
+                                       if( 
$GLOBALS['phpgw']->custom_functions->edit( $custom_function ) )
+                                       {
+                                               $receipt['message'][] = 
array('msg'=>'OK');
+                                       }
+                                       else
+                                       {
+                                               $receipt['error'][] = 
array('msg'=>'Error');
+                                       }
                                }
                        }
                        else
                        {
-                               $receipt = 
$GLOBALS['phpgw']->custom_functions->add( $custom_function );
+                               if($receipt['id'] = 
$GLOBALS['phpgw']->custom_functions->add( $custom_function ) )
+                               {
+                                       $receipt['message'][] = 
array('msg'=>'OK');
+                               }
+                               else
+                               {
+                                       $receipt['error'][] = 
array('msg'=>'Error');
+                               }
                        }
                        return $receipt;
                }
@@ -582,14 +598,14 @@
                        return $this->so->get_path( $entity_id, $node );
                }
 
-               function read_category_tree2( $entity_id )
+               function read_category_tree2( $entity_id, $table )
                {
-                       return $this->so->read_category_tree2( $entity_id );
+                       return $this->so->read_category_tree2( $entity_id, 
$table );
                }
 
-               function get_children2( $entity_id, $parent, $level, $reset = 
false )
+               function get_children2( $entity_id, $parent, $level, $reset = 
false, $table )
                {
-                       return $this->so->get_children2( $entity_id, $parent, 
$level, $reset );
+                       return $this->so->get_children2( $entity_id, $parent, 
$level, $reset, $table );
                }
 
                function convert_to_eav()
@@ -597,4 +613,4 @@
                        return $this->so->convert_to_eav();
                }
 
-       }
\ No newline at end of file
+       }

Modified: branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php       
2012-10-30 07:43:54 UTC (rev 10373)
@@ -477,8 +477,10 @@
                        $entity['descr'] = 
$this->db->db_addslashes($entity['descr']);
 
                        $entity['id'] = 
$this->bocommon->next_id("fm_{$this->type}");
+                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}." . $entity['id'], 
$entity['name'], $this->type_app[$this->type], true);
 
                        $values= array(
+                               $location_id,
                                $entity['id'],
                                $entity['name'],
                                $entity['descr'],
@@ -488,10 +490,9 @@
 
                        $values = $this->db->validate_insert($values);
 
-                       $this->db->query("INSERT INTO fm_{$this->type} 
(id,name, descr,location_form,documentation) "
+                       $this->db->query("INSERT INTO fm_{$this->type} 
(location_id,id,name, descr,location_form,documentation) "
                                . "VALUES ($values)",__LINE__,__FILE__);
 
-                       $GLOBALS['phpgw']->locations->add(".{$this->type}." . 
$entity['id'], $entity['name'], $this->type_app[$this->type], true);
 
                        $receipt['id']= $entity['id'];
 
@@ -539,6 +540,7 @@
                        $values['descr'] = 
$this->db->db_addslashes($values['descr']);
 
                        $values['id'] = $this->bocommon->next_id($table, 
array('entity_id'=>$values['entity_id']));
+                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true);
 
                        if($values['parent_id'])
                        {
@@ -554,6 +556,7 @@
 
                        $values_insert= array
                                (
+                                       $location_id,
                                        $values['entity_id'],
                                        $values['id'],
                                        $values['name'],
@@ -575,7 +578,7 @@
 
                        $values_insert  = 
$this->db->validate_insert($values_insert);
 
-                       $this->db->query("INSERT INTO {$table} 
(entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,jasperupload,parent_id,level
 ) "
+                       $this->db->query("INSERT INTO {$table} 
(location_id,entity_id,id,name, 
descr,prefix,lookup_tenant,tracking,location_level,location_link_level,fileupload,loc_link,start_project,start_ticket,is_eav,jasperupload,parent_id,level
 ) "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);
 
 
@@ -583,7 +586,6 @@
 
                        if($values['is_eav']) // if modelles as eav - we are 
good
                        {
-                               $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true);
                                $values_insert = array
                                (
                                        'location_id'   => $location_id,
@@ -603,7 +605,6 @@
                        
                        
                        // if not eav - we need a table to hold the attributes
-                       $location_id = 
$GLOBALS['phpgw']->locations->add(".{$this->type}.{$values['entity_id']}.{$values['id']}",
 $values['name'],  $this->type_app[$this->type], true, 
"fm_{$this->type}_{$values['entity_id']}_{$values['id']}");
                        $this->init_process();
 
                        $fd = $this->get_default_column_def();

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-10-29 14:42:31 UTC (rev 10372)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-10-30 07:43:54 UTC (rev 10373)
@@ -41,6 +41,7 @@
                var $cols_extra;
                var $cols_return_lookup;
                var $type = 'entity';
+               protected $sql;
 
 
                protected $type_app = array
@@ -156,7 +157,7 @@
                                                $ordermethod = " ORDER BY 
fm_location1.loc1_name {$sort}";  // Don't work with LDAP. 
                                                break;
                                        default:
-                                               $ordermethod = " ORDER BY 
$entity_table.$order $sort";  
+                                               $ordermethod = " ORDER BY 
$entity_table.$order $sort";
                                }
                        }
                        else
@@ -216,6 +217,191 @@
                        return $values;
                }
 
+
+               /**
+                * Method for retreiving sublevels of a hierarchy.
+                * 
+                * @param $data array array holding input parametres
+                * @return array of entities
+                */
+
+               public function get_eav_list($data = array())
+               {
+                       $start                  = isset($data['start']) && 
$data['start'] ? (int)$data['start'] : 0;
+                       $results                = isset($data['results']) && 
$data['results'] ? (int)$data['results'] : 0;
+                       $location_id    = isset($data['location_id']) && 
$data['location_id'] ? (int)$data['location_id'] : 0;
+                       $conditions             = isset($data['conditions']) && 
$data['conditions'] ? $data['conditions'] : array();
+                       $query                  = isset($data['query']) ? 
$data['query'] : '';
+                       $allrows                = isset($data['allrows']) ? 
$data['allrows'] : '';
+
+                       if(!$location_id)
+                       {
+                               return array();
+                       }
+
+                       $_querymethod = array();
+                       $__querymethod = array();
+
+//                     $__querymethod = array("fm_bim_item.id = -1"); // block 
query waiting for conditions
+
+                       $attribute_table = 'phpgw_cust_attribute';
+
+                       foreach ($conditions as $condition)
+                       {
+                               $this->db->query("SELECT * FROM 
phpgw_cust_attribute WHERE location_id = {$location_id} AND id= " . (int) 
$condition['attribute_id']);
+                               $this->db->next_record();
+                               $attribute_name = $this->db->f('column_name');
+
+                               $attributes[$condition['attibute_id']]['name']  
                                        = $attribute_name;
+                               
$attributes[$condition['attibute_id']]['datatype']                              
        = $this->db->f('datatype');
+                               
$attributes[$condition['attibute_id']]['get_list_function']                     
= $this->db->f('get_list_function',true);
+                               
$attributes[$condition['attibute_id']]['get_list_function_input']       = 
$this->db->f('get_list_function_input') ? 
unserialize($this->db->f('get_list_function_input', true)) : '';
+                               
$attributes[$condition['attibute_id']]['get_single_function']           = 
$this->db->f('get_single_function',true);
+                               
$attributes[$condition['attibute_id']]['get_single_function_input']     = 
$this->db->f('get_single_function_input') ? 
unserialize($this->db->f('get_single_function_input', true)) : '';
+
+                               switch ($this->db->f('datatype'))
+                               {
+                                       case 'I':
+                                               switch($condition['operator'])
+                                               {
+                                                       case '=':
+                                                       case 'equal':
+                                                               
$_querymethod[]= "xmlexists('//{$attribute_name}[text() = 
''{$condition['value']}'']' PASSING BY REF xml_representation)";
+                                                               break;
+                                                       case 'gt':
+                                                       case '>':
+                                                               $operator = '>';
+                                                               
$_querymethod[]= "xmlexists('//{$attribute_name}[number() {$operator} 
''{$condition['value']}'']' PASSING BY REF xml_representation)";
+                                                       break;
+                                                       case 'lt':
+                                                       case '<':
+                                                               $operator = '<';
+                                                               
$_querymethod[]= "xmlexists('//{$attribute_name}[number() {$operator} 
''{$condition['value']}'']' PASSING BY REF xml_representation)";
+                                                       break;
+                                                       default:
+                                                               throw new 
Exception('ERROR: Not a valid operator on conditions');
+                                               }
+                                               $__querymethod = array(); // 
remove block
+                                               break;
+                                       case 'CH':
+                                               $__querymethod = array(); // 
remove block
+                                               $_querymethod[]= 
"xmlexists('//{$attribute_name}[contains(.,'',{$condition['value']},'')]' 
PASSING BY REF xml_representation)";
+                                               break;
+                                       default:
+                                               $_querymethod[]= 
"xmlexists('//{$attribute_name}[text() = ''{$condition['value']}'']' PASSING BY 
REF xml_representation)";
+                                               $__querymethod = array(); // 
remove block
+                               }
+                       }
+
+                       $querymethod = '';
+
+                       $where = 'AND';
+                       $_querymethod = array_merge($__querymethod, 
$_querymethod);
+                       if ($_querymethod)
+                       {
+                               $querymethod = " $where (" . implode(' AND 
',$_querymethod) . ')';
+                               unset($_querymethod);
+                       }
+                       $sql = "SELECT id, location_code, p_location_id, p_id, 
xml_representation FROM fm_bim_item WHERE location_id = {$location_id} 
$querymethod";
+
+                       $sql_cnt = "SELECT count(id) as cnt FROM fm_bim_item 
WHERE location_id = {$location_id} $querymethod";
+
+                       $this->db->query($sql_cnt,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       unset($sql_cnt);
+
+                       $this->total_records = $this->db->f('cnt');
+
+                       $ordermethod = '';
+                       if(!$allrows)
+                       {
+                               $this->db->limit_query($sql . $ordermethod, 
$start,__LINE__,__FILE__,$results);
+                       }
+                       else
+                       {
+                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                       }
+
+                       $items = array();
+                       $j=0;
+                       while ($this->db->next_record())
+                       {
+                               $xmldata = $this->db->f('xml_representation');
+
+
+                               $xml = new DOMDocument('1.0', 'utf-8');
+                               $xml->loadXML($xmldata);
+
+                               foreach($attributes as $attrib_id => $field)
+                               {
+                                       if(!$value = 
$xml->getElementsByTagName($field['name'])->item(0)->nodeValue)
+                                       {
+                                               $value = 
$this->db->f($field['name'],true);
+                                       }
+                                       $dataset[$j][$field['name']] = array
+                                       (
+                                               'value'                         
                => $value,
+                                               'datatype'                      
                => $field['datatype'],
+                                               'attrib_id'                     
                => $attrib_id,
+                                               'get_list_function'             
=> $field['get_list_function'],
+                                               'get_list_function_input'       
=> $field['get_list_function_input'],
+                                               'get_single_function'           
=> $field['get_single_function'],
+                                               'get_single_function_input'     
=> $field['get_single_function_input']
+                                       );
+                               }
+
+                               $dataset[$j]['id'] = array
+                                       (
+                                               'value'         => 
$this->db->f('id'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
+                               $dataset[$j]['location_id'] = array
+                                       (
+                                               'value'         => $location_id,
+                                               'datatype'      => false,
+                                               'attrib_id'     => false
+                                       );
+
+                               $dataset[$j]['p_id'] = array
+                                       (
+                                               'value'         => 
$this->db->f('p_id'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
+                               $dataset[$j]['p_location_id'] = array
+                                       (
+                                               'value'         => 
$this->db->f('p_location_id'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
+
+                               $dataset[$j]['location_code'] = array
+                                       (
+                                               'value'         => 
$this->db->f('location_code'),
+                                               'datatype'      => false,
+                                               'attrib_id'     => false,
+                                       );
+
+                               $j++;
+                       }
+
+                       foreach ($dataset as &$entry)
+                       {
+                               $entry['short_description'] = array
+                               (
+                                       'value'         => 
$this->get_short_description(array('location_id' => $location_id, 'id' => 
$entry['id']['value'] ) ),
+                                       'datatype'      => false,
+                                       'attrib_id'     => false,
+                               );
+
+                       }
+
+                       $values = $this->custom->translate_value($dataset, 
$location_id);
+                       return $values;
+               }
+
+
                protected function read_eav($data)
                {
                        $start                  = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
@@ -270,225 +456,16 @@
                        $attribute_table = 'phpgw_cust_attribute';
                        $attribute_filter = " location_id = {$location_id}";
 
-                       $sql = 
'';//$this->bocommon->fm_cache("sql_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
 
-                       if(!$sql)
-                       {
-                               $cols_return_extra      = array();
-                               $cols_return            = array();
-                               $uicols                         = array();
-                               $cols                           = 
"{$entity_table}.*";
 
-                               $cols_return[]                          = 
'location_code';
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 
'location_code';
-                               $uicols['descr'][]                      = 
'dummy';
-                               $uicols['statustext'][]         = 'dummy';
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = true;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = '';
-                               $uicols['classname'][]          = '';
+                       
$this->get_cols($category,$entity_id,$cat_id,$lookup,$location_id);
 
-                               $cols_return[]                          = 'num';
-                               $uicols['input_type'][]         = 'text';
-                               $uicols['name'][]                       = 'num';
-                               $uicols['descr'][]                      = 
lang('ID');
-                               $uicols['statustext'][]         = lang('ID');
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = true;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = $lookup ? '' 
: 'linktToEntity';
-                               $uicols['classname'][]          = '';
 
-                               $cols_return[]                          = 'id';
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 'id';
-                               $uicols['descr'][]                      = false;
-                               $uicols['statustext'][]         = false;
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = false;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = '';
-                               $uicols['classname'][]          = '';
-
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 
'entity_id';
-                               $uicols['descr'][]                      = false;
-                               $uicols['statustext'][]         = false;
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = false;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = '';
-                               $uicols['classname'][]          = '';
-
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 
'cat_id';
-                               $uicols['descr'][]                      = false;
-                               $uicols['statustext'][]         = false;
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = false;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = '';
-                               $uicols['classname'][]          = '';
-
-                               $uicols['input_type'][]         = 'hidden';
-                               $uicols['name'][]                       = 
'_type';
-                               $uicols['descr'][]                      = false;
-                               $uicols['statustext'][]         = false;
-                               $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = '';
-                               $uicols['sortable'][]           = false;
-                               $uicols['exchange'][]           = false;
-                               $uicols['formatter'][]          = '';
-                               $uicols['classname'][]          = '';
-
-                               if($lookup)
-                               {
-                                       $cols .= ',num as entity_num_' . 
$entity_id;
-                                       $cols_return[] = 'entity_num_' . 
$entity_id;
-                                       $uicols['input_type'][]         = 
'hidden';
-                                       $uicols['name'][]                       
= 'entity_num_' . $entity_id;
-                                       $uicols['descr'][]                      
= 'dummy';
-                                       $uicols['statustext'][]         = 
'dummy';
-                                       $uicols['align'][]                      
= '';
-                                       $uicols['datatype'][]           = '';
-                                       $uicols['sortable'][]           = false;
-                                       $uicols['exchange'][]           = false;
-                                       $uicols['formatter'][]          = '';
-                                       $uicols['classname'][]          = '';
-                               }
-
-               //              $cols .= ", {$entity_table}.user_id";
-                               $cols_return[]                          = 
'user_id';
-
-                               $cols_return_extra[]= array
-                               (
-                                       'name'          => 'user_id',
-                                       'datatype'      => 'user'
-                               );
-
-                               // Don't work with LDAP - where phpgw_accounts 
is empty
-                               //                      $joinmethod = " 
$this->join phpgw_accounts ON ($entity_table.user_id = 
phpgw_accounts.account_id))";
-                               //                      $paranthesis ='(';
-
-                               
$this->bocommon->generate_sql(array('entity_table'=>$entity_table,'cols_return'=>$cols_return,'cols'=>$cols,
-                                       
'uicols'=>$uicols,'joinmethod'=>$joinmethod,'paranthesis'=>$paranthesis,'query'=>$query,'lookup'=>$lookup,'location_level'=>$category['location_level']));
-
-
-               //              
$this->bocommon->fm_cache("sql_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}", 
$sql);
-                               
$this->bocommon->fm_cache("uicols_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->uicols);
-                               
$this->bocommon->fm_cache("cols_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_return);
-                               
$this->bocommon->fm_cache("cols_return_lookup_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_return_lookup);
-                               
$this->bocommon->fm_cache("cols_extra_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $this->bocommon->cols_extra);
-                               
$this->bocommon->fm_cache("cols_extra_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}",
 $cols_return_extra);
-
-                               $uicols                                         
= $this->bocommon->uicols;
-                               $cols_return                            = 
$this->bocommon->cols_return;
-                               $this->cols_return_lookup       = 
$this->bocommon->cols_return_lookup;
-                               $this->cols_extra                       = 
$this->bocommon->cols_extra;
-                       }
-                       else
+                       if (!$cat_id > 0)
                        {
-                               $uicols                                         
= 
$this->bocommon->fm_cache("uicols_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
-                               $cols_return                            = 
$this->bocommon->fm_cache("cols_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
-                               $this->cols_return_lookup       = 
$this->bocommon->fm_cache("cols_return_lookup_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
-                               $this->cols_extra                       = 
$this->bocommon->fm_cache("cols_extra_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
-                               $cols_return_extra                      = 
$this->bocommon->fm_cache("cols_extra_return_{$this->type}_{$entity_id}_{$cat_id}_{$lookup}");
-                       }
-
-                       if ($cat_id > 0)
-                       {
-                               //-------------------
-

@@ Diff output truncated at 153600 characters. @@



reply via email to

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