[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [13061] Merge 12914:13060 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [13061] Merge 12914:13060 from trunk |
Date: |
Wed, 22 Apr 2015 17:40:31 +0000 |
Revision: 13061
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=13061
Author: sigurdne
Date: 2015-04-22 17:40:31 +0000 (Wed, 22 Apr 2015)
Log Message:
-----------
Merge 12914:13060 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/booking/inc/class.async_task_send_reminder.inc.php
branches/Version-1_0-branch/booking/inc/class.boallocation.inc.php
branches/Version-1_0-branch/booking/inc/class.boapplication.inc.php
branches/Version-1_0-branch/booking/inc/class.bobooking.inc.php
branches/Version-1_0-branch/booking/inc/class.bocommon.inc.php
branches/Version-1_0-branch/booking/inc/class.bodocument_view.inc.php
branches/Version-1_0-branch/booking/inc/class.boevent.inc.php
branches/Version-1_0-branch/booking/inc/class.boorganization.inc.php
branches/Version-1_0-branch/booking/inc/class.customer_identifier.inc.php
branches/Version-1_0-branch/booking/inc/class.menu.inc.php
branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
branches/Version-1_0-branch/booking/inc/class.socommon.inc.php
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export_file.inc.php
branches/Version-1_0-branch/booking/inc/class.soevent.inc.php
branches/Version-1_0-branch/booking/inc/class.sogroup.inc.php
branches/Version-1_0-branch/booking/inc/class.soorganization.inc.php
branches/Version-1_0-branch/booking/inc/class.soresource.inc.php
branches/Version-1_0-branch/booking/inc/class.uiaccount_code_set.inc.php
branches/Version-1_0-branch/booking/inc/class.uiallocation.inc.php
branches/Version-1_0-branch/booking/inc/class.uiapplication.inc.php
branches/Version-1_0-branch/booking/inc/class.uibooking.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.uicompleted_reservation.inc.php
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export.inc.php
branches/Version-1_0-branch/booking/inc/class.uicompleted_reservation_export_file.inc.php
branches/Version-1_0-branch/booking/inc/class.uievent.inc.php
branches/Version-1_0-branch/booking/inc/class.uigroup.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.uiseason.inc.php
branches/Version-1_0-branch/booking/jasper/templates/logo.png
branches/Version-1_0-branch/booking/js/booking/application.js
branches/Version-1_0-branch/booking/js/booking/common.js
branches/Version-1_0-branch/booking/js/booking/schedule.js
branches/Version-1_0-branch/booking/setup/default_records.inc.php
branches/Version-1_0-branch/booking/setup/phpgw_no.lang
branches/Version-1_0-branch/booking/setup/setup.inc.php
branches/Version-1_0-branch/booking/setup/tables_current.inc.php
branches/Version-1_0-branch/booking/setup/tables_update.inc.php
branches/Version-1_0-branch/booking/templates/base/account_code_dimension.xsl
branches/Version-1_0-branch/booking/templates/base/account_code_set.xsl
branches/Version-1_0-branch/booking/templates/base/account_code_set_form.xsl
branches/Version-1_0-branch/booking/templates/base/allocation_delete_preview.xsl
branches/Version-1_0-branch/booking/templates/base/application.xsl
branches/Version-1_0-branch/booking/templates/base/application_edit.xsl
branches/Version-1_0-branch/booking/templates/base/application_new.xsl
branches/Version-1_0-branch/booking/templates/base/booking_delete.xsl
branches/Version-1_0-branch/booking/templates/base/building.xsl
branches/Version-1_0-branch/booking/templates/base/building_form.xsl
branches/Version-1_0-branch/booking/templates/base/css/base.css
branches/Version-1_0-branch/booking/templates/base/organization_edit.xsl
branches/Version-1_0-branch/booking/templates/base/resource_form.xsl
branches/Version-1_0-branch/booking/templates/base/settings.xsl
branches/Version-1_0-branch/bookingfrontend/inc/class.bosearch.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.bouser.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.menu.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uiallocation.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uiapplication.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uibooking.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uibuilding.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uievent.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uiorganization.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uiresource.inc.php
branches/Version-1_0-branch/bookingfrontend/inc/class.uisearch.inc.php
branches/Version-1_0-branch/bookingfrontend/setup/phpgw_no.lang
branches/Version-1_0-branch/bookingfrontend/setup/setup.inc.php
branches/Version-1_0-branch/bookingfrontend/templates/base/config.tpl
branches/Version-1_0-branch/bookingfrontend/templates/base/search.xsl
branches/Version-1_0-branch/catch/setup/setup.inc.php
branches/Version-1_0-branch/catch/setup/tables_current.inc.php
branches/Version-1_0-branch/catch/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/inc/class.menu.inc.php
branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_info.inc.php
branches/Version-1_0-branch/controller/inc/component/class.check_list_status_manager.inc.php
branches/Version-1_0-branch/controller/inc/component/class.month_calendar.inc.php
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
branches/Version-1_0-branch/controller/inc/model/class.check_list.inc.php
branches/Version-1_0-branch/controller/inc/model/class.component.inc.php
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/setup.inc.php
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/templates/base/calendar/check_list_status_manager.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/nav_calendar_month.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/nav_calendar_year.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/add_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_details.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/view_control_info.xsl
branches/Version-1_0-branch/controller/templates/base/component.xsl
branches/Version-1_0-branch/controller/templates/base/config.tpl
branches/Version-1_0-branch/phpgwapi/inc/accounts/class.accounts_sql.inc.php
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.inc.php
branches/Version-1_0-branch/phpgwapi/templates/bkbooking/head.tpl
branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
branches/Version-1_0-branch/property/inc/class.soadmin_entity.inc.php
branches/Version-1_0-branch/property/inc/class.sodocument.inc.php
branches/Version-1_0-branch/property/inc/class.soentity.inc.php
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uiadmin_entity.inc.php
branches/Version-1_0-branch/property/inc/class.uidocument.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
branches/Version-1_0-branch/property/inc/cron/default/import_oppdatering_av_bestilling_fra_agresso_bkb.php
branches/Version-1_0-branch/property/inc/soap_client/bra5/soap.php
branches/Version-1_0-branch/property/setup/phpgw_no.lang
branches/Version-1_0-branch/property/setup/setup.inc.php
branches/Version-1_0-branch/property/setup/tables_current.inc.php
branches/Version-1_0-branch/property/setup/tables_update.inc.php
branches/Version-1_0-branch/property/templates/base/admin_entity.xsl
Added Paths:
-----------
branches/Version-1_0-branch/booking/inc/class.sopermission_event.inc.php
branches/Version-1_0-branch/booking/inc/class.uiapplication_settings.inc.php
branches/Version-1_0-branch/booking/inc/class.uievent_mail_settings.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/jasper/templates/logo.jpg
branches/Version-1_0-branch/booking/templates/base/application_settings.xsl
branches/Version-1_0-branch/booking/templates/base/event_mail_settings.xsl
branches/Version-1_0-branch/booking/templates/base/mail_settings.xsl
branches/Version-1_0-branch/booking/templates/base/metasettings.xsl
branches/Version-1_0-branch/bookingfrontend/change.php
branches/Version-1_0-branch/bookingfrontend/inc/custom/default/MinId.php
branches/Version-1_0-branch/bookingfrontend/templates/fjell/
branches/Version-1_0-branch/bookingfrontend/templates/stavanger/
branches/Version-1_0-branch/controller/inc/class.uicomponent.inc.php
branches/Version-1_0-branch/controller/inc/hook_config.inc.php
Property Changed:
----------------
branches/Version-1_0-branch/
branches/Version-1_0-branch/booking/
branches/Version-1_0-branch/bookingfrontend/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,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
+ /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
Property changes on: branches/Version-1_0-branch/booking
___________________________________________________________________
Added: 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
Modified:
branches/Version-1_0-branch/booking/inc/class.async_task_send_reminder.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.async_task_send_reminder.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++
branches/Version-1_0-branch/booking/inc/class.async_task_send_reminder.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -111,14 +111,23 @@
private function create_body_text($from, $to, $where, $who,
$id, $secret, $type, $external_site_address)
{
- $body = "Informasjon om kommende arrangement:\n";
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $body = "Informasjon om kommende arrangement:\n";
$body .= "Hvor: %WHERE%\n";
$body .= "Når: %WHEN%\n";
if (strlen($who) > 0)
{
$body .= "Hvem: %WHO%\n";
}
- $body .= "\nBergen kommune fører statistikk på bruk av
lokaler og ber derfor om at dere \n";
+ if ($config->config_data['metatag_author'] != '') {
+ $body .= "\n".$config->config_data['metatag_author'];
+ } else {
+ $body .= "\nAktivby ";
+ }
+
+ $body .= " fører statistikk på bruk av lokaler og ber
derfor om at dere \n";
$body .= "\netter arrangementet melder inn korrekt
deltakertall til oss.\n";
$body .= "Du kan gjøre dette ved å klikke på linken
nedenfor.\n\n%URL%";
Modified: branches/Version-1_0-branch/booking/inc/class.boallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.boallocation.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.boallocation.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -10,6 +10,162 @@
}
/**
+ * @ Send message about cancelation to users of building.
+ */
+ function send_notification($allocation, $maildata,
$mailadresses)
+ {
+ if
(!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ if($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on')
+ {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ $info_deleted = $info_deleted."".$res_names." -
";
+ $info_deleted .= pretty_timestamp($allocation['from_'])." - ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($allocation['from_']).'&to_[]='.urlencode($allocation['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+
+ $subject =
$config->config_data['allocation_canceled_mail_subject'];
+ $body = "<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted =
$info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+ $subject =
$config->config_data['allocation_canceled_mail_subject'];
+ $body = "<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ }
+
+
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body,
'', '', '', $from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+
+ }
+
+ function send_admin_notification($allocation, $maildata,
$system_message)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n",$mailadresses);
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $subject = $system_message['title'];
+ $body = '<b>Beksjed fra '.$system_message['name'].'</b><br
/>'.$system_message['message'].'<br /><br /><b>Epost som er sendt til brukere
av Hallen:</b><br />';
+
+
+ if ($config->config_data['user_can_delete_allocations'] == 'yes') {
+ if($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on')
+ {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/?menuaction=booking.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($allocation['from_']).'&to_[]='.urlencode($allocation['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($allocation['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .=
pretty_timestamp($valid_date['from_'])." - ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/?menuaction=booking.uiapplication.add&building_id=';
+ $link .=
$allocation['building_id'].'&building_name='.urlencode($allocation['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$allocation['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply
for time').'</a><br />';
+ }
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$allocation['organization_name'].' har
avbestilt tid i '.$allocation['building_name'];
+ $body .= $info_deleted.'</p>';
+ }
+ } else {
+ $body .= "<p>Det er ikke sendt noen beskjed til brukere.</p>";
+ }
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '',
$from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+
+ }
+
+
+ /**
* @see bocommon_authorized
*/
protected function include_subject_parent_roles(array
$for_object = null)
Modified: branches/Version-1_0-branch/booking/inc/class.boapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.boapplication.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.boapplication.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -1,15 +1,17 @@
<?php
phpgw::import_class('booking.bocommon');
-
+
class booking_boapplication extends booking_bocommon
{
function __construct()
{
parent::__construct();
+ $this->activity_bo = CreateObject('booking.boactivity');
+ $this->organization_bo = CreateObject('booking.boorganization');
$this->so = CreateObject('booking.soapplication');
}
- function send_notification($application, $created=false)
+ function send_notification($application, $created=false,
$assocciated=false)
{
if
(!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
return;
@@ -20,34 +22,82 @@
$from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
$external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+ $subject =
$config->config_data['application_mail_subject'];
- $subject = 'Melding fra Bergen kommune - AktivBy';
$link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.show&id='.$application['id'].'&secret='.$application['secret'];
if ($created) {
- $body = '<p>Din søknad om leie/lån er
mottatt.</p>';
- $body .= '<p>Praktisk informasjon finner du i
dokumenter knyttet til bygget, ref. juridiske betingelser pk.8 i søknad.</p>';
- $body .= '<p>Klikk på linken under for å se på,
redigere eller ha dialog med saksbehandler om din søknad.</p>';
- $body .= '<p><a href="'.$link.'">Link til
AktivBy: søknad #'.$application['id'].'</a></p>';
+ $body =
"<pre>".$config->config_data['application_mail_created']."</pre>";
+ $body .= '<p><a href="'.$link.'">Link til
'.$config->config_data['application_mail_systemname'].': søknad
#'.$application['id'].'</a></p>';
} elseif ($application['status'] == 'PENDING') {
- $body = '<p>Din søknad i AktivBy? om leie/lån
er '.lang($application['status']).'.<br />Saksbehandler trenger ytterligere
informasjon, ber om at du klikker på linken under og gir nødvendig
tilbakemeldinger slik at saken kan ferdigbehandles.</p>';
- $body .= '<p><a href="'.$link.'">Link til
AktivBy: søknad #'.$application['id'].'</a></p>';
+ $body = "<p>Din søknad i
".$config->config_data['application_mail_systemname']." om leie/lån er
".lang($application['status']);
+ $body .=
"</p><pre>".$config->config_data['application_mail_pending']."</pre>";
+ $body .= '<p><a href="'.$link.'">Link til
'.$config->config_data['application_mail_systemname'].': søknad
#'.$application['id'].'</a></p>';
if ($application['comment'] != '') {
$body .= '<p>Kommentar fra
saksbehandler:<br />'.$application['comment'].'</p>';
}
} elseif ($application['status'] == 'ACCEPTED') {
- $body = '<p>Din søknad i AktivBy om leie/lån er
'.lang($application['status']).'.<br /> For å skrive ut en bekreftelse eller ha
dialog med saksbehandler bruk <a href="'.$link.'">Link til AktivBy: søknad
#'.$application['id'].'</a></p>';
+ $accepted =
$this->so->get_accepted($application['id']);
+ $adates = "";
+ foreach ($accepted as $key => $date) {
+ if($key === 0)
+ $adates .= implode(" -
",$date)."\n";
+ else
+ $adates .=
"\t".implode(" - ",$date)."\n";
+ }
+ $rejected =
$this->so->get_rejected($application['id']);
+ $rdates = "";
+ foreach ($rejected as $key => $date) {
+ if($key === 0)
+ $rdates .= implode(" -
",$date)."\n";
+ else
+ $rdates .=
"\t".implode(" - ",$date)."\n";
+ }
+
+ $body = "<p>Din søknad i
".$config->config_data['application_mail_systemname']." om leie/lån er
".lang($application['status']);
+ $body .=
'</p><pre>'.$config->config_data['application_mail_accepted'].'<br /><a
href="'.$link.'">Link til
'.$config->config_data['application_mail_systemname'].': søknad
#'.$application['id'].'</a></pre>';
+ $body .= "<pre>Godkjent: ".$adates."</pre>";
+ $body .= "<pre>Avvist: ".$rdates."</pre>";
+
if ($application['comment'] != '') {
- $body .= '<p>Kommentar fra
saksbehandler:<br />'.$application['comment'].'</p>';
+ $body .= "<p>Kommentar fra
saksbehandler:<br />".$application['comment']."</p>";
}
+
+ $buildingemail =
$this->get_tilsyn_email($application['building_name']);
+ if ($buildingemail['email1'] != '' ||
$buildingemail['email2'] != '' || $buildingemail['email3'] != '') {
+ $resourcename =
implode(",",$this->get_resource_name($application['resources']));
+ $bsubject =
$config->config_data['application_mail_subject'].": En søknad om leie/lån av
".$resourcename." på ".$application['building_name']." er godkjent";
+ $bbody =
"<p>".$application['contact_name']." sin søknad om leie/lån av
".$resourcename." på ".$application['building_name']."</p>";
+ $bbody .= "<p>Den ".$adates."er
Godkjent</p>";
+ $bbody .= "<p><b>Ekstra informasjon fra søker:</b><br
/>".$application['equipment']."</p>";
+
+ foreach ($buildingemail as $bemail)
+ {
+ try
+ {
+ $send->msg('email',
$bemail, $bsubject, $bbody, '', '', '', $from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if
something goes wrong
+ }
+
+ }
+ }
} elseif ($application['status'] == 'REJECTED') {
- $body = '<p>Din søknad i AktivBy om leie/lån er
'.lang($application['status']).'.<br />For ytterligere informasjon se <a
href="'.$link.'">Link til AktivBy: søknad #'.$application['id'].'</a></p>';
+ $body = "<p>Din søknad i
".$config->config_data['application_mail_systemname']." om leie/lån er
".lang($application['status']);
+ $body .=
'</p><pre>'.$config->config_data['application_mail_rejected'].' <a
href="'.$link.'">Link til
'.$config->config_data['application_mail_systemname'].': søknad
#'.$application['id'].'</a></pre>';
if ($application['comment'] != '') {
$body .= '<p>Kommentar fra
saksbehandler:<br />'.$application['comment'].'</p>';
}
- }
- $body .= '<p>Med vennlig hilsen AktivBy - Bergen
Kommune</p>';
+ } else {
+ $subject =
$config->config_data['application_comment_mail_subject'];
+ $body =
"<pre><p>".$config->config_data['application_comment_added_mail']."</p>";
+ $body .= '<p>Kommentar fra saksbehandler:<br
/>'.$application['comment'].'</p></pre>';
+ $body .= '<p><a href="'.$link.'">Link til
'.$config->config_data['application_mail_systemname'].': søknad
#'.$application['id'].'</a></p>';
+ }
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
try
{
@@ -58,8 +108,65 @@
// TODO: Inform user if something goes wrong
}
}
-
- /**
+
+ /**
+ * @ Send message about comment on application to case officer.
+ */
+ function send_admin_notification($application, $message = null)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config', 'booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $subject =
$config->config_data['application_comment_mail_subject_caseofficer'];
+
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n", $mailadresses);
+
+ if ($GLOBALS['phpgw_info']['server']['webserver_url'] != '' &&
isset($config->config_data['external_site_address']))
+ $link = $external_site_address .
$GLOBALS['phpgw_info']['server']['webserver_url'] .
'/index.php?menuaction=booking.uiapplication.show&id=' . $application['id'];
+ else
+ $link = $external_site_address .
'/index.php?menuaction=booking.uiapplication.show&id=' . $application['id'];
+
+ $activity =
$this->activity_bo->read_single($application['activity_id']);
+
+ if (strlen($application['customer_organization_number']) == 9) {
+ $orgid =
$this->organization_bo->so->get_orgid($application['customer_organization_number']);
+ $organization = $this->organization_bo->read_single($orgid);
+ $body = '<b>Kommentar fra ' . $organization['name'] . '</b><br
/>' . $message . '<br /><br/>';
+ } else {
+ $body = '<b>Kommentar fra
'.$application['contact_name'].'</b><br />'.$message.'<br /><br/>';
+ }
+
+ $body .= '<b>Bygg: </b>'.$application['building_name'].'<br />';
+ $body .= '<b>Aktivitet: </b>'.$activity['name'].'<br /><br />';
+ $body .= '<b>Kontaktperson:</b>
'.$application['contact_name'].'<br />';
+ $body .= '<b>Epost:</b> '.$application['contact_email'].'<br />';
+ $body .= '<b>Telefon:</b> '.$application['contact_phone'].'<br
/><br />';
+ $body .= '<a href="'.$link.'">Lenke til søknad</a><br /><br />';
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '',
$from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+
+ /**
* Returns an array of application ids from applications
assocciated with buildings
* which the given user has access to
*
@@ -70,6 +177,11 @@
$applications = array();
$this->db = & $GLOBALS['phpgw']->db;
+# $sql = "select distinct ap.id
+# from bb_application ap
+# inner join bb_application_resource ar
on ar.application_id = ap.id
+# inner join bb_resource re on re.id =
ar.resource_id
+# inner join bb_building bu on bu.id =
re.building_id";
$sql = "select distinct ap.id
from bb_application ap
inner join bb_application_resource ar
on ar.application_id = ap.id
@@ -93,20 +205,19 @@
if (!isset($params['filters'])) $params['filters'] =
array();
$where_clauses = !isset($params['filters']['where']) ?
array() : (array)$params['filters']['where'];
-
+
if (!is_null($for_case_officer_id[0])) {
$where_clauses[] =
"(%%table%%.display_in_dashboard = 1 AND %%table%%.case_officer_id =
".intval($for_case_officer_id[1]).')';
} else {
$where_clauses[] = "(%%table%%.case_officer_id
= ".intval($for_case_officer_id[1]).')';
}
-
if ($building_id = phpgw::get_var('filter_building_id',
'int', 'GET', false)) {
$where_clauses[] = "(%%table%%.id IN (SELECT
DISTINCT a.id FROM bb_application a, bb_application_resource ar, bb_resource r
WHERE ar.application_id = a.id AND ar.resource_id = r.id AND r.building_id =
".intval($building_id)."))";
}
-
+
if ( $status = phpgw::get_var('status') != '') {
- $params['filters']['status'] = phpgw::get_var('status');
+ $params['filters']['status'] = phpgw::get_var('status');
}
$params['filters']['where'] = $where_clauses;
@@ -123,4 +234,4 @@
parent::__construct();
$this->so = new booking_soapplication_association();
}
- }
+ }
\ No newline at end of file
Modified: branches/Version-1_0-branch/booking/inc/class.bobooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.bobooking.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.bobooking.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -29,8 +29,251 @@
$this->event_so = CreateObject('booking.soevent');
$this->season_bo = CreateObject('booking.boseason');
}
-
+
/**
+ * @ Send message about cancelation to users of building.
+ */
+ function send_notification($booking, $allocation, $maildata,
$mailadresses, $valid_dates=null)
+ {
+ if
(!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+
+ if(($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] != 'on') ||
+ ($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] == 'on' &&
+ $maildata['allocation'] == 0))
+ {
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($booking['from_']).'&to_[]='.urlencode($booking['to_']).'&resource='.$booking['resources'][0];
+
+ $subject =
$config->config_data['booking_canceled_mail_subject'];
+
+ $body = "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '</p><p>'.$booking['group_name'].' har avbestilt tid
i '.$booking['building_name'].':<br />';
+ $body .= $this->so->get_resource($booking['resources'][0]).'
den '.pretty_timestamp($booking['from_']);
+ $body .=' til '.pretty_timestamp($booking['to_']);
+ $body .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a></p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] != 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." -
";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+ $subject =
$config->config_data['booking_canceled_mail_subject'];
+
+ $body = "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] == 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ if (!in_array($valid_date,$maildata['delete'])) {
+ $info_deleted =
$info_deleted."".$res_names." - ";
+ $info_deleted .=
pretty_timestamp($valid_date['from_'])." - ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply
for time').'</a><br />';
+ }
+ }
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted =
$info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+
+ $subject =
$config->config_data['allocation_canceled_mail_subject'];
+ $body = "<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names =
$res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted =
$info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+ $subject =
$config->config_data['allocation_canceled_mail_subject'];
+ $body = "<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+ }
+
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body,
'', '', '', $from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+ function send_admin_notification($booking, $maildata, $system_message,
$allocation, $valid_dates=null)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ $subject = $system_message['title'];
+ $body = '<b>Beskjed fra '.$system_message['name'].'</b><br
/>'.$system_message['message'].'<br /><br /><b>Epost som er sendt til brukere
av Hallen:</b><br />';
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n",$mailadresses);
+
+ if(($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] != 'on') ||
+ ($maildata['outseason'] != 'on' && $maildata['recurring'] !=
'on' && $maildata['delete_allocation'] == 'on' &&
+ $maildata['allocation'] == 0))
+ {
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($booking['from_']).'&to_[]='.urlencode($booking['to_']).'&resource='.$booking['resources'][0];
+
+ $body .= "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '</p><p>'.$booking['group_name'].' har avbestilt tid
i '.$booking['building_name'].':<br />';
+ $body .= $this->so->get_resource($booking['resources'][0]).'
den '.pretty_timestamp($booking['from_']);
+ $body .=' til '.pretty_timestamp($booking['to_']);
+ $body .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a></p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] != 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+ $body .= "<p>".$config->config_data['booking_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } elseif (($maildata['outseason'] == 'on' ||
$maildata['recurring'] == 'on') && $maildata['delete_allocation'] == 'on') {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($valid_dates as $valid_date) {
+ if (!in_array($valid_date,$maildata['delete'])) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .=
pretty_timestamp($valid_date['from_'])." - ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply
for time').'</a><br />';
+ }
+ }
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($valid_date['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($valid_date['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']).'&from_[]=';
+ $link .=
urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+
+
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+
+ } else {
+ $res_names = '';
+ foreach ($booking['resources'] as $res) {
+ $res_names = $res_names.$this->so->get_resource($res)." ";
+ }
+ $info_deleted = ':<p>';
+ foreach ($maildata['delete'] as $valid_date) {
+ $info_deleted = $info_deleted."".$res_names." - ";
+ $info_deleted .= pretty_timestamp($allocation['from_'])."
- ";
+ $info_deleted .= pretty_timestamp($allocation['to_']);
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+ $link .=
$booking['building_id'].'&building_name='.urlencode($booking['building_name']);
+ $link .=
'&from_[]='.urlencode($valid_date['from_']).'&to_[]='.urlencode($valid_date['to_']).'&resource='.$booking['resources'][0];
+ $info_deleted .= ' - <a href="'.$link.'">'.lang('Apply for
time').'</a><br />';
+ }
+ $body .=
"<p>".$config->config_data['allocation_canceled_mail'];
+ $body .= '<br />'.$booking['group_name'].' har avbestilt tid i
'.$booking['building_name'];
+ $body .= $info_deleted.'</p>';
+ }
+
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '',
$from, '', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+
+ /**
* @see bocommon_authorized
*/
protected function include_subject_parent_roles(array
$for_object = null)
@@ -176,11 +419,315 @@
*
* @return array containing values from $array for the keys in
$keys.
*/
- function building_schedule($building_id, $date)
+
+// todo: remove debug kode
+ function building_schedule($building_id, $date)
+ {
+// echo "debug:\n";
+ $from = clone $date;
+ $from->setTime(0, 0, 0);
+ // Make sure $from is a monday
+ if($from->format('w') != 1)
+ {
+ $from->modify('last monday');
+ }
+ $to = clone $from;
+ $to->modify('+7 days');
+ $allocation_ids =
$this->so->allocation_ids_for_building($building_id, $from, $to);
+ $allocations = $this->allocation_so->read(array('filters'=>
array('id' => $allocation_ids)));
+ $allocations = $allocations['results'];
+ foreach($allocations as &$allocation)
+ {
+ $allocation['name'] = $allocation['organization_name'];
+ $allocation['shortname'] =
$allocation['organization_shortname'];
+ $allocation['type'] = 'allocation';
+ }
+
+ $booking_ids = $this->so->booking_ids_for_building($building_id,
$from, $to);
+ $bookings = $this->so->read(array('filters'=> array('id' =>
$booking_ids)));
+ $bookings = $bookings['results'];
+ foreach($bookings as &$booking)
+ {
+ $booking['name'] = $booking['group_name'];
+ $booking['shortname'] = $booking['group_shortname'];
+ $booking['type'] = 'booking';
+ unset($booking['audience']);
+ unset($booking['agegroups']);
+ }
+
+ $allocations = $this->split_allocations($allocations, $bookings);
+
+ $event_ids = $this->so->event_ids_for_building($building_id,
$from, $to);
+ $events = $this->event_so->read(array('filters'=> array('id' =>
$event_ids)));
+ $events = $events['results'];
+ foreach($events as &$event)
+ {
+
+ $event['name'] = $event['description'];
+ $event['type'] = 'event';
+ unset($event['comments']);
+ unset($event['audience']);
+ unset($event['agegroups']);
+ unset($event['dates']);
+
+ }
+
+ $bookings = array_merge($allocations, $bookings);
+// echo "before rem\n";
+ $bookings = $this->_remove_event_conflicts($bookings, $events);
+// echo "after rem\n";
+
+ $bookings = array_merge($events, $bookings);
+
+ $resource_ids = $this->so->resource_ids_for_bookings($booking_ids);
+ $resource_ids = array_merge($resource_ids,
$this->so->resource_ids_for_allocations($allocation_ids));
+ $resource_ids = array_merge($resource_ids,
$this->so->resource_ids_for_events($event_ids));
+ $resources = $this->resource_so->read(array('filters' =>
array('id' => $resource_ids, 'active' => 1)));
+ $resources = $resources['results'];
+
+ foreach ($resources as $key => $row) {
+ $sort[$key] = $row['sort'];
+ }
+
+ // Sort the resources with sortkey ascending
+ // Add $resources as the last parameter, to sort by the common key
+ array_multisort($sort, SORT_ASC, $resources);
+ $bookings = $this->_split_multi_day_bookings($bookings, $from,
$to);
+ $results = build_schedule_table($bookings, $resources);
+// exit;
+ return array('total_records'=>count($results),
'results'=>$results);
+ }
+
+ function building_infoscreen_schedule($building_id, $date, $res
= False)
{
+ $from = clone $date;
+ $from->setTime(0, 0, 0);
+ // Make sure $from is a monday
+ if($from->format('w') != 1)
+ {
+ $from->modify('last monday');
+ }
+ $to = clone $from;
+ $to->modify('+7 days');
+ $to->modify('-1 minute');
+ if ($res != False){
+ $resources = $this->so->get_screen_resources($building_id,
$res);
+ if (count($resources) > 0)
+ $resources = "AND bb_resource.id IN (".implode(",",
$resources).")";
+ else
+ $resources = '';
+ }
+ $allocations = $this->so->get_screen_allocation($building_id,
$from, $to, $resources);
+ $bookings = $this->so->get_screen_booking($building_id, $from,
$to, $resources);
+ $events = $this->so->get_screen_event($building_id, $from, $to,
$resources);
- $from = clone $date;
+ $results = array();
+
+ foreach($allocations as &$allocation)
+ {
+ $allocation['name'] =
$allocation['organization_name'];
+ $allocation['shortname'] =
$allocation['organization_shortname'];
+ $allocation['type'] = 'allocation';
+
+ $datef = strtotime($allocation['from_']);
+ $allocation['weekday'] = date('D',$datef);
+ }
+
+ foreach($bookings as &$booking)
+ {
+ $booking['name'] = $booking['group_name'];
+ $booking['shortname'] =
$booking['group_shortname'];
+ $booking['type'] = 'booking';
+
+ $datef = strtotime($booking['from_']);
+ $booking['weekday'] = date('D',$datef);
+ }
+
+ foreach($events as &$event)
+ {
+ $event['name'] = substr($event['description'], 0, 34);
+ $event['shortname'] = substr($event['description'], 0, 12);
+ $event['type'] = 'event';
+ $datef = strtotime($event['from_']);
+ $event['weekday'] = date('D',$datef);
+ }
+
+ $allocations = $this->split_allocations2($allocations, $bookings);
+ $bookings = array_merge($allocations, $bookings);
+ $bookings = $this->_remove_event_conflicts2($bookings, $events);
+ $bookings = array_merge($bookings, $events);
+ $bookings = $this->_split_multi_day_bookings2($bookings, $from,
$to);
+
+ foreach($bookings as &$allocation)
+ {
+ $datef = strtotime($allocation['from_']);
+ $datet = strtotime($allocation['to_']);
+ $timef = date('H:i:s',$datef);
+ $timet = date('H:i:s',$datet);
+ $weekday = $allocation['weekday'];
+ $resname = $allocation['resource_name'];
+ $ft = $timef;
+ $from = explode(':',$timef);
+ $to = explode(':',$timet);
+ $from = $from[0]*60+$from[1];
+ $to = $to[0]*60+$to[1];
+ if ($to == 0)
+ $to = 24*60;
+ $colspan = ($to-$from)/30;
+
+ $allocation['colspan'] = $colspan;
+ $results[$weekday][$resname][$ft] = $allocation;
+ }
+
+ foreach ($results as &$day) {
+ foreach ($day as &$res) {
+ ksort($res);
+ }
+ }
+
+ return array('total_records'=>count($results),
'results'=>$results);
+ }
+
+ function split_allocations2($allocations, $all_bookings)
+ {
+ function get_from2($a) {return $a['from_'];};
+ function get_to2($a) {return $a['to_'];};
+ $new_allocations = array();
+ foreach($allocations as $allocation)
+ {
+ // $ Find all associated bookings
+ $bookings = array();
+
+ foreach($all_bookings as $b)
+ {
+ if($b['allocation_id'] == $allocation['id'])
+ $bookings[] = $b;
+ }
+ $times = array($allocation['from_'], $allocation['to_']);
+
+ $times = array_merge(array_map("get_from2", $bookings),
$times);
+ $times = array_merge(array_map("get_to2", $bookings), $times);
+ $times = array_unique($times);
+ sort($times);
+ while(count($times) >= 2)
+ {
+ $from_ = $times[0];
+ $to_ = $times[1];
+ $resources = array($allocation['resource_id']);
+ foreach($all_bookings as $b)
+ {
+
+ if(($b['from_'] >= $from_ && $b['from_'] < $to_) ||
($b['to_'] > $from_ && $b['to_'] <= $to_) || ($b['from_'] <= $from_ &&
$b['to_'] >= $to_))
+ $resources = array_minus($resources,
array($b['resource_id']));
+ }
+ if($resources)
+ {
+ $a = $allocation;
+ $a['from_'] = $times[0];
+ $a['to_'] = $times[1];
+ $new_allocations[] = $a;
+ }
+ array_shift($times);
+ }
+ }
+ return $new_allocations;
+ }
+
+ function _remove_event_conflicts2($bookings, &$events)
+ {
+ $new_bookings = array();
+ foreach($bookings as $b)
+ {
+ $keep = true;
+ foreach($events as &$e)
+ {
+ if((($b['from_'] >= $e['from_'] && $b['from_'] <
$e['to_']) ||
+ ($b['to_'] > $e['from_'] && $b['to_'] <=
$e['to_']) ||
+ ($b['from_'] <= $e['from_'] && $b['to_'] >=
$e['to_'])) && ( $b['resource_id'] == $e['resource_id']))
+ {
+ $keep = false;
+ break;
+ }
+ }
+ if($keep)
+ {
+ $new_bookings[] = $b;
+ }
+ }
+ return $new_bookings;
+ }
+
+ function _split_multi_day_bookings2($bookings, $t0, $t1)
+ {
+ if($t1->format('H:i') == '00:00')
+ $t1->modify('-1 day');
+ $new_bookings = array();
+ foreach($bookings as $booking)
+ {
+ $from = new DateTime($booking['from_']);
+ $to = new DateTime($booking['to_']);
+ // Basic one-day booking
+ if($from->format('Y-m-d') == $to->format('Y-m-d'))
+ {
+ $booking['date'] = $from->format('Y-m-d');
+ $booking['weekday'] =
date_format(date_create($booking['date']), 'D');
+ $booking['from_'] = $from->format('H:i');
+ $booking['to_'] = $to->format('H:i');
+ // We need to use 24:00 instead of 00:00 to sort correctly
+ $booking['to_'] = $booking['to_'] == '00:00' ? '24:00' :
$booking['to_'];
+ $new_bookings[] = $booking;
+ }
+ // Multi-day booking
+ else
+ {
+ $start = clone max($from, $t0);
+ $end = clone min($to, $t1);
+ $date = clone $start;
+ do
+ {
+ $new_booking = $booking;
+ $new_booking['date'] = $date->format('Y-m-d');
+ $new_booking['weekday'] = date_format($date, 'D');
+ $new_booking['from_'] = '00:00';
+ $new_booking['to_'] = '00:00';
+ if($new_booking['date'] == $from->format('Y-m-d'))
+ {
+ $new_booking['from_'] = $from->format('H:i');
+ }
+ else if($new_booking['date'] == $to->format('Y-m-d'))
+ {
+ $new_booking['to_'] = $to->format('H:i');
+ }
+ // We need to use 24:00 instead of 00:00 to sort
correctly
+ $new_booking['to_'] = $new_booking['to_'] == '00:00' ?
'24:00' : $new_booking['to_'];
+ $new_bookings[] = $new_booking;
+
+ if($date->format('Y-m-d') == $end->format('Y-m-d'))
+ {
+ break;
+ }
+
+ // if($date->getTimestamp() >
$end->getTimestamp()) // > php 5.3.0
+ if($date->format("U") > $end->format("U"))
+ {
+ throw new InvalidArgumentException('start time( '
. $date->format('Y-m-d') . ' ) later than end time( ' . $end->format('Y-m-d') .
" ) for {$booking['type']}#{$booking['id']}::{$booking['name']}");
+ }
+
+ $date->modify('+1 day');
+ }
+ while(true);
+ }
+ }
+ return $new_bookings;
+ }
+
+ function building_extraschedule($building_id, $date)
+ {
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = clone $date;
$from->setTime(0, 0, 0);
// Make sure $from is a monday
if($from->format('w') != 1)
@@ -190,7 +737,10 @@
$to = clone $from;
$to->modify('+7 days');
$allocation_ids =
$this->so->allocation_ids_for_building($building_id, $from, $to);
- $allocations =
$this->allocation_so->read(array('filters'=> array('id' => $allocation_ids)));
+
+ $orgids = explode(",", $config->config_data['extra_schedule_ids']);
+
+ $allocations =
$this->allocation_so->read(array('filters'=> array('id' => $allocation_ids,
'organization_id' => $orgids), 'sort'=>'from_'));
$allocations = $allocations['results'];
foreach($allocations as &$allocation)
{
@@ -200,7 +750,7 @@
}
$booking_ids =
$this->so->booking_ids_for_building($building_id, $from, $to);
- $bookings = $this->so->read(array('filters'=>
array('id' => $booking_ids)));
+ $bookings = $this->so->read(array('filters'=>
array('id' => $booking_ids), 'sort'=>'from_'));
$bookings = $bookings['results'];
foreach($bookings as &$booking)
{
@@ -214,7 +764,7 @@
$allocations = $this->split_allocations($allocations,
$bookings);
$event_ids =
$this->so->event_ids_for_building($building_id, $from, $to);
- $events = $this->event_so->read(array('filters'=>
array('id' => $event_ids)));
+ $events = $this->event_so->read(array('filters'=>
array('id' => $event_ids), 'sort'=>'from_'));
$events = $events['results'];
foreach($events as &$event)
{
@@ -228,7 +778,6 @@
$bookings = array_merge($allocations, $bookings);
$bookings = $this->_remove_event_conflicts($bookings,
$events);
- $bookings = array_merge($events, $bookings);
$resource_ids =
$this->so->resource_ids_for_bookings($booking_ids);
$resource_ids = array_merge($resource_ids,
$this->so->resource_ids_for_allocations($allocation_ids));
@@ -257,199 +806,324 @@
*
* @return array containg values from $array for the keys in
$keys.
*/
- function resource_schedule($resource_id, $date)
- {
- $from = clone $date;
- $from->setTime(0, 0, 0);
- // Make sure $from is a monday
- if($from->format('w') != 1)
- {
- $from->modify('last monday');
- }
- $to = clone $from;
- $to->modify('+7 days');
- $resource =
$this->resource_so->read_single($resource_id);
- $allocation_ids =
$this->so->allocation_ids_for_resource($resource_id, $from, $to);
- $allocations =
$this->allocation_so->read(array('filters'=> array('id' => $allocation_ids)));
- $allocations = $allocations['results'];
- foreach($allocations as &$allocation)
- {
- $allocation['name'] =
$allocation['organization_name'];
- $allocation['shortname'] =
$allocation['organization_shortname'];
- $allocation['type'] = 'allocation';
- }
- $booking_ids =
$this->so->booking_ids_for_resource($resource_id, $from, $to);
- $bookings = $this->so->read(array('filters'=>
array('id' => $booking_ids)));
- $bookings = $bookings['results'];
- foreach($bookings as &$booking)
- {
- $booking['name'] = $booking['group_name'];
- $booking['shortname'] =
$booking['group_shortname'];
- $booking['type'] = 'booking';
- }
- $allocations = $this->split_allocations($allocations,
$bookings);
+ function resource_schedule($resource_id, $date)
+ {
+ $from = clone $date;
+ $from->setTime(0, 0, 0);
+ // Make sure $from is a monday
+ if($from->format('w') != 1)
+ {
+ $from->modify('last monday');
+ }
+ $to = clone $from;
+ $to->modify('+7 days');
+ $resource = $this->resource_so->read_single($resource_id);
+ $allocation_ids =
$this->so->allocation_ids_for_resource($resource_id, $from, $to);
+ $allocations = $this->allocation_so->read(array('filters'=>
array('id' => $allocation_ids)));
+ $allocations = $allocations['results'];
+ foreach($allocations as &$allocation)
+ {
+ $allocation['name'] = $allocation['organization_name'];
+ $allocation['shortname'] =
$allocation['organization_shortname'];
+ $allocation['type'] = 'allocation';
+ }
+ $booking_ids = $this->so->booking_ids_for_resource($resource_id,
$from, $to);
+ $bookings = $this->so->read(array('filters'=> array('id' =>
$booking_ids)));
+ $bookings = $bookings['results'];
+ foreach($bookings as &$booking)
+ {
+ $booking['name'] = $booking['group_name'];
+ $booking['shortname'] = $booking['group_shortname'];
+ $booking['type'] = 'booking';
+ }
+ $allocations = $this->split_allocations($allocations, $bookings);
- $event_ids =
$this->so->event_ids_for_resource($resource_id, $from, $to);
- $events = $this->event_so->read(array('filters'=>
array('id' => $event_ids)));
- $events = $events['results'];
- foreach($events as &$event)
- {
- $event['name'] = $event['description'];
- $event['type'] = 'event';
- }
- $bookings = array_merge($allocations, $bookings);
- $bookings = $this->_remove_event_conflicts($bookings,
$events);
- $bookings = array_merge($events, $bookings);
-
- $bookings = $this->_split_multi_day_bookings($bookings,
$from, $to);
- $results = build_schedule_table($bookings,
array($resource));
- return array('total_records'=>count($results),
'results'=>$results);
- }
+ $event_ids = $this->so->event_ids_for_resource($resource_id,
$from, $to);
+ $events = $this->event_so->read(array('filters'=> array('id' =>
$event_ids)));
+ $events = $events['results'];
+ foreach($events as &$event)
+ {
+ $event['name'] = $event['description'];
+ $event['type'] = 'event';
+ }
+ $bookings = array_merge($allocations, $bookings);
+ $bookings = $this->_remove_event_conflicts($bookings, $events);
+ $bookings = array_merge($events, $bookings);
- /**
- * Split allocations overlapped by bookings into multiple
allocations
- * to avoid overlaps
- */
- function split_allocations($allocations, $all_bookings)
- {
- function get_from2($a) {return $a['from_'];};
- function get_to2($a) {return $a['to_'];};
- $new_allocations = array();
- foreach($allocations as $allocation)
- {
- // $ Find all associated bookings
- $bookings = array();
- foreach($all_bookings as $b)
- {
- if($b['allocation_id'] ==
$allocation['id'])
- $bookings[] = $b;
- }
- $times = array($allocation['from_'],
$allocation['to_']);
- $times = array_merge(array_map("get_from2",
$bookings), $times);
- $times = array_merge(array_map("get_to2",
$bookings), $times);
- $times = array_unique($times);
- sort($times);
- while(count($times) >= 2)
- {
- $from_ = $times[0];
- $to_ = $times[1];
- $resources = $allocation['resources'];
- $used = array();
- foreach($all_bookings as $b)
- {
-
- if(($b['from_'] >= $from_ &&
$b['from_'] < $to_) || ($b['to_'] > $from_ && $b['to_'] <= $to_) ||
($b['from_'] <= $from_ && $b['to_'] >= $to_))
- $resources =
array_minus($resources, $b['resources']);
- }
- if($resources)
- {
- $a = $allocation;
- $a['from_'] = $times[0];
- $a['to_'] = $times[1];
- $new_allocations[] = $a;
- }
- array_shift($times);
- }
- }
- return $new_allocations;
- }
+ $bookings = $this->_split_multi_day_bookings($bookings, $from,
$to);
+ $results = build_schedule_table($bookings, array($resource));
+ return array('total_records'=>count($results),
'results'=>$results);
+ }
- /**
- * Split Multi-day bookings into separate single-day bookings
- **/
- function _split_multi_day_bookings($bookings, $t0, $t1)
- {
- if($t1->format('H:i') == '00:00')
- $t1->modify('-1 day');
- $new_bookings = array();
- foreach($bookings as $booking)
- {
- $from = new DateTime($booking['from_']);
- $to = new DateTime($booking['to_']);
- // Basic one-day booking
- if($from->format('Y-m-d') ==
$to->format('Y-m-d'))
- {
- $booking['date'] =
$from->format('Y-m-d');
- $booking['wday'] =
date_format(date_create($booking['date']), 'D');
- $booking['from_'] =
$from->format('H:i');
- $booking['to_'] = $to->format('H:i');
- // We need to use 24:00 instead of
00:00 to sort correctly
- $booking['to_'] = $booking['to_'] ==
'00:00' ? '24:00' : $booking['to_'];
- $new_bookings[] = $booking;
- }
- // Multi-day booking
- else
- {
- $start = clone max($from, $t0);
- $end = clone min($to, $t1);
- $date = clone $start;
- do
- {
- $new_booking = $booking;
- $new_booking['date'] =
$date->format('Y-m-d');
- $new_booking['wday'] =
date_format($date, 'D');
- $new_booking['from_'] = '00:00';
- $new_booking['to_'] = '00:00';
- if($new_booking['date'] ==
$from->format('Y-m-d'))
- {
- $new_booking['from_'] =
$from->format('H:i');
- }
- else if($new_booking['date'] ==
$to->format('Y-m-d'))
- {
- $new_booking['to_'] =
$to->format('H:i');
- }
- // We need to use 24:00 instead
of 00:00 to sort correctly
- $new_booking['to_'] =
$new_booking['to_'] == '00:00' ? '24:00' : $new_booking['to_'];
- $new_bookings[] = $new_booking;
+ /**
+ * Split allocations overlapped by bookings into multiple allocations
+ * to avoid overlaps
+ */
+ function split_allocations($allocations, $all_bookings)
+ {
+ function get_from2($a) {return $a['from_'];};
+ function get_to2($a) {return $a['to_'];};
+ $new_allocations = array();
+ foreach($allocations as $allocation)
+ {
+ // $ Find all associated bookings
+ $bookings = array();
+ foreach($all_bookings as $b)
+ {
+ if($b['allocation_id'] == $allocation['id'])
+ $bookings[] = $b;
+ }
+ $times = array($allocation['from_'], $allocation['to_']);
+ $times = array_merge(array_map("get_from2", $bookings),
$times);
+ $times = array_merge(array_map("get_to2", $bookings), $times);
+ $times = array_unique($times);
+ sort($times);
+ while(count($times) >= 2)
+ {
+ $from_ = $times[0];
+ $to_ = $times[1];
+ $resources = $allocation['resources'];
+ $used = array();
+ foreach($all_bookings as $b)
+ {
- if($date->format('Y-m-d') ==
$end->format('Y-m-d'))
- {
- break;
- }
+ if(($b['from_'] >= $from_ && $b['from_'] < $to_) ||
($b['to_'] > $from_ && $b['to_'] <= $to_) || ($b['from_'] <= $from_ &&
$b['to_'] >= $to_))
+ $resources = array_minus($resources,
$b['resources']);
+ }
+ if($resources)
+ {
+ $a = $allocation;
+ $a['from_'] = $times[0];
+ $a['to_'] = $times[1];
+ $new_allocations[] = $a;
+ }
+ array_shift($times);
+ }
+ }
+ return $new_allocations;
+ }
- // if($date->getTimestamp() >
$end->getTimestamp()) // > php 5.3.0
- if($date->format("U") >
$end->format("U"))
- {
- throw new
InvalidArgumentException('start time( ' . $date->format('Y-m-d') . ' ) later
than end time( ' . $end->format('Y-m-d') . " ) for
{$booking['type']}#{$booking['id']}::{$booking['name']}");
- }
+ /**
+ * Split Multi-day bookings into separate single-day bookings
+ **/
+ function _split_multi_day_bookings($bookings, $t0, $t1)
+ {
+ if($t1->format('H:i') == '00:00')
+ $t1->modify('-1 day');
+ $new_bookings = array();
+ foreach($bookings as $booking)
+ {
+ $from = new DateTime($booking['from_']);
+ $to = new DateTime($booking['to_']);
+ // Basic one-day booking
+ if($from->format('Y-m-d') == $to->format('Y-m-d'))
+ {
+ $booking['date'] = $from->format('Y-m-d');
+ $booking['wday'] =
date_format(date_create($booking['date']), 'D');
+ $booking['from_'] = $from->format('H:i');
+ $booking['to_'] = $to->format('H:i');
+ // We need to use 24:00 instead of 00:00 to sort correctly
+ $booking['to_'] = $booking['to_'] == '00:00' ? '24:00' :
$booking['to_'];
+ $new_bookings[] = $booking;
+ }
+ // Multi-day booking
+ else
+ {
+ $start = clone max($from, $t0);
+ $end = clone min($to, $t1);
+ $date = clone $start;
+ do
+ {
+ $new_booking = $booking;
+ $new_booking['date'] = $date->format('Y-m-d');
+ $new_booking['wday'] = date_format($date, 'D');
+ $new_booking['from_'] = '00:00';
+ $new_booking['to_'] = '00:00';
+ if($new_booking['date'] == $from->format('Y-m-d'))
+ {
+ $new_booking['from_'] = $from->format('H:i');
+ }
+ else if($new_booking['date'] == $to->format('Y-m-d'))
+ {
+ $new_booking['to_'] = $to->format('H:i');
+ }
+ // We need to use 24:00 instead of 00:00 to sort
correctly
+ $new_booking['to_'] = $new_booking['to_'] == '00:00' ?
'24:00' : $new_booking['to_'];
+ $new_bookings[] = $new_booking;
- $date->modify('+1 day');
- }
- while(true);
- }
- }
- return $new_bookings;
- }
+ if($date->format('Y-m-d') == $end->format('Y-m-d'))
+ {
+ break;
+ }
- function _remove_event_conflicts($bookings, &$events)
- {
- foreach($events as &$e)
- {
- $e['conflicts'] = array();
- }
- $new_bookings = array();
- foreach($bookings as $b)
- {
- $keep = true;
- foreach($events as &$e)
- {
- if((($b['from_'] >= $e['from_'] &&
$b['from_'] < $e['to_']) ||
- ($b['to_'] > $e['from_'] &&
$b['to_'] <= $e['to_']) ||
- ($b['from_'] <= $e['from_'] &&
$b['to_'] >= $e['to_'])) && (array_intersect($b['resources'], $e['resources'])
!= array()))
- {
- $keep = false;
- $e['conflicts'][] = $b;
- break;
- }
- }
- if($keep)
- {
- $new_bookings[] = $b;
- }
- }
- return $new_bookings;
- }
-
+ // if($date->getTimestamp() >
$end->getTimestamp()) // > php 5.3.0
+ if($date->format("U") > $end->format("U"))
+ {
+ throw new InvalidArgumentException('start time( '
. $date->format('Y-m-d') . ' ) later than end time( ' . $end->format('Y-m-d') .
" ) for {$booking['type']}#{$booking['id']}::{$booking['name']}");
+ }
+
+ $date->modify('+1 day');
+ }
+ while(true);
+ }
+ }
+ return $new_bookings;
+ }
+
+ function _remove_event_conflicts($bookings, &$events)
+ {
+ foreach($events as &$e)
+ {
+ $e['conflicts'] = array();
+ }
+ $new_bookings = array();
+ $last = array();
+ foreach($bookings as $b)
+ {
+ if ($last) {
+ foreach ($last as $l) {
+// echo $l['id']."-".$l['from_']."-".$l['to_']."\n";
+ $new_bookings[] = $l;
+ }
+ $last = array();
+ }
+ $keep = true;
+// $i = 0;
+ foreach($events as &$e)
+ {
+
+// echo $b['id']."\tfrom: ".substr($b['from_'],11,19)." to:
".substr($b['to_'],11,19)."\n";
+// echo $e['id']."\tfrom: ".substr($e['from_'],11,19)." to:
".substr($e['to_'],11,19)." ".$e['name']."\n";
+
+ if((($b['from_'] >= $e['from_'] && $b['from_'] <
$e['to_']) ||
+ ($b['to_'] > $e['from_'] && $b['to_'] <=
$e['to_']) ||
+ ($b['from_'] <= $e['from_'] && $b['to_'] >=
$e['to_'])) && (array_intersect($b['resources'], $e['resources']) != array()))
+ {
+// echo "##$i\n";
+ $keep = false;
+ $e['conflicts'][] = $b;
+
+ $bf = $b['from_'];
+ $bt = $b['to_'];
+ $ef = $e['from_'];
+ $et = $e['to_'];
+ $tmp = $b;
+
+ if ($last) {
+ $ilast = $last;
+ $last = array();
+ foreach ($ilast as $l) {
+ $lf = $l['from_'];
+ $lt = $l['to_'];
+ $tmp = $l;
+ if ($ef <= $lf && $et >= $lt) {
+// echo "B0: break ef <= bf && et >=
bt\n\n";
+ $last[] = $l;
+ break;
+ } elseif (($ef >= $lf) && ($et > $lt)) {
+// echo "B1: (ef >= lf) && (et > lt)\n";
+ $tmp['from_'] = $lf;
+ $tmp['to_'] = $ef;
+ $last[] = $tmp;
+ } elseif (($ef <= $lf) && ($et < $lt)) {
+// echo "B2: (ef <= lf) && (et < lt)\n";
+ $tmp['from_'] = $et;
+ $tmp['to_'] = $lt;
+ $last[] = $tmp;
+ } elseif (($ef > $lf) && ($et < $lt)) {
+// echo "B3: (ef > lf) && (et < lt)\n";
+ $tmp['from_'] = $lf;
+ $tmp['to_'] = $ef;
+ $last[] = $tmp;
+ $tmp['from_'] = $et;
+ $tmp['to_'] = $lt;
+ $last[] = $tmp;
+ } else {
+// echo "B4: else break\n\n";
+ $last[] = $l;
+ break;
+ }
+ }
+ } else {
+ if ($ef <= $bf && $et >= $bt) {
+// echo "A0: break ef <= bf && et >= bt\n\n";
+ break;
+ } elseif (($ef >= $bf) && ($et > $bt)) {
+// echo "A1: (ef >= bf) && (et > bt)\n";
+ $tmp['from_'] = $bf;
+ $tmp['to_'] = $ef;
+ $last[] = $tmp;
+ } elseif (($ef <= $bf) && ($et < $bt)) {
+// echo "A2: (ef <= bf) && (et < bt)\n";
+ $tmp['from_'] = $et;
+ $tmp['to_'] = $bt;
+ $last[] = $tmp;
+ } elseif (($ef > $bf) && ($et < $bt)) {
+// echo "A3: (ef > bf) && (et < bt)\n";
+ $tmp['from_'] = $bf;
+ $tmp['to_'] = $ef;
+ $last[] = $tmp;
+ $tmp['from_'] = $et;
+ $tmp['to_'] = $bt;
+ $last[] = $tmp;
+ } else {
+// echo "A4: else break\n\n";
+ break;
+ }
+ }
+// print_r($last);
+ }
+// $i+=1;
+ }
+
+ if($last)
+ {
+ foreach ($last as $l) {
+// echo $l['id']."-".$l['from_']."-".$l['to_']."\n";
+ $new_bookings[] = $l;
+ }
+ $last = array();
+ }
+
+ if($keep)
+ {
+ $new_bookings[] = $b;
+ }
+ }
+// print_r($new_bookings);
+ return $new_bookings;
+// exit;
+ }
+
+ function _remove_event_conflicts_org($bookings, &$events)
+ {
+ foreach($events as &$e)
+ {
+ $e['conflicts'] = array();
+ }
+ $new_bookings = array();
+ foreach($bookings as $b)
+ {
+ $keep = true;
+ foreach($events as &$e)
+ {
+ if((($b['from_'] >= $e['from_'] && $b['from_'] < $e['to_'])
||
+ ($b['to_'] > $e['from_'] && $b['to_'] <= $e['to_'])
||
+ ($b['from_'] <= $e['from_'] && $b['to_'] >=
$e['to_'])) && (array_intersect($b['resources'], $e['resources']) != array()))
+ {
+ $keep = false;
+ $e['conflicts'][] = $b;
+ break;
+ }
+ }
+ if($keep)
+ {
+ $new_bookings[] = $b;
+ }
+ }
+ return $new_bookings;
+ }
+
public function complete_expired(&$bookings) {
$this->so->complete_expired($bookings);
}
Modified: branches/Version-1_0-branch/booking/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.bocommon.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.bocommon.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -71,7 +71,9 @@
}
if(!isset($_SESSION['showall'])) {
- $filters['active'] = "1";
+ if(!isset($filters['application_id'])) {
+ $filters['active'] = "1";
+ }
}
return array(
Modified: branches/Version-1_0-branch/booking/inc/class.bodocument_view.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.bodocument_view.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.bodocument_view.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -12,11 +12,10 @@
public function read_regulations() {
$params = $this->build_default_read_params();
!isset($params['filters']) AND $params['filters'] =
array();
-
- $params['filters']['category'] =
array(booking_sodocument::CATEGORY_REGULATION,
booking_sodocument::CATEGORY_HMS_DOCUMENT);
-
+ $params['filters']['category'] =
array(booking_sodocument::CATEGORY_REGULATION,
+ booking_sodocument::CATEGORY_HMS_DOCUMENT,
+ booking_sodocument::CATEGORY_PRICE_LIST);
$where_filter = array();
-
if ($owner_filters = phpgw::get_var('owner', 'string'))
{
foreach($owner_filters as $filter) {
list($owner_type, $owner_id) =
explode('::', $filter);
@@ -25,9 +24,7 @@
$where_filter[] =
"(%%table%%.type=$owner_type AND %%table%%.owner_id = $owner_id)";
}
}
-
$params['filters']['where'] =
array('('.join($where_filter, ' OR ').')');
-
return $this->so->read($params);
}
}
\ No newline at end of file
Modified: branches/Version-1_0-branch/booking/inc/class.boevent.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.boevent.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.boevent.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -1,19 +1,233 @@
<?php
- phpgw::import_class('booking.bocommon');
-
- class booking_boevent extends booking_bocommon
- {
- function __construct()
- {
- parent::__construct();
- $this->so = CreateObject('booking.soevent');
- }
-
- public function complete_expired(&$events) {
- $this->so->complete_expired($events);
- }
-
- public function find_expired() {
- return $this->so->find_expired();
- }
- }
+phpgw::import_class('booking.bocommon_authorized');
+
+class booking_boevent extends booking_bocommon_authorized
+{
+ const ROLE_ADMIN = 'organization_admin';
+
+ function __construct()
+ {
+ parent::__construct();
+ $this->so = CreateObject('booking.soevent');
+ }
+ /**
+ * @see booking_bocommon_authorized
+ */
+ protected function get_subject_roles($for_object = null,
$initial_roles=array())
+ {
+ if ($this->current_app() == 'bookingfrontend') {
+ $bouser = CreateObject('bookingfrontend.bouser');
+
+ if (is_array($for_object) &&
$for_object['customer_organization_number']) {
+ $org =
$this->so->get_org($for_object['customer_organization_number']);
+ $for_object['customer_organization_id'] = $org['id'];
+ $for_object['customer_organization_name'] = $org['name'];
+ }
+
+ $org_id = is_array($for_object) ?
$for_object['customer_organization_id'] : (!is_null($for_object) ? $for_object
: null);
+
+ if ($bouser->is_organization_admin($org_id)) {
+ $initial_roles[] = array('role' => self::ROLE_ADMIN);
+ }
+ }
+ return parent::get_subject_roles($for_object, $initial_roles);
+ }
+
+ /**
+ * @see bocommon_authorized
+ */
+ protected function get_object_role_permissions(array $forObject,
$defaultPermissions)
+ {
+ if ($this->current_app() == 'booking') {
+ $defaultPermissions[booking_sopermission::ROLE_DEFAULT] = array
+ (
+ 'read' => true,
+ 'delete' => true,
+ 'write' => true,
+ 'create' => true,
+ );
+ }
+
+ if ($this->current_app() == 'bookingfrontend') {
+ $defaultPermissions[self::ROLE_ADMIN] = array
+ (
+ 'write' =>
array_fill_keys(array('active','description','from_','to_','contact_name','contact_email',
+
'contact_phone','activity_name','audience','agegroups','is_public'), true),
+ );
+ }
+
+ return $defaultPermissions;
+ }
+
+ /**
+ * @see bocommon_authorized
+ */
+ protected function get_collection_role_permissions($defaultPermissions)
+ {
+ if ($this->current_app() == 'booking')
+ {
+ $defaultPermissions[booking_sopermission::ROLE_DEFAULT]['create']
= true;
+ $defaultPermissions[booking_sopermission::ROLE_DEFAULT]['write'] =
true;
+ }
+
+ return $defaultPermissions;
+ }
+
+ public function get_permissions(array $entity)
+ {
+ return parent::get_permissions($entity);
+ }
+
+ public function complete_expired(&$events) {
+ $this->so->complete_expired($events);
+ }
+
+ public function find_expired() {
+ return $this->so->find_expired();
+ }
+
+ /**
+ * @ Send message about cancelation/modification on event to users of
building.
+ */
+ function send_notification($type, $event, $mailadresses, $orgdate = null)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+// $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uiapplication.add&building_id=';
+// $link .=
$event['building_id'].'&building_name='.urlencode($event['building_name']).'&from_[]=';
+// $link .=
urlencode($event['from_']).'&to_[]='.urlencode($event['to_']).'&resource='.implode(",",$event['resources']);
+
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uibuilding.schedule&id=';
+ $link .= $event['building_id'].'&date='.substr($event['from_'], 0, 10);
+ $body = "";
+ $subject = "";
+ if (!$type) {
+ $subject .= $config->config_data['event_canceled_mail_subject'];
+ $body .= "<p>".$config->config_data['event_canceled_mail'];
+ } else {
+ $subject .= $config->config_data['event_edited_mail_subject'];
+ $body .= "<p>".$config->config_data['event_edited_mail'];
+ }
+
+ if ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] ==
$event['to_']) {
+ $event['from_'] = $_POST['org_from'];
+ $event['to_'] = $event['from_'];
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_']);
+ }
+ elseif ($_POST['org_from'] == $event['from_'] && $_POST['org_to'] >
$event['to_']) {
+ $event['from_'] = $event['to_'];
+ $event['to_'] = $_POST['org_to'];
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_']);
+ }
+ elseif ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] >
$event['to_']) {
+ $freetime = pretty_timestamp($_POST['org_from']).' til
'.pretty_timestamp($event['from_'])." og \n";
+ $freetime .= pretty_timestamp($event['to_']).' til
'.pretty_timestamp($_POST['org_to']);
+ } else {
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_'])."\n";
+ }
+
+ $body .= '</p><p>'.$event['customer_organization_name'].' har
avbestilt tid i '.$event['building_name'].':<br />';
+ $body .= implode(",
",$this->so->get_resources(implode(",",$event['resources']))).' den '.$freetime;
+ $body .= ' - <a href="'.$link.'">'.lang('Check calendar').'</a></p>';
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '', $from,
'', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+ /**
+ * @ Send message about cancelation/modification on event to admins of
building.
+ */
+ function send_admin_notification($type, $event, $message = null, $orgdate
= null)
+ {
+ if (!(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server']))
+ return;
+ $send = CreateObject('phpgwapi.send');
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ $from = isset($config->config_data['email_sender']) &&
$config->config_data['email_sender'] ? $config->config_data['email_sender'] :
"noreply<address@hidden'phpgw_info']['server']['hostname']}>";
+
+ $external_site_address =
isset($config->config_data['external_site_address']) &&
$config->config_data['external_site_address'] ?
$config->config_data['external_site_address'] :
$GLOBALS['phpgw_info']['server']['webserver_url'];
+
+ if (!$type) {
+ $subject = $config->config_data['event_canceled_mail_subject'];
+ } else {
+ $subject = $config->config_data['event_edited_mail_subject'];
+ }
+
+ $body = '<b>Beksjed fra
'.$event['customer_organization_name'].'</b><br />'.$message.'<br /><br/>';
+ $body .= '<b>Kontaktperson:</b> '.$event['contact_name'].'<br />';
+ $body .= '<b>Epost:</b> '.$event['contact_email'].'<br />';
+ $body .= '<b>Telefon:</b> '.$event['contact_phone'].'<br /><br />';
+ $body .= '<br /><b>Epost som er sendt til brukere av Hallen:</b><br
/>';
+
+ $mailadresses = $config->config_data['emails'];
+ $mailadresses = explode("\n",$mailadresses);
+
+ $link =
$external_site_address.'/bookingfrontend/?menuaction=bookingfrontend.uibuilding.schedule&id=';
+ $link .= $event['building_id'].'&date='.substr($event['from_'], 0, 10);
+
+ if (!$type) {
+ $body .= $config->config_data['event_canceled_mail_subject'];
+ $body .= "<p>".$config->config_data['event_canceled_mail'];
+ } else {
+ $body .= $config->config_data['event_edited_mail_subject'];
+ $body .= "<p>".$config->config_data['event_edited_mail'];
+ }
+
+ if ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] ==
$event['to_']) {
+ $event['from_'] = $_POST['org_from'];
+ $event['to_'] = $event['from_'];
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_']);
+ }
+ elseif ($_POST['org_from'] == $event['from_'] && $_POST['org_to'] >
$event['to_']) {
+ $event['from_'] = $event['to_'];
+ $event['to_'] = $_POST['org_to'];
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_']);
+ }
+ elseif ($_POST['org_from'] < $event['from_'] && $_POST['org_to'] >
$event['to_']) {
+ $freetime = pretty_timestamp($_POST['org_from']).' til
'.pretty_timestamp($event['from_'])." og \n";
+ $freetime .= pretty_timestamp($event['to_']).' til
'.pretty_timestamp($_POST['org_to']);
+ } else {
+ $freetime = pretty_timestamp($event['from_']).' til
'.pretty_timestamp($event['to_'])."\n";
+ }
+
+ $body .= '</p><p>'.$event['customer_organization_name'].' har
avbestilt tid i '.$event['building_name'].':<br />';
+ $body .= implode(",
",$this->so->get_resources(implode(",",$event['resources']))).' den '.$freetime;
+ $body .= ' - <a href="'.$link.'">'.lang('Check calendar').'</a></p>';
+ $body .=
"<p>".$config->config_data['application_mail_signature']."</p>";
+
+ foreach ($mailadresses as $adr)
+ {
+ try
+ {
+ $send->msg('email', $adr, $subject, $body, '', '', '', $from,
'', 'html');
+ }
+ catch (phpmailerException $e)
+ {
+ // TODO: Inform user if something goes wrong
+ }
+ }
+ }
+
+}
\ No newline at end of file
Modified: branches/Version-1_0-branch/booking/inc/class.boorganization.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.boorganization.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.boorganization.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -51,7 +51,7 @@
if ($this->current_app() == 'bookingfrontend') {
$defaultPermissions[self::ROLE_ADMIN] = array
(
- 'write' =>
array_fill_keys(array('name','homepage','phone','email','description','street','zip_code','district','city','active','organization_number'),
true),
+ 'write' =>
array_fill_keys(array('name','homepage','phone','email','description','street','zip_code','district','city','active','organization_number','contacts'),
true),
);
}
@@ -103,8 +103,8 @@
/**
* @see soorganization
*/
- function find_building_users($building_id)
+ function find_building_users($building_id, $split = false,
$activities = array())
{
- return $this->so->find_building_users($building_id,
$this->build_default_read_params());
+ return $this->so->find_building_users($building_id,
$this->build_default_read_params(), $split, $activities);
}
}
Modified:
branches/Version-1_0-branch/booking/inc/class.customer_identifier.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.customer_identifier.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.customer_identifier.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -177,16 +177,16 @@
Event.addListener(select_input, 'change',
function(e) {
enableCustField(this[this.selectedIndex].value);
});
-
+
// Wouldn't work in IE6:
// Dom.batch(items, function(opt) {
- // Event.addListener(opt, 'click',
function(e) {
+ // Event.addListener(opt, 'click',
function(e) {
// enableCustField(this.value);
// })
// });
})();
JST;
-
+
if (is_array($entity)) {
$this->add_current_identifier_info($entity);
}
Modified: branches/Version-1_0-branch/booking/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.menu.inc.php 2015-04-22
17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.menu.inc.php 2015-04-22
17:40:31 UTC (rev 13061)
@@ -212,7 +212,13 @@
'text' => lang('Free time'),
'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=> 'booking.uireports.freetime') ),
'image' =>
array('property', 'report'),
- )
+ ),
+# 'free_time2' => array
+# (
+# 'text' => lang('Free time2'),
+# 'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction'=> 'booking.uireports.freetime2') ),
+# 'image' =>
array('property', 'report'),
+# )
)
),
);
@@ -265,6 +271,21 @@
'text' =>
lang('Documentation'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uidocumentation.index', 'appname' => 'booking') )
),
+ 'mail_settings' => array
+ (
+ 'text' =>
lang('Mail Settings'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uimail_settings.index', 'appname' => 'booking') )
+ ),
+ 'event_mail_settings'
=> array
+ (
+ 'text' =>
lang('Event Mail Settings'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uievent_mail_settings.index', 'appname' => 'booking') )
+ ),
+ 'application_settings'
=> array
+ (
+ 'text' =>
lang('Application Settings'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'booking.uiapplication_settings.index', 'appname' => 'booking') )
+ ),
'office' => array
(
'text' =>
lang('office'),
Modified: branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.soallocation.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -239,7 +239,7 @@
$season_id = $allocation['season_id'];
$resources = implode(",", $allocation['resources']);
- $sql = "SELECT id FROM bb_allocation ba2 WHERE ba2.from_ = ($from)
AND ba2.to_ = ($to) AND ba2.organization_id = ($org_id) AND ba2.season_id =
($season_id) AND EXISTS ( SELECT 1 FROM bb_allocation a,bb_allocation_resource
b WHERE a.id = b.allocation_id AND b.resource_id IN ($resources))";
+ $sql = "SELECT id FROM bb_allocation ba2 JOIN
bb_allocation_resource bar2 ON (ba2.id = bar2.allocation_id) WHERE ba2.from_ =
($from) AND ba2.to_ = ($to) AND ba2.organization_id = ($org_id) AND
ba2.season_id = ($season_id) AND bar2.resource_id IN ($resources)";
$this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
if(!$this->db->next_record())
@@ -271,6 +271,7 @@
$table_name = $this->table_name;
$sql = "DELETE FROM $table_name WHERE id = ($id)";
$db->query($sql, __LINE__, __FILE__);
+ return True;
}
public function update_id_string()
Modified: branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.soapplication.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -40,6 +40,7 @@
'column' =>
'name'
)),
'description' => array('type' =>
'string', 'query' => true, 'required' => true),
+ 'equipment' => array('type' => 'string', 'query' =>
true, 'required' => false),
'contact_name' => array('type' =>
'string', 'query' => true, 'required'=> true),
'contact_email' => array('type' =>
'string', 'required'=> true, 'sf_validator' =>
createObject('booking.sfValidatorEmail', array(), array('invalid' => '%field%
is invalid'))),
'contact_phone' => array('type' =>
'string'),
@@ -116,6 +117,74 @@
'name' => $this->db->f('name',
false));
}
+ function get_accepted($id)
+ {
+ $sql = "SELECT bad.from_, bad.to_
+ FROM bb_application ba,
bb_application_date bad, bb_event be
+ WHERE ba.id=($id)
+ AND ba.id=bad.application_id
+ AND ba.id=be.application_id
+ AND be.from_=bad.from_
+ AND be.to_=bad.to_";
+ $results = array();
+ $this->db->query($sql,__LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array('from_' =>
$this->db->f('from_', false),
+ 'to_' =>
$this->db->f('to_', false));
+ }
+ return $results;
+ }
+
+ function get_rejected($id)
+ {
+ $sql = "SELECT bad.from_, bad.to_ FROM bb_application
ba, bb_application_date bad
+ WHERE ba.id=($id)
+ AND ba.id=bad.application_id
+ AND bad.id NOT IN (SELECT bad.id
+ FROM bb_application ba,
bb_application_date bad, bb_event be
+ WHERE ba.id=($id)
+ AND ba.id=bad.application_id
+ AND ba.id=be.application_id
+ AND be.from_=bad.from_
+ AND be.to_=bad.to_)";
+ $results = array();
+ $this->db->query($sql,__LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array('from_' =>
$this->db->f('from_', false),
+ 'to_' =>
$this->db->f('to_', false));
+ }
+ return $results;
+ }
+
+ function get_tilsyn_email($id)
+ {
+ $sql = "SELECT tilsyn_email, tilsyn_email2, email FROM
bb_building where id=(select id from bb_building where name = '$id' AND active
= 1)";
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return array('email1' => $this->db->f('tilsyn_email',
false),
+ 'email2' =>
$this->db->f('tilsyn_email2', false),
+ 'email3' => $this->db->f('email', false));
+
+ }
+
+ function get_resource_name($id)
+ {
+ $list = implode(",",$id);
+ $results = array();
+ $this->db->query("SELECT name FROM bb_resource where id
IN ($list)",__LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = $this->db->f('name', false);
+ }
+ return $results;
+
+ }
+
function get_building($id)
{
$this->db->limit_query("SELECT name FROM bb_building
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
@@ -139,6 +208,38 @@
return $results;
}
+ function set_inactive($id,$type)
+ {
+ if ($type == 'event') {
+ $sql = "UPDATE bb_event SET active = 0 where id
= ($id)";
+ } elseif ($type == 'allocation') {
+ $sql = "UPDATE bb_allocation SET active = 0
where id = ($id)";
+ } elseif ($type == 'booking') {
+ $sql = "UPDATE bb_booking SET active = 0 where
id = ($id)";
+ } else {
+ throw new UnexpectedValueException('Encountered
an unexpected error');
+ }
+ $this->db->query($sql, __LINE__, __FILE__);
+ return;
+
+ }
+
+ function set_active($id,$type)
+ {
+ if ($type == 'event') {
+ $sql = "UPDATE bb_event SET active = 1 where id
= ($id)";
+ } elseif ($type == 'allocation') {
+ $sql = "UPDATE bb_allocation SET active = 1
where id = ($id)";
+ } elseif ($type == 'booking') {
+ $sql = "UPDATE bb_booking SET active = 1 where
id = ($id)";
+ } else {
+ throw new UnexpectedValueException('Encountered
an unexpected error');
+ }
+ $this->db->query($sql, __LINE__, __FILE__);
+ return;
+
+ }
+
function get_activities_main_level()
{
$results = array();
@@ -169,10 +270,37 @@
$sql = "UPDATE $table_name SET id_string = cast(id AS
varchar)";
$db->query($sql, __LINE__, __FILE__);
}
-
+ function check_collision($resources, $from_, $to_)
+ {
+ $rids = join(',', array_map("intval", $resources));
+ $sql = "SELECT ba.id
+ FROM bb_allocation ba, bb_allocation_resource bar
+ WHERE ba.id = bar.allocation_id
+ AND bar.resource_id in ($rids)
+ AND ((ba.from_ < '$from_' AND ba.to_ > '$from_')
+ OR (ba.from_ >= '$from_' AND ba.to_ <= '$to_')
+ OR (ba.from_ < '$to_' AND ba.to_ > '$to_'))
+ UNION
+ SELECT be.id
+ FROM bb_event be, bb_event_resource ber, bb_event_date
bed
+ WHERE be.id = ber.event_id
+ AND be.id = bed.event_id
+ AND ber.resource_id in ($rids)
+ AND ((bed.from_ < '$from_' AND bed.to_ > '$from_')
+ OR (bed.from_ >= '$from_' AND bed.to_ <= '$to_')
+ OR (bed.from_ < '$to_' AND bed.to_ > '$to_'))";
-
+ $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
+
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return True;
+
+ }
+
/**
* Check if a given timespan is available for bookings or
allocations
*
@@ -186,7 +314,7 @@
{
$rids = join(',', array_map("intval", $resources));
$nrids = count($resources);
- $this->db->query("SELECT id FROM bb_season
+ $this->db->query("SELECT id FROM bb_season
WHERE id IN (SELECT season_id
FROM
bb_season_resource
WHERE
resource_id IN ($rids,-1)
@@ -213,7 +341,8 @@
'id'
=> array('type' => 'int'),
'application_id' =>
array('type' => 'int'),
'type' => array('type' => 'string',
'required' => true),
- 'from_' => array('type' => 'timestamp'),
- 'to_' => array('type' =>
'timestamp')));
+ 'from_' => array('type' =>
'timestamp','query' => true),
+ 'to_' => array('type' => 'timestamp'),
+ 'active' => array('type' => 'int')));
}
}
Modified: branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.sobooking.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -255,7 +255,7 @@
$end = $end->format('Y-m-d H:i');
$building_id = intval($building_id);
$results = array();
- $this->db->query("SELECT bb_allocation.id AS id FROM
bb_allocation JOIN bb_season ON (bb_allocation.season_id=bb_season.id AND
bb_allocation.active=1) WHERE bb_season.building_id=$building_id AND
((bb_allocation.from_ >= '$start' AND bb_allocation.from_ < '$end') OR
(bb_allocation.to_ > '$start' AND bb_allocation.to_ <= '$end') OR
(bb_allocation.from_ < '$start' AND bb_allocation.to_ > '$end'))", __LINE__,
__FILE__);
+ $this->db->query("SELECT bb_allocation.id AS id FROM
bb_allocation JOIN bb_season ON (bb_allocation.season_id=bb_season.id AND
bb_allocation.active=1) WHERE bb_season.building_id=$building_id AND
bb_season.active=1 AND bb_season.status='PUBLISHED' AND ((bb_allocation.from_
>= '$start' AND bb_allocation.from_ < '$end') OR (bb_allocation.to_ > '$start'
AND bb_allocation.to_ <= '$end') OR (bb_allocation.from_ < '$start' AND
bb_allocation.to_ > '$end'))", __LINE__, __FILE__);
while ($this->db->next_record())
{
$results[] =
$this->_unmarshal($this->db->f('id', false), 'int');
@@ -269,7 +269,7 @@
$end = $end->format('Y-m-d H:i');
$building_id = intval($building_id);
$results = array();
- $this->db->query("SELECT bb_booking.id AS id FROM
bb_booking JOIN bb_season ON (bb_booking.season_id=bb_season.id AND
bb_booking.active=1) WHERE bb_season.building_id=$building_id AND
((bb_booking.from_ >= '$start' AND bb_booking.from_ < '$end') OR
(bb_booking.to_ > '$start' AND bb_booking.to_ <= '$end') OR (bb_booking.from_ <
'$start' AND bb_booking.to_ > '$end'))", __LINE__, __FILE__);
+ $this->db->query("SELECT bb_booking.id AS id FROM
bb_booking JOIN bb_season ON (bb_booking.season_id=bb_season.id AND
bb_booking.active=1) WHERE bb_season.building_id=$building_id AND
bb_season.active=1 AND bb_season.status='PUBLISHED' AND ((bb_booking.from_ >=
'$start' AND bb_booking.from_ < '$end') OR (bb_booking.to_ > '$start' AND
bb_booking.to_ <= '$end') OR (bb_booking.from_ < '$start' AND bb_booking.to_ >
'$end'))", __LINE__, __FILE__);
while ($this->db->next_record())
{
$results[] =
$this->_unmarshal($this->db->f('id', false), 'int');
@@ -297,7 +297,7 @@
$end = $end->format('Y-m-d H:i');
$resource_id = intval($resource_id);
$results = array();
- $this->db->query("SELECT id FROM bb_allocation JOIN
bb_allocation_resource ON (allocation_id=id AND resource_id=$resource_id) WHERE
active=1 AND ((from_ >= '$start' AND from_ < '$end') OR (to_ > '$start' AND to_
<= '$end') OR (from_ < '$start' AND to_ > '$end'))", __LINE__, __FILE__);
+ $this->db->query("SELECT bb_allocation.id AS id FROM
bb_allocation JOIN bb_allocation_resource ON (allocation_id=id AND
resource_id=$resource_id) JOIN bb_resource as res ON ( res.id=$resource_id)
JOIN bb_season ON (bb_allocation.season_id=bb_season.id AND
bb_allocation.active=1) WHERE bb_season.building_id=res.building_id AND
bb_season.active=1 AND bb_season.status='PUBLISHED' AND ((bb_allocation.from_
>= '$start'AND bb_allocation.from_ < '$end') OR (bb_allocation.to_ > '$start'
AND bb_allocation.to_ <= '$end') OR (bb_allocation.from_ < '$start' AND
bb_allocation.to_ > '$end'))", __LINE__, __FILE__);
while ($this->db->next_record())
{
$results[] =
$this->_unmarshal($this->db->f('id', false), 'int');
@@ -311,7 +311,7 @@
$end = $end->format('Y-m-d H:i');
$resource_id = intval($resource_id);
$results = array();
- $this->db->query("SELECT id FROM bb_booking JOIN
bb_booking_resource ON (booking_id=id AND resource_id=$resource_id) WHERE
active=1 AND ((from_ >= '$start' AND from_ < '$end') OR (to_ > '$start' AND to_
<= '$end') OR (from_ < '$start' AND to_ > '$end'))", __LINE__, __FILE__);
+ $this->db->query("SELECT bb_booking.id AS id FROM
bb_booking JOIN bb_booking_resource ON (booking_id=id AND
resource_id=$resource_id) JOIN bb_resource as res ON ( res.id=$resource_id)
JOIN bb_season ON (bb_booking.season_id=bb_season.id AND bb_booking.active=1)
WHERE bb_season.building_id=res.building_id AND bb_season.active=1 AND
bb_season.status='PUBLISHED' AND ((bb_booking.from_ >= '$start' AND
bb_booking.from_ < '$end') OR (bb_booking.to_ > '$start' AND bb_booking.to_ <=
'$end') OR (bb_booking.from_ < '$start' AND bb_booking.to_ > '$end'))",
__LINE__, __FILE__);
while ($this->db->next_record())
{
$results[] =
$this->_unmarshal($this->db->f('id', false), 'int');
@@ -336,9 +336,6 @@
public function get_booking_id($booking)
{
- $table_name = $this->table_name;
- $db = $this->db;
-
$from = "'".$booking['from_']."'";
$to = "'".$booking['to_']."'";
$gid = $booking['group_id'];
@@ -357,9 +354,6 @@
public function check_allocation($id)
{
- $table_name = $this->table_name;
- $db = $this->db;
-
$sql = "SELECT allocation_id as aid FROM bb_booking WHERE
allocation_id = ( SELECT allocation_id FROM bb_booking WHERE id = ($id) ) GROUP
BY allocation_id HAVING count(id) < 2";
$this->db->limit_query($sql, 0,__LINE__, __FILE__,1);
@@ -444,6 +438,16 @@
return $this->db->f('name', false);
}
+ function get_groups_of_organization($grp_id)
+ {
+ $this->db->limit_query("select organization_id from
bb_group where id=($grp_id)", 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return $this->db->f('organization_id', false);
+ }
+
function get_resource($id)
{
$this->db->limit_query("SELECT name FROM bb_resource
where id=" . intval($id), 0, __LINE__, __FILE__, 1);
@@ -474,16 +478,32 @@
return $this->db->f('id', false);
}
- function get_group_of_organization($id)
+ public function get_group_contacts_of_organization($id)
{
$results = array();
- $this->db->query("SELECT id FROM bb_group WHERE active
= 1 and organization_id=". intval($id), __LINE__, __FILE__);
+ $sql = "SELECT
bb_group_contact.id,bb_group_contact.group_id,bb_group_contact.email FROM
bb_group,bb_group_contact WHERE bb_group.id=bb_group_contact.group_id AND
bb_group.active = 1 AND bb_group.organization_id=(".intval($id).")";
+ $this->db->query($sql, __LINE__, __FILE__);
while ($this->db->next_record())
{
- $results[] = $this->db->f('id', false);
+ $results[] = array('id' => $this->db->f('id',
false),
+ 'group_id' => $this->db->f('group_id',
false),
+ 'email' => $this->db->f('email', false));
}
return $results;
}
+ public function get_all_group_of_organization_from_groupid($id)
+ {
+ $results = array();
+ $sql = "SELECT
bb_group_contact.id,bb_group_contact.group_id,bb_group_contact.email FROM
bb_group,bb_group_contact WHERE bb_group.id=bb_group_contact.group_id AND
bb_group.active = 1 AND bb_group.organization_id=(select organization_id from
bb_group where id=(".intval($id)."))";
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array('id' => $this->db->f('id',
false),
+ 'group_id' => $this->db->f('group_id',
false),
+ 'email' => $this->db->f('email', false));
+ }
+ return $results;
+ }
function get_organizations()
{
@@ -537,4 +557,183 @@
}
}
}
+
+
+ function get_screen_resources($building_id, $res = False){
+ $building_id = intval($building_id);
+ if (intval($res) == 1) {
+ $type = "AND ba.name IN ('Idrett','Friidrett','Svømming')";
+ } elseif (intval($res) == 2){
+ $type = "AND ba.name IN ('Barnehage','Styrkerom','Møterom')";
+ } else {
+ $type = '';
+ }
+ $results = array();
+ $sql = "SELECT br.id
+ FROM bb_resource br, bb_activity ba
+ WHERE ba.id = br.activity_id ".$type."
+ AND br.building_id = ".$building_id."
+ AND br.active = 1
+ ORDER by br.sort";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = $this->db->f('id', false);
+ }
+ return $results;
+ }
+
+ function get_screen_allocation($building_id, $start, $end, $resources
= False)
+ {
+ $start = $start->format('Y-m-d H:i');
+ $end = $end->format('Y-m-d H:i');
+ $building_id = intval($building_id);
+ $results = array();
+ $sql = "SELECT
+ bb_allocation.id AS id,
+ bb_allocation.building_name AS building_name,
+ bb_allocation.from_ AS from_,
+ bb_allocation.to_ AS to_,
+ bb_allocation.organization_id AS organization_id,
+ bb_resource.id AS resource_id,
+ bb_resource.name AS resource_name,
+ bb_resource.sort AS sort,
+ bb_resource.building_id AS building_id,
+ bb_organization.name AS organization_name,
+ bb_organization.shortname AS organization_shortname
+ FROM bb_allocation
+ INNER JOIN bb_allocation_resource ON (bb_allocation.id =
bb_allocation_resource.allocation_id)
+ INNER JOIN bb_resource ON
(bb_allocation_resource.resource_id = bb_resource.id)
+ INNER JOIN bb_organization ON (bb_organization.id =
bb_allocation.organization_id)
+ WHERE bb_allocation.from_ > '".$start."' AND
bb_allocation.to_ < '".$end."'
+ AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
+ AND bb_allocation.active = 1
+ ORDER BY building_name, sort, from_;";
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array(
+ 'id' => $this->db->f('id', false),
+ 'building_id' =>
$this->db->f('building_id', false),
+ 'resource_id' =>
$this->db->f('resource_id', false),
+ 'organization_id' =>
$this->db->f('organization_id', false),
+ 'building_name' =>
$this->db->f('building_name', false),
+ 'resource_name' =>
$this->db->f('resource_name', false),
+ 'organization_name' =>
$this->db->f('organization_name', false),
+ 'organization_shortname' =>
$this->db->f('organization_shortname', false),
+ 'from_' => $this->db->f('from_', false),
+ 'to_' => $this->db->f('to_', false),
+ );
+ }
+ return $results;
+ }
+
+ function get_screen_booking($building_id, $start, $end, $resources =
False)
+ {
+ $start = $start->format('Y-m-d H:i');
+ $end = $end->format('Y-m-d H:i');
+ $building_id = intval($building_id);
+
+ $results = array();
+ $sql = "SELECT
+ bb_booking.id AS id,
+ bb_booking.allocation_id AS allocation_id,
+ bb_booking.building_name as buidling_name,
+ bb_booking.from_ AS from_,
+ bb_booking.to_ AS to_,
+ bb_booking.group_id AS group_id,
+ bb_resource.id AS resource_id,
+ bb_resource.name AS resource_name,
+ bb_resource.sort AS sort,
+ bb_resource.building_id AS building_id,
+ bb_group.name AS group_name,
+ bb_group.shortname AS group_shortname
+ FROM bb_booking
+ INNER JOIN bb_booking_resource ON
(bb_booking_resource.booking_id = bb_booking.id)
+ INNER JOIN bb_resource ON
(bb_booking_resource.resource_id = bb_resource.id)
+ INNER JOIN bb_group ON (bb_group.id = bb_booking.group_id)
+ WHERE bb_booking.from_ > '".$start."' AND bb_booking.to_ <
'".$end."'
+ AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
+ AND bb_booking.active = 1
+ ORDER BY building_name,sort, from_;";
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array(
+ 'id' => $this->db->f('id', false),
+ 'building_id' => $this->db->f('building_id', false),
+ 'resource_id' => $this->db->f('resource_id', false),
+ 'group_id' => $this->db->f('group_id', false),
+ 'allocation_id' => $this->db->f('allocation_id', false),
+ 'building_name' => $this->db->f('building_name', false),
+ 'resource_name' => $this->db->f('resource_name', false),
+ 'group_name' => $this->db->f('group_name', false),
+ 'group_shortname' => $this->db->f('group_shortname',
false),
+ 'from_' => $this->db->f('from_', false),
+ 'to_' => $this->db->f('to_', false),
+ );
+ }
+ return $results;
+ }
+
+ function get_screen_event($building_id, $start, $end, $resources = '')
+ {
+ $start = $start->format('Y-m-d H:i:s');
+
+ $test = $end->format('H:i');
+
+ if ($test != '00:00') {
+ $end = $end->format('Y-m-d H:i:s');
+
+ } else {
+ $end = $end->format('Y-m-d').' 24:00:00';
+ }
+
+ $building_id = intval($building_id);
+ $results = array();
+ $sql = "SELECT
+ bb_event.id AS id,
+ bb_event.building_name as building_name,
+ bb_event.description as description,
+ bb_event.from_ AS from_,
+ bb_event.to_ AS to_,
+ bb_resource.sort AS sort,
+ bb_resource.id AS resource_id,
+ bb_resource.name AS resource_name,
+ bb_resource.building_id AS building_id
+ FROM bb_event
+ INNER JOIN bb_event_resource ON
(bb_event_resource.event_id = bb_event.id)
+ INNER JOIN bb_resource ON (bb_resource.id =
bb_event_resource.resource_id)
+ WHERE
+ (
+ (bb_event.from_ >= '".$start."' AND bb_event.to_ <=
'".$end."')
+ OR (bb_event.from_ < '".$start."' AND bb_event.to_ <=
'".$end."' AND bb_event.to_ > '".$start."')
+ OR (bb_event.from_ >='".$start."' AND bb_event.from_ <
'".$end."' AND bb_event.to_ > '".$end."')
+ OR (bb_event.from_ < '".$start."' AND bb_event.to_ >
'".$end."')
+ )
+ AND bb_resource.building_id = (".$building_id.")
+ ".$resources."
+ AND bb_event.active = 1
+ ORDER BY building_name,sort,from_;";
+ $this->db->query($sql, __LINE__, __FILE__);
+ while ($this->db->next_record())
+ {
+ $results[] = array(
+ 'id' => $this->db->f('id', false),
+ 'building_id' => $this->db->f('building_id', false),
+ 'resource_id' => $this->db->f('resource_id', false),
+ 'building_name' => $this->db->f('building_name', false),
+ 'resource_id' => $this->db->f('resource_id', false),
+ 'resource_name' => $this->db->f('resource_name', false),
+ 'description' => $this->db->f('description', false),
+ 'from_' => $this->db->f('from_', false),
+ 'to_' => $this->db->f('to_', false),
+ );
+ }
+ return $results;
+ }
+
}
Modified: branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.sobuilding.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -10,12 +10,20 @@
'id' => array('type' => 'int'),
'name' => array('type' => 'string',
'query' => true, 'required' => true),
'homepage' => array('type' => 'string'),
+ 'calendar_text' => array('type' =>
'string'),
'description' => array('type' =>
'string'),
'phone' => array('type' => 'string'),
'email' => array('type' => 'string'),
+ 'tilsyn_name' => array('type' =>
'string'),
+ 'tilsyn_phone' => array('type' =>
'string'),
+ 'tilsyn_email' => array('type' =>
'string'),
+ 'tilsyn_name2' => array('type' =>
'string'),
+ 'tilsyn_phone2' => array('type' =>
'string'),
+ 'tilsyn_email2' => array('type' =>
'string'),
'deactivate_calendar' => array('type'
=> 'int'),
'deactivate_application' =>
array('type' => 'int'),
'deactivate_sendmessage' =>
array('type' => 'int'),
+ 'extra_kalendar' => array('type' =>
'int'),
'location_code' =>array('type' =>
'string', 'required' => false),
'street' => array('type'
=> 'string', 'query' => true),
'zip_code' => array('type'
=> 'string'),
@@ -25,6 +33,29 @@
)
);
}
+
+ function get_endofseason($id)
+ {
+ $this->db->limit_query("SELECT to_ FROM bb_season WHERE
status = 'PUBLISHED' AND active=1 AND building_id =" . intval($id) . "ORDER BY
to_ DESC", 0, __LINE__, __FILE__, 1);
+ if(!$this->db->next_record())
+ {
+ return false;
+ }
+ return $this->db->f('to_', false);
+ }
+
+ function get_metainfo($id)
+ {
+ $this->db->limit_query("SELECT name, district, city,
description FROM bb_building where id=" . intval($id), 0, __LINE__, __FILE__,
1);
+ if(!$this->db->next_record())
+ {
+ return False;
+ }
+ return array('name' => $this->db->f('name', false),
+ 'district' =>
$this->db->f('district', false),
+ 'city' =>
$this->db->f('city', false),
+ 'description' =>
$this->db->f('description', false));
+ }
/**
* Returns buildings used by the organization with the
specified id
Modified: branches/Version-1_0-branch/booking/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/booking/inc/class.socommon.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++ branches/Version-1_0-branch/booking/inc/class.socommon.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -404,7 +404,6 @@
$dir = isset($params['dir']) && $params['dir'] ?
$params['dir'] : 'asc';
$query = isset($params['query']) && $params['query'] ?
$params['query'] : null;
$filters = isset($params['filters']) &&
$params['filters'] ? $params['filters'] : array();
-
$cols_joins = $this->_get_cols_and_joins();
$cols = join(',', $cols_joins[0]);
$joins = join(' ', $cols_joins[1]);
Modified:
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
2015-04-22 17:33:32 UTC (rev 13060)
+++
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation_export.inc.php
2015-04-22 17:40:31 UTC (rev 13061)
@@ -283,7 +283,21 @@
* @return array with three elements where index 0: total_rows,
index 1: total_cost, index 2: formatted data
*/
public function export_external(array &$reservations, array
$account_codes) {
- $export_format = 'agresso';
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+ if ($config->config_data['external_format'] == 'CSV')
+ {
+ $export_format = 'csv';
+ }
+ elseif ($config->config_data['external_format'] == 'AGRESSO')
+ {
+ $export_format = 'agresso';
+ }
+ elseif ($config->config_data['external_format'] == 'KOMMFAKT')
+ {
+ $export_format = 'kommfakt';
+ }
if (is_array($reservations)) {
if (count($external_reservations =
array_filter($reservations, array($this, 'select_external'))) > 0) {
@@ -292,12 +306,33 @@
throw new
UnexpectedValueException("Unable to find sequential number generator for
external export");
}
- return $this->build_export_result(
+ if ($config->config_data['external_format'] == 'CSV')
+ {
+ return $this->build_export_result(
+ $export_format,
+
count(array_filter($internal_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($internal_reservations),
+
$this->format_csv($internal_reservations, $account_codes, $number_generator)
+ );
+ }
+ elseif ($config->config_data['external_format'] ==
'AGRESSO')
+ {
+ return
$this->build_export_result(
$export_format,
count(array_filter($external_reservations, array($this, 'not_free'))),
$this->calculate_total_cost($external_reservations),
$this->format_agresso($external_reservations, $account_codes, $number_generator)
- );
+ );
+ }
+ elseif ($config->config_data['external_format'] ==
'KOMMFAKT')
+ {
+ return
$this->build_export_result(
+ $export_format,
+
count(array_filter($external_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($external_reservations),
+
$this->format_kommfakt($external_reservations, $account_codes,
$number_generator)
+ );
+ }
}
}
return $this->build_export_result($export_format, 0,
0.0);
@@ -314,10 +349,14 @@
{
$export_format = 'csv';
}
- elseif ($config->config_data['internal_format'] == 'AGGRESSO')
+ elseif ($config->config_data['internal_format'] == 'AGRESSO')
{
$export_format = 'agresso';
}
+ elseif ($config->config_data['internal_format'] == 'KOMMFAKT')
+ {
+ $export_format = 'kommfakt';
+ }
if (is_array($reservations)) {
if (count($internal_reservations =
array_filter($reservations, array($this, 'select_internal'))) > 0) {
@@ -334,7 +373,7 @@
$this->format_csv($internal_reservations, $account_codes, $number_generator)
);
}
- elseif ($config->config_data['internal_format'] ==
'AGGRESSO')
+ elseif ($config->config_data['internal_format'] ==
'AGRESSO')
{
return
$this->build_export_result(
$export_format,
@@ -343,6 +382,15 @@
$this->format_agresso($internal_reservations, $account_codes, $number_generator)
);
}
+ elseif ($config->config_data['internal_format'] ==
'KOMMFAKT')
+ {
+ return
$this->build_export_result(
+ $export_format,
+
count(array_filter($internal_reservations, array($this, 'not_free'))),
+
$this->calculate_total_cost($internal_reservations),
+
$this->format_kommfakt($internal_reservations, $account_codes,
$number_generator)
+ );
+ }
}
}
return $this->build_export_result($export_format, 0,
0.0);
@@ -397,6 +445,7 @@
$combined_data = array();
$export_format = null;
$combine_method = null;
+
foreach($export_results as &$export_result) {
if (!isset($export_result['export_format']) ||
!is_string($export_result['export_format'])) {
throw new
InvalidArgumentException('export_format must be specified');
@@ -435,7 +484,7 @@
$combined_data[] = substr($export['data'],
strpos($export['data'], "\n")+1); //Remove first line (i.e don't to repeat
headers in file)
}
}
-
+
public function format_csv(array &$reservations, array
$account_codes, $sequential_number_generator) {
$export_info = array();
$output = array();
@@ -710,7 +759,7 @@
$header['line_no'] = '0000'; //Nothing
here according to example file but spec. says so
//Topptekst til faktura, knyttet mot
fagavdeling
- $header['long_info1'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$account_codes['invoice_instruction']),
0, 120), 120, ' ');
+ $header['long_info1'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$account_codes['invoice_instruction']),
0, 120), 120, ' ');
//Ordrenr. UNIKT, løpenr. genereres i
booking ut fra gitt serie, eks. 38000000
$header['order_id'] =
str_pad($order_id, 9, 0, STR_PAD_LEFT);
@@ -741,7 +790,7 @@
/* Data hentes fra booking, tidspunkt
legges i eget felt som kommer på
* linjen under: 78_short_info. <navn
på bygg>, <navn på ressurs>
*/
- $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
+ $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
//Artikkel opprettes i Agresso (4
siffer), en for kultur og en for idrett, inneholder konteringsinfo.
$item['article'] =
str_pad(substr(strtoupper($account_codes['article']), 0, 15), 15, ' ');
@@ -797,7 +846,7 @@
$text['batch_id'] = $header['batch_id'];
$text['client'] = $header['client'];
$text['line_no'] = $item['line_no'];
- $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['description']), 0, 60),
60, ' ');
+ $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['description']),
0, 60), 60, ' ');
$text['trans_type'] =
$header['trans_type'];
$text['voucher_type'] =
$header['voucher_type'];
@@ -855,7 +904,7 @@
/* Data hentes fra booking, tidspunkt
legges i eget felt som kommer på
* linjen under: 78_short_info. <navn
på bygg>, <navn på ressurs>
*/
- $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
+ $item['art_descr'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['article_description']),
0, 35), 35, ' '); //35 chars long
//Artikkel opprettes i Agresso (4
siffer), en for kultur og en for idrett, inneholder konteringsinfo.
$item['article'] =
str_pad(substr(strtoupper($account_codes['article']), 0, 15), 15, ' ');
@@ -911,7 +960,7 @@
$text['batch_id'] =
$stored_header['batch_id'];
$text['client'] =
$stored_header['client'];
$text['line_no'] = $item['line_no'];
- $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1",$reservation['description']), 0, 60),
60, ' ');
+ $text['short_info'] =
str_pad(substr(iconv("utf-8","ISO-8859-1//TRANSLIT",$reservation['description']),
0, 60), 60, ' ');
$text['trans_type'] =
$stored_header['trans_type'];
$text['voucher_type'] =
$stored_header['voucher_type'];
@@ -933,8 +982,14 @@
if (count($export_info) == 0) {
return null;
}
+
+ if ($config->config_data['external_format_linebreak'] ==
'Windows') {
+ $file_format_linebreak = "\r\n";
+ } else {
+ $file_format_linebreak = "\n";
+ }
- return array('data' => implode("\n", $output),
'data_log' => implode("\n", $log), 'info' => $export_info, 'header_count' =>
$header_count);
+ return array('data' => implode($file_format_linebreak,
$output), 'data_log' => implode("\n", $log), 'info' => $export_info,
'header_count' => $header_count);
}
protected function get_agresso_row_template() {
@@ -944,4 +999,207 @@
$row_template = array('accept_flag' => str_repeat(' ',
1), 'account' => str_repeat(' ', 8), 'accountable' => str_repeat(' ', 20),
'address' => str_repeat(' ', 160), 'allocation_key' => str_repeat(' ', 2),
'amount' => str_repeat(' ', 17), 'amount_set' => str_repeat(' ', 1), 'apar_id'
=> str_repeat(' ', 8), 'apar_name' => str_repeat(' ', 30), 'art_descr' =>
str_repeat(' ', 35), 'article' => str_repeat(' ', 15), 'att_1_id' =>
str_repeat(' ', 2), 'att_2_id' => str_repeat(' ', 2), 'att_3_id' =>
str_repeat(' ', 2), 'att_4_id' => str_repeat(' ', 2), 'att_5_id' =>
str_repeat(' ', 2), 'att_6_id' => str_repeat(' ', 2), 'att_7_id' =>
str_repeat(' ', 2), 'bank_account' => str_repeat(' ', 35), 'batch_id' =>
str_repeat(' ', 12), 'client' => str_repeat(' ', 2), 'client_ref' =>
str_repeat(' ', 2), 'confirm_date' => str_repeat(' ', 17), 'control' =>
str_repeat(' ', 1), 'cur_amount' => str_repeat(' ', 17), 'currency' =>
str_repeat(' ', 3), 'del_met_descr' => str_repeat(' ', 60), 'del_term_descr' =>
str_repeat(' ', 60), 'deliv_addr' => str_repeat(' ', 255), 'deliv_attention' =>
str_repeat(' ', 50), 'deliv_countr' => str_repeat(' ', 3), 'deliv_date' =>
str_repeat(' ', 17), 'deliv_method' => str_repeat(' ', 8), 'deliv_terms' =>
str_repeat(' ', 8), 'dim_1' => str_repeat(' ', 8), 'dim_2' => str_repeat(' ',
8), 'dim_3' => str_repeat(' ', 8), 'dim_4' => str_repeat(' ', 8), 'dim_5' =>
str_repeat(' ', 12), 'dim_6' => str_repeat(' ', 4), 'dim_7' => str_repeat(' ',
4), 'dim_value_1' => str_repeat(' ', 12), 'dim_value_2' => str_repeat(' ', 12),
'dim_value_3' => str_repeat(' ', 12), 'dim_value_4' => str_repeat(' ', 12),
'dim_value_5' => str_repeat(' ', 12), 'dim_value_6' => str_repeat(' ', 12),
'dim_value_7' => str_repeat(' ', 12), 'disc_percent' => str_repeat(' ', 17),
'exch_rate' => str_repeat(' ', 17), 'ext_ord_ref' => str_repeat(' ', 15),
'intrule_id' => str_repeat(' ', 6), 'line_no' => str_repeat(' ', 4), 'location'
=> str_repeat(' ', 4), 'long_info1' => str_repeat(' ', 120), 'long_info2' =>
str_repeat(' ', 120), 'lot' => str_repeat(' ', 10), 'main_apar_id' =>
str_repeat(' ', 8), 'mark_attention' => str_repeat(' ', 50), 'mark_ctry_cd' =>
str_repeat(' ', 3), 'markings' => str_repeat(' ', 120), 'obs_date' =>
str_repeat(' ', 17), 'order_date' => str_repeat(' ', 17), 'order_id' =>
str_repeat(' ', 9), 'order_type' => str_repeat(' ', 2), 'pay_method' =>
str_repeat(' ', 2), 'period' => str_repeat(' ', 8), 'place' => str_repeat(' ',
30), 'province' => str_repeat(' ', 40), 'rel_value' => str_repeat(' ', 12),
'responsible' => str_repeat(' ', 8), 'responsible2' => str_repeat(' ', 8),
'sequence_no' => str_repeat(' ', 8), 'sequence_ref' => str_repeat(' ', 8),
'serial_no' => str_repeat(' ', 20), 'short_info' => str_repeat(' ', 60),
'status' => str_repeat(' ', 1), 'tax_code' => str_repeat(' ', 2), 'tax_system'
=> str_repeat(' ', 2), 'template_id' => str_repeat(' ', 8), 'terms_id' =>
str_repeat(' ', 2), 'tekx1' => str_repeat(' ', 12), 'tekst2' => str_repeat(' ',
12), 'tekst3' => str_repeat(' ', 12), 'text4' => str_repeat(' ', 12),
'trans_type' => str_repeat(' ', 2), 'unit_code' => str_repeat(' ', 3),
'unit_descr' => str_repeat(' ', 50), 'value_1' => str_repeat(' ', 17),
'voucher_ref' => str_repeat(' ', 9), 'voucher_type' => str_repeat(' ', 2),
'warehouse' => str_repeat(' ', 4), 'zip_code' => str_repeat(' ', 15));
return $row_template;
}
+
+ protected function combine_kommfakt_export_data(array
&$combined_data, $export) {
+ if (count($combined_data) == 0) {
+ $combined_data[] = $export['data'];
+ } else {
+ $combined_data[] = "\n";
+ $combined_data[] = $export['data'];
+ }
+ }
+
+ public function format_kommfakt(array &$reservations, array
$account_codes, $sequential_number_generator) {
+ $export_info = array();
+ $output = array();
+
+ $log = array();
+
+ $date = str_pad(date('Ymd'), 17, ' ', STR_PAD_LEFT);
+
+ $config = CreateObject('phpgwapi.config','booking');
+ $config->read();
+
+
+
+ $stored_header = array();
+ $line_no = 0;
+ $header_count = 0;
+ $log_order_id = '';
+ $log_customer_name = '';
+ $log_customer_nr = '';
+ $log_buidling = '';
+
+ $internal = false;
+
+ $ant_post = 0;
+ $linjenr = 1;
+ $lopenr = 1;
+
+ foreach($reservations as &$reservation) {
+
+ if ($this->get_cost_value($reservation['cost'])
<= 0) {
+ continue; //Don't export costless rows
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [13061] Merge 12914:13060 from trunk,
Sigurd Nes <=