fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10108] Merge 10074:10107 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [10108] Merge 10074:10107 from trunk
Date: Wed, 03 Oct 2012 16:26:02 +0000

Revision: 10108
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10108
Author:   sigurdne
Date:     2012-10-03 16:26:02 +0000 (Wed, 03 Oct 2012)
Log Message:
-----------
Merge 10074:10107 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/hook_home.inc.php
    branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php
    branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
    branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php
    branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
    branches/Version-1_0-branch/logistic/setup/setup.inc.php
    branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
    branches/Version-1_0-branch/logistic/templates/base/activity_item.xsl
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
    branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
    branches/Version-1_0-branch/property/js/yahoo/project.edit.js
    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

Added Paths:
-----------
    branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uibooking.inc.php
    branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
    
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
    branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php
    
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_type.inc.php
    
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php
    branches/Version-1_0-branch/logistic/js/logistic/
    branches/Version-1_0-branch/logistic/setup/tables_update.inc.php

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

Modified: 
branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/activitycalendar/inc/class.uiactivities.inc.php 
2012-10-03 16:26:02 UTC (rev 10108)
@@ -58,7 +58,7 @@
         $this->render('activity_list.php');
 
     }
-       
+
     /**
      * Displays info about one single billing job.
      */
@@ -109,8 +109,8 @@
         $buildings = $this->so_arena->get_buildings();
         // Retrieve the activity object or create a new one
         if(isset($activity_id) && $activity_id > 0)
-        {      
-            $activity = $this->so_activity->get_single($activity_id); 
+        {
+            $activity = $this->so_activity->get_single($activity_id);
         }
         else
         {
@@ -156,8 +156,8 @@
             $keys = array_keys($group_array);
             $local_group = $group_array[$keys[0]];
             //$group_name = $local_group->get_name();
-        }  
         }
+        }
         else
         {
             $groups = $this->so_group->get(null, null, null, null, null, null, 
null);
@@ -228,11 +228,11 @@
                             if(count($group_array) > 0){
                                 $keys = array_keys($group_array);
                                 $group = $group_array[$keys[0]];
-                            } 
+                            }
 
                             $group_info = array();
                             $group_info['name'] = $group->get_name(); //new
-                            $group_info['organization_id'] = 
$activity->get_organization_id(); 
+                            $group_info['organization_id'] = 
$activity->get_organization_id();
                             $group_info['description'] = 
$group->get_description();
 
                             $contacts = 
$this->so_contact->get_local_contact_persons($group->get_id(), true);
@@ -250,7 +250,7 @@
                                 $contact1['group_id'] = $new_group_id;
                                 
$this->so_activity->add_contact_person_group($contact1);
 
-                                $message = lang('messages_saved_form');        
+                                $message = lang('messages_saved_form');
 
                                 //get organization_id for the group:
                                 $group_org_id = 
$this->so_group->get_orgid_from_group($new_group_id);
@@ -280,14 +280,17 @@
                                 $cp1 = $contact_persons[0];
                             }
                         }
-                        $message = lang('messages_saved_form');        
+                        $message = lang('messages_saved_form');
                     }
                     else
                     {
                         $error = lang('messages_form_error');
                     }
 
-                    $activity = $this->so_activity->get_single($activity_id);
+                                                                               
if(isset($activity_id) && $activity_id > 0)
+                                                                               
{
+                                                                               
                $activity = $this->so_activity->get_single($activity_id);
+                                                                               
}
 
                     if($old_state != $new_state && ($new_state == 3 || 
$new_state == 5))
                     {
@@ -304,7 +307,7 @@
                         {
                             
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
                             
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),$subject,$body);
-                        }   
+                        }
                     }
                     $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendar.uiactivities.view', 'id' => 
$activity->get_id(), 'saved_ok' => 'yes'));
                 }
@@ -335,7 +338,7 @@
                                 'cancel_link' => $cancel_link,
                                 'message' => isset($message) ? $message : 
phpgw::get_var('message'),
                                 'error' => isset($error) ? $error : 
phpgw::get_var('error')
-                            )  
+                            )
                     );
                 }
             }
@@ -365,7 +368,7 @@
                     'cancel_link' => $cancel_link,
                     'message' => isset($message) ? $message : 
phpgw::get_var('message'),
                     'error' => isset($error) ? $error : phpgw::get_var('error')
-                )      
+                )
         );
     }
 
@@ -420,7 +423,7 @@
                 $result_objects = 
activitycalendar_soactivity::get_instance()->get($start_index, $num_of_objects, 
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
                 $object_count = 
activitycalendar_soactivity::get_instance()->get_count($search_for, 
$search_type, $filters);
                 break;
-        }                                                                      
                                                                                
                                     
+        }
 
         //Create an empty row set
         $rows = array();
@@ -452,7 +455,7 @@
         if($email)
         {
             //var_dump($mail_rows);
-            $this->send_email_to_selection($mail_rows);        
+            $this->send_email_to_selection($mail_rows);
         }
         else
         {
@@ -503,7 +506,7 @@
                 break;
         }
     }
-    
+
     function send_email_to_selection($activities)
     {
         $c = createobject('phpgwapi.config','activitycalendarfrontend');
@@ -550,7 +553,7 @@
                 
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(),
 true));
 /*                     if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
                         
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
-                else*/ 
+                else*/
                 if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
                     
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(),
 $subject, $body);
             }
@@ -559,26 +562,26 @@
                 
$activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
 /*                     if($activity->get_contact_person_2() && 
$activity->get_contact_person_2()->get_email())
                         
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
-                else*/ 
+                else*/
                 if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
                     
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
             }
         }
-       
+
        //$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
-       
+
     }
-    
+
     public function send_mail()
     {
         $c = createobject('phpgwapi.config','activitycalendarfrontend');
         $c->read();
         $config = $c->config_data;
-               
+
         $mailBaseURL = $c->config_data['mailBaseURL'];
        $activity_id = (int)phpgw::get_var('activity_id');
        $activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
-       
+
        $message_type = phpgw::get_var('message_type');
        if($message_type)
        {
@@ -604,11 +607,11 @@
             $subject = "dette er en test";
             $body = "testmelding fra Aktivitetsoversikt";
        }
-       
+
 //     var_dump($subject);
 //     var_dump($body);
 //     var_dump($activity->get_organization_id() . " ; " . 
$activity->get_group_id());
-       
+
        if($activity->get_group_id() && $activity->get_group_id() > 0)
        {
             //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact2($activity>get_group_id());
@@ -629,11 +632,11 @@
             if($activity->get_contact_person_1() && 
$activity->get_contact_person_1()->get_email())
                 
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(),
 $subject, $body);
        }
-       
+
        $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
-       
+
     }
-    
+
     function send_mailnotification_to_organization($contact_person, $subject, 
$body)
     {
 
@@ -648,7 +651,7 @@
         $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
         //$from = "address@hidden";
 
-        if (strlen(trim($body)) == 0) 
+        if (strlen(trim($body)) == 0)
         {
             return false;
         }
@@ -658,7 +661,7 @@
 
         //var_dump($mailtoAddress);
         //var_dump($mailtoAddress.';'.$from.';'.$subject);
-        if (strlen($mailtoAddress) > 0) 
+        if (strlen($mailtoAddress) > 0)
         {
             try
             {
@@ -681,7 +684,7 @@
             }
         }
     }
-    
+
     function send_mailnotification_to_group($contact_person, $subject, $body)
     {
         if (!is_object($GLOBALS['phpgw']->send))
@@ -694,7 +697,7 @@
         $from = isset($config->config_data['email_sender']) && 
$config->config_data['email_sender'] ? $config->config_data['email_sender'] : 
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
         //$from = "address@hidden";
 
-        if (strlen(trim($body)) == 0) 
+        if (strlen(trim($body)) == 0)
         {
             return false;
         }
@@ -702,7 +705,7 @@
         $mailtoAddress = 
activitycalendar_socontactperson::get_instance()->get_mailaddress_for_group_contact($contact_person->get_id());
         //$mailtoaddress = "address@hidden";
         //var_dump($mailtoAddress.';'.$from.';'.$subject);
-        if (strlen($mailtoAddress) > 0) 
+        if (strlen($mailtoAddress) > 0)
         {
             try
             {
@@ -725,11 +728,11 @@
             }
         }
     }
-       
+
     public function get_organization_groups()
     {
-        $GLOBALS['phpgw_info']['flags']['noheader'] = true; 
-        $GLOBALS['phpgw_info']['flags']['nofooter'] = true; 
+        $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+        $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
         $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
 
         $org_id = phpgw::get_var('orgid');
@@ -746,7 +749,7 @@
                     $selected = "";
                     if($group_id && $group_id > 0)
                     {
-                        $gr_id = (int)$group_id; 
+                        $gr_id = (int)$group_id;
                         if($gr_id == (int)$group->get_id())
                         {
                             $selected_group = " selected='selected'";
@@ -766,7 +769,7 @@
 
         return $returnHTML;
     }
-        
+
     public function create_groups()
     {
         $activities = $this->so_activity->get_activities_without_groups();

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-10-03 16:26:02 UTC (rev 10108)
@@ -354,68 +354,6 @@
                        return null;
                }
        }
-                
-       /**
-        * Get check list objects for a control on a location after specitied 
date
-        *
-        * @param $control_id control id
-        * @param $location_code location code
-        * @return array with check list objects
-        */
-       /* Tror ikke vi bruker denne: Torstein 6/9-2012
-       function get_open_check_lists_for_control($control_id, $location_code, 
$from_date)
-       {
-               $control_id = (int) $control_id;
-
-               $sql = "SELECT cl.id as cl_id, cl.status as cl_status, 
cl.comment as cl_comment, deadline, planned_date, "; 
-               $sql .= "completed_date, component_id, location_code, 
num_open_cases, num_pending_cases ";
-               $sql .= "FROM controller_check_list cl ";
-               $sql .= "WHERE cl.control_id = {$control_id} ";
-               $sql .= "AND cl.location_code = '{$location_code}' "; 
-               $sql .= "AND (cl.planned_date IS NULL OR cl.planned_date < 
$from_date) ";
-               $sql .= "AND cl.deadline < $from_date ";
-               $sql .= "AND cl.completed_date IS NULL ";
-               $sql .= "ORDER BY cl.id;";
-               
-               $this->db->query($sql);
-               
-               $check_list_id = 0;
-               $check_list = null;
-               while ($this->db->next_record())
-               {
-               
-                       if( $this->db->f('cl_id') != $check_list_id )
-                       {
-                               if($check_list_id)
-                               {
-                                       $check_list_array[] = $check_list;
-                               }
-                               
-                               $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id'), 'int'));
-                               
$check_list->set_status($this->unmarshal($this->db->f('cl_status'), 'int'));
-                               
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
-                               
$check_list->set_deadline($this->unmarshal($this->db->f('deadline'), 'int'));
-                               
$check_list->set_planned_date($this->unmarshal($this->db->f('planned_date'), 
'int'));
-                               
$check_list->set_completed_date($this->unmarshal($this->db->f('completed_date'),
 'int'));       
-                               
$check_list->set_component_id($this->unmarshal($this->db->f('component_id'), 
'int'));
-                               
$check_list->set_location_code($this->unmarshal($this->db->f('location_code', 
true), 'string'));
-                               
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
-                               
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
-                       }
-                       $check_list_id =  $check_list->get_id();
-               }
-               
-               if($check_list != null)
-               {
-                       $check_list_array[] = $check_list;
-                       return $check_list_array;
-               }
-               else
-               {
-                       return null;
-               }
-       }
-       */
        
        /**
         * Get array with control id and number of open cases within time period

Modified: branches/Version-1_0-branch/controller/inc/hook_home.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/hook_home.inc.php        
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/controller/inc/hook_home.inc.php        
2012-10-03 16:26:02 UTC (rev 10108)
@@ -63,6 +63,8 @@
        $styling .= " .home_portal li div { display: block;float:left;cursor: 
pointer;vertical-align: middle;}";
        $styling .= " .home_portal_title h2 div{ 
display:block;float:left;cursor: pointer;vertical-align: middle;}";
        $styling .= "  h2.heading { font-size: 22px; font-weight: 
normal;margin: 0 0 0 20px;}";
+       $styling .= "  h4.expand_trigger img { 
vertical-align:middle;margin-right:3px; }";
+       $styling .= "  h4.expand_trigger span { vertical-align:middle; }";
        $styling .= "  .expand_list{ display:none; }";
        $styling .= "</style>"; 
        $styling .= "\n".'<!-- END checklist info -->'."\n";
@@ -602,7 +604,7 @@
                                        {
                                                $component = $container_arr[3];
                                                
$my_assigned_controls[$deadline_ts][] =  array("add", $deadline_ts, 
$my_control, "component", $component['location_id'], $component['id'] );
-                               }
+                     }
                                }
                                else if($check_list->get_status() == 
controller_check_list::STATUS_NOT_DONE)
                                {
@@ -623,7 +625,7 @@
                {
                        $portalbox2->data[] = array(                    
 //                                     'text' => "<h4 class='expand_trigger' 
style='font-size: 12px;color:#031647;background: #D0DEF4;padding:2px 
4px;margin:0;'><img height='12' src='controller/images/arrow_right.png' /><span 
style='display:inline-block;width:805px'>Antall kontroller: " .  
count($assigned_controls_on_date) . "</span><span 
style='display:inline-block;width:200px;'>" . date($dateformat, $date_ts) . 
"</span></h4><ul class='expand_list'>"
-                                       'text' => "<h4 class='expand_trigger' 
style='font-size: 12px;color:#031647;background: #D0DEF4;padding:2px 
4px;margin:0;'><img height='12' src='controller/images/arrow_right.png' /><span 
style='display:inline-block;width:805px'>Frist: "  . date($dateformat, 
$date_ts) .  "</span><span style='display:inline-block;width:200px;'>Antall 
kontroller: " .  count($controls_on_date) . "</span></h4><ul 
class='expand_list'>"
+                                       'text' => "<h4 class='expand_trigger' 
style='font-size: 12px;color:#031647;background: #D0DEF4;padding:2px 
4px;margin:0;'><img height='12' src='controller/images/arrow_right.png' /><span 
style='display:inline-block;width:805px'>Frist: "  . date($dateformat, 
$date_ts) .  "</span><span style='display:inline-block;width:200px;'>Antall 
kontroller: " .  count($assigned_controls_on_date) . "</span></h4><ul 
class='expand_list'>"
                                );
                }
                

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-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/class.soactivity.inc.php   
2012-10-03 16:26:02 UTC (rev 10108)
@@ -53,6 +53,7 @@
                        $cols = array(
                                'parent_activity_id',
                                'name',
+                               'description',
                                'project_id',
                                'start_date',
                                'end_date',
@@ -61,19 +62,10 @@
                                'update_date'
                        );
 
-                       if( $activity->get_project_id() == '')
-                       {
-                               $activity->set_project_id(1);
-                       }
-
-                       if( $activity->get_responsible_user_id() == '')
-                       {
-                               $activity->set_responsible_user_id(1);
-                       }
-
                        $values = array(
                                $this->marshal($activity->get_parent_id(), 
'int'),
                                $this->marshal($activity->get_name(), 'string'),
+                               $this->marshal($activity->get_description(), 
'string'),
                                $this->marshal($activity->get_project_id(), 
'int'),
                                $this->marshal($activity->get_start_date(), 
'int'),
                                $this->marshal($activity->get_end_date(), 
'int'),
@@ -102,6 +94,7 @@
 
                        $values = array(
                                'name=' . $this->marshal($activity->get_name(), 
'string'),
+                               'description=' . 
$this->marshal($activity->get_description(), 'string'),
                                'parent_activity_id=' . 
$this->marshal($activity->get_parent_id(), 'int'),
                                'project_id=' . 
$this->marshal($activity->get_project_id(), 'int'),
                                'start_date=' . 
$this->marshal($activity->get_start_date(), 'int'),
@@ -142,7 +135,7 @@
 
                        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');
@@ -211,6 +204,7 @@
                                $activity = new logistic_activity((int) 
$activity_id);
 
                                
$activity->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$activity->set_description($this->unmarshal($this->db->f('description'), 
'string'));
                                
$activity->set_parent_id($this->unmarshal($this->db->f('parent_id'), 'int'));
                                
$activity->set_project_id($this->unmarshal($this->db->f('project_id'), 'int'));
                                
$activity->set_start_date($this->unmarshal($this->db->f('start_date'), 'int'));

Modified: branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/class.soproject.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -26,7 +26,7 @@
        * @package property
        * @subpackage logistic
        * @version $Id$
-       */      
+       */
 
        phpgw::import_class('logistic.socommon');
 
@@ -52,11 +52,13 @@
 
                protected function add(&$project)
                {
+                       $user_id = $GLOBALS['phpgw_info']['user']['id'];
+                       $now = time();
                        $name = $project->get_name();
                        $description = $project->get_description();
-                       $type_id = $project->geT_project_type_id();
+                       $type_id = $project->get_project_type_id();
 
-                       $sql = "INSERT INTO lg_project (name, description, 
project_type_id) VALUES ('$name','$description',$type_id)";
+                       $sql = "INSERT INTO lg_project (name, description, 
project_type_id, create_user, create_date) VALUES 
('$name','$description',$type_id, $user_id, $now)";
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
                        if($result)
@@ -69,8 +71,8 @@
                                return 0;
                        }
                }
-               
-               
+
+
                protected function update($project)
                {
                        $id = intval($project->get_id());
@@ -201,7 +203,7 @@
 
                        return $project;
                }
-               
+
                public function get_projects()
                {
                        $project_array = array();
@@ -228,13 +230,13 @@
                {
                        $sql = "SELECT name FROM lg_project_type where id=$id";
                        $this->db->query($sql, __LINE__, __FILE__);
-                       
+
                        while ($this->db->next_record())
                        {
                                return $this->db->f('name');
                        }
                }
-               
+
                public function get_project_types()
                {
                        $project_type_array = array();
@@ -255,7 +257,7 @@
                        }
                        return $project_type_array;
                }
-               
+
                public function update_project_type($id, $name)
                {
                        $sql = "UPDATE lg_project_type set name='{$name}' where 
id={$id}";
@@ -270,10 +272,12 @@
                                return 0;
                        }
                }
-               
+
                public function add_project_type($name)
                {
-                       $sql = "INSERT INTO lg_project_type (name) VALUES 
('{$name}')";
+                       $user_id = $GLOBALS['phpgw_info']['user']['id'];
+                       $now = time();
+                       $sql = "INSERT INTO lg_project_type (name, create_user, 
create_date) VALUES ('{$name}', $user_id, $now)";
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
                        if($result)

Copied: branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php 
(from rev 10107, trunk/logistic/inc/class.sorequirement.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php        
                        (rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php        
2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,147 @@
+<?php
+/**
+       * phpGroupWare - logistic: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage logistic
+       * @version $Id:$
+       */
+
+       phpgw::import_class('logistic.socommon');
+
+       include_class('logistic', 'requirement', '/inc/model/');
+
+       class logistic_sorequirement extends logistic_socommon
+       {
+               protected static $so;
+
+               protected function add(&$object)
+               {
+
+               }
+
+               protected function get_id_field_name()
+               {
+                       if(!$extended_info)
+                       {
+                               $ret = 'id';
+                       }
+                       else
+                       {
+                               $ret = array
+                               (
+                                       'table'                 => 
'requirement', // 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[] = 
"requirement.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()]))
+                       {
+                               $filter_clauses[] = "requirement.id = 
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+                       }
+                       if(isset($filters['activity']) && !$filters['activity'] 
== '')
+                       {
+                               $filter_clauses[] = "requirement.activity_id = 
{$this->marshal($filters['activity'], 'int')}";
+                       }
+
+                       if(count($filter_clauses))
+                       {
+                               $clauses[] = join(' AND ', $filter_clauses);
+                       }
+
+                       $condition =  join(' AND ', $clauses);
+
+                       //$joins = " {$this->left_join} controller_control_area 
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+                       $tables = "lg_requirement requirement";
+
+                       if($return_count) // We should only return a count
+                       {
+                               $cols = 'COUNT(DISTINCT(requirement.id)) AS 
count';
+                       }
+                       else
+                       {
+                               $cols .= "* ";
+                       }
+
+                       $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} {$joins} WHERE 
{$condition} {$order}";
+               }
+
+               protected function populate(int $requirement_id, &$requirement)
+               {
+                       if($requirement == null)
+                       {
+                               $requirement = new logistic_requirement((int) 
$requirement_id);
+
+                               
$requirement->set_activity_id($this->unmarshal($this->db->f('activity_id'), 
'int'));
+                               
$requirement->set_date_from($this->unmarshal($this->db->f('date_from'), 'int'));
+                               
$requirement->set_date_to($this->unmarshal($this->db->f('date_to'), 'int'));
+                       }
+
+                       return $requirement;
+               }
+
+               protected function update($object)
+               {
+
+               }
+
+               public static function get_instance()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+                       return self::$so;
+               }
+       }
\ No newline at end of file

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-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/class.uiactivity.inc.php   
2012-10-03 16:26:02 UTC (rev 10108)
@@ -53,7 +53,7 @@
                        $this->so_project = createObject('logistic.soproject');
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"logistic::project::activity";
                }
-
+               
                public function index()
                {
                        if (phpgw::get_var('phpgw_return_as') == 'json')
@@ -146,6 +146,11 @@
                                                        'name'          => 
'parent_id',
                                                        'source'        => 'id'
                                                ),
+                                               array
+                                               (
+                                                       'name'          => 
'activity_id',
+                                                       'source'        => 'id'
+                                               ),
                                        )
                                );
 
@@ -160,8 +165,52 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'new_requirement',
+                                               'text'                  => 
lang('t_new_requirement'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uirequirement.edit'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
 
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'view_requirements',
+                                               'text'                  => 
lang('t_view_requirements'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uirequirement.index'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
 
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'new_booking',
+                                               'text'                  => 
lang('t_new_booking'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uibooking.edit'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
+
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'view_bookings',
+                                               'text'                  => 
lang('t_view_bookings'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uibooking.index'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
+
+
+
                        self::render_template_xsl(array('datatable_common'), 
$data);
                }
 
@@ -229,7 +278,7 @@
                                        $rows[] = $result->serialize();
                                }
                        }
-
+                       
                        // ... add result data
                        $result_data = array('results' => $rows);
 
@@ -261,6 +310,8 @@
                public function edit()
                {
                        $activity_id = phpgw::get_var('id');
+                       $parent_activity_id = phpgw::get_var('parent_id');
+                       
                        if ($activity_id && is_numeric($activity_id))
                        {
                                $activity = $this->so->get_single($activity_id);
@@ -270,7 +321,17 @@
                                $activity = new logistic_activity();
                        }
 
-                       $activity->set_project_id(phpgw::get_var('project_id'));
+                       if(phpgw::get_var('project_id') && 
phpgw::get_var('project_id') > 0)
+                       {
+                               
$activity->set_project_id(phpgw::get_var('project_id'));
+                       }
+                       
+                       if($parent_activity_id > 0)
+                       {
+                               $activity->set_parent_id( $parent_activity_id );
+                               $parent_activity = $this->so->get_single( 
$parent_activity_id );
+                               $activity->set_project_id( 
$parent_activity->get_project_id() );
+                       }
 
                        if (isset($_POST['save_activity']))
                        {
@@ -279,6 +340,7 @@
                                $activity->set_name( phpgw::get_var('name') );
                                $activity->set_update_user( $user_id );
                                $activity->set_responsible_user_id( 
phpgw::get_var('responsible_user_id') );
+                               $activity->set_description( 
phpgw::get_var('description') );
 
                                if(phpgw::get_var('start_date','string') != '')
                                {
@@ -310,17 +372,23 @@
                        }
                        else
                        {
-                               
                                $accounts = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
                                
+                         $activities = $this->so->get();
+                               $activities_array = $this->convert_to_array( 
$activities );
                                
                                $data = array
-                                       (
-                                       'user_array' => $accounts,
+                               (
+                                       'responsible_users' => $accounts,
+                                       'activities' => $activities_array,
                                        'activity' => $activity->toArray(),
-                                       'img_go_home' => 
'rental/templates/base/images/32x32/actions/go-home.png',
                                        'editable' => true,
                                );
+                               
+                               if($parent_activity_id > 0)
+                               {
+                                       $data['parent_activity'] = 
$parent_activity->toArray();
+                               }
 
                                $this->use_yui_editor('description');
                                $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('logistic') . '::' . lang('Add activity');
@@ -328,11 +396,23 @@
                                
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
                                
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
 
+                               self::add_javascript('logistic', 'logistic', 
'ajax.js');
                                
self::render_template_xsl(array('activity_item'), $data);
                        }
                }
+               
+               function convert_to_array($object_list)
+               {
+                       $converted_array = array();
+                       
+                       foreach($object_list as $object)
+                       {
+                               $converted_array[] = $object->toArray();
+                       }
+                       
+                       return $converted_array; 
+               }
 
-
                public function view()
                {
                        $activity_id = phpgw::get_var('id');

Copied: branches/Version-1_0-branch/logistic/inc/class.uibooking.inc.php (from 
rev 10107, trunk/logistic/inc/class.uibooking.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uibooking.inc.php            
                (rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.uibooking.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,434 @@
+<?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z 
vator $
+       */
+       
+       phpgw::import_class('phpgwapi.yui');
+
+       /**
+       * Import the jQuery class
+       */
+       phpgw::import_class('phpgwapi.jquery');
+
+       phpgw::import_class('phpgwapi.uicommon');
+               
+       class controller_uicontrol_register_to_component extends 
phpgwapi_uicommon
+       {
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $type_id;
+               var $location_code;
+               
+               private $bo;
+               private $bocommon;
+               private $so_control;
+       
+               var $public_functions = array
+               (
+                       'index'                                                 
        => true,
+                       'query'                                                 
        => true,
+                       'edit_component'                                        
=> true,
+                       'get_location_category'                         => 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
+               );
+
+               function __construct()
+               {
+                       parent::__construct();
+                       
+                       $this->bo                                       = 
CreateObject('property.bolocation',true);
+                       $this->bocommon                         = & 
$this->bo->bocommon;
+                       $this->so_control                       = 
CreateObject('controller.socontrol');
+                       
+                       $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;
+                       
+                       
self::set_active_menu('controller::control::location_for_check_list');
+               }       
+       
+
+
+               function index()
+               {
+                   
self::set_active_menu('controller::control::component_for_check_list');
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
+                       $receipt = array();
+
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       $msgbox_data = array();
+                       if( phpgw::get_var('phpgw_return_as') != 'json' && 
$receipt = phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                       {
+                               phpgwapi_cache::session_clear('phpgwapi', 
'phpgw_messages');
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($receipt);
+                               $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+                       }
+
+                       $myColumnDefs = array();
+                       $datavalues = array();
+                       $myButtons      = array();
+
+                       $datavalues[] = array
+                       (
+                               'name'                          => "0",
+                               'values'                        => 
json_encode(array()),
+                               'total_records'         => 0,
+                               'permission'            => "''",
+                               'is_paginator'          => 1,
+                               'edit_action'           => "''",
+                               'footer'                        => 0
+                       );
+
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode(array())
+                       );      
+
+                       $GLOBALS['phpgw']->translation->add_app('property');
+                       $entity                 = 
CreateObject('property.soadmin_entity');
+                       $entity_list    = $entity->read(array('allrows' => 
true));
+
+                       $district_list  = 
$this->bocommon->select_district_list('filter',$this->district_id);
+
+                       $part_of_town_list = 
execMethod('property.bogeneric.get_list', array('type'=>'part_of_town', 
'selected' => $part_of_town_id ));
+                       $location_type_list = 
execMethod('property.soadmin_location.select_location_type');
+
+                       array_unshift($entity_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($district_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($part_of_town_list ,array 
('id'=>'','name'=>lang('select')));
+                       array_unshift($location_type_list ,array 
('id'=>'','name'=>lang('select')));
+
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'controller', '.control');
+                       $cats->supress_info     = true;
+
+                       $control_area = 
$cats->formatted_xslt_list(array('format'=>'filter','globals' => true,'use_acl' 
=> $this->_category_acl));
+
+                                                               
+                       $control_area_list = array();
+                       foreach($control_area['cat_list'] as $cat_list)
+                       {
+                               $control_area_list[] = array
+                               (
+                                       'id'    => $cat_list['cat_id'],
+                                       'name'  => $cat_list['name'],
+                               );              
+                       }
+
+                       array_unshift ($control_area_list ,array 
('id'=>'','name'=>lang('select')));
+
+                       
+                                       
+                       $data = array
+                       (
+                               'td_count'                                      
        => '""',
+                               'datatable'                                     
        => $datavalues,
+                               'myColumnDefs'                                  
=> $myColumnDefs,
+                               'myButtons'                                     
        => $myButtons,
+
+                               'msgbox_data'                                   
=> $msgbox_data,
+                               'control_area_list'             => 
array('options' => $control_area_list),
+                               'filter_form'                                   
=> array
+                                                                               
                        (
+                                                                               
                                'control_area_list'             => 
array('options' => $control_area_list),
+                                                                               
                                'entity_list'                   => 
array('options' => $entity_list),
+                                                                               
                                'district_list'                 => 
array('options' => $district_list),
+                                                                               
                                'part_of_town_list'             => 
array('options' => $part_of_town_list),
+                                                                               
                                'location_type_list'    => array('options' => 
$location_type_list),
+                                                                               
                        ),
+                               'update_action'                                 
=> self::link(array('menuaction' => 
'controller.uicontrol_location.edit_component'))
+                       );
+
+                       phpgwapi_jquery::load_widget('core');
+                       phpgwapi_jquery::load_widget('autocomplete');
+
+                       self::add_javascript('controller', 'controller', 
'ajax_control_to_component.js');
+                       self::add_javascript('controller', 'yahoo', 
'register_control_to_component2.js');
+
+                       
self::render_template_xsl(array('control_location/register_control_to_component'
 ), $data);
+               }
+
+               
+               /*
+                * Return categories based on chosen location
+                */
+               public function get_location_category()
+               {
+                       $type_id = phpgw::get_var('type_id');
+                       $category_types = 
$this->bocommon->select_category_list(array(
+                                                                               
                                                                
'format'=>'filter',
+                                                                               
                                                                'selected' => 0,
+                                                                               
                                                                'type' 
=>'location',
+                                                                               
                                                                'type_id' 
=>$type_id,
+                                                                               
                                                                'order'=>'descr'
+                                                                               
                                                        ));
+                       $default_value = array ('id'=>'','name'=>lang('no 
category selected'));
+                       array_unshift($category_types,$default_value);
+                       return json_encode( $category_types );
+               }
+               
+               /*
+                * Return parts of town based on chosen district
+                */
+               public function get_district_part_of_town()
+               {
+                       $district_id = phpgw::get_var('district_id');
+                       $part_of_town_list =  
$this->bocommon->select_part_of_town('filter',null,$district_id);
+                       $default_value = array ('id'=>'','name'=>lang('no part 
of town'));
+                       array_unshift($part_of_town_list,$default_value);
+
+                       return json_encode( $part_of_town_list );
+               }
+
+
+               /*
+
+                * Return parts of town based on chosen district
+                */
+               public function get_category_by_entity()
+               {
+                       $entity_id              = phpgw::get_var('entity_id');
+                       $entity                 = 
CreateObject('property.soadmin_entity');
+
+                       $category_list = 
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+
+                       return $category_list;
+               }
+
+
+               public function get_location_type_category()
+               {
+                       $location_type                  = 
phpgw::get_var('location_type', 'int');
+
+                       $values  = $this->bocommon->select_category_list(array
+                                       (
+                                               'format'=>'filter',
+                                       //      'selected' => $this->cat_id,
+                                               'type' =>'location',
+                                               'type_id' =>$location_type,
+                                               'order'=>'descr'
+                                       )
+                               );
+
+                       return $values;
+               }
+
+
+               public function get_entity_table_def()
+               {
+                       $entity_id                      = 
phpgw::get_var('entity_id', 'int');
+                       $cat_id                         = 
phpgw::get_var('cat_id', 'int');
+                       $boentity       = 
CreateObject('property.boentity',false, 'entity');
+                       $boentity->read(array('dry_run' => true));
+                       $uicols = $boentity->uicols;
+                       $columndef = array();
+
+                       $columndef[] = array
+                       (
+                               'key'           => 'select',
+                               'label'         => lang('select'),
+                               'sortable'      => false,
+                               'formatter'     => false,
+                               'hidden'        => false,
+                               'formatter' => '',
+                               'className' => ''
+                       );
+
+                       $columndef[] = array
+                       (
+                               'key'           => 'delete',
+                               'label'         => lang('delete'),
+                               'sortable'      => false,
+                               'formatter'     => false,
+                               'hidden'        => false,
+                               'formatter' => '',
+                               'className' => ''
+                       );
+
+                       $count_fields = count($uicols['name']);
+
+                       for ($i=0;$i<$count_fields;$i++)
+                       {
+                               if( $uicols['name'][$i])
+                               {
+                                       $columndef[] = array
+                                       (
+                                               'key'           => 
$uicols['name'][$i],
+                                               'label'         => 
$uicols['descr'][$i],
+                                               'sortable'      => 
$uicols['sortable'][$i],
+                                               'formatter'     => 
$uicols['formatter'][$i],
+                                               'hidden'        => 
$uicols['input_type'][$i] == 'hidden' ? true : false ,               
+                                               'className'     => 
$uicols['classname'][$i],
+                                       );
+                               }
+                       }
+
+//_debug_array($columndef);
+                       return $columndef;
+               }
+
+
+               public function get_locations()
+               {
+                       $location_code = phpgw::get_var('location_code');
+                       $child_level = phpgw::get_var('child_level', 'int', 
'REQUEST', 1);
+                       $part_of_town_id = phpgw::get_var('part_of_town_id', 
'int');
+
+                       $criteria = array
+                       (
+                               'location_code'         => $location_code,
+                               'child_level'           => $child_level,
+                               'field_name'            => 
"loc{$child_level}_name",
+                               'part_of_town_id'       => $part_of_town_id
+                       );
+       
+                       $locations = 
execMethod('property.solocation.get_children',$criteria);
+                       return $locations;
+               }
+
+
+
+               public function query()
+               {
+                       $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');
+                       $control_registered     = 
phpgw::get_var('control_registered', 'bool');
+
+                       if(!$entity_id && !$cat_id)
+                       {
+                               $values = array();
+                       }
+                       else
+                       {
+                               $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$entity_id}.{$cat_id}");
+                               $boentity       = 
CreateObject('property.boentity',false, 'entity');
+                               $boentity->results = $results;
+                               $values = 
$boentity->read(array('control_registered' => $control_registered, 'control_id' 
=> $control_id));
+                       }               
+
+                       foreach($values as &$entry)
+                       {
+                               $checked = '';
+                               
if($this->so_control->check_control_component($control_id,$location_id,$entry['id']))
+                               {
+                                       $checked =  'checked = "checked" 
disabled = "disabled"';
+                                       $entry['delete'] = "<input class 
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
+                               }
+                               $entry['select'] = "<input class 
=\"mychecks_add\" type =\"checkbox\" $checked 
name=\"values[register_component][]\" 
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
+                       }
+
+                       
+                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $return_data['recordsReturned'] = count($values);
+                       $return_data['totalRecords'] = $boentity->total_records;
+                       $return_data['startIndex'] = $this->start;
+                       $return_data['sort'] = 'location_code';
+                       $return_data['dir'] = "ASC";
+                       $return_data['pageSize'] = $results;
+                       $return_data['activePage'] = floor($this->start / 
$results) + 1;
+                       $return_data['records'] = $values;
+
+                       return $return_data;
+               }
+
+               public function edit_component()
+               {
+                       if($values = phpgw::get_var('values'))
+                       {
+                               if(!$GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_EDIT, 'property'))
+                               {
+                                       $receipt['error'][]=true;
+                                       phpgwapi_cache::message_set(lang('you 
are not approved for this task'), 'error');
+                               }
+                               if(!$receipt['error'])
+                               {
+
+                                       
if($this->so_control->register_control_to_component($values))
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'updated'
+                                               );
+                                       }
+                                       else
+                                       {
+                                               $result =  array
+                                               (
+                                                       'status'        => 
'error'
+                                               );
+                                       }
+                               }
+                       }
+
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               if( $receipt = 
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                               {
+                                       
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                       $result['receipt'] = $receipt;
+                               }
+                               else
+                               {
+                                       $result['receipt'] = array();
+                               }
+                               return $result;
+                       }
+                       else
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 
'controller.uicontrol_location.register_control_to_component'));
+                       }
+               }
+       }

Modified: branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/class.uiproject.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -45,8 +45,7 @@
                        'edit_project_type' => true,
                        'edit_project_type_name' => true,
                        'add' => true,
-                       'edit' => true,
-                       'edit_something' => true
+                       'edit' => true
                );
 
                public function __construct()
@@ -199,7 +198,6 @@
                                ),
                                'datatable' => array(
                                        'source' => 
self::link(array('menuaction' => 'logistic.uiproject.index', 'phpgw_return_as' 
=> 'json')),
-                                       'editor_action' => 
'logistic.uiproject.edit_something',
                                        'field' => array(
                                                array(
                                                        'key' => 'name',
@@ -231,14 +229,32 @@
                                ),
                        );
 
+                       $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'project_id',
+                                                       'source'        => 'id'
+                                               ),
+                                       )
+                               );
+
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'new_activity',
+                                               'text'                  => 
lang('t_new_activity'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uiactivity.edit'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
+
                        self::render_template_xsl('datatable_common', $data);
                }
 
-               public function edit_something()
-               {
-                       return 'kvittering';
-               }
-
                public function project_types()
                {
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"admin::logistic::project_types";

Copied: branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php 
(from rev 10107, trunk/logistic/inc/class.uirequirement.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php        
                        (rev 0)
+++ branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php        
2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,218 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+
+       phpgw::import_class('phpgwapi.uicommon');
+       phpgw::import_class('logistic.sorequirement');
+
+       include_class('logistic', 'requirement');
+
+
+       class uirequirement extends phpgwapi_uicommon
+       {
+               private $so;
+
+               public $public_functions = array(
+                       'query' => true,
+                       'index' => true,
+                       'add' => true,
+                       'edit' => true,
+                       'view' => true
+               );
+
+               public function __construct()
+               {
+                       parent::__construct();
+
+                       $this->so = CreateObject('logistic.sorequirement');
+
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"logistic::project::requirement";
+               }
+
+
+               public function query()
+               {
+                       $params = array(
+                               'start' => phpgw::get_var('startIndex', 'int', 
'REQUEST', 0),
+                               'results' => phpgw::get_var('results', 'int', 
'REQUEST', null),
+                               'query' => phpgw::get_var('query'),
+                               'sort' => phpgw::get_var('sort'),
+                               'dir' => phpgw::get_var('dir'),
+                               'filters' => $filters
+                       );
+
+                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+                       {
+                               $user_rows_per_page = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       }
+                       else
+                       {
+                               $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;
+
+                       //Retrieve a contract identifier and load corresponding 
contract
+                       $project_id = phpgw::get_var('project_id');
+
+                       $exp_param = phpgw::get_var('export');
+                       $export = false;
+                       if (isset($exp_param))
+                       {
+                               $export = true;
+                               $num_of_objects = null;
+                       }
+
+                       //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)
+                                       phpgwapi_cache::session_set('logistic', 
'requirement_query', $search_for);
+                                       //$filters = array('project_type' => 
phpgw::get_var('project_type'));
+                                       $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;
+                       }
+
+                       //Create an empty row set
+                       $rows = array();
+                       foreach ($result_objects as $result)
+                       {
+                               if (isset($result))
+                               {
+                                       $rows[] = $result->serialize();
+                               }
+                       }
+
+                       // ... add result data
+                       $result_data = array('results' => $rows);
+
+                       $result_data['total_records'] = $object_count;
+                       $result_data['start'] = $params['start'];
+                       $result_data['sort'] = $params['sort'];
+                       $result_data['dir'] = $params['dir'];
+
+                       $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
+
+                       if (!$export)
+                       {
+                               //Add action column to each row in result table
+                               array_walk(
+                                                               
$result_data['results'], array($this, '_add_links'), "logistic.uiproject.view");
+                       }
+                       return $this->yui_results($result_data);
+               }
+
+               public function index()
+               {
+                       if (phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+
+                       self::add_javascript('phpgwapi', 'yahoo', 
'datatable.js');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('paginator');
+
+                       $data = array(
+                               'datatable_name'        => lang('requirement'),
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array('type' => 'text',
+                                                               'text' => 
lang('search'),
+                                                               'name' => 
'query'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'submit',
+                                                               'name' => 
'search',
+                                                               'value' => 
lang('Search')
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'logistic.uirequirement.index', 
'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'name',
+                                                       'label' => 
lang('Project name'),
+                                                       'sortable' => true
+                                               ),
+                                               array(
+                                                       'key' => 'id',
+                                                       'label' => lang('ID'),
+                                                       'sortable' => true,
+                                                       'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'hidden' => true
+                                               )
+                                       )
+                               ),
+                       );
+
+                       $parameters = array
+                               (
+                                       'parameter' => array
+                                       (
+                                               array
+                                               (
+                                                       'name'          => 
'requirement_id',
+                                                       'source'        => 'id'
+                                               ),
+                                       )
+                               );
+
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'book_requirement',
+                                               'text'                  => 
lang('t_book_requirement'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'logistic.uiactivity.edit'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
+
+                       self::render_template_xsl('datatable_common', $data);
+               }
+       }
\ No newline at end of file

Modified: branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php       
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/model/class.activity.inc.php       
2012-10-03 16:26:02 UTC (rev 10108)
@@ -33,15 +33,19 @@
                {
                                public static $so;
 
-                               protected static $id;
-                               protected static $name;
-                               protected static $parent_id;
-                               protected static $project_id;
-                               protected static $start_date;
-                               protected static $end_date;
-                               protected static $responsible_user_id;
-                               protected static $update_user;
-                               protected static $update_date;
+                               protected $id;
+                               protected $name;
+                               protected $description;
+                               protected $parent_id;
+                               protected $project_id;
+                               protected $start_date;
+                               protected $end_date;
+                               protected $responsible_user_id;
+                               protected $update_user;
+                               protected $update_date;
+                               
+                               // Arrays
+                               protected $sub_activities = array();
 
                                /**
                                * Constructor.  Takes an optional ID.  If a 
contract is created from outside
@@ -51,7 +55,6 @@
                                */
                                public function __construct(int $id = null)
                                {
-//                                     echo "1";
                                        $this->id = (int)$id;
                                }
 
@@ -75,6 +78,16 @@
                                        return $this->name;
                                }
 
+                               public function set_description($description)
+                               {
+                                       $this->description = $description;
+                               }
+
+                               public function get_description()
+                               {
+                                       return $this->description;
+                               }
+
                                public function set_parent_id($parent_id)
                                {
                                        $this->parent_id = $parent_id;
@@ -144,6 +157,16 @@
                                {
                                        return $this->update_date;
                                }
+                               
+                               public function 
set_sub_activities($sub_activities)
+                               {
+                                       $this->sub_activities = $sub_activities;
+                               }
+                               
+                               public function get_sub_activities()
+                               {
+                                       return $this->sub_activities;
+                               }
 
                                /**
                                * Get a static reference to the storage object 
associated with this model object
@@ -169,6 +192,7 @@
                                                'id' => $this->get_id(),
                                                'parent_id' => 
$this->get_parent_id(),
                                                'name' => $this->get_name(),
+                                               'description' => 
$this->get_description(),
                                                'project_id' => 
$this->get_project_id(),
                                                'project_name' => $project_name,
                                                'start_date' => 
$this->get_start_date() ? date($date_format, $this->get_start_date()): '',
@@ -176,4 +200,23 @@
                                                'responsible_user_id' => 
$responsible_user
                                        );
                                }
+
+                               public function toArray()
+                               {
+                                       $converted_obj_array = 
parent::toArray();
+                                       
+                                       $converted_obj_array['sub_activities'] 
= array();
+                                       
+                                       foreach($this->sub_activities as 
$activitiy)
+                                       {
+                                               // Checks if object to be 
converted is not the same as this object, 
+                                               // otherwise an eternal loop 
will happen
+                                               if($activitiy != $this)
+                                               {
+                                                       
$converted_obj_array['sub_activities'][] = $activitiy->toArray();
+                                               }
+                                       }
+                                                               
+                                       return $converted_obj_array;
+                               }
                }

Copied: 
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
 (from rev 10107, 
trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
                              (rev 0)
+++ 
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
      2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,116 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_bim_item_type_requirement extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $location_id;
+               protected static $project_type_id;
+               protected static $attribute_name;
+               protected static $attribute_type;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+
+               public function get_location_id()
+               {
+                       return $this->location_id;
+               }
+
+               public function set_project_type_id($project_type_id)
+               {
+                       $this->project_type_id = $project_type_id;
+               }
+
+               public function get_project_type_id()
+               {
+                       return $this->project_type_id;
+               }
+
+               public function set_attribute_name($attribute_name)
+               {
+                       $this->attribute_name = $attribute_name;
+               }
+
+               public function get_attribute_name()
+               {
+                       return $this->attribute_name;
+               }
+
+               public function set_attribute_type($attribute_type)
+               {
+                       $this->attribute_type = $attribute_type;
+               }
+
+               public function get_attribute_type()
+               {
+                       return $this->attribute_type;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sobim_item_type_requirement');
+                       }
+
+                       return self::$so;
+               }
+       }
\ No newline at end of file

Modified: branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php        
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/inc/model/class.project.inc.php        
2012-10-03 16:26:02 UTC (rev 10108)
@@ -33,11 +33,11 @@
                {
                                public static $so;
 
-                               protected static $id;
-                               protected static $name;
-                               protected static $project_type_id;
-                               protected static $project_type_label;
-                               protected static $description;
+                               protected $id;
+                               protected $name;
+                               protected $project_type_id;
+                               protected $project_type_label;
+                               protected $description;
 
                                /**
                                * Constructor.  Takes an optional ID.  If a 
contract is created from outside

Copied: 
branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php (from 
rev 10107, trunk/logistic/inc/model/class.requirement.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php    
                        (rev 0)
+++ branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,115 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement extends logistic_model
+       {
+
+               public static $so;
+               protected static $requirement_id;
+               protected static $activity_id;
+               protected static $date_from;
+               protected static $date_to;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->requirement_id = (int) $id;
+               }
+
+               public function set_requirement_id($id)
+               {
+                       $this->requirement_id = $id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_activity_id($activity_id)
+               {
+                       $this->activity_id = $activity_id;
+               }
+
+               public function get_activity_id()
+               {
+                       return $this->activity_id;
+               }
+
+               public function set_date_from($date_from)
+               {
+                       $this->date_from = $date_from;
+               }
+
+               public function get_date_from()
+               {
+                       return $this->date_from;
+               }
+
+               public function set_date_to($date_to)
+               {
+                       $this->date_to = $date_to;
+               }
+
+               public function get_date_to()
+               {
+                       return $this->date_to;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+
+               public function serialize()
+               {
+                       return array(
+                               'requirement_id' => $this->get_requirement_id(),
+                               'activity_id' => $this->get_activity_id(),
+                               'date_from' => $this->get_date_from(),
+                               'date_to' => $this->get_date_to()
+                       );
+               }
+       }
\ No newline at end of file

Copied: 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
 (from rev 10107, 
trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
                                (rev 0)
+++ 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
        2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_resource_allocation extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $article_id;
+               protected static $type;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_article_id($article_id)
+               {
+                       $this->article_id = $article_id;
+               }
+
+               public function get_article_id()
+               {
+                       return $this->article_id;
+               }
+
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+
+               public function get_type()
+               {
+                       return $this->type;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+       }
\ No newline at end of file

Copied: 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
 (from rev 10107, 
trunk/logistic/inc/model/class.requirement_resource_type.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
                              (rev 0)
+++ 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
      2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_resource_type extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $resource_type_id;
+               protected static $no_of_elements;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function set_resource_type_id($resource_type_id)
+               {
+                       $this->resource_type_id = $resource_type_id;
+               }
+
+               public function get_resource_type_id()
+               {
+                       return $this->resource_type_id;
+               }
+
+               public function set_no_of_elements($no_of_elements)
+               {
+                       $this->no_of_elements = $no_of_elements;
+               }
+
+               public function get_no_of_elements()
+               {
+                       return $this->no_of_elements;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement_resource_type');
+                       }
+
+                       return self::$so;
+               }
+       }

Copied: 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php 
(from rev 10107, trunk/logistic/inc/model/class.requirement_value.inc.php)
===================================================================
--- 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php  
                            (rev 0)
+++ 
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php  
    2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,105 @@
+<?php
+
+       /**
+        * phpGroupWare - logistic: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage logistic
+        * @version $Id $
+        */
+       include_class('logistic', 'model', '/inc/model/');
+
+       class logistic_requirement_value extends logistic_model
+       {
+               public static $so;
+
+               protected static $id;
+               protected static $requirement_id;
+               protected static $bim_item_type_requirement_id;
+               protected static $value;
+
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                *
+                * @param int $id the id of this project
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int) $id;
+               }
+
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+
+               public function get_id()
+               {
+                       return $this->id;
+               }
+
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+
+               public function get_requirement_id()
+               {
+                       return $this->requirement_id;
+               }
+
+               public function 
set_bim_item_type_requirement_id($bim_item_type_requirement_id)
+               {
+                       $this->bim_item_type_requirement_id = 
$bim_item_type_requirement_id;
+               }
+
+               public function get_bim_item_type_requirement_id()
+               {
+                       return $this->bim_item_type_requirement_id;
+               }
+
+               public function set_value($value)
+               {
+                       $this->value = $value;
+               }
+
+               public function get_value()
+               {
+                       return $this->value;
+               }
+
+               /**
+               * Get a static reference to the storage object associated with 
this model object
+               *
+               * @return the storage object
+               */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('logistic.sorequirement');
+                       }
+
+                       return self::$so;
+               }
+       }

Modified: branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/logistic/setup/phpgw_no.lang    2012-10-03 
16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/setup/phpgw_no.lang    2012-10-03 
16:26:02 UTC (rev 10108)
@@ -11,6 +11,10 @@
 t_new_project  logistic        no      Nytt prosjekt
 t_new_project_type     logistic        no      Ny prosjekttype
 t_new_activity logistic        no      Opprett ny aktivitet på dette prosjektet
+t_new_requirement      logistic        no      Registrer nytt behov på denne 
aktiviteten
+t_view_requirements    logistic        no      Vis registrerte behov på denne 
aktiviteten
+t_new_booking  logistic        no      Registrer ny booking på denne 
aktiviteten
+t_view_bookings        logistic        no      Vis registrerte bookinger på 
denne aktiviteten
 Project_type   logistic        no      Prosjekttype
 settings       logistic        no      innstillinger
 Project types  logistic        no      Prosjekttyper
@@ -23,5 +27,6 @@
 End date       logistic        no      Sluttdato
 Responsible user       logistic        no      Ansvarlig
 my_activities  logistic        no      Mine aktiviteter
-Project type name updated logistic     no      Prosjekttypenavn oppdatert
-Add activity   logistic        Legg til aktivitet
\ No newline at end of file
+Project type name updated              logistic        no      
Prosjekttypenavn oppdatert
+Add activity   logistic        no      Legg til aktivitet
+Add sub activity       logistic        no      Legg til subaktivitet
\ No newline at end of file

Modified: branches/Version-1_0-branch/logistic/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/setup.inc.php    2012-10-03 
16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/setup/setup.inc.php    2012-10-03 
16:26:02 UTC (rev 10108)
@@ -1,11 +1,11 @@
 <?php
        $setup_info['logistic']['name'] = 'logistic';
-       $setup_info['logistic']['version'] = '0.0.1';
+       $setup_info['logistic']['version'] = '0.0.2';
        $setup_info['logistic']['app_order'] = 70;
        $setup_info['logistic']['enable'] = 1;
        $setup_info['logistic']['app_group']    = 'office';
-       
-       $setup_info['logistic']['tables'] = array 
+
+       $setup_info['logistic']['tables'] = array
        (
                        'lg_project',
                        'lg_project_type',

Modified: branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_current.inc.php   
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/setup/tables_current.inc.php   
2012-10-03 16:26:02 UTC (rev 10108)
@@ -4,7 +4,9 @@
                'lg_project_type' => array(
                                'fd' => array(
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
-                                               'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false)
+                                               'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(),
@@ -16,7 +18,9 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
                                                'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
-                                               'description' => array('type' 
=> 'text', 'nullable' => false)
+                                               'description' => array('type' 
=> 'text', 'nullable' => false),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array('lg_project_type' => 
array('project_type_id' => 'id')),
@@ -28,10 +32,13 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'parent_activity_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true),
                                                'name' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => false),
+                                               'description' => array('type' 
=> 'text', 'nullable' => false),
                                                'project_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
                                                'start_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
                                                'end_date' => array('type' => 
'int', 'precision' => 4, 'nullable' => true),
                                                'responsible_user_id' => 
array('type' => 'int', 'precision' => 4, 'nullable'=> false),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'update_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'update_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false)
                                ),
@@ -48,7 +55,9 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'activity_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'date_from' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
-                                               'date_to' => array('type' => 
'int', 'precision' => 4, 'nullable' => false)
+                                               'date_to' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array('lg_activity' => 
array('activity_id' => 'id')),
@@ -60,7 +69,9 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'resource_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
-                                               'no_of_elements' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true)
+                                               'no_of_elements' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -75,7 +86,9 @@
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
                                                'article_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
-                                               'type' => array('type' => 
'int', 'precision' => 4, 'nullable' => false)
+                                               'type' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -91,7 +104,9 @@
                                                'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'attribute_name' => 
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
                                                'attribute_type' => 
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
-                                               'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true)
+                                               'project_type_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => true),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array(
@@ -105,7 +120,9 @@
                                'fd' => array(
                                                'id' => array('type' => 'auto', 
'precision' => 4, 'nullable' => false),
                                                'type_requirement_id' => 
array('type' => 'int', 'precision' => 4, 'nullable' => false),
-                                               'value' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true)
+                                               'value' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array('lg_bim_item_type_requirement' => 
array('type_requirement_id' => 'id')),
@@ -118,7 +135,9 @@
                                                'location_id' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                                'item_id' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
                                                'type' => array('type' => 
'int', 'precision' => 4, 'nullable' => false),
-                                               'tracking' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true)
+                                               'tracking' => array('type' => 
'varchar', 'precision' => '255', 'nullable' => true),
+                                               'create_user' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
+                                               'create_date' => array('type' 
=> 'int', 'precision' => 4, 'nullable' => false),
                                ),
                                'pk' => array('id'),
                                'fk' => array('fm_bim_item' => array('item_id' 
=> 'id', 'type' => 'type')),

Copied: branches/Version-1_0-branch/logistic/setup/tables_update.inc.php (from 
rev 10107, trunk/logistic/setup/tables_update.inc.php)
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_update.inc.php            
                (rev 0)
+++ branches/Version-1_0-branch/logistic/setup/tables_update.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -0,0 +1,16 @@
+<?php
+        /* Update Logistic from v 0.0.1 to 0.0.2
+         * Add column 'description' to table activity
+         */
+
+       $test[] = '0.0.1';
+       function logistic_upgrade0_0_1()
+       {
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_activity','description',array(
+                       'type' => 'text',
+                       'nullable' => True
+               ));
+
+               $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.2';
+               return $GLOBALS['setup_info']['logistic']['currentver'];
+       }

Modified: branches/Version-1_0-branch/logistic/templates/base/activity_item.xsl
===================================================================
--- branches/Version-1_0-branch/logistic/templates/base/activity_item.xsl       
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/logistic/templates/base/activity_item.xsl       
2012-10-03 16:26:02 UTC (rev 10108)
@@ -6,16 +6,51 @@
 
 <xsl:call-template name="yui_phpgw_i18n"/>
 <div class="yui-navset yui-navset-top">
-       <div class="identifier-header">
-               <h1><img src="{img_go_home}" /> 
-                               <xsl:value-of select="php:function('lang', 'Add 
activity')" />
-               </h1>
+       <div style="clear: both;margin-bottom: 0;overflow: hidden;padding: 
1em;" class="identifier-header">
+               
+               <xsl:choose>
+                       <xsl:when test="parent_activity/id &gt; 0">
+                               <h1 style="float:left;"> 
+                                       <xsl:value-of 
select="parent_activity/name" disable-output-escaping="yes"/>::<xsl:value-of 
select="php:function('lang', 'Add sub activity')" />
+                               </h1>
+                               
+                               <div style="float: left; margin-left: 130px;" 
class="select-box">
+                                       <label>Velg en annen 
hovedaktivitet</label>
+                                       
+                                       <form action="#">
+                                               <input type="hidden" 
name="activity_id" value="{activity/id}" />
+                                               <input type="hidden" 
name="parent_id" value="{parent_activity/id}" />
+                                                                               
                
+                                               <select id="select_activity" 
name="parent_activity_id" class="selectLocation">
+                                                       <option>Velg 
aktivitet</option>
+                                                       <xsl:for-each 
select="activities">
+                                       <option value="{id}">
+                                               <xsl:if 
test="activity/parent_id = id">
+                                                       <xsl:attribute 
name="selected">
+                                                                       selected
+                                                                       
</xsl:attribute>
+                                               </xsl:if>
+                                       <xsl:value-of 
disable-output-escaping="yes" select="name"/>
+                                       </option>
+                                                 </xsl:for-each>
+                                               </select>                       
                
+                                       </form>
+                               </div>          
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <h1 style="float:left;"> 
+                                       <xsl:value-of 
select="php:function('lang', 'Add activity')" />
+                               </h1>
+                       </xsl:otherwise>
+               </xsl:choose>
        </div>
-       <div class="yui-content">
+
+       <div class="yui-content" style="padding: 20px;">
                <div id="details">
                        <form action="#" method="post">
                                <input type="hidden" name="id" value = 
"{activity/id}" />
                                <input type="hidden" name="project_id" 
value="{activity/project_id}" />
+                               <input type="hidden" name="parent_id" 
value="{parent_activity/id}" />
                                
                                <dl class="proplist-col">
                                        <dt>
@@ -85,7 +120,7 @@
                                                <xsl:choose>
                                                        <xsl:when 
test="editable">
                                                                <select 
name="responsible_user_id">
-                                               <xsl:for-each 
select="user_array">
+                                               <xsl:for-each 
select="responsible_users">
                                                        <xsl:variable 
name="full_name">
                                                                <xsl:value-of 
disable-output-escaping="yes" select="account_firstname"/><xsl:text> </xsl:text>
                                                                <xsl:value-of 
disable-output-escaping="yes" select="account_lastname"/>

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -1226,9 +1226,18 @@
 
                        $this->db->query("UPDATE fm_project SET $value_set 
WHERE id= {$project['id']}",__LINE__,__FILE__);
 
-                       if($project['delete_b_year'])
+                       $_closed_period = array
+                       (
+                               'closed_b_period' => 
isset($project['closed_b_period']) && $project['closed_b_period'] ? 
$project['closed_b_period'] : array(),
+                               'closed_orig_b_period' => 
isset($project['closed_orig_b_period']) && $project['closed_orig_b_period'] ? 
$project['closed_orig_b_period'] : array()
+                       );
+
+                       $this->close_period_from_budget($project['id'], 
$_closed_period);
+                       unset($_close_period);
+
+                       if($project['delete_b_period'])
                        {
-                               $this->delete_year_from_budget($project['id'], 
$project['delete_b_year']);
+                               
$this->delete_period_from_budget($project['id'], $project['delete_b_year']);
                        }
 
                        if($project['budget'])
@@ -1598,6 +1607,7 @@
                function get_budget($project_id)
                {
                        $project_id = (int) $project_id;
+                       $closed_period = array();
 
 
                        $sql = "SELECT * FROM fm_project_budget WHERE 
project_id = {$project_id}";
@@ -1612,6 +1622,7 @@
                                $period = $year . sprintf("%02s", $month);
                                
                                $project_budget[$period] = 
(int)$this->db->f('budget');
+                               $closed_period[$period] = 
!!$this->db->f('closed');
                        }
                        unset($year);                   
 
@@ -1878,13 +1889,14 @@
                                $month = substr( $entry['period'], 4, 2 );
                                $entry['month'] = $month == '00' ? '' : $month;
                                $entry['diff'] = $entry['budget'] - 
$entry['sum_orders'] - $entry['actual_cost'];
+                               $entry['closed'] = 
$closed_period[$entry['period']];
                        }
 
 //_debug_array( $values);die();
                        return $values;
                }
 
-               function delete_year_from_budget($project_id, $data)
+               function delete_period_from_budget($project_id, $data)
                {
                        $project_id = (int) $project_id;
                        foreach($data as $entry)
@@ -1895,6 +1907,47 @@
                        }
                }
 
+               function close_period_from_budget($project_id, $data)
+               {
+                       $project_id = (int) $project_id;
+                       $close_period = array();
+                       $open_period = array();
+
+                       foreach($data['closed_orig_b_period'] as $period)
+                       {
+                               if(!in_array($period, $data['closed_b_period']))
+                               {
+                                       $open_period[] = $period;
+                               }
+                       }
+
+                       foreach($data['closed_b_period'] as $period)
+                       {
+                               if(!in_array($period, 
$data['closed_orig_b_period']))
+                               {
+                                       $close_period[] = $period;
+                               }
+                       }
+
+                       foreach ($close_period as $period)
+                       {
+                               $when = explode('_', $period);
+                               $sql = "UPDATE fm_project_budget SET closed = 1 
WHERE project_id = {$project_id} AND year =" . (int) $when[0] . ' AND month = ' 
. (int) $when[1];
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+
+                       foreach ($open_period as $period)
+                       {
+                               $when = explode('_', $period);
+                               $sql = "UPDATE fm_project_budget SET closed = 0 
WHERE project_id = {$project_id} AND year =" . (int) $when[0] . ' AND month = ' 
. (int) $when[1];
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+//_debug_array($close_period);
+//_debug_array($open_period);die();
+
+
+               }
+
                function 
update_request_status($project_id='',$status='',$category=0,$coordinator=0)
                {
                        $historylog_r   = 
CreateObject('property.historylog','request');

Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -1680,10 +1680,15 @@
                        if($id)
                        {
                                $content_budget = $this->bo->get_budget($id);
-                               $lang_delete = lang('Check to delete year');
+                               $lang_delete = lang('Check to delete period');
+                               $lang_delete = lang('Check to close period');
                                foreach($content_budget as & $b_entry)
                                {
-                                       $b_entry['delete_year'] = "<input 
type='checkbox' name='values[delete_b_year][]' 
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_delete}'>";
+                                       $checked = $b_entry['closed'] ? 
'checked="checked"' : '';
+                                       
+                                       $b_entry['delete_year'] = "<input 
type='checkbox' name='values[delete_b_period][]' 
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_delete}'>";
+                                       $b_entry['closed'] = "<input 
type='checkbox' name='values[closed_b_period][]' 
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_close}' $checked>";
+                                       $b_entry['closed_orig'] = "<input 
type='checkbox' name='values[closed_orig_b_period][]' 
value='{$b_entry['year']}_{$b_entry['month']}' $checked>";
                                        $value_remainder -= 
$b_entry['sum_orders'];
                                        $value_remainder -= 
$b_entry['actual_cost'];
                                }
@@ -1715,6 +1720,8 @@
                                                                                
                                array('key' => 'sum_orders','label'=>lang('sum 
orders'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
                                                                                
                                array('key' => 
'actual_cost','label'=>lang('actual 
cost'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
                                                                                
                                array('key' => 
'diff','label'=>lang('difference'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'closed','label'=>lang('closed'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter'),
+                                                                               
                                array('key' => 'closed_orig','hidden' => true),
                                                                                
                                array('key' => 
'delete_year','label'=>lang('Delete'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')))
                                );
 

Modified: branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -1532,6 +1532,20 @@
 
                                $subject  = lang('Workorder').": 
".$workorder_id;
 
+                               $address_element = 
execMethod('property.botts.get_address_element', $location_code);
+                               $_address = array();
+                               foreach($address_element as $entry)
+                               {
+                                       $_address[] = "{$entry['text']}: 
{$entry['value']}";
+                               }
+                               
+                               if($_address)
+                               {
+                                       $subject .= ', ' . implode(', ', 
$_address);
+                               }
+                               unset($_address);
+                               unset($address_element);
+
                                $attachments = array();
                                $attachment_log = '';
                                if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])

Modified: branches/Version-1_0-branch/property/js/yahoo/project.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/js/yahoo/project.edit.js       
2012-10-03 16:26:02 UTC (rev 10108)
@@ -117,7 +117,7 @@
                td_sum(tmp_sum2);
                td_sum(tmp_sum3);
                td_sum(tmp_sum4);
-               td_empty(1);
+               td_empty(3);
 
                myfoot = tableYUI0.createTFoot();
                myfoot.setAttribute("id","myfoot");

Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php    2012-10-03 
16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php    2012-10-03 
16:26:02 UTC (rev 10108)
@@ -12,7 +12,7 @@
        */
 
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.650';
+       $setup_info['property']['version']              = '0.9.17.651';
        $setup_info['property']['app_order']    = 8;
        $setup_info['property']['enable']               = 1;
        $setup_info['property']['app_group']    = 'office';

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2012-10-03 16:26:02 UTC (rev 10108)
@@ -1463,6 +1463,7 @@
                                'year' => array('type' => 'int','precision' => 
4,'nullable' => False),
                                'month' => array('type' => 'int','precision' => 
2,'nullable' => False,'default' => 0),
                                'budget' => array('type' => 
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' => 
'0.00'),
+                               'closed' => array('type' => 'int','precision' 
=> 2,'nullable' => True),
                                'user_id' => array('type' => 'int','precision' 
=> 4,'nullable' => True),
                                'entry_date' => array('type' => 
'int','precision' => 4,'nullable' => True),
                                'modified_date' => array('type' => 
'int','precision' => 4,'nullable' => True)

Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2012-10-03 16:22:56 UTC (rev 10107)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2012-10-03 16:26:02 UTC (rev 10108)
@@ -6656,4 +6656,27 @@
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.650';
                        return $GLOBALS['setup_info']['property']['currentver'];
                }
-       }       
+       }
+
+       /**
+       * Update property version from 0.9.17.650 to 0.9.17.651
+       * Enable to close periode on budget
+       */
+       $test[] = '0.9.17.650';
+       function property_upgrade0_9_17_650()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+               
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_project_budget','closed',array(
+                       'type'          => 'int',
+                       'precision'     => 2,
+                       'nullable'      => true
+                       )
+               );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.651';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }




reply via email to

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