fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10585] Merge 10569:10584 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [10585] Merge 10569:10584 from trunk
Date: Tue, 11 Dec 2012 09:48:09 +0000

Revision: 10585
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10585
Author:   sigurdne
Date:     2012-12-11 09:48:09 +0000 (Tue, 11 Dec 2012)
Log Message:
-----------
Merge 10569:10584 from trunk

Modified Paths:
--------------
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js
    branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js
    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.boinvestment.inc.php
    branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.bopricebook.inc.php
    branches/Version-1_0-branch/property/inc/class.borequest.inc.php
    branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
    branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
    branches/Version-1_0-branch/property/inc/class.interlink.inc.php
    branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
    branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
    branches/Version-1_0-branch/property/inc/class.soentity.inc.php
    branches/Version-1_0-branch/property/inc/class.solocation.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
    branches/Version-1_0-branch/property/inc/class.uientity.inc.php
    branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
    branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
    
branches/Version-1_0-branch/property/inc/cron/default/export_info_as_files.php
    
branches/Version-1_0-branch/property/inc/cron/default/forward_mail_as_sms.php
    branches/Version-1_0-branch/property/inc/cron/default/import_files.php
    
branches/Version-1_0-branch/property/inc/cron/default/import_from_scanner.php
    
branches/Version-1_0-branch/property/inc/cron/default/oppdater_antall_leieobjekt.php
    
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
    branches/Version-1_0-branch/property/inc/cron/default/organize_drawing.php
    
branches/Version-1_0-branch/property/inc/cron/default/organize_energy_pdf_bbb.php
    
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
    branches/Version-1_0-branch/property/inc/cron/default/update_googlemap.php
    branches/Version-1_0-branch/property/inc/cron/default/update_phpgw.php
    
branches/Version-1_0-branch/property/inc/cron/default/update_workorder_status.php
    
branches/Version-1_0-branch/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
    
branches/Version-1_0-branch/property/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
    
branches/Version-1_0-branch/property/inc/custom/default/kalkuler_risiko_for_ros.php
    branches/Version-1_0-branch/property/inc/export/default/Agresso
    branches/Version-1_0-branch/property/inc/export/default/Ecolink
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner
    
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner_xml
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service
    
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_xml
    
branches/Version-1_0-branch/property/inc/import/default/import_fra_Service_xls
    branches/Version-1_0-branch/property/js/portico/condition_survey_edit.js
    branches/Version-1_0-branch/property/js/yahoo/request.edit.js
    branches/Version-1_0-branch/property/js/yahoo/request.index.js
    branches/Version-1_0-branch/property/setup/phpgw_no.lang
    branches/Version-1_0-branch/property/setup/setup.inc.php
    branches/Version-1_0-branch/property/setup/tables_update.inc.php
    branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
    
branches/Version-1_0-branch/property/templates/base/condition_survey_import.xsl
    branches/Version-1_0-branch/property/templates/base/request.xsl

Added Paths:
-----------
    branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php

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


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

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_component.inc.php
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -325,18 +325,17 @@
                                }
                        }
                        
-                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
 
                        $data = array(
                                 'ResultSet' => array(
                                        'totalResultsAvailable' => 
$boentity->total_records,
-                                       'startIndex' => $this->start, 
+                                       'startIndex' => $boentity->start, 
                                        'sortKey' => 'location_code', 
                                        'sortDir' => "ASC", 
                                        'Result' => $values,
-                                       //FIXME: Sigurd 18 oct 2012...
-                                       'pageSize' => $results,
-                                       'activePage' => floor($this->bo->start 
/ $results) + 1
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($boentity->start 
/ $num_rows) + 1
                                )
                        );
 

Modified: 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
     2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/controller/inc/class.uicontrol_register_to_location.inc.php
     2012-12-11 09:48:09 UTC (rev 10585)
@@ -380,7 +380,7 @@
                                }
                        }
                        
-                       $results = $results ? $results : 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
 
                        $data = array(
                                 'ResultSet' => array(
@@ -389,9 +389,8 @@
                                        'sortKey' => 'location_code', 
                                        'sortDir' => "ASC", 
                                        'Result' => $values,
-                                       //FIXME: Sigurd 18 oct 2012...
-                                       'pageSize' => $results,
-                                       'activePage' => floor($this->bo->start 
/ $results) + 1
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($this->bo->start 
/ $num_rows) + 1
                                )
                        );
 

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.uicommon.inc.php     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -375,11 +375,14 @@
                                $result['results'] = array();
                        }
 
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
                        return array(   
                                'ResultSet' => array(
                                        'totalResultsAvailable' => 
$results['total_records'],
                                        'totalRecords'          => 
$results['total_records'],// temeporary 
                                        'recordsReturned'       => 
count($results['results']),
+                                       'pageSize'                      => 
$num_rows,
                                        'startIndex'            => 
$results['start'], 
                                        'sortKey'                       => 
$results['sort'], 
                                        'sortDir'                       => 
$results['dir'], 

Modified: branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js
===================================================================
--- branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js     2012-12-11 
09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/phpgwapi/js/yahoo/common.js     2012-12-11 
09:48:09 UTC (rev 10585)
@@ -15,6 +15,16 @@
        return config;
 };
 
+/*
+
+       YAHOO.portico.FormatterAmount0 = function(elCell, oRecord, oColumn, 
oData)
+       {
+alert('hei');
+//             var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">ee"+amount+"</div>";
+       }       
+*/
+
 /** Hook widgets to translations **/
 YAHOO.portico.js_alias_method_chain(YAHOO.widget.Calendar, 'init', 'i18n', 
function(id, container, config) {
        YAHOO.portico.lang('Calendar', config);
@@ -205,9 +215,9 @@
 
        var DatatableName = 'datatable_container' + container;
        var PaginatorName = 'paginator_container' + container;
+//console.log(YAHOO.portico.Paginator);
+       requestUrl = requestUrl ? requestUrl : 
YAHOO.portico.requestUrl[DatatableName];
 
-       requestUrl = requestUrl ? requestUrl : 
YAHOO.portico.requestUrl.DatatableName;
-
        var callback =
        {
                success: function(o)
@@ -220,46 +230,49 @@
                                return;
                        }
 
-                       
YAHOO.portico.Paginator.PaginatorName.setRowsPerPage(values_ds.ResultSet.Result.length,true);
+                       var Paginator = YAHOO.portico.Paginator[PaginatorName];
 
                        //delete values of datatable
-                       
YAHOO.portico.DataTable.DatatableName.getRecordSet().reset();
+                       var DataTable = YAHOO.portico.DataTable[DatatableName];
+                       DataTable.getRecordSet().reset();
 
-                       //reset total records always to zero
-                       
YAHOO.portico.Paginator.PaginatorName.setTotalRecords(0,true);
-
                        //obtain records of the last DS and add to datatable
                        var record = values_ds.ResultSet.Result;
                        var newTotalRecords = 
values_ds.ResultSet.totalResultsAvailable;
 
                        if(record.length)
                        {
-                               
YAHOO.portico.DataTable.DatatableName.addRows(record);
+                               DataTable.addRows(record);
                        }
                        else
                        {
-                               YAHOO.portico.DataTable.DatatableName.render();
+                               DataTable.render();
                        }
 
-                       //update paginator with news values
-                       
YAHOO.portico.Paginator.PaginatorName.setTotalRecords(newTotalRecords,true);
+                       if(Paginator)
+                       {
+                               
Paginator.setRowsPerPage(values_ds.ResultSet.Result.length,true);
+                               //reset total records always to zero
+                               Paginator.setTotalRecords(0,true);
 
-                       if(typeof(values_ds.ResultSet.results) == 'undefined')
-                       {
-                               var results = 10;
+                               //update paginator with news values
+                               Paginator.setTotalRecords(newTotalRecords,true);
+                               if(typeof(values_ds.ResultSet.results) == 
'undefined')
+                               {
+                                       var results = 10;
+                               }
+                               else
+                               {
+                                       var results = 
values_ds.ResultSet.results;
+                               }
+                               
+                               var activePage = 
Math.floor(values_ds.ResultSet.startIndex / results) + 1;
+                               Paginator.setPage(activePage,true); //true no 
fuerza un recarge solo cambia el paginator
                        }
-                       else
-                       {
-                               var results = values_ds.ResultSet.results;
-                       }
-                               
-                       var activePage = 
Math.floor(values_ds.ResultSet.startIndex / results) + 1;
-                       
YAHOO.portico.Paginator.PaginatorName.setPage(activePage,true); //true no 
fuerza un recarge solo cambia el paginator
 
                        //update "sortedBy" values
-
                        values_ds.ResultSet.sortDir == "asc"? dir_ds = 
YAHOO.widget.DataTable.CLASS_ASC : dir_ds = YAHOO.widget.DataTable.CLASS_DESC;
-                       
YAHOO.portico.DataTable.DatatableName.set("sortedBy",{key:values_ds.ResultSet.sortKey,dir:dir_ds});
+                       
DataTable.set("sortedBy",{key:values_ds.ResultSet.sortKey,dir:dir_ds});
                },
                failure: function(o) {window.alert('Server or your connection 
is dead.')},
                timeout: 10000,
@@ -319,13 +332,15 @@
        options = options || {};
        options.dynamicData = true;
        
+       YAHOO.portico.Paginator[PaginatorName] = {};
        if(!disablePagination)
        {
                options.paginator = 
YAHOO.portico.setupInlineTablePaginator(paginatorContainer);
+//             options.paginator.setRowsPerPage(20,true);
+
                url += '&results=' + options.paginator.getRowsPerPage() + '&';
 
-
-               YAHOO.portico.Paginator.PaginatorName =options.paginator;
+               YAHOO.portico.Paginator[PaginatorName] =options.paginator;
        }
 
 
@@ -336,7 +351,14 @@
        myDataSource.connXhrMode = "queueRequests";
        myDataSource.responseSchema = {
                resultsList: "ResultSet.Result",
-               metaFields : { totalResultsAvailable: 
"ResultSet.totalResultsAvailable", actions: 'Actions' }
+               metaFields : { 
+                       totalResultsAvailable: 
'ResultSet.totalResultsAvailable',
+                       actions: 'Actions',
+                       pageSize: 'ResultSet.pageSize',
+                       startIndex: 'ResultSet.startIndex',
+                       sortKey: 'ResultSet.sortKey',
+                       sortDir: 'ResultSet.sortDir'
+               }
        };
        
        var myDataTable = new YAHOO.widget.DataTable(dataTableContainer, 
colDefs, myDataSource, options);
@@ -346,10 +368,24 @@
           return oPayload;
    }
        
-       myDataTable.doBeforeLoadData = function(nothing, data) {
-               if (!data.meta.actions) return data;
+       myDataTable.doBeforeLoadData = function(nothing, oResponse, oPayload) {
+
+        oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
+//             oPayload.pagination.rowsPerPage= oResponse.meta.pageSize || 10;
+
+               oPayload.pagination = { 
+                       rowsPerPage: oResponse.meta.pageSize || 10, 
+                       recordOffset: oResponse.meta.startIndex || 0 
+           }
+/*
+               oPayload.sortedBy = { 
+                       key: oResponse.meta.sortKey || "id", 
+                       dir: (oResponse.meta.sortDir) ? "yui-dt-" + 
oResponse.meta.sortDir : "yui-dt-asc" 
+               };
+*/
+               if (!oResponse.meta.actions) return oResponse;
                
-               actions = data.meta.actions;
+               actions = oResponse.meta.actions;
                
                for (var key in actions) {
                        var actionLink = document.createElement('a');
@@ -358,11 +394,11 @@
                        YAHOO.util.Dom.insertAfter(actionLink, container);
                };
                
-               return data;
+               return oResponse;
        };
 
-       YAHOO.portico.DataTable.DatatableName = myDataTable;
-       YAHOO.portico.requestUrl.DatatableName = url;
+       YAHOO.portico.DataTable[DatatableName] = myDataTable;
+       YAHOO.portico.requestUrl[DatatableName] = url;
 
        return {dataTable: myDataTable, dataSource: myDataSource};
 };

Modified: branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js
===================================================================
--- branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js  2012-12-11 
09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/phpgwapi/js/yahoo/datatable.js  2012-12-11 
09:48:09 UTC (rev 10585)
@@ -70,7 +70,7 @@
 //      baseUrl += 'sort=' + fields[0];
     }
        
-         baseUrl += '&results=' + pag.getRowsPerPage() + '&';
+//       baseUrl += '&results=' + pag.getRowsPerPage() + '&';
     var myDataSource = new YAHOO.util.DataSource(baseUrl);
 
     myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
@@ -81,6 +81,7 @@
         metaFields : {
             totalResultsAvailable: "ResultSet.totalResultsAvailable",
                        startIndex: 'ResultSet.startIndex',
+                       pageSize: 'ResultSet.pageSize',
                        sortKey: 'ResultSet.sortKey',
                        sortDir: 'ResultSet.sortDir'
         }
@@ -101,6 +102,13 @@
        /* Inline editor from 'rental'*/
 
 
+       var highlightEditableCell = function(oArgs) {
+               var elCell = oArgs.target;
+               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+                       myDataTable.highlightCell(elCell);
+               }
+       };
+
        myDataTable.editor_action = YAHOO.portico.editor_action;
 
                // Handle mouseover and click events for inline editing
@@ -337,7 +345,10 @@
    }
 
 
-       myDataTable.subscribe("rowMouseoverEvent", 
myDataTable.onEventHighlightRow);
+       if(!myDataTable.editor_action)
+       {
+               myDataTable.subscribe("rowMouseoverEvent", 
myDataTable.onEventHighlightRow);
+       }
 
        myDataTable.subscribe("rowMouseoutEvent", 
myDataTable.onEventUnhighlightRow);
 
@@ -463,7 +474,7 @@
     myDataTable.doBeforeLoadData = function(oRequest, oResponse, oPayload) {
         oPayload.totalRecords = oResponse.meta.totalResultsAvailable;
                oPayload.pagination = { 
-                       rowsPerPage: oResponse.meta.paginationRowsPerPage || 
10, 
+                       rowsPerPage: oResponse.meta.pageSize || 10, 
                        recordOffset: oResponse.meta.startIndex || 0 
            }
                oPayload.sortedBy = { 
@@ -535,12 +546,6 @@
 
 };
 
-       var highlightEditableCell = function(oArgs) {
-               var elCell = oArgs.target;
-               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
-                       myDataTable.highlightCell(elCell);
-               }
-       };
 
 
 

Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -44,6 +44,9 @@
                var $cat_id;
                var $district_id;
                var     $xsl_rootdir;
+               protected $join;
+               protected $left_join;
+               protected $like;
 
                var $public_functions = array
                        (
@@ -63,31 +66,10 @@
                        }
                        $this->async = &$GLOBALS['phpgw']->asyncservice;
 
-                       $this->join             = $this->socommon->join;
+                       $this->join                     = $this->socommon->join;
                        $this->left_join        = $this->socommon->left_join;
-                       $this->like             = $this->socommon->like;
+                       $this->like                     = $this->socommon->like;
 
-                       switch($GLOBALS['phpgw_info']['server']['db_type'])
-                       {
-                       case 'mssql':
-                               $this->dateformat               = "M d Y";
-                               $this->datetimeformat   = "M d Y g:iA";
-                               break;
-                       case 'mysql':
-                               $this->dateformat               = "Y-m-d";
-                               $this->datetimeformat   = "Y-m-d G:i:s";
-                               break;
-                       case 'pgsql':
-                               $this->dateformat               = "Y-m-d";
-                               $this->datetimeformat   = "Y-m-d G:i:s";
-                               //                                      
$this->dateformat               = "F j, Y";
-                               //                                      
$this->datetimeformat   = "F j, Y g:iA";
-                               break;
-                       case 'postgres':
-                               $this->dateformat               = "Y-m-d";
-                               $this->datetimeformat   = "Y-m-d G:i:s";
-                               break;
-                       }
                        $this->xsl_rootdir = PHPGW_SERVER_ROOT . 
'/property/templates/base';
                }
 
@@ -136,20 +118,7 @@
                        return $msgbox_data;
                }
 
-               function moneyformat($amount)
-               {
-                       if 
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
-                       {
-                               $moneyformat    = 
"CONVERT(MONEY,"."'$amount'".",0)";
-                       }
-                       else
-                       {
-                               $moneyformat    = "'" . $amount . "'";
-                       }
 
-                       return $moneyformat;
-               }
-
                function confirm_session()
                {
                        if($GLOBALS['phpgw']->session->verify())
@@ -1458,42 +1427,7 @@
                }
 
 
-               function validate_db_insert($values)
-               {
-                       foreach($values as $value)
-                       {
-                               if($value || $value === 0)
-                               {
-                                       $insert_value[] = "'".$value."'";
-                               }
-                               else
-                               {
-                                       $insert_value[] = 'NULL';
-                               }
-                       }
 
-                       $values = implode(",", $insert_value);
-                       return $values;
-               }
-
-               function validate_db_update($value_set)
-               {
-                       while (is_array($value_set) && list($field,$value) = 
each($value_set))
-                       {
-                               if($value || $value === 0)
-                               {
-                                       $value_entry[]= "$field='$value'";
-                               }
-                               else
-                               {
-                                       $value_entry[]= "$field=NULL";
-                               }
-                       }
-
-                       $value_set      = implode(",", $value_entry);
-                       return $value_set;
-               }
-
                function fm_cache($name='',$value='')
                {
                        return $this->socommon->fm_cache($name,$value);

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-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php   
2012-12-11 09:48:09 UTC (rev 10585)
@@ -57,6 +57,9 @@
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->dateformat                       = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
 
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories', -1, 'property', $this->acl_location);
+                       $this->cats->supress_info       = true;
+
                        $start                          = 
phpgw::get_var('start', 'int', 'REQUEST', 0);
                        $query                          = 
phpgw::get_var('query');
                        $sort                           = 
phpgw::get_var('sort');
@@ -154,7 +157,8 @@
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
 
-                       $test = true;
+                       $test = false;
+
                        if ($test)
                        {
                                if (!empty($_FILES))
@@ -284,8 +288,90 @@
                }
                
 
+               public function import($survey, $import_data)
+               {
+                       try
+                       {
+                               $this->so->import($survey, $import_data);
+                       }
+
+                       catch(Exception $e)
+                       {
+                               if ( $e )
+                               {
+                                       throw $e;                               
+                               }
+                       }
+               }
+
+               public function get_summation($id)
+               {
+                       $data = $this->so->get_summation($id);
+
+                       $values =array();
+                       $i=0;
+                       foreach ($data as $entry)
+                       {
+                               $i = $entry['building_part'];
+                               
+                               $values[$i]['building_part'] = 
$entry['building_part'];
+                               $values[$i]['category'] = 
$this->get_category_name($entry['cat_id']);
+                               
+                               $diff = $entry['year'] - date('Y');
+                               if($diff < 0)
+                               {
+                                       $period = 1;
+                               }
+                               else
+                               {
+                                       $period = ceil($diff/5) +1;
+                                       $period  = $period < 6 ? $period : 6;
+                               }
+       
+                               for ($j = 1; $j < 7 ; $j++ )
+                               {
+                                       if($j == $period)
+                                       {
+                                               $values[$i]["period_{$j}"] += 
$entry['amount'];
+                                               $values[$i]['sum'] += 
$entry['amount'];
+                                       }
+                                       else
+                                       {
+                                               $values[$i]["period_{$j}"] += 
0;                                        
+                                       }
+                               }
+
+                               $i++;
+                       }
+//_debug_array($values);
+                       return $values;
+               }
+
+               function get_category_name($cat_id)
+               {
+                       static $category_name = array();
+
+                       if(!isset($category_name[$cat_id]))
+                       {
+                               $category = $this->cats->return_single($cat_id);
+                               $category_name[$cat_id] = $category[0]['name'];
+                       }
+                       return $category_name[$cat_id];
+               }
+
                public function delete($id)
                {
-                       $this->so->delete($id);
+                       try
+                       {
+                               $this->so->delete($id);
+                       }
+
+                       catch(Exception $e)
+                       {
+                               if ( $e )
+                               {
+                                       throw $e;                               
+                               }
+                       }
                }
        }

Modified: branches/Version-1_0-branch/property/inc/class.boinvestment.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvestment.inc.php 
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.boinvestment.inc.php 
2012-12-11 09:48:09 UTC (rev 10585)
@@ -221,7 +221,7 @@
                        //_debug_array($values);
 
                        $values['date'] = 
$this->bocommon->date_to_timestamp($values['date']);
-                       $values['date']= 
date($this->bocommon->dateformat,$values['date']);
+                       $values['date']= 
date($GLOBALS['phpgw']->db->date_format(),$values['date']);
 
                        $values['initial_value']        = 
abs($values['initial_value']);
 
@@ -263,7 +263,7 @@
                        $date_array = 
phpgwapi_datetime::date_array($values['date']);
 
                        $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-                       $date= date($this->bocommon->dateformat,$date);
+                       $date= date($GLOBALS['phpgw']->db->date_format(),$date);
 
                        $new_index=str_replace(",",".",$values['new_index']);
 

Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -430,7 +430,7 @@
                        $values['belop']                        = 
$values['amount'];
                        $values['godkjentbelop']        = $values['amount'];
 
-                       $_dateformat = $this->bocommon->dateformat;
+                       $_dateformat = $GLOBALS['phpgw']->db->date_format();
 
                        $invoice_date   = $values['invoice_date'] ? 
phpgwapi_datetime::date_to_timestamp($values['invoice_date']) : time();
                        $payment_date   = $values['payment_date'] ? 
phpgwapi_datetime::date_to_timestamp($values['payment_date']) : time();
@@ -538,15 +538,15 @@
                        $values['belop']                        = 
$values['amount'];
                        $values['godkjentbelop']        = $values['amount'];
 
-                       $values['fakturadato'] = 
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']));
+                       $values['fakturadato'] = 
date($GLOBALS['phpgw']->db->date_format(),mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear']));
 
                        if($values['num_days'])
                        {
-                               $values['forfallsdato'] = 
date($this->bocommon->dateformat,mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear'])+(86400*$values['num_days']));
+                               $values['forfallsdato'] = 
date($GLOBALS['phpgw']->db->date_format(),mktime(2,0,0,$values['smonth'],$values['sday'],$values['syear'])+(86400*$values['num_days']));
                        }
                        else
                        {
-                               $values['forfallsdato'] = 
date($this->bocommon->dateformat,mktime(2,0,0,$values['emonth'],$values['eday'],$values['eyear']));
+                               $values['forfallsdato'] = 
date($GLOBALS['phpgw']->db->date_format(),mktime(2,0,0,$values['emonth'],$values['eday'],$values['eyear']));
                        }
 
                        $values['artid']                        = 
$values['art'];

Modified: branches/Version-1_0-branch/property/inc/class.bopricebook.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bopricebook.inc.php  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.bopricebook.inc.php  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -215,7 +215,7 @@
                        
$date_array=phpgwapi_datetime::date_array($values['date']);
 
                        $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-//                     $date= date($this->bocommon->dateformat,$date);
+//                     $date= date($GLOBALS['phpgw']->db->date_format(),$date);
 
                        $new_index=str_replace(",",".",$values['new_index']);
 
@@ -282,7 +282,7 @@
                        
$date_array=phpgwapi_datetime::date_array($values['date']);
 
                        $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-//                     $date= date($this->bocommon->dateformat,$date);
+//                     $date= date($GLOBALS['phpgw']->db->date_format(),$date);
 
                        $m_cost                 = 
str_replace(",",".",$values['m_cost']);
                        $w_cost                 = 
str_replace(",",".",$values['w_cost']);

Modified: branches/Version-1_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.borequest.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -87,6 +87,8 @@
                        $end_date               = phpgw::get_var('end_date');
                        $building_part  = phpgw::get_var('building_part');
 
+                       $this->condition_survey_id = 
phpgw::get_var('condition_survey_id', 'int', 'REQUEST', 0);
+
                        if(isset($_POST['start']) || isset($_GET['start']))
                        {
                                $this->start = $start;
@@ -443,7 +445,7 @@
                                'project_id' => 
$data['project_id'],'allrows'=>$data['allrows'],'list_descr' => 
$data['list_descr'],
                                'dry_run'=>$data['dry_run'], 'p_num' => 
$this->p_num,'start_date'=>$this->start_date,'end_date'=>$this->end_date,
                                'property_cat_id' => $this->property_cat_id, 
'building_part' => $this->building_part,
-                               'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter));
+                               'degree_id' => $this->degree_id, 
'attrib_filter' => $attrib_filter, 'condition_survey_id' => 
$this->condition_survey_id));
 
                        $this->total_records    = $this->so->total_records;
                        $this->sum_budget               = $this->so->sum_budget;
@@ -487,6 +489,7 @@
                                $this->uicols['formatter'][]    = '';
                                $this->uicols['classname'][]    = '';
                        }
+
                        return $request;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -385,5 +385,154 @@
                        return $this->Transaction;
                }
 
+               /**
+               * Get the correct date format for DATE field for a particular 
RDBMS
+               *
+               * @internal the string is compatiable with PHP's date()
+               * @return string the date format string
+               */
+               public static function date_format()
+               {
+                       static $date_format = null;
+                       if ( is_null($date_format) )
+                       {
+                               
switch($GLOBALS['phpgw_info']['server']['db_type'])
+                               {
+                                       case 'mssql':
+                                               $date_format            = 'M d 
Y';
+                                               break;
+                                       case 'mysql':
+                                       case 'pgsql':
+                                       case 'postgres':
+                                       default:
+                                               $date_format            = 
'Y-m-d';
+                               }
+                       }
+                       return $date_format;
+               }
+       
+               /**
+               * Get the correct datetime format for DATETIME field for a 
particular RDBMS
+               *
+               * @internal the string is compatiable with PHP's date()
+               * @return string the date format string
+               */
+               public static function datetime_format()
+               {
+                       static $datetime_format = null;
+                       if ( is_null($datetime_format) )
+                       {
+                               
switch($GLOBALS['phpgw_info']['server']['db_type'])
+                               {
+                                       case 'mssql':
+                                               $datetime_format                
= 'M d Y g:iA';
+                                               break;
+                                       case 'mysql':
+                                       case 'pgsql':
+                                       case 'postgres':
+                                       default:
+                                               $datetime_format                
= 'Y-m-d G:i:s';
+                               }
+                       }
+                       return $datetime_format;
+               }
+
+               /**
+               * Get the correct datetime format for MONEY field for a 
particular RDBMS
+               *
+               * @return string the formatted string
+               */
+               public static function money_format($amount)
+               {
+                       if 
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
+                       {
+                               return "CONVERT(MONEY,'{$amount}',0)";
+                       }
+                       else
+                       {
+                               return "'{$amount}'";
+                       }
+               }
+
+
+               /**
+                * Prepare the VALUES component of an INSERT sql statement by 
guessing data types
+                *
+                * It is not a good idea to rely on the data types determined 
by this method if 
+                * you are inserting numeric data into varchar/text fields, 
such as street numbers
+                * 
+                * @param array $value_set array of values to insert into the 
database
+                * @return string the prepared sql, empty string for invalid 
input
+                */
+               public function validate_insert($values)
+               {
+                       if ( !is_array($values) || !count($values) )
+                       {
+                               return '';
+                       }
+                       
+                       $insert_value = array();
+                       foreach ( $values as $value )
+                       {
+                               if($value || (is_numeric($value) && $value == 
0) )
+                               {
+                                       if ( is_numeric($value) )
+                                       {
+                                               $insert_value[] = "'$value'";
+                                       }
+                                       else
+                                       {
+                                               $insert_value[] = "'" . 
$this->db_addslashes(stripslashes($value)) . "'"; //in case slashes are already 
added.
+                                       }
+                               }
+                               else
+                               {
+                                       $insert_value[] = 'NULL';
+                               }
+                       }
+                       return implode(",", $insert_value);
+               }
+
+               /**
+                * Prepare the SET component of an UPDATE sql statement
+                * 
+                * @param array $value_set associative array of values to 
update the database with
+                * @return string the prepared sql, empty string for invalid 
input
+                */
+               public function validate_update($value_set)
+               {
+                       if ( !is_array($value_set) || !count($value_set) )
+                       {
+                               return '';
+                       }
+                       
+                       $value_entry = array();
+                       foreach ( $value_set as $field => $value )
+                       {
+                               if($value || (is_numeric($value) && $value == 
0) )
+                               {
+                                       if ( is_numeric($value) )
+                                       {
+                                               if((strlen($value) > 1 && 
strpos($value,'0') === 0))
+                                               {
+                                                       $value_entry[]= 
"{$field}='{$value}'";
+                                               }
+                                               else
+                                               {
+                                                       $value_entry[]= 
"{$field}={$value}";
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $value_entry[]= 
"{$field}='{$value}'";
+                                       }
+                               }
+                               else
+                               {
+                                       $value_entry[]= "{$field}=NULL";
+                               }
+                       }
+                       return implode(',', $value_entry);
+               }
+
        }
-

Modified: branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php 
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.fileuploader.inc.php 
2012-12-11 09:48:09 UTC (rev 10585)
@@ -149,7 +149,17 @@
                                                                                
        {
                                                                                
                alert('Du må laste siden på nytt for å vise resultatet');
                                                                                
        }
-                                                                               
        parent.lightbox.hide();
+                                                                               
        try
+                                                                               
        {
+                                                                               
                if(!parent.lightbox_hide())
+                                                                               
                {
+                                                                               
                        parent.lightbox.hide();
+                                                                               
                }
+                                                                               
        }
+                                                                               
        catch (ex)
+                                                                               
        {
+                                                                               
        }
+
                                                                                
  }
                                                                        });
                                                                });

Modified: branches/Version-1_0-branch/property/inc/class.interlink.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.interlink.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.interlink.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -234,6 +234,10 @@
                        {
                                $link = array('menuaction' => 
"property.uirequest.{$function}", 'id' => $id);
                        }
+                       else if($type == '.project.condition_survey')
+                       {
+                               $link = array('menuaction' => 
"property.uicondition_survey.{$function}", 'id' => $id);
+                       }
                        else if($type == '.project')
                        {
                                $link = array('menuaction' => 
"property.uiproject.{$function}", 'id' => $id);
@@ -319,6 +323,15 @@
                                return $relation_info;
 
                        }
+                       else if($type == '.project.condition_survey')
+                       {
+                               $this->_db->query("SELECT 
fm_condition_survey.title, fm_condition_survey_status.descr as status FROM 
fm_condition_survey {$this->_join} fm_condition_survey_status ON 
fm_condition_survey.status_id = fm_condition_survey_status.id WHERE 
fm_condition_survey.id = {$id}",__LINE__,__FILE__);                           
+                               $this->_db->next_record();
+                               $relation_info['statustext'] = 
$this->_db->f('status');
+                               $relation_info['title'] = 
$this->_db->f('title');
+                               return $relation_info;
+
+                       }
                        else if($type == '.project')
                        {               
                                $this->_db->query("SELECT fm_project.name as 
title, fm_project_status.descr as status FROM fm_project {$this->_join} 
fm_project_status ON fm_project.status = fm_project_status.id WHERE 
fm_project.id = {$id}",__LINE__,__FILE__);

Modified: branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soagreement.inc.php  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.soagreement.inc.php  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -42,9 +42,9 @@
                        $this->bocommon         = 
CreateObject('property.bocommon');
                        $this->db           = clone($GLOBALS['phpgw']->db);
                        $this->db2          = clone($this->db);
-                       $this->join                     = $this->bocommon->join;
-                       $this->left_join        = $this->bocommon->left_join;
-                       $this->like                     = $this->bocommon->like;
+                       $this->join                     = $this->db->join;
+                       $this->left_join        = $this->db->left_join;
+                       $this->like                     = $this->db->like;
                        //                      $this->role             = 
'agreement';
                }
 
@@ -757,7 +757,7 @@
                        if($cols)
                        {
                                $cols   = "," . implode(",", $cols);
-                               $vals   = 
$this->bocommon->validate_db_insert($vals);
+                               $vals   = $this->db->validate_insert($vals);
                        }
 
                        $this->db->query("INSERT INTO $table 
(id,name,descr,entry_date,category,start_date,end_date,termination_date,vendor_id,user_id
 $cols) "
@@ -850,7 +850,7 @@
                        $value_set['status']    = $values['status'];
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
                        $this->db->query("UPDATE $table set entry_date='" . 
time() . "', category='"
@@ -873,7 +873,7 @@
 
                        if($value_set)
                        {
-                               $value_set      = ',' . 
$this->bocommon->validate_db_update($value_set);
+                               $value_set      = ',' . 
$this->db->validate_update($value_set);
                        }
 
                        $this->db->query("UPDATE fm_activity_price_index set 
entry_date=" . time() . "$value_set WHERE agreement_id=" . 
intval($values['agreement_id']) . ' AND activity_id=' . intval($values['id']));

Copied: branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php 
(from rev 10584, trunk/property/inc/class.socommon_core.inc.php)
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php        
                        (rev 0)
+++ branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php        
2012-12-11 09:48:09 UTC (rev 10585)
@@ -0,0 +1,274 @@
+<?php
+       /**
+       * Common so-functions, database related helpers 
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage core
+       * @version $Id: class.socommon_core.inc.php 10127 2012-10-07 17:06:01Z 
sigurdne $
+       */
+
+       /*
+               This program is free software: you can redistribute it and/or 
modify
+               it under the terms of the GNU Lesser General Public License as 
published by
+               the Free Software Foundation, either version 2 of the License, 
or
+               (at your option) any later version.
+
+               This program is distributed in the hope that it will be useful,
+               but WITHOUT ANY WARRANTY; without even the implied warranty of
+               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+               GNU Lesser General Public License for more details.
+
+               You should have received a copy of the GNU General Public 
License
+               along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
+        */
+
+
+
+
+       phpgw::import_class('phpgwapi.datetime');
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class property_socommon_core
+       {
+               /**
+               * @var int $_total_records total number of records found
+               */
+               protected $_total_records = 0;
+
+
+               /**
+               * @var int $_receipt feedback on actions
+               */
+               protected $_receipt = array();
+
+
+               /**
+                * @var object $_db reference to the global database object
+                */
+               protected $_db;
+
+               /**
+                * @var string $_join SQL JOIN statement
+                */
+               protected $_join;
+
+               /**
+                * @var string $_join SQL LEFT JOIN statement
+                */
+               protected $_left_join;
+
+               /**
+                * @var string $_like SQL LIKE statement
+                */
+               protected $_like;
+
+
+               public function __construct()
+               {
+                       $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->_left_join       = & $this->_db->left_join;
+                       $this->custom           = 
createObject('property.custom_fields');
+               }
+
+               /**
+                * Magic get method
+                *
+                * @param string $varname the variable to fetch
+                *
+                * @return mixed the value of the variable sought - null if not 
found
+                */
+               public function __get($varname)
+               {
+                       switch ($varname)
+                       {
+                               case 'total_records':
+                                       return $this->_total_records;
+                                       break;
+                               case 'receipt':
+                                       return $this->_receipt;
+                                       break;
+                               default:
+                                       return null;
+                       }
+               }
+
+               protected function _edit($id, $value_set, $table)
+               {
+                       $id = (int)$id;
+
+                       $value_set      = 
$this->_db->validate_update($value_set);
+
+                       $this->_db->transaction_begin();
+
+                       $sql = "UPDATE {$table} SET $value_set WHERE 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;
+                               }
+                       }
+
+                       $this->_db->transaction_commit();
+                       return $id;
+               }
+
+
+               /**
+                * Get standard valueset for atttibutes and location
+                *
+                * @param array $data the data to organize
+                *
+                * @return array $value_set to either insert or edit
+                */
+
+               protected function _get_value_set($data)
+               {
+                       $value_set = array();
+
+                       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;
+               }
+
+               protected function _get_interlink_data($id, $data, $location2)
+               {
+                       if(!$id || !$location2)
+                       {
+                               throw new 
Exception('property_socommon_core::_get_interlink_data() - missing input');
+                       }
+
+                       $interlink_data = array();
+
+                       if(isset($data['origin']) && is_array($data['origin']))
+                       {
+                               if($data['origin'][0]['data'][0]['id'])
+                               {
+                                       $data['origin_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', 
$data['origin'][0]['location']);
+                                       $data['origin_item_id'] = 
$data['origin'][0]['data'][0]['id'];
+                               }
+                       }
+
+                       if(isset($data['origin_id']) && $data['origin_id'] && 
isset($data['origin_item_id']) && $data['origin_item_id'])
+                       {
+                               $interlink_data = array
+                               (
+                                       'location1_id'          => 
$data['origin_id'],
+                                       'location1_item_id' => 
$data['origin_item_id'],
+                                       'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', $location2),
+                                       'location2_item_id' => $id,
+                                       'account_id'            => 
$this->account
+                               );
+                       }
+                       else if(isset($data['extra']) && 
is_array($data['extra']) && isset($data['extra']['p_num']) && 
$data['extra']['p_num'])
+                       {
+                               $data['origin_id'] = 
$GLOBALS['phpgw']->locations->get_id('property', 
".entity.{$data['extra']['p_entity_id']}.{$data['extra']['p_cat_id']}");
+ 
+                               $this->db->query('SELECT prefix FROM 
fm_entity_category WHERE entity_id = '. (int)$data['extra']['p_entity_id'] . ' 
AND id = ' . (int)$data['extra']['p_cat_id']);
+                               $this->db->next_record();
+                               $prefix = $this->db->f('prefix');
+                               $data['origin_item_id']         = (int) 
ltrim($data['extra']['p_num'], $prefix);
+                       
+                               $interlink_data = array
+                               (
+                                       'location1_id'          => 
$data['origin_id'],
+                                       'location1_item_id' => 
$data['origin_item_id'],
+                                       'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'),
+                                       'location2_item_id' => $id,
+                                       'account_id'            => 
$this->account
+                               );
+                       }
+                       return $interlink_data;
+               }
+       }

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-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php   
2012-12-11 09:48:09 UTC (rev 10585)
@@ -28,13 +28,14 @@
        */
 
        phpgw::import_class('phpgwapi.datetime');
+       phpgw::import_class('property.socommon_core');
 
        /**
         * Description
         * @package property
         */
 
-       class property_socondition_survey
+       class property_socondition_survey extends property_socommon_core
        {
                /**
                * @var int $_total_records total number of records found
@@ -66,34 +67,9 @@
 
                public function __construct()
                {
-                       $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');
+                       parent::__construct();
                }
 
-               /**
-                * Magic get method
-                *
-                * @param string $varname the variable to fetch
-                *
-                * @return mixed the value of the variable sought - null if not 
found
-                */
-               public function __get($varname)
-               {
-                       switch ($varname)
-                       {
-                               case 'total_records':
-                                       return $this->_total_records;
-                                       break;
-                               case 'receipt':
-                                       return $this->_receipt;
-                                       break;
-                               default:
-                                       return null;
-                       }
-               }
 
                function read($data = array())
                {
@@ -205,12 +181,23 @@
 
                        $this->_db->transaction_begin();
 
+                       $value_set                                              
= $this->_get_value_set( $data );
+
                        $id = $this->_db->next_id($table);
 
-                       $value_set                                      = 
$this->_get_value_set( $data );
-                       $value_set['id']                        = $id;
-                       $value_set['entry_date']        = time();
+                       $value_set['id']                                = $id;
+                       $value_set['entry_date']                = time();
+                       $value_set['title']                             = 
$this->_db->db_addslashes($data['title']);
+                       $value_set['descr']                             = 
$this->_db->db_addslashes($data['descr']);
+                       $value_set['status_id']                 = 
(int)$data['status_id'];
+                       $value_set['category']                  = 
(int)$data['cat_id'];
+                       $value_set['vendor_id']                 = 
(int)$data['vendor_id'];
+                       $value_set['coordinator_id']    = 
(int)$data['coordinator_id'];
+                       $value_set['report_date']               = 
phpgwapi_datetime::date_to_timestamp($data['report_date']);
+                       $value_set['user_id']                   = 
$this->account;
+                       $value_set['modified_date']             = time();
 
+
                        $cols = implode(',', array_keys($value_set));
                        $values = 
$this->_db->validate_insert(array_values($value_set));
                        $sql = "INSERT INTO {$table} ({$cols}) VALUES 
({$values})";
@@ -226,7 +213,7 @@
                        {
                                if ( $e )
                                {
-                                       throw $e;                               
+                                       throw $e;
                                }
                                return 0;
                        }
@@ -248,16 +235,26 @@
 
                        $value_set      = $this->_get_value_set( $data );
 
+                       $value_set['title']                             = 
$this->_db->db_addslashes($data['title']);
+                       $value_set['descr']                             = 
$this->_db->db_addslashes($data['descr']);
+                       $value_set['status_id']                 = 
(int)$data['status_id'];
+                       $value_set['category']                  = 
(int)$data['cat_id'];
+                       $value_set['vendor_id']                 = 
(int)$data['vendor_id'];
+                       $value_set['coordinator_id']    = 
(int)$data['coordinator_id'];
+                       $value_set['report_date']               = 
phpgwapi_datetime::date_to_timestamp($data['report_date']);
+                       $value_set['user_id']                   = 
$this->account;
+                       $value_set['modified_date']             = time();
+
                        try
                        {
-                               $this->_edit($id, $value_set);
+                               $this->_edit($id, $value_set, 
'fm_condition_survey');
                        }
 
                        catch(Exception $e)
                        {
                                if ( $e )
                                {
-                                       throw $e;                               
+                                       throw $e;
                                }
                        }
 
@@ -275,149 +272,138 @@
 
                        try
                        {
-                               $this->_edit($id, $value_set);
+                               $this->_edit($id, $value_set, 
'fm_condition_survey');
                        }
 
                        catch(Exception $e)
                        {
                                if ( $e )
                                {
-                                       throw $e;                               
+                                       throw $e;
                                }
                        }
 
                        return $id;
                }
 
-               private function _edit($id, $value_set)
+               public function import($survey, $import_data = array())
                {
-                       $table = 'fm_condition_survey';
-                       $id = (int)$id;
+                       if(!isset($survey['id']) || !$survey['id'])
+                       {
+                               throw new 
Exception('property_socondition_survey::import - missing id');
+                       }
 
-                       $value_set      = 
$this->_db->validate_update($value_set);
+                       $location_data = 
execMethod('property.solocation.read_single', $survey['location_code']);
+                       
+                       $_locations = explode('-', $survey['location_code']);
+                       $i=1;
+                       foreach ($_locations as $_location)
+                       {
+                               $location["loc{$i}"] = $_location;
+                               $i++;
+                       }
 
-                       $this->_db->transaction_begin();
+                       $sorequest      = CreateObject('property.sorequest');
 
-                       $sql = "UPDATE {$table} SET $value_set WHERE id= {$id}";
+//_debug_array($survey);                       
 
-                       try
+                       $this->_db->transaction_begin();
+/*
+                                       kategorier:
+                                       13 => D - Drift
+                                       202 => Kombinasjon
+                                       14 => U - Investering
+                                       12 => V - Planlagt
+*/
+                       foreach ($import_data as $entry)
                        {
-                               $this->_db->Exception_On_Error = true;
-                               $this->_db->query($sql,__LINE__,__FILE__);
-                               $this->_db->Exception_On_Error = false;
-                       }
-
-                       catch(Exception $e)
-                       {
-                               if ( $e )
+                               if( ctype_digit($entry['condition_degree']) &&  
$entry['condition_degree'] > 0 && strlen($entry['building_part']) > 2)
                                {
-                                       throw $e;                               
+                                       $request = array();
+                                       $request['condition_survey_id'] = 
$survey['id'];
+                                       $request['street_name']                 
= $location_data['street_name'];
+                                       $request['street_number']               
= $location_data['street_number'];
+                                       $request['location']                    
= $location;
+                                       $request['location_code']               
= $survey['location_code'];
+                                       $request['origin_id']                   
= $GLOBALS['phpgw']->locations->get_id('property', '.project.condition_survey');
+                                       $request['origin_item_id']              
= (int)$survey['id'];
+                                       $request['title']                       
        = substr($entry['title'], 0, 255);
+                                       $request['descr']                       
        = $entry['descr'];
+                                       $request['cat_id']                      
        = 13; //???? FIXME
+                                       $request['building_part']               
= $entry['building_part'];
+                                       $request['coordinator']                 
= $survey['coordinator_id'];
+                                       $request['status']                      
        = 'registrert';//???? FIXME
+                                       $request['budget']                      
        = $entry['amount'];
+                                       $request['planning_date']               
= mktime(13,0,0,7,1, $entry['due_year']?$entry['due_year']:date('Y'));
+                                       $request['planning_value']              
= $entry['amount'];
+                                       $request['condition']                   
= array
+                                       (
+                                               array
+                                               (
+                                                       'degree' => 
$entry['condition_degree'],
+                                                       'condition_type' => 
$entry['condition_type'],
+                                                       'consequence' => 
$entry['consequence'],
+                                                       'probability' => 
$entry['probability']
+                                               )
+                                       );
+//_debug_array($request);
+                                       $sorequest->add($request, 
$values_attribute = array());
                                }
                        }
+//             die();
 
                        $this->_db->transaction_commit();
-                       return $id;
                }
 
-
-               private function _get_value_set($data)
+               public function get_summation($id)
                {
-                       $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(),
-                       );
+                       $table = 'fm_request';
 
+                       $condition_survey_id            = (int)$id;
+                       $sql = "SELECT category as cat_id, 
left(building_part,1) as building_part_, sum(fm_request_planning.amount) as 
amount , EXTRACT(YEAR from to_timestamp(fm_request_planning.date) ) as year"
+                       ." FROM {$table} {$this->_join} fm_request_planning ON 
fm_request_planning.request_id = {$table}.id"
+                       ." WHERE condition_survey_id={$condition_survey_id}"
+                       ." GROUP BY building_part_ ,category, year ORDER BY 
building_part_";
 
-                       if(isset($data['location']) && 
is_array($data['location']))
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+                       while ($this->_db->next_record())
                        {
-                               foreach ($data['location'] as $input_name => 
$value)
-                               {
-                                       if(isset($value) && $value)
-                                       {
-                                               $value_set[$input_name] = 
$value;
-                                       }
-                               }
-                               $value_set['location_code'] = implode('-', 
$data['location']);
+                               $values[] = array
+                               (
+                                       'building_part'         => 
$this->_db->f('building_part_'),
+                                       'amount'                        => 
$this->_db->f('amount'),
+                                       'year'                          => 
$this->_db->f('year'),//date('Y', $this->_db->f('date')),
+                                       'cat_id'                        => 
$this->_db->f('cat_id'),
+                               );
                        }
 
-                       if(isset($data['extra']) && is_array($data['extra']))
-                       {
-                               foreach ($data['extra'] as $input_name => 
$value)
-                               {
-                                       if(isset($value) && $value)
-                                       {
-                                               $value_set[$input_name] = 
$value;
-                                       }
-                               }
+                       return $values;
+               }
 
-                               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;
-                                               }
-                                       }
-                               }
-                       }
+               public function delete($id)
+               {
+                       $id = (int) $id;
+                       $this->_db->transaction_begin();
 
-                       $_address = array();
-                       if(isset($data['street_name']) && $data['street_name'])
+                       try
                        {
-                               $_address[] = "{$data['street_name']} 
{$data['street_number']}";
+                               $this->_db->Exception_On_Error = true;
+                               $this->_db->query("DELETE FROM 
fm_condition_survey WHERE id={$id}",__LINE__,__FILE__);
+                               $this->_db->query("DELETE FROM fm_request WHERE 
condition_survey_id={$id}",__LINE__,__FILE__);
+                               $this->_db->Exception_On_Error = false;
                        }
 
-                       if(isset($data['location_name']) && 
$data['location_name'])
+                       catch(Exception $e)
                        {
-                               $_address[] = $data['location_name'];
-                       }
-
-                       if(isset($data['additional_info']) && 
$data['additional_info'])
-                       {
-                               foreach($data['additional_info'] as $key => 
$value)
+                               if ( $e )
                                {
-                                       if($value)
-                                       {
-                                               $_address[] = "{$key}|{$value}";
-                                       }
+                                       throw $e;
                                }
                        }
 
-                       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;
+                       $this->_db->transaction_commit();
                }
-
-               function delete($id)
-               {
-                       $id = (int) $id;
-                       $table = 'fm_condition_survey';
-                       $this->_db->query("DELETE FROM $table WHERE 
id={$id}",__LINE__,__FILE__);
-               }
        }

Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -1181,7 +1181,11 @@
                                                $ordermethod = " ORDER BY 
fm_location1.loc1_name {$sort}";  // Don't work with LDAP. 
                                                break;
                                        default:
-                                               $ordermethod = " ORDER BY 
$entity_table.$order $sort";
+                                               $metadata = 
$this->db->metadata($entity_table);
+                                               if(isset($metadata[$order]))
+                                               {
+                                                       $ordermethod = " ORDER 
BY $entity_table.$order $sort";
+                                               }
                                }
                        }
                        else

Modified: branches/Version-1_0-branch/property/inc/class.solocation.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.solocation.inc.php   
2012-12-11 09:48:09 UTC (rev 10585)
@@ -1341,7 +1341,7 @@
 
                        $value_set['entry_date'] = time();
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = 
$this->db->validate_update($value_set);
 
                        $sql = "SELECT * from fm_location$type_id where 
location_code ='" . $location['location_code'] . "'";
                        $this->db->query($sql,__LINE__,__FILE__);
@@ -1375,10 +1375,10 @@
                        }
 
                        $cols[] = 'exp_date';
-                       $vals[] = date($this->bocommon->datetimeformat,time());
+                       $vals[] = date($this->db->datetime_format(),time());
 
                        $cols   =implode(",", $cols);
-                       $vals = $this->bocommon->validate_db_insert($vals);
+                       $vals = $this->db->validate_insert($vals);
 
                        $this->db->transaction_begin();
                        $sql = "INSERT INTO fm_location" . $type_id ."_history 
($cols) VALUES ($vals)";

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -1024,7 +1024,7 @@
                                        $project['budget_periodization'],
                                );
 
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $this->db->query("INSERT INTO fm_project 
(id,project_group,name,access,category,entry_date,start_date,end_date,coordinator,status,"
                                . 
"descr,budget,reserve,location_code,address,key_deliver,key_fetch,other_branch,key_responsible,user_id,ecodimb,account_group,contact_id,inherit_location,periodization_id
 $cols) "

Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -28,43 +28,43 @@
        */
 
        phpgw::import_class('phpgwapi.datetime');
+       phpgw::import_class('property.socommon_core');
 
        /**
         * Description
         * @package property
         */
 
-       class property_sorequest
+       class property_sorequest extends property_socommon_core
        {
                public $sum_budget = 0;
                public $sum_consume = 0;
+               public $uicols = array();
+
+               protected $global_lock = false;
                function __construct()
                {
-                       $this->account          = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       parent::__construct();
+
                        $this->soproject        = 
CreateObject('property.soproject');
                        $this->historylog       = 
CreateObject('property.historylog','request');
                        $this->bocommon         = 
CreateObject('property.bocommon');
-                       $this->custom           = 
createObject('property.custom_fields');
-                       $this->db           = & $GLOBALS['phpgw']->db;
-                       $this->join                     = & $this->db->join;
-                       $this->left_join        = & $this->db->left_join;
-                       $this->like                     = & $this->db->like;
                        $this->interlink        = 
CreateObject('property.interlink');
                }
 
                function read_priority_key()
                {
-                       $this->db->query("SELECT * FROM 
fm_request_condition_type ORDER BY priority_key DESC, id 
ASC",__LINE__,__FILE__);
+                       $this->_db->query("SELECT * FROM 
fm_request_condition_type ORDER BY priority_key DESC, id 
ASC",__LINE__,__FILE__);
 
                        $priority_key = array();
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $priority_key[] = array
                                (
-                                       'id'                    => 
$this->db->f('id'),
-                                       'name'                  => 
$this->db->f('name',true),
-                                       'descr'                 => 
$this->db->f('descr',true),
-                                       'priority_key'  => 
$this->db->f('priority_key')
+                                       'id'                    => 
$this->_db->f('id'),
+                                       'name'                  => 
$this->_db->f('name',true),
+                                       'descr'                 => 
$this->_db->f('descr',true),
+                                       'priority_key'  => 
$this->_db->f('priority_key')
                                );
                        }
 
@@ -76,7 +76,7 @@
 
                        while (is_array($values['priority_key']) && 
list($id,$priority_key) = each($values['priority_key']))
                        {
-                               $this->db->query("UPDATE 
fm_request_condition_type SET priority_key = $priority_key WHERE id = 
$id",__LINE__,__FILE__);
+                               $this->_db->query("UPDATE 
fm_request_condition_type SET priority_key = $priority_key WHERE id = 
$id",__LINE__,__FILE__);
                        }
 
                        $this->update_score();
@@ -95,11 +95,11 @@
                        else
                        {
                                $request = array();
-                               $this->db->query("SELECT id FROM 
fm_request",__LINE__,__FILE__);
+                               $this->_db->query("SELECT id FROM 
fm_request",__LINE__,__FILE__);
 
-                               while ($this->db->next_record())
+                               while ($this->_db->next_record())
                                {
-                                       $request[] = $this->db->f('id');
+                                       $request[] = $this->_db->f('id');
                                }
                        }
 
@@ -112,37 +112,37 @@
                                
if($GLOBALS['phpgw_info']['server']['db_type']=='pgsql' || 
$GLOBALS['phpgw_info']['server']['db_type']=='postgres')
                                {
                                        $sql = "UPDATE fm_request SET score = 
(SELECT sum(CAST(priority_key as int4) * ( CAST(degree as int4) * 
CAST(probability as int4) * ( CAST(consequence as int4) )))  FROM 
fm_request_condition"
-                                               . " {$this->join}  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = {$id}) WHERE fm_request.id = 
{$id}";
+                                               . " {$this->_join}  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = {$id}) WHERE fm_request.id = 
{$id}";
 
-                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
                                }
                                else
                                {
                                        $sql = "SELECT sum(priority_key * ( 
degree * probability * ( consequence ))) AS score FROM fm_request_condition"
-                                               . " $this->join  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = $id";
+                                               . " $this->_join  
fm_request_condition_type ON (fm_request_condition.condition_type = 
fm_request_condition_type.id) WHERE request_id = $id";
 
-                                       
$this->db->query($sql,__LINE__,__FILE__);
+                                       
$this->_db->query($sql,__LINE__,__FILE__);
 
-                                       $this->db->next_record();
-                                       $score = $this->db->f('score');
-                                       $this->db->query("UPDATE fm_request SET 
score = $score WHERE id = $id",__LINE__,__FILE__);
+                                       $this->_db->next_record();
+                                       $score = $this->_db->f('score');
+                                       $this->_db->query("UPDATE fm_request 
SET score = $score WHERE id = $id",__LINE__,__FILE__);
                                }
                        }
-                       $this->db->query("UPDATE fm_request SET score = 0 WHERE 
score IS NULL",__LINE__,__FILE__);
-                       $this->db->query("UPDATE fm_request SET score = score + 
{$authorities_demands} WHERE authorities_demands = 1",__LINE__,__FILE__);
+                       $this->_db->query("UPDATE fm_request SET score = 0 
WHERE score IS NULL",__LINE__,__FILE__);
+                       $this->_db->query("UPDATE fm_request SET score = score 
+ {$authorities_demands} WHERE authorities_demands = 1",__LINE__,__FILE__);
                }
 
                function select_status_list()
                {
-                       $this->db->query("SELECT id, descr FROM 
fm_request_status ORDER BY sorting ");
+                       $this->_db->query("SELECT id, descr FROM 
fm_request_status ORDER BY sorting ");
 
                        $status = array();
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $status[] = array
                                (
-                                       'id'    => $this->db->f('id'),
-                                       'name'  => $this->db->f('descr',true)
+                                       'id'    => $this->_db->f('id'),
+                                       'name'  => $this->_db->f('descr',true)
                                );
                        }
                        return $status;
@@ -150,18 +150,18 @@
 
                function select_condition_type_list()
                {
-                       $this->db->query("SELECT * FROM 
fm_request_condition_type ORDER BY id",__LINE__,__FILE__);
+                       $this->_db->query("SELECT * FROM 
fm_request_condition_type ORDER BY id",__LINE__,__FILE__);
 
                        $values = array();
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
-                               $id = $this->db->f('id');
+                               $id = $this->_db->f('id');
                                $values[$id] = array
                                (
                                        'id'            => $id,
-                                       'name'          => 
$this->db->f('name',true),
-                                       'descr'         => 
$this->db->f('descr',true),
-                                       'weight'        => 
$this->db->f('priority_key')
+                                       'name'          => 
$this->_db->f('name',true),
+                                       'descr'         => 
$this->_db->f('descr',true),
+                                       'weight'        => 
$this->_db->f('priority_key')
                                );
                        }
                        return $values;
@@ -174,18 +174,18 @@
                        foreach($condition_type_list as $condition_type)
                        {
                                $i = (int)$condition_type['id'];
-                               $this->db->query("SELECT * FROM 
fm_request_condition WHERE request_id={$request_id} AND condition_type = 
{$i}",__LINE__,__FILE__);
+                               $this->_db->query("SELECT * FROM 
fm_request_condition WHERE request_id={$request_id} AND condition_type = 
{$i}",__LINE__,__FILE__);
 
-                               $this->db->next_record();
+                               $this->_db->next_record();
 
                                $values[$i] = array
                                (
                                        'request_id'            => $request_id,
-                                       'condition_type'        => 
$this->db->f('condition_type'),
-                                       'reference'                     => 
$this->db->f('reference'),
-                                       'degree'                        => 
$this->db->f('degree'),
-                                       'probability'           => 
$this->db->f('probability'),
-                                       'consequence'           => 
$this->db->f('consequence')
+                                       'condition_type'        => 
$this->_db->f('condition_type'),
+                                       'reference'                     => 
$this->_db->f('reference'),
+                                       'degree'                        => 
$this->_db->f('degree'),
+                                       'probability'           => 
$this->_db->f('probability'),
+                                       'consequence'           => 
$this->_db->f('consequence')
                                );
                        }
 
@@ -214,6 +214,7 @@
                        $building_part  = isset($data['building_part']) && 
$data['building_part'] ? (int)$data['building_part'] : 0;
                        $degree_id              = $data['degree_id'];
                        $attrib_filter  = $data['attrib_filter'] ? 
$data['attrib_filter'] : array();
+                       $condition_survey_id = $data['condition_survey_id'] ? 
(int) $data['condition_survey_id'] : 0;
 
                        $location_id = 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request');
                        $attribute_table = 'phpgw_cust_attribute';
@@ -373,27 +374,27 @@
                        $uicols['classname'][]          = '';
                        $uicols['sortable'][]           = true;
 
-                       $this->db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter");
+                       $this->_db->query("SELECT * FROM $attribute_table WHERE 
list=1 AND $attribute_filter");
                        $_attrib = array();
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
-                               $_column_name = $this->db->f('column_name');
+                               $_column_name = $this->_db->f('column_name');
                                $cols .= ",{$entity_table}.{$_column_name}";
 
                                $cols_return[]                          = 
$_column_name;
                                $cols_group[]                           = 
$_column_name;
                                $uicols['input_type'][]         = 'text';
                                $uicols['name'][]                       = 
$_column_name;
-                               $uicols['descr'][]                      = 
$this->db->f('input_text',true);
-                               $uicols['statustext'][]         = 
$this->db->f('statustext',true);
+                               $uicols['descr'][]                      = 
$this->_db->f('input_text',true);
+                               $uicols['statustext'][]         = 
$this->_db->f('statustext',true);
                                $uicols['exchange'][]           = '';
                                $uicols['align'][]                      = '';
-                               $uicols['datatype'][]           = 
$this->db->f('datatype');
+                               $uicols['datatype'][]           = 
$this->_db->f('datatype');
                                $uicols['formatter'][]          = '';
                                $uicols['classname'][]          = '';
                                $uicols['sortable'][]           = false;
 
-                               $_attrib[$_column_name] = $this->db->f('id');
+                               $_attrib[$_column_name] = $this->_db->f('id');
                        }
 
                        $cols.= ",$entity_table.coordinator";
@@ -412,11 +413,11 @@
 
 
                        $paranthesis = '(';
-                       $joinmethod = "{$this->left_join} fm_request_status ON 
{$entity_table}.status = fm_request_status.id)";
+                       $joinmethod = "{$this->_left_join} fm_request_status ON 
{$entity_table}.status = fm_request_status.id)";
                        $paranthesis .= '(';
-                       $joinmethod .= "{$this->left_join} fm_request_consume 
ON {$entity_table}.id = fm_request_consume.request_id)";
+                       $joinmethod .= "{$this->_left_join} fm_request_consume 
ON {$entity_table}.id = fm_request_consume.request_id)";
                        $paranthesis .= '(';
-                       $joinmethod .= "{$this->left_join} fm_request_condition 
ON {$entity_table}.id = fm_request_condition.request_id)";
+                       $joinmethod .= "{$this->_left_join} 
fm_request_condition ON {$entity_table}.id = fm_request_condition.request_id)";
 
                        $GLOBALS['phpgw']->config->read();
                        $_location_level = 
isset($GLOBALS['phpgw']->config->config_data['request_location_level']) && 
$GLOBALS['phpgw']->config->config_data['request_location_level'] ? 
$GLOBALS['phpgw']->config->config_data['request_location_level'] : 0;
@@ -455,22 +456,29 @@
                                $where = 'AND';
                        }
 
+
                        if ($cat_id > 0)
                        {
                                $filtermethod .= " $where 
fm_request.category='{$cat_id}'";
                                $where = 'AND';
                        }
 
+                       if ($condition_survey_id > 0)
+                       {
+                               $filtermethod .= " $where 
fm_request.condition_survey_id = '{$condition_survey_id}'";
+                               $where = 'AND';
+                       }
+
                        if ($status_id && $status_id != 'all')
                        {
 
                                if($status_id == 'open')
                                {
                                        $_status_filter = array();
-                                       $this->db->query("SELECT * FROM 
fm_request_status WHERE delivered IS NULL AND closed IS NULL");
-                                       while($this->db->next_record())
+                                       $this->_db->query("SELECT * FROM 
fm_request_status WHERE delivered IS NULL AND closed IS NULL");
+                                       while($this->_db->next_record())
                                        {
-                                               $_status_filter[] = 
$this->db->f('id');
+                                               $_status_filter[] = 
$this->_db->f('id');
                                        }
                                        $filtermethod .= " $where 
fm_request.status IN ('" . implode("','", $_status_filter) . "')"; 
                                }
@@ -490,7 +498,7 @@
 
                        if ($building_part)
                        {
-                               $filtermethod .= " $where 
fm_request.building_part {$this->like} '{$building_part}%'";
+                               $filtermethod .= " $where 
fm_request.building_part {$this->_like} '{$building_part}%'";
                                $where = 'AND';
                        }
 
@@ -537,11 +545,11 @@
                                }
                                else
                                {
-                                       $query = 
$this->db->db_addslashes($query);
-                                       $querymethod = " $where 
(fm_request.title {$this->like} '%$query%' OR fm_request.address {$this->like} 
'%$query%' OR fm_request.location_code {$this->like} '%$query%' OR 
fm_request.id =" . (int)$query;
+                                       $query = 
$this->_db->db_addslashes($query);
+                                       $querymethod = " $where 
(fm_request.title {$this->_like} '%$query%' OR fm_request.address 
{$this->_like} '%$query%' OR fm_request.location_code {$this->_like} '%$query%' 
OR fm_request.id =" . (int)$query;
                                        for ($i=1;$i<=($_location_level);$i++)
                                        {
-                                               $querymethod .= " OR 
fm_location{$i}.loc{$i}_name {$this->like} '%$query%'";
+                                               $querymethod .= " OR 
fm_location{$i}.loc{$i}_name {$this->_like} '%$query%'";
                                        }
                                        $querymethod .= ')';
                                }
@@ -578,19 +586,19 @@
                        $cols_return            = $this->bocommon->cols_return;
                        $this->cols_extra       = $this->bocommon->cols_extra;
 
-                       $this->db->fetchmode = 'ASSOC';
+                       $this->_db->fetchmode = 'ASSOC';
 
                        $sql2 = "SELECT count(*) as cnt, sum(budget) as 
sum_budget  FROM ({$sql}) as t";
 
-                       $this->db->query($sql2,__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $this->total_records = $this->db->f('cnt');
-                       $this->sum_budget       = $this->db->f('sum_budget');
+                       $this->_db->query($sql2,__LINE__,__FILE__);
+                       $this->_db->next_record();
+                       $this->_total_records = $this->_db->f('cnt');
+                       $this->sum_budget       = $this->_db->f('sum_budget');
 
                        $sql3 = "SELECT sum(fm_request_consume.amount) as 
sum_consume  FROM {$sql_arr[1]}";
-                       $this->db->query($sql3,__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $this->sum_consume      = $this->db->f('sum_consume');
+                       $this->_db->query($sql3,__LINE__,__FILE__);
+                       $this->_db->next_record();
+                       $this->sum_consume      = $this->_db->f('sum_consume');
                        
 //                     _debug_array($sql_arr);
 
@@ -603,11 +611,11 @@
                        {
                                if(!$allrows)
                                {
-                                       $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                                       $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
                                }
                                else
                                {
-                                       $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                                       $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                                }
                        }
                        $_datatype = array();
@@ -617,13 +625,13 @@
                        }
                        $dataset = array();
                        $j=0;
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                foreach($cols_return as $key => $field)
                                {
                                        $dataset[$j][$field] = array
                                                (
-                                                       'value'         => 
$this->db->f($field),
+                                                       'value'         => 
$this->_db->f($field),
                                                        'datatype'      => 
$_datatype[$field],
                                                        'attrib_id'     => 
$_attrib[$field]
                                                );
@@ -634,12 +642,12 @@
                        foreach ($dataset as &$entry)
                        {
                                $sql = "SELECT sum(amount) as consume FROM 
fm_request_consume WHERE request_id={$entry['request_id']['value']}";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               $this->db->next_record();
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               $this->_db->next_record();
 
                                $entry['consume'] = array
                                (
-                                       'value'         => 
$this->db->f('consume'),
+                                       'value'         => 
$this->_db->f('consume'),
                                        'datatype'      => false,
                                        'attrib_id'     => false,
                                );
@@ -656,40 +664,40 @@
                        $request_id = (int) $request_id;
                        $sql = "SELECT * FROM fm_request WHERE 
id={$request_id}";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->_db->query($sql,__LINE__,__FILE__);
 
                        $request = array();
-                       if ($this->db->next_record())
+                       if ($this->_db->next_record())
                        {
                                $request = array
                                        (
-                                               'id'                            
        => $this->db->f('id'),
-                                               'request_id'                    
=> $this->db->f('id'), // FIXME
-                                               'title'                         
        => $this->db->f('title', true),
-                                               'location_code'                 
=> $this->db->f('location_code'),
-                                               'descr'                         
        => $this->db->f('descr', true),
-                                               'status'                        
        => $this->db->f('status'),
-                                               'budget'                        
        => (int)$this->db->f('budget'),
-                                               'tenant_id'                     
        => $this->db->f('tenant_id'),
-                                               'owner'                         
        => $this->db->f('owner'),
-                                               'coordinator'                   
=> $this->db->f('coordinator'),
-                                               'access'                        
        => $this->db->f('access'),
-                                               'start_date'                    
=> $this->db->f('start_date'),
-                                               'end_date'                      
        => $this->db->f('end_date'),
-                                               'cat_id'                        
        => $this->db->f('category'),
-                                               'branch_id'                     
        => $this->db->f('branch_id'),
-                                               'authorities_demands'   => 
$this->db->f('authorities_demands'),
-                                               'score'                         
        => $this->db->f('score'),
-                                               'p_num'                         
        => $this->db->f('p_num'),
-                                               'p_entity_id'                   
=> $this->db->f('p_entity_id'),
-                                               'p_cat_id'                      
        => $this->db->f('p_cat_id'),
-                                               'contact_phone'                 
=> $this->db->f('contact_phone', true),
-                                               'building_part'                 
=> $this->db->f('building_part'),
-                                               'entry_date'                    
=> $this->db->f('entry_date'),
-                                               'closed_date'                   
=> $this->db->f('closed_date'),
-                                               'in_progress_date'              
=> $this->db->f('in_progress_date'),
-                                               'delivered_date'                
=> $this->db->f('delivered_date'),
-                                               'regulations'                   
=> explode(',', $this->db->f('regulations'))
+                                               'id'                            
        => $this->_db->f('id'),
+                                               'request_id'                    
=> $this->_db->f('id'), // FIXME
+                                               'title'                         
        => $this->_db->f('title', true),
+                                               'location_code'                 
=> $this->_db->f('location_code'),
+                                               'descr'                         
        => $this->_db->f('descr', true),
+                                               'status'                        
        => $this->_db->f('status'),
+                                               'budget'                        
        => (int)$this->_db->f('budget'),
+                                               'tenant_id'                     
        => $this->_db->f('tenant_id'),
+                                               'owner'                         
        => $this->_db->f('owner'),
+                                               'coordinator'                   
=> $this->_db->f('coordinator'),
+                                               'access'                        
        => $this->_db->f('access'),
+                                               'start_date'                    
=> $this->_db->f('start_date'),
+                                               'end_date'                      
        => $this->_db->f('end_date'),
+                                               'cat_id'                        
        => $this->_db->f('category'),
+                                               'branch_id'                     
        => $this->_db->f('branch_id'),
+                                               'authorities_demands'   => 
$this->_db->f('authorities_demands'),
+                                               'score'                         
        => $this->_db->f('score'),
+                                               'p_num'                         
        => $this->_db->f('p_num'),
+                                               'p_entity_id'                   
=> $this->_db->f('p_entity_id'),
+                                               'p_cat_id'                      
        => $this->_db->f('p_cat_id'),
+                                               'contact_phone'                 
=> $this->_db->f('contact_phone', true),
+                                               'building_part'                 
=> $this->_db->f('building_part'),
+                                               'entry_date'                    
=> $this->_db->f('entry_date'),
+                                               'closed_date'                   
=> $this->_db->f('closed_date'),
+                                               'in_progress_date'              
=> $this->_db->f('in_progress_date'),
+                                               'delivered_date'                
=> $this->_db->f('delivered_date'),
+                                               'regulations'                   
=> explode(',', $this->_db->f('regulations'))
                                        );
 
                                if ( isset($values['attributes']) && 
is_array($values['attributes']) )
@@ -697,40 +705,40 @@
                                        $request['attributes'] = 
$values['attributes'];
                                        foreach ( $request['attributes'] as 
&$attr )
                                        {
-                                               $attr['value']  = 
$this->db->f($attr['column_name']);
+                                               $attr['value']  = 
$this->_db->f($attr['column_name']);
                                        }
                                }
 
-                               $location_code = $this->db->f('location_code');
+                               $location_code = $this->_db->f('location_code');
                                $request['power_meter']         = 
$this->soproject->get_power_meter($location_code);
 
                                $sql = "SELECT * FROM fm_request_planning WHERE 
request_id={$request_id} ORDER BY date ASC";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               while($this->db->next_record())
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               while($this->_db->next_record())
                                {
                                        $request['planning'][] = array
                                        (
-                                               'id'                    => 
$this->db->f('id'),
-                                               'amount'                => 
$this->db->f('amount'),
-                                               'date'                  => 
$this->db->f('date'),
-                                               'user_id'               => 
$this->db->f('user_id'),
-                                               'entry_date'    => 
$this->db->f('entry_date'),
-                                               'descr'                 => 
$this->db->f('descr',true)
+                                               'id'                    => 
$this->_db->f('id'),
+                                               'amount'                => 
$this->_db->f('amount'),
+                                               'date'                  => 
$this->_db->f('date'),
+                                               'user_id'               => 
$this->_db->f('user_id'),
+                                               'entry_date'    => 
$this->_db->f('entry_date'),
+                                               'descr'                 => 
$this->_db->f('descr',true)
                                        );
                                }
 
                                $sql = "SELECT * FROM fm_request_consume WHERE 
request_id={$request_id} ORDER BY date ASC";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               while($this->db->next_record())
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               while($this->_db->next_record())
                                {
                                        $request['consume'][] = array
                                        (
-                                               'id'                    => 
$this->db->f('id'),
-                                               'amount'                => 
$this->db->f('amount'),
-                                               'date'                  => 
$this->db->f('date'),
-                                               'user_id'               => 
$this->db->f('user_id'),
-                                               'entry_date'    => 
$this->db->f('entry_date'),
-                                               'descr'                 => 
$this->db->f('descr',true)
+                                               'id'                    => 
$this->_db->f('id'),
+                                               'amount'                => 
$this->_db->f('amount'),
+                                               'date'                  => 
$this->_db->f('date'),
+                                               'user_id'               => 
$this->_db->f('user_id'),
+                                               'entry_date'    => 
$this->_db->f('entry_date'),
+                                               'descr'                 => 
$this->_db->f('descr',true)
                                        );
                                }
                        }
@@ -741,15 +749,15 @@
                function request_workorder_data($request_id = '')
                {
                        $request_id = (int)$request_id;
-                       $this->db->query("select budget, id as workorder_id, 
vendor_id from fm_workorder where request_id='$request_id'");
+                       $this->_db->query("select budget, id as workorder_id, 
vendor_id from fm_workorder where request_id='$request_id'");
                        $budget = array();
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $budget[] = array
                                        (
-                                               'workorder_id'  => 
$this->db->f('workorder_id'),
-                                               'budget'        => 
sprintf("%01.2f",$this->db->f('budget')),
-                                               'vendor_id'     => 
$this->db->f('vendor_id')
+                                               'workorder_id'  => 
$this->_db->f('workorder_id'),
+                                               'budget'        => 
sprintf("%01.2f",$this->_db->f('budget')),
+                                               'vendor_id'     => 
$this->_db->f('vendor_id')
                                        );
                        }
                        return $budget;
@@ -760,11 +768,11 @@
                {
                        $name = 'request';
                        $now = time();
-                       $this->db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
-                       $this->db->next_record();
-                       $next_id = $this->db->f('value') +1;
-                       $start_date = (int)$this->db->f('start_date');
-                       $this->db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
+                       $this->_db->query("SELECT value, start_date FROM 
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date 
DESC");
+                       $this->_db->next_record();
+                       $next_id = $this->_db->f('value') +1;
+                       $start_date = (int)$this->_db->f('start_date');
+                       $this->_db->query("UPDATE fm_idgenerator SET value = 
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
                        return $next_id;
                }
 
@@ -772,70 +780,41 @@
                {
                        $name = 'request';
                        $now = time();
-                       $this->db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC");
-                       $this->db->next_record();
-                       $id = $this->db->f('value')+1;
+                       $this->_db->query("SELECT value FROM fm_idgenerator 
WHERE name = '{$name}' AND start_date < {$now} ORDER BY start_date DESC");
+                       $this->_db->next_record();
+                       $id = $this->_db->f('value')+1;
                        return $id;
                }
 
                function add($request, $values_attribute = array())
                {
-                       //_debug_array($request);
                        $receipt = array();
 
                        $value_set = array();
 
-                       while (is_array($request['location']) && 
list($input_name,$value) = each($request['location']))
-                       {
-                               if($value)
-                               {
-                                       $value_set[$input_name] = $value;
-                               }
-                       }
+                       $data = $request;
+                       $data['attributes'] = $values_attribute;
+                       
+                       $value_set                                              
= $this->_get_value_set( $data );
 
-                       while (is_array($request['extra']) && 
list($input_name,$value) = each($request['extra']))
-                       {
-                               if($value)
-                               {
-                                       $value_set[$input_name] = $value;
-                               }
-                       }
 
-                       $data_attribute = 
$this->custom->prepare_for_db('fm_request', $values_attribute);
-                       if(isset($data_attribute['value_set']))
+                       if ( $this->_db->get_transaction() )
                        {
-                               foreach($data_attribute['value_set'] as 
$input_name => $value)
-                               {
-                                       if(isset($value) && $value)
-                                       {
-                                               $value_set[$input_name] = 
$value;
-                                       }
-                               }
+                               $this->global_lock = true;
                        }
-
-                       if($request['street_name'])
+                       else
                        {
-                               $address[]= $request['street_name'];
-                               $address[]= $request['street_number'];
-                               $address        = 
$this->db->db_addslashes(implode(" ", $address));
+                               $this->_db->transaction_begin();
                        }
 
-                       if(!$address)
-                       {
-                               $address = 
$this->db->db_addslashes($request['location_name']);
-                       }
-
-                       $this->db->transaction_begin();
-
                        $id = $this->next_id();
 
                        $value_set['id']                                        
= $id;
-                       $value_set['title']                                     
= $this->db->db_addslashes($request['title']);
+                       $value_set['title']                                     
= $this->_db->db_addslashes($request['title']);
                        $value_set['owner']                                     
= $this->account;
                        $value_set['category']                          = 
$request['cat_id'];
-                       $value_set['descr']                                     
= $this->db->db_addslashes($request['descr']);
-                       $value_set['location_code']                     = 
$request['location_code'];
-                       $value_set['address']                           = 
$address;
+                       $value_set['descr']                                     
= $this->_db->db_addslashes($request['descr']);
+//                     $value_set['location_code']                     = 
$request['location_code'];
                        $value_set['entry_date']                        = 
time();
                        $value_set['budget']                            = 
$request['budget'];
                        $value_set['status']                            = 
$request['status'];
@@ -846,11 +825,12 @@
                        $value_set['start_date']                        = 
$request['start_date'];
                        $value_set['end_date']                          = 
$request['end_date'];
                        $value_set['regulations']                       = 
$request['regulations'] ? ',' . implode(',',$request['regulations']) . ',' : '';
+                       $value_set['condition_survey_id']       = 
$request['condition_survey_id'];
 
                        $cols = implode(',', array_keys($value_set));
-                       $values = 
$this->bocommon->validate_db_insert(array_values($value_set));
+                       $values = 
$this->_db->validate_insert(array_values($value_set));
 
-                       $this->db->query("INSERT INTO fm_request ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
+                       $this->_db->query("INSERT INTO fm_request ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
 
 
                        if(isset($request['condition']) && 
is_array($request['condition']))
@@ -860,7 +840,7 @@
                                        $_condition_type = 
isset($value_type['condition_type']) && $value_type['condition_type'] ? 
$value_type['condition_type'] : $condition_type;
                                        if($_condition_type)
                                        {
-                                               $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,reference,degree,probability,consequence,user_id,entry_date)
 "
+                                               $this->_db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,reference,degree,probability,consequence,user_id,entry_date)
 "
                                                        . "VALUES ("
                                                        . (int) $id. ","
                                                        . (int) 
$_condition_type . ","
@@ -878,7 +858,7 @@
 
                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
                        {
-                               $this->db->query("update fm_tenant set 
contact_phone='". $request['extra']['contact_phone']. "' where id='". 
$request['extra']['tenant_id']. "'",__LINE__,__FILE__);
+                               $this->_db->query("update fm_tenant set 
contact_phone='". $request['extra']['contact_phone']. "' where id='". 
$request['extra']['tenant_id']. "'",__LINE__,__FILE__);
                        }
 
                        if ($request['power_meter'] )
@@ -886,47 +866,38 @@
                                
$this->soproject->update_power_meter($request['power_meter'],$request['location_code'],$address);
                        }
 
-                       if(is_array($request['origin']) && 
isset($request['origin'][0]['data'][0]['id']))
+                       if($interlink_data = $this->_get_interlink_data($id, 
$request, '.project.request'))
                        {
-                               $interlink_data = array
-                                       (
-                                               'location1_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', 
$request['origin'][0]['location']),
-                                               'location1_item_id' => 
$request['origin'][0]['data'][0]['id'],
-                                               'location2_id'          => 
$GLOBALS['phpgw']->locations->get_id('property', '.project.request'),
-                                               'location2_item_id' => $id,
-                                               'account_id'            => 
$this->account
-                                       );
-
-                               
$this->interlink->add($interlink_data,$this->db);
+                               
$this->interlink->add($interlink_data,$this->_db);
                        }
 
                        $sql = "SELECT * FROM fm_request_status WHERE 
id='{$request['status']}'";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->_db->next_record();
 
                        $value_set = array();
-                       if($this->db->f('in_progress'))
+                       if($this->_db->f('in_progress'))
                        {
                                $value_set['in_progress_date']  = time();
                        }
-                       if($this->db->f('closed'))
+                       if($this->_db->f('closed'))
                        {
                                $value_set['closed_date']               = 
time();
                        }
-                       if($this->db->f('delivered'))
+                       if($this->_db->f('delivered'))
                        {
                                $value_set['delivered_date']    = time();
                        }
 
                        if($value_set)
                        {
-                               $value_set      = 
$this->db->validate_update($value_set);
-                               $this->db->query("UPDATE fm_request SET 
$value_set WHERE id= '{$id}'",__LINE__,__FILE__);
+                               $value_set      = 
$this->_db->validate_update($value_set);
+                               $this->_db->query("UPDATE fm_request SET 
$value_set WHERE id= '{$id}'",__LINE__,__FILE__);
                        }
 
                        if($request['planning_value'] && 
$request['planning_date'])
                        {
-                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                               $this->_db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
                                        . "VALUES ('"
                                        . $id . "','"
                                        . (int)$request['planning_value'] . "',"
@@ -937,7 +908,7 @@
 
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
-                               $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
+                               $this->_db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
                                        . "VALUES ('"
                                        . $id . "','"
                                        . (int)$request['consume_value'] . "',"
@@ -946,18 +917,20 @@
                                        . time() . ")",__LINE__,__FILE__);
                        }
 
-                       if($this->db->transaction_commit())
+                       $this->increment_request_id();
+                       $this->historylog->add('SO',$id,$request['status']);
+                       $this->historylog->add('TO',$id,$request['cat_id']);
+                       
$this->historylog->add('CO',$id,$request['coordinator']);
+                       $receipt['message'][] = array('msg'=>lang('request %1 
has been saved',$id));
+
+
+                       if ( !$this->global_lock )
                        {
-                               $this->increment_request_id();
-                               
$this->historylog->add('SO',$id,$request['status']);
-                               
$this->historylog->add('TO',$id,$request['cat_id']);
-                               
$this->historylog->add('CO',$id,$request['coordinator']);
-                               $receipt['message'][] = 
array('msg'=>lang('request %1 has been saved',$id));
+                               $this->_db->transaction_commit();
                        }
-                       else
-                       {
-                               $receipt['error'][] = 
array('msg'=>lang('request %1 has not been saved',$id));
-                       }
+
+//                             $receipt['error'][] = 
array('msg'=>lang('request %1 has not been saved',$id));
+
                        $receipt['id'] = $id;
                        return $receipt;
                }
@@ -970,23 +943,23 @@
                        {
                                $address[]= $request['street_name'];
                                $address[]= $request['street_number'];
-                               $address = $this->db->db_addslashes(implode(" 
", $address));
+                               $address = $this->_db->db_addslashes(implode(" 
", $address));
                        }
 
                        if(!$address)
                        {
-                               $address = 
$this->db->db_addslashes($request['location_name']);
+                               $address = 
$this->_db->db_addslashes($request['location_name']);
                        }
 
                        $value_set = array
                        (
-                               'title'                                 => 
$this->db->db_addslashes($request['title']),
+                               'title'                                 => 
$this->_db->db_addslashes($request['title']),
                                'status'                                => 
$request['status'],
                                'category'                              => 
$request['cat_id'],
                                'start_date'                    => 
$request['start_date'],
                                'end_date'                              => 
$request['end_date'],
                                'coordinator'                   => 
$request['coordinator'],
-                               'descr'                                 => 
$this->db->db_addslashes($request['descr']),
+                               'descr'                                 => 
$this->_db->db_addslashes($request['descr']),
                                'budget'                                => 
(int)$request['budget'],
                                'location_code'                 => 
$request['location_code'],
                                'address'                               => 
$address,
@@ -1013,40 +986,40 @@
                        }
 
 
-                       $this->db->transaction_begin();
+                       $this->_db->transaction_begin();
 
-                       $this->db->query("SELECT 
budget,status,category,coordinator FROM fm_request where id='" 
.$request['id']."'",__LINE__,__FILE__);
-                       $this->db->next_record();
+                       $this->_db->query("SELECT 
budget,status,category,coordinator FROM fm_request where id='" 
.$request['id']."'",__LINE__,__FILE__);
+                       $this->_db->next_record();
 
-                       $old_budget                     = 
$this->db->f('budget');
-                       $old_status = $this->db->f('status');
-                       $old_category = $this->db->f('category');
-                       $old_coordinator = $this->db->f('coordinator');
+                       $old_budget                     = 
$this->_db->f('budget');
+                       $old_status = $this->_db->f('status');
+                       $old_category = $this->_db->f('category');
+                       $old_coordinator = $this->_db->f('coordinator');
                        if($old_status != $request['status'])
                        {
                                $sql = "SELECT * FROM fm_request_status WHERE 
id='{$request['status']}'";
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               $this->db->next_record();
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               $this->_db->next_record();
 
-                               if($this->db->f('in_progress'))
+                               if($this->_db->f('in_progress'))
                                {
                                        $value_set['in_progress_date']  = 
time();
                                }
-                               if($this->db->f('closed'))
+                               if($this->_db->f('closed'))
                                {
                                        $value_set['closed_date']               
= time();
                                }
-                               if($this->db->f('delivered'))
+                               if($this->_db->f('delivered'))
                                {
                                        $value_set['delivered_date']    = 
time();
                                }
                        }
 
-                       $value_set      = 
$this->db->validate_update($value_set);
+                       $value_set      = 
$this->_db->validate_update($value_set);
 
-                       $this->db->query("UPDATE fm_request SET $value_set 
WHERE id= '{$request['id']}'",__LINE__,__FILE__);
+                       $this->_db->query("UPDATE fm_request SET $value_set 
WHERE id= '{$request['id']}'",__LINE__,__FILE__);
 
-                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id='{$request['id']}'",__LINE__,__FILE__);
+                       $this->_db->query("DELETE FROM fm_request_condition 
WHERE request_id='{$request['id']}'",__LINE__,__FILE__);
 
                        if(isset($request['condition']) && 
is_array($request['condition']))
                        {
@@ -1057,7 +1030,7 @@
                                        {
                                                continue;
                                        }
-                                       $this->db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,reference,degree,probability,consequence,user_id,entry_date)
 "
+                                       $this->_db->query("INSERT INTO 
fm_request_condition 
(request_id,condition_type,reference,degree,probability,consequence,user_id,entry_date)
 "
                                                . "VALUES ("
                                                . (int)$request['id']. ","
                                                . (int)$_condition_type . ","
@@ -1074,7 +1047,7 @@
 
                        if($request['extra']['contact_phone'] && 
$request['extra']['tenant_id'])
                        {
-                               $this->db->query("UPDATE fm_tenant SET 
contact_phone='{$request['extra']['contact_phone']}' WHERE 
id='{$request['extra']['tenant_id']}'",__LINE__,__FILE__);
+                               $this->_db->query("UPDATE fm_tenant SET 
contact_phone='{$request['extra']['contact_phone']}' WHERE 
id='{$request['extra']['tenant_id']}'",__LINE__,__FILE__);
                        }
 
                        if ($request['power_meter'] )
@@ -1084,7 +1057,7 @@
 
                        if($request['planning_value'] && 
$request['planning_date'])
                        {
-                               $this->db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
+                               $this->_db->query("INSERT INTO 
fm_request_planning (request_id,amount,date,user_id,entry_date) "
                                        . "VALUES ('"
                                        . $request['id']. "','"
                                        . (int)$request['planning_value'] . "',"
@@ -1097,13 +1070,13 @@
                        {
                                foreach ($request['delete_planning'] as 
$delete_planning)
                                {
-                                       $this->db->query("DELETE FROM 
fm_request_planning WHERE id =" . (int)$delete_planning,__LINE__,__FILE__);
+                                       $this->_db->query("DELETE FROM 
fm_request_planning WHERE id =" . (int)$delete_planning,__LINE__,__FILE__);
                                }
                        }
 
                        if($request['consume_value'] && 
$request['consume_date'])
                        {
-                               $this->db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
+                               $this->_db->query("INSERT INTO 
fm_request_consume (request_id,amount,date,user_id,entry_date) "
                                        . "VALUES ('"
                                        . $request['id']. "','"
                                        . (int)$request['consume_value'] . "',"
@@ -1116,11 +1089,11 @@
                        {
                                foreach ($request['delete_consume'] as 
$delete_consume)
                                {
-                                       $this->db->query("DELETE FROM 
fm_request_consume WHERE id =" . (int)$delete_consume,__LINE__,__FILE__);
+                                       $this->_db->query("DELETE FROM 
fm_request_consume WHERE id =" . (int)$delete_consume,__LINE__,__FILE__);
                                }
                        }
 
-                       if($this->db->transaction_commit())
+                       if($this->_db->transaction_commit())
                        {
                                if ($old_status != $request['status'])
                                {
@@ -1154,15 +1127,14 @@
                function delete($request_id )
                {
                        $request_id = (int) $request_id;
-                       $this->db->transaction_begin();
-                       $this->db->query("DELETE FROM fm_request_planning WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request_consume WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request_condition 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request_history  WHERE 
 history_record_id = {$request_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_request WHERE id = 
{$request_id}",__LINE__,__FILE__);
-               //      $this->db->query("DELETE FROM fm_origin WHERE 
destination = 'request' AND destination_id='" . $request_id . 
"'",__LINE__,__FILE__);
-                       $this->interlink->delete_at_target('property', 
'.project.request', $request_id, $this->db);
-                       $this->db->transaction_commit();
+                       $this->_db->transaction_begin();
+                       $this->_db->query("DELETE FROM fm_request_planning 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
+                       $this->_db->query("DELETE FROM fm_request_consume WHERE 
request_id = {$request_id}",__LINE__,__FILE__);
+                       $this->_db->query("DELETE FROM fm_request_condition 
WHERE request_id = {$request_id}",__LINE__,__FILE__);
+                       $this->_db->query("DELETE FROM fm_request_history  
WHERE  history_record_id = {$request_id}",__LINE__,__FILE__);
+                       $this->_db->query("DELETE FROM fm_request WHERE id = 
{$request_id}",__LINE__,__FILE__);
+                       $this->interlink->delete_at_target('property', 
'.project.request', $request_id, $this->_db);
+                       $this->_db->transaction_commit();
                }
 
                public function get_user_list()
@@ -1170,12 +1142,12 @@
                        $values = array();
                        $users = 
$GLOBALS['phpgw']->accounts->get_list('accounts', $start=-1, $sort='ASC', 
$order='account_lastname', $query,$offset=-1);
                        $sql = 'SELECT DISTINCT coordinator FROM fm_request';
-                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->_db->query($sql,__LINE__,__FILE__);
 
                        $account_lastname = array();
-                       while($this->db->next_record())
+                       while($this->_db->next_record())
                        {
-                               $user_id        = $this->db->f('coordinator');
+                               $user_id        = $this->_db->f('coordinator');
                                if(isset($users[$user_id]))
                                {
                                        $name   = 
$users[$user_id]->__toString();

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-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php   
2012-12-11 09:48:09 UTC (rev 10585)
@@ -47,6 +47,8 @@
                        'get_users'                     => true,
                        'edit_survey_title'     => true,
                        'get_files'                     => true,
+                       'get_related'           => true,
+                       'get_summation'         => true,
                        'view_file'                     => true,
                        'import'                        => true
                );
@@ -65,7 +67,8 @@
                        $this->acl_delete                       = 
$this->acl->check($this->acl_location, PHPGW_ACL_DELETE, 'property');
                        $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
 
-                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::condition_survey";
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::project::condition_survey";
+       //                      
$GLOBALS['phpgw']->css->add_external_file('logistic/templates/base/css/base.css');
                }
 
 
@@ -186,6 +189,17 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
+                       $data['datatable']['actions'][] = array
+                                       (
+                                               'my_name'               => 
'import_survey',
+                                               'text'                  => 
lang('import'),
+                                               'action'                => 
$GLOBALS['phpgw']->link('/index.php',array
+                                               (
+                                                       'menuaction'    => 
'property.uicondition_survey.import'
+                                               )),
+                                               'parameters'    => 
json_encode($parameters)
+                                       );
+
                        self::render_template_xsl('datatable_common', $data);
                }
 
@@ -226,7 +240,6 @@
                        $result_data['sort'] = $params['sort'];
                        $result_data['dir'] = $params['dir'];
 
-                       $editable = phpgw::get_var('editable') == 'true' ? true 
: false;
 
                        if (!$export)
                        {
@@ -293,7 +306,9 @@
                        $tabs['generic']        = array('label' => 
lang('generic'), 'link' => '#generic');
                        $active_tab = 'generic';
                        $tabs['documents']      = array('label' => 
lang('documents'), 'link' => null);
-                       $tabs['import'] = array('label' => lang('import'), 
'link' => null);
+                       $tabs['related']        = array('label' => 
lang('related'), 'link' => null);
+                       $tabs['summation']      = array('label' => 
lang('summation'), 'link' => null);
+                       $tabs['import']         = array('label' => 
lang('import'), 'link' => null);
 
                        if ($id)
                        {
@@ -302,6 +317,8 @@
                                        $tabs['import']['link'] = '#import';
                                }
                                $tabs['documents']['link'] = '#documents';
+                               $tabs['related']['link'] = '#related';
+                               $tabs['summation']['link'] = '#summation';
 
                                if (!$values)
                                {
@@ -347,6 +364,43 @@
                        
                        );
 
+                       $related_def = array
+                       (
+                               array('key' => 
'url','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'user','label'=>lang('user'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 
'entry_date','label'=>lang('entry date'),'sortable'=>false,'resizeable'=>true),
+                       );
+
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_1',
+                               'requestUrl'    => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_related', 'id' => 
$id,'phpgw_return_as'=>'json'))),
+                               'ColumnDefs'    => json_encode($related_def)
+                       );
+
+                       $summation_def = array
+                       (
+                               array('key' => 
'building_part','label'=>lang('building 
part'),'sortable'=>false,'resizeable'=>true),
+                               array('key' => 
'category','label'=>lang('category'),'sortable'=>true,'resizeable'=>true),
+                               array('key' => 'period_1','label'=>lang('year') 
. ':: < 1' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.formatLink'),
+                               array('key' => 'period_2','label'=>lang('year') 
. ':: 1 - 5' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                               array('key' => 'period_3','label'=>lang('year') 
. ':: 6 - 10' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                               array('key' => 'period_4','label'=>lang('year') 
. ':: 11 - 15' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                               array('key' => 'period_5','label'=>lang('year') 
. ':: 16 - 20' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                               array('key' => 'period_6','label'=>lang('year') 
. ':: 21 +' 
,'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                               array('key' => 
'sum','label'=>lang('sum'),'sortable'=>false,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+                       );
+
+                       $datatable_def[] = array
+                       (
+                               'container'             => 
'datatable-container_2',
+                               'requestUrl'    => 
json_encode(self::link(array('menuaction' => 
'property.uicondition_survey.get_summation', 'id' => 
$id,'phpgw_return_as'=>'json'))),
+                               'ColumnDefs'    => json_encode($summation_def)
+                       );
+
                        $data = array
                        (
                                'datatable_def'                                 
=> $datatable_def,
@@ -370,10 +424,11 @@
                                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::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
-                               
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
                        }
 
+                       self::add_javascript('phpgwapi', 'tinybox2', 
'packed.js');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
 //                     $GLOBALS['phpgw_info']['server']['no_jscombine'] = true;
 
                        self::render_template_xsl(array('condition_survey'), 
$data);
@@ -451,7 +506,7 @@
 
                public function get_files()
                {
-                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
+                       $id     = phpgw::get_var('id', 'int', 'REQUEST');
 
                        if( !$this->acl_read)
                        {
@@ -477,23 +532,171 @@
                        $vfs->override_acl = 0;
 
 
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
+                       $total_records = count($files);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $files;
+                       }
+                       else
+                       {
+                       //      $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $page = ceil( ( $start / $num_rows) );
+                               $files_part = array_chunk($files, $num_rows);
+                               $out = $files_part[$page];
+                       }
+
+//------ End pagination
+
+
                        $lang_view = lang('click to view file');
                        $lang_delete = lang('click to delete file');
 
                        $values = array();
-                       foreach($files as $_entry )
+                       foreach($out as $_entry )
                        {
                                $values[] = array
                                (
                                        'file_name' => "<a 
href='{$link_view_file}&amp;file_name={$_entry['name']}' target='_blank' 
title='{$lang_view}'>{$_entry['name']}</a>",
-                                       'delete_file' => "<input 
type='checkbox' name='values[file_action][]' value='{$_entry['name']}' 
title='$lang_delete'>",
+                                       'delete_file' => "<input 
type='checkbox' name='file_action[]' value='{$_entry['name']}' 
title='$lang_delete'>",
                                );
                        }                                                       
 
-                       return array('ResultSet'=> array('Result'=>$values), 
'totalResultsAvailable' => count($values));
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $values,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+
                }
 
+               function get_summation()
+               {
+                       $id     = phpgw::get_var('id', 'int', 'REQUEST');
 
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+
+                       $values = $this->bo->get_summation($id);
+                       
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $out,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+               }
+
+
+               function get_related()
+               {
+                       $id     = phpgw::get_var('id', 'int', 'REQUEST');
+
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+               
+                       $interlink      = CreateObject('property.interlink');
+                       $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
+
+
+                       $values = array();
+                       if($target)
+                       {
+                               foreach($target as $_target_section)
+                               {
+                                       foreach ($_target_section['data'] as 
$_target_entry)
+                                       {
+                                               $values[] = array
+                                               (
+                                                       'url'           => "<a 
href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
+                                                       'type'          => 
$_target_section['descr'],
+                                                       'title'         => 
$_target_entry['title'],
+                                                       'status'        => 
$_target_entry['statustext'],
+                                                       'user'          => 
$GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
+                                                       'entry_date'=> 
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               );
+                                       }
+                               }
+                       }
+
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'int', 'REQUEST', 
0);
+
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+//------ End pagination
+
+
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $out,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+               }
+
+
+
+
                /**
                * Dowloads a single file to the browser
                *
@@ -529,6 +732,7 @@
                                throw new 
Exception('uicondition_survey::_handle_files() - missing id');
                        }
                        $bofiles        = CreateObject('property.bofiles');
+
                        if(isset($_POST['file_action']) && 
is_array($_POST['file_action']))
                        {
                                
$bofiles->delete_file("/condition_survey/{$id}/", array('file_action' => 
$_POST['file_action']));
@@ -566,7 +770,7 @@
 
                public function import()
                {
-                       $id = phpgw::get_var('id', 'REQUEST', 'int');
+                       $id = phpgw::get_var('id', 'int', 'REQUEST');
                        $this->_handle_import($id);
                }
 
@@ -585,12 +789,33 @@
                                throw new 
Exception('uicondition_survey::_handle_import() - missing id');
                        }
 
-                       $step                   = phpgw::get_var('step', 
'REQUEST', 'int');
-                       $sheet_id               = phpgw::get_var('sheet_id', 
'REQUEST', 'int');
+                       $step                   = phpgw::get_var('step', 'int', 
'REQUEST');
+                       $sheet_id               = phpgw::get_var('sheet_id', 
'int', 'REQUEST');
                        
-                       $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'REQUEST', 'int');
-                       $start_line     = phpgw::get_var('start_line', 
'REQUEST', 'int', 1);
+                       $sheet_id = $sheet_id ? $sheet_id : 
phpgw::get_var('selected_sheet_id', 'int', 'REQUEST');
 
+                       if($start_line  = phpgw::get_var('start_line', 'int', 
'REQUEST'))
+                       {
+                               phpgwapi_cache::system_set('property', 
'import_sheet_start_line', $start_line);
+                       }
+                       else
+                       {
+                               $start_line = 
phpgwapi_cache::system_get('property', 'import_sheet_start_line');
+                               $start_line = $start_line  ? $start_line : 1;
+                       }
+
+
+                       if($columns = phpgw::get_var('columns'))
+                       {
+                               phpgwapi_cache::system_set('property', 
'import_sheet_columns', $columns);
+                       }
+                       else
+                       {
+                               $columns = 
phpgwapi_cache::system_get('property', 'import_sheet_columns');
+                               $columns = $columns && is_array($columns) ? 
$columns : array();
+                       }
+
+
                        if(!$cached_file = 
phpgwapi_cache::session_get('property', 'condition_survey_import_file'))
                        {
                                $file = $_FILES['import_file']['tmp_name'];
@@ -598,65 +823,101 @@
                                // save a copy to survive multiple steps
                                file_put_contents($cached_file, 
file_get_contents($file));
                                phpgwapi_cache::session_set('property', 
'condition_survey_import_file',$cached_file);
+                               $step = 1;
                        }
 
-//_debug_array($_POST);die();
-                       phpgw::import_class('phpgwapi.phpexcel');
-
-                       $objPHPExcel = PHPExcel_IOFactory::load($cached_file);
-                       $AllSheets = $objPHPExcel->getSheetNames();
-                       
-                       $sheets = array();
-                       if($AllSheets)
-                       {
-                               foreach ($AllSheets as $key => $sheet)
-                               $sheets[] = array
-                               (
-                                       'id'    => $key,
-                                       'name'  => $sheet,
-                                       'selected' => $sheet_id == $key
-                               );
-                       }
-
-
-//_debug_array($cached_file);
-//_debug_array($AllSheets);die();
-
-
-
-//                     phpgwapi_yui::tabview_setup('survey_edit_tabview');
                        $tabs = array();
                        
                        switch ($step)
                        {
                                case 0:
                                        $active_tab = 'step_1';
-                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => '#step_1');
-                                       $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => null);
-                                       $tabs['step_3'] = array('label' => 
lang('step_3'), 'link' => null);
+                                       $lang_submit = lang('continue');
+                                       $tabs['step_1'] = array('label' => 
lang('choose file'), 'link' => '#step_1');
+                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => null);
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null);
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null);
                                        break;
                                case 1:
                                        $active_tab = 'step_2';
-                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
-                                       $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => '#step_2');
-                                       $tabs['step_3'] = array('label' => 
lang('step_3'), 'link' => null);
+                                       $lang_submit = lang('continue');
+                                       $tabs['step_1'] = array('label' => 
lang('choose file'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' =>  '#step_2');
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => null);
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null);
                                        break;
                                case 2:
                                        $active_tab = 'step_3';
-                                       $tabs['step_1'] = array('label' => 
lang('step_1'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
-                                       $tabs['step_2'] = array('label' => 
lang('step_2'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 1, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
-                                       $tabs['step_3'] = array('label' => 
lang('step_3'), 'link' =>  '#step_3');
+                                       $lang_submit = lang('continue');
+                                       $tabs['step_1'] = array('label' => 
lang('choose file'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 1, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => '#step_3');
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' => null);
                                        break;
+                               case 3:
+                                       $active_tab = 'step_4';
+                                       $lang_submit = lang('import');
+                                       $tabs['step_1'] = array('label' => 
lang('choose file'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_2'] = array('label' => 
lang('choose sheet'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 1, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_3'] = array('label' => 
lang('choose start line'), 'link' => self::link(array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 2, 'sheet_id' => 
$sheet_id, 'start_line' => $start_line )));
+                                       $tabs['step_4'] = array('label' => 
lang('choose columns'), 'link' =>  '#step_4');
+                                       break;
+/*
+                               case 4://temporary
+                                       
phpgwapi_cache::session_clear('property', 'condition_survey_import_file');
+                                       unlink($cached_file);
+                                       
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction' => 
'property.uicondition_survey.import', 'id' =>$id, 'step' => 0));
+                                       break;
+*/
                        }
                        
 //-----------
 
+                       $data = array();
+                       if(!$step )
+                       {
+                               phpgwapi_cache::session_clear('property', 
'condition_survey_import_file');
+                               unlink($cached_file);
+                       }
+                       else if ($cached_file)
+                       {
+                               phpgw::import_class('phpgwapi.phpexcel');
 
-                       $objPHPExcel->setActiveSheetIndex((int)$sheet_id);
+                               try
+                               {
+                                       $objPHPExcel = 
PHPExcel_IOFactory::load($cached_file);
+                                       $AllSheets = 
$objPHPExcel->getSheetNames();
+                       
+                                       $sheets = array();
+                                       if($AllSheets)
+                                       {
+                                               foreach ($AllSheets as $key => 
$sheet)
+                                               $sheets[] = array
+                                               (
+                                                       'id'    => $key,
+                                                       'name'  => $sheet,
+                                                       'selected' => $sheet_id 
== $key
+                                               );
+                                       }
 
-                       $data = 
$objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+                                       
$objPHPExcel->setActiveSheetIndex((int)$sheet_id);
+                                       $data = 
$objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+                               }
+                               catch(Exception $e)
+                               {
+                                       if ( $e )
+                                       {
+                                               
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                               
phpgwapi_cache::session_clear('property', 'condition_survey_import_file');
+                                               unlink($cached_file);
+                                       }
+                               }
+                       }
+
+                       $survey = $this->bo->read_single( array('id' => $id,  
'view' => $mode == 'view') );
+
                        $html_table = '<table border="1">';
-                       if($data && $step == 1)
+                       if($data && $step == 2)
                        {
                                $i = 0;
                                $html_table .= "<tr><th align = 'center'>". 
lang('start'). "</th><th align='center'>" . implode("</th><th align='center'>", 
array_keys($data[1])) . '</th></tr>';
@@ -679,116 +940,118 @@
                                        $i++;
                                }
                        }                       
-                       else if($data && $step == 2)
+                       else if($data && $step == 3)
                        {
                                $_options = array
                                (
-                                       'Felt_1',
-                                       'Felt_2',
-                                       'Felt_3',
-                                       'Felt_4',
-                                       'Felt_5',
-                                       'Felt_6',
+                                       '_skip_import_'                 => 
'Utelates fra import/implisitt',
+                                       'building_part'                 => 
'bygningsdels kode',
+                                       'descr'                                 
=> 'Tilstandbeskrivelse',
+                                       'title'                                 
=> 'Tiltak',
+                                       'hjemmel'                               
=> 'Hjemmel/ krav',
+                                       'condition_degree'              => 
'Tilstandsgrad',
+                                       'condition_type'                => 
'Konsekvenstype',
+                                       'consequence'                   => 
'Konsekvensgrad',
+                                       'probability'                   => 
'Sannsynlighet',
+                                       'due_year'                              
=> 'År (innen)',
+                                       'percentage_investment' => 'Andel % 
aktivering (U)',
+                                       'amount'                                
=> 'Kalkyle netto totalt (VU)',
                                );
 
-
-               /*
-                * Create a generic select list
-                *
-                * @param string $name string with name of the submitted var 
which holds the key of the selected item form array
-                * @param array $selected key(s) of already selected item(s) 
from $options, eg. '1' or '1,2' or array with keys
-                * @param array $options items to populate the <options>
-                * @param bool $no_lang by default all values are translated by 
calls to lang(), setting this to true disbales it
-                * @param string $attribs additional html attributed to be 
applied to <select>
-                * @param int $multiple the height of the <select>, if greater 
than 1, set to 1 to just enable multiple selections
-                * @return string the populated html select element
-                */
                                phpgw::import_class('phpgwapi.sbox');
 
                                foreach($data[$start_line] as $_column => 
$_value)
                                {
-                                       $_listbox = 
phpgwapi_sbox::getArrayItem($_column, $selected= 'Felt_6', $_options, true );
-
-                                       $_checkbox = "<input id=\"start_line\" 
type =\"checkbox\" {$_checked} name=\"column\" value=\"{$_column}\">";
+                                       $selected = isset($columns[$_column]) 
&& $columns[$_column] ? $columns[$_column] : '';
+                                       
+                                       $_listbox = 
phpgwapi_sbox::getArrayItem("columns[{$_column}]", $selected, $_options, true );
                                        $html_table .= "<tr><td>[{$_column}] 
{$_value}</td><td>{$_listbox}</td><tr>";
                                }
                        }
+                       else if($data && $step == 4)
+                       {
+//                             _debug_array($columns);
 
-                       $html_table .= '</table>';
+                               $rows = count($data)+1;
 
+                               $import_data = array();
 
+                               for ($i=$start_line; $i<$rows; $i++ )
+                               {
+                                       $_result = array();
 
+                                       foreach ($columns as $_row_key => 
$_value_key)
+                                       {
+                                               if($_value_key != 
'_skip_import_')
+                                               {
+                                                       $_result[$_value_key] 
=trim($data[$i][$_row_key]);
+                                               }
+                                       
+                                       }
+                                       $import_data[] = $_result;
+                               }
+                               if($import_data)
+                               {
+                                       try
+                                       {
+                                               $this->bo->import($survey, 
$import_data);
+                                       }
+                                       catch(Exception $e)
+                                       {
+                                               if ( $e )
+                                               {
+                                                       
phpgwapi_cache::message_set($e->getMessage(), 'error'); 
+                                               }
+                                       }
+                               }
 
+//                             $msg = "'{$cached_file}' contained " . 
count($import_data) . " lines";
+//                             phpgwapi_cache::message_set($msg, 'message'); 
 
-//
-                       $values = $this->bo->read_single( array('id' => $id,  
'view' => $mode == 'view') );
+//     _debug_array($import_data);die();
+                       }
 
-                       if(isset($values['location_code']) && 
$values['location_code'])
+
+
+                       $html_table .= '</table>';
+
+
+
+
+                       if(isset($survey['location_code']) && 
$survey['location_code'])
                        {
-                               $values['location_data'] = 
execMethod('property.solocation.read_single', $values['location_code']);
+                               $survey['location_data'] = 
execMethod('property.solocation.read_single', $survey['location_code']);
                        }
 
                        $bolocation     = CreateObject('property.bolocation');
                        $location_data = $bolocation->initiate_ui_location(array
                                (
-                                       'values'        => 
$values['location_data'],
+                                       'values'        => 
$survey['location_data'],
                                        'type_id'       => 2,
                                        'lookup_type'   => 'view2',
                                        'tenant'        => false,
                                        'lookup_entity' => array(),
-                                       'entity_data'   => 
isset($values['p'])?$values['p']:''
+                                       'entity_data'   => 
isset($survey['p'])?$survey['p']:''
                                ));
-//
 
                        $data = array
                        (
-                               'survey'                                        
        => $values,
+                               'lang_submit'                                   
=> $lang_submit,
+                               'survey'                                        
        => $survey,
                                'location_data2'                                
=> $location_data,
                                'step'                                          
        => $step +1,
                                'sheet_id'                                      
        => $sheet_id,
                                'start_line'                                    
=> $start_line,
                                'html_table'                                    
=> $html_table,
                                'sheets'                                        
        => array('options' => $sheets),
-               //              'tabs'                                          
        => phpgwapi_yui::tabview_generate($tabs, $active_tab),
                                'tabs'                                          
        =>$GLOBALS['phpgw']->common->create_tabs($tabs, $active_tab),
                        );
 
-//_debug_array($data);die();
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey import');
 
                        
self::render_template_xsl(array('condition_survey_import'), $data);
 
 
-//_debug_array($html_table);
-
-return;
-
-
-                       $start = 1; // Where to start
-
-                       $fields = array_values($data[($start-1)]);
-
-                       $rows = count($data)+1;
-
-                       $result = array();
-
-                       for ($i=$start; $i<$rows; $i++ )
-                       {
-                               $_result = array();
-                               $j=0;
-                               foreach($data[$i] as $key => $value)
-                               {
-                                       $_result[$j] = trim($value);
-                                       $j++;
-                               }
-                               $result[] = $_result;
-                       }
-
-                       $msg = "'{$path}' contained " . count($result) . " 
lines";
-
-_debug_array($msg);
-_debug_array($result);die();
-
                }
 
 
@@ -863,7 +1126,7 @@
 
                public function edit_survey_title()
                {
-                       $id = phpgw::get_var('id', 'POST', 'int');
+                       $id = phpgw::get_var('id', 'int', 'GET');
 
                        if(!$this->acl_edit)
                        {

Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -198,6 +198,80 @@
                        
$fileuploader->upload("{$this->category_dir}/{$loc1}/{$id}");
                }
 
+
+               /**
+               * Function to get related via Ajax-call using api-version of yui
+               *
+               */
+               function get_related()
+               {
+                       $id     = phpgw::get_var('id', 'REQUEST', 'int');
+
+                       if( !$this->acl_read)
+                       {
+                               return;
+                       }
+               
+                       $interlink      = CreateObject('property.interlink');
+                       $target = $interlink->get_relation('property', 
$this->acl_location, $id, 'target');
+
+
+                       $values = array();
+                       if($target)
+                       {
+                               foreach($target as $_target_section)
+                               {
+                                       foreach ($_target_section['data'] as 
$_target_entry)
+                                       {
+                                               $values[] = array
+                                               (
+                                                       'url'           => "<a 
href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
+                                                       'type'          => 
$_target_section['descr'],
+                                                       'title'         => 
$_target_entry['title'],
+                                                       'status'        => 
$_target_entry['statustext'],
+                                                       'user'          => 
$GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
+                                                       'entry_date'=> 
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                               );
+                                       }
+                               }
+                       }
+
+//------ Start pagination
+
+                       $start = phpgw::get_var('startIndex', 'REQUEST', 'int', 
0);
+                       $total_records = count($values);
+
+                       $num_rows = 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) && 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int) 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;      
                
+
+                       if($allrows)
+                       {
+                               $out = $values;
+                       }
+                       else
+                       {
+                               $page = ceil( ( $start / $total_records ) * 
($total_records/ $num_rows) );
+                               $values_part = array_chunk($values, $num_rows);
+                               $out = $values_part[$page];
+                       }
+
+//------ End pagination
+
+
+                       $data = array(
+                                'ResultSet' => array(
+                                       'totalResultsAvailable' => 
$total_records,
+                                       'startIndex' => $start,
+                                       'sortKey' => 'type', 
+                                       'sortDir' => "ASC", 
+                                       'Result' => $out,
+                                       'pageSize' => $num_rows,
+                                       'activePage' => floor($start / 
$num_rows) + 1
+                               )
+                       );
+                       return $data;
+               }
+
+
                function get_files()
                {
                        $id     = phpgw::get_var('id', 'int');

Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -3248,7 +3248,7 @@
                                                unset($edateparts);
                                        }
 
-                                       $values['regtid']               = 
date($this->bocommon->datetimeformat);
+                                       $values['regtid']               = 
date($GLOBALS['phpgw']->db->datetime_format());
 
 
                                        $_receipt = array();//local errors

Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php    
2012-12-11 09:48:09 UTC (rev 10585)
@@ -46,6 +46,7 @@
                var $part_of_town_id;
                var $sub;
                var $currentapp;
+               var $nonavbar;
 
                var $public_functions = array
                        (
@@ -94,6 +95,16 @@
                        $this->building_part            = 
$this->bo->building_part;
                        $this->allrows                          = 
$this->bo->allrows;
                        $this->p_num                            = 
$this->bo->p_num;
+                       $this->condition_survey_id      = 
$this->bo->condition_survey_id;
+                       $this->nonavbar                         = 
phpgw::get_var('nonavbar', 'bool');
+
+                       if( $this->nonavbar )
+                       {
+                               $GLOBALS['phpgw_info']['flags']['nonavbar']     
        = true;
+                               $GLOBALS['phpgw_info']['flags']['noheader_xsl'] 
= true;
+                               $GLOBALS['phpgw_info']['flags']['nofooter']     
        = true;
+                               $GLOBALS['phpgw_info']['flags']['noframework']  
= true;
+                       }
                }
 
                function save_sessiondata()
@@ -226,6 +237,8 @@
                //                              'status_id'     => 
$this->status_id,
                                                'project_id'    => $project_id,
                //                              'query'         => $this->query,
+                                               'condition_survey_id'=> 
$this->condition_survey_id,
+                                               'nonavbar' => $this->nonavbar,
                                                'p_num'         => $this->p_num,
                                                'start_date'=> 
$this->start_date,
                                                'end_date'      => 
$this->end_date
@@ -242,6 +255,8 @@
                                        ."status_id:'{$this->status_id}',"
                                        ."degree_id:'{$this->degree_id}',"
                                        
."property_cat_id:'{$this->property_cat_id}',"
+                                       
."condition_survey_id:'{$this->condition_survey_id}',"
+                                       ."nonavbar:'{$this->nonavbar}',"
                                        ."district_id: '{$this->district_id}',"
                                        ."start_date:'{$this->start_date}',"
                                        ."end_date: '{$this->end_date}',"
@@ -304,6 +319,8 @@
                                                        (
                                                                'menuaction'    
        => 'property.uirequest.index',
                                                                'lookup'        
        => $lookup,
+                                                               
'condition_survey_id'=> $this->condition_survey_id,
+                                                               'nonavbar'      
                => $this->nonavbar,
                                                                
'property_cat_id'       => $this->property_cat_id,
                                                                'cat_id'        
                => $this->cat_id,
                                                                'filter'        
                => $this->filter,
@@ -881,6 +898,7 @@
                        // values for datatable
                        if(isset($datatable['rows']['row']) && 
is_array($datatable['rows']['row']))
                        {
+//_debug_array($datatable['rows']);
                                foreach( $datatable['rows']['row'] as $row )
                                {
                                        $json_row = array();
@@ -1329,7 +1347,7 @@
                                $this->cat_id = $values['cat_id'];
                        }
 
-                       $lookup_type = $mode == 'edit' ? 'form' : 'view';
+                       $lookup_type = $mode == 'edit' ? 'form2' : 'view2';
 
                        
$location_data=$this->bolocation->initiate_ui_location(array(
                                        'values'                => 
$values['location_data'],
@@ -1641,8 +1659,8 @@
                                        'value_diff'                            
                => number_format($value_diff, 0, ',', ' '),
                                        'value_diff2'                           
                => number_format($value_diff2, 0, ',', ' '),
 
-                                       'location_data'                         
                => $location_data,
-                                       'location_type'                         
                => 'form',
+                                       'location_data2'                        
                => $location_data,
+                       //              'location_type'                         
                => 'form2',
                                        'form_action'                           
                => $GLOBALS['phpgw']->link('/index.php',$link_data),
                                        'done_action'                           
                => $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uirequest.index')),
                                        'lang_save'                             
                        => lang('save'),

Modified: branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/class.uiworkorder.inc.php  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -2224,7 +2224,7 @@
                                //_debug_array($values);
                                if (!is_array($receipt['error']))
                                {
-                                       $values['regtid']               = 
date($this->bocommon->datetimeformat);
+                                       $values['regtid']               = 
date($GLOBALS['phpgw']->db->datetime_format());
 
                                        $_receipt = array();//local errors
                                        $receipt = 
$boinvoice->add_manual_invoice($values);

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
   2012-12-11 09:48:09 UTC (rev 10585)
@@ -347,7 +347,7 @@
                        $insert_values= array
                        (
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                
$this->db->db_addslashes(implode(',',(array_keys($msgbox_data))))
                        );

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/export_info_as_files.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/export_info_as_files.php  
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/export_info_as_files.php  
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -144,12 +144,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                implode(',',(array_keys($msgbox_data)))
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/forward_mail_as_sms.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/forward_mail_as_sms.php   
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/forward_mail_as_sms.php   
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -117,12 +117,12 @@
                {
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                $receipt
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: branches/Version-1_0-branch/property/inc/cron/default/import_files.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/import_files.php      
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/cron/default/import_files.php      
2012-12-11 09:48:09 UTC (rev 10585)
@@ -137,12 +137,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                implode(',',(array_keys($msgbox_data)))
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/import_from_scanner.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/import_from_scanner.php   
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/import_from_scanner.php   
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -276,12 +276,12 @@
 
                                                $insert_values= array(
                                                        $cron,
-                                                       
date($this->bocommon->datetimeformat),
+                                                       
date($this->db->datetime_format()),
                                                        $this->function_name,
                                                        
implode(',',(array_keys($msgbox_data)))
                                                        );
 
-                                               $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                                               $insert_values  = 
$this->db->validate_insert($insert_values);
 
                                                $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                                                . "VALUES 
($insert_values)";
@@ -485,7 +485,7 @@
                                                $values['loc4'],
                                                );
 
-                                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                                        $sql = "INSERT INTO fm_document 
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
                                                . 
"location_code,address,branch_id,vendor_id,user_id,loc1,loc2,loc3,loc4) "

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_antall_leieobjekt.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_antall_leieobjekt.php
        2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_antall_leieobjekt.php
        2012-12-11 09:48:09 UTC (rev 10585)
@@ -158,12 +158,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                implode(',',(array_keys($msgbox_data)))
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
       2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
       2012-12-11 09:48:09 UTC (rev 10585)
@@ -154,12 +154,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                $receipt
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/organize_drawing.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/organize_drawing.php  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/cron/default/organize_drawing.php  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -190,12 +190,12 @@
 
                                $insert_values= array(
                                        $cron,
-                                       date($this->bocommon->datetimeformat),
+                                       date($this->db->datetime_format()),
                                        $this->function_name,
                                        implode(',',(array_keys($msgbox_data)))
                                        );
 
-                               $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                               $insert_values  = 
$this->db->validate_insert($insert_values);
 
                                $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                                . "VALUES ($insert_values)";
@@ -416,7 +416,7 @@
                                                $values['loc3'],
                                                );
 
-                                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                                        $sql = "INSERT INTO fm_document 
(document_name,title,access,category,entry_date,document_date,version,coordinator,status,"
                                                . 
"location_code,address,branch_id,vendor_id,user_id,loc1,loc2,loc3) "

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/organize_energy_pdf_bbb.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/organize_energy_pdf_bbb.php
   2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/organize_energy_pdf_bbb.php
   2012-12-11 09:48:09 UTC (rev 10585)
@@ -166,7 +166,7 @@
                                $insert_values= array
                                (
                                        $cron,
-                                       date($this->bocommon->datetimeformat),
+                                       date($this->db->datetime_format()),
                                        $this->function_name,
                                        implode(',',(array_keys($msgbox_data)))
                                );

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php  
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php  
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -181,12 +181,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                $receipt
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";
@@ -265,10 +265,10 @@
                        for ($i=0; $i<count($owner_utf); $i++)
                        {
                                $sql2_utf = "INSERT INTO fm_owner 
(id,org_name,remark,category,entry_date,owner_id)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($owner_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($owner_utf[$i]) . ")";
 
                                $sql2_latin = "INSERT INTO fm_owner 
(id,org_name,remark,category,entry_date,owner_id)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($owner_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($owner_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -374,9 +374,9 @@
                        {
 
                                $sql2_utf = "INSERT INTO fm_location1 
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id,category) 
"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($objekt_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($objekt_utf[$i]) . ")";
                                $sql2_latin = "INSERT INTO fm_location1 
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id,category) 
"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($objekt_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($objekt_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -430,9 +430,9 @@
                        {
 
                                $sql2_utf = "INSERT INTO fm_location2 
(location_code, loc1, loc2, loc2_name,category) "
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($bygg_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($bygg_utf[$i]) . ")";
                                $sql2_latin = "INSERT INTO fm_location2 
(location_code, loc1, loc2, loc2_name,category) "
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($bygg_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($bygg_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -494,9 +494,9 @@
                        {
 
                                $sql2_utf = "INSERT INTO fm_location3 
(location_code, loc1, loc2, loc3, loc3_name, fellesareal,category) "
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($seksjon_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($seksjon_utf[$i]) . ")";
                                $sql2_latin = "INSERT INTO fm_location3 
(location_code, loc1, loc2, loc3, loc3_name, fellesareal,category) "
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($seksjon_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($seksjon_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -584,10 +584,10 @@
 
                                $sql2_utf = "INSERT INTO fm_location4 
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id, 
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
                       tenant_id, beregnet_boa, flyttenr)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leieobjekt_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($leieobjekt_utf[$i]) . ")";
                                $sql2_latin = "INSERT INTO fm_location4 
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id, 
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
                       tenant_id, beregnet_boa, flyttenr)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leieobjekt_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($leieobjekt_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -650,9 +650,9 @@
                                $this->db_boei->query("DELETE FROM fm_tenant 
WHERE id=" . (int)$leietaker_latin[$i]['id'],__LINE__,__FILE__);
 
                                $sql2_utf = "INSERT INTO fm_tenant (id, 
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leietaker_utf[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($leietaker_utf[$i]) . ")";
                                $sql2_latin = "INSERT INTO fm_tenant (id, 
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
-                                       . "VALUES (" . 
$this->bocommon->validate_db_insert($leietaker_latin[$i]) . ")";
+                                       . "VALUES (" . 
$this->db->validate_insert($leietaker_latin[$i]) . ")";
 
                                $this->db->query($sql2_utf,__LINE__,__FILE__);
                                
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
@@ -724,7 +724,7 @@
                                . " driftsstatus_id = '" . 
$this->db_boei->f('driftsstatus_id') . "',"
                                . " boareal = '" . $this->db_boei->f('boareal') 
. "',"
                                . " flyttenr = '" . 
$this->db_boei->f('flyttenr') . "',"
-                               . " innflyttetdato = '" . 
date($this->bocommon->dateformat,strtotime($this->db_boei->f('innflyttetdato')))
 . "'"
+                               . " innflyttetdato = '" . 
date($this->db->date_format(),strtotime($this->db_boei->f('innflyttetdato'))) . 
"'"
                                . " WHERE  loc1 = '" . 
$this->db_boei->f('objekt_id') . "'  AND  loc4= '" . 
$this->db_boei->f('leie_id') . "'";
                                $sql2_latin = " UPDATE  fm_location4 SET "
                                . " tenant_id = '" . 
$this->db_boei->f('leietaker_id') . "',"

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/update_googlemap.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/update_googlemap.php  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/cron/default/update_googlemap.php  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -124,12 +124,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                implode(',',(array_keys($msgbox_data)))
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: branches/Version-1_0-branch/property/inc/cron/default/update_phpgw.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/update_phpgw.php      
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/cron/default/update_phpgw.php      
2012-12-11 09:48:09 UTC (rev 10585)
@@ -114,12 +114,12 @@
                {
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                $receipt
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/update_workorder_status.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/update_workorder_status.php
   2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/update_workorder_status.php
   2012-12-11 09:48:09 UTC (rev 10585)
@@ -122,12 +122,12 @@
 
                        $insert_values= array(
                                $cron,
-                               date($this->bocommon->datetimeformat),
+                               date($this->db->datetime_format()),
                                $this->function_name,
                                implode(',',(array_keys($msgbox_data)))
                                );
 
-                       $insert_values  = 
$this->bocommon->validate_db_insert($insert_values);
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
 
                        $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
                                        . "VALUES ($insert_values)";

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
  2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/estimert_ferdigdato_til_leieobjekt_BBB.php
  2012-12-11 09:48:09 UTC (rev 10585)
@@ -23,7 +23,7 @@
 
                if($finnish_date >0)
                {
-                       $finnish_date = 
date($this->bocommon->dateformat,$finnish_date);
+                       $finnish_date = date($db->date_format(),$finnish_date);
                        $db->query("UPDATE fm_location4 set finnish_date = 
'$finnish_date' WHERE location_code='$location_code'",__LINE__,__FILE__);
                }
        }

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
  2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/innflyttetdato_entity_2_11_BBB.php
  2012-12-11 09:48:09 UTC (rev 10585)
@@ -22,7 +22,7 @@
                if($tenant_id == $values['extra']['tenant_id'] && 
!$innflyttetdato_old)
                {
                        $value_set['innflyttet']        = $innflyttetdato;
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = $db->validate_update($value_set);
                        $db->transaction_begin();
                        $db->query("UPDATE fm_entity_2_11 set $value_set WHERE 
id=" . (int) $receipt['id'],__LINE__,__FILE__);
                        $db->transaction_commit();

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/kalkuler_risiko_for_ros.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/kalkuler_risiko_for_ros.php
 2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/kalkuler_risiko_for_ros.php
 2012-12-11 09:48:09 UTC (rev 10585)
@@ -75,7 +75,7 @@
                                }
                        }
 
-                       $value_set      = 
$this->bocommon->validate_db_update($value_set);
+                       $value_set      = $db->validate_update($value_set);
                        $db->transaction_begin();
                        $db->query("UPDATE fm_entity_2_6 set $value_set WHERE 
id=" . (int)$receipt['id'],__LINE__,__FILE__);
                        $db->transaction_commit();

Modified: branches/Version-1_0-branch/property/inc/export/default/Agresso
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Agresso     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/export/default/Agresso     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -286,15 +286,15 @@
                                $BilagOverf['item_id'],
                                );
                        
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
                        . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
                        . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
                        . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
                        . " values ($values,"
-                       . $this->bocommon->moneyformat($BilagOverf['belop']) . 
","
-                       . 
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
+                       . $this->db->money_format($BilagOverf['belop']) . ","
+                       . $this->db->money_format($BilagOverf['godkjentbelop']) 
. ")";
 
                        $this->db->query($sql,__LINE__,__FILE__);
                }

Modified: branches/Version-1_0-branch/property/inc/export/default/Ecolink
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Ecolink     
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/export/default/Ecolink     
2012-12-11 09:48:09 UTC (rev 10585)
@@ -222,15 +222,15 @@
                                $BilagOverf['utbetalingsigndato'],
                                );
                        
-                       $values = $this->bocommon->validate_db_insert($values);
+                       $values = $this->db->validate_insert($values);
 
                        $sql= "INSERT INTO fm_ecobilag 
(pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
                        . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
                        . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
                        . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,belop,godkjentbelop)"
                        . " values ($values,"
-                       . $this->bocommon->moneyformat($BilagOverf['belop']) . 
","
-                       . 
$this->bocommon->moneyformat($BilagOverf['godkjentbelop']) . ")";
+                       . $this->db->money_format($BilagOverf['belop']) . ","
+                       . $this->db->money_format($BilagOverf['godkjentbelop']) 
. ")";
 
                        $this->db->query($sql,__LINE__,__FILE__);
                }

Modified: branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK      
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK      
2012-12-11 09:48:09 UTC (rev 10585)
@@ -96,13 +96,10 @@
 
                function import_conv()
                {
-
-                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
-                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
-                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->dateformat       = $this->bocommon->dateformat;
-                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->soXport          = 
CreateObject('property.soXport');     
+                       $this->invoice          = 
CreateObject('property.boinvoice');
+                       $this->dateformat       = 
$GLOBALS['phpgw']->db->date_format();
+                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
                        $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
                        $this->config = 
CreateObject('phpgwapi.config','property');
                        $this->config->read_repository();
@@ -320,4 +317,3 @@
                        return $receipt;
                }
        }
-?>

Modified: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner   
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner   
2012-12-11 09:48:09 UTC (rev 10585)
@@ -65,13 +65,10 @@
 
                function import_conv()
                {
-                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
-                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
-                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->dateformat       = $this->bocommon->dateformat;
-                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
-                       
+                       $this->soXport                  = 
CreateObject('property.soXport');     
+                       $this->invoice                  = 
CreateObject('property.boinvoice');
+                       $this->dateformat               = 
$GLOBALS['phpgw']->db->date_format();
+                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
                }
 
                function import($invoice_common,$download)

Modified: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner_xml
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner_xml   
    2012-12-11 09:45:51 UTC (rev 10584)
+++ 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner_xml   
    2012-12-11 09:48:09 UTC (rev 10585)
@@ -62,12 +62,10 @@
 
                function import_conv()
                {
-                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
-                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');
-                       $this->bocommon         = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->dateformat       = $this->bocommon->dateformat;
-                       $this->datetimeformat   = 
$this->bocommon->datetimeformat;
+                       $this->soXport          = 
CreateObject('property.soXport');     
+                       $this->invoice          = 
CreateObject('property.boinvoice');
+                       $this->dateformat       = 
$GLOBALS['phpgw']->db->date_format();
+                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
                }
 
                function import($invoice_common,$download)

Modified: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service  
2012-12-11 09:45:51 UTC (rev 10584)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service  
2012-12-11 09:48:09 UTC (rev 10585)
@@ -58,14 +58,12 @@
 
                function import_conv()
                {
-       //              $this->db               = $GLOBALS['phpgw']->db;
-                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
-                       $this->invoice          = 
CreateObject($this->currentapp.'.boinvoice');

@@ Diff output truncated at 153600 characters. @@



reply via email to

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