fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10541] Merge 10529:10540 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [10541] Merge 10529:10540 from trunk
Date: Tue, 27 Nov 2012 09:26:35 +0000

Revision: 10541
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10541
Author:   sigurdne
Date:     2012-11-27 09:26:34 +0000 (Tue, 27 Nov 2012)
Log Message:
-----------
Merge 10529:10540 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/admin/inc/hook_after_navbar.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.phpgw.inc.php
    branches/Version-1_0-branch/phpgwapi/templates/portico/navbar.inc.php
    branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
    branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
    branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
    branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
    branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
    branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js
    branches/Version-1_0-branch/property/setup/tables_current.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/condition_survey.xsl

Property Changed:
----------------
    branches/Version-1_0-branch/
    
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.js
    
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
    branches/Version-1_0-branch/property/inc/import/import_update_generic.php
    branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
    branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js
    branches/Version-1_0-branch/property/templates/base/condition_survey.xsl


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

Modified: branches/Version-1_0-branch/admin/inc/hook_after_navbar.inc.php
===================================================================
--- branches/Version-1_0-branch/admin/inc/hook_after_navbar.inc.php     
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/admin/inc/hook_after_navbar.inc.php     
2012-11-27 09:26:34 UTC (rev 10541)
@@ -97,6 +97,7 @@
                }
        }
        
+/*
        if( phpgw::get_var('phpgw_return_as') != 'json' && $receipt = 
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
        {
                phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
@@ -105,8 +106,8 @@
                foreach($msgbox_data as & $message)
                {
                        echo "<div class='{$message['msgbox_class']}'>";
-//                     echo "<img src='{$message['msgbox_img']}' 
alt='{$message['msgbox_img_alt']}' title='{$message['msgbox_img_alt']}'/>";
                        echo $message['msgbox_text'];
                        echo '</div>';
                }
        }
+*/

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.phpgw.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.phpgw.inc.php        
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.phpgw.inc.php        
2012-11-27 09:26:34 UTC (rev 10541)
@@ -424,6 +424,7 @@
                                                return (float) $default;
                                        
                                        case 'int':
+                                       case 'integer':
                                        case 'number':
                                                if ( (int) $value == $value )
                                                {

Modified: branches/Version-1_0-branch/phpgwapi/templates/portico/navbar.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/templates/portico/navbar.inc.php       
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/phpgwapi/templates/portico/navbar.inc.php       
2012-11-27 09:26:34 UTC (rev 10541)
@@ -150,6 +150,19 @@
                }
 
 
+               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);
+                       foreach($msgbox_data as & $message)
+                       {
+                               echo "<div class='{$message['msgbox_class']}'>";
+                               echo $message['msgbox_text'];
+                               echo '</div>';
+                       }
+               }
+
                $GLOBALS['phpgw']->hooks->process('after_navbar');
                register_shutdown_function('parse_footer_end');
        }

Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-11-27 09:26:34 UTC (rev 10541)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 
2003,2004,2005,2006,2007,2008,2009,2010,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
@@ -2012,11 +2012,14 @@
 //_debug_array($insert_record);die();
                        if($insert_record)
                        {
-                               for ($i=0; 
$i<count($insert_record['location']); $i++)
+                               if( isset($insert_record['location']) && 
is_array($insert_record['location']) )
                                {
-                                       
if(isset($_POST[$insert_record['location'][$i]]) && 
$_POST[$insert_record['location'][$i]])
+                                       for ($i=0; 
$i<count($insert_record['location']); $i++)
                                        {
-                                               
$values['location'][$insert_record['location'][$i]]= 
phpgw::get_var($insert_record['location'][$i], 'string', 'POST');
+                                               
if(isset($_POST[$insert_record['location'][$i]]) && 
$_POST[$insert_record['location'][$i]])
+                                               {
+                                                       
$values['location'][$insert_record['location'][$i]]= 
phpgw::get_var($insert_record['location'][$i], 'string', 'POST');
+                                               }
                                        }
                                }
 
@@ -2034,7 +2037,10 @@
                                {
                                        foreach 
($insert_record['additional_info'] as $additional_info)
                                        {
-                                               
$values['additional_info'][$additional_info['input_text']]      = 
phpgw::get_var($additional_info['input_name'], 'string', 'POST');
+                                               if($additional_info_value = 
phpgw::get_var($additional_info['input_name'], 'string', 'POST'))
+                                               {
+                                                       
$values['additional_info'][$additional_info['input_text']]      = 
$additional_info_value;
+                                               }
                                        }
                                }
                        }
@@ -2044,6 +2050,7 @@
                        if(isset($values['location']) && 
is_array($values['location']))
                        {
                                $values['location_name']        = 
phpgw::get_var('loc' . (count($values['location'])).'_name', 'string', 'POST'); 
// if not address - get the parent name as address
+                               $values['location_code']        = implode('-', 
$values['location']);
                        }
 
                        return $values;

Modified: 
branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php   
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php   
2012-11-27 09:26:34 UTC (rev 10541)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Free 
Software Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 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
@@ -45,11 +45,17 @@
                var $allrows;
                public $acl_location = '.project.condition_survey';
 
+               var $public_functions = array
+               (
+                       'addfiles'              => true
+               );
+
                function __construct($session=false)
                {
                        $this->so                       = 
CreateObject('property.socondition_survey');
                        $this->custom           = & $this->so->custom;
                        $this->bocommon         = 
CreateObject('property.bocommon');
+                       $this->dateformat                       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
                        $start                          = 
phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query                          = 
phpgw::get_var('query');
@@ -125,6 +131,53 @@
                        return $column_list;
                }
 
+               public function addfiles()
+               {
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+                       $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+
+                       $acl                    = & $GLOBALS['phpgw']->acl;
+                       $acl_add                = 
$acl->check($this->acl_location, PHPGW_ACL_ADD, 'property');
+                       $acl_edit               = 
$acl->check($this->acl_location, PHPGW_ACL_EDIT, 'property');
+                       $id                             = phpgw::get_var('id', 
'int');
+                       $check                  = phpgw::get_var('check', 
'bool');
+                       $fileuploader   = CreateObject('property.fileuploader');
+
+                       if(!$acl_add && !$acl_edit)
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       if(!$id)
+                       {
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+
+                       $test = true;
+                       if ($test)
+                       {
+                               if (!empty($_FILES))
+                               {
+                                       $tempFile = 
$_FILES['Filedata']['tmp_name'];
+                                       $targetPath = 
"{$GLOBALS['phpgw_info']['server']['temp_dir']}/";
+                                       $targetFile =  
str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
+                                       
move_uploaded_file($tempFile,$targetFile);
+                                       echo 
str_replace($GLOBALS['phpgw_info']['server']['temp_dir'],'',$targetFile);
+                               }
+                               $GLOBALS['phpgw']->common->phpgw_exit();
+                       }
+       
+                       if($check)
+                       {
+                               $fileuploader->check("condition_survey/{$id}");
+                       }
+                       else
+                       {
+                               $fileuploader->upload("condition_survey/{$id}");
+                       }
+               }
+
                public function read($data = array())
                {
                        $values = $this->so->read($data);
@@ -138,42 +191,79 @@
                        
if($GLOBALS['phpgw']->locations->get_attrib_table('property', 
$this->acl_location))
                        {
                                $custom_fields = true;
-                               $values = array();
-                               $values['attributes'] = 
$this->custom->find('property', $this->acl_location, 0, '', 'ASC', 
'attrib_sort', true, true);
+                               $data['attributes'] = 
$this->custom->find('property', $this->acl_location, 0, '', 'ASC', 
'attrib_sort', true, true);
                        }
 
+                       $values = array();
                        if(isset($data['id']) && $data['id'])
                        {
-                               $values = $this->so->read_single($data, 
$values);
+                               $values = $this->so->read_single($data);
                        }
                        if($custom_fields)
                        {
                                $values = $this->custom->prepare($values, 
'property', $this->acl_location, $data['view']);
                        }
+
+                       $values['report_date']  = 
$GLOBALS['phpgw']->common->show_date($values['report_date'],$this->dateformat);
+
+                       if(isset($values['vendor_id']) && $values['vendor_id'] 
&& !$values['vendor_name'])
+                       {
+                               $contacts       = 
CreateObject('property.sogeneric');
+                               $contacts->get_location_info('vendor',false);
+
+                               $custom                 = 
createObject('property.custom_fields');
+                               $vendor_data['attributes'] = 
$custom->find('property','.vendor', 0, '', 'ASC', 'attrib_sort', true, true);
+
+                               $vendor_data    = 
$contacts->read_single(array('id' => $values['vendor_id']),$vendor_data);
+                               if(is_array($vendor_data))
+                               {
+                                       foreach($vendor_data['attributes'] as 
$attribute)
+                                       {
+                                               
if($attribute['name']=='org_name')
+                                               {
+                                                       
$values['vendor_name']=$attribute['value'];
+                                                       break;
+                                               }
+                                       }
+                               }
+                               unset($contacts);
+                       }
+
+                       if($values['coordinator_id'])
+                       {
+                               $values['coordinator_name']     = 
$GLOBALS['phpgw']->accounts->get($values['coordinator_id'])->__toString();
+                       }
                        return $values;
                }
 
-               public function save($data,$action='',$values_attribute = 
array())
+               public function save($data = array())
                {
-                       if(is_array($values_attribute))
+                       if(isset($data['attributes']) && 
is_array($data['attributes']))
                        {
-                               $values_attribute = 
$this->custom->convert_attribute_save($values_attribute);
+                               $data['attributes'] = 
$this->custom->convert_attribute_save($data['attributes']);
                        }
 
-                       if ($action=='edit')
+                       try
                        {
-                               if ($data['id'] != '')
+                               if (isset($data['id']) && $data['id'])
                                {
-
-                                       $receipt = 
$this->so->edit($data,$values_attribute);
+                                       $id = $this->so->edit($data);
                                }
+                               else
+                               {
+                                       $id = $this->so->add($data);
+                               }
                        }
-                       else
+
+                       catch(Exception $e)
                        {
-                               $receipt = 
$this->so->add($data,$values_attribute);
+                               if ( $e )
+                               {
+                                       throw $e;                               
+                               }
                        }
 
-                       return $receipt;
+                       return $id;
                }
 
                public function delete($id)

Modified: branches/Version-1_0-branch/property/inc/class.bolocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.bolocation.inc.php   
2012-11-27 09:26:34 UTC (rev 10541)
@@ -596,7 +596,9 @@
                        }
                        if(isset($insert_record))
                        {
-                               
$GLOBALS['phpgw']->session->appsession('insert_record','property',$insert_record);
+       //                      
$GLOBALS['phpgw']->session->appsession('insert_record','property',$insert_record);
+                               phpgwapi_cache::session_set('property', 
'insert_record',$insert_record);
+
                        }
                        //                      
$GLOBALS['phpgw']->session->appsession('input_name','property',$input_name);
 

Modified: branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php        
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php        
2012-11-27 09:26:34 UTC (rev 10541)
@@ -313,7 +313,10 @@
 
                                        });
 JS;
-                                       $GLOBALS['phpgw']->js->add_code('', 
$_autocomplete);
+                                       if(!$view_only)
+                                       {
+                                               
$GLOBALS['phpgw']->js->add_code('', $_autocomplete);
+                                       }
 
                                }
                                else if($attributes['datatype'] == 'user')

Modified: 
branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php   
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php   
2012-11-27 09:26:34 UTC (rev 10541)
@@ -3,7 +3,7 @@
        * phpGroupWare - property: a Facilities Management System.
        *
        * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * @copyright Copyright (C) 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
@@ -27,6 +27,8 @@
        * @version $Id$
        */
 
+       phpgw::import_class('phpgwapi.datetime');
+
        /**
         * Description
         * @package property
@@ -64,10 +66,11 @@
 
                public function __construct()
                {
-                       $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->_db              = & $GLOBALS['phpgw']->db;
-                       $this->_join    = & $this->_db->join;
-                       $this->_like    = & $this->_db->like;
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->_db                      = & 
$GLOBALS['phpgw']->db;
+                       $this->_join            = & $this->_db->join;
+                       $this->_like            = & $this->_db->like;
+                       $this->custom           = 
createObject('property.custom_fields');
                }
 
                /**
@@ -139,24 +142,28 @@
                                $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
+                       $values = array();
                        while ($this->_db->next_record())
                        {
-                               $customs[] = array
-                                       (
-                                               'custom_id'             => 
$this->_db->f('id'),
-                                               'name'                  => 
stripslashes($this->_db->f('name')),
-                                               'entry_date'    => 
$this->_db->f('entry_date'),
-                                               'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->_db->f('user_id'))
-                                       );
+                               $values[] = array
+                               (
+                                       'id'                    => 
$this->_db->f('id'),
+                                       'title'                 => 
$this->_db->f('title',true),
+                                       'descr'                 => 
$this->_db->f('descr',true),
+                                       'address'               => 
$this->_db->f('address',true),
+                                       'entry_date'    => 
$this->_db->f('entry_date'),
+                                       'user'                  => 
$this->_db->f('user_id')
+                               );
                        }
-                       return $customs;
+
+                       return $values;
                }
 
-               function read_single($id)
+               function read_single($data = array())
                {
                        $table = 'fm_condition_survey';
 
-                       $id = (int) $id;
+                       $id             = (int)$data['id'];
                        $this->_db->query("SELECT * FROM {$table} WHERE 
id={$id}",__LINE__,__FILE__);
 
                        $values = array();
@@ -164,12 +171,28 @@
                        {
                                $values = array
                                (
-                                       'id'                    => 
(int)$this->_db->f('id'),
-                                       'name'                  => 
$this->_db->f('name', true),
-                                       'sql_text'              => 
$this->_db->f('sql_text', true),
-                                       'entry_date'    => 
$this->_db->f('entry_date'),
+                                       'id'                            => $id,
+                                       'title'                         => 
$this->_db->f('title',true),
+                                       'descr'                         => 
$this->_db->f('descr', true),
+                                       'location_code'         => 
$this->_db->f('location_code', true),
+                                       'status_id'                     => 
(int)$this->_db->f('status_id'),
+                                       'cat_id'                        => 
(int)$this->_db->f('category'),
+                                       'vendor_id'                     => 
(int)$this->_db->f('vendor_id'),
+                                       'coordinator_id'        => 
(int)$this->_db->f('coordinator_id'),
+                                       'report_date'           => 
(int)$this->_db->f('report_date'),
+                                       'user_id'                       => 
(int)$this->_db->f('user_id'),
+                                       'entry_date'            => 
(int)$this->_db->f('entry_date'),
+                                       'modified_date'         => 
(int)$this->_db->f('modified_date'),
+                               );
 
-                               );
+                               if ( isset($data['attributes']) && 
is_array($data['attributes']) )
+                               {
+                                       $values['attributes'] = 
$data['attributes'];
+                                       foreach ( $values['attributes'] as 
&$attr )
+                                       {
+                                               $attr['value']  = 
$this->db->f($attr['column_name']);
+                                       }
+                               }
                        }
 
                        return $values;
@@ -179,34 +202,43 @@
                function add($data)
                {
                        $table = 'fm_condition_survey';
-                       $custom['sql_text'] = 
$this->_db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
                        $this->_db->transaction_begin();
 
                        $id = $this->_db->next_id($table);
 
-                       $value_set = array
-                       (
-                               'id'                            => $id,
-                               'title'                         => 
$this->_db->db_addslashes($data['title']),
-                               'month'                         => 
$entry['month'],
-                               'budget'                        => 
$entry['budget'],
-                               'user_id'                       => 
$entry['user_id'],
-                               'entry_date'            => $entry['entry_date'],
-                               'modified_date'         => 
$entry['modified_date']
-                       );
+                       $value_set                                      = 
$this->_get_value_set( $data );
+                       $value_set['id']                        = $id;
+                       $value_set['entry_date']        = time();
+
                        $cols = implode(',', array_keys($value_set));
                        $values = 
$this->_db->validate_insert(array_values($value_set));
-                       $this->_db->query("INSERT INTO {$table} ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
+                       $sql = "INSERT INTO {$table} ({$cols}) VALUES 
({$values})";
 
-                       $receipt['id']= $id;
+                       try
+                       {
+                               $this->_db->Exception_On_Error = true;
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               $this->_db->Exception_On_Error = false;
+                       }
 
+                       catch(Exception $e)
+                       {
+                               if ( $e )
+                               {
+                                       throw $e;                               
+                               }
+                               return 0;
+                       }
+
                        if($this->_db->transaction_commit())
                        {
-                               $this->_receipt['message'][] = 
array('msg'=>lang('survey %1 has been saved',$id));
                                return $id;
                        }
-                       return 0;
+                       else
+                       {
+                               return 0;
+                       }
                }
 
                function edit($data)
@@ -214,19 +246,127 @@
                        $table = 'fm_condition_survey';
                        $id = (int)$data['id'];
 
-                       $value_set      = 
$this->db->validate_update($value_set);
+                       $value_set      = $this->_get_value_set( $data );
+                       $value_set      = 
$this->_db->validate_update($value_set);
 
-                       $this->db->transaction_begin();
+                       $this->_db->transaction_begin();
 
-                       $this->db->query("UPDATE {$table} SET $value_set WHERE 
id= {$id}",__LINE__,__FILE__);
+                       $sql = "UPDATE {$table} SET $value_set WHERE id= {$id}";
 
-                       if($this->_db->transaction_commit())
+                       try
                        {
-                               $this->_receipt['message'][] = 
array('msg'=>lang('survey %1 has been saved',$id));
+                               $this->_db->Exception_On_Error = true;
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               $this->_db->Exception_On_Error = false;
                        }
+
+                       catch(Exception $e)
+                       {
+                               if ( $e )
+                               {
+                                       throw $e;                               
+                               }
+                       }
+
+                       $this->_db->transaction_commit();
                        return $id;
                }
 
+
+               private function _get_value_set($data)
+               {
+                       $value_set = array
+                       (
+                               'title'                         => 
$this->_db->db_addslashes($data['title']),
+                               'descr'                         => 
$this->_db->db_addslashes($data['descr']),
+                               'status_id'                     => 
(int)$data['status_id'],
+                               'category'                      => 
(int)$data['cat_id'],
+                               'vendor_id'                     => 
(int)$data['vendor_id'],
+                               'coordinator_id'        => 
(int)$data['coordinator_id'],
+                               'report_date'           => 
phpgwapi_datetime::date_to_timestamp($data['report_date']),
+                               'user_id'                       => 
$this->account,
+                               'modified_date'         => time(),
+                       );
+
+
+                       if(isset($data['location']) && 
is_array($data['location']))
+                       {
+                               foreach ($data['location'] as $input_name => 
$value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $value_set[$input_name] = 
$value;
+                                       }
+                               }
+                               $value_set['location_code'] = implode('-', 
$data['location']);
+                       }
+
+                       if(isset($data['extra']) && is_array($data['extra']))
+                       {
+                               foreach ($data['extra'] as $input_name => 
$value)
+                               {
+                                       if(isset($value) && $value)
+                                       {
+                                               $value_set[$input_name] = 
$value;
+                                       }
+                               }
+
+                               if($data['extra']['p_num'] && 
$data['extra']['p_entity_id'] && $data['extra']['p_cat_id'])
+                               {
+                                       $entity = 
CreateObject('property.soadmin_entity');
+                                       $entity_category = 
$entity->read_single_category($data['extra']['p_entity_id'],$data['extra']['p_cat_id']);
+                               }
+                       }
+
+                       if(isset($values['attributes']) && 
is_array($values['attributes']))
+                       {
+                               $data_attribute = 
$this->custom->prepare_for_db($table, $values['attributes']);
+                               if(isset($data_attribute['value_set']))
+                               {
+                                       foreach($data_attribute['value_set'] as 
$input_name => $value)
+                                       {
+                                               if(isset($value) && $value)
+                                               {
+                                                       $value_set[$input_name] 
= $value;
+                                               }
+                                       }
+                               }
+                       }
+
+                       $_address = array();
+                       if(isset($data['street_name']) && $data['street_name'])
+                       {
+                               $_address[] = "{$data['street_name']} 
{$data['street_number']}";
+                       }
+
+                       if(isset($data['location_name']) && 
$data['location_name'])
+                       {
+                               $_address[] = $data['location_name'];
+                       }
+
+                       if(isset($data['additional_info']) && 
$data['additional_info'])
+                       {
+                               foreach($data['additional_info'] as $key => 
$value)
+                               {
+                                       if($value)
+                                       {
+                                               $_address[] = "{$key}|{$value}";
+                                       }
+                               }
+                       }
+
+                       if(isset($entity_category) && $entity_category)
+                       {
+                               $_address[] = 
"{$entity_category['name']}::{$data['extra']['p_num']}";
+                       }
+
+                       $address        = 
$this->_db->db_addslashes(implode('::', $_address));
+
+                       $value_set['address'] = $address;
+
+                       return $value_set;
+               }
+
                function delete($id)
                {
                        $id = (int) $id;

Modified: 
branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php   
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php   
2012-11-27 09:26:34 UTC (rev 10541)
@@ -34,14 +34,17 @@
        {
 
                private $bo;
-               public $public_functions = array(
-                       'query' => true,
-                       'index' => true,
-                       'view' => true,
-                       'add' => true,
-                       'edit' => true,
-                       'save' => true,
-                       'get_vendors'   => true
+               private $receipt = array();
+               public $public_functions = array
+               (
+                       'query'                 => true,
+                       'index'                 => true,
+                       'view'                  => true,
+                       'add'                   => true,
+                       'edit'                  => true,
+                       'save'                  => true,
+                       'get_vendors'   => true,
+                       'get_users'             => true
                );
 
                public function __construct()
@@ -81,8 +84,8 @@
                        phpgwapi_yui::load_widget('paginator');
 
                        $categories = $this->_get_categories();
-                       
 
+
                        $data = array(
                                'datatable_name'        => lang('condition 
survey'),
                                'form' => array(
@@ -133,20 +136,20 @@
                                                        'formatter' => 
'YAHOO.portico.formatLink'
                                                ),
                                                array(
-                                                       'key' => 'name',
-                                                       'label' => lang('name'),
+                                                       'key' => 'title',
+                                                       'label' => 
lang('title'),
                                                        'sortable' => true
                                                ),
                                                array(
-                                                       'key' => 'description',
+                                                       'key' => 'descr',
                                                        'label' => 
lang('description'),
                                                        'sortable' => false,
                                                        'editor' => 'new 
YAHOO.widget.TextboxCellEditor({disableBtns:true})'
                                                ),
                                                array(
-                                                       'key' => 
'survey_type_label',
-                                                       'label' => lang('type'),
-                                                       'sortable' => false
+                                                       'key' => 'address',
+                                                       'label' => 
lang('address'),
+                                                       'sortable' => true
                                                ),
                                                array(
                                                        'key' => 'link',
@@ -174,7 +177,7 @@
                                                'text'                  => 
lang('edit'),
                                                'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
                                                (
-                                                       'menuaction'    => 
'logistic.uiactivity.edit'
+                                                       'menuaction'    => 
'property.uicondition_survey.edit'
                                                )),
                                                'parameters'    => 
json_encode($parameters)
                                        );
@@ -210,7 +213,7 @@
                        $export = phpgw::get_var('export');
 
                        $values = $this->bo->read($params);
-
+//_debug_array($values);
                        // ... add result data
                        $result_data = array('results' => $values);
 
@@ -237,7 +240,7 @@
                                $this->bocommon->no_access();
                                return;
                        }
-                       $this->edit($mode = 'view');
+                       $this->edit(null, $mode = 'view');
                }
 
                public function add()
@@ -245,7 +248,7 @@
                        $this->edit();
                }
 
-               public function edit($mode = 'edit')
+               public function edit($values = array(), $mode = 'edit')
                {
                        $id     = phpgw::get_var('id', 'int');
 
@@ -271,8 +274,6 @@
                                }
                        }
 
-                       $values = array();
-
                        phpgwapi_yui::tabview_setup('survey_edit_tabview');
                        $tabs = array();
                        $tabs['generic']        = array('label' => 
lang('generic'), 'link' => '#generic');
@@ -280,18 +281,24 @@
                        $tabs['documents']      = array('label' => 
lang('documents'), 'link' => null);
                        $tabs['import'] = array('label' => lang('import'), 
'link' => null);
 
+                       if ($id)
+                       {
                                $tabs['documents']['link'] = '#documents';
                                $tabs['import']['link'] = '#import';
 
-                       if ($id)
+                               if (!$values)
+                               {
+                                       $values = $this->bo->read_single( 
array('id' => $id,  'view' => $mode == 'view') );
+                               }
+                       }
+
+                       if(isset($values['location_code']) && 
$values['location_code'])
                        {
-
-                               $values = $this->so->read_single( array('id' => 
$id,  'view' => $mode == 'view') );
+                               $values['location_data'] = 
execMethod('property.solocation.read_single', $values['location_code']);
                        }
 
+                       $categories = $this->_get_categories($values['cat_id']);
 
-                       $categories = 
$this->_get_categories($survey['category']);
-
                        $bolocation     = CreateObject('property.bolocation');
                        $location_data = $bolocation->initiate_ui_location(array
                                (
@@ -304,56 +311,116 @@
                                        'entity_data'   => 
isset($values['p'])?$values['p']:''
                                ));
 
+                       $msgbox_data = 
$this->bocommon->msgbox_data($this->receipt);
 
                        $data = array
                        (
+                               'msgbox_data'           => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
                                'survey'                        => $values,
+                               'location_data'         => $location_data,
                                'categories'            => array('options' => 
$categories),
                                'status_list'           => array('options' => 
execMethod('property.bogeneric.get_list',array('type' => 
'condition_survey_status', 'selected' => $values['status_id'], 'add_empty' => 
true))),
                                'editable'                      => $mode == 
'edit',
                                'tabs'                          => 
phpgwapi_yui::tabview_generate($tabs, $active_tab),
-                               'location_data'         => $location_data,
+                               'fileupload'                                    
=> true,
+                               'multiple_uploader'                             
=> true,
+                               'fileuploader_action'                   => 
"{menuaction:'property.fileuploader.add',"
+                                                                               
                                
."upload_target:'property.bocondition_survey.addfiles',"
+                                                                               
                                ."id:'{$id}'}",
                        );
-
+//_debug_array($data);die();
                        $GLOBALS['phpgw']->jqcal->add_listener('report_date');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');
-                       
+
                        phpgwapi_jquery::load_widget('core');
                        self::add_javascript('property', 'portico', 
'condition_survey_edit.js');
                        self::add_javascript('phpgwapi', 'yui3', 
'yui/yui-min.js');
                        self::add_javascript('phpgwapi', 'yui3', 
'gallery-formvalidator/gallery-formvalidator-min.js');
                        
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yui3/gallery-formvalidator/validatorCss.css');
-                       self::render_template_xsl(array('condition_survey'), 
$data);
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
+                       
self::render_template_xsl(array('condition_survey','files'), $data);
                }
-               
+
                public function save()
                {
                        $id = phpgw::get_var('id');
-                       
+
                        if ($id )
                        {
-                               $project = $this->so->get_single($id);
+                               $values = $this->bo->read_single( array('id' => 
$id,  'view' => true) );
                        }
                        else
                        {
-                               $project = new logistic_project();
+                               $values = array();
                        }
-                       
-                       $project->populate();
-                       
-                       if( $project->validate() )
+
+                       /*
+                       * Overrides with incoming data from POST
+                       */
+                       $values = $this->_populate($values);
+
+                       if( $this->receipt['error'] )
                        {
-                               $id = $this->so->store($project);
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.view', 'id' => $id)); 
+                               $this->edit( $values );
                        }
                        else
                        {
-                               $this->edit( $project );
+
+                               try
+                               {
+                                       $id = $this->bo->save($values);
+                               }
+
+                               catch(Exception $e)
+                               {
+                                       if ( $e )
+                                       {
+                                               
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                               $this->edit( $values );
+                                               return;
+                                       }
+                               }
+
+                               phpgwapi_cache::message_set('ok!', 'message'); 
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.view', 'id' => $id));
                        }
                }
 
+               public function get_users()
+               {
+                       if(!$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $query = phpgw::get_var('query');
+
+                       $accounts = 
$GLOBALS['phpgw']->accounts->get_list('accounts', $start, $sort, $order, 
$query,$offset);
+
+                       $values = array();
+                       foreach($accounts as $account)
+                       {
+                               if ($account->enabled)
+                               {
+                                       $values[] = array
+                                       (
+                                               'id'    => $account->id,
+                                               'name'  => 
$account->__toString(),
+                                       );
+                               }
+                       }
+                       return array('ResultSet'=> array('Result'=>$values));
+               }
+
                public function get_vendors()
                {
+                       if(!$this->acl_read)
+                       {
+                               return;
+                       }
+
                        $query = phpgw::get_var('query');
 
                        $sogeneric = CreateObject('property.sogeneric', 
'vendor');
@@ -365,6 +432,130 @@
                        return array('ResultSet'=> array('Result'=>$values));
                }
 
+
+               /*
+               * Overrides with incoming data from POST
+               */
+               private function _populate($data = array())
+               {
+                       $insert_record = 
phpgwapi_cache::session_get('property', 'insert_record');
+
+                       $values = phpgw::get_var('values');
+
+                       $_fields = array
+                       (
+                               array
+                               (
+                                       'name' => 'title',
+                                       'type'  => 'string',
+                                       'required'      => true
+                               ),
+                               array
+                               (
+                                       'name' => 'descr',
+                                       'type'  => 'string',
+                                       'required'      => true
+                               ),
+                               array
+                               (
+                                       'name' => 'cat_id',
+                                       'type'  => 'integer',
+                                       'required'      => true
+                               ),
+                               array
+                               (
+                                       'name' => 'report_date',
+                                       'type'  => 'string',
+                                       'required'      => true
+                               ),
+                               array
+                               (
+                                       'name' => 'status_id',
+                                       'type'  => 'integer',
+                                       'required'      => true
+                               ),
+                               array
+                               (
+                                       'name' => 'vendor_id',
+                                       'type'  => 'integer',
+                                       'required'      => false
+                               ),
+                               array
+                               (
+                                       'name' => 'vendor_name',
+                                       'type'  => 'string',
+                                       'required'      => false
+                               ),
+                               array
+                               (
+                                       'name' => 'coordinator_id',
+                                       'type'  => 'integer',
+                                       'required'      => false
+                               ),
+                               array
+                               (
+                                       'name' => 'coordinator_name',
+                                       'type'  => 'string',
+                                       'required'      => false
+                               ),
+                       );
+
+
+                       foreach ($_fields as $_field)
+                       {
+                               if($data[$_field['name']] = 
$_POST['values'][$_field['name']])
+                               {
+                                       $data[$_field['name']] =  
phpgw::clean_value($data[$_field['name']], $_field['type']);
+                               }
+                               if($_field['required'] && 
!$data[$_field['name']])
+                               {
+                                       
$this->receipt['error'][]=array('msg'=>lang('Please enter value for attribute 
%1', $_field['name']));
+                               }
+                       }
+
+//_debug_array($data);die();
+
+                       $values = 
$this->bocommon->collect_locationdata($data,$insert_record);
+
+                       if(!isset($values['location_code']) || ! 
$values['location_code'])
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('Please select a location !'));
+                       }
+
+                       /*
+                       * Extra data from custom fields
+                       */
+                       $values['attributes']   = 
phpgw::get_var('values_attribute');
+
+                       if(is_array($values['attributes']))
+                       {
+                               foreach ($values['attributes'] as $attribute )
+                               {
+                                       if($attribute['nullable'] != 1 && 
(!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                       {
+                                               
$this->receipt['error'][]=array('msg'=>lang('Please enter value for attribute 
%1', $attribute['input_text']));
+                                       }
+                               }
+                       }
+
+                       if(!isset($values['cat_id']) || !$values['cat_id'])
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('Please select a category !'));
+                       }
+
+                       if(!isset($values['title']) || !$values['title'])
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('Please give a title !'));
+                       }
+
+                       if(!isset($values['report_date']) || 
!$values['report_date'])
+                       {
+                               
$this->receipt['error'][]=array('msg'=>lang('Please select a date!'));
+                       }
+
+                       return $values;
+               }
+
                private function _get_categories($selected = 0)
                {
                        $cats   = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
@@ -377,7 +568,7 @@
                        {
                                $_category['id'] = $_category['cat_id'];
                        }
-                       
+
                        return $categories['cat_list'];
                }
        }


Property changes on: 
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.js
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/property/inc/import/import_update_generic.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/property/js/portico/ajax_project_edit.js
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: 
branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js    
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js    
2012-11-27 09:26:34 UTC (rev 10541)
@@ -44,3 +44,26 @@
                'vendor_name', 'vendor_id', 'vendor_container');
        });
 
+       YAHOO.util.Event.addListener(window, "load", function()
+       {
+               var oArgs = 
{menuaction:'property.uicondition_survey.get_users'};
+               var strURL = phpGWLink('index.php', oArgs, true);
+           YAHOO.portico.autocompleteHelper(strURL, 
+               'coordinator_name', 'coordinator_id', 'coordinator_container');
+       });
+
+       this.fileuploader = function()
+       {
+               var requestUrl = phpGWLink('index.php', fileuploader_action);
+               TINY.box.show({iframe:requestUrl, 
boxid:'frameless',width:750,height:450,fixed:false,maskid:'darkmask',maskopacity:40,
 mask:true, animate:true, close: true,closejs:function(){closeJS_local()}});
+       }
+
+
+       function closeJS_local()
+       {
+               var reqUrl = '<xsl:value-of select="//datatable/source"/>';
+               YAHOO.portico.inlineTableHelper('requirement-container', 
reqUrl, YAHOO.portico.columnDefs);
+       }
+
+
+


Property changes on: 
branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php   
2012-11-27 09:26:34 UTC (rev 10541)
@@ -802,9 +802,10 @@
                                'loc3' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
                                'loc4' => array('type' => 'varchar','precision' 
=> '4','nullable' => True),
                                'descr' => array('type' => 'text','nullable' => 
True),
+                               'address' => array('type' => 
'varchar','precision' => '255','nullable' => True),
                                'status_id' => array('type' => 
'int','precision' => '4','nullable' => false),
                                'category' => array('type' => 'int','precision' 
=> '4','nullable' => True),
-                               'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                               'coordinator_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'report_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                'user_id' => 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-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php    
2012-11-27 09:26:34 UTC (rev 10541)
@@ -6850,9 +6850,10 @@
                                        'loc3' => array('type' => 
'varchar','precision' => '4','nullable' => True),
                                        'loc4' => array('type' => 
'varchar','precision' => '4','nullable' => True),
                                        'descr' => array('type' => 
'text','nullable' => True),
+                                       'address' => array('type' => 
'varchar','precision' => '255','nullable' => True),
                                        'status_id' => array('type' => 
'int','precision' => '4','nullable' => false),
                                        'category' => array('type' => 
'int','precision' => '4','nullable' => True),
-                                       'coordinator' => array('type' => 
'int','precision' => '4','nullable' => True),
+                                       'coordinator_id' => array('type' => 
'int','precision' => '4','nullable' => True),
                                        'vendor_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                        'report_date' => array('type' => 'int', 
'precision' => 4,'nullable' => True),
                                        'user_id' => array('type' => 'int', 
'precision' => 4,'nullable' => True),

Modified: 
branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/condition_survey.xsl    
2012-11-26 18:29:14 UTC (rev 10540)
+++ branches/Version-1_0-branch/property/templates/base/condition_survey.xsl    
2012-11-27 09:26:34 UTC (rev 10541)
@@ -1,4 +1,4 @@
-<!-- $Id:$ -->
+<!-- $Id$ -->
 
        <!-- add / edit -->
 <xsl:template match="data" xmlns:formvalidator="http://www.w3.org/TR/html4/"; 
xmlns:php="http://php.net/xsl";>
@@ -54,46 +54,25 @@
                                                        </tr>
                                                </xsl:when>
                                        </xsl:choose>
-                                       <xsl:choose>
-                                               <xsl:when test="value_id !=''">
-                                                       <tr>
-                                                               <td 
class="th_text" valign="top">
-                                                                       <a 
href="{link_pdf}" target="_blank">PDF</a>
-                                                               </td>
-                                                       </tr>
-                                               </xsl:when>
-                                       </xsl:choose>
                                </table>
-                               <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
-                                       <tr>
-                                               <td class="th_text">
-                                                       <xsl:value-of 
select="lang_entity"/>
-                                               </td>
-                                               <td class="th_text">
-                                                       <xsl:value-of 
select="entity_name"/>
-                                               </td>
-                                       </tr>
+                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
+                               <div class="yui-content">
+                                       <div id="generic">
+                                       <table>
                                        <xsl:choose>
-                                               <xsl:when test="value_id!=''">
+                                               <xsl:when test="survey/id!=''">
                                                        <tr>
                                                                <td 
valign="top">
-                                                                       
<xsl:value-of select="lang_id"/>
+                                                                       
<xsl:value-of select="php:function('lang', 'id')" />
                                                                </td>
                                                                <td>
-                                                                       
<xsl:value-of select="value_num"/>
-                                                                       <input 
type="hidden" name="location_code" value="{location_code}"/>
-                                                                       <input 
type="hidden" name="lookup_tenant" value="{lookup_tenant}"/>
-                                                                       <input 
type="hidden" name="values[id]" value="{value_id}"/>
-                                                                       <input 
type="hidden" name="values[num]" value="{value_num}"/>
+                                                                       
<xsl:value-of select="survey/id"/>
+                                                                       <input 
type="hidden" name="id" value="{survey/id}"/>
                                                                </td>
                                                        </tr>
                                                </xsl:when>
                                        </xsl:choose>
-                               </table>
-                               <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
-                               <div class="yui-content">
-                                       <div id="generic">
-                                       <table>
+
                                        <xsl:choose>
                                                <xsl:when 
test="location_data!=''">
                                                                <xsl:choose>
@@ -113,7 +92,7 @@
                                        <td>
                                                <xsl:choose>
                                                        <xsl:when 
test="editable = 1">
-                                                               <input 
id="title" name='title' type="text"
+                                                               <input 
id="title" name='values[title]' type="text" value="{survey/title}"
                                                                        
formvalidator:FormField="yes"
                                                                        
formvalidator:Type="TextBaseField">
                                                                </input>
@@ -126,20 +105,19 @@
                                </tr>
                                <tr>
                                        <td>
-
-                                                       <label 
for="name"><xsl:value-of select="php:function('lang', 'description')" /></label>
+                                               <label for="name"><xsl:value-of 
select="php:function('lang', 'description')" /></label>
                                        </td>
                                        <td>
                                                <xsl:choose>
                                                        <xsl:when 
test="editable = 1">
-                                                               <textarea 
id="description" name="values[description]" rows="5" cols="60"
+                                                               <textarea 
id="descr" name="values[descr]" rows="5" cols="60"
                                                                        
formvalidator:FormField="yes"
                                                                        
formvalidator:Type="TextBaseField">
-                                                                       
<xsl:value-of select="project/description" disable-output-escaping="yes"/>
+                                                                       
<xsl:value-of select="survey/descr" disable-output-escaping="yes"/>
                                                                </textarea>
                                                        </xsl:when>
                                                        <xsl:otherwise>
-                                                               <xsl:value-of 
select="project/description" disable-output-escaping="yes"/>
+                                                               <xsl:value-of 
select="survey/descr" disable-output-escaping="yes"/>
                                                        </xsl:otherwise>
                                                </xsl:choose>
                                        </td>
@@ -170,10 +148,16 @@
                                                        <label 
for="category"><xsl:value-of select="php:function('lang', 'date')" /></label>
                                        </td>
                                        <td>
-                                                       <input id="report_date" 
name='values[report_date]' type="text"
-                                                               
formvalidator:FormField="yes"
-                                                               
formvalidator:type="TextBaseField"/>
-
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                               <input 
id="report_date" name='values[report_date]' type="text" 
value="{survey/report_date}"
+                                                                       
formvalidator:FormField="yes"
+                                                                       
formvalidator:type="TextBaseField"/>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="survey/report_date"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </td>
                                </tr>
                                <tr>
@@ -200,54 +184,47 @@
                                </tr>
                                <tr>
                                        <td>
-                                               <label 
for="vendor"><xsl:value-of select="php:function('lang', 'vendor')" /></label>
+                                               <label 
for="coordinator"><xsl:value-of select="php:function('lang', 'coordinator')" 
/></label>
                                        </td>
                                        <td>
 
                                                <xsl:choose>
                                                        <xsl:when 
test="editable = 1">
                                                            <div 
class="autocomplete">
-                                                               <input 
type="hidden" id="vendor_id" name="values[vendor_id]"  
value="{survey/vendor_id}"/>
-                                                               <input 
type="text" id="vendor_name" name="vendor_name" value="{survey/vendor_name}">
+                                                               <input 
type="hidden" id="coordinator_id" name="values[coordinator_id]"  
value="{survey/coordinator_id}"/>
+                                                               <input 
type="text" id="coordinator_name" name="values[coordinator_name]" 
value="{survey/coordinator_name}">
                                                                        </input>
-                                                               <div 
id="vendor_container"/>
+                                                               <div 
id="coordinator_container"/>
                                                            </div>
                                                        </xsl:when>
                                                        <xsl:otherwise>
-                                                               <xsl:value-of 
select="survey/vendor_name" />
+                                                               <xsl:value-of 
select="survey/coordinator_name" />
                                                        </xsl:otherwise>
                                                </xsl:choose>
 
-<!--
-
                                        </td>
                                </tr>
+
                                <tr>
                                        <td>
+                                               <label 
for="vendor"><xsl:value-of select="php:function('lang', 'vendor')" /></label>
+                                       </td>
+                                       <td>
 
-                                                <div class="label">
-                                                       <label 
for="age2">Age:</label>                                          
-                                                </div>
-                                                       <input id="age2" 
type="text"
-                                                               
formvalidator:FormField="yes"
-                                                               
formvalidator:type="IntegerField"
-                                                               
formvalidator:max="100"
-                                                               
formvalidator:min="10"/>
-                                               <div class="clearDiv"></div>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                           <div 
class="autocomplete">
+                                                               <input 
type="hidden" id="vendor_id" name="values[vendor_id]"  
value="{survey/vendor_id}"/>
+                                                               <input 
type="text" id="vendor_name" name="values[vendor_name]" 
value="{survey/vendor_name}">
+                                                                       </input>
+                                                               <div 
id="vendor_container"/>
+                                                           </div>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="survey/vendor_name" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
 
-                                                 <div class="label">
-                                                       <label 
for="income2">Income ($):</label>                                               
 
-                                                </div>
-                                                       <input id="income2" 
type="text"
-                                                               
formvalidator:FormField="yes"
-                                                               
formvalidator:type="DoubleField"
-                                                               
formvalidator:maxDecimalPlaces="2"
-                                                               
formvalidator:max="40000"
-                                                               
formvalidator:maxInclusive="true"/>
-                                               <div class="clearDiv"></div>
-                                       
-                                       -->
-
                                        </td>
                                </tr>
 
@@ -255,37 +232,28 @@
                                        </div>
 
                        <div id="documents">
+                               <script type="text/javascript">
+                                       var fileuploader_action = <xsl:value-of 
select="fileuploader_action"/>;
+                               </script>
+                               <table cellpadding="2" cellspacing="2" 
width="80%" align="center">
+                                       <!-- <xsl:call-template 
name="file_list"/> -->
+                                       <tr>
+                                               <td align="left" valign="top">
+                                                       <xsl:value-of 
select="php:function('lang', 'files')"/>
+                                               </td>
+                                               <td>
+                                                       <div 
id="datatable-container_0"/>
+                                               </td>
+                                       </tr>
+                                       <xsl:call-template name="file_upload"/>
+                               </table>
+
                        </div>
                        <div id="import">
                        </div>
 
 
                                        <xsl:choose>
-                                               <xsl:when test="files!='' or 
fileupload = 1">
-                                                       <div id="files">
-                                                               <script 
type="text/javascript">
-                                                                       var 
fileuploader_action = <xsl:value-of select="fileuploader_action"/>;
-                                                               </script>
-                                                               <table 
cellpadding="2" cellspacing="2" width="80%" align="center">
-                                                                       <!-- 
<xsl:call-template name="file_list"/> -->
-                                                                       <tr>
-                                                                               
<td align="left" valign="top">
-                                                                               
        <xsl:value-of select="//lang_files"/>
-                                                                               
</td>
-                                                                               
<td>
-                                                                               
        <div id="datatable-container_0"/>
-                                                                               
</td>
-                                                                       </tr>
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="cat_list='' and fileupload = 1 and mode = 'edit'">
-                                                                               
        <xsl:call-template name="file_upload"/>
-                                                                               
</xsl:when>
-                                                                       
</xsl:choose>
-                                                               </table>
-                                                       </div>
-                                               </xsl:when>
-                                       </xsl:choose>
-                                       <xsl:choose>
                                                <xsl:when test="documents != 
''">
                                                        <div id="document">
                                                                <!-- Some style 
for the expand/contract section-->
@@ -344,18 +312,19 @@
                                        </td>
                                        <td>
                                                <div class="form-buttons">
+                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
                                                        <xsl:choose>
                                                                <xsl:when 
test="editable = 1">
                                                                        
<xsl:variable name="lang_save"><xsl:value-of select="php:function('lang', 
'save')" /></xsl:variable>
-                                                                       
<xsl:variable name="lang_cancel"><xsl:value-of select="php:function('lang', 
'cancel')" /></xsl:variable>
                                                                        <input 
type="submit" name="save_project" value="{$lang_save}" title = "{$lang_save}" />
-                                                                       <input 
class="submit" type="button" name="cancelButton" id ='cancelButton' 
value="{$lang_cancel}" title = "{$lang_cancel}" 
onClick="document.cancel_form.submit();"/>
+                                                                       <input 
class="button" type="button" name="cancelButton" id ='cancelButton' 
value="{$lang_cancel}" title = "{$lang_cancel}" 
onClick="document.cancel_form.submit();"/>
                                                                </xsl:when>
                                                                <xsl:otherwise>
                                                                        
<xsl:variable name="lang_edit"><xsl:value-of select="php:function('lang', 
'edit')" /></xsl:variable>
-                                                                       
<xsl:variable name="lang_new_activity"><xsl:value-of 
select="php:function('lang', 't_new_activity')" /></xsl:variable>
-                                                                       <input 
type="submit" name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
-                                                                       <input 
type="submit" name="new_activity" value="{$lang_new_activity}" title = 
"{$lang_new_activity}" />
+                                                                       
<xsl:variable name="lang_new_survey"><xsl:value-of select="php:function('lang', 
'new survey')" /></xsl:variable>
+                                                                       <input 
type="button" name="edit_survey" value="{$lang_edit}" title = "{$lang_edit}"  
onClick="document.load_edit_form.submit();"/>
+                                                                       <input 
type="button" name="new_survey" value="{$lang_new_survey}" title = 
"{$lang_new_survey}" onClick="document.new_form.submit();"/>
+                                                                       <input 
class="button" type="button" name="cancelButton" id ='cancelButton' 
value="{$lang_cancel}" title = "{$lang_cancel}" 
onClick="document.cancel_form.submit();"/>
                                                                </xsl:otherwise>
                                                        </xsl:choose>
                                                </div>
@@ -380,14 +349,29 @@
 
                <form name="cancel_form" id="cancel_form" 
action="{$cancel_url}" method="post">
                </form>
+               <xsl:variable name="new_url">
+                       <xsl:value-of select="php:function('get_phpgw_link', 
'/index.php', 'menuaction:property.uicondition_survey.add')" />
+               </xsl:variable>
+               <form name="new_form" id="new_form" action="{$new_url}" 
method="post">
+               </form>
 
+               <xsl:variable name="edit_params">
+                       <xsl:text>menuaction:property.uicondition_survey.edit, 
id:</xsl:text>
+                               <xsl:value-of select="survey/id" />
+                       </xsl:variable>
+               <xsl:variable name="edit_url">
+                               <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', $edit_params )" />
+               </xsl:variable>
 
+               <form name="load_edit_form" id="load_edit_form" 
action="{$edit_url}" method="post">
+               </form>
+
        </xsl:template>
 
 
 <xsl:template match="options">
        <option value="{id}">
-               <xsl:if test="selected = 'selected'">
+               <xsl:if test="selected = 'selected' or selected = 1">
                        <xsl:attribute name="selected" value="selected" />
                </xsl:if>
                <xsl:attribute name="title" value="description" />


Property changes on: 
branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id




reply via email to

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