fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14231] Merge 14019:14230 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [14231] Merge 14019:14230 from trunk
Date: Thu, 22 Oct 2015 16:43:20 +0000

Revision: 14231
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14231
Author:   sigurdne
Date:     2015-10-22 16:43:19 +0000 (Thu, 22 Oct 2015)
Log Message:
-----------
Merge 14019:14230 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/booking/inc/class.uiapplication_settings.inc.php
    branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
    branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/booking/inc/class.uievent_mail_settings.inc.php
    branches/Version-1_0-branch/booking/inc/class.uigroup.inc.php
    branches/Version-1_0-branch/booking/inc/class.uimail_settings.inc.php
    branches/Version-1_0-branch/booking/inc/class.uimetasettings.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiorganization.inc.php
    branches/Version-1_0-branch/booking/inc/class.uiresource.inc.php
    branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
    branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
    branches/Version-1_0-branch/controller/js/controller/case.js
    branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
    
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
    branches/Version-1_0-branch/controller/templates/base/config.tpl
    branches/Version-1_0-branch/controller/templates/base/css/base.css
    branches/Version-1_0-branch/property/inc/class.botts.inc.php
    branches/Version-1_0-branch/property/inc/class.sotts.inc.php
    branches/Version-1_0-branch/property/inc/class.uitts.inc.php

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


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038,12040-12042,12044-12045,12047,12049-12052,12054,12056-12063,12065-12073,12075-12086,12088-12092,12094-12095,12097,12099-12102,12104,12106-12107,12109-12182,12184-12201,12203-12210,12212-12231,12233-12239,12241-12248,12250-12328,12330-12363,12365-12384,12386-12397,12399-12401,12403-12434,12436-12455,12457,12459-12461,12463-12465,12467,12469-12477,12479-12518,12520-12527,12529-12532,12534-12595,12597-12601,12603-12655,12657-12670,12672-12683,12685-12686,12688-12707,12709-12730,12732-12750,12752-12755,12757,12759-12761,12763-12819,12821,12823,12825-12890,12892-12896,12898,12900-12913,12915-13060,13062-13142,13144,13146-13331,13333-13338,13340-13347,13349-13365,13367-13381,13383,13385,13387-13391,13393-13401,13403,13405-13416,13418-13431,13433-13434,13436,13438-13440,13442-13480,13482-13506,13509-13540,13545-13551,13553,13555-13564,13566-13570,13572,13574-13590,13601,13603-13701,13703-13709,13711-13713,13715,13717,13719-13723,13725,13727-13728,13730-13732,13734-13735,13737-13744,13746,13748-13772,13774-13775,13777-13781,13783-13797,13799,13801-13806,13808-13810,13812,13814-13835,13837-13840,13842,13844-13855,13857-13879,13881-13930,13932-13934,13936-13938,13940-13980,13982,13984-14018
   + /branches/dev-syncromind:13653
/branches/stavangerkommune:12743-12875,12986
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038,12040-12042,12044-12045,12047,12049-12052,12054,12056-12063,12065-12073,12075-12086,12088-12092,12094-12095,12097,12099-12102,12104,12106-12107,12109-12182,12184-12201,12203-12210,12212-12231,12233-12239,12241-12248,12250-12328,12330-12363,12365-12384,12386-12397,12399-12401,12403-12434,12436-12455,12457,12459-12461,12463-12465,12467,12469-12477,12479-12518,12520-12527,12529-12532,12534-12595,12597-12601,12603-12655,12657-12670,12672-12683,12685-12686,12688-12707,12709-12730,12732-12750,12752-12755,12757,12759-12761,12763-12819,12821,12823,12825-12890,12892-12896,12898,12900-12913,12915-13060,13062-13142,13144,13146-13331,13333-13338,13340-13347,13349-13365,13367-13381,13383,13385,13387-13391,13393-13401,13403,13405-13416,13418-13431,13433-13434,13436,13438-13440,13442-13480,13482-13506,13509-13540,13545-13551,13553,13555-13564,13566-13570,13572,13574-13590,13601,13603-13701,13703-13709,13711-13713,13715,13717,13719-13723,13725,13727-13728,13730-13732,13734-13735,13737-13744,13746,13748-13772,13774-13775,13777-13781,13783-13797,13799,13801-13806,13808-13810,13812,13814-13835,13837-13840,13842,13844-13855,13857-13879,13881-13930,13932-13934,13936-13938,13940-13980,13982,13984-14018,14020-14230


Property changes on: branches/Version-1_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038,12040-12042,12044-12045,12047,12049-12052,12054,12056-12063,12065-12073,12075-12086,12088-12092,12094-12095,12097,12099-12102,12104,12106-12107,12109-12182,12184-12201,12203-12210,12212-12231,12233-12239,12241-12248,12250-12328,12330-12363,12365-12384,12386-12397,12399-12401,12403-12434,12436-12455,12457,12459-12461,12463-12465,12467,12469-12477,12479-12518,12520-12527,12529-12532,12534-12595,12597-12601,12603-12655,12657-12670,12672-12683,12685-12686,12688-12707,12709-12730,12732-12750,12752-12755,12757,12759-12761,12763-12819,12821,12823,12825-12890,12892-12896,12898,12900-12913,12915-13060,13333-13338,13442-13480,13783-13797,13814-13835,13932-13934,13940-13980
   + /branches/stavangerkommune/booking:9468-12740,12743-12875,12986
/trunk/booking:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038,12040-12042,12044-12045,12047,12049-12052,12054,12056-12063,12065-12073,12075-12086,12088-12092,12094-12095,12097,12099-12102,12104,12106-12107,12109-12182,12184-12201,12203-12210,12212-12231,12233-12239,12241-12248,12250-12328,12330-12363,12365-12384,12386-12397,12399-12401,12403-12434,12436-12455,12457,12459-12461,12463-12465,12467,12469-12477,12479-12518,12520-12527,12529-12532,12534-12595,12597-12601,12603-12655,12657-12670,12672-12683,12685-12686,12688-12707,12709-12730,12732-12750,12752-12755,12757,12759-12761,12763-12819,12821,12823,12825-12890,12892-12896,12898,12900-12913,12915-13060,13333-13338,13442-13480,13783-13797,13814-13835,13932-13934,13940-13980,14020-14230

Modified: 
branches/Version-1_0-branch/booking/inc/class.uiapplication_settings.inc.php
===================================================================
--- 
branches/Version-1_0-branch/booking/inc/class.uiapplication_settings.inc.php    
    2015-10-22 16:30:22 UTC (rev 14230)
+++ 
branches/Version-1_0-branch/booking/inc/class.uiapplication_settings.inc.php    
    2015-10-22 16:43:19 UTC (rev 14231)
@@ -25,7 +25,7 @@
                                {
                                        if (strlen(trim($value)) > 0)
                                        {
-                                               $config->value($dim, 
trim($value));
+                                               $config->value($dim, 
phpgw::clean_value($value));
                                        }
                                        else
                                        {

Modified: branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php    
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uibuilding.inc.php    
2015-10-22 16:43:19 UTC (rev 14231)
@@ -27,7 +27,31 @@
                        $this->bo = CreateObject('booking.bobuilding');
             $this->bo_booking = CreateObject('booking.bobooking');
                        self::set_active_menu('booking::buildings');
-                       $this->fields = array('name', 'homepage', 
'description', 'email', 'tilsyn_name', 'tilsyn_email', 'tilsyn_phone', 
'tilsyn_name2', 'tilsyn_email2', 'tilsyn_phone2', 'street', 'zip_code', 'city', 
'district', 'phone', 'active', 
'location_code','deactivate_application','deactivate_calendar','deactivate_sendmessage','extra_kalendar','calendar_text');
+                       $this->fields = array
+                       (
+                               'name'                                          
=> 'string',
+                               'homepage'                                      
=> 'url',
+                               'description'                           => 
'html',
+                               'email'                                         
=> 'email',
+                               'tilsyn_name'                           => 
'string',
+                               'tilsyn_email'                          => 
'email',
+                               'tilsyn_phone'                          => 
'string',
+                               'tilsyn_name2'                          => 
'string',
+                               'tilsyn_email2'                         => 
'email',
+                               'tilsyn_phone2'                         => 
'string',
+                               'street'                                        
=> 'string',
+                               'zip_code'                                      
=> 'string',
+                               'city'                                          
=> 'string',
+                               'district'                                      
=> 'string',
+                               'phone'                                         
=> 'string',
+                               'active'                                        
=> 'int',
+                               'location_code'                         => 
'string',
+                               'deactivate_application'        => 'int',
+                               'deactivate_calendar'           => 'int',
+                               'deactivate_sendmessage'        => 'int',
+                               'extra_kalendar'                        => 
'string',
+                               'calendar_text'                         => 
'string',
+                       );
                }
                
                public function properties()

Modified: branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php      
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uicommon.inc.php      
2015-10-22 16:43:19 UTC (rev 14231)
@@ -19,16 +19,79 @@
                );
                
                $options = array_merge($default_options, $options);
-               
                $result = array();
-               foreach($keys as $write_key)
+
+               $isIndexed = array_values($keys) === $keys;
+               if($isIndexed)
                {
-                       $array_key = 
$options['prefix'].$write_key.$options['suffix'];
-                       if(isset($array[$array_key]))
+                       foreach($keys as $write_key)
                        {
-                               $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key]);
+                               $array_key = 
$options['prefix'].$write_key.$options['suffix'];
+                               if(isset($array[$array_key]))
+                               {
+                                       $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key]);
+                               }
+
                        }
                }
+               else
+               {
+                       foreach($keys as $write_key => $type)
+                       {
+                               switch($type)
+                               {
+                                       case 'string':
+                                       default:
+                                               $_type = 'string';
+                                               break;
+                                       case 'bool':
+                                       case 'boolean':
+                                               $_type = 'bool';
+                                               break;
+                                       case 'int':
+                                       case 'integer':
+                                       case 'number':
+                                               $_type = 'int';
+                                               break;
+                                       case 'float':
+                                       case 'double':
+                                               $_type = 'float';
+                                               break;
+                                               /* Specific string types */
+                                       case 'color':
+                                               $_type = 'color';
+                                               break;
+                                       case 'email':
+                                               $_type = 'email';
+                                               break;
+                                       case 'filename':
+                                               $_type = 'filename';
+                                               break;
+                                       case 'ip':
+                                               $_type = 'ip';
+                                               break;
+                                       case 'location':
+                                               $_type = 'location';
+                                               break;
+                                       case 'url':
+                                               $_type = 'url';
+                                               break;
+                                       /* only use this if you really know 
what you are doing */
+                                       case 'raw':
+                                               $_type = 'raw';
+                                               break;
+                                       case 'html':
+                                               $_type = 'html';
+                                               break;
+                               }
+                               $array_key = 
$options['prefix'].$write_key.$options['suffix'];
+                               if(isset($array[$array_key]))
+                               {
+                                       $result[($options['preserve_prefix'] ? 
$options['prefix'] : '').$write_key.($options['preserve_suffix'] ? 
$options['suffix'] : '')] = phpgw::clean_value($array[$array_key],$_type);
+                               }
+                       }
+               }
+               
                return $result;
        }
        

Modified: 
branches/Version-1_0-branch/booking/inc/class.uievent_mail_settings.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uievent_mail_settings.inc.php 
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uievent_mail_settings.inc.php 
2015-10-22 16:43:19 UTC (rev 14231)
@@ -25,7 +25,7 @@
                                {
                                        if (strlen(trim($value)) > 0)
                                        {
-                                               $config->value($dim, 
trim($value));
+                                               $config->value($dim, 
phpgw::clean_value($value));
                                        }
                                        else
                                        {

Modified: branches/Version-1_0-branch/booking/inc/class.uigroup.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uigroup.inc.php       
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uigroup.inc.php       
2015-10-22 16:43:19 UTC (rev 14231)
@@ -242,7 +242,17 @@
                        $errors = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
-                               $group = array_merge($group, 
extract_values($_POST, array('name', 'shortname', 'organization_id', 
'organization_name', 'description', 'contacts', 'active', 'activity_id', 
'show_in_portal')));
+                               $group = array_merge($group, 
extract_values($_POST, array(
+                                       'name'                          => 
'string',
+                                       'shortname'                     => 
'string',
+                                       'organization_id'       => 'string',
+                                       'organization_name'     => 'string',
+                                       'description'           => 'html',
+                                       'contacts'                      => 
'string',
+                                       'active'                        => 
'int',
+                                       'activity_id'           => 'int',
+                                       'show_in_portal'        => 'int',
+                                       )));
                                if (!isset($group["active"]))
                                {
                                        $group['active'] = '1';

Modified: branches/Version-1_0-branch/booking/inc/class.uimail_settings.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uimail_settings.inc.php       
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uimail_settings.inc.php       
2015-10-22 16:43:19 UTC (rev 14231)
@@ -25,7 +25,7 @@
                                {
                                        if (strlen(trim($value)) > 0)
                                        {
-                                               $config->value($dim, 
trim($value));
+                                               $config->value($dim, 
phpgw::clean_value($value));
                                        }
                                        else
                                        {

Modified: branches/Version-1_0-branch/booking/inc/class.uimetasettings.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uimetasettings.inc.php        
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uimetasettings.inc.php        
2015-10-22 16:43:19 UTC (rev 14231)
@@ -25,7 +25,7 @@
                                {
                                        if (strlen(trim($value)) > 0)
                                        {
-                                               $config->value($dim, 
trim($value));
+                                               $config->value($dim, 
phpgw::clean_value($value));
                                        }
                                        else
                                        {

Modified: branches/Version-1_0-branch/booking/inc/class.uiorganization.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiorganization.inc.php        
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uiorganization.inc.php        
2015-10-22 16:43:19 UTC (rev 14231)
@@ -29,13 +29,26 @@
                        
                        self::set_active_menu('booking::organizations');
                        $this->module = "booking";
-                       $this->fields = array('name', 'shortname', 'homepage', 
'phone', 'email', 
-                                                                 'street', 
'zip_code', 'city', 'district', 
-                                                                 
'description', 'contacts', 'active', 
-                                                                 
'organization_number', 'activity_id',
-                                                                 
'customer_number', 'customer_internal', 'show_in_portal');
-                                                               
-                       
+                       $this->fields = array(
+                               'name'                                  => 
'string',
+                               'shortname'                             => 
'string',
+                               'homepage'                              => 
'url',
+                               'phone'                                 => 
'string',
+                               'email'                                 => 
'email',
+                               'street'                                => 
'string',
+                               'zip_code'                              => 
'string',
+                               'city'                                  => 
'string',
+                               'district'                              => 
'string',
+                               'description'                   => 'html',
+                               'contacts'                              => 
'string',
+                               'active'                                => 
'int',
+                               'organization_number'   => 'string',
+                               'activity_id'                   => 'int',
+                               'customer_number'               => 'string',
+                               'customer_internal'             => 'int',
+                               'show_in_portal'                => 'int',
+                               );
+
                }
                
                public function building_users() {

Modified: branches/Version-1_0-branch/booking/inc/class.uiresource.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uiresource.inc.php    
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uiresource.inc.php    
2015-10-22 16:43:19 UTC (rev 14231)
@@ -23,7 +23,17 @@
                        
                        $this->bo = CreateObject('booking.boresource');
                        $this->activity_bo = CreateObject('booking.boactivity');
-                       $this->fields = array('name', 'building_id', 
'building_name','description','activity_id', 'active', 'type', 'sort', 
'organizations_ids');
+                       $this->fields = array(
+                                       'name'                                  
=> 'string',
+                                       'building_id'                   => 
'string',
+                                       'building_name'                 => 
'string',
+                                       'description'                   => 
'html',
+                                       'activity_id'                   => 
'int',
+                                       'active'                                
=> 'int',
+                                       'type'                                  
=> 'string',
+                                       'sort'                                  
=> 'string',
+                                       'organizations_ids'             => 
'string',
+                               );
                        self::set_active_menu('booking::resources');
                }
                

Modified: branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php      
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/booking/inc/class.uisystem_message.inc.php      
2015-10-22 16:43:19 UTC (rev 14231)
@@ -247,7 +247,9 @@
                        $errors = array();
                        if($_SERVER['REQUEST_METHOD'] == 'POST')
                        {
-                               $system_message = array_merge($system_message, 
extract_values($_POST, array('time', 'title', 'message')));
+                               $system_message = array_merge($system_message, 
extract_values($_POST, array(
+                                       'name' => 'string', 'time' => 'string', 
'title' => 'string', 'message' => 'html', 'phone' => 'string', 'email' => 
'email')
+                               ));
                                if (!isset($system_message["Status"]))
                                {
                                        $system_message['status'] = 'NEW';

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2015-10-22 16:43:19 UTC (rev 14231)
@@ -316,8 +316,8 @@
                        
                        $sql .= "AND ((c.start_date <= $to_date AND c.end_date 
IS NULL) ";
                        $sql .= "OR (c.start_date <= $to_date AND c.end_date > 
$from_date ))";
-                       
 
+
                        $this->db->query($sql);
 
                        while($this->db->next_record())

Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php     
2015-10-22 16:43:19 UTC (rev 14231)
@@ -300,6 +300,17 @@
 
                function add_case()
                {
+                        $config        = 
CreateObject('phpgwapi.config','controller');
+                        $config->read();
+                        $mandatory_location = 
$config->config_data['control_mandatory_location'];
+                        if($mandatory_location && $mandatory_location == 1)
+                                               {
+                            $mandatory_location = true;
+                                               }
+                        else
+                                               {
+                            $mandatory_location = false;
+                                               }
                        $case_data = $this->_get_case_data();
                        $check_list = $case_data['check_list'];
 
@@ -321,6 +332,8 @@
                                'location_level'                                
        => $level,
                                'current_year'                                  
        => $year,
                                'current_month_nr'                              
        => $month,
+                                'mandatory_location'                           
         => $mandatory_location,
+                                'location_required'                            
         => $mandatory_location,
                                'cases_view'                                    
        => 'add_case',
                        );
                        

Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php       
2015-10-22 16:43:19 UTC (rev 14231)
@@ -1,1578 +1,1578 @@
-<?php
-
-       /**
-        * phpGroupWare - controller: a part of a Facilities Management System.
-        *
-        * @author Erik Holm-Larsen <address@hidden>
-        * @author Torstein Vadla <address@hidden>
-        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
-        * This file is part of phpGroupWare.
-        *
-        * phpGroupWare is free software; you can redistribute it and/or modify
-        * it under the terms of the GNU General Public License as published by
-        * the Free Software Foundation; either version 2 of the License, or
-        * (at your option) any later version.
-        *
-        * phpGroupWare is distributed in the hope that it will be useful,
-        * but WITHOUT ANY WARRANTY; without even the implied warranty of
-        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-        * GNU General Public License for more details.
-        *
-        * You should have received a copy of the GNU General Public License
-        * along with phpGroupWare; if not, write to the Free Software
-        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
-        *
-        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
-        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
-        * @package property
-        * @subpackage controller
-        * @version $Id$
-        */
-       /**
-        * Import the jQuery class
-        */
-       phpgw::import_class('phpgwapi.jquery');
-
-       /**
-        * Import the yui class
-        */
-       phpgw::import_class('phpgwapi.yui');
-       phpgw::import_class('phpgwapi.uicommon');
-       phpgw::import_class('controller.socheck_list');
-       phpgw::import_class('phpgwapi.datetime');
-
-       include_class('controller', 'check_list', 'inc/model/');
-       include_class('controller', 'check_item', 'inc/model/');
-       include_class('controller', 'date_generator', 'inc/component/');
-       include_class('controller', 'date_converter', 'inc/helper/');
-       include_class('controller', 'location_finder', 'inc/helper/');
-
-       class controller_uicheck_list extends phpgwapi_uicommon
-       {
-               protected $so;
-               protected $so_control;
-               protected $so_control_item;
-               protected $so_check_item;
-               protected $so_procedure;
-               protected $so_control_group_list;
-               protected $so_control_group;
-               protected $so_control_item_list;
-               protected $location_finder;
-
-               private $read;
-               private $add;
-               private $edit;
-               private $delete;
-               private $acl_location;
-
-               var $public_functions = array(
-                       'index' => true,
-                       'add_check_list' => true,
-                       'save_check_list' => true,
-                       'edit_check_list' => true,
-                       'print_check_list' => true,
-                       'view_control_info' => true,
-                       'view_control_details' => true,
-                       'view_control_items' => true,
-                       'get_check_list_info' => true,
-                       'get_cases_for_check_list' => true,
-                       'update_status' => true
-               );
-
-               function __construct()
-               {
-                       parent::__construct();
-
-                       $this->so_control = 
CreateObject('controller.socontrol');
-                       $this->so = CreateObject('controller.socheck_list');
-                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
-                       $this->so_check_item = 
CreateObject('controller.socheck_item');
-                       $this->so_procedure = 
CreateObject('controller.soprocedure');
-                       $this->so_control_group_list = 
CreateObject('controller.socontrol_group_list');
-                       $this->so_control_group = 
CreateObject('controller.socontrol_group');
-                       $this->so_control_item_list = 
CreateObject('controller.socontrol_item_list');
-                       $this->so_case  = CreateObject('controller.socase');
-                       $this->location_finder = new location_finder();
-
-                       $this->acl_location = '.checklist';
-
-                       $this->read     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1 
-                       $this->add       = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2 
-                       $this->edit     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_EDIT, 'controller');//4 
-                       $this->delete  = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_DELETE, 'controller');//8 
-
-                       
self::set_active_menu('controller::control::check_list');
-
-                       if(phpgw::get_var('noframework', 'bool'))
-                       {
-                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
-                               
phpgwapi_cache::session_set('controller','noframework',true);
-                       }
-                       else if 
(phpgwapi_cache::session_get('controller','noframework'))
-                       {
-                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
-                       }
-               }
-
-               /**
-                * Public function for displaying checklists  
-                * 
-                * @param HTTP:: phpgw_return_as
-                * @return data array
-                */
-               public function index()
-               {
-                       if(phpgw::get_var('phpgw_return_as') == 'json')
-                       {
-                               return $this->query();
-                       }
-                       self::add_javascript('phpgwapi', 'yahoo', 
'datatable.js');
-                       phpgwapi_yui::load_widget('datatable');
-                       phpgwapi_yui::load_widget('paginator');
-
-                       $data = array(
-                               'datatable_name' => 'Sjekkliste (Ikke i bruk)',
-                               'form' => array(
-                                       'toolbar' => array(
-                                               'item' => array(
-                                                       array('type' => 
'filter',
-                                                               'name' => 
'status',
-                                                               'text' => 
lang('Status'),
-                                                               'list' => array(
-                                                                       array(
-                                                                               
'id' => 'none',
-                                                                               
'name' => lang('Not selected')
-                                                                       ),
-                                                                       array(
-                                                                               
'id' => 'NEW',
-                                                                               
'name' => lang('NEW')
-                                                                       ),
-                                                                       array(
-                                                                               
'id' => 'PENDING',
-                                                                               
'name' => lang('PENDING')
-                                                                       ),
-                                                                       array(
-                                                                               
'id' => 'REJECTED',
-                                                                               
'name' => lang('REJECTED')
-                                                                       ),
-                                                                       array(
-                                                                               
'id' => 'ACCEPTED',
-                                                                               
'name' => lang('ACCEPTED')
-                                                                       )
-                                                               )
-                                                       ),
-                                                       array('type' => 'text',
-                                                               'text' => 
lang('searchfield'),
-                                                               'name' => 
'query'
-                                                       ),
-                                                       array(
-                                                               'type' => 
'submit',
-                                                               'name' => 
'search',
-                                                               'value' => 
lang('Search')
-                                                       ),
-                                               ),
-                                       ),
-                               ),
-                               'datatable' => array(
-                                       'source' => 
self::link(array('menuaction' => 'controller.uicheck_list.index', 
'phpgw_return_as' => 'json')),
-                                       'field' => array(
-                                               array(
-                                                       'key' => 'id',
-                                                       'label' => lang('ID'),
-                                                       'sortable' => true,
-                                                       'formatter' => 
'YAHOO.portico.formatLink'
-                                               ),
-                                               array(
-                                                       'key' => 'title',
-                                                       'label' => 
lang('Control title'),
-                                                       'sortable' => false
-                                               ),
-                                               array(
-                                                       'key' => 'start_date',
-                                                       'label' => 
lang('start_date'),
-                                                       'sortable' => false
-                                               ),
-                                               array(
-                                                       'key' => 'planned_date',
-                                                       'label' => 
lang('planned_date'),
-                                                       'sortable' => false
-                                               ),
-                                               array(
-                                                       'key' => 'end_date',
-                                                       'label' => 
lang('end_date'),
-                                                       'sortable' => false
-                                               ),
-                                               array(
-                                                       'key' => 'link',
-                                                       'hidden' => true
-                                               )
-                                       )
-                               ),
-                       );
-
-                       self::render_template_xsl('datatable_common', $data);
-               }
-
-               /**
-                * Public function for displaying the add check list form
-                * 
-                * @param HTTP:: location code, control id, date
-                * @return data array
-                */
-               function add_check_list($check_list = null)
-               {
-                       if($check_list == null)
-                       {
-                               $type = phpgw::get_var('type');
-                               $control_id = phpgw::get_var('control_id');
-                               $deadline_ts = phpgw::get_var('deadline_ts');
-                               $deadline_current = 
phpgw::get_var('deadline_current', 'bool');
-                               $serie_id = phpgw::get_var('serie_id', 'int');
-
-                               if($deadline_current)
-                               {
-                                       $year = date('Y');
-                                       $month = date('m');
-                                       $a_date = "{$year}-{$month}-23";
-                                       $deadline_ts    = mktime(00, 00, 00, 
$month, date('t', strtotime($a_date)), $year);
-                                       unset($year);
-                                       unset($month);
-                                       unset($a_date);
-
-                                       /*look for checklist with $deadline_ts 
= $deadline_current*/
-
-                                       $check_list_id = 
$this->so_control->get_check_list_id_for_deadline($serie_id, $deadline_ts);
-                                       if($check_list_id)
-                                       {
-                                               
$this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-                                       }
-                               }
-
-                               $check_list = new controller_check_list();
-                               $check_list->set_control_id($control_id);
-                               $check_list->set_deadline($deadline_ts);
-                       }
-                       else
-                       {
-                               if($check_list->get_component_id() > 0)
-                               {
-                                       $type = "component";
-                               }
-                               else
-                               {
-                                       $type = "location";
-                               }
-                       }
-
-                       if(!$location_code = $check_list->get_location_code())
-                       {
-                               $location_code = 
phpgw::get_var('location_code');
-                               $check_list->set_location_code($location_code);
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
-                               $level = 
$this->location_finder->get_location_level($location_code);
-                       }
-
-
-                       if($type == "component")
-                       {
-                               if($check_list != null)
-                               {
-                                       $location_id = 
phpgw::get_var('location_id');
-                                       
$check_list->set_location_id($location_id);
-                                       $component_id = 
phpgw::get_var('component_id');
-                                       
$check_list->set_component_id($component_id);
-                               }
-
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-
-                               $location_code = 
$component_arr['location_code'];
-
-                               $check_list->set_location_code($location_code);
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
-                               $level = 
$this->location_finder->get_location_level($location_code);
-
-                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
-
-                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-
-                               $component = new controller_component();
-                               $component->set_id($component_id);
-                               $component->set_location_id($location_id);
-                               
$component->set_location_code($component_arr['location_code']);
-                               $component->set_xml_short_desc($short_desc);
-
-                               $component_array = $component->toArray();
-                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
-
-                               $type = "component";
-                       }
-                       else
-                       {
-                               $type = "location";
-                       }
-
-                       $repeat_descr = '';
-                       if($serie = $this->so_control->get_serie($serie_id))
-                       {
-                               $repeat_type_array = array
-                                       (
-                                               "0"=> lang('day'),
-                                               "1"=> lang('week'),
-                                               "2"=> lang('month'),
-                                               "3"=> lang('year')
-                                       );
-                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
-                       }
-
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-
-                       if($repeat_descr)
-                       {
-                               $repeat_descr .= " :: " .$control->get_title();
-                               $control->set_title($repeat_descr);
-                       }
-
-                       if(!$responsible_user_id = 
phpgw::get_var('assigned_to', 'int'))
-                       {
-                               $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
-                                       array
-                                       (
-                                               'responsibility_id' => 
$control->get_responsibility_id(),
-                                               'location_code' => 
$location_code
-                                       )
-                               );
-                       }
-
-                       $year = date("Y", $deadline_ts);
-                       $month_nr = date("n", $deadline_ts);
-
-                       $level = 
$this->location_finder->get_location_level($location_code);
-                       $user_role = true;
-
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
-
-                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
-
-                       $user_list_options = array();
-                       foreach ($users as $user)
-                       {
-                               $user_list_options[] = array
-                               (
-                                       'id' => $user['account_id'],
-                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
-                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
-                               );
-                       }
-
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-
-                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
-                       $request_ical_event = 
isset($config->config_data['request_ical_event']) && 
$config->config_data['request_ical_event'] ? 
$config->config_data['request_ical_event'] : false;
-
-                       $data = array
-                       (
-                               'user_list' => array('options' => 
$user_list_options),
-                               'location_array' => $location_array,
-                               'component_array' => $component_array,
-                               'control' => $control,
-                               'check_list' => $check_list,
-                               'buildings_on_property' => 
$buildings_on_property,
-                               'type' => $type,
-                               'current_year' => $year,
-                               'current_month_nr' => $month_nr,
-                               'building_location_code' => 
$building_location_code,
-                               'location_level' => $level,
-                               'check_list_type' => 'add_check_list',
-                               'serie_id'                      => $serie_id,
-                               'required_actual_hours' => 
$required_actual_hours,
-                               'integration'                   => 
$this->_get_component_integration($location_id, $component_arr),
-                               'request_ical_event'    => $request_ical_event
-
-                       );
-
-                       $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
-                       
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
-
-                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
-                       self::add_javascript('controller', 'controller', 
'ajax.js');
-                       self::add_javascript('controller', 'controller', 
'check_list.js');
-
-                       
self::render_template_xsl(array('check_list/add_check_list', 
'check_list/fragments/nav_control_plan',
-                               'check_list/fragments/check_list_top_section', 
'check_list/fragments/add_check_list_menu',
-                               
'check_list/fragments/select_buildings_on_property'), $data);
-               }
-
-               /**
-                * Public function for displaying the edit check list form  
-                * 
-                * @param HTTP:: check list id
-                * @return data array
-                */
-               function edit_check_list($check_list = null)
-               {
-                       if($check_list == null)
-                       {
-                               $check_list_id = 
phpgw::get_var('check_list_id');
-                               $check_list = 
$this->so->get_single($check_list_id);
-                       }
-
-                       $repeat_descr = '';
-                       if($serie = 
$this->so_control->get_serie($check_list->get_serie_id()))
-                       {
-                               $repeat_type_array = array
-                                       (
-                                               "0"=> lang('day'),
-                                               "1"=> lang('week'),
-                                               "2"=> lang('month'),
-                                               "3"=> lang('year')
-                                       );
-                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
-                       }
-
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-
-                       if($repeat_descr)
-                       {
-                               $repeat_descr .= " :: " .$control->get_title();
-                               $control->set_title($repeat_descr);
-                       }
-
-                       $component_id = $check_list->get_component_id();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_id = $check_list->get_component_id();
-
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
-
-                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-
-                               $component = new controller_component();
-                               $component->set_id($component_id);
-                               $component->set_location_id($location_id);
-                               
$component->set_location_code($component_arr['location_code']);
-                               $component->set_xml_short_desc($short_desc);
-                               $component_array = $component->toArray();
-
-                               $type = 'component';
-                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
-                       }
-                       else
-                       {
-                               $location_code = 
$check_list->get_location_code();
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                               $type = 'location';
-                               $level = 
$this->location_finder->get_location_level($location_code);
-                       }
-
-                       $year = date("Y", $check_list->get_deadline());
-                       $month = date("n", $check_list->get_deadline());
-
-                       $level = 
$this->location_finder->get_location_level($location_code);
-                       $user_role = true;
-
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
-
-                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
-
-                       $responsible_user_id = $check_list->get_assigned_to();
-
-                       $user_list_options = array();
-                       foreach ($users as $user)
-                       {
-                               $user_list_options[] = array
-                               (
-                                       'id' => $user['account_id'],
-                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
-                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
-                               );
-                       }
-
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-
-                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
-                       $request_ical_event = 
isset($config->config_data['request_ical_event']) && 
$config->config_data['request_ical_event'] ? 
$config->config_data['request_ical_event'] : false;
-
-                       $data = array
-                       (
-                               'user_list' => array('options' => 
$user_list_options),
-                               'control' => $control,
-                               'check_list' => $check_list,
-                               '$buildings_on_property' => 
$buildings_on_property,
-                               'location_array' => $location_array,
-                               'component_array' => $component_array,
-                               'type' => $type,
-                               'current_year' => $year,
-                               'current_month_nr' => $month,
-                               'building_location_code' => 
$building_location_code,
-                               'location_level' => $level,
-                               'required_actual_hours' => 
$required_actual_hours,
-                               'integration'                   => 
$this->_get_component_integration($location_id, $component_arr),
-                               'request_ical_event'    => $request_ical_event,
-                       );
-
-                       $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
-                       
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
-                       $GLOBALS['phpgw']->jqcal->add_listener('deadline_date');
-
-                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
-                       self::add_javascript('controller', 'controller', 
'ajax.js');
-                       self::add_javascript('controller', 'controller', 
'check_list.js');
-                       self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
-
-                       
self::render_template_xsl(array('check_list/fragments/check_list_menu', 
'check_list/fragments/nav_control_plan',
-                               'check_list/fragments/check_list_top_section', 
'check_list/edit_check_list',
-                               
'check_list/fragments/select_buildings_on_property'), $data);
-               }
-
-               /**
-                * Get linked information from external systems - as pictures
-                * @param integer $location_id
-                * @param array $component_arr
-                * @return array integration info
-                */
-               private function _get_component_integration($location_id, 
$_component_arr = array())
-               {
-                       if(isset($_component_arr['id']) && 
$_component_arr['id'])
-                       {
-                               $component_id = $_component_arr['id'];
-                       }
-                       else
-                       {
-                               return array();
-                       }
-                       $attributes = 
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '', 
'ASC','attrib_sort', $allrows = true);
-       
-                       $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id, 'values' => array('attributes' => 
$attributes)));
-
-                       $_custom_config = 
CreateObject('admin.soconfig',$location_id);
-                       $_config = isset($_custom_config->config_data) && 
$_custom_config->config_data ? $_custom_config->config_data : array();
-
-                       $integration = array();
-                       foreach ($_config as $_config_section => 
$_config_section_data)
-                       {
-                               if(isset($_config_section_data['tab']) && 
$component_arr['id'])
-                               {
-                                       if(!isset($_config_section_data['url']))
-                                       {
-                                               
phpgwapi_cache::message_set("'url' is a required setting for integrations, 
'{$_config_section}' is disabled", 'error');
-                                               break;
-                                       }
-
-                                       //get session key from remote system
-                                       $arguments = 
array($_config_section_data['auth_hash_name'] => 
$_config_section_data['auth_hash_value']);
-                                       $query = http_build_query($arguments);
-                                       $auth_url = 
$_config_section_data['auth_url'];
-                                       $request = "{$auth_url}?{$query}";
-
-                                       $aContext = array
-                                       (
-                                               'http' => array
-                                               (
-                                                       'request_fulluri' => 
true,
-                                               ),
-                                       );
-
-                                       
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
-                                       {
-                                               $aContext['http']['proxy'] = 
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
-                                       }
-
-                                       $cxContext = 
stream_context_create($aContext);
-                                       $response = 
trim(file_get_contents($request, False, $cxContext));
-
-                                       $_config_section_data['url']            
= htmlspecialchars_decode($_config_section_data['url']);
-                                       $_config_section_data['parametres']     
= htmlspecialchars_decode($_config_section_data['parametres']);
-
-                                       
parse_str($_config_section_data['parametres'], $output);
-
-                                       foreach ($output as $_dummy => 
$_substitute)
-                                       {
-                                               $_keys[] = $_substitute;
-
-                                               $__value = false;
-                                               if(!$__value = 
urlencode($component_arr[str_replace(array('__','*'),array('',''), 
$_substitute)]))
-                                               {
-                                                       foreach 
($component_arr['attributes'] as $_attribute)
-                                                       {
-                                                               
if(str_replace(array('__','*'),array('',''), $_substitute) == 
$_attribute['name'])
-                                                               {
-                                                                       
$__value = urlencode($_attribute['value']);
-                                                                       break;
-                                                               }
-                                                       }
-                                               }
-
-                                               if($__value)
-                                               {
-                                                       $_values[] = $__value;
-                                               }
-                                       }
-
-                                       unset($output);
-                                       unset($__value);
-                                       $_sep = '?';
-                                       if 
(stripos($_config_section_data['url'],'?'))
-                                       {
-                                               $_sep = '&';
-                                       }
-                                       $_param = str_replace($_keys, $_values, 
$_config_section_data['parametres']);
-                                       unset($_keys);
-                                       unset($_values);
-                                       $integration_src = 
"{$_config_section_data['url']}{$_sep}{$_param}";
-                                       if($_config_section_data['action'])
-                                       {
-                                               $_sep = '?';
-                                               if 
(stripos($integration_src,'?'))
-                                               {
-                                                       $_sep = '&';
-                                               }
-                                               $integration_src .= 
"{$_sep}{$_config_section_data['action']}=" . 
$_config_section_data["action_{$mode}"];
-                                       }
-
-                                       
if(isset($_config_section_data['location_data']) && 
$_config_section_data['location_data'])
-                                       {
-                                               
$_config_section_data['location_data']  = 
htmlspecialchars_decode($_config_section_data['location_data']);
-                                               
parse_str($_config_section_data['location_data'], $output);
-                                               foreach ($output as $_dummy => 
$_substitute)
-                                               {
-                                                       $_keys[] = $_substitute;
-                                                       $_values[] = 
urlencode($component_arr['location_data'][trim($_substitute, '_')]);
-                                               }
-                                               $integration_src .= '&' . 
str_replace($_keys, $_values, $_config_section_data['location_data']);
-                                       }
-
-                                       $integration_src .= 
"&{$_config_section_data['auth_key_name']}={$response}";
-
-                                       $integration[]  = array
-                                       (
-                                               'section'       => 
$_config_section,
-                                               'height'        => 
isset($_config_section_data['height']) && $_config_section_data['height'] ? 
$_config_section_data['height'] : 500,
-                                               'src'           => 
$integration_src
-                                       );
-                               }
-                       }
-                       return $integration;
-               }
-
-               /**
-                * Public function for saving a check list
-                * 
-                * @param HTTP:: location code, control id, status etc.. (check 
list details) 
-                * @return data array
-                */
-               function save_check_list()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       if(!$this->add && !$this->edit)
-                       {
-                               phpgwapi_cache::message_set('No access', 
'error');
-                               $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-                       }
-
-                       $control_id = phpgw::get_var('control_id', 'int');
-                       $serie_id = phpgw::get_var('serie_id', 'int');
-                       $status = (int) phpgw::get_var('status');
-                       $type = phpgw::get_var('type');
-                       $deadline_date = phpgw::get_var('deadline_date', 
'string');
-                       $planned_date = phpgw::get_var('planned_date', 
'string');
-                       $completed_date = phpgw::get_var('completed_date', 
'string');
-                       $comment = phpgw::get_var('comment', 'string');
-                       $assigned_to = phpgw::get_var('assigned_to', 'int');
-                       $billable_hours = phpgw::get_var('billable_hours', 
'float');
-
-                       $deadline_date_ts = 
date_converter::date_to_timestamp($deadline_date);
-
-                       $error = false;
-
-                       if($planned_date != '')
-                       {
-                               $planned_date_ts = 
date_converter::date_to_timestamp($planned_date);
-                       }
-                       else
-                       {
-                               $planned_date_ts = $deadline_date_ts;
-                       }
-
-                       if($completed_date != '')
-                       {
-                               $completed_date_ts = 
phpgwapi_datetime::date_to_timestamp($completed_date);
-                               $status = controller_check_list::STATUS_DONE;
-                       }
-                       else
-                       {
-                               $completed_date_ts = 0;
-                       }
-
-                       if($check_list_id > 0)
-                       {
-                               $check_list = 
$this->so->get_single($check_list_id);
-                               
-                               if($status == 
controller_check_list::STATUS_DONE)
-                               {
-                                       if(! 
$this->_check_for_required($check_list) )
-                                       {
-                                               
$this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               if($status == 
controller_check_list::STATUS_DONE)
-                               {
-                                       $status = 
controller_check_list::STATUS_NOT_DONE;
-                                       $completed_date_ts = 0;
-                                       $error_message =  "Status kunne ikke 
settes til utført - prøv igjen";
-                                       $error = true;
-                                       
phpgwapi_cache::message_set($error_message, 'error');
-                               }
-
-                               $check_list = new controller_check_list();
-                               $check_list->set_control_id($control_id);
-                               $location_code = 
phpgw::get_var('location_code');
-                               $check_list->set_location_code($location_code);
-                               $check_list->set_serie_id($serie_id);
-
-
-                               if($type == "component")
-                               {
-                                       $location_id = 
phpgw::get_var('location_id');
-                                       $component_id = 
phpgw::get_var('component_id');
-                                       
$check_list->set_location_id($location_id);
-                                       
$check_list->set_component_id($component_id);
-                               }
-                       }
-
-                       $check_list->set_comment($comment);
-                       $check_list->set_deadline($deadline_date_ts);
-                       $check_list->set_planned_date($planned_date_ts);
-                       $check_list->set_completed_date($completed_date_ts);
-
-                       $orig_assigned_to = $check_list->get_assigned_to();
-
-                       $check_list->set_assigned_to($assigned_to);
-
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-
-                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
-
-                       if($status == controller_check_list::STATUS_DONE && 
$required_actual_hours && $check_list->get_billable_hours() == 0 && 
!$billable_hours)
-                       {
-                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
-                               $error = true;
-                       }
-                       else
-                       {
-                               
$check_list->set_delta_billable_hours($billable_hours);
-                       }
-                       if ( $status == controller_check_list::STATUS_DONE && 
$this->_check_for_required($check_list) && !$error)
-                       {
-                               $check_list->set_status($status);
-                       }
-                       else if ($status == 
controller_check_list::STATUS_CANCELED && !$error)
-                       {
-                               $check_list->set_status($status);
-                       }
-
-                       if(!$error && $check_list->validate())
-                       {
-                               $check_list_id = $this->so->store($check_list);
-                               $serie = 
$this->so_control->get_serie($check_list->get_serie_id());
-
-                               /**
-                                * Add an iCal-event if there is a serie - and 
the checklist is visited the first time - or assigned is changed
-                                */
-                               if((phpgw::get_var('request_ical_event', 
'bool') && $check_list_id && $serie))// && !phpgw::get_var('check_list_id')) || 
($serie && $orig_assigned_to != $assigned_to) )
-                               {
-                                       $bocommon= 
CreateObject('property.bocommon');
-                                       $current_prefs_user = 
$bocommon->create_preferences('property',$GLOBALS['phpgw_info']['user']['account_id']);
-                                       $from_address = 
"{$GLOBALS['phpgw_info']['user']['fullname']}<{$current_prefs_user['email']}>";
-                                       $from_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
-
-                                       $to_name = 
$GLOBALS['phpgw']->accounts->id2name($assigned_to);
-                                       $prefs_target = 
$bocommon->create_preferences('property',$assigned_to);
-                                       $to_address = $prefs_target['email'];
-
-                                       if(! $start_date = 
$check_list->get_planned_date())
-                                       {
-                                               $start_date = 
$check_list->get_deadline();
-                                       }
-                                       $startTime = $start_date + 8 * 3600;
-
-                                       $endTime = $startTime + ( 
(float)$serie['service_time'] * 3600 ) + ( (float)$serie['controle_time'] * 
3600 );
-
-                                       if($check_list->get_component_id() > 0)
-                                       {
-                                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$check_list->get_location_id(), 'id' => $check_list->get_component_id()));
-                                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
-                                               $short_desc = $location_name . 
'::' . execMethod('property.soentity.get_short_description', 
array('location_id' => $check_list->get_location_id(), 'id' => 
$check_list->get_component_id()));
-                                               $location = $location_name;
-                                       }
-
-                                       $repeat_type_array = array
-                                               (
-                                                       "0"=> lang('day'),
-                                                       "1"=> lang('week'),
-                                                       "2"=> lang('month'),
-                                                       "3"=> lang('year')
-                                               );
-
-                                       $subject = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
-                                       $subject .= 
"::{$serie['title']}::{$short_desc}";
-
-                                       $link_backend = 
$GLOBALS['phpgw']->link('/index.php', array(
-                                               'menuaction'    => 
'controller.uicheck_list.add_check_list',
-                                               'control_id'    => 
$check_list->get_control_id(),
-                                               'location_id'   => 
$check_list->get_location_id(),
-                                               'component_id'  => 
$check_list->get_component_id(),
-                                               'serie_id'              => 
$check_list->get_serie_id(),
-                                               'type'                  => 
'component',
-                                               'assigned_to'   => 
$check_list->get_assigned_to(),
-                                               'deadline_current'      => true
-
-                                       ),false,true,true);
-
-                                       $link_mobilefrontend = 
$GLOBALS['phpgw']->link('/mobilefrontend/index.php', array(
-                                               'menuaction'    => 
'controller.uicheck_list.add_check_list',
-                                               'control_id'    => 
$check_list->get_control_id(),
-                                               'location_id'   => 
$check_list->get_location_id(),
-                                               'component_id'  => 
$check_list->get_component_id(),
-                                               'serie_id'              => 
$check_list->get_serie_id(),
-                                               'type'                  => 
'component',
-                                               'assigned_to'   => 
$check_list->get_assigned_to(),
-                                               'deadline_current'      => true
-
-                                       ),false,true,true);
-
-                                       $html_description = "<a href 
='{$link_mobilefrontend}'>Serie#" . $check_list->get_serie_id() 
.'::Mobilefrontend</a><br/><br/>';
-                                       $html_description .= "<a href 
='{$link_backend}'>Serie#" . $check_list->get_serie_id() .'::Backend</a>';
-
-                                       $_serie_id = 
$check_list->get_serie_id();
-                                       $text_description = 
str_replace('&amp;', '&', 
"Serie#{$_serie_id}::Mobilefrontend:\\n{$link_mobilefrontend}\\n\\nSerie#{$_serie_id}::Backend:\\n{$link_backend}");
-
-                                       if($from_address && $to_address)
-                                       {
-                                               
$this->sendIcalEvent($from_name, $from_address, $to_name, $to_address, 
$startTime, $endTime, $subject, $html_description, $text_description, 
$location);
-                                       }
-                                       else
-                                       {
-                                               
phpgwapi_cache::message_set("Mangler epostadresse til avsender eller addresat - 
eller begge", 'error');
-                                       }
-                               }
-
-                               if($check_list_id > 0)
-                               {
-                                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
-                               }
-                               else
-                               {
-                                       $this->edit_check_list($check_list);
-                               }
-                       }
-                       else
-                       {
-                               if($check_list->get_id() > 0)
-                               {
-                                       $this->edit_check_list($check_list);
-                               }
-                               else
-                               {
-                                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.add_check_list',
-                                               'control_id'            => 
$control_id,
-                                               'location_id'           => 
$location_id,
-                                               'component_id'          => 
$component_id,
-                                               'serie_id'                      
=> $serie_id,
-                                               'deadline_ts'           => 
$deadline_date_ts,
-                                               'type'                          
=> $type,
-                                               'assigned_to'           => 
$assigned_to,
-                                               'status'                        
=> $status,
-                                       //      'billable_hours' => 
$billable_hours
-                                       ));
-                               }
-                       }
-               }
-
-               function get_files2($location_id, $data)
-               {
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-                       $doc_types = 
isset($config->config_data['document_cat']) && 
$config->config_data['document_cat'] ? $config->config_data['document_cat'] : 
array();
-                       $sodocument     = CreateObject('property.sodocument');
-
-                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-                       $type_arr = explode('.',  $loc_arr['location']);
-                       if(count($type_arr) != 4)
-                       {
-                               return array();
-                       }
-
-                       $type           = $type_arr[1];
-                       $entity_id      = $type_arr[2];
-                       $cat_id         = $type_arr[3];
-
-                       $document_list = array();
-                       foreach ($doc_types as $doc_type)
-                       {
-                               if($doc_type)
-                               {
-                                       $document_list = 
array_merge($document_list, $sodocument->read_at_location(array(
-                                               'entity_id' => 
$entity_id,'cat_id' => $cat_id, 'p_num' =>$data['id'], 'doc_type' => $doc_type, 
'allrows' => true)));
-                               }
-                       }
-               
-//                     $valid_types = 
isset($config->config_data['document_valid_types']) && 
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' , 
$config->config_data['document_valid_types'] ) : '.pdf';
-
-                       $values = array();
-//                     if($valid_types)
-                       {
-                               $lang_view = lang('click to view file');
-                               foreach($document_list as $entry)
-                               {
-//                                     if ( 
!preg_match("/({$valid_types})$/i", $entry['document_name']) )
-//                                     {
-//                                             continue;
-//                                     }
-                                       $link_file_data = array
-                                       (
-                                               'menuaction'    => 
'property.uidocument.view_file',
-                                               'id'                    => 
$entry['document_id'],
-                                               'p_num'                 => 
$data['id'],
-                                               'cat_id'                => 
$cat_id,
-                                               'entity_id'             => 
$entity_id,
-                                       );
-
-                                       $values[] = array
-                                       (
-                                               'document_id'                   
=> $entry['document_id'],
-                                               'file_name'                     
        => $entry['document_name'],
-                                               'file_name'                     
        =>'<a href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data)."\" 
target='_blank' title='{$lang_view}'>{$entry['document_name']}</a>",
-                                               'link'                          
        => $entry['link'],
-                                               'title'                         
        => $entry['title'],
-                                               'doc_type'                      
        => $entry['doc_type'],
-                                               'document_date'                 
=> 
$GLOBALS['phpgw']->common->show_date($entry['document_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
-                                       );
-                               }
-                       }
-                       return $values;
-               }
-               function get_files($location_id, $data)
-               {
-                       $vfs = CreateObject('phpgwapi.vfs');
-                       $vfs->override_acl = 1;
-
-                       $location_data = explode('-', $data['location_code']);
-                       $loc1 = isset($location_data[0]) && $location_data[0] ? 
$location_data[0] : 'dummy';
-
-                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-
-                       $type_arr = explode('.',  $loc_arr['location']);
-
-                       if(count($type_arr) != 4)
-                       {
-                               return array();
-                       }
-
-                       $type = $type_arr[1];
-                       $entity_id = $type_arr[2];
-                       $cat_id = $type_arr[3];
-                       $category_dir = "{$type}_{$entity_id}_{$cat_id}";
-
-                       $files = $vfs->ls (array(
-                               'string' => 
"/property/{$category_dir}/{$loc1}/{$data['id']}",
-                               'relatives' => array(RELATIVE_NONE)));
-
-                       $vfs->override_acl = 0;
-
-                       $values         = array();
-                       foreach ($files as $file)
-                       {
-                               $values[] = array
-                               (
-                                       'name'          => $file['name'],
-                                       'directory'     => $file['directory'],
-                                       'file_id'       => $file['file_id'],
-                                       'mime_type'     => $file['mime_type']
-                               );
-                       }
-
-                       $link_file_data = array
-                       (
-                               'menuaction'    => 
'property.uientity.view_file',
-                               'loc1'                  => $loc1,
-                               'id'                    => $data['id'],
-                               'cat_id'                => $cat_id,
-                               'entity_id'             => $entity_id,
-                               'type'                  => $type
-                       );
-
-                       foreach($values as &$_entry )
-                       {
-                               $_entry['file_name'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.urlencode($_entry['name']).'"
 target="_blank" title="'.lang('click to view 
file').'">'.$_entry['name'].'</a>';
-                       }
-
-                       return $values;
-               }
-
-               function view_control_info()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-
-                       $check_list = $this->so->get_single($check_list_id);
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-
-                       $component_id = $check_list->get_component_id();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_id = $check_list->get_component_id();
-
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-
-                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
-
-                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-
-                               $component = new controller_component();
-                               $component->set_id($component_id);
-                               $component->set_location_id($location_id);
-                               
$component->set_location_code($component_arr['location_code']);
-                               $component->set_xml_short_desc($short_desc);
-                               $component_array = $component->toArray();
-
-                               $type = 'component';
-                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
-                       }
-                       else
-                       {
-                               $location_code = 
$check_list->get_location_code();
-                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
-                               $type = 'location';
-                               $level = 
$this->location_finder->get_location_level($location_code);
-                       }
-
-                       $year = date("Y", $check_list->get_deadline());
-                       $month = date("n", $check_list->get_deadline());
-
-                       $level = 
$this->location_finder->get_location_level($location_code);
-                       $user_role = true;
-
-                       // Fetches buildings on property
-                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
-
-                       $data = array
-                       (
-                               'control'                                       
=> $control,
-                               'check_list'                            => 
$check_list,
-                               'buildings_on_property'         => 
$buildings_on_property,
-                               'location_array'                        => 
$location_array,
-                               'component_array'                       => 
$component_array,
-                               'type'                                          
=> $type,
-                               'current_year'                          => 
$year,
-                               'current_month_nr'                      => 
$month,
-                               'building_location_code'        => 
$building_location_code,
-                               'location_level'                        => 
$level
-                       );
-
-                       phpgwapi_jquery::load_widget('core');
-                       self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
-
-                       
self::render_template_xsl(array('check_list/fragments/check_list_menu', 
'check_list/fragments/check_list_top_section',
-                               'check_list/fragments/nav_control_plan', 
'check_list/view_control_info',
-                               
'check_list/fragments/select_buildings_on_property'), $data);
-               }
-
-               function view_control_details()
-               {
-                       $control_id = phpgw::get_var('control_id');
-
-                       $control = $this->so_control->get_single($control_id);
-
-                       $check_list_id = phpgw::get_var('check_list_id','int');
-
-                       $check_list = $this->so->get_single($check_list_id);
-
-                       $component_id = $check_list->get_component_id();
-                       $files = array();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
-                               $files = 
$this->get_files2($location_id,$component_arr);
-                       }
-
-                       $data = array
-                       (
-                               'control'       => $control,
-                               'files'         => $files
-
-                       );
-
-                       
self::render_template_xsl('check_list/view_control_details', $data);
-               }
-
-               function view_control_items()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $check_list = $this->so->get_single($check_list_id);
-
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-                       $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-
-                       $saved_groups_with_items_array = array();
-
-                       //Populating array with saved control items for each 
group
-                       foreach($control_groups as $control_group)
-                       {
-                               $saved_control_items = 
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
 $control_group->get_id());
-
-                               $control_item = 
$this->so_control_item->get_single($control_item_id);
-
-                               $saved_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
-                       }
-
-                       $data = array
-                       (
-                               'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
-                               'check_list' => $check_list
-                       );
-
-                       
self::render_template_xsl('check_list/view_control_items', $data);
-               }
-
-               public function print_check_list()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $check_list = $this->so->get_single($check_list_id);
-
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-                       $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-
-                                                                               
                $location_code = $check_list->get_location_code();
-                                                                               
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
-                                                                               
                $level = 
$this->location_finder->get_location_level($location_code);
-                                                                               
                //var_dump($location_array);
-
-                       $saved_groups_with_items_array = array();
-
-                       //Populating array with saved control items for each 
group
-                       foreach($control_groups as $control_group)
-                       {
-                               $saved_control_items = 
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
 $control_group->get_id());
-
-                               $control_item = 
$this->so_control_item->get_single($control_item_id);
-
-                               $saved_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
-                       }
-
-                       $data = array
-                       (
-                               'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
-                               'check_list' => $check_list,
-                                                                               
                                                'control' => 
$control->toArray(),
-                                                                               
                                                'location_array' => 
$location_array,
-                                                                               
                                                'location_level' => $level
-                       );
-
-                       
self::render_template_xsl('check_list/print_check_list', $data);
-               }
-
-               // Returns check list info as JSON
-               public function get_check_list_info()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $check_list = 
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
-
-                       return json_encode($check_list);
-               }
-
-               // Returns open cases for a check list as JSON 
-               public function get_cases_for_check_list()
-               {
-                       $check_list_id = phpgw::get_var('check_list_id');
-
-                       $check_items_with_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open", 
null);
-
-                       return json_encode($check_items_with_cases);
-               }
-
-               /**
-                * Public function for updateing status for a check list
-                * 
-                * @return json encoded array with status saved or not saved
-                */
-               public function update_status()
-               {
-                       if(!$this->add && !$this->edit)
-                       {
-                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
-                       }
-
-                       $check_list_id = phpgw::get_var('check_list_id');
-                       $check_list_status = phpgw::get_var('status');
-                       $check_list = $this->so->get_single($check_list_id);
-
-//
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-                       $ok = true;
-
-                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
-                       if($check_list_status == 
controller_check_list::STATUS_DONE && $required_actual_hours && 
$check_list->get_billable_hours() == 0)
-                       {
-                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
-                               $ok = false;
-                       }
-//
-                       if ( !$this->_check_for_required($check_list) || !$ok)
-                       {
-                               $messages = phpgwapi_cache::message_get(true);
-                               $message = '';
-                               foreach($messages as $_type => $_message)
-                               {
-                                       if($_type == 'error')
-                                       {
-                                               $i = 1;
-                                               foreach($_message as $__message)
-                                               {
-                                                       $message.= "#{$i}: " . 
preg_replace("/<\/br[^>]*>\s*\r*\n*/is", "\n", $__message['msg']) . "\n";
-                                                       $i++;
-                                               }
-                                       }
-
-                               }
-                               return json_encode( array( "status" => 
'not_saved', 'message' => $message) );
-
-                       }
-
-                       if($check_list_status == 
controller_check_list::STATUS_DONE)
-                       {
-                               $check_list->set_completed_date(time());
-                       }
-                       else
-                       {
-                               $check_list_status = 
controller_check_list::STATUS_NOT_DONE;
-                               $check_list->set_completed_date(0);
-                       }
-
-                       $check_list->set_status( $check_list_status );
-
-                       if($this->so->store($check_list))
-                       {
-                               return json_encode( array( 'status' => 
$check_list_status) );
-                       }
-                       else
-                       {
-                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
-                       }
-               }
-
-               public function query()
-               {
-
-               }
-
-               /**
-               * Check for required items on all groups and for all components 
registered to the location.
-               * @param object $check_list
-               * @return bool
-               **/
-               private function _check_for_required($check_list)
-               {
-                       $ok = true;
-                       $control = 
$this->so_control->get_single($check_list->get_control_id());
-
-                       $saved_control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
-
-                       $required_control_items = array();
-                       foreach ($saved_control_groups as $control_group)
-                       {       
-                               $control_items = 
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
 $control_group->get_id(), "return_array");
-                               $component_location_id = 
$control_group->get_component_location_id();
-                               $component_criteria = 
$control_group->get_component_criteria();
-
-                               foreach ($control_items as $control_item)
-                               {
-                                       if($control_item['required'])
-                                       {
-                                               
$control_item['component_location_id'] = $component_location_id;
-                                               
$control_item['component_criteria'] = $component_criteria;
-                                               $required_control_items[] = 
$control_item;
-                                       }
-                               }
-                       }
-
-                       $components_at_location = array();
-                       $control_groups_with_items_array = array();
-                       
-                       $component_id = $check_list->get_component_id();
-
-                       if($component_id > 0)
-                       {
-                               $location_id = $check_list->get_location_id();
-                               $component_id = $check_list->get_component_id();
-                               
-                               foreach ($required_control_items as 
$required_control_item)
-                               {
-                                       $_ok = 
$this->so_case->get_cases_by_component($location_id, $component_id, 
$required_control_item['id'],$check_list->get_id());
-                                       if(!$_ok)
-                                       {
-                                               $error_message =  lang('missing 
value for required') . "</br>";
-                                               $error_message .=  
"\"{$required_control_item['title']}\"</br>";
-                                               $error_message .= 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-                                               $error_message .=  "</br>";
-                                               
phpgwapi_cache::message_set($error_message, 'error');
-//                                             echo $error_message;
-                                               $ok = false;
-                                       }
-                               }
-                       }
-                       else
-                       {
-                               $location_code = 
$check_list->get_location_code();
-                               $location_code_search_components = 
$location_code;
-                               $type = 'location';
-
-                               foreach ($required_control_items as 
$required_control_item)
-                               {
-                                       $criterias_array = array();
-
-                                       $component_location_id = 
$required_control_item['component_location_id'];
-                                       $criterias_array['location_id'] = 
$component_location_id;
-                                       $criterias_array['location_code'] = 
$location_code_search_components;
-                                       $criterias_array['allrows'] = true;
-
-                                       $component_criteria = 
$required_control_item['component_criteria'];
-
-                                       $conditions = array();
-                                       foreach ($component_criteria as 
$attribute_id => $condition)
-                                       {
-                                               if($condition['value'])
-                                               {
-                                                       eval('$condition_value 
= ' . "{$condition['value']};");
-                                                       $conditions[] = array
-                                                       (
-                                                               'attribute_id'  
=> $attribute_id,
-                                                               'operator'      
        => $condition['operator'],
-                                                               'value'         
        => $condition_value
-                                                       );
-                                               }
-                                       }
-
-                                       $criterias_array['conditions'] = 
$conditions;
-
-                                       if( 
!isset($components_at_location[$component_location_id][$location_code_search_components])
  || !$_components_at_location = 
$components_at_location[$component_location_id][$location_code_search_components])
-                                       {
-                                               $_components_at_location = 
execMethod('property.soentity.get_eav_list', $criterias_array);
-                                               
$components_at_location[$component_location_id][$location_code_search_components]
 = $_components_at_location;
-                                       }
-                                               
-                                       if($_components_at_location)
-                                       {
-                                               
foreach($_components_at_location as &$_component_at_location)
-                                               {
-                                                       $_ok = 
$this->so_case->get_cases_by_component($_component_at_location['location_id'], 
$_component_at_location['id'], $required_control_item['id'], 
$check_list->get_id());
-
-                                                       if(!$_ok)
-                                                       {
-                                                               $error_message 
=  "mangler registrering for required</br>";
-                                                               $error_message 
.=  "{$required_control_item['title']}</br>";
-                                                               $error_message 
.= execMethod('property.soentity.get_short_description', array('location_id' => 
$_component_at_location['location_id'], 'id' => $_component_at_location['id']));
-                                                               $error_message 
.=  "</br>";
-                                                               
phpgwapi_cache::message_set($error_message, 'error');
-//                                                             echo 
$error_message;
-                                                               $ok = false;
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-                       $config = CreateObject('phpgwapi.config','controller');
-                       $config->read();
-
-                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
-
-                       if($check_list->get_status == 
controller_check_list::STATUS_DONE && $required_actual_hours && 
$check_list->get_billable_hours() == 0)
-                       {
-                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
-                               $ok = false;
-                       }
-
-                       return $ok;
-               }
-
-               /**
-                * 
-                * @param string $from_name
-                * @param string $from_address
-                * @param string $to_name
-                * @param string $to_address
-                * @param int $startTime
-                * @param int $endTime
-                * @param string $subject
-                * @param string $html_description
-                * @param string $text_description
-                * @param string $location
-                * @return type
-                */
-               function sendIcalEvent($from_name, $from_address, $to_name, 
$to_address, $startTime, $endTime, $subject, 
$html_description,$text_description, $location)
-               {
-//                     
https://www.exchangecore.com/blog/sending-outlookemail-calendar-events-php/
-
-                       $domain = $GLOBALS['phpgw_info']['server']['hostname'];
-
-                       //Create Email Headers
-                       $mime_boundary = "----Meeting Booking----".md5(time());
-
-                       //Create Email Body (HTML)
-                       $message  = <<<HTML
-                       --{$mime_boundary}
-                       Content-Type: text/html; charset=UTF-8
-                       Content-Transfer-Encoding: 8bit
-
-                       <html>
-                       <body>
-                       <p>Dear {$to_name}</p>
-                       <p>{$html_description}</p>
-                       </body>
-                       </html>
-                       --{$mime_boundary}
-HTML;
-                       //Create Email Body (HTML)
-                       $message  = <<<HTML
-                       <html>
-                       <body>
-                       <p>Dear {$to_name}</p>
-                       <p>{$html_description}</p>
-                       </body>
-                       </html>
-HTML;
-
-                       $last_modified =  date("Ymd\TGis");
-                       $uid = date("Ymd\TGis", $startTime).rand()."@".$domain;
-                       $dtstamp = date("Ymd\TGis");
-                       $dtstart = date("Ymd\THis", $startTime);
-                       $dtend = date("Ymd\THis", $endTime);
-                       $timezone = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['timezone'];
-
-
-$ical = <<<HTML
-BEGIN:VCALENDAR
-PRODID: controller {$domain}
-VERSION:2.0
-CALSCALE:GREGORIAN
-METHOD:REQUEST
-X-WR-TIMEZONE:Europe/Oslo
-BEGIN:VEVENT
-ORGANIZER;CN="{$to_name}":MAILTO:{$to_address}
-ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
-DTSTAMP:{$dtstamp}
-DTSTART:{$dtstart}
-DTEND:{$dtend}
-SEQUENCE:0
-STATUS:TENTATIVE
-SUMMARY:{$subject}
-LOCATION:{$location}
-DESCRIPTION:{$text_description}
-UID:{$uid}
-BEGIN:VALARM
-TRIGGER:-PT15M
-ACTION:DISPLAY
-DESCRIPTION:Reminder
-END:VALARM
-END:VEVENT
-END:VCALENDAR
-HTML;
-
-//ORGANIZER;CN="{$from_name}":MAILTO:{$from_address}
-//ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
-
-
-
-//                     $message .= $ical;
-                       $message = $ical;
-
-
-                       //Might work....
-                       $attachment = array
-                       (
-                       //      'content'               => base64_encode($ical),
-                               'content'               => $ical,
-                               'name'                  => 'meeting.ics',
-                       //      'encoding'              => 'base64',//'7bit',
-                               'encoding'              => '7bit',
-                               'type'                  => 
"text/calendar;charset=utf-8; method=REQUEST",
-                               'disposition'   => 'inline'
-                       );
-
-//test
-                       $mail = createObject('phpgwapi.mailer_smtp');
-                       $mail->Subject = $subject;
-                       $mail->Body =<<<HTML
-                       <html>
-                       <body>
-                       <p>{$to_name}:</p>
-                       <p>{$html_description}</p>
-                       </body>
-                       </html>
-HTML;
-                       $mail->AltBody = $text_description; // For non HTML 
email client
-                       $mail->Ical = $ical; //Your manually created ical code
-                       $mail->IsHTML(true);
-                       $mail->isSMTP();
-                       $mail->AddAddress($to_address);
-
-
-                       $from = 
str_replace(array('[',']'),array('<','>'),$from_address);
-                       $from_array = explode('<', $from);
-                       unset($from);
-                       if ( count($from_array) == 2 )
-                       {
-                               $mail->From = trim($from_array[1],'>');
-                               $mail->FromName = $from_array[0];
-                       }
-                       else
-                       {
-                               $mail->From = $from_array[0];
-                               $mail->FromName = $from_name;
-                       }
-
-                       try
-                       {
-                               $mail->Send();
-                       }
-                       catch (phpmailerException $e)
-                       {
-                               phpgwapi_cache::message_set($e->getMessage(), 
'error');
-                       }
-                       return;
-//test
-                       $rc = false;
-                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
-                       {
-                               $send= CreateObject('phpgwapi.send');
-                               try
-                               {
-                                       $rc = $send->msg('email', $to_address, 
$subject, $message, $msgtype='Ical', $cc='', $bcc='', $from_address, 
$from_name,'html',$mime_boundary);//, array($attachment));
-                               }
-                               catch (phpmailerException $e)
-                               {
-                                       
phpgwapi_cache::message_set($e->getMessage(), 'error');
-                               }
-                       }
-                       else
-                       {
-                               phpgwapi_cache::message_set(lang('SMTP server 
is not set! (admin section)'), 'error');
-                       }
-
-                       return $rc;
-               }
-       }
+<?php
+
+       /**
+        * phpGroupWare - controller: a part of a Facilities Management System.
+        *
+        * @author Erik Holm-Larsen <address@hidden>
+        * @author Torstein Vadla <address@hidden>
+        * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * This file is part of phpGroupWare.
+        *
+        * phpGroupWare is free software; you can redistribute it and/or modify
+        * it under the terms of the GNU General Public License as published by
+        * the Free Software Foundation; either version 2 of the License, or
+        * (at your option) any later version.
+        *
+        * phpGroupWare is distributed in the hope that it will be useful,
+        * but WITHOUT ANY WARRANTY; without even the implied warranty of
+        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        * GNU General Public License for more details.
+        *
+        * You should have received a copy of the GNU General Public License
+        * along with phpGroupWare; if not, write to the Free Software
+        * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  
02110-1301  USA
+        *
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+        * @package property
+        * @subpackage controller
+        * @version $Id$
+        */
+       /**
+        * Import the jQuery class
+        */
+       phpgw::import_class('phpgwapi.jquery');
+
+       /**
+        * Import the yui class
+        */
+       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('phpgwapi.uicommon');
+       phpgw::import_class('controller.socheck_list');
+       phpgw::import_class('phpgwapi.datetime');
+
+       include_class('controller', 'check_list', 'inc/model/');
+       include_class('controller', 'check_item', 'inc/model/');
+       include_class('controller', 'date_generator', 'inc/component/');
+       include_class('controller', 'date_converter', 'inc/helper/');
+       include_class('controller', 'location_finder', 'inc/helper/');
+
+       class controller_uicheck_list extends phpgwapi_uicommon
+       {
+               protected $so;
+               protected $so_control;
+               protected $so_control_item;
+               protected $so_check_item;
+               protected $so_procedure;
+               protected $so_control_group_list;
+               protected $so_control_group;
+               protected $so_control_item_list;
+               protected $location_finder;
+
+               private $read;
+               private $add;
+               private $edit;
+               private $delete;
+               private $acl_location;
+
+               var $public_functions = array(
+                       'index' => true,
+                       'add_check_list' => true,
+                       'save_check_list' => true,
+                       'edit_check_list' => true,
+                       'print_check_list' => true,
+                       'view_control_info' => true,
+                       'view_control_details' => true,
+                       'view_control_items' => true,
+                       'get_check_list_info' => true,
+                       'get_cases_for_check_list' => true,
+                       'update_status' => true
+               );
+
+               function __construct()
+               {
+                       parent::__construct();
+
+                       $this->so_control = 
CreateObject('controller.socontrol');
+                       $this->so = CreateObject('controller.socheck_list');
+                       $this->so_control_item = 
CreateObject('controller.socontrol_item');
+                       $this->so_check_item = 
CreateObject('controller.socheck_item');
+                       $this->so_procedure = 
CreateObject('controller.soprocedure');
+                       $this->so_control_group_list = 
CreateObject('controller.socontrol_group_list');
+                       $this->so_control_group = 
CreateObject('controller.socontrol_group');
+                       $this->so_control_item_list = 
CreateObject('controller.socontrol_item_list');
+                       $this->so_case  = CreateObject('controller.socase');
+                       $this->location_finder = new location_finder();
+
+                       $this->acl_location = '.checklist';
+
+                       $this->read     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1 
+                       $this->add       = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2 
+                       $this->edit     = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_EDIT, 'controller');//4 
+                       $this->delete  = 
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_DELETE, 'controller');//8 
+
+                       
self::set_active_menu('controller::control::check_list');
+
+                       if(phpgw::get_var('noframework', 'bool'))
+                       {
+                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                               
phpgwapi_cache::session_set('controller','noframework',true);
+                       }
+                       else if 
(phpgwapi_cache::session_get('controller','noframework'))
+                       {
+                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
+                       }
+               }
+
+               /**
+                * Public function for displaying checklists  
+                * 
+                * @param HTTP:: phpgw_return_as
+                * @return data array
+                */
+               public function index()
+               {
+                       if(phpgw::get_var('phpgw_return_as') == 'json')
+                       {
+                               return $this->query();
+                       }
+                       self::add_javascript('phpgwapi', 'yahoo', 
'datatable.js');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('paginator');
+
+                       $data = array(
+                               'datatable_name' => 'Sjekkliste (Ikke i bruk)',
+                               'form' => array(
+                                       'toolbar' => array(
+                                               'item' => array(
+                                                       array('type' => 
'filter',
+                                                               'name' => 
'status',
+                                                               'text' => 
lang('Status'),
+                                                               'list' => array(
+                                                                       array(
+                                                                               
'id' => 'none',
+                                                                               
'name' => lang('Not selected')
+                                                                       ),
+                                                                       array(
+                                                                               
'id' => 'NEW',
+                                                                               
'name' => lang('NEW')
+                                                                       ),
+                                                                       array(
+                                                                               
'id' => 'PENDING',
+                                                                               
'name' => lang('PENDING')
+                                                                       ),
+                                                                       array(
+                                                                               
'id' => 'REJECTED',
+                                                                               
'name' => lang('REJECTED')
+                                                                       ),
+                                                                       array(
+                                                                               
'id' => 'ACCEPTED',
+                                                                               
'name' => lang('ACCEPTED')
+                                                                       )
+                                                               )
+                                                       ),
+                                                       array('type' => 'text',
+                                                               'text' => 
lang('searchfield'),
+                                                               'name' => 
'query'
+                                                       ),
+                                                       array(
+                                                               'type' => 
'submit',
+                                                               'name' => 
'search',
+                                                               'value' => 
lang('Search')
+                                                       ),
+                                               ),
+                                       ),
+                               ),
+                               'datatable' => array(
+                                       'source' => 
self::link(array('menuaction' => 'controller.uicheck_list.index', 
'phpgw_return_as' => 'json')),
+                                       'field' => array(
+                                               array(
+                                                       'key' => 'id',
+                                                       'label' => lang('ID'),
+                                                       'sortable' => true,
+                                                       'formatter' => 
'YAHOO.portico.formatLink'
+                                               ),
+                                               array(
+                                                       'key' => 'title',
+                                                       'label' => 
lang('Control title'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 'start_date',
+                                                       'label' => 
lang('start_date'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 'planned_date',
+                                                       'label' => 
lang('planned_date'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 'end_date',
+                                                       'label' => 
lang('end_date'),
+                                                       'sortable' => false
+                                               ),
+                                               array(
+                                                       'key' => 'link',
+                                                       'hidden' => true
+                                               )
+                                       )
+                               ),
+                       );
+
+                       self::render_template_xsl('datatable_common', $data);
+               }
+
+               /**
+                * Public function for displaying the add check list form
+                * 
+                * @param HTTP:: location code, control id, date
+                * @return data array
+                */
+               function add_check_list($check_list = null)
+               {
+                       if($check_list == null)
+                       {
+                               $type = phpgw::get_var('type');
+                               $control_id = phpgw::get_var('control_id');
+                               $deadline_ts = phpgw::get_var('deadline_ts');
+                               $deadline_current = 
phpgw::get_var('deadline_current', 'bool');
+                               $serie_id = phpgw::get_var('serie_id', 'int');
+
+                               if($deadline_current)
+                               {
+                                       $year = date('Y');
+                                       $month = date('m');
+                                       $a_date = "{$year}-{$month}-23";
+                                       $deadline_ts    = mktime(00, 00, 00, 
$month, date('t', strtotime($a_date)), $year);
+                                       unset($year);
+                                       unset($month);
+                                       unset($a_date);
+
+                                       /*look for checklist with $deadline_ts 
= $deadline_current*/
+
+                                       $check_list_id = 
$this->so_control->get_check_list_id_for_deadline($serie_id, $deadline_ts);
+                                       if($check_list_id)
+                                       {
+                                               
$this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+                                       }
+                               }
+
+                               $check_list = new controller_check_list();
+                               $check_list->set_control_id($control_id);
+                               $check_list->set_deadline($deadline_ts);
+                       }
+                       else
+                       {
+                               if($check_list->get_component_id() > 0)
+                               {
+                                       $type = "component";
+                               }
+                               else
+                               {
+                                       $type = "location";
+                               }
+                       }
+
+                       if(!$location_code = $check_list->get_location_code())
+                       {
+                               $location_code = 
phpgw::get_var('location_code');
+                               $check_list->set_location_code($location_code);
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
+                               $level = 
$this->location_finder->get_location_level($location_code);
+                       }
+
+
+                       if($type == "component")
+                       {
+                               if($check_list != null)
+                               {
+                                       $location_id = 
phpgw::get_var('location_id');
+                                       
$check_list->set_location_id($location_id);
+                                       $component_id = 
phpgw::get_var('component_id');
+                                       
$check_list->set_component_id($component_id);
+                               }
+
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+
+                               $location_code = 
$component_arr['location_code'];
+
+                               $check_list->set_location_code($location_code);
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$check_list->get_location_code()));
+                               $level = 
$this->location_finder->get_location_level($location_code);
+
+                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+
+                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+
+                               $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
+                               
$component->set_location_code($component_arr['location_code']);
+                               $component->set_xml_short_desc($short_desc);
+
+                               $component_array = $component->toArray();
+                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+
+                               $type = "component";
+                       }
+                       else
+                       {
+                               $type = "location";
+                       }
+
+                       $repeat_descr = '';
+                       if($serie = $this->so_control->get_serie($serie_id))
+                       {
+                               $repeat_type_array = array
+                                       (
+                                               "0"=> lang('day'),
+                                               "1"=> lang('week'),
+                                               "2"=> lang('month'),
+                                               "3"=> lang('year')
+                                       );
+                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                       }
+
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+
+                       if($repeat_descr)
+                       {
+                               $repeat_descr .= " :: " .$control->get_title();
+                               $control->set_title($repeat_descr);
+                       }
+
+                       if(!$responsible_user_id = 
phpgw::get_var('assigned_to', 'int'))
+                       {
+                               $responsible_user_id = 
execMethod('property.soresponsible.get_responsible_user_id',
+                                       array
+                                       (
+                                               'responsibility_id' => 
$control->get_responsibility_id(),
+                                               'location_code' => 
$location_code
+                                       )
+                               );
+                       }
+
+                       $year = date("Y", $deadline_ts);
+                       $month_nr = date("n", $deadline_ts);
+
+                       $level = 
$this->location_finder->get_location_level($location_code);
+                       $user_role = true;
+
+                       // Fetches buildings on property
+                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
+
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
+
+                       $user_list_options = array();
+                       foreach ($users as $user)
+                       {
+                               $user_list_options[] = array
+                               (
+                                       'id' => $user['account_id'],
+                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
+                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
+                               );
+                       }
+
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+
+                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
+                       $request_ical_event = 
isset($config->config_data['request_ical_event']) && 
$config->config_data['request_ical_event'] ? 
$config->config_data['request_ical_event'] : false;
+
+                       $data = array
+                       (
+                               'user_list' => array('options' => 
$user_list_options),
+                               'location_array' => $location_array,
+                               'component_array' => $component_array,
+                               'control' => $control,
+                               'check_list' => $check_list,
+                               'buildings_on_property' => 
$buildings_on_property,
+                               'type' => $type,
+                               'current_year' => $year,
+                               'current_month_nr' => $month_nr,
+                               'building_location_code' => 
$building_location_code,
+                               'location_level' => $level,
+                               'check_list_type' => 'add_check_list',
+                               'serie_id'                      => $serie_id,
+                               'required_actual_hours' => 
$required_actual_hours,
+                               'integration'                   => 
$this->_get_component_integration($location_id, $component_arr),
+                               'request_ical_event'    => $request_ical_event
+
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
+                       
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
+
+                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+                       self::add_javascript('controller', 'controller', 
'check_list.js');
+
+                       
self::render_template_xsl(array('check_list/add_check_list', 
'check_list/fragments/nav_control_plan',
+                               'check_list/fragments/check_list_top_section', 
'check_list/fragments/add_check_list_menu',
+                               
'check_list/fragments/select_buildings_on_property'), $data);
+               }
+
+               /**
+                * Public function for displaying the edit check list form  
+                * 
+                * @param HTTP:: check list id
+                * @return data array
+                */
+               function edit_check_list($check_list = null)
+               {
+                       if($check_list == null)
+                       {
+                               $check_list_id = 
phpgw::get_var('check_list_id');
+                               $check_list = 
$this->so->get_single($check_list_id);
+                       }
+
+                       $repeat_descr = '';
+                       if($serie = 
$this->so_control->get_serie($check_list->get_serie_id()))
+                       {
+                               $repeat_type_array = array
+                                       (
+                                               "0"=> lang('day'),
+                                               "1"=> lang('week'),
+                                               "2"=> lang('month'),
+                                               "3"=> lang('year')
+                                       );
+                               $repeat_descr = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                       }
+
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+
+                       if($repeat_descr)
+                       {
+                               $repeat_descr .= " :: " .$control->get_title();
+                               $control->set_title($repeat_descr);
+                       }
+
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+
+                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+
+                               $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
+                               
$component->set_location_code($component_arr['location_code']);
+                               $component->set_xml_short_desc($short_desc);
+                               $component_array = $component->toArray();
+
+                               $type = 'component';
+                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->location_finder->get_location_level($location_code);
+                       }
+
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+
+                       $level = 
$this->location_finder->get_location_level($location_code);
+                       $user_role = true;
+
+                       // Fetches buildings on property
+                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
+
+                       $users = 
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_ADD, $this->acl_location);
+
+                       $responsible_user_id = $check_list->get_assigned_to();
+
+                       $user_list_options = array();
+                       foreach ($users as $user)
+                       {
+                               $user_list_options[] = array
+                               (
+                                       'id' => $user['account_id'],
+                                       'name' => $user['account_lastname'] . 
', ' . $user['account_firstname'],
+                                       'selected'      => $responsible_user_id 
== $user['account_id'] ? 1 : 0
+                               );
+                       }
+
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+
+                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
+                       $request_ical_event = 
isset($config->config_data['request_ical_event']) && 
$config->config_data['request_ical_event'] ? 
$config->config_data['request_ical_event'] : false;
+
+                       $data = array
+                       (
+                               'user_list' => array('options' => 
$user_list_options),
+                               'control' => $control,
+                               'check_list' => $check_list,
+                               '$buildings_on_property' => 
$buildings_on_property,
+                               'location_array' => $location_array,
+                               'component_array' => $component_array,
+                               'type' => $type,
+                               'current_year' => $year,
+                               'current_month_nr' => $month,
+                               'building_location_code' => 
$building_location_code,
+                               'location_level' => $level,
+                               'required_actual_hours' => 
$required_actual_hours,
+                               'integration'                   => 
$this->_get_component_integration($location_id, $component_arr),
+                               'request_ical_event'    => $request_ical_event,
+                       );
+
+                       $GLOBALS['phpgw']->jqcal->add_listener('planned_date');
+                       
$GLOBALS['phpgw']->jqcal->add_listener('completed_date');
+                       $GLOBALS['phpgw']->jqcal->add_listener('deadline_date');
+
+                       self::add_javascript('controller', 'controller', 
'custom_ui.js');
+                       self::add_javascript('controller', 'controller', 
'ajax.js');
+                       self::add_javascript('controller', 'controller', 
'check_list.js');
+                       self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
+
+                       
self::render_template_xsl(array('check_list/fragments/check_list_menu', 
'check_list/fragments/nav_control_plan',
+                               'check_list/fragments/check_list_top_section', 
'check_list/edit_check_list',
+                               
'check_list/fragments/select_buildings_on_property'), $data);
+               }
+
+               /**
+                * Get linked information from external systems - as pictures
+                * @param integer $location_id
+                * @param array $component_arr
+                * @return array integration info
+                */
+               private function _get_component_integration($location_id, 
$_component_arr = array())
+               {
+                       if(isset($_component_arr['id']) && 
$_component_arr['id'])
+                       {
+                               $component_id = $_component_arr['id'];
+                       }
+                       else
+                       {
+                               return array();
+                       }
+                       $attributes = 
$GLOBALS['phpgw']->custom_fields->find2($location_id, 0, '', 
'ASC','attrib_sort', $allrows = true);
+       
+                       $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id, 'values' => array('attributes' => 
$attributes)));
+
+                       $_custom_config = 
CreateObject('admin.soconfig',$location_id);
+                       $_config = isset($_custom_config->config_data) && 
$_custom_config->config_data ? $_custom_config->config_data : array();
+
+                       $integration = array();
+                       foreach ($_config as $_config_section => 
$_config_section_data)
+                       {
+                               if(isset($_config_section_data['tab']) && 
$component_arr['id'])
+                               {
+                                       if(!isset($_config_section_data['url']))
+                                       {
+                                               
phpgwapi_cache::message_set("'url' is a required setting for integrations, 
'{$_config_section}' is disabled", 'error');
+                                               break;
+                                       }
+
+                                       //get session key from remote system
+                                       $arguments = 
array($_config_section_data['auth_hash_name'] => 
$_config_section_data['auth_hash_value']);
+                                       $query = http_build_query($arguments);
+                                       $auth_url = 
$_config_section_data['auth_url'];
+                                       $request = "{$auth_url}?{$query}";
+
+                                       $aContext = array
+                                       (
+                                               'http' => array
+                                               (
+                                                       'request_fulluri' => 
true,
+                                               ),
+                                       );
+
+                                       
if(isset($GLOBALS['phpgw_info']['server']['httpproxy_server']))
+                                       {
+                                               $aContext['http']['proxy'] = 
"{$GLOBALS['phpgw_info']['server']['httpproxy_server']}:{$GLOBALS['phpgw_info']['server']['httpproxy_port']}";
+                                       }
+
+                                       $cxContext = 
stream_context_create($aContext);
+                                       $response = 
trim(file_get_contents($request, False, $cxContext));
+
+                                       $_config_section_data['url']            
= htmlspecialchars_decode($_config_section_data['url']);
+                                       $_config_section_data['parametres']     
= htmlspecialchars_decode($_config_section_data['parametres']);
+
+                                       
parse_str($_config_section_data['parametres'], $output);
+
+                                       foreach ($output as $_dummy => 
$_substitute)
+                                       {
+                                               $_keys[] = $_substitute;
+
+                                               $__value = false;
+                                               if(!$__value = 
urlencode($component_arr[str_replace(array('__','*'),array('',''), 
$_substitute)]))
+                                               {
+                                                       foreach 
($component_arr['attributes'] as $_attribute)
+                                                       {
+                                                               
if(str_replace(array('__','*'),array('',''), $_substitute) == 
$_attribute['name'])
+                                                               {
+                                                                       
$__value = urlencode($_attribute['value']);
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+
+                                               if($__value)
+                                               {
+                                                       $_values[] = $__value;
+                                               }
+                                       }
+
+                                       unset($output);
+                                       unset($__value);
+                                       $_sep = '?';
+                                       if 
(stripos($_config_section_data['url'],'?'))
+                                       {
+                                               $_sep = '&';
+                                       }
+                                       $_param = str_replace($_keys, $_values, 
$_config_section_data['parametres']);
+                                       unset($_keys);
+                                       unset($_values);
+                                       $integration_src = 
"{$_config_section_data['url']}{$_sep}{$_param}";
+                                       if($_config_section_data['action'])
+                                       {
+                                               $_sep = '?';
+                                               if 
(stripos($integration_src,'?'))
+                                               {
+                                                       $_sep = '&';
+                                               }
+                                               $integration_src .= 
"{$_sep}{$_config_section_data['action']}=" . 
$_config_section_data["action_{$mode}"];
+                                       }
+
+                                       
if(isset($_config_section_data['location_data']) && 
$_config_section_data['location_data'])
+                                       {
+                                               
$_config_section_data['location_data']  = 
htmlspecialchars_decode($_config_section_data['location_data']);
+                                               
parse_str($_config_section_data['location_data'], $output);
+                                               foreach ($output as $_dummy => 
$_substitute)
+                                               {
+                                                       $_keys[] = $_substitute;
+                                                       $_values[] = 
urlencode($component_arr['location_data'][trim($_substitute, '_')]);
+                                               }
+                                               $integration_src .= '&' . 
str_replace($_keys, $_values, $_config_section_data['location_data']);
+                                       }
+
+                                       $integration_src .= 
"&{$_config_section_data['auth_key_name']}={$response}";
+
+                                       $integration[]  = array
+                                       (
+                                               'section'       => 
$_config_section,
+                                               'height'        => 
isset($_config_section_data['height']) && $_config_section_data['height'] ? 
$_config_section_data['height'] : 500,
+                                               'src'           => 
$integration_src
+                                       );
+                               }
+                       }
+                       return $integration;
+               }
+
+               /**
+                * Public function for saving a check list
+                * 
+                * @param HTTP:: location code, control id, status etc.. (check 
list details) 
+                * @return data array
+                */
+               function save_check_list()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       if(!$this->add && !$this->edit)
+                       {
+                               phpgwapi_cache::message_set('No access', 
'error');
+                               $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+                       }
+
+                       $control_id = phpgw::get_var('control_id', 'int');
+                       $serie_id = phpgw::get_var('serie_id', 'int');
+                       $status = (int) phpgw::get_var('status');
+                       $type = phpgw::get_var('type');
+                       $deadline_date = phpgw::get_var('deadline_date', 
'string');
+                       $planned_date = phpgw::get_var('planned_date', 
'string');
+                       $completed_date = phpgw::get_var('completed_date', 
'string');
+                       $comment = phpgw::get_var('comment', 'string');
+                       $assigned_to = phpgw::get_var('assigned_to', 'int');
+                       $billable_hours = phpgw::get_var('billable_hours', 
'float');
+
+                       $deadline_date_ts = 
date_converter::date_to_timestamp($deadline_date);
+
+                       $error = false;
+
+                       if($planned_date != '')
+                       {
+                               $planned_date_ts = 
date_converter::date_to_timestamp($planned_date);
+                       }
+                       else
+                       {
+                               $planned_date_ts = $deadline_date_ts;
+                       }
+
+                       if($completed_date != '')
+                       {
+                               $completed_date_ts = 
phpgwapi_datetime::date_to_timestamp($completed_date);
+                               $status = controller_check_list::STATUS_DONE;
+                       }
+                       else
+                       {
+                               $completed_date_ts = 0;
+                       }
+
+                       if($check_list_id > 0)
+                       {
+                               $check_list = 
$this->so->get_single($check_list_id);
+                               
+                               if($status == 
controller_check_list::STATUS_DONE)
+                               {
+                                       if(! 
$this->_check_for_required($check_list) )
+                                       {
+                                               
$this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               if($status == 
controller_check_list::STATUS_DONE)
+                               {
+                                       $status = 
controller_check_list::STATUS_NOT_DONE;
+                                       $completed_date_ts = 0;
+                                       $error_message =  "Status kunne ikke 
settes til utført - prøv igjen";
+                                       $error = true;
+                                       
phpgwapi_cache::message_set($error_message, 'error');
+                               }
+
+                               $check_list = new controller_check_list();
+                               $check_list->set_control_id($control_id);
+                               $location_code = 
phpgw::get_var('location_code');
+                               $check_list->set_location_code($location_code);
+                               $check_list->set_serie_id($serie_id);
+
+
+                               if($type == "component")
+                               {
+                                       $location_id = 
phpgw::get_var('location_id');
+                                       $component_id = 
phpgw::get_var('component_id');
+                                       
$check_list->set_location_id($location_id);
+                                       
$check_list->set_component_id($component_id);
+                               }
+                       }
+
+                       $check_list->set_comment($comment);
+                       $check_list->set_deadline($deadline_date_ts);
+                       $check_list->set_planned_date($planned_date_ts);
+                       $check_list->set_completed_date($completed_date_ts);
+
+                       $orig_assigned_to = $check_list->get_assigned_to();
+
+                       $check_list->set_assigned_to($assigned_to);
+
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+
+                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
+
+                       if($status == controller_check_list::STATUS_DONE && 
$required_actual_hours && $check_list->get_billable_hours() == 0 && 
!$billable_hours)
+                       {
+                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
+                               $error = true;
+                       }
+                       else
+                       {
+                               
$check_list->set_delta_billable_hours($billable_hours);
+                       }
+                       if ( $status == controller_check_list::STATUS_DONE && 
$this->_check_for_required($check_list) && !$error)
+                       {
+                               $check_list->set_status($status);
+                       }
+                       else if ($status == 
controller_check_list::STATUS_CANCELED && !$error)
+                       {
+                               $check_list->set_status($status);
+                       }
+
+                       if(!$error && $check_list->validate())
+                       {
+                               $check_list_id = $this->so->store($check_list);
+                               $serie = 
$this->so_control->get_serie($check_list->get_serie_id());
+
+                               /**
+                                * Add an iCal-event if there is a serie - and 
the checklist is visited the first time - or assigned is changed
+                                */
+                               if((phpgw::get_var('request_ical_event', 
'bool') && $check_list_id && $serie))// && !phpgw::get_var('check_list_id')) || 
($serie && $orig_assigned_to != $assigned_to) )
+                               {
+                                       $bocommon= 
CreateObject('property.bocommon');
+                                       $current_prefs_user = 
$bocommon->create_preferences('property',$GLOBALS['phpgw_info']['user']['account_id']);
+                                       $from_address = 
"{$GLOBALS['phpgw_info']['user']['fullname']}<{$current_prefs_user['email']}>";
+                                       $from_name = 
$GLOBALS['phpgw_info']['user']['fullname'];
+
+                                       $to_name = 
$GLOBALS['phpgw']->accounts->id2name($assigned_to);
+                                       $prefs_target = 
$bocommon->create_preferences('property',$assigned_to);
+                                       $to_address = $prefs_target['email'];
+
+                                       if(! $start_date = 
$check_list->get_planned_date())
+                                       {
+                                               $start_date = 
$check_list->get_deadline();
+                                       }
+                                       $startTime = $start_date + 8 * 3600;
+
+                                       $endTime = $startTime + ( 
(float)$serie['service_time'] * 3600 ) + ( (float)$serie['controle_time'] * 
3600 );
+
+                                       if($check_list->get_component_id() > 0)
+                                       {
+                                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$check_list->get_location_id(), 'id' => $check_list->get_component_id()));
+                                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+                                               $short_desc = $location_name . 
'::' . execMethod('property.soentity.get_short_description', 
array('location_id' => $check_list->get_location_id(), 'id' => 
$check_list->get_component_id()));
+                                               $location = $location_name;
+                                       }
+
+                                       $repeat_type_array = array
+                                               (
+                                                       "0"=> lang('day'),
+                                                       "1"=> lang('week'),
+                                                       "2"=> lang('month'),
+                                                       "3"=> lang('year')
+                                               );
+
+                                       $subject = 
"{$repeat_type_array[$serie['repeat_type']]}/{$serie['repeat_interval']}";
+                                       $subject .= 
"::{$serie['title']}::{$short_desc}";
+
+                                       $link_backend = 
$GLOBALS['phpgw']->link('/index.php', array(
+                                               'menuaction'    => 
'controller.uicheck_list.add_check_list',
+                                               'control_id'    => 
$check_list->get_control_id(),
+                                               'location_id'   => 
$check_list->get_location_id(),
+                                               'component_id'  => 
$check_list->get_component_id(),
+                                               'serie_id'              => 
$check_list->get_serie_id(),
+                                               'type'                  => 
'component',
+                                               'assigned_to'   => 
$check_list->get_assigned_to(),
+                                               'deadline_current'      => true
+
+                                       ),false,true,true);
+
+                                       $link_mobilefrontend = 
$GLOBALS['phpgw']->link('/mobilefrontend/index.php', array(
+                                               'menuaction'    => 
'controller.uicheck_list.add_check_list',
+                                               'control_id'    => 
$check_list->get_control_id(),
+                                               'location_id'   => 
$check_list->get_location_id(),
+                                               'component_id'  => 
$check_list->get_component_id(),
+                                               'serie_id'              => 
$check_list->get_serie_id(),
+                                               'type'                  => 
'component',
+                                               'assigned_to'   => 
$check_list->get_assigned_to(),
+                                               'deadline_current'      => true
+
+                                       ),false,true,true);
+
+                                       $html_description = "<a href 
='{$link_mobilefrontend}'>Serie#" . $check_list->get_serie_id() 
.'::Mobilefrontend</a><br/><br/>';
+                                       $html_description .= "<a href 
='{$link_backend}'>Serie#" . $check_list->get_serie_id() .'::Backend</a>';
+
+                                       $_serie_id = 
$check_list->get_serie_id();
+                                       $text_description = 
str_replace('&amp;', '&', 
"Serie#{$_serie_id}::Mobilefrontend:\\n{$link_mobilefrontend}\\n\\nSerie#{$_serie_id}::Backend:\\n{$link_backend}");
+
+                                       if($from_address && $to_address)
+                                       {
+                                               
$this->sendIcalEvent($from_name, $from_address, $to_name, $to_address, 
$startTime, $endTime, $subject, $html_description, $text_description, 
$location);
+                                       }
+                                       else
+                                       {
+                                               
phpgwapi_cache::message_set("Mangler epostadresse til avsender eller addresat - 
eller begge", 'error');
+                                       }
+                               }
+
+                               if($check_list_id > 0)
+                               {
+                                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
+                               }
+                               else
+                               {
+                                       $this->edit_check_list($check_list);
+                               }
+                       }
+                       else
+                       {
+                               if($check_list->get_id() > 0)
+                               {
+                                       $this->edit_check_list($check_list);
+                               }
+                               else
+                               {
+                                       $this->redirect(array('menuaction' => 
'controller.uicheck_list.add_check_list',
+                                               'control_id'            => 
$control_id,
+                                               'location_id'           => 
$location_id,
+                                               'component_id'          => 
$component_id,
+                                               'serie_id'                      
=> $serie_id,
+                                               'deadline_ts'           => 
$deadline_date_ts,
+                                               'type'                          
=> $type,
+                                               'assigned_to'           => 
$assigned_to,
+                                               'status'                        
=> $status,
+                                       //      'billable_hours' => 
$billable_hours
+                                       ));
+                               }
+                       }
+               }
+
+               function get_files2($location_id, $data)
+               {
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+                       $doc_types = 
isset($config->config_data['document_cat']) && 
$config->config_data['document_cat'] ? $config->config_data['document_cat'] : 
array();
+                       $sodocument     = CreateObject('property.sodocument');
+
+                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+                       $type_arr = explode('.',  $loc_arr['location']);
+                       if(count($type_arr) != 4)
+                       {
+                               return array();
+                       }
+
+                       $type           = $type_arr[1];
+                       $entity_id      = $type_arr[2];
+                       $cat_id         = $type_arr[3];
+
+                       $document_list = array();
+                       foreach ($doc_types as $doc_type)
+                       {
+                               if($doc_type)
+                               {
+                                       $document_list = 
array_merge($document_list, $sodocument->read_at_location(array(
+                                               'entity_id' => 
$entity_id,'cat_id' => $cat_id, 'p_num' =>$data['id'], 'doc_type' => $doc_type, 
'allrows' => true)));
+                               }
+                       }
+               
+//                     $valid_types = 
isset($config->config_data['document_valid_types']) && 
$config->config_data['document_valid_types'] ? str_replace ( ',' , '|' , 
$config->config_data['document_valid_types'] ) : '.pdf';
+
+                       $values = array();
+//                     if($valid_types)
+                       {
+                               $lang_view = lang('click to view file');
+                               foreach($document_list as $entry)
+                               {
+//                                     if ( 
!preg_match("/({$valid_types})$/i", $entry['document_name']) )
+//                                     {
+//                                             continue;
+//                                     }
+                                       $link_file_data = array
+                                       (
+                                               'menuaction'    => 
'property.uidocument.view_file',
+                                               'id'                    => 
$entry['document_id'],
+                                               'p_num'                 => 
$data['id'],
+                                               'cat_id'                => 
$cat_id,
+                                               'entity_id'             => 
$entity_id,
+                                       );
+
+                                       $values[] = array
+                                       (
+                                               'document_id'                   
=> $entry['document_id'],
+                                               'file_name'                     
        => $entry['document_name'],
+                                               'file_name'                     
        =>'<a href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data)."\" 
target='_blank' title='{$lang_view}'>{$entry['document_name']}</a>",
+                                               'link'                          
        => $entry['link'],
+                                               'title'                         
        => $entry['title'],
+                                               'doc_type'                      
        => $entry['doc_type'],
+                                               'document_date'                 
=> 
$GLOBALS['phpgw']->common->show_date($entry['document_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
+                                       );
+                               }
+                       }
+                       return $values;
+               }
+               function get_files($location_id, $data)
+               {
+                       $vfs = CreateObject('phpgwapi.vfs');
+                       $vfs->override_acl = 1;
+
+                       $location_data = explode('-', $data['location_code']);
+                       $loc1 = isset($location_data[0]) && $location_data[0] ? 
$location_data[0] : 'dummy';
+
+                       $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
+
+                       $type_arr = explode('.',  $loc_arr['location']);
+
+                       if(count($type_arr) != 4)
+                       {
+                               return array();
+                       }
+
+                       $type = $type_arr[1];
+                       $entity_id = $type_arr[2];
+                       $cat_id = $type_arr[3];
+                       $category_dir = "{$type}_{$entity_id}_{$cat_id}";
+
+                       $files = $vfs->ls (array(
+                               'string' => 
"/property/{$category_dir}/{$loc1}/{$data['id']}",
+                               'relatives' => array(RELATIVE_NONE)));
+
+                       $vfs->override_acl = 0;
+
+                       $values         = array();
+                       foreach ($files as $file)
+                       {
+                               $values[] = array
+                               (
+                                       'name'          => $file['name'],
+                                       'directory'     => $file['directory'],
+                                       'file_id'       => $file['file_id'],
+                                       'mime_type'     => $file['mime_type']
+                               );
+                       }
+
+                       $link_file_data = array
+                       (
+                               'menuaction'    => 
'property.uientity.view_file',
+                               'loc1'                  => $loc1,
+                               'id'                    => $data['id'],
+                               'cat_id'                => $cat_id,
+                               'entity_id'             => $entity_id,
+                               'type'                  => $type
+                       );
+
+                       foreach($values as &$_entry )
+                       {
+                               $_entry['file_name'] = '<a 
href="'.$GLOBALS['phpgw']->link('/index.php',$link_file_data).'&amp;file_name='.urlencode($_entry['name']).'"
 target="_blank" title="'.lang('click to view 
file').'">'.$_entry['name'].'</a>';
+                       }
+
+                       return $values;
+               }
+
+               function view_control_info()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+
+                       $check_list = $this->so->get_single($check_list_id);
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+
+                               $location_name = 
execMethod('property.bolocation.get_location_name', 
$component_arr['location_code']);
+
+                               $short_desc = $location_name . '::' . 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+
+                               $component = new controller_component();
+                               $component->set_id($component_id);
+                               $component->set_location_id($location_id);
+                               
$component->set_location_code($component_arr['location_code']);
+                               $component->set_xml_short_desc($short_desc);
+                               $component_array = $component->toArray();
+
+                               $type = 'component';
+                               $building_location_code = 
$this->location_finder->get_building_location_code($component_arr['location_code']);
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                               $type = 'location';
+                               $level = 
$this->location_finder->get_location_level($location_code);
+                       }
+
+                       $year = date("Y", $check_list->get_deadline());
+                       $month = date("n", $check_list->get_deadline());
+
+                       $level = 
$this->location_finder->get_location_level($location_code);
+                       $user_role = true;
+
+                       // Fetches buildings on property
+                       $buildings_on_property = 
$this->location_finder->get_buildings_on_property($user_role, $location_code, 
$level);
+
+                       $data = array
+                       (
+                               'control'                                       
=> $control,
+                               'check_list'                            => 
$check_list,
+                               'buildings_on_property'         => 
$buildings_on_property,
+                               'location_array'                        => 
$location_array,
+                               'component_array'                       => 
$component_array,
+                               'type'                                          
=> $type,
+                               'current_year'                          => 
$year,
+                               'current_month_nr'                      => 
$month,
+                               'building_location_code'        => 
$building_location_code,
+                               'location_level'                        => 
$level
+                       );
+
+                       phpgwapi_jquery::load_widget('core');
+                       self::add_javascript('controller', 'controller', 
'check_list_update_status.js');
+
+                       
self::render_template_xsl(array('check_list/fragments/check_list_menu', 
'check_list/fragments/check_list_top_section',
+                               'check_list/fragments/nav_control_plan', 
'check_list/view_control_info',
+                               
'check_list/fragments/select_buildings_on_property'), $data);
+               }
+
+               function view_control_details()
+               {
+                       $control_id = phpgw::get_var('control_id');
+
+                       $control = $this->so_control->get_single($control_id);
+
+                       $check_list_id = phpgw::get_var('check_list_id','int');
+
+                       $check_list = $this->so->get_single($check_list_id);
+
+                       $component_id = $check_list->get_component_id();
+                       $files = array();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_arr = 
execMethod('property.soentity.read_single_eav', array('location_id' => 
$location_id, 'id' => $component_id));
+                               $files = 
$this->get_files2($location_id,$component_arr);
+                       }
+
+                       $data = array
+                       (
+                               'control'       => $control,
+                               'files'         => $files
+
+                       );
+
+                       
self::render_template_xsl('check_list/view_control_details', $data);
+               }
+
+               function view_control_items()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list = $this->so->get_single($check_list_id);
+
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+                       $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+                       $saved_groups_with_items_array = array();
+
+                       //Populating array with saved control items for each 
group
+                       foreach($control_groups as $control_group)
+                       {
+                               $saved_control_items = 
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
 $control_group->get_id());
+
+                               $control_item = 
$this->so_control_item->get_single($control_item_id);
+
+                               $saved_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
+                       }
+
+                       $data = array
+                       (
+                               'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
+                               'check_list' => $check_list
+                       );
+
+                       
self::render_template_xsl('check_list/view_control_items', $data);
+               }
+
+               public function print_check_list()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list = $this->so->get_single($check_list_id);
+
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+                       $control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+                                                                               
                $location_code = $check_list->get_location_code();
+                                                                               
                $location_array = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
+                                                                               
                $level = 
$this->location_finder->get_location_level($location_code);
+                                                                               
                //var_dump($location_array);
+
+                       $saved_groups_with_items_array = array();
+
+                       //Populating array with saved control items for each 
group
+                       foreach($control_groups as $control_group)
+                       {
+                               $saved_control_items = 
$this->so_control_item_list->get_control_items_by_control_and_group($control->get_id(),
 $control_group->get_id());
+
+                               $control_item = 
$this->so_control_item->get_single($control_item_id);
+
+                               $saved_groups_with_items_array[] = 
array("control_group" => $control_group->toArray(), "control_items" => 
$saved_control_items);
+                       }
+
+                       $data = array
+                       (
+                               'saved_groups_with_items_array' => 
$saved_groups_with_items_array,
+                               'check_list' => $check_list,
+                                                                               
                                                'control' => 
$control->toArray(),
+                                                                               
                                                'location_array' => 
$location_array,
+                                                                               
                                                'location_level' => $level
+                       );
+
+                       
self::render_template_xsl('check_list/print_check_list', $data);
+               }
+
+               // Returns check list info as JSON
+               public function get_check_list_info()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list = 
$this->so_check_list->get_single_with_check_items($check_list_id, "open");
+
+                       return json_encode($check_list);
+               }
+
+               // Returns open cases for a check list as JSON 
+               public function get_cases_for_check_list()
+               {
+                       $check_list_id = phpgw::get_var('check_list_id');
+
+                       $check_items_with_cases = 
$this->so_check_item->get_check_items_with_cases($check_list_id, null, "open", 
null);
+
+                       return json_encode($check_items_with_cases);
+               }
+
+               /**
+                * Public function for updateing status for a check list
+                * 
+                * @return json encoded array with status saved or not saved
+                */
+               public function update_status()
+               {
+                       if(!$this->add && !$this->edit)
+                       {
+                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
+                       }
+
+                       $check_list_id = phpgw::get_var('check_list_id');
+                       $check_list_status = phpgw::get_var('status');
+                       $check_list = $this->so->get_single($check_list_id);
+
+//
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+                       $ok = true;
+
+                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
+                       if($check_list_status == 
controller_check_list::STATUS_DONE && $required_actual_hours && 
$check_list->get_billable_hours() == 0)
+                       {
+                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
+                               $ok = false;
+                       }
+//
+                       if ( !$this->_check_for_required($check_list) || !$ok)
+                       {
+                               $messages = phpgwapi_cache::message_get(true);
+                               $message = '';
+                               foreach($messages as $_type => $_message)
+                               {
+                                       if($_type == 'error')
+                                       {
+                                               $i = 1;
+                                               foreach($_message as $__message)
+                                               {
+                                                       $message.= "#{$i}: " . 
preg_replace("/<\/br[^>]*>\s*\r*\n*/is", "\n", $__message['msg']) . "\n";
+                                                       $i++;
+                                               }
+                                       }
+
+                               }
+                               return json_encode( array( "status" => 
'not_saved', 'message' => $message) );
+
+                       }
+
+                       if($check_list_status == 
controller_check_list::STATUS_DONE)
+                       {
+                               $check_list->set_completed_date(time());
+                       }
+                       else
+                       {
+                               $check_list_status = 
controller_check_list::STATUS_NOT_DONE;
+                               $check_list->set_completed_date(0);
+                       }
+
+                       $check_list->set_status( $check_list_status );
+
+                       if($this->so->store($check_list))
+                       {
+                               return json_encode( array( 'status' => 
$check_list_status) );
+                       }
+                       else
+                       {
+                               return json_encode( array( "status" => 
'not_saved', 'message' => '') );
+                       }
+               }
+
+               public function query()
+               {
+
+               }
+
+               /**
+               * Check for required items on all groups and for all components 
registered to the location.
+               * @param object $check_list
+               * @return bool
+               **/
+               private function _check_for_required($check_list)
+               {
+                       $ok = true;
+                       $control = 
$this->so_control->get_single($check_list->get_control_id());
+
+                       $saved_control_groups = 
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
+
+                       $required_control_items = array();
+                       foreach ($saved_control_groups as $control_group)
+                       {       
+                               $control_items = 
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
 $control_group->get_id(), "return_array");
+                               $component_location_id = 
$control_group->get_component_location_id();
+                               $component_criteria = 
$control_group->get_component_criteria();
+
+                               foreach ($control_items as $control_item)
+                               {
+                                       if($control_item['required'])
+                                       {
+                                               
$control_item['component_location_id'] = $component_location_id;
+                                               
$control_item['component_criteria'] = $component_criteria;
+                                               $required_control_items[] = 
$control_item;
+                                       }
+                               }
+                       }
+
+                       $components_at_location = array();
+                       $control_groups_with_items_array = array();
+                       
+                       $component_id = $check_list->get_component_id();
+
+                       if($component_id > 0)
+                       {
+                               $location_id = $check_list->get_location_id();
+                               $component_id = $check_list->get_component_id();
+                               
+                               foreach ($required_control_items as 
$required_control_item)
+                               {
+                                       $_ok = 
$this->so_case->get_cases_by_component($location_id, $component_id, 
$required_control_item['id'],$check_list->get_id());
+                                       if(!$_ok)
+                                       {
+                                               $error_message =  lang('missing 
value for required') . "</br>";
+                                               $error_message .=  
"\"{$required_control_item['title']}\"</br>";
+                                               $error_message .= 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+                                               $error_message .=  "</br>";
+                                               
phpgwapi_cache::message_set($error_message, 'error');
+//                                             echo $error_message;
+                                               $ok = false;
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $location_code = 
$check_list->get_location_code();
+                               $location_code_search_components = 
$location_code;
+                               $type = 'location';
+
+                               foreach ($required_control_items as 
$required_control_item)
+                               {
+                                       $criterias_array = array();
+
+                                       $component_location_id = 
$required_control_item['component_location_id'];
+                                       $criterias_array['location_id'] = 
$component_location_id;
+                                       $criterias_array['location_code'] = 
$location_code_search_components;
+                                       $criterias_array['allrows'] = true;
+
+                                       $component_criteria = 
$required_control_item['component_criteria'];
+
+                                       $conditions = array();
+                                       foreach ($component_criteria as 
$attribute_id => $condition)
+                                       {
+                                               if($condition['value'])
+                                               {
+                                                       eval('$condition_value 
= ' . "{$condition['value']};");
+                                                       $conditions[] = array
+                                                       (
+                                                               'attribute_id'  
=> $attribute_id,
+                                                               'operator'      
        => $condition['operator'],
+                                                               'value'         
        => $condition_value
+                                                       );
+                                               }
+                                       }
+
+                                       $criterias_array['conditions'] = 
$conditions;
+
+                                       if( 
!isset($components_at_location[$component_location_id][$location_code_search_components])
  || !$_components_at_location = 
$components_at_location[$component_location_id][$location_code_search_components])
+                                       {
+                                               $_components_at_location = 
execMethod('property.soentity.get_eav_list', $criterias_array);
+                                               
$components_at_location[$component_location_id][$location_code_search_components]
 = $_components_at_location;
+                                       }
+                                               
+                                       if($_components_at_location)
+                                       {
+                                               
foreach($_components_at_location as &$_component_at_location)
+                                               {
+                                                       $_ok = 
$this->so_case->get_cases_by_component($_component_at_location['location_id'], 
$_component_at_location['id'], $required_control_item['id'], 
$check_list->get_id());
+
+                                                       if(!$_ok)
+                                                       {
+                                                               $error_message 
=  "mangler registrering for required</br>";
+                                                               $error_message 
.=  "{$required_control_item['title']}</br>";
+                                                               $error_message 
.= execMethod('property.soentity.get_short_description', array('location_id' => 
$_component_at_location['location_id'], 'id' => $_component_at_location['id']));
+                                                               $error_message 
.=  "</br>";
+                                                               
phpgwapi_cache::message_set($error_message, 'error');
+//                                                             echo 
$error_message;
+                                                               $ok = false;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       $config = CreateObject('phpgwapi.config','controller');
+                       $config->read();
+
+                       $required_actual_hours = 
isset($config->config_data['required_actual_hours']) && 
$config->config_data['required_actual_hours'] ? 
$config->config_data['required_actual_hours'] : false;
+
+                       if($check_list->get_status == 
controller_check_list::STATUS_DONE && $required_actual_hours && 
$check_list->get_billable_hours() == 0)
+                       {
+                               phpgwapi_cache::message_set(lang("Please enter 
billable hours"), 'error');
+                               $ok = false;
+                       }
+
+                       return $ok;
+               }
+
+               /**
+                * 
+                * @param string $from_name
+                * @param string $from_address
+                * @param string $to_name
+                * @param string $to_address
+                * @param int $startTime
+                * @param int $endTime
+                * @param string $subject
+                * @param string $html_description
+                * @param string $text_description
+                * @param string $location
+                * @return type
+                */
+               function sendIcalEvent($from_name, $from_address, $to_name, 
$to_address, $startTime, $endTime, $subject, 
$html_description,$text_description, $location)
+               {
+//                     
https://www.exchangecore.com/blog/sending-outlookemail-calendar-events-php/
+
+                       $domain = $GLOBALS['phpgw_info']['server']['hostname'];
+
+                       //Create Email Headers
+                       $mime_boundary = "----Meeting Booking----".md5(time());
+
+                       //Create Email Body (HTML)
+                       $message  = <<<HTML
+                       --{$mime_boundary}
+                       Content-Type: text/html; charset=UTF-8
+                       Content-Transfer-Encoding: 8bit
+
+                       <html>
+                       <body>
+                       <p>Dear {$to_name}</p>
+                       <p>{$html_description}</p>
+                       </body>
+                       </html>
+                       --{$mime_boundary}
+HTML;
+                       //Create Email Body (HTML)
+                       $message  = <<<HTML
+                       <html>
+                       <body>
+                       <p>Dear {$to_name}</p>
+                       <p>{$html_description}</p>
+                       </body>
+                       </html>
+HTML;
+
+                       $last_modified =  date("Ymd\TGis");
+                       $uid = date("Ymd\TGis", $startTime).rand()."@".$domain;
+                       $dtstamp = date("Ymd\TGis");
+                       $dtstart = date("Ymd\THis", $startTime);
+                       $dtend = date("Ymd\THis", $endTime);
+                       $timezone = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['timezone'];
+
+
+$ical = <<<HTML
+BEGIN:VCALENDAR
+PRODID: controller {$domain}
+VERSION:2.0
+CALSCALE:GREGORIAN
+METHOD:REQUEST
+X-WR-TIMEZONE:Europe/Oslo
+BEGIN:VEVENT
+ORGANIZER;CN="{$to_name}":MAILTO:{$to_address}
+ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
+DTSTAMP:{$dtstamp}
+DTSTART:{$dtstart}
+DTEND:{$dtend}
+SEQUENCE:0
+STATUS:TENTATIVE
+SUMMARY:{$subject}
+LOCATION:{$location}
+DESCRIPTION:{$text_description}
+UID:{$uid}
+BEGIN:VALARM
+TRIGGER:-PT15M
+ACTION:DISPLAY
+DESCRIPTION:Reminder
+END:VALARM
+END:VEVENT
+END:VCALENDAR
+HTML;
+
+//ORGANIZER;CN="{$from_name}":MAILTO:{$from_address}
+//ATTENDEE;CN="{$to_name}";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:{$to_address}
+
+
+
+//                     $message .= $ical;
+                       $message = $ical;
+
+
+                       //Might work....
+                       $attachment = array
+                       (
+                       //      'content'               => base64_encode($ical),
+                               'content'               => $ical,
+                               'name'                  => 'meeting.ics',
+                       //      'encoding'              => 'base64',//'7bit',
+                               'encoding'              => '7bit',
+                               'type'                  => 
"text/calendar;charset=utf-8; method=REQUEST",
+                               'disposition'   => 'inline'
+                       );
+
+//test
+                       $mail = createObject('phpgwapi.mailer_smtp');
+                       $mail->Subject = $subject;
+                       $mail->Body =<<<HTML
+                       <html>
+                       <body>
+                       <p>{$to_name}:</p>
+                       <p>{$html_description}</p>
+                       </body>
+                       </html>
+HTML;
+                       $mail->AltBody = $text_description; // For non HTML 
email client
+                       $mail->Ical = $ical; //Your manually created ical code
+                       $mail->IsHTML(true);
+                       $mail->isSMTP();
+                       $mail->AddAddress($to_address);
+
+
+                       $from = 
str_replace(array('[',']'),array('<','>'),$from_address);
+                       $from_array = explode('<', $from);
+                       unset($from);
+                       if ( count($from_array) == 2 )
+                       {
+                               $mail->From = trim($from_array[1],'>');
+                               $mail->FromName = $from_array[0];
+                       }
+                       else
+                       {
+                               $mail->From = $from_array[0];
+                               $mail->FromName = $from_name;
+                       }
+
+                       try
+                       {
+                               $mail->Send();
+                       }
+                       catch (phpmailerException $e)
+                       {
+                               phpgwapi_cache::message_set($e->getMessage(), 
'error');
+                       }
+                       return;
+//test
+                       $rc = false;
+                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                       {
+                               $send= CreateObject('phpgwapi.send');
+                               try
+                               {
+                                       $rc = $send->msg('email', $to_address, 
$subject, $message, $msgtype='Ical', $cc='', $bcc='', $from_address, 
$from_name,'html',$mime_boundary);//, array($attachment));
+                               }
+                               catch (phpmailerException $e)
+                               {
+                                       
phpgwapi_cache::message_set($e->getMessage(), 'error');
+                               }
+                       }
+                       else
+                       {
+                               phpgwapi_cache::message_set(lang('SMTP server 
is not set! (admin section)'), 'error');
+                       }
+
+                       return $rc;
+               }
+       }

Modified: branches/Version-1_0-branch/controller/js/controller/case.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/case.js        
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/js/controller/case.js        
2015-10-22 16:43:19 UTC (rev 14231)
@@ -374,8 +374,8 @@
                        status = false;
                }
        });
-
-       return status;
+        
+               return status;
 }
 
 //Updates order number for hidden field and number in front of row

Modified: 
branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl     
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl     
2015-10-22 16:43:19 UTC (rev 14231)
@@ -6,7 +6,7 @@
   
     <xsl:call-template name="check_list_top_section">
     </xsl:call-template>
-               
+
        <xsl:choose>
                <xsl:when test="buildings_on_property/child::node()">
                        <div id="choose-building-wrp">

Modified: 
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
===================================================================
--- 
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
 2015-10-22 16:30:22 UTC (rev 14230)
+++ 
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
 2015-10-22 16:43:19 UTC (rev 14231)
@@ -1,14 +1,19 @@
 <!-- $Id: view_calendar_month.xsl 9200 2012-04-21 20:05:34Z vator $ -->
 <xsl:template name="select_buildings_on_property">
   
-  <span style="display: block;font-size: 16px;margin-bottom: 8px;">Spesifiser 
lokalisering du vil registrere saken pa</span>
+  <span style="display: block;font-size: 16px;margin-bottom: 8px;">
+      Spesifiser lokalisering du vil registrere saken på.
+      <xsl:if test="mandatory_location = 1">
+          Lokalisering <u>må</u> velges før du registrerer ny sak.
+      </xsl:if>
+  </span>
   <select id="choose-building-on-property">
     <xsl:choose>
       <xsl:when test="cases_view = 'open_cases' or cases_view = 
'closed_cases'">
         <xsl:attribute name="class">view-cases</xsl:attribute>
       </xsl:when>
       <xsl:otherwise>
-        <xsl:attribute name="class">add-case</xsl:attribute>
+        <xsl:attribute name="class">add-case required</xsl:attribute>
       </xsl:otherwise>
     </xsl:choose>
     

Modified: branches/Version-1_0-branch/controller/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/config.tpl    
2015-10-22 16:30:22 UTC (rev 14230)
+++ branches/Version-1_0-branch/controller/templates/base/config.tpl    
2015-10-22 16:43:19 UTC (rev 14231)
@@ -1,91 +1,91 @@
-<!-- $Id$ -->
-<!-- BEGIN header -->
-<form method="POST" action="{action_url}">
-       <table border="0" align="center" width="85%">
-               <tr class="th">
-                       <td colspan="2"><font 
color="{th_text}">&nbsp;<b>{title}</b></font></td>
-               </tr>
-               <!-- END header -->
-               <!-- BEGIN body -->
-               <tr class="row_on">
-                       <td colspan="2">&nbsp;</td>
-               </tr>
-               <tr class="row_off">
-                       <td colspan="2">&nbsp;<b>{lang_controller} 
{lang_settings}</b></td>
-               </tr>
-               <tr class="row_on">
-                       <td>{lang_Use_ACL_for_control_areas}.</td>
-                       <td>
-                               <select name="newsettings[acl_at_control_area]">
-                                       <option value="2" 
{selected_acl_at_control_area_2}>{lang_no}</option>
-                                       <option value="1" 
{selected_acl_at_control_area_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_off">
-                       <td>{lang_required_actual_hours}.</td>
-                       <td>
-                               <select 
name="newsettings[required_actual_hours]">
-                                       <option value="" 
{selected_required_actual_hours_}>{lang_no}</option>
-                                       <option value="1" 
{selected_required_actual_hours_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_off">
-                       <td>{lang_request_ical_event}.</td>
-                       <td>
-                               <select name="newsettings[request_ical_event]">
-                                       <option value="" 
{selected_request_ical_event_}>{lang_no}</option>
-                                       <option value="1" 
{selected_request_ical_event_1}>{lang_yes}</option>
-                               </select>
-                       </td>
-               </tr>
-               <tr class="row_on">
-                       <td>Antall planlagte kontroller som skal vises.</td>
-                       <td>
-                               <input type="text" 
name="newsettings[no_of_planned_controls]" 
value="{value_no_of_planned_controls}"/>
-                       </td>
-               </tr>
-               <tr class="row_off">
-                       <td>Antall tildelte kontroller som skal vises</td>
-                       <td>
-                               <input type="text" 
name="newsettings[no_of_assigned_controls]" 
value="{value_no_of_assigned_controls}"/>
-                       </td>
-               </tr>

@@ Diff output truncated at 153600 characters. @@



reply via email to

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