fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11387] Merge 11362:11386 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11387] Merge 11362:11386 from trunk
Date: Wed, 23 Oct 2013 13:18:02 +0000

Revision: 11387
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11387
Author:   sigurdne
Date:     2013-10-23 13:18:01 +0000 (Wed, 23 Oct 2013)
Log Message:
-----------
Merge 11362:11386 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
    branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php
    branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
    branches/Version-1_0-branch/frontend/inc/hook_config.inc.php
    branches/Version-1_0-branch/frontend/setup/default_records.inc.php
    branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
    branches/Version-1_0-branch/frontend/templates/base/attributes_view.xsl
    branches/Version-1_0-branch/frontend/templates/base/drawings.xsl
    branches/Version-1_0-branch/frontend/templates/base/entity.xsl
    branches/Version-1_0-branch/frontend/templates/base/frontend.xsl
    branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
    branches/Version-1_0-branch/phpgwapi/inc/class.db.inc.php
    branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
    branches/Version-1_0-branch/property/inc/class.historylog.inc.php
    branches/Version-1_0-branch/property/inc/class.soXport.inc.php
    branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php
    branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
    branches/Version-1_0-branch/property/inc/class.uitts.inc.php
    
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
    
branches/Version-1_0-branch/property/inc/custom/default/catch_ticket_export.php
    
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
    
branches/Version-1_0-branch/property/inc/custom/default/ticket_redirect_based_on_status.php
    branches/Version-1_0-branch/property/inc/export/default/Agresso
    branches/Version-1_0-branch/property/inc/export/default/Ecolink
    branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
    branches/Version-1_0-branch/property/inc/export/default/GABNr
    branches/Version-1_0-branch/property/inc/export/default/Kemner_kvittering
    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/attributes_form.xsl
    branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php
    branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
    branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
    branches/Version-1_0-branch/rental/inc/class.sounit.inc.php
    branches/Version-1_0-branch/rental/inc/hook_config.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/frontend/inc/class.sorental.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
    branches/Version-1_0-branch/property/inc/export/default/Agresso_X114

Property Changed:
----------------
    branches/Version-1_0-branch/
    branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php
    branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
    branches/Version-1_0-branch/frontend/inc/class.boproperty.inc.php
    branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
    branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
    branches/Version-1_0-branch/frontend/inc/class.menu.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_in.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uicontract_internal.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uidocumentupload.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uidrawings.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uimaintenance.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uimessages.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uipictures.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uirefurbishment.inc.php
    branches/Version-1_0-branch/frontend/inc/class.uiservices.inc.php
    branches/Version-1_0-branch/frontend/inc/hook_config.inc.php
    branches/Version-1_0-branch/frontend/inc/model/class.ticket.inc.php
    branches/Version-1_0-branch/frontend/index.php
    branches/Version-1_0-branch/frontend/setup/default_records.inc.php
    branches/Version-1_0-branch/frontend/setup/setup.inc.php
    branches/Version-1_0-branch/frontend/setup/tables_current.inc.php
    branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
    branches/Version-1_0-branch/frontend/templates/base/app_data.xsl
    branches/Version-1_0-branch/frontend/templates/base/attributes_view.xsl
    branches/Version-1_0-branch/frontend/templates/base/contract.xsl
    branches/Version-1_0-branch/frontend/templates/base/datatable.xsl
    branches/Version-1_0-branch/frontend/templates/base/delegate.xsl
    branches/Version-1_0-branch/frontend/templates/base/demo.xsl
    branches/Version-1_0-branch/frontend/templates/base/document.xsl
    branches/Version-1_0-branch/frontend/templates/base/documentupload.xsl
    branches/Version-1_0-branch/frontend/templates/base/drawings.xsl
    branches/Version-1_0-branch/frontend/templates/base/entity.xsl
    branches/Version-1_0-branch/frontend/templates/base/entityview.xsl
    branches/Version-1_0-branch/frontend/templates/base/frontend.xsl
    branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl
    branches/Version-1_0-branch/frontend/templates/base/maintenance.xsl
    branches/Version-1_0-branch/frontend/templates/base/messages.xsl
    branches/Version-1_0-branch/frontend/templates/base/pictures.xsl
    branches/Version-1_0-branch/frontend/templates/base/refurbishment.xsl
    branches/Version-1_0-branch/frontend/templates/base/services.xsl
    branches/Version-1_0-branch/frontend/templates/base/ticketview.xsl
    branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php
    branches/Version-1_0-branch/property/inc/export/default/Agresso
    branches/Version-1_0-branch/property/inc/export/default/Basware_X114
    branches/Version-1_0-branch/property/inc/export/default/Ecolink
    branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
    branches/Version-1_0-branch/property/inc/export/default/GABNr
    branches/Version-1_0-branch/property/inc/export/default/Kemner_kvittering
    branches/Version-1_0-branch/rental/inc/SnappyMedia.php
    branches/Version-1_0-branch/rental/inc/SnappyPdf.php
    branches/Version-1_0-branch/rental/inc/class.bofellesdata.inc.php
    branches/Version-1_0-branch/rental/inc/class.menu.inc.php
    branches/Version-1_0-branch/rental/inc/class.soadjustment.inc.php
    branches/Version-1_0-branch/rental/inc/class.sobilling.inc.php
    branches/Version-1_0-branch/rental/inc/class.sobilling_info.inc.php
    branches/Version-1_0-branch/rental/inc/class.socommon.inc.php
    branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
    branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
    branches/Version-1_0-branch/rental/inc/class.socontract_price_item.inc.php
    branches/Version-1_0-branch/rental/inc/class.sodocument.inc.php
    branches/Version-1_0-branch/rental/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/rental/inc/class.soinvoice_price_item.inc.php
    branches/Version-1_0-branch/rental/inc/class.sonotification.inc.php
    branches/Version-1_0-branch/rental/inc/class.soparty.inc.php
    branches/Version-1_0-branch/rental/inc/class.soprice_item.inc.php
    branches/Version-1_0-branch/rental/inc/class.sounit.inc.php
    
branches/Version-1_0-branch/rental/inc/class.soworkbench_notification.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiadjustment.inc.php
    branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
    branches/Version-1_0-branch/rental/inc/class.uicommon.inc.php
    branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
    branches/Version-1_0-branch/rental/inc/class.uicontract.inc.php
    branches/Version-1_0-branch/rental/inc/class.uidelegate.inc.php
    branches/Version-1_0-branch/rental/inc/class.uidocument.inc.php
    branches/Version-1_0-branch/rental/inc/class.uifrontpage.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiimport.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiinvoice_price_item.inc.php
    branches/Version-1_0-branch/rental/inc/class.uimakepdf.inc.php
    branches/Version-1_0-branch/rental/inc/class.uinotification.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiparty.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiprice_item.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiproperty_location.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiresultunit.inc.php
    branches/Version-1_0-branch/rental/inc/class.uiunit.inc.php
    branches/Version-1_0-branch/rental/inc/export/default/customer.php
    
branches/Version-1_0-branch/rental/inc/export/nordlandssykehuset/customer.php
    branches/Version-1_0-branch/rental/inc/hook_config.inc.php
    branches/Version-1_0-branch/rental/inc/hook_settings.inc.php
    
branches/Version-1_0-branch/rental/inc/locations/class.city_counsil_dep.inc.php
    
branches/Version-1_0-branch/rental/inc/locations/class.location_hierarchy.inc.php
    
branches/Version-1_0-branch/rental/inc/locations/class.organisational_location.inc.php
    branches/Version-1_0-branch/rental/inc/locations/class.result_unit.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.adjustment.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.agresso_cs15.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.agresso_gl07.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.agresso_lg04.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.billing.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.billing_info.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.contract_date.inc.php
    
branches/Version-1_0-branch/rental/inc/model/class.contract_price_item.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.default_export.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.document.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.exportable.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.invoice.inc.php
    
branches/Version-1_0-branch/rental/inc/model/class.invoice_price_item.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.model.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.notification.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.party.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.price_item.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.property_location.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.unit.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.validator.inc.php
    branches/Version-1_0-branch/rental/inc/plugins/fellesdata/party.edit.php
    branches/Version-1_0-branch/rental/index.php
    branches/Version-1_0-branch/rental/setup/default_records.inc.php
    branches/Version-1_0-branch/rental/setup/setup.inc.php
    branches/Version-1_0-branch/rental/setup/tables_current.inc.php
    branches/Version-1_0-branch/rental/setup/tables_update.inc.php
    branches/Version-1_0-branch/rental/templates/base/adjustment.php
    branches/Version-1_0-branch/rental/templates/base/adjustment_list.php
    
branches/Version-1_0-branch/rental/templates/base/adjustment_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/admin_price_item.php
    branches/Version-1_0-branch/rental/templates/base/admin_price_item_list.php
    
branches/Version-1_0-branch/rental/templates/base/admin_price_item_manual_adjustment.php
    branches/Version-1_0-branch/rental/templates/base/billing.php
    branches/Version-1_0-branch/rental/templates/base/billing_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/billing_step0.php
    branches/Version-1_0-branch/rental/templates/base/billing_step1.php
    branches/Version-1_0-branch/rental/templates/base/billing_step2.php
    branches/Version-1_0-branch/rental/templates/base/common.php
    branches/Version-1_0-branch/rental/templates/base/composite.php
    branches/Version-1_0-branch/rental/templates/base/composite_list.php
    branches/Version-1_0-branch/rental/templates/base/composite_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/contract.php
    branches/Version-1_0-branch/rental/templates/base/contract_list.php
    branches/Version-1_0-branch/rental/templates/base/contract_list_partial.php
    
branches/Version-1_0-branch/rental/templates/base/contract_warnings_partial.php
    
branches/Version-1_0-branch/rental/templates/base/contracts_for_regulation_list.php
    branches/Version-1_0-branch/rental/templates/base/delegate_list.php
    branches/Version-1_0-branch/rental/templates/base/document_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/facilit_import.php
    
branches/Version-1_0-branch/rental/templates/base/facilit_import_adjustment.php
    branches/Version-1_0-branch/rental/templates/base/form_buttons.php
    branches/Version-1_0-branch/rental/templates/base/frontpage.php
    branches/Version-1_0-branch/rental/templates/base/invoice_list_partial.php
    
branches/Version-1_0-branch/rental/templates/base/invoice_price_item_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/notification_list.php
    branches/Version-1_0-branch/rental/templates/base/orphan_unit_list.php
    branches/Version-1_0-branch/rental/templates/base/party.php
    branches/Version-1_0-branch/rental/templates/base/party_list.php
    branches/Version-1_0-branch/rental/templates/base/party_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/permission_denied.php
    branches/Version-1_0-branch/rental/templates/base/price_item_partial.php
    
branches/Version-1_0-branch/rental/templates/base/property_location_partial.php
    branches/Version-1_0-branch/rental/templates/base/resultunit.php
    branches/Version-1_0-branch/rental/templates/base/resultunit_list.php
    
branches/Version-1_0-branch/rental/templates/base/resultunit_list_partial.php
    branches/Version-1_0-branch/rental/templates/base/sync_party_list.php
    
branches/Version-1_0-branch/rental/templates/base/sync_party_list_identifier.php
    branches/Version-1_0-branch/rental/templates/base/sync_party_list_org_id.php
    
branches/Version-1_0-branch/rental/templates/base/sync_party_list_res_unit.php
    branches/Version-1_0-branch/rental/templates/base/total_price_partial.php
    branches/Version-1_0-branch/rental/templates/base/unit_list_partial.php


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

Modified: branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/controller/inc/class.hook_helper.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -67,6 +67,7 @@
 
                        $location_array = array();
                        $component_short_desc = array();
+                       $component_short_desc[0][0] = '';
 
                        $so_check_list = 
CreateObject('controller.socheck_list');
                        $so_control = CreateObject('controller.socontrol');
@@ -195,7 +196,6 @@
                        } 
 
                        $my_planned_controls = array();
-
                        // Generates an array with planned controls
                        foreach($my_controls as $container_arr)
                        {
@@ -268,8 +268,12 @@
                        {
                                foreach($planned_controls_on_date as 
$my_planned_control)
                                {
+
                                        $deadline_ts = $my_planned_control[0];
                                        $my_control = $my_planned_control[1];
+                                       
+                                       $location_id = 
isset($my_control['location_id']) && $my_control['location_id'] ? 
$my_control['location_id'] : 0;
+                                       $component_id = 
isset($my_control['component_id']) && $my_control['component_id'] ? 
$my_control['component_id'] : 0;
 
                                        $control_area_name = 
$this->get_control_area_name( $my_control["control_area_id"] );
 
@@ -279,11 +283,13 @@
                                        $check_list_id = $my_planned_control[2];
                                        $location_code = $my_planned_control[4];
 
-                                       
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+                                       $location_name = 
$this->get_location_name($location_code);
+                                       
+                                       if($component_id)
                                        {
-                                               $location_array[$location_code] 
= execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
+                                               $short_descr = 
$this->get_short_description($location_id, $component_id);
+                                               $location_name .= 
"::{$short_descr}";
                                        }
-                                       $location_name = 
$location_array[$location_code]["loc1_name"];
 
                                        $link = "";
                                //      $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
@@ -388,16 +394,18 @@
                        //Add assigned
                        $my_check_lists = 
$this->get_my_assigned_check_list($from_date_ts, $to_date_ts, $repeat_type, 
true);
 
+/*??
                        $_assigned_list = array();
                        foreach ($my_check_lists as $_key => $my_check_list)
                        {
                                
$_assigned_list[$my_check_list['location_code']][$_key] = $my_check_list;
                        }
-
+*/
                        foreach ($my_check_lists as $_key => $my_check_list)
                        {
                                
$my_undone_controls[$my_check_list['deadline']][] = array("edit", 
$my_check_list['deadline'], $my_check_list, $_key, 
$my_check_list['location_code'] );
                        }
+//_debug_array($my_undone_controls);
        
                        ksort($my_undone_controls);
 
@@ -440,12 +448,9 @@
                                                if($check_list_type == 
"location")
                                                {
                                                        $location_code = 
$my_undone_control[4];
-                                                       
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
-                                                       {
-                                                               
$location_array[$location_code] = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
-                                                       }
-                                                       $location_name = 
$location_array[$location_code]["loc1_name"];
 
+                                                       $location_name = 
$this->get_location_name($location_code);
+
                                                        if(count( 
$controls_on_date) > 1 )
                                                        {
                                                                $link = "";
@@ -467,42 +472,41 @@
                                                        $location_id = 
$my_undone_control[4];
                                                        $component_id = 
$my_undone_control[5];
 
-                                                       
if(!isset($component_short_desc[$location_id][$component_id]))
-                                                       {
-                                                               
$component_short_desc[$location_id][$component_id] = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-                                                       }
-
-                                                       
if($component_short_desc[$location_id][$component_id])
-                                                       {
-                                                               $short_desc_arr 
= $component_short_desc[$location_id][$component_id];
-                                                       }
-
+                                                       $short_descr = 
$this->get_short_description($location_id, $component_id);
                                                        if(count( 
$controls_on_date) > 1 )
                                                        {
                                                                $link = "";
                                                                $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id' 
=> $my_control['id'], 'location_id' => $location_id, 'component_id' => 
$component_id, 'deadline_ts' => $deadline_ts));
 
-                                                               
$my_undone_controls_HTML .= "<li><a href='{$link}'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_desc_arr}</div><div 
class='control-area'>{$control_area_name}</div></a></li>";
+                                                               
$my_undone_controls_HTML .= "<li><a href='{$link}'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_descr}</div><div 
class='control-area'>{$control_area_name}</div></a></li>";
                                                        }
                                                        else
                                                        {
                                                                $link = "";
                                                                $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id' 
=> $my_control['id'], 'location_id' => $location_id, 'component_id' => 
$component_id, 'deadline_ts' => $deadline_ts));
 
-                                                               
$my_undone_controls_HTML .= "<a href='{$link}'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_desc_arr}</div><div 
class='control-area'>{$control_area_name}</div></a>";
+                                                               
$my_undone_controls_HTML .= "<a href='{$link}'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_descr}</div><div 
class='control-area'>{$control_area_name}</div></a>";
                                                        }
                                                }
                                        }
                                        else if($check_list_status == "edit")
                                        {
+
+                                               $location_id = 
isset($my_control['location_id']) && $my_control['location_id'] ? 
$my_control['location_id'] : 0;
+                                               $component_id = 
isset($my_control['component_id']) && $my_control['component_id'] ? 
$my_control['component_id'] : 0;
+
+
                                                $check_list_id = 
$my_undone_control[3];
                                                $location_code = 
$my_undone_control[4];
 
-                                               
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
+                                               $location_name = 
$this->get_location_name($location_code);
+
+                                               if($component_id)
                                                {
-                                                       
$location_array[$location_code] = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
+                                                       $short_descr = 
$this->get_short_description($location_id, $component_id);
+
+                                                       $location_name .= 
"::{$short_descr}";
                                                }
-                                               $location_name = 
$location_array[$location_code]["loc1_name"];
 
                                                if(count( $controls_on_date) > 
1 )
                                                {
@@ -668,11 +672,7 @@
                                                {
                                                        $location_code = 
$my_assigned_control[4];
 
-                                                       
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
-                                                       {
-                                                               
$location_array[$location_code] = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
-                                                       }
-                                                       $location_name = 
$location_array[$location_code]["loc1_name"];
+                                                       $location_name = 
$this->get_location_name($location_code);
 
                                                        $link = "";
                                                        $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'type' => "location", 'control_id' => 
$my_control['id'], 'location_code' => $location_code, 'deadline_ts' => 
$deadline_ts));
@@ -683,21 +683,13 @@
                                                {
                                                        $location_id = 
$my_assigned_control[4];
                                                        $component_id = 
$my_assigned_control[5];
+                                                       
+                                                       $short_descr = 
$this->get_short_description($location_id, $component_id);
 
-                                                       
if(!isset($component_short_desc[$location_id][$component_id]))
-                                                       {
-                                                               
$component_short_desc[$location_id][$component_id] = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
-                                                       }
-
-                                                       
if($component_short_desc[$location_id][$component_id])
-                                                       {
-                                                               $short_desc_arr 
= $component_short_desc[$location_id][$component_id];
-                                                       }
-
                                                        $link = "";
                                                        $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.add_check_list', 'type' => "component", 'control_id' 
=> $my_control['id'], 'location_id' => $location_id, 'component_id' => 
$component_id, 'deadline_ts' => $deadline_ts));
 
-                                                       
$my_assigned_controls_HTML .= "<li><a href='$link'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_desc_arr}</div><div 
class='control-area'>{$control_area_name}</div></a></li>";
+                                                       
$my_assigned_controls_HTML .= "<li><a href='$link'><div 
class='date'>{$date_str}</div><div 
class='control'>{$my_control['title']}</div><div 
class='title'>{$short_descr}</div><div 
class='control-area'>{$control_area_name}</div></a></li>";
                                                }
                                        }
                                        else if($check_list_status == "edit")
@@ -705,11 +697,7 @@
                                                $check_list_id = 
$my_assigned_control[3];
                                                $location_code = 
$my_assigned_control[4];
 
-                                               
if(!isset($location_array[$location_code]) || !$location_array[$location_code])
-                                               {
-                                                       
$location_array[$location_code] = execMethod('property.bolocation.read_single', 
array('location_code' => $location_code));
-                                               }
-                                               $location_name = 
$location_array[$location_code]["loc1_name"];
+                                               $location_name = 
$this->get_location_name($location_code);
 
                                                $link = "";
                                                $link = 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'controller.uicheck_list.edit_check_list', 'check_list_id' => $check_list_id));
@@ -826,4 +814,40 @@
 
                        return $control_area_name;
                }
+               
+               function get_location_name($location_code)
+               {
+                       static $location_array = array();
+                       if(!isset($location_array[$location_code]) || 
!$location_array[$location_code])
+                       {
+                               $_location_info = 
execMethod('property.bolocation.read_single', array
+                                       (
+                                               'location_code' => 
$location_code,
+                                               'extra'                 => 
array('noattrib' => true)
+                                       )
+                               );
+
+                               $_loc_name_arr = array();
+                               for ($i=1; $i < count(explode('-', 
$location_code)) +1;$i++)
+                               {
+                                       $_loc_name_arr[] = 
$_location_info["loc{$i}_name"];
+                               }
+
+                               $location_array[$location_code] = implode(' | 
',$_loc_name_arr);
+                       }
+
+                       return $location_array[$location_code];
+               }
+               
+               function get_short_description($location_id, $component_id)
+               {
+                       static $component_short_desc = array();
+
+                       
if(!isset($component_short_desc[$location_id][$component_id]))
+                       {
+                               
$component_short_desc[$location_id][$component_id] = 
execMethod('property.soentity.get_short_description', array('location_id' => 
$location_id, 'id' => $component_id));
+                       }
+
+                       return  
$component_short_desc[$location_id][$component_id];
+               }
        }

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2013-10-23 13:18:01 UTC (rev 11387)
@@ -206,15 +206,14 @@
 
                
                        $sql  = "SELECT DISTINCT 
controller_check_list.location_code, controller_check_list.control_id, 
controller_check_list.id AS check_list_id,"
-                               . " 
procedure_id,requirement_id,costresponsibility_id, 
controller_control.description, start_date, end_date, deadline,planned_date, 
completed_date,"
-                               . " control_area_id, 
repeat_type,repeat_interval, title,"
-                               . " bim_item.guid,bim_item.type as 
component_type, bim_item.id as component_id, bim_item.address,"
-                               . " bim_item.loc1"
+                               . " controller_control.description, start_date, 
end_date, deadline,planned_date, completed_date,"
+                               . " 
control_area_id,controller_check_list.location_id,title,controller_check_list.component_id"
                                . " FROM controller_check_list"
                                . " {$this->join} controller_control ON 
controller_check_list.control_id = controller_control.id"
-                               . " {$this->join} 
controller_control_component_list ON 
controller_control_component_list.control_id = controller_control.id"
-                               . " {$this->join} fm_bim_item bim_item ON 
controller_control_component_list.component_id = bim_item.id"
-                               . " {$this->join} fm_bim_type bim_type ON 
controller_control_component_list.location_id = bim_type.location_id"
+                               . " {$this->join} 
controller_control_component_list "
+                                       . " ON 
(controller_control_component_list.control_id = 
controller_check_list.control_id"
+                                       . " AND 
controller_control_component_list.location_id = 
controller_check_list.location_id"
+                                       . " AND 
controller_control_component_list.component_id = 
controller_check_list.component_id)"
                                . " WHERE assigned_to = {$user_id}";
 
                        if( $repeat_type )
@@ -227,10 +226,9 @@
                                $sql .= " AND 
controller_check_list.completed_date IS NULL ";                   
                        }
 
-                       $sql .= " AND ((controller_control.start_date <= 
$to_date AND controller_control.end_date IS NULL) ";
-                       $sql .= " OR (controller_control.start_date <= $to_date 
AND controller_control.end_date > $from_date ))";
-                       $sql .= " ORDER BY bim_item.id ";
-                        
+                       $sql .= " AND ((deadline <= $to_date AND 
controller_control.end_date IS NULL) ";
+                       $sql .= " OR (deadline <= $to_date AND deadline > 
$from_date ))";
+
                        $this->db->query($sql);
                        
                        $check_list_array = array();
@@ -239,6 +237,8 @@
                        {
                                $check_list = new 
controller_check_list($this->unmarshal($this->db->f('check_list_id'), 'int'));
                                
$check_list->set_control_id($this->unmarshal($this->db->f('control_id'), 
'int'));
+                               
$check_list->set_location_id($this->unmarshal($this->db->f('location_id'), 
'int'));
+                               
$check_list->set_component_id($this->unmarshal($this->db->f('component_id'), 
'int'));
                                
$check_list->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$check_list->set_description($this->unmarshal($this->db->f('description', 
true), 'string'));
                                
$check_list->set_start_date($this->unmarshal($this->db->f('start_date'), 
'int'));

Modified: 
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.xsl
       2013-10-23 13:13:32 UTC (rev 11386)
+++ 
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year.xsl
       2013-10-23 13:18:01 UTC (rev 11387)
@@ -289,9 +289,7 @@
                                                                                
                        <xsl:value-of select="$session_url"/>
                                                                                
                </xsl:attribute>
 
-                                                                               
                <xsl:variable name="month_str">short_month
-                                                                               
                        <xsl:number/> capitalized
-                                                                               
                </xsl:variable>
+                                                                               
                <xsl:variable name="month_str">short_month <xsl:number/> 
capitalized</xsl:variable>
                                                                                
                <xsl:value-of select="php:function('lang', $month_str)" />
                                                                                
        </a>
                                                                                
</th>

Modified: branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php 
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php 
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,6 +1,31 @@
 <?php
-    class frontend_bofellesdata {
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
+    class frontend_bofellesdata
+    {
+
        // Instance variable
            protected static $bo;
 


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.bofellesdata.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.boproperty.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.borental.inc.php     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.borental.inc.php     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,11 +1,37 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @author Sigurd Nes <address@hidden>
+        * @copyright Copyright (C) 2013 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
        phpgw::import_class('rental.soparty');
        phpgw::import_class('rental.socontract');
        phpgw::import_class('rental.socomposite');
        phpgw::import_class('rental.socontract_price_item');
        include_class('rental', 'contract', 'inc/model/');
 
-    class frontend_borental {
+    class frontend_borental
+    {
 
        public static function contract_exist_per_location($contract_id, 
$location_code, $contract_state_identifier)
        {
@@ -62,37 +88,30 @@
                        return false;
        }
 
+       //FIXME : Sigurd 16 okt 2013: not used?
        public static function get_first_contract_per_location($location_code)
        {
                $contracts_per_location = 
phpgwapi_cache::session_get('frontend', 'contracts_per_location');
                return $contracts_per_location[$location_code][0];
        }
 
+       //FIXME : Sigurd 16 okt 2013: not used?
                public static function 
get_first_contract_in_per_location($location_code)
        {
                $contracts_in_per_location = 
phpgwapi_cache::session_get('frontend', 'contracts_in_per_location');
                return $contracts_in_per_location[$location_code][0];
        }
 
+
         /**
          *
-         * @param integer $org_unit_ids
+         * @param array $org_unit_ids
          */
-        public static function get_property_locations($array)
+        public static function get_property_locations($array,$top_org_units)
         {
 
-               $property_locations = array();
-               $property_locations_active = array();
-
-               $total_price_all_buildings = 0;
-               $total_rented_area_all_builings = 0;
-
-               $types = 
rental_socontract::get_instance()->get_fields_of_responsibility();
-                       $location_id_internal = 
array_search('contract_type_internleie', $types);
-               $location_id_in = array_search('contract_type_innleie', $types);
-               $location_id_ex = array_search('contract_type_eksternleie', 
$types);
-
-               foreach($array as $row){
+               foreach($array as $row)
+               {
                        /*
              * 1. hent alle kontraktsparter som har org unit id (foreløpig 
bruker vi result_unit_number i rentalparty)
              * 2. hent alle kontrakter på kontraktspartene
@@ -105,119 +124,80 @@
                                {
                                        continue;
                                }
-                               $parties = 
rental_soparty::get_instance()->get(null, null, null, null, null, null, 
array('org_unit_id' => $row['ORG_UNIT_ID']));
+                               $parties = 
self::get_all_parties($top_org_units, $row['ORG_UNIT_ID']);
                        }
                        else
                        {
                                $parties = 
rental_soparty::get_instance()->get(null, null, null, null, null, null, 
array('email' => $row));
+                               $parties = array_keys($parties);
                        }
 
                        $contracts = array();
                        $composites = array();
 
+                       $sorental       = CreateObject('frontend.sorental');
 
                        //For all parties connected to the internal 
organization unit
-                       foreach($parties as $party)
-                       {
-                               //... get the contracts
-                               $contracts = 
rental_socontract::get_instance()->get(null, null, null, null, null, null, 
array('party_id' => $party->get_id()));
+                               $locations = $sorental->get_location($parties);
+               }
 
-                               //... and for each contract connected to this 
contract part
-                               foreach($contracts as $id => $contract)
-                               {
-                                       //... get the composites
-                                       $composites = 
rental_socomposite::get_instance()->get(null, null, null, null, null, null, 
array('contract_id' => $contracts[$id]->get_id()));
+                       return $locations;
+               }
+               
 
-                                       //...and for each composite in the 
contract in which this contract part is connected
-                                       foreach($composites as $composite)
-                                       {
-                                               //... get the units
-                                               $units = 
$composite->get_units();
+               /**
+               * Get the org_units by hierarchical inheritance
+               */
+               function get_all_parties($top_org_units = 
array(),$selected_org_unit = 0)
+               {
+                       static $parties =array(); // cache result
+                       
+                       //already calculated
+                       if($parties)
+                       {
+                               return $parties;
+                       }
+/*
+                       $bt = debug_backtrace();
+                       echo "<b>frontend_borental::{$bt[0]['function']} Called 
from file: {$bt[0]['file']} line: {$bt[0]['line']}</b><br/>";
+                       unset($bt);
+*/
 
-                                               //... and for each unit 
retrieve the property locations we are after
-                                               foreach($units as $unit)
-                                               {
-                                                       $property_location = 
$unit->get_location();
-                                                       
$property_locations[$property_location->get_location_code()] = 
$property_location;
+                       $org_units = array();
 
-                                                       // Contract holders: 
contracts_per_location (internal) and contracts_in_per_location (in)
+                       if($selected_org_unit == 'all')
+                       {
+                               foreach($top_org_units as $entry)
+                               {
+                                       $org_units[] = $entry['ORG_UNIT_ID'];
+                               }
+                       }
+                       else if ($selected_org_unit != 'none')
+                       {
+                               $org_units[] = $selected_org_unit;
+                       }
+                       
 
-                                                       // Internal contract 
should have impact on total price
-                                                       
if($contract->get_location_id() == $location_id_internal)
-                                                       {
-                                                               $total_price = 
rental_socontract_price_item::get_instance()->get_total_price($contract->get_id());
-                                                               
$contract->set_total_price($total_price);
+                       $bofellesdata = CreateObject('rental.bofellesdata');
 
-                                                               
if(!is_array($contracts_per_location[$property_location->get_location_code()]))
-                                                               {
-                                                                       
$contracts_per_location[$property_location->get_location_code()] = array();
-                                                               }
-                                                               
array_push($contracts_per_location[$property_location->get_location_code()], 
$contract);
+                       foreach ($org_units as $org_unit)
+                       {
+                               
$bofellesdata->get_org_unit_ids_from_top($org_unit); 
+                       }
 
-                                                               
if($contract->is_active())
-                                                               {
-                                                                       
$property_locations_active[$property_location->get_location_code()] = true;
-                                                                       
$rented_area_per_location[$property_location->get_location_code()] += 
$contract->get_rented_area();
-                                                                       
$rented_price_per_location[$property_location->get_location_code()] += 
$total_price;
-                                                               }
-                                                       }
-                                                       else 
if($contract->get_location_id() == $location_id_in)
-                                                       {
-                                                               $total_price = 
rental_socontract_price_item::get_instance()->get_total_price($contract->get_id());
-                                                               
$contract->set_total_price($total_price);
+                       $all_unit_ids = array_unique($bofellesdata->unit_ids);
 
-                                                               
if($contract->is_active())
-                                                               {
-                                                                       
$property_locations_active[$property_location->get_location_code()] = true;
-                                                               }
+ 
+                       $parties        = 
execMethod('frontend.sorental.get_parties', $all_unit_ids);
 
-                                                               
if(!is_array($contracts_in_per_location[$property_location->get_location_code()]))
-                                                               {
-                                                                       
$contracts_in_per_location[$property_location->get_location_code()] = array();
-                                                               }
-                                                               
array_push($contracts_in_per_location[$property_location->get_location_code()], 
$contract);
-                                                       }
-                                                       else 
if($contract->get_location_id() == $location_id_ex)
-                                                       {
-                                                               $total_price = 
rental_socontract_price_item::get_instance()->get_total_price($contract->get_id());
-                                                               
$contract->set_total_price($total_price);
+                       return $parties;
+               }
 
-                                                               
if(!is_array($contracts_ex_per_location[$property_location->get_location_code()]))
-                                                               {
-                                                                       
$contracts_ex_per_location[$property_location->get_location_code()] = array();
-                                                               }
-                                                               
array_push($contracts_ex_per_location[$property_location->get_location_code()], 
$contract);
 
-                                                               
if($contract->is_active())
-                                                               {
-                                                                       
$property_locations_active[$property_location->get_location_code()] = true;
-                                                                       
$rented_area_per_location[$property_location->get_location_code()] += 
$contract->get_rented_area();
-                                                                       
$rented_price_per_location[$property_location->get_location_code()] += 
$total_price;
-                                                               }
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-               }
+               public static function get_total_cost_and_area($org_units = 
array(),$selected_location ='')
+               {
+               $sorental       = CreateObject('frontend.sorental');
+               return $sorental->get_total_cost_and_area($org_units, 
$selected_location);
+               }
 
-               phpgwapi_cache::session_set('frontend', 
'contracts_per_location', $contracts_per_location);
-               phpgwapi_cache::session_set('frontend', 
'contracts_in_per_location', $contracts_in_per_location);
-               phpgwapi_cache::session_set('frontend', 
'contracts_ex_per_location', $contracts_ex_per_location);
-               phpgwapi_cache::session_set('frontend', 
'rented_area_per_location', $rented_area_per_location);
-               phpgwapi_cache::session_set('frontend', 
'total_price_per_location', $rented_price_per_location);
-
-
-               //Serialize the properties
-               $serialized_properties = array();
-               foreach($property_locations as $key => $property_location)
-               {
-                       
if(isset($property_locations_active[$property_location->get_location_code()]) 
&& $property_locations_active[$property_location->get_location_code()])
-                       {
-                               $serialized_properties[] = 
$property_location->serialize();
-                       }
-               }
-               return $serialized_properties;
-        }
-
     }


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.borental.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: branches/Version-1_0-branch/frontend/inc/class.menu.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Copied: branches/Version-1_0-branch/frontend/inc/class.sorental.inc.php (from 
rev 11386, trunk/frontend/inc/class.sorental.inc.php)
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.sorental.inc.php             
                (rev 0)
+++ branches/Version-1_0-branch/frontend/inc/class.sorental.inc.php     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -0,0 +1,235 @@
+<?php
+       /**
+       * Frontend : a simplified tool for end users.
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License v2 or later
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage core
+       * @version $Id$
+       */
+
+       /*
+               This program is free software: you can redistribute it and/or 
modify
+               it under the terms of the GNU Lesser General Public License as 
published by
+               the Free Software Foundation, either version 2 of the License, 
or
+               (at your option) any later version.
+
+               This program is distributed in the hope that it will be useful,
+               but WITHOUT ANY WARRANTY; without even the implied warranty of
+               MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+               GNU Lesser General Public License for more details.
+
+               You should have received a copy of the GNU General Public 
License
+               along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
+        */
+
+
+
+
+       /**
+        * Description
+        * @package frontend
+        */
+
+       class frontend_sorental
+       {
+               /**
+               * @var int $_total_records total number of records found
+               */
+               protected $_total_records = 0;
+
+
+               /**
+               * @var int $_receipt feedback on actions
+               */
+               protected $_receipt = array();
+
+
+               /**
+                * @var object $_db reference to the global database object
+                */
+               protected $_db;
+
+               /**
+                * @var string $_join SQL JOIN statement
+                */
+               protected $_join;
+
+               /**
+                * @var string $_join SQL LEFT JOIN statement
+                */
+               protected $_left_join;
+
+               /**
+                * @var string $_like SQL LIKE statement
+                */
+               protected $_like;
+
+               protected $_global_lock = false;
+
+               public function __construct()
+               {
+                       $this->account          = 
(int)$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->_db                      = & 
$GLOBALS['phpgw']->db;
+                       $this->_join            = & $this->_db->join;
+                       $this->_like            = & $this->_db->like;
+                       $this->_left_join       = & $this->_db->left_join;
+               }
+
+               /**
+                * Magic get method
+                *
+                * @param string $varname the variable to fetch
+                *
+                * @return mixed the value of the variable sought - null if not 
found
+                */
+               public function __get($varname)
+               {
+                       switch ($varname)
+                       {
+                               case 'total_records':
+                                       return $this->_total_records;
+                                       break;
+                               case 'receipt':
+                                       return $this->_receipt;
+                                       break;
+                               default:
+                                       return null;
+                       }
+               }
+
+               public function get_location($parties)
+               {
+                       $parties = (array) $parties;
+                       if(!$parties)
+                       {
+                               return array();
+                       }
+
+                       $ts = time();
+                       
+                       $filtermethod = 'WHERE rental_party.id IN (' . 
implode(',', $parties) . ')'; 
+                       //active contract
+                       $filtermethod .= " AND ({$ts} >= date_start AND 
(date_end IS NULL OR {$ts} <= date_end))";
+                       
+                       $sql = "SELECT DISTINCT location_code FROM"
+                       . " rental_contract {$this->_db->join} 
rental_contract_party ON (rental_contract.id = 
rental_contract_party.contract_id)"
+                       . " {$this->_db->join} rental_party ON (rental_party.id 
= rental_contract_party.party_id)"
+                       . " {$this->_db->join} rental_contract_composite ON 
(rental_contract.id = rental_contract_composite.contract_id)"
+                       . " {$this->_db->join} rental_composite ON 
(rental_contract_composite.composite_id = rental_composite.id)"
+                       . " {$this->_db->join} rental_unit ON 
(rental_composite.id = rental_unit.composite_id)"
+                       . " {$filtermethod}";
+
+//_debug_array($sql);
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+                       $level = 0;
+                       $map_level = array();
+                       while ($this->_db->next_record())
+                       {
+                               $location_code  = 
$this->_db->f('location_code', true);
+                               
+                               $_level = substr_count($location_code, '-') + 1;
+                               
+                               $level = $_level > $level ? $_level : $level;
+                               
+                               $map_level[$level][] = $location_code;
+                       }
+                       
+                       foreach ($map_level as $level => $locations)
+                       {
+                       
+                               $sql = "SELECT loc{$level}_name as name, 
location_code FROM fm_location{$level} WHERE location_code IN ('" . 
implode("','", $locations) . "')";
+                               $this->_db->query($sql,__LINE__,__FILE__);
+                               while ($this->_db->next_record())
+                               {
+                                       $values[] = array
+                                       (
+                                               'location_code' => 
$this->_db->f('location_code', true),
+                                               'name'                  => 
$this->_db->f('name', true),
+                                       );
+                               }
+                       }
+
+                       return $values;
+               }
+
+
+               /**
+               * translate from org_unit to party.id
+               **/
+               function get_parties($org_units)
+               {
+                       if(!$org_units)
+                       {
+                               return array();
+                       }
+                       
+                       $sql = 'SELECT id FROM rental_party WHERE org_enhet_id 
IN (' . implode(',', $org_units) . ')'; 
+//_debug_array($sql);
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+
+                       while ($this->_db->next_record())
+                       {
+                               $values[] = $this->_db->f('id');
+                       }
+
+                       return $values;
+               }
+
+               public function get_total_cost_and_area($org_units = array(), 
$selected_location = '')
+               {
+                       if(!$org_units)
+                       {
+                               return array();
+                       }
+
+                       $ts = time();
+                       $filtermethod = 'WHERE rental_party.id IN (' . 
implode(',', $org_units) . ')'; 
+                       //active contract
+                       $filtermethod .= " AND ({$ts} >= 
rental_contract.date_start AND (rental_contract.date_end IS NULL OR {$ts} <= 
rental_contract.date_end))";
+                       
+                       
+                       $join_method = '';
+                       if($selected_location)
+                       {
+                               $filtermethod .= " AND location_code 
{$this->_db->like} '{$selected_location}%'";
+                               $join_method =  " {$this->_db->join} 
rental_contract_composite ON (rental_contract.id = 
rental_contract_composite.contract_id)"
+                                       . " {$this->_db->join} rental_composite 
ON (rental_contract_composite.composite_id = rental_composite.id)"
+                                       . " {$this->_db->join} rental_unit ON 
(rental_composite.id = rental_unit.composite_id) ";
+
+                       }
+                       
+                       $sql = "SELECT sum(total_price::numeric) AS 
sum_total_price FROM"
+                       . " rental_contract {$this->_db->join} 
rental_contract_party ON (rental_contract.id = 
rental_contract_party.contract_id)"
+                       . " {$this->_db->join} rental_party ON (rental_party.id 
= rental_contract_party.party_id)"
+                       . " {$this->_db->join} rental_contract_price_item ON 
(rental_contract.id  = rental_contract_price_item.contract_id)"
+                       . " {$join_method}{$filtermethod} AND NOT is_one_time";
+
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $values = array();
+                       $this->_db->next_record();
+                       $values['sum_total_price'] = 
$this->_db->f('sum_total_price');
+
+
+                       $sql = "SELECT 
sum(rental_contract.rented_area::numeric) AS sum_total_area FROM"
+                       . " rental_contract {$this->_db->join} 
rental_contract_party ON (rental_contract.id = 
rental_contract_party.contract_id)"
+                       . " {$this->_db->join} rental_party ON (rental_party.id 
= rental_contract_party.party_id)"
+                       . " {$join_method}{$filtermethod}";
+
+
+                       $this->_db->query($sql,__LINE__,__FILE__);
+
+                       $this->_db->next_record();
+                       $values['sum_total_area'] = 
$this->_db->f('sum_total_area');
+
+                       return $values;
+               }
+       }


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uicontract.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php 
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php 
2013-10-23 13:18:01 UTC (rev 11387)
@@ -6,7 +6,7 @@
         * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
         * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
         * @package Frontend
-        * @version $Id:$
+        * @version $Id$
         */
 
        /*


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_documents.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,15 +1,38 @@
 <?php
+       /**
+        * Frontend : a simplified tool for end users.
+        *
+        * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+        * @package Frontend
+        * @version $Id$
+        */
 
-phpgw::import_class('frontend.uicontract');
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
 
-class frontend_uicontract_ex extends frontend_uicontract
-{
-       public function __construct()
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+       */
+
+       phpgw::import_class('frontend.uicontract');
+
+       class frontend_uicontract_ex extends frontend_uicontract
        {
-               $this->contract_state_identifier = "contract_state_ex";
-               $this->contracts_per_location_identifier = 
"contracts_ex_per_location";
-               $this->form_url = 
"index.php?menuaction=frontend.uicontract_ex.index";
-               
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.rental.contract_ex'));
-               parent::__construct();
+               public function __construct()
+               {
+                       $this->contract_state_identifier = "contract_state_ex";
+                       $this->contracts_per_location_identifier = 
"contracts_ex_per_location";
+                       $this->form_url = 
"index.php?menuaction=frontend.uicontract_ex.index";
+                       
phpgwapi_cache::session_set('frontend','tab',$GLOBALS['phpgw']->locations->get_id('frontend','.rental.contract_ex'));
+                       parent::__construct();
+               }
        }
-}


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_ex.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_in.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uicontract_internal.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uidelegates.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uidocumentupload.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uidrawings.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -7,7 +7,7 @@
         * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
         * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
         * @package Frontend
-        * @version $Id: class.uientity.inc.php 7224 2011-04-15 11:48:27Z 
sigurdne $
+        * @version $Id$
         */
 
        /*


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uientity.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php   
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php   
2013-10-23 13:18:01 UTC (rev 11387)
@@ -6,7 +6,7 @@
         * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
         * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
         * @package Frontend
-        * @version $Id: class.uifrontend.inc.php 4859 2010-02-18 23:09:16Z 
sigurd $
+        * @version $Id$
         */
 
        /*
@@ -56,19 +56,19 @@
 
                        $this->config   = 
CreateObject('phpgwapi.config','frontend');
                        $this->config->read();
-                       $use_fellesdata = 
$this->config->config_data['use_fellesdata'];
-                       $logo_path = $this->config->config_data['logo_path'];
+                       $use_fellesdata = 
$this->config->config_data['use_fellesdata'];
+                       $logo_path              = 
$this->config->config_data['logo_path'];
 
                        // Get the mode: in frame or full screen
-                       $mode = phpgwapi_cache::session_get('frontend', 
'noframework');
-                       $noframework = isset($mode) ? $mode : true;
+                       $mode                   = 
phpgwapi_cache::session_get('frontend', 'noframework');
+                       $noframework    = isset($mode) ? $mode : true;
 
                        /* Get the tabs and check to see whether the user has 
specified a tab or has a selected tab on session */
-                       $tabs = $this->get_tabs();
-                       $location_id = phpgw::get_var('location_id', 'int', 
'REQUEST');
-                       $tab = isset($location_id) ? $location_id : 
phpgwapi_cache::session_get('frontend','tab');
-                       $selected = isset($tab) && $tab ? $tab : 
array_shift(array_keys($tabs));
-                       $this->tabs = 
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected);
+                       $tabs                   = $this->get_tabs();
+                       $location_id    = phpgw::get_var('location_id', 'int', 
'REQUEST');
+                       $tab                    = isset($location_id) ? 
$location_id : phpgwapi_cache::session_get('frontend','tab');
+                       $selected               = isset($tab) && $tab ? $tab : 
array_shift(array_keys($tabs));
+                       $this->tabs             = 
$GLOBALS['phpgw']->common->create_tabs($tabs, $selected);
                        phpgwapi_cache::session_set('frontend','tab',$selected);
 
                        // Get header state
@@ -79,8 +79,8 @@
 
                        // Get navigation parameters
                        $param_selected_location = phpgw::get_var('location');  
                // New location selected from locations list
-                       $param_selected_org_unit = 
phpgw::get_var('org_unit_id');                       // New organisational unit 
selected from organisational units list
-                       $param_only_org_unit = phpgw::get_var('org_enhet_id');  
// Frontend access from rental module regarding specific organisational unit
+                       $param_selected_org_unit = 
phpgw::get_var('org_unit_id');               // New organisational unit 
selected from organisational units list
+                       $param_only_org_unit = phpgw::get_var('org_enhet_id');  
                // Frontend access from rental module regarding specific 
organisational unit
 
                        //Refresh organisation list
                        $refresh = phpgw::get_var('refresh','bool');
@@ -88,7 +88,7 @@
                        $property_locations_update = false;
 
                        /* If the user has selected an organisational unit or 
all units */
-                       if(isset($param_selected_org_unit))
+                       if(isset($param_selected_org_unit) && 
$param_selected_org_unit && $param_selected_org_unit != 'none')
                        {
                                //Specify which unit(s)
                                if($param_selected_org_unit == 'all')
@@ -112,21 +112,31 @@
                                        {
                                                //If the organisational unit 
selected is not in list; do default 'all'
                                                $org_unit_ids = 
$this->header_state['org_unit'];
-                                               $param_selected_org_unit = 
'all';
+                                               $param_selected_org_unit = 
'none';
                                        }
                                }
                                $this->header_state['selected_org_unit'] = 
$param_selected_org_unit;
 
                                //Update locations according to organisational 
unit specification
-                               $property_locations = 
frontend_borental::get_property_locations($org_unit_ids);
+                               $property_locations = 
frontend_borental::get_property_locations($org_unit_ids, 
$this->header_state['org_unit']);
+
                                $property_locations_update = true;
 
                        }
+                       else if($param_selected_org_unit == 'none')
+                       {
+                               $this->header_state['selected_org_unit'] = 
$param_selected_org_unit;
+                               $property_locations = array();
+                               $this->header_state['locations'] = 
$property_locations;
+                               $this->header_state['number_of_locations'] = 
count($property_locations);
+                       }
+
                        /* If the user selects a organisational unit in rental 
module */
-                       else if(isset($param_only_org_unit))
+                       else if(isset($param_only_org_unit) && 
$param_only_org_unit && $param_selected_org_unit != 'none')
                        {
                                //TODO: check permissions
-                               if($use_fellesdata){
+                               if($use_fellesdata)
+                               {
                                        $name_and_result_number = 
frontend_bofellesdata::get_instance()->get_organisational_unit_info($param_only_org_unit);
 
                                        //Specify unit
@@ -145,7 +155,7 @@
                                        
$this->header_state['selected_org_unit'] = $param_only_org_unit;
 
                                        //Update locations
-                                       $property_locations = 
frontend_borental::get_property_locations($org_unit_ids);
+                                       $property_locations = 
frontend_borental::get_property_locations($org_unit_ids, 
$this->header_state['org_unit']);
                                        $property_locations_update = true;
 
                                        $noframework = false; // In regular 
frames
@@ -173,16 +183,17 @@
                                        //Update org units on header state
                                        $this->header_state['org_unit'] = 
$org_units;
                                        
$this->header_state['number_of_org_units'] = count($org_units);
-                                       
$this->header_state['selected_org_unit'] = 'all';
+                                       
$this->header_state['selected_org_unit'] = 'none';
 
                                        //Update locations
-                                       $property_locations = 
frontend_borental::get_property_locations($org_units);
+                                       //FIXME Sigurd 15. okt 2013: deselect 
'all' on initial view
+                                       //$property_locations = 
frontend_borental::get_property_locations($org_units, 
$this->header_state['org_unit']);
                                }
-                               else
+                               else if ( $param_selected_org_unit != 'none')
                                {
                                        //If no organisational database is in 
use: get rented properties based on username
                                        $usernames[] = 
$GLOBALS['phpgw_info']['user']['account_lid'];
-                                       $property_locations = 
frontend_borental::get_property_locations($usernames);
+                                       $property_locations = 
frontend_borental::get_property_locations($usernames, 
$this->header_state['org_unit']);
                                }
 
                                $property_locations_update = true;
@@ -206,12 +217,13 @@
 
                                $this->header_state['locations'] = 
$property_locations;
                                $this->header_state['number_of_locations'] = 
count($property_locations);
+                               //FIXME
                                $this->calculate_totals($property_locations);
                        }
 
 
                        /* If the user has selected a location or as a 
side-effect from selecting organisational unit */
-                       if(isset($param_selected_location))
+                       if($param_selected_location)
                        {
                                $locs = $this->header_state['locations'];
                                $exist = false;
@@ -225,11 +237,14 @@
 
                                if($exist)
                                {
-                                       $tppl = 
phpgwapi_cache::session_get('frontend','total_price_per_location');
-                                       $tapl = 
phpgwapi_cache::session_get('frontend','rented_area_per_location');
                                        
$this->header_state['selected_location'] = $param_selected_location;
-                                       
$this->header_state['selected_total_price'] = 
number_format($tppl[$param_selected_location],2,","," ")." ".lang('currency');
-                                       
$this->header_state['selected_total_area'] = 
number_format($tapl[$param_selected_location],2,","," ")." 
".lang('square_meters');
+
+                                       $parties = 
frontend_borental::get_all_parties(array(), 
$this->header_state['selected_org_unit']);
+                                       $totals = 
frontend_borental::get_total_cost_and_area($parties, $param_selected_location);
+
+                                       
$this->header_state['selected_total_price'] = 
number_format($totals['sum_total_price'],2,","," ")." ".lang('currency');
+                                       
$this->header_state['selected_total_area'] = 
number_format($totals['sum_total_area'],2,","," ")." ".lang('square_meters');
+
                                        phpgwapi_cache::session_set('frontend', 
'header_state', $this->header_state);
                                }
                                else
@@ -391,34 +406,18 @@
                        $this->header_state['name_of_user'] = $name_of_user;
                }
 
+
+
                function calculate_totals($property_locations)
                {
-
                        // Calculate
-                       $total_area = 0;
-               //      $rented_area_per_location = 
phpgwapi_cache::user_get('frontend','rented_area_per_location', 
$GLOBALS['phpgw_info']['user']['account_id']);
-                       $rented_area_per_location = 
phpgwapi_cache::session_get('frontend','rented_area_per_location');
-                       foreach($rented_area_per_location as $location_code => 
$area_per_location)
-                       {
+                       $parties = frontend_borental::get_all_parties();
+       
+                       $totals = 
frontend_borental::get_total_cost_and_area($parties);
+                       $this->header_state['total_price'] = 
number_format($totals['sum_total_price'], 0, ","," ")." kr";
+                       $this->header_state['total_area'] = 
number_format($totals['sum_total_area'], 0, ",", " ")." kvm";
+                       
 
-                               
if($this->location_in_selection($location_code,$property_locations))
-                               {
-                                       $total_area += $area_per_location;
-                               }
-                       }
-
-                       $total_price = 0;
-               //      $total_price_per_location = 
phpgwapi_cache::user_get('frontend','total_price_per_location', 
$GLOBALS['phpgw_info']['user']['account_id']);
-                       $total_price_per_location = 
phpgwapi_cache::session_get('frontend','total_price_per_location');
-                       foreach($total_price_per_location as $location_code => 
$price_per_location)
-                       {
-                               
if($this->location_in_selection($location_code,$property_locations))
-                               {
-                                       $total_price += $price_per_location;
-                               }
-                       }
-                       $this->header_state['total_price'] = 
number_format($total_price, 0, ","," ")." kr";
-                       $this->header_state['total_area'] = 
number_format($total_area, 0, ",", " ")." kvm";
                }
 
                function location_in_selection($location_code, 
$property_locations)


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uifrontend.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uihelpdesk.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uimaintenance.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uimessages.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uipictures.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uirefurbishment.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


Property changes on: 
branches/Version-1_0-branch/frontend/inc/class.uiservices.inc.php
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/inc/hook_config.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/hook_config.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/inc/hook_config.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -8,7 +8,7 @@
        * @package phpgroupware
        * @subpackage Frontend
        * @category hooks
-       * @version $Id: hook_config.inc.php 4237 2009-11-27 23:17:21Z sigurd $
+       * @version $Id$
        */
 
        /*


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


Property changes on: 
branches/Version-1_0-branch/frontend/inc/model/class.ticket.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


Property changes on: branches/Version-1_0-branch/frontend/index.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/setup/default_records.inc.php  
2013-10-23 13:18:01 UTC (rev 11387)
@@ -5,7 +5,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package frontend
        * @subpackage setup
-       * @version $Id: default_records.inc.php 4175 2009-11-22 14:00:45Z 
sigurd $
+       * @version $Id$
        */
 
        $GLOBALS['phpgw']->locations->add('.', 'top', 'frontend', false);


Property changes on: 
branches/Version-1_0-branch/frontend/setup/default_records.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


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


Property changes on: 
branches/Version-1_0-branch/frontend/setup/tables_current.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Modified: branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/setup/tables_update.inc.php    
2013-10-23 13:18:01 UTC (rev 11387)
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package frontend
        * @subpackage setup
-       * @version $Id: tables_update.inc.php 4859 2010-02-18 23:09:16Z sigurd $
+       * @version $Id$
        */
 
        /**


Property changes on: 
branches/Version-1_0-branch/frontend/setup/tables_update.inc.php
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id


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

Modified: 
branches/Version-1_0-branch/frontend/templates/base/attributes_view.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/attributes_view.xsl     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/templates/base/attributes_view.xsl     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,4 +1,4 @@
-<!-- $Id: attributes_form.xsl 7396 2011-06-17 13:19:00Z sigurdne $ -->
+<!-- $Id$ -->
        <xsl:template name="attributes_view">
                <xsl:apply-templates select="attributes_values"/>
        </xsl:template>


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


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


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


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


Property changes on: 
branches/Version-1_0-branch/frontend/templates/base/demo.xsl
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


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


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

Modified: branches/Version-1_0-branch/frontend/templates/base/drawings.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/drawings.xsl    
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/templates/base/drawings.xsl    
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,4 +1,4 @@
-<!-- $Id: helpdesk.xsl 6663 2010-12-09 10:45:28Z sigurdne $ -->
+<!-- $Id$ -->
 <xsl:template match="drawings" xmlns:php="http://php.net/xsl";>
     <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
     <div class="yui-navset" id="drawing_tabview">


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

Modified: branches/Version-1_0-branch/frontend/templates/base/entity.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/entity.xsl      
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/templates/base/entity.xsl      
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,4 +1,4 @@
-<!-- $Id: helpdesk.xsl 6663 2010-12-09 10:45:28Z sigurdne $ -->
+<!-- $Id$ -->
 <xsl:template match="entity" xmlns:php="http://php.net/xsl";>
     <xsl:variable name="form_action"><xsl:value-of 
select="form_action"/></xsl:variable>
     <div class="yui-navset" id="entity_tabview">


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


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

Modified: branches/Version-1_0-branch/frontend/templates/base/frontend.xsl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/frontend.xsl    
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/frontend/templates/base/frontend.xsl    
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1,10 +1,11 @@
 <xsl:template match="header" xmlns:php="http://php.net/xsl";>
+       <xsl:variable name="messages_url"><xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:frontend.uimessages.index')" /></xsl:variable>
        <div id="wrapper">
        <div id="header">
                <div id="login-bar">
                        <ul class="user_menu">
                                <li><em><img 
src="frontend/templates/base/images/16x16/user_red.png"  class="list_image" 
/></em><xsl:value-of select="name_of_user"/> | <a 
href="http://portico/pe/preferences/changepassword.php";>Bytt passord</a></li>
-                               <li><a 
href="index.php?menuaction=frontend.uimessages.index" 
class="list_image"><em><img 
src="frontend/templates/base/images/16x16/email.png" 
class="list_image"/></em><xsl:value-of select="new_messages"/></a></li>
+                                       <li><a href="{$messages_url}" 
class="list_image"><em><img 
src="frontend/templates/base/images/16x16/email.png" 
class="list_image"/></em><xsl:value-of select="new_messages"/></a></li>
                                <li>
                                        <a href="logout.php"  
class="header_link"><em><img 
src="frontend/templates/base/images/16x16/door_out.png" 
class="list_image"/></em><xsl:value-of select="php:function('lang', 
'logout')"/></a> 
                                        |
@@ -41,32 +42,29 @@
                                                        </a>
                                                </li>
                                                <li>
-                                                       <form 
action="index.php?menuaction=frontend.uihelpdesk.index" method="post">
+                                                       <form 
action="{form_action}" method="post">
                                                                <select 
size="3" onchange="this.form.submit()" name="org_unit_id">
-                                                                       
<xsl:choose>
-                                                                               
<xsl:when test="selected_org_unit = 'all'">
-                                                                               
        <option value="all" selected="selected"><xsl:value-of 
select="php:function('lang', 'all_organisational_units')"/></option>
-                                                                               
        <xsl:for-each select="org_unit">
-                                                                               
                <xsl:sort select="ORG_NAME"/>
-                                                                               
                <option value="{ORG_UNIT_ID}"><xsl:value-of 
select="ORG_NAME"/></option>
-                                                                               
        </xsl:for-each>
-                                                                               
</xsl:when>
-                                                                               
<xsl:otherwise>
-                                                                               
        <option value="all"><xsl:value-of select="php:function('lang', 
'all_organisational_units')"/></option>
-                                                                               
        <xsl:for-each select="org_unit">
-                                                                               
                <xsl:sort select="ORG_NAME"/>
-                                                                               
                <xsl:choose>
-                                                                               
                                <xsl:when test="ORG_UNIT_ID = 
//header/selected_org_unit">
-                                                                               
                                        <option value="{ORG_UNIT_ID}" 
selected="selected"><xsl:value-of select="ORG_NAME"/></option>
-                                                                               
                                </xsl:when>
-                                                                               
                                <xsl:otherwise>
-                                                                               
                                        <option 
value="{ORG_UNIT_ID}"><xsl:value-of select="ORG_NAME"/></option>
-                                                                               
                                </xsl:otherwise>
-                                                                               
                        </xsl:choose>
-                                                                               
        </xsl:for-each>
-                                                                               
</xsl:otherwise>
-                                                                               
-                                                                       
</xsl:choose> 
+                                                                       <option 
value="none">
+                                                                               
        <xsl:if test="'none' = //header/selected_org_unit">
+                                                                               
                <xsl:attribute name="selected" value="selected"/>
+                                                                               
        </xsl:if>
+                                                                               
<xsl:value-of select="php:function('lang', 'none')"/>
+                                                                       
</option>
+                                                                       <option 
value="all">
+                                                                               
        <xsl:if test="'all' = //header/selected_org_unit">
+                                                                               
                <xsl:attribute name="selected" value="selected"/>
+                                                                               
        </xsl:if>
+                                                                               
<xsl:value-of select="php:function('lang', 'all_organisational_units')"/>
+                                                                       
</option>
+                                                                       
<xsl:for-each select="org_unit">
+                                                                               
<xsl:sort select="ORG_NAME"/>
+                                                                               
        <option value="{ORG_UNIT_ID}" >
+                                                                               
                <xsl:if test="ORG_UNIT_ID = //header/selected_org_unit">
+                                                                               
                        <xsl:attribute name="selected" value="selected"/>
+                                                                               
                </xsl:if>
+                                                                               
                <xsl:value-of disable-output-escaping="yes" select="ORG_NAME"/>
+                                                                               
        </option>
+                                                                       
</xsl:for-each>
                                                                </select>
                                                        </form>
                                                </li>
@@ -115,6 +113,7 @@
                                                                        <em 
class="select_header"><xsl:value-of select="php:function('lang', 
'select_unit')"/></em>
                                                                </label>
                                                                <br/>
+                                                               <xsl:variable 
name="lang_no_name_unit"><xsl:value-of select="php:function('lang', 
'no_name_unit')"/></xsl:variable>                                               
              
                                                                <select 
name="location" size="7" onchange="this.form.submit();" style="margin:5px;">
                                                                        
<xsl:for-each select="locations">
                                                                                
<xsl:sort select="loc1_name"/>
@@ -122,14 +121,11 @@
                                                                                
        <xsl:when test="location_code = //header/selected_location">
                                                                                
                <option value="{location_code}" selected="selected">
                                                                                
                        <xsl:choose>
-                                                                               
                                <xsl:when test="loc2_name != ''">
-                                                                               
                                        <xsl:value-of select="loc2_name"/>
+                                                                               
                                <xsl:when test="name != ''">
+                                                                               
                                        <xsl:value-of select="name"/>
                                                                                
                                </xsl:when>
-                                                                               
                                <xsl:when test="loc1_name != ''">
-                                                                               
                                        <xsl:value-of select="loc1_name"/>
-                                                                               
                                </xsl:when>
                                                                                
                                <xsl:otherwise>
-                                                                               
                                        <xsl:value-of 
select="php:function('lang', 'no_name_unit')"/> (<xsl:value-of 
select="location_code"/>)
+                                                                               
                                        <xsl:value-of 
select="$lang_no_name_unit"/> (<xsl:value-of select="location_code"/>)
                                                                                
                                </xsl:otherwise>
                                                                                
                        </xsl:choose>
                                                                                
                </option>
@@ -137,14 +133,11 @@
                                                                                
        <xsl:otherwise>
                                                                                
                <option value="{location_code}">
                                                                                
                <xsl:choose>
-                                                                               
                        <xsl:when test="loc2_name != ''">
-                                                                               
                                <xsl:value-of select="loc2_name"/>
+                                                                               
                        <xsl:when test="name != ''">
+                                                                               
                                <xsl:value-of select="name"/>
                                                                                
                        </xsl:when>
-                                                                               
                        <xsl:when test="loc1_name != ''">
-                                                                               
                                <xsl:value-of select="loc1_name"/>
-                                                                               
                        </xsl:when>
                                                                                
                        <xsl:otherwise>
-                                                                               
                                <xsl:value-of select="php:function('lang', 
'no_name_unit')"/> (<xsl:value-of select="location_code"/>)
+                                                                               
                                        <xsl:value-of 
select="$lang_no_name_unit"/> (<xsl:value-of select="location_code"/>)
                                                                                
                        </xsl:otherwise>
                                                                                
                </xsl:choose>
                                                                                
                </option>
@@ -156,7 +149,6 @@
                                                </div>
                                        </td>
                                        <td>
-                                               
                                                <div id="area_and_price" 
style="margin-top: 2em;">
                                                <ul>
                                                        <li 
style="border-style: none none solid none; border-width: 1px; border-color: 
grey; padding-bottom: 5px; "><em><img 
src="frontend/templates/base/images/16x16/house.png" 
class="list_image"/></em><xsl:value-of select="php:function('lang', 
'chosen_unit')"/>:</li>
@@ -168,7 +160,13 @@
                                        <td>
                                                <br/>
                                                <div id="unit_image">
-                                                       <img 
src="index.php?menuaction=frontend.uifrontend.objectimg&amp;loc_code={//header/selected_location}"
 alt="" />
+                                                       <img alt="">
+                                                               <xsl:attribute 
name="src">
+                                                                       
<xsl:value-of select="php:function('get_phpgw_link', '/index.php', 
'menuaction:frontend.uifrontend.objectimg')" />
+                                                                       
<xsl:text>&amp;loc_code=</xsl:text>
+                                                                       
<xsl:value-of select="//header/selected_location"/>
+                                                               </xsl:attribute>
+                                                       </img>
                                                </div>
                                        </td>
                                </tr>


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


Property changes on: 
branches/Version-1_0-branch/frontend/templates/base/helpdesk.xsl
___________________________________________________________________
Modified: svn:keywords
   - Id Revision
   + Revision Author Id


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


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


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


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


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


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

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1127,6 +1127,7 @@
                                        'column_name'                   => 
$this->_db->f('column_name'),
                                        'name'                                  
=> $this->_db->f('column_name'),
                                        'size'                                  
=> $this->_db->f('size'),
+                                       'precision'                             
=> $this->_db->f('precision_'),
                                        'statustext'                    => 
$this->_db->f('statustext', true),
                                        'input_text'                    => 
$this->_db->f('input_text', true),
                                        'type_name'                             
=> $this->_db->f('type'),

Modified: branches/Version-1_0-branch/phpgwapi/inc/class.db.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.db.inc.php   2013-10-23 
13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.db.inc.php   2013-10-23 
13:18:01 UTC (rev 11387)
@@ -261,7 +261,7 @@
                /**
                * Discard the current query result
                */
-               public function free()
+               final public function free()
                {
                        //unset($this->resultSet);
                        $this->resultSet = array();
@@ -364,7 +364,7 @@
                 * @param array $value_set array of values to insert into the 
database
                 * @return string the prepared sql, empty string for invalid 
input
                 */
-               public function validate_insert($values)
+               final public function validate_insert($values)
                {
                        if ( !is_array($values) || !count($values) )
                        {
@@ -399,7 +399,7 @@
                 * @param array $value_set associative array of values to 
update the database with
                 * @return string the prepared sql, empty string for invalid 
input
                 */
-               public function validate_update($value_set)
+               final public function validate_update($value_set)
                {
                        if ( !is_array($value_set) || !count($value_set) )
                        {
@@ -567,7 +567,7 @@
                * @internal the string is compatiable with PHP's date()
                * @return string the date format string
                */
-               public static function date_format()
+               final public static function date_format()
                {
                        static $date_format = null;
                        if ( is_null($date_format) )
@@ -593,7 +593,7 @@
                * @internal the string is compatiable with PHP's date()
                * @return string the date format string
                */
-               public static function datetime_format()
+               final public static function datetime_format()
                {
                        static $datetime_format = null;
                        if ( is_null($datetime_format) )
@@ -618,7 +618,7 @@
                *
                * @return string the formatted string
                */
-               public static function money_format($amount)
+               final public static function money_format($amount)
                {
                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='mssql')
                        {
@@ -659,7 +659,7 @@
                * @return int the next id
                */
 
-               public function next_id($table='',$key='')
+               final public function next_id($table='',$key='')
                {
                        $where = '';
                        $condition = array();
@@ -685,7 +685,7 @@
                        return $next_id;
                }
 
-               public function get_transaction()
+               final public function get_transaction()
                {
                        return $this->Transaction;
                }

Modified: branches/Version-1_0-branch/property/inc/class.bolookup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bolookup.inc.php     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.bolookup.inc.php     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -273,8 +273,10 @@
                        $sogeneric      = CreateObject('property.sogeneric');
 
                        $location_info = 
$sogeneric->get_location_info('vendor');
+                       
+                       $this->order = $this->order ? $this->order : 'org_name';
+                       $this->sort = $this->sort ? $this->sort : 'ASC';
 
-
                        if (! $filter )
                        {
                                foreach ( $location_info['fields'] as $field )

Modified: branches/Version-1_0-branch/property/inc/class.historylog.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.historylog.inc.php   
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.historylog.inc.php   
2013-10-23 13:18:01 UTC (rev 11387)
@@ -155,9 +155,12 @@
                }
 
                // array $filter_out
-               function return_array($filter_out,$only_show,$_orderby = 
'',$sort = '', $record_id,$attrib_id='',$detail_id='')
+               function return_array($filter_out, $only_show, $_orderby = '', 
$sort = '', $record_id, $attrib_id=0, $detail_id=0)
                {
-
+                       $record_id = (int) $record_id;
+                       $attrib_id = (int) $attrib_id;
+                       $detail_id = (int) $detail_id;
+                       
                        if (! $sort || ! $_orderby)
                        {
                                $orderby = 'order by 
history_timestamp,history_id';
@@ -175,17 +178,17 @@
                        $filter = '';
                        if (isset($filtered))
                        {
-                               $filter = ' and ' . implode(' and ',$filtered);
+                               $filter = ' AND ' . implode(' AND ',$filtered);
                        }
 
                        if($attrib_id)
                        {
-                               $filter .= " and history_attrib_id = 
$attrib_id";
+                               $filter .= " AND history_attrib_id = 
$attrib_id";
                        }
 
                        if($detail_id)
                        {
-                               $filter .= " and history_detail_id = 
$detail_id";
+                               $filter .= " AND history_detail_id = 
$detail_id";
                        }
 
                        while (is_array($only_show) && list(,$_filter) = 
each($only_show))
@@ -196,28 +199,28 @@
                        $only_show_filter = '';
                        if (isset($_only_show))
                        {
-                               $only_show_filter = ' and (' . implode(' or 
',$_only_show) . ')';
+                               $only_show_filter = ' AND (' . implode(' OR 
',$_only_show) . ')';
                        }
 
-                       $this->db->query("select * from $this->table where 
history_appname='"
-                               . $this->appname . "' and 
history_record_id='$record_id' $filter $only_show_filter "
+                       $this->db->query("SELECT * FROM {$this->table} WHERE 
history_appname='"
+                               . $this->appname . "' AND 
history_record_id=$record_id $filter $only_show_filter "
                                . "$orderby",__LINE__,__FILE__);
 
                        $return_values = array();
                        while ($this->db->next_record())
                        {
                                $return_values[] = array
-                                       (
-                                               'id'                    => 
$this->db->f('history_id'),
-                                               'record_id'             => 
$this->db->f('history_record_id'),
-                                               'owner'                 => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
-       //                                      'status'                => 
lang($this->types[$this->db->f('history_status')]),
-                                               'status'                => 
preg_replace('/ /','',$this->db->f('history_status')),
-                                               'new_value'             => 
$this->db->f('history_new_value',true),
-                                               'old_value'             => 
$this->db->f('history_old_value',true),
-                                               'datetime'              => 
strtotime($this->db->f('history_timestamp')),
-                                               'publish'               => 
$this->db->f('publish')
-                                       );
+                               (
+                                       'id'                    => 
$this->db->f('history_id'),
+                                       'record_id'             => 
$this->db->f('history_record_id'),
+                                       'owner'                 => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('history_owner')),
+       //                              'status'                => 
lang($this->types[$this->db->f('history_status')]),
+                                       'status'                => 
preg_replace('/ /','',$this->db->f('history_status')),
+                                       'new_value'             => 
$this->db->f('history_new_value',true),
+                                       'old_value'             => 
$this->db->f('history_old_value',true),
+                                       'datetime'              => 
strtotime($this->db->f('history_timestamp')),
+                                       'publish'               => 
$this->db->f('publish')
+                               );
                        }
                        return $return_values;
                }

Modified: branches/Version-1_0-branch/property/inc/class.soXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soXport.inc.php      
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.soXport.inc.php      
2013-10-23 13:18:01 UTC (rev 11387)
@@ -268,6 +268,7 @@
                                                $fields['item_type'],
                                                $fields['item_id'],
                                                $fields['external_ref'],
+                                               $fields['external_voucher_id'],
                                                isset($fields['currency']) && 
$fields['currency'] ? $fields['currency'] : 'NOK'
                                        );
 
@@ -278,7 +279,7 @@
                                        $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,bilagsnr_ut,splitt,kildeid,kidnr,typeid,fakturadato,"
                                                . " 
forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
                                                . " 
fakturanr,spbudact_code,loc1,dima,dimd,dime,mvakode,periode,merknad,line_text,oppsynsigndato,saksigndato,"
-                                               . " 
budsjettsigndato,utbetalingsigndato,item_type,item_id,external_ref,currency,belop,godkjentbelop)"
+                                               . " 
budsjettsigndato,utbetalingsigndato,item_type,item_id,external_ref,external_voucher_id,currency,belop,godkjentbelop)"
                                                . " VALUES ({$values}," . 
$this->db->money_format($fields['belop']) . ',' . 
$this->db->money_format($fields['godkjentbelop']) .')';
 
                                        
$this->db->query($sql,__LINE__,__FILE__);
@@ -348,6 +349,7 @@
                                $data['item_type'],
                                $data['item_id'],
                                $data['external_ref'],
+                               $data['external_voucher_id'],
                                $data['currency'],
                                $data['manual_record'],
                                $data['process_code'],
@@ -360,7 +362,7 @@
                                . " 
periode,periodization,periodization_start,forfallsdato,fakturanr,spbudact_code,regtid,artid,spvend_code,dima,loc1,"
                                . " 
dimb,mvakode,dimd,dime,oppsynsmannid,saksbehandlerid,budsjettansvarligid,oppsynsigndato,saksigndato,"
                                . " 
budsjettsigndato,merknad,line_text,splitt,utbetalingid,utbetalingsigndato,filnavn,overftid,item_type,item_id,external_ref,"
-                               . " 
currency,manual_record,process_code,process_log,belop,godkjentbelop,ordrebelop)"
+                               . " 
external_voucher_id,currency,manual_record,process_code,process_log,belop,godkjentbelop,ordrebelop)"
                                . "VALUES ($values, "
                                . $this->db->money_format($data['belop']) . ","
                                . 
$this->db->money_format($data['godkjentbelop']) . ","
@@ -439,6 +441,7 @@
                                        'utbetalingid'                  => 
$this->db->f('utbetalingid'),
                                        'utbetalingsigndato'    => 
$this->db->f('utbetalingsigndato'),
                                        'external_ref'                  => 
$this->db->f('external_ref'),
+                                       'external_voucher_id'   => 
$this->db->f('external_voucher_id'),
                                        'kostra_id'                             
=> $this->db->f('kostra_id'),
                                        'currency'                              
=> $this->db->f('currency'),
                                        'process_log'                   => 
$this->db->f('process_log',true),

Modified: branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.socommon_core.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -7,7 +7,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage core
-       * @version $Id: class.socommon_core.inc.php 10127 2012-10-07 17:06:01Z 
sigurdne $
+       * @version $Id$
        */
 
        /*


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

Modified: branches/Version-1_0-branch/property/inc/class.uilookup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uilookup.inc.php     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.uilookup.inc.php     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -882,7 +882,7 @@
 
                        if ( (phpgw::get_var("start")== "") && 
(phpgw::get_var("order",'string')== ""))
                        {
-                               $datatable['sorting']['order']                  
= 'id'; // name key Column in myColumnDef
+                               $datatable['sorting']['order']                  
= 'org_name'; // name key Column in myColumnDef
                                $datatable['sorting']['sort']                   
= 'asc'; // ASC / DESC
                        }
                        else

Modified: branches/Version-1_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/class.uitts.inc.php        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -1810,6 +1810,29 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a location - or an 
entity!'));
                                }
 
+                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               {
+                                       foreach ($values_attribute as 
&$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'I' && ! 
ctype_digit($attribute['value']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));                                              
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'V' && 
strlen($attribute['value']) > $attribute['precision'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Max length for attribute %1 is: %2', 
"\"{$attribute['input_text']}\"",$attribute['precision']));
+                                                       $attribute['value'] = 
substr($attribute['value'],0,$attribute['precision']);
+                                               }
+                                       }
+                               }
+
+
                                if(!$values['assignedto'] && 
!$values['group_id'])
                                {
                                        $_responsible = 
execMethod('property.boresponsible.get_responsible', $values);
@@ -2346,6 +2369,29 @@
                                        
$receipt['error'][]=array('msg'=>lang('budget') . ': ' . lang('Please enter an 
integer !'));
                                }
 
+                               if(isset($values_attribute) && 
is_array($values_attribute))
+                               {
+                                       foreach ($values_attribute as 
&$attribute )
+                                       {
+                                               if($attribute['nullable'] != 1 
&& (!$attribute['value'] && !$values['extra'][$attribute['name']]))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter value for attribute %1', 
$attribute['input_text']));
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'I' && ! 
ctype_digit($attribute['value']))
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Please enter integer for attribute %1', 
$attribute['input_text']));                                              
+                                               }
+
+                                               if(isset($attribute['value']) 
&& $attribute['value'] && $attribute['datatype'] == 'V' && 
strlen($attribute['value']) > $attribute['precision'])
+                                               {
+                                                       
$receipt['error'][]=array('msg'=>lang('Max length for attribute %1 is: %2', 
$attribute['input_text'],$attribute['precision']));
+                                                       $attribute['value'] = 
substr($attribute['value'],0,$attribute['precision']);
+                                               }
+                                       }
+                               }
+
+
                                if($access_order)
                                {
                                        if((isset($values['order_id']) && 
$values['order_id']) && (!isset($values['budget']) || !$values['budget']) )

Copied: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
 (from rev 11386, trunk/property/inc/cron/default/Import_fra_agresso_X205.php)
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
                           (rev 0)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
   2013-10-23 13:18:01 UTC (rev 11387)
@@ -0,0 +1,835 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage import
+       * @version $Id$
+       */
+
+       /**
+        * Filteret benytter format X205 for integrasjon mellom Contempus 
Invoice og ClockWork Logistics.
+        * Formatet sender innskannede fakturaer fra Contempus til ClockWork - 
og Portico Estate
+        * @package property
+        */
+
+
+       class  Import_fra_basware_X205
+       {
+               var     $function_name = 'Import_fra_basware_X205';
+               var $auto_tax = true;
+               var $mvakode=0;
+               var $kildeid=1;
+               var $splitt=0;
+               var $soXport;
+               var $invoice;
+               var $default_kostra_id = 9999; //dummy
+               var $debug = false;
+               var $skip_import = false;
+               protected $export;
+               protected $receipt = array();
+
+
+               function __construct()
+               {
+                       $this->soXport                  = 
CreateObject('property.soXport');
+                       $this->invoice                  = 
CreateObject('property.soinvoice');
+                       $this->responsible              = 
CreateObject('property.soresponsible');
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->db                               = & 
$GLOBALS['phpgw']->db;
+                       $this->join                             = & 
$this->db->join;
+                       $this->left_join                = & 
$this->db->left_join;
+                       $this->like                             = & 
$this->db->like;
+                       $this->dateformat               = 
$this->db->date_format();
+                       $this->datetimeformat   = $this->db->datetime_format();
+                       $this->config                   = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       $this->send                             = 
CreateObject('phpgwapi.send');
+
+                       include (PHPGW_SERVER_ROOT . 
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/Basware_X114");
+                       $this->export           = new export_conv;
+               }
+
+               function pre_run($data = array())
+               {
+                       if(isset($data['enabled']) && $data['enabled']==1)
+                       {
+                               $confirm        = true;
+                               $cron           = true;
+                       }
+                       else
+                       {
+                               $confirm        = phpgw::get_var('confirm', 
'bool', 'POST');
+                               $execute        = phpgw::get_var('execute', 
'bool', 'GET');
+                       }
+
+                       if( isset($data['debug']) && $data['debug'] )
+                       {
+                               $this->debug = true;
+                       }
+                       else
+                       {
+                               $this->debug    = phpgw::get_var('debug', 
'bool');
+                       }
+
+                       if ($confirm)
+                       {
+                               $this->execute($cron);
+                       }
+                       else
+                       {
+                               $this->confirm($execute=false);
+                       }
+               }
+
+               function confirm($execute='')
+               {
+                       $link_data = array
+                       (
+                               'menuaction'    => 
'property.custom_functions.index',
+                               'function'              => $this->function_name,
+                               'execute'               => $execute,
+                               'debug'                 => $this->debug
+                       );
+
+
+                       if(!$execute)
+                       {
+                               $lang_confirm_msg       = lang('do you want to 
perform this action');
+                       }
+
+                       $lang_yes                       = lang('yes');
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('confirm_custom'));
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $data = array
+                       (
+                               'msgbox_data'                   => 
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+                               'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php', 
array('menuaction'=>'property.uiasync.index')),
+                               'run_action'                    => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
+                               'message'                               => 
$this->receipt['message'],
+                               'lang_confirm_msg'              => 
$lang_confirm_msg,
+                               'lang_yes'                              => 
$lang_yes,
+                               'lang_yes_statustext'   => 'Importer faktura 
fra Basware',
+                               'lang_no_statustext'    => 'tilbake',
+                               'lang_no'                               => 
lang('no'),
+                               'lang_done'                             => 
'Avbryt',
+                               'lang_done_statustext'  => 'tilbake'
+                       );
+
+                       $appname                = lang('location');
+                       $function_msg   = 'Importer faktura fra Basware';
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . ' - ' . $appname . ': ' . $function_msg;
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('confirm' => $data));
+                       $GLOBALS['phpgw']->xslttpl->pp();
+               }
+
+
+               protected function check_archive()
+               {
+                       $dirname = 
$this->config->config_data['import']['local_path'];
+
+                       if ( preg_match('/\./', $dirname) 
+                        || !is_dir($dirname) )
+                       {
+                               return array();
+                       }
+
+                       $archive = "{$dirname}/archive";
+                       $file_list = array();
+                       $dir = new DirectoryIterator($archive); 
+                       if ( is_object($dir) )
+                       {
+                               foreach ( $dir as $file )
+                               {
+                                       if ( $file->isDot()
+                                               || !$file->isFile()
+                                               || !$file->isReadable()
+                                               || strcasecmp( end( explode( 
".", $file->getPathname() ) ), 'xml' ) != 0 )
+                                       {
+                                               continue;
+                                       }
+
+                                       $file_list[] = (string) $file;
+                               }
+                       }
+
+                       foreach($file_list as $file)
+                       {
+                               $file_parts = explode('_', basename($file, 
'.xml'));
+                       //      $external_ref = $file_parts[2];
+                               $external_voucher_id = $file_parts[2];
+
+                               $duplicate = false;
+                               $sql = "SELECT bilagsnr FROM fm_ecobilag WHERE 
external_voucher_id = '{$external_voucher_id}'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $duplicate = true;
+                               }
+
+                               $sql = "SELECT bilagsnr FROM fm_ecobilagoverf 
WHERE external_voucher_id = '{$external_voucher_id}'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $duplicate = true;
+                               }
+
+                               if( !$duplicate )
+                               {
+                                       rename("{$archive}/{$file}", 
"{$dirname}/{$file}");
+                                       $this->receipt['message'][] = 
array('msg' => "fil tilbakeført fra arkiv til importkø: 
{$external_voucher_id}");
+                               }
+                       }
+               }
+
+               protected function remind()
+               {
+                       if 
(!isset($GLOBALS['phpgw_info']['server']['smtp_server']) || 
!$GLOBALS['phpgw_info']['server']['smtp_server'])
+                       {
+                               return;
+                       }
+
+                       // max. one mail each day
+                       if ( (int) 
$GLOBALS['phpgw_info']['server']['invoice_mail_reminder_time'] < (time() - 
(3600 * 24)) )
+                       {
+                               $toarray = array();
+                               $sql = 'SELECT DISTINCT oppsynsmannid as 
responsible FROM fm_ecobilag WHERE oppsynsigndato IS NULL AND oppsynsmannid IS 
NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+                               $sql = 'SELECT DISTINCT saksbehandlerid as 
responsible FROM fm_ecobilag WHERE saksigndato IS NULL AND saksbehandlerid IS 
NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+                               $sql = 'SELECT DISTINCT budsjettansvarligid as 
responsible FROM fm_ecobilag WHERE saksigndato IS NOT NULL AND budsjettsigndato 
IS NULL AND budsjettansvarligid IS NOT NULL';
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               while($this->db->next_record())
+                               {
+                                       $toarray[$this->db->f('responsible')] = 
true;
+                               }
+
+                               $subject = 'Du har faktura til behandling';
+
+                               foreach ($toarray as $lid => $dummy)
+                               {
+                                       $prefs = 
$this->bocommon->create_preferences('property', 
$GLOBALS['phpgw']->accounts->name2id($lid));
+                                       if(isset($prefs['email']) && 
$prefs['email'])
+                                       {
+                                               $body = '<a href ="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiinvoice2.index', 'voucher_id' => $bilagsnr, 'user_lid' => $lid 
),false,true).'">Link til fakturabehandling</a>';
+                                               try
+                                               {
+                                                       $rc = 
$this->send->msg('email',$prefs['email'], $subject, stripslashes($body), '', 
'', '','','','html');
+                                               }
+                                               catch (phpmailerException $e)
+                                               {
+                                                       
$this->receipt['error'][] = array('msg' => $e->getMessage());
+                                               }
+                                       }
+                               }
+                               // save time of mail, to not send to many mails
+                               $config = createObject('phpgwapi.config', 
'phpgwapi');
+                               $config->read_repository();
+                               $config->value('invoice_mail_reminder_time', 
time());
+                               $config->save_repository();
+                       }
+               }
+
+               public function execute($cron='')
+               {
+                       
if(isset($this->config->config_data['import']['check_archive']) && 
$this->config->config_data['import']['check_archive'])
+                       {
+                               $this->check_archive();
+                       }
+
+                       $this->get_files();
+                       $dirname = 
$this->config->config_data['import']['local_path'];
+                       // prevent path traversal
+                       if ( preg_match('/\./', $dirname) 
+                        || !is_dir($dirname) )
+                       {
+                               return array();
+                       }
+
+                       $file_list = array();
+                       $dir = new DirectoryIterator($dirname); 
+                       if ( is_object($dir) )
+                       {
+                               foreach ( $dir as $file )
+                               {
+                                       if ( $file->isDot()
+                                               || !$file->isFile()
+                                               || !$file->isReadable()
+                                               || strcasecmp( end( explode( 
".", $file->getPathname() ) ), 'xml' ) != 0 )
+                                       {
+                                               continue;
+                                       }
+
+                                       $file_list[] = (string) 
"{$dirname}/{$file}";
+                               }
+                       }
+
+                       if(is_writable("{$dirname}/archive"))
+                       {
+                               foreach($file_list as $file)
+                               {
+                                       $this->db->transaction_begin();
+                                       $bilagsnr = $this->import($file);
+                                       if ($bilagsnr)
+                                       {
+                                               // move file
+                                               $_file = basename($file);
+                                               $movefrom = 
"{$dirname}/{$_file}";
+                                               $moveto = 
"{$dirname}/archive/{$_file}";
+
+                                               if( is_file($moveto) )
+                                               {
+                                                       @unlink($moveto);//in 
case of duplicates
+                                               }
+
+                                               $ok = @rename($movefrom, 
$moveto);
+                                               if(!$ok) // Should never happen.
+                                               {
+                                               //      
$this->invoice->delete($bilagsnr);
+                                                       
$this->db->transaction_abort();
+                                                       
$this->receipt['error'][] = array('msg' => "Kunne ikke flytte importfil til 
arkiv, Bilag {$bilagsnr} er slettet");
+                                               }
+                                               else
+                                               {
+                                                       
$this->db->transaction_commit();
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $this->db->transaction_abort();
+                                       }
+                               }
+                       }
+                       else
+                       {
+                               $this->receipt['error'][] = array('msg' => 
"Arkiv katalog '{$dirname}/archive/' ikke er ikke skrivbar - kontakt 
systemadminstrator for å korrigere");
+                       }
+
+                       $this->remind();
+
+                       if(!$cron)
+                       {
+                               $this->confirm($execute=false);
+                       }
+
+                       $msgbox_data = 
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+                       $insert_values= array
+                       (
+                               $cron,
+                               date($this->db->datetime_format()),
+                               $this->function_name,
+                               
$this->db->db_addslashes(implode(',',(array_keys($msgbox_data))))
+                       );
+
+                       $insert_values  = 
$this->db->validate_insert($insert_values);
+
+                       $sql = "INSERT INTO fm_cron_log 
(cron,cron_date,process,message) "
+                                       . "VALUES ($insert_values)";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+               }
+
+               protected function get_files()
+               {
+                       $server                         = 
$this->config->config_data['common']['host'];
+                       $user                           = 
$this->config->config_data['common']['user'];
+                       $password                       = 
$this->config->config_data['common']['password'];
+                       $directory_remote       = 
rtrim($this->config->config_data['import']['remote_basedir'],'/');
+                       $directory_local        = 
rtrim($this->config->config_data['import']['local_path'],'/');
+                       $port                           = 22;
+
+                       if (!function_exists("ssh2_connect"))
+                       {
+                               die("function ssh2_connect doesn't exist");
+                       }
+                       if(!($connection = ssh2_connect($server, $port)))
+                       {
+                               echo "fail: unable to establish connection\n";
+                       }
+                       else
+                       {
+                               // try to authenticate with username root, 
password secretpassword
+                               if(!ssh2_auth_password($connection, $user, 
$password))
+                               {
+                                       echo "fail: unable to authenticate\n";
+                               }
+                               else
+                               {
+                                       // allright, we're in!
+                                       echo "okay: logged in...<br/>";
+
+                                       // Enter "sftp" mode
+                                       $sftp = @ssh2_sftp($connection);
+
+                                       // Scan directory
+                                       $files = array();
+                                       echo "Scanning 
{$directory_remote}<br/>";
+                                       $dir = 
"ssh2.sftp://$sftp$directory_remote";;
+                                       $handle = opendir($dir);
+                                       while (false !== ($file = 
readdir($handle)))
+                                       {
+                                               if (is_dir($file))
+                                               {
+//                                                     echo "Directory: 
$file<br/>";
+                                                       continue;
+                                               }
+
+/*                                             $size = 
filesize("ssh2.sftp://$sftp$directory_remote/$file";);
+                                               echo "File $file Size: 
$size<br/>";
+
+                                               $stream = 
@fopen("ssh2.sftp://$sftp$directory_remote/$file";, 'r');
+                                               $contents = fread($stream, 
filesize("ssh2.sftp://$sftp$directory_remote/$file";));
+                                               @fclose($stream);
+                                               echo "CONTENTS: 
$contents<br/><br/>";
+*/
+                                               $files[] = $file;
+                                       }
+
+                                       if ($this->debug)
+                                       {
+                                               _debug_array($files);
+                                       }
+                                       else
+                                       {
+                                               foreach($files as $file_name)
+                                               {
+                                                       if( stripos( 
$file_name, 'x205' ) === 0)
+                                                       {
+                                               //              
_debug_array($file_name);
+                                                               $file_remote = 
"{$directory_remote}/{$file_name}";         
+                                                               $file_local = 
"{$directory_local}/{$file_name}";
+
+                                                               $stream = 
fopen("ssh2.sftp://$sftp$file_remote";, 'r');
+                                                               $contents = 
fread($stream, filesize("ssh2.sftp://$sftp$file_remote";));
+                                                               fclose($stream);
+
+                                                               $fp = 
fopen($file_local, "wb");
+                                                               
fwrite($fp,$contents);
+
+                                                               if(fclose($fp))
+                                                               {
+                                                                       echo 
"File remote: {$file_remote} was copied to local: $file_local<br/>";
+                                                                       if( 
ssh2_sftp_unlink ($sftp, "{$directory_remote}/archive/{$file_name}" ))
+                                                                       {
+                                                                               
echo "Deleted duplicate File remote: 
{$directory_remote}/archive/{$file_name}<br/>";
+                                                                       }
+                                                                       if( 
ssh2_sftp_rename ($sftp, $file_remote, 
"{$directory_remote}/archive/{$file_name}" ))
+                                                                       {
+                                                                               
echo "File remote: {$file_remote} was moved to remote: 
{$directory_remote}/archive/{$file_name}<br/>";
+                                                                       }
+                                                                       else
+                                                                       {
+                                                                               
echo "ERROR! File remote: {$file_remote} failed to move to remote: 
{$directory_remote}/archive/{$file_name}<br/>";
+                                                                               
if(unlink($file_local))
+                                                                               
{
+                                                                               
        echo "Lokal file was deleted: {$file_local}<br/>";
+                                                                               
}
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+
+               protected function import($file)
+               {
+//                     $valid_data= False;
+
+                       $buffer = array();
+                       $bilagsnr = false;
+
+                       $xmlparse = CreateObject('property.XmlToArray');
+                       $xmlparse->setEncoding('UTF-8');
+                       $var_result = $xmlparse->parseFile($file);
+
+                       set_time_limit(300);
+
+                       if (isset($var_result['INVOICES']) && 
is_array($var_result['INVOICES']))
+                       {
+                               $transferdate =  str_replace('.', '-', 
$var_result['TRANSACTIONINFORMATION'][0]['TRANSFERDATE']);// 2009.05.28
+                               $transfertime =  
$var_result['TRANSACTIONINFORMATION'][0]['TRANSFERTIME'];// 13:10:28
+                               $regtid         = 
date($this->datetimeformat,strtotime("{$transferdate} {$transfertime}"));
+
+                               $i = 0;
+                               $_data = 
$var_result['INVOICES'][0]['INVOICE'][0]['INVOICEHEADER'][0];
+
+//_debug_array($_data);
+//die();
+
+                               $_data['ARRIVAL']; // => 2009.05.28
+                               $_data['CLIENT.CODE']; // => 14
+                               $_data['EXCHANGERATE']; // => 1
+                               $_data['LOCALAMOUNT']; // => 312500
+                               $_data['LOCALVATAMOUNT']; // => 62500
+                               $_data['PAYAMOUNT']; // => 0
+                               $_data['POSTATUSUPDATED']; // => 0
+                               $_data['PURCHASEORDERSTATUS.CODE']; // => 
WaitForMatch
+                               $_data['SUPPLIER.BANKGIRO']; // => 70580621110
+                               $_data['VATAMOUNT']; // => 62500
+
+                               $bilagsnr_ut = isset($_data['VOUCHERID']) ? 
$_data['VOUCHERID'] : ''; // FIXME: innkommende bilagsnummer?
+
+                               $fakturanr              = 
$_data['SUPPLIERREF'];//$_data['KEY'];
+                               $fakturadato    = 
date($this->dateformat,strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
+                               $forfallsdato   = 
date($this->dateformat,strtotime(str_replace('.', '-', $_data['MATURITY'])));
+                               $periode                = 
'';//date('Ym',strtotime(str_replace('.', '-', $_data['INVOICEDATE'])));
+                               $belop                  = $_data['AMOUNT']/100;
+
+                               if( $belop < 0 )
+                               {
+                                       $buffer[$i]['artid'] = 2;
+                               }
+                               else
+                               {
+                                       $buffer[$i]['artid'] = 1;
+                               }
+
+                               $kidnr                                          
= $_data['KIDNO'];
+                               $_order_id                                      
= $_data['PURCHASEORDERNO'];
+                               $merknad                                        
= '';
+                               $line_text                                      
= '';
+                               $order_id                                       
= '';
+                               $buffer[$i]['project_id']       = '';
+
+                               $order_info = 
$this->get_order_info($_order_id); // henter default verdier selv om  
$_order_id ikke er gyldig.
+
+                               if(!$_order_id)
+                               {
+                                       $merknad = 'Mangler bestillingsnummer';
+                                       $this->receipt['error'][] = array('msg' 
=> $merknad);
+                               }
+                               else if (!ctype_digit($_order_id))
+                               {
+                                       $merknad = "bestillingsnummeret er på 
feil format: {$_order_id}";
+                                       $this->receipt['error'][] = array('msg' 
=> $merknad);
+                               }
+                               else if (!$order_info['order_exist'])
+                               {
+                                       $merknad = 'bestillingsnummeret ikke 
gyldig: ' . $_order_id;
+                                       $this->receipt['error'][] = array('msg' 
=> $merknad);
+                               }
+                               else
+                               {
+                                       $buffer[$i]['project_id'] = 
$this->soXport->get_project($_order_id);
+                                       $order_id = $_order_id;
+                               }
+
+                               $buffer[$i]['external_ref']                     
= $_data['SCANNINGNO'];
+                               $buffer[$i]['external_voucher_id']      = 
$_data['KEY']; // => 1400050146
+                               $buffer[$i]['pmwrkord_code']            = 
$order_id;
+                               $buffer[$i]['fakturanr']                        
= $fakturanr;
+                               $buffer[$i]['periode']                          
= $periode;
+                               $buffer[$i]['forfallsdato']                     
= $forfallsdato;
+                               $buffer[$i]['fakturadato']                      
= $fakturadato;
+                               $buffer[$i]['belop']                            
= $belop;
+                               $buffer[$i]['currency']                         
= $_data['CURRENCY.CURRENCYID'];
+                               $buffer[$i]['godkjentbelop']            = 
$belop;
+
+                               $buffer[$i]['kidnr']                            
= $kidnr;
+                               $buffer[$i]['bilagsnr_ut']                      
= $bilagsnr_ut;
+                               $buffer[$i]['referanse']                        
= "ordre: {$order_id}";
+
+                               $buffer[$i]['dima']                             
= $order_info['dima'];
+                               $buffer[$i]['dimb']                             
= $order_info['dimb'];
+                               $buffer[$i]['dime']                             
= $order_info['dime'];
+                               $buffer[$i]['loc1']                             
= $order_info['loc1'];
+                               $buffer[$i]['line_text']                        
= $order_info['title'];
+
+                               $buffer[$i]['mvakode'] = $this->mvakode;
+
+                               if($buffer[$i]['loc1'] && $this->auto_tax)
+                               {
+                                       $mvakode = 
$this->soXport->auto_tax($buffer[$i]['loc1']);
+
+                                       if($mvakode)
+                                       {
+                                               $buffer[$i]['mvakode'] = 
$mvakode;
+                                       }
+                               }
+
+                               $duplicate = false;
+                               $sql = "SELECT bilagsnr, external_ref FROM 
fm_ecobilag WHERE external_ref = '{$_data['SCANNINGNO']}'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $duplicate = true;
+                                       $bilagsnr = $this->db->f('bilagsnr');
+                                       $this->receipt['message'][] = 
array('msg' => "Ikke importert duplikat til arbeidsregister: 
{$_data['SCANNINGNO']}");
+                               }
+
+                               $sql = "SELECT bilagsnr, bilagsnr_ut FROM 
fm_ecobilagoverf WHERE external_ref = '{$_data['SCANNINGNO']}'";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if($this->db->next_record())
+                               {
+                                       $duplicate = true;
+                                       $_bilagsnr_ut = 
$this->db->f('bilagsnr_ut');
+                                       $bilagsnr = $this->db->f('bilagsnr');
+                                       $__bilagsnr = $_bilagsnr_ut ? 
$_bilagsnr_ut : $bilagsnr;
+
+                                       if($_bilagsnr_ut)
+                                       {
+                                               $receipt = 
$this->export->RullTilbake(false,false,$_bilagsnr_ut);
+                                       }
+                                       else
+                                       {
+                                               $receipt = 
$this->export->RullTilbake(false,false,false,$bilagsnr);
+                                       }
+
+                                       if( isset($receipt['message']) )
+                                       {
+                                               $this->receipt['message'][] = 
array('msg' => "Bilag rullet tilbake fra historikk : {$__bilagsnr}");
+                                       }
+                                       else
+                                       {
+                                               $this->receipt['error'][] = 
array('msg' => "Bilag ikke rullet tilbake fra historikk : {$__bilagsnr}, extern 
ref: {$_data['SCANNINGNO']}");
+                                       }
+                                       unset($_bilagsnr_ut);
+                               }
+
+                               $vendor_id = $_data['SUPPLIER.CODE'];
+
+                               $sql = 'SELECT id FROM fm_vendor WHERE id = ' . 
(int) $vendor_id;
+                               $this->db->query($sql,__LINE__,__FILE__);
+
+                               if(!$_data['SUPPLIER.CODE'])
+                               {
+                                       $this->receipt['error'][] = array('msg' 
=> "LeverandørId ikke angitt for faktura: {$_data['SCANNINGNO']}");
+                                       $this->skip_import = true;
+                               }
+                               else if(!$this->db->next_record())
+                               {
+                                       $this->receipt['error'][] = array('msg' 
=> "Ikke gyldig LeverandørId: {$_data['SUPPLIER.CODE']}, Faktura: 
{$_data['SCANNINGNO']}");
+                                       $this->skip_import = true;
+
+                                       $to = 
isset($this->config->config_data['import']['email_on_error']) && 
$this->config->config_data['import']['email_on_error'] ? 
$this->config->config_data['import']['email_on_error'] : '';
+
+                                       if($to)
+                                       {
+                                               $body = "Ikke gyldig 
leverandør, id: {$_data['SUPPLIER.CODE']}</br>";
+                                               $body .= '<a href ="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uigeneric.edit', 'appname' => 'property', 'type' => 
'vendor'),false,true).'">Link til å legge inn ny leverandør</a>';
+
+                                               try
+                                               {
+                                                       $rc = 
$this->send->msg('email', $to, 'Ikke gyldig leverandør ved import av faktura 
til Portico', $body, '', '', '','','','html');
+                                                       if($rc)
+                                                       {
+                                                               
$this->receipt['message'][] = array('msg'=> "epost sendt til {$to}");
+                                                       }
+                                               }
+                                               catch (phpmailerException $e)
+                                               {
+                                                       
$this->receipt['error'][] = array('msg' => $e->getMessage());
+                                               }
+                                       }
+                               }
+                               else
+                               {
+                                       if ($order_info['vendor_id'] != 
$vendor_id)
+                                       {
+                                               $this->receipt['message'][] = 
array('msg' => 'Ikke samsvar med leverandør på bestilling og mottatt faktura');
+                                       }
+                               }
+
+                               if($this->auto_tax)
+                               {
+                                       $buffer[$i]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$i]['mvakode'], 
$order_info['spbudact_code']);
+                                       $buffer[$i]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$i]['mvakode'], $vendor_id);
+                               }
+
+                               $buffer[$i]['kostra_id'] = 
$this->default_kostra_id;//$this->soXport->get_kostra_id($buffer[$i]['loc1']);
+
+                               $buffer[$i]['merknad'] = $merknad;
+                               $buffer[$i]['splitt'] = $this->splitt;
+                               $buffer[$i]['kildeid'] = $this->kildeid;
+                               $buffer[$i]['spbudact_code'] = 
$order_info['spbudact_code'];
+                               $buffer[$i]['typeid'] = 
isset($invoice_common['type']) && $invoice_common['type'] ? 
$invoice_common['type'] : 1;
+                               $buffer[$i]['regtid'] = $regtid;
+
+                               $buffer[$i]['spvend_code'] = $vendor_id;
+
+                               if(isset($order_info['janitor']) && 
$order_info['janitor'])
+                               {
+                                       $buffer[$i]['oppsynsmannid'] = 
$order_info['janitor'];
+                               }
+
+                               if(isset($order_info['supervisor']) && 
$order_info['supervisor'])
+                               {
+                               $buffer[$i]['saksbehandlerid']          = 
$order_info['supervisor'];
+                               }
+
+                               if(isset($order_info['budget_responsible']) && 
$order_info['budget_responsible'])
+                               {
+                                       $buffer[$i]['budsjettansvarligid']      
= $order_info['budget_responsible'];
+                               }
+                       }
+
+//_debug_array($buffer);
+//_debug_array($this->receipt);
+//_debug_array($order_info['toarray']);
+                       if(!$this->skip_import)
+                       {
+                               if(!$bilagsnr)
+                               {
+                                       $bilagsnr = 
$this->invoice->next_bilagsnr();
+
+                                       foreach($buffer as &$entry)
+                                       {
+                                               $entry['bilagsnr'] = $bilagsnr;
+                                       }
+                               }
+
+                               if($order_info['toarray'])
+                               {
+                                       $to = 
implode(';',$order_info['toarray']);
+
+                                       if 
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) && 
$GLOBALS['phpgw_info']['server']['smtp_server'])
+                                       {
+                                               $subject = 'Ny faktura venter 
på behandling';
+                                               $body = '<a href ="' . 
$GLOBALS['phpgw']->link('/index.php', array('menuaction' => 
'property.uiinvoice2.index', 'voucher_id' => $bilagsnr, 'query' => $bilagsnr, 
'user_lid' =>'all'),false,true).'">Link til fakturabehandling</a>';
+
+                                               try
+                                               {
+                                                       $rc = 
$this->send->msg('email', $to, $subject, stripslashes($body), '', $cc, 
$bcc,'','','html');
+                                               }
+                                               catch (phpmailerException $e)
+                                               {
+                                                       
$this->receipt['error'][] = array('msg' => $e->getMessage());
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $this->receipt['error'][] = 
array('msg'=>lang('SMTP server is not set! (admin section)'));
+                                       }
+                               }
+
+                               if(!$duplicate)
+                               {
+                                       
$GLOBALS['phpgw']->db->Exception_On_Error = true;
+                                       try
+                                       {
+                                               $bilagsnr = 
$this->import_end_file($buffer);
+                                       }
+                                       catch (Exception $e)
+                                       {
+                                               if($e)
+                                               {
+                                                       
$GLOBALS['phpgw']->log->error(array(
+                                                               'text'  => 
'import_fra_basware_X205::import() : error when trying to execute 
import_end_file(): %1',
+                                                               'p1'    => 
$e->getMessage(),
+                                                               'p2'    => '',
+                                                               'line'  => 
__LINE__,
+                                                               'file'  => 
__FILE__
+                                                       ));
+
+                                                       
$this->receipt['error'][] = array('msg'=> $e->getMessage());
+                                               }
+                                               return false;
+                                       }
+
+                                       
$GLOBALS['phpgw']->db->Exception_On_Error = false;
+                                       return $bilagsnr;
+                               }
+                               else
+                               {
+                                       $duplicate  = false;
+                                       return $bilagsnr;
+                               }
+                       }
+                       $this->skip_import = false;
+                       return false;
+               }
+
+               function get_order_info($order_id = '')
+               {
+                       $order_info = array();
+                       $toarray = array();
+                       $order_id = (int) $order_id;
+                       $sql = "SELECT 
fm_workorder.location_code,fm_workorder.vendor_id,fm_workorder.account_id,fm_workorder.ecodimb,fm_workorder.category,
 fm_workorder.user_id,fm_workorder.title"
+                       . " FROM fm_workorder {$this->join} fm_project ON 
fm_workorder.project_id = fm_project.id WHERE fm_workorder.id = {$order_id}";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       if(     $this->db->next_record())
+                       {
+                               $order_info['order_exist'] = true;
+                       }
+                       if ($this->db->f('location_code'))
+                       { 
+                               $parts = 
explode('-',$this->db->f('location_code'));
+                               $order_info['dima'] = implode('', $parts);
+                               $order_info['loc1'] = $parts[0];
+                       }
+
+                       $order_info['vendor_id']                        = 
$this->db->f('vendor_id');
+                       $order_info['spbudact_code']            = 
$this->db->f('account_id');
+                       $order_info['dimb']                                     
= $this->db->f('ecodimb');
+                       $order_info['dime']                                     
= $this->db->f('category');
+                       $order_info['title']                            = 
$this->db->f('title',true);                   
+
+                       $janitor_user_id                                        
= $this->db->f('user_id');
+                       $order_info['janitor']                          = 
$GLOBALS['phpgw']->accounts->get($janitor_user_id)->lid;
+                       $supervisor_user_id                             = 
$this->invoice->get_default_dimb_role_user(2, $order_info['dimb']);
+                       if($supervisor_user_id)
+                       {
+                               $order_info['supervisor']                       
= $GLOBALS['phpgw']->accounts->get($supervisor_user_id)->lid;
+                       }
+
+                       $budget_responsible_user_id                     = 
$this->invoice->get_default_dimb_role_user(3, $order_info['dimb']);
+                       if($budget_responsible_user_id)
+                       {
+                               $order_info['budget_responsible']       = 
$GLOBALS['phpgw']->accounts->get($budget_responsible_user_id)->lid;
+                       }
+
+                       if(!$order_info['budget_responsible'])
+                       {
+                               $order_info['budget_responsible'] = 
isset($this->config->config_data['import']['budget_responsible']) && 
$this->config->config_data['import']['budget_responsible'] ? 
$this->config->config_data['import']['budget_responsible'] : 'karhal';
+                       }
+
+                       $order_info['toarray'] = $toarray;
+                       return $order_info;
+               }
+
+               function import_end_file($buffer)
+               {
+                       $num = $this->soXport->add($buffer);
+                       if($num > 0)
+                       {
+                               $this->receipt['message'][]= array('msg' => 
"Importert {$num} poster til bilag {$buffer[0]['bilagsnr']}, SCANNINGNO: 
{$buffer[0]['external_ref']}, KEY: {$buffer[0]['external_voucher_id']}");
+                               return $buffer[0]['bilagsnr'];
+                       }
+                       return false;
+               }
+       }

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
   2013-10-23 13:13:32 UTC (rev 11386)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/BkBygg_editer_system_oversikt.php
   2013-10-23 13:18:01 UTC (rev 11387)
@@ -3,8 +3,6 @@
        /*
        * This class will update classification records baed on input.
        */
-       $systemoversikt = new ikt_systemoversikt();
-       
$systemoversikt->set_classification($values,$values_attribute,$entity_id,$cat_id,$receipt);
 
        class ikt_systemoversikt extends property_boentity
        {
@@ -121,3 +119,7 @@
                        
$this->so->edit($_values,$values_attribute,$entity_id,$cat_id);
                }
        }
+
+       $systemoversikt = new ikt_systemoversikt();
+       
$systemoversikt->set_classification($values,$values_attribute,$entity_id,$cat_id,$receipt);
+

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/catch_ticket_export.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/catch_ticket_export.php 
    2013-10-23 13:13:32 UTC (rev 11386)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/catch_ticket_export.php 
    2013-10-23 13:18:01 UTC (rev 11387)
@@ -5,9 +5,6 @@
                // out: 'deliver'
                // in: 'pickup'
 
-       $export = new catch_ticket_export();
-       $export->export_ticket($ticket);
-       
        class catch_ticket_export extends property_botts
        {
                protected $db;
@@ -283,3 +280,7 @@
                        return $connection;
                }
        }
+
+       $export = new catch_ticket_export();
+       $export->export_ticket($ticket);
+

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
       2013-10-23 13:13:32 UTC (rev 11386)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
       2013-10-23 13:18:01 UTC (rev 11387)
@@ -5,10 +5,6 @@
        * 
        */
 
-
-       $data_sync = new entity_data_sync();
-       $data_sync->update_data($values, $values_attribute, $action);
-
        class entity_data_sync extends property_boentity
        {
                protected $db;
@@ -181,3 +177,6 @@
                }
        }
 
+       $data_sync = new entity_data_sync();
+       $data_sync->update_data($values, $values_attribute, $action);
+

Modified: 
branches/Version-1_0-branch/property/inc/custom/default/ticket_redirect_based_on_status.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/custom/default/ticket_redirect_based_on_status.php
 2013-10-23 13:13:32 UTC (rev 11386)
+++ 
branches/Version-1_0-branch/property/inc/custom/default/ticket_redirect_based_on_status.php
 2013-10-23 13:18:01 UTC (rev 11387)
@@ -4,8 +4,6 @@
        * This class will enable status conditional redirect on tickets.
        * A config section will be defined where conditions on status and 
target can be configured.
        */
-       $ticket_redirect = new ticket_redirect_based_on_status();
-       $ticket_redirect->check_status($data);
 
        class ticket_redirect_based_on_status extends property_botts
        {
@@ -87,3 +85,6 @@
                        }
                }
        }
+
+       $ticket_redirect = new ticket_redirect_based_on_status();
+       $ticket_redirect->check_status($data);

Modified: branches/Version-1_0-branch/property/inc/export/default/Agresso
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Agresso     
2013-10-23 13:13:32 UTC (rev 11386)
+++ branches/Version-1_0-branch/property/inc/export/default/Agresso     
2013-10-23 13:18:01 UTC (rev 11387)
@@ -24,7 +24,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage export
-       * @version $Id: Agresso,v 1.35 2007/03/16 08:57:05 sigurdne Exp $
+       * @version $Id$
        */
 
        /**


Property changes on: 
branches/Version-1_0-branch/property/inc/export/default/Agresso
___________________________________________________________________
Added: svn:keywords
   + Revision Author Id

Copied: branches/Version-1_0-branch/property/inc/export/default/Agresso_X114 
(from rev 11386, trunk/property/inc/export/default/Agresso_X114)
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Agresso_X114        
                        (rev 0)
+++ branches/Version-1_0-branch/property/inc/export/default/Agresso_X114        
2013-10-23 13:18:01 UTC (rev 11387)
@@ -0,0 +1,1172 @@
+<?php
+       /**
+       * phpGroupWare - property: a Facilities Management System.
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software 
Foundation, Inc. http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
+       * @package property
+       * @subpackage export
+       * @version $Id$
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       phpgw::import_class('phpgwapi.datetime');
+
+       class export_conv
+       {
+               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
+
+               var $debug;
+               var $client_code = 14;
+               protected $connection = false;
+               protected $global_lock = false;
+               protected $orders_affected = array();
+               protected $min_period;
+
+               function  __construct()
+               {
+                       $GLOBALS['phpgw_info']['flags']['currentapp']   =       
'property';
+                       $this->currentapp                       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->db                                       = & 
$GLOBALS['phpgw']->db;
+                       $this->join                                     = & 
$this->db->join;
+
+                       $this->soXport                          = 
CreateObject('property.soXport');
+                       $this->config                           = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       $this->cats                                     = 
CreateObject('phpgwapi.categories', -1, 'property', '.project');
+                       $this->cats->supress_info       = true;
+
+                       
if(!isset($this->config->config_data['common']['method']))
+                       {
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'admin.uiconfig2.index', 'location_id' => 
$GLOBALS['phpgw']->locations->get_id('property', '.invoice')) );
+                       }
+
+                       if 
(isset($this->config->config_data['export']['cleanup_old']) && 
$this->config->config_data['export']['cleanup_old'])
+                       {
+                               $this->cleanup_old();
+                       }
+
+                       $sogeneric              = 
CreateObject('property.sogeneric','period_transition');
+                       $period_config                  = 
$sogeneric->read(array('allrows' => true));
+                       
+                       $period_transition = array();
+                       foreach($period_config as $entry)
+                       {
+                               $period_transition[$entry['month']] = $entry;
+                       }
+
+                       $current_month = date('n');
+                       
+                       if(isset($period_transition[$current_month]))
+                       {
+                               $_lag_day = 
(int)$period_transition[$current_month]['day'];
+                               $_lag_hour = 
(int)$period_transition[$current_month]['hour'];
+                               $_lag_seconds = ($_lag_day * 24 * 3600) + 
($_lag_hour * 3600);
+                       }
+                       else if(isset($period_transition[13]))
+                       {
+                               $_lag_day = (int)$period_transition[13]['day'];
+                               $_lag_hour = 
(int)$period_transition[13]['hour'];
+                               $_lag_seconds = ($_lag_day * 24 * 3600) + 
($_lag_hour * 3600);
+                       }
+                       else
+                       {
+                               $_lag                   = date('n') == 1 ? 17 : 
7;//6 days into next month, 16 days into next year
+                               $_lag_seconds   = $_lag * 24 * 3600;
+                       }
+                       
+                       $_lag_seconds -= phpgwapi_datetime::user_timezone();
+                       
+//_debug_array($period_transition);                    
+                       $time = time();
+                       $timestamp_at_start_month =  mktime( $hour = 0, $minute 
= 0, $second = 0, $month = date("n"), $day = 0, $year = date("Y") );
+
+                       if(($time - $timestamp_at_start_month) < $_lag_seconds)
+                       {
+                               $time = $time - $_lag_seconds;                  
+                       }
+
+                       $month = date('n', $time);
+                       $year = date('Y',$time);
+                       
+                       $this->min_period = sprintf("%s%02d",$year,$month);
+
+               }
+
+               protected function cleanup_old()
+               {
+                       $this->db->transaction_begin();
+                       $date = date($this->db->datetime_format(),time());
+                       $sql= "UPDATE fm_ecobilag SET saksigndato = '{$date}', 
saksbehandlerid = 'admin' WHERE external_ref IS NULL AND saksigndato IS NULL";
+//_debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $sql= "UPDATE fm_ecobilag SET budsjettsigndato = 
'{$date}', budsjettansvarligid = 'admin' WHERE external_ref IS NULL AND 
budsjettsigndato IS NULL";
+//_debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $sql= "UPDATE fm_ecobilag SET utbetalingsigndato = 
'{$date}', utbetalingid = 'admin' WHERE external_ref IS NULL AND 
utbetalingsigndato IS NULL";
+//_debug_array($sql);
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->overfor('on');
+
+                       $sql= "SELECT min(bilagsnr) as bilagsnr FROM 
fm_ecobilagoverf";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $bilagsnr = (int)$this->db->f('bilagsnr');
+                       if($bilagsnr)
+                       {
+                               $correction = $bilagsnr -1;
+                               $sql= "UPDATE fm_ecobilagoverf SET bilagsnr = 
bilagsnr - {$correction}";
+//_debug_array($sql);
+                               $this->db->query($sql,__LINE__,__FILE__);
+                       }
+                       $this->db->transaction_commit();
+               }
+
+               protected function select_vouchers_to_transfer()
+               {
+                       
if(isset($this->config->config_data['common']['invoice_approval']) && 
$this->config->config_data['common']['invoice_approval']== 1)
+                       {
+                               $sql= "SELECT DISTINCT fm_ecobilag.bilagsnr 
FROM fm_ecobilag {$this->join} fm_ecobilag_sum_view ON fm_ecobilag.bilagsnr = 
fm_ecobilag_sum_view.bilagsnr WHERE approved_amount = '0.00' OR 
budsjettsigndato IS NOT NULL ORDER BY bilagsnr ASC";
+                       }
+                       else
+                       {
+                               $sql= "SELECT DISTINCT fm_ecobilag.bilagsnr 
FROM fm_ecobilag {$this->join} fm_ecobilag_sum_view ON fm_ecobilag.bilagsnr = 
fm_ecobilag_sum_view.bilagsnr WHERE  approved_amount = '0.00' OR ( 
budsjettsigndato IS NOT NULL AND (saksigndato IS NOT NULL OR oppsynsigndato IS 
NOT NULL) ) ORDER BY bilagsnr ASC";
+                       }
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $vouchers_step1 = array();
+                       while ($this->db->next_record())
+                       {
+                               $vouchers_step1[]       = 
$this->db->f('bilagsnr');
+                       }
+
+                       //Filter out partially approved
+                       $vouchers = array();
+                       foreach($vouchers_step1 as $bilagsnr)
+                       {
+                               $sql = "SELECT bilagsnr FROM fm_ecobilag WHERE 
bilagsnr = {$bilagsnr} AND budsjettsigndato IS NULL";
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               if( !$this->db->next_record() )
+                               {
+                                       $vouchers[] = $bilagsnr;
+                               }
+                       }
+
+
+                       //Add vouchers with split-line and approved amount = 
0.00
+                       $extra_candidates = array();
+                       $sql = "SELECT DISTINCT bilagsnr FROM fm_ecobilag WHERE 
(godkjentbelop = '0' OR godkjentbelop = '0.00') AND budsjettsigndato IS NULL";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       while( $this->db->next_record() )
+                       {
+                               $extra_candidates[]     = 
$this->db->f('bilagsnr');
+                       }
+
+                       foreach($extra_candidates as $extra_candidate)
+                       {
+                               if(in_array($extra_candidate, $vouchers))
+                               {
+                                       continue;
+                               }
+
+                               $sql = "SELECT 
bilagsnr,oppsynsigndato,saksigndato,budsjettsigndato FROM fm_ecobilag WHERE 
bilagsnr = {$extra_candidate} AND (godkjentbelop > 0 OR godkjentbelop < 0)";
+
+                               $this->db->query($sql,__LINE__,__FILE__);
+                               $transfer_extra         = true;
+                               while( $this->db->next_record() )
+                               {
+                                       $oppsynsigndato         = 
$this->db->f('oppsynsigndato');
+                                       $saksigndato            = 
$this->db->f('saksigndato');
+                                       $budsjettsigndato       = 
$this->db->f('budsjettsigndato');
+
+                                       
if(isset($this->config->config_data['common']['invoice_approval']) && 
$this->config->config_data['common']['invoice_approval']== 1)
+                                       {
+                                               if(!$budsjettsigndato)
+                                               {
+                                                       $transfer_extra = false;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if (!$budsjettsigndato)
+                                               {
+                                                       $transfer_extra = false;
+                                               }
+                                               else if ($budsjettsigndato && 
!$saksigndato && !$oppsynsigndato)
+                                               {
+                                                       $transfer_extra = false;
+                                               }
+                                       }
+                               }
+
+                               if($transfer_extra)
+                               {
+                                       $vouchers[] = $extra_candidate;
+                               }
+                       }
+
+                       return $vouchers;
+               }
+
+               protected function log_end($batchid)
+               {
+                       $tid=date($this->soXport->datetimeformat);
+                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function log_error($batchid,$error_desr)
+               {
+                       $tid = date($this->soXport->datetimeformat);
+                       $sql = "INSERT INTO fm_ecologg 
(batchid,ecobilagid,status,melding,tid) VALUES 
('$batchid',NULL,0,'$error_desr','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function increment_batchid()
+               {
+                       $this->db->query("UPDATE fm_idgenerator SET value = 
value + 1 WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->query("SELECT value from fm_idgenerator 
WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value');
+                       return $batchid;
+               }
+
+               protected function next_batchid()
+               {
+                       $this->db->query("SELECT value from fm_idgenerator 
WHERE name = 'Ecobatchid'",__LINE__,__FILE__);
+                       $this->db->next_record();
+                       $batchid = $this->db->f('value')+1;
+                       return $batchid;
+               }
+
+               //Lagre start melding
+               protected function log_start($batchid)
+               {
+                       $tid = date($this->db->datetime_format());
+                       $sql= "INSERT INTO fm_ecologg (batchid,melding,tid) 
VALUES ('$batchid','Start transfer','$tid')";
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               protected function get_vendor_info($vendor_id='')
+               {
+                       $sql = "SELECT org_nr, konto_nr FROM fm_vendor WHERE 
id='$vendor_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $vendor_info= array
+                       (
+                               'org_nr' => $this->db->f('org_nr'),
+                               'konto_nr' => $this->db->f('konto_nr')
+                       );
+
+                       return $vendor_info;
+               }
+
+               protected function get_order_info($order_id='')
+               {
+                       $order_info = array();
+                       $sql = "SELECT type FROM fm_orders WHERE 
id='$order_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       switch($this->db->f('type'))
+                       {
+                               case 'workorder':
+                                       $sql2 = "SELECT title, category FROM 
fm_workorder WHERE id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_info['title'] = 
$this->db->f('title');
+                                       $cat_id = (int)$this->db->f('category');
+                                       $category = 
$this->cats->return_single($cat_id);
+                                       $category_arr = 
explode('-',$category[0]['name']);
+                                       $order_info['category'] = 
(int)trim($category_arr[0]);
+                                       break;
+                               case 's_agreement':
+                                       $sql2 = "SELECT descr as title FROM 
fm_s_agreement WHERE id='$order_id'";
+                                       
$this->db->query($sql2,__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $order_info['title'] = 
$this->db->f('title');
+                                       break;
+                       }
+
+                       return $order_info;
+               }
+
+
+               protected function select_invoice_rollback($date, 
$Filnavn,$rollback_voucher,$rollback_internal_voucher)
+               {
+                       $date_array = phpgwapi_datetime::date_array($date);
+                       $day = $date_array['day'];
+                       $month = $date_array['month'];
+                       $year = $date_array['year'];
+
+                       switch($GLOBALS['phpgw_info']['server']['db_type'])
+                       {
+                               case 'mssql':
+                                       $datepart_year          = 
"datepart(year,overftid)";
+                                       $datepart_month         = 
"datepart(month,overftid)";
+                                       $datepart_day           = 
"datepart(day,overftid)";
+                                       break;
+                               case 'mysql':
+                                       $datepart_year          = 
"YEAR(overftid)";
+                                       $datepart_month         = 
"MONTH(overftid)";
+                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
+                                       break;
+                               case 'pgsql':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                               case 'postgres':
+                                       $datepart_year          = 
"date_part('year',overftid)";
+                                       $datepart_month         = 
"date_part('month',overftid)";
+                                       $datepart_day           = 
"date_part('day',overftid)";
+                                       break;
+                       }
+
+                       if($rollback_voucher)
+                       {
+                               $rollback_voucher = (int)$rollback_voucher;
+                               $sql="SELECT * FROM fm_ecobilagoverf WHERE 
bilagsnr_ut = {$rollback_voucher} AND manual_record IS NULL";
+                       }
+                       else if($rollback_internal_voucher)
+                       {
+                               $rollback_internal_voucher = 
(int)$rollback_internal_voucher;
+                               $sql="SELECT * FROM fm_ecobilagoverf WHERE 
bilagsnr = {$rollback_internal_voucher} AND manual_record IS NULL";
+                       }
+                       else
+                       {
+                               $sql="SELECT * FROM fm_ecobilagoverf WHERE 
filnavn='$Filnavn' AND $datepart_year=$year AND $datepart_month=$month AND 
$datepart_day= $day";
+                       }
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       $invoice_rollback = array();
+                       while ($this->db->next_record())
+                       {
+                               $invoice_rollback[] = array
+                               (
+                                       'id'                                    
=> $this->db->f('id'),
+                                       'bilagsnr'                              
=> $this->db->f('bilagsnr'),
+                                       'bilagsnr_ut'                   => 
$this->db->f('bilagsnr_ut'),
+                                       'kidnr'                                 
=> $this->db->f('kidnr'),
+                                       'typeid'                                
=> $this->db->f('typeid'),
+                                       'kildeid'                               
=> $this->db->f('kildeid'),
+                                       'pmwrkord_code'                 => 
$this->db->f('pmwrkord_code'),
+                                       'belop'                                 
=> $this->db->f('belop'),
+                                       'fakturadato'                   => 
$this->db->f('fakturadato'),
+                                       'periode'                               
=> $this->db->f('periode'),
+                                       'periodization'                 => 
$this->db->f('periodization'),
+                                       'periodization_start'   => 
$this->db->f('periodization_start'),
+                                       'forfallsdato'                  => 
$this->db->f('forfallsdato'),
+                                       'fakturanr'                             
=> $this->db->f('fakturanr'),
+                                       'spbudact_code'                 => 
$this->db->f('spbudact_code'),
+                                       'regtid'                                
=> $this->db->f('regtid'),
+                                       'artid'                                 
=> $this->db->f('artid'),
+                                       'godkjentbelop'                 => 
(int) $this->db->f('godkjentbelop') == 0 ? $this->db->f('belop') :  
$this->db->f('godkjentbelop'),//restore original amount
+                                       'spvend_code'                   => 
$this->db->f('spvend_code'),
+                                       'dima'                                  
=> $this->db->f('dima'),
+                                       'loc1'                                  
=> $this->db->f('loc1'),
+                                       'dimb'                                  
=> $this->db->f('dimb'),
+                                       'mvakode'                               
=> $this->db->f('mvakode'),
+                                       'dimd'                                  
=> $this->db->f('dimd'),
+                                       'dime'                                  
=> $this->db->f('dime'),
+                                       'project_id'                    => 
$this->db->f('project_id'),
+                                       'kostra_id'                             
=> $this->db->f('kostra_id'),
+                                       'item_type'                             
=> $this->db->f('item_type'),
+                                       'item_id'                               
=> $this->db->f('item_id'),
+                                       'oppsynsmannid'                 => 
$this->db->f('oppsynsmannid'),
+                                       'saksbehandlerid'               => 
$this->db->f('saksbehandlerid'),
+                                       'budsjettansvarligid'   => 
$this->db->f('budsjettansvarligid'),
+                                       'oppsynsigndato'                => 
$this->db->f('oppsynsigndato'),
+                                       'saksigndato'                   => 
$this->db->f('saksigndato'),
+               //                      'budsjettsigndato'              => 
$this->db->f('budsjettsigndato'), // må anvises på nytt etter tilbakerulling
+                                       'merknad'                               
=> $this->db->f('merknad',true),
+                                       'line_text'                             
=> $this->db->f('line_text',true),
+                                       'splitt'                                
=> $this->db->f('splitt'),
+                                       'ordrebelop'                    => 
$this->db->f('ordrebelop'),
+               //                      'utbetalingid'                  => 
$this->db->f('utbetalingid'),
+               //                      'utbetalingsigndato'    => 
$this->db->f('utbetalingsigndato'),
+                                       'external_ref'                  => 
$this->db->f('external_ref'),
+                                       'external_voucher_id'   => 
$this->db->f('external_voucher_id'),
+                                       'currency'                              
=> $this->db->f('currency'),
+                                       'process_log'                   => 
$this->db->f('process_log',true),
+                                       'process_code'                  => 
$this->db->f('process_code'),
+
+                               );
+                       }
+
+                       return $invoice_rollback;
+               }
+
+               //rollback function
+               protected function bilag_update_overf($BilagOverf)
+               {
+                       $values= array
+                       (
+                               $BilagOverf['project_id'],
+                               $BilagOverf['kostra_id'],
+                               $BilagOverf['pmwrkord_code'],
+                               $BilagOverf['bilagsnr'],
+                               $BilagOverf['bilagsnr_ut'],
+                               $BilagOverf['splitt'],
+                               $BilagOverf['kildeid'],
+                               $BilagOverf['kidnr'],
+                               $BilagOverf['typeid'],
+                               $BilagOverf['fakturadato'],
+                               $BilagOverf['forfallsdato'],
+                               $BilagOverf['regtid'],
+                               $BilagOverf['artid'],
+                               $BilagOverf['spvend_code'],
+                               $BilagOverf['dimb'],
+                               $BilagOverf['oppsynsmannid'],
+                               $BilagOverf['saksbehandlerid'],
+                               $BilagOverf['budsjettansvarligid'],
+                               $BilagOverf['fakturanr'],
+                               $BilagOverf['spbudact_code'],
+                               $BilagOverf['dima'],
+                               $BilagOverf['loc1'],
+                               $BilagOverf['dimd'],
+                               $BilagOverf['dime'],
+                               $BilagOverf['mvakode'],
+                               $BilagOverf['periode'],
+                               $BilagOverf['periodization'],
+                               $BilagOverf['periodization_start'],
+                               
$this->db->db_addslashes($BilagOverf['merknad']),
+                               
$this->db->db_addslashes($BilagOverf['line_text']),
+                               $BilagOverf['utbetalingid'],
+                               $BilagOverf['oppsynsigndato'],
+                               $BilagOverf['saksigndato'],
+                               $BilagOverf['budsjettsigndato'],
+                               $BilagOverf['utbetalingsigndato'],
+                               $BilagOverf['item_type'],
+                               $BilagOverf['item_id'],
+                               $BilagOverf['external_ref'],
+                               $BilagOverf['external_voucher_id'],
+                               $BilagOverf['belop'],
+                               $BilagOverf['godkjentbelop'],
+                               $BilagOverf['currency'],
+                               
$this->db->db_addslashes($BilagOverf['process_log']),
+                               $BilagOverf['process_code'],
+                       );
+
+                       $values = $this->db->validate_insert($values);
+
+                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,bilagsnr_ut,splitt,kildeid,kidnr,typeid,"
+                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
+                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,dime,mvakode,"
+                       . " 
periode,periodization,periodization_start,merknad,line_text,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,"
+                       . " 
item_type,item_id,external_ref,external_voucher_id,belop,godkjentbelop,currency,process_log,process_code)"
+                       . " VALUES ({$values})";
+
+                       $this->db->query($sql,__LINE__,__FILE__);
+               }
+
+               public function overfor($download,$force_period_year='')
+               {
+//                     $download = 'on';
+//                     $download = False;
+//                     $this->debug=True;
+
+                       //Generer batch ID
+                       $batchid = $this->soXport->next_batchid();
+                       if ($download=='on')
+                       {
+                               $this->increment_batchid();
+                               //Lagre melding
+                               $this->log_start($batchid);
+                       }
+
+                       //Velg ut alle hoved bilag som skal overføres
+                       $vouchers = $this->select_vouchers_to_transfer();
+
+                       foreach ($vouchers as $voucher_id)
+                       {
+                               $receipt['message'][]= array('msg' => 
$this->transfer_voucher($batchid, $voucher_id, $download, $force_period_year));
+                       }
+
+                       if($this->connection)
+                       {
+                               switch 
($this->config->config_data['common']['method'])
+                               {
+                                       case 'ftp';
+                                               ftp_quit($this->connection);
+                                               break;
+                                       case 'ssh';
+                                               ssh2_exec($this->connection, 
'exit');
+                                               break;
+                               }
+                       }
+                       //Lagre melding
+                       if ($download=='on')
+                       {
+                               $this->log_end($batchid); //Lagre melding
+                       }
+
+                       return $receipt;
+               }
+
+               protected function errorhandler($batchid,$error_desr)
+               {
+                       if($this->db->get_transaction())
+                       {
+                               $this->db->transaction_abort();
+                       }
+
+                       $meld = $error_desr;
+
+                       //Vis feilmelding
+                       echo $meld;
+
+                       //Lagre feilmelding
+                       $this->log_error($batchid,$error_desr);
+               }
+
+               public function RullTilbake($Filnavn, 
$date,$rollback_voucher,$rollback_internal_voucher)
+               {
+                       $voucher = $this->select_invoice_rollback($date, 
$Filnavn,$rollback_voucher,$rollback_internal_voucher);
+
+                       if ( $this->db->get_transaction() )
+                       {
+                               $this->global_lock = true;
+                       }
+                       else
+                       {
+                               $this->global_lock = false;
+                               $this->db->transaction_begin();
+                       }
+
+                       foreach ($voucher as $line)
+                       {
+                               $this->bilag_update_overf($line);
+
+                               if($line['pmwrkord_code'])
+                               {
+                                       
$orders_affected[$line['pmwrkord_code']] = true;
+
+                                       $Belop = sprintf("%01.2f", 
$line['ordrebelop'])*100;
+
+                                       if ($line['dimd'] % 2 == 0)
+                                       {
+                                               
$actual_cost_field='act_mtrl_cost';
+                                       }
+                                       else
+                                       {
+                                               
$actual_cost_field='act_vendor_cost';
+                                       }
+
+                                       $operator='-';
+
+                                       
$this->soXport->correct_actual_cost($line['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
+                               }
+
+                               //Slett fra avviks tabell
+                       //      $this->soXport->delete_avvik($line['bilagsnr']);
+
+                               //Slett fra arkiv
+                               
$this->soXport->delete_invoice($line['bilagsnr']);
+                       }
+
+                       $antall = count($voucher);
+                       if($antall > 0)
+                       {
+                               $fil_katalog = 
$this->config->config_data['export']['path'];
+
+                               if($rollback_voucher || 
$rollback_internal_voucher)
+                               {
+                                       if ( !$this->global_lock )
+                                       {
+                                               $this->db->transaction_commit();
+                                       }
+
+                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+                               }
+                               else if(unlink ($fil_katalog. '/' . $Filnavn))
+                               {
+                                       if ( !$this->global_lock )
+                                       {
+                                               $this->db->transaction_commit();
+                                       }
+
+                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
+                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
+                               }
+                               else
+                               {
+                                       $this->db->transaction_abort();
+                                       $receipt['error'][]= array('msg' => 
'Noe gikk galt!');
+                               }
+                       }
+                       else
+                       {
+                               if ( !$this->global_lock )
+                               {
+                                       $this->db->transaction_commit();
+                               }
+
+                               $receipt['error'][]= array('msg' => lang('Sorry 
- No hits'));
+                       }
+                       return $receipt;
+               }
+
+               protected function LagFilnavn($external_voucher_id = '')
+               {
+                       if(!$external_voucher_id)
+                       {
+                               throw new Exception('Agresso_X114::LagFilnavn() 
Mangler SCANNINGNO' );
+                       }
+                       $fil_katalog = 
$this->config->config_data['export']['path'];
+
+                       $Filnavn = $fil_katalog . 
"/x114_{$this->client_code}_{$external_voucher_id}.xml";
+
+                       //Sjekk om filen eksisterer
+                       if (file_exists($Filnavn))
+                       {
+                               unlink($Filnavn);
+                       }
+
+                       return $Filnavn;
+               }
+
+               protected function transfer_voucher($batchid, $voucher_id, 
$download, $force_period_year = '')
+               {
+                       $oRsBilag =  $this->soXport->get_voucher($voucher_id);
+
+                       $skip_agresso = false;
+                       //FIXME
+                       if(!isset($oRsBilag[0]['external_ref'])  || 
!$oRsBilag[0]['external_ref'])
+                       {
+                               $skip_agresso = true;
+                       }
+
+                       //Bestem filnavn
+                       
+                       try
+                       {
+                               $Filnavn = 
$this->LagFilnavn($oRsBilag[0]['external_voucher_id']);
+                       }
+                       catch(Exception $e)
+                       {
+                               if ( $e )
+                               {
+                                       $message = $e->getMessage();
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+                       }
+
+                       //Test om filen kan opprettes og skrives til
+                       if(!$skip_agresso)
+                       {
+                               if (@fopen($Filnavn, "wb"))
+                               {
+                                       unlink($Filnavn);
+                               }
+                               else
+                               {
+                                       $message='kan ikke lagre til fil: '. 
$Filnavn .'<br>';
+                                       if($this->debug)
+                                       {
+                                               echo $message;
+                                       }
+                                       else
+                                       {
+                                               return $message;
+                                       }
+                               }
+                       }
+
+                       $antall = count($oRsBilag);
+
+                       if ( $this->db->get_transaction() )
+                       {
+                               $this->global_lock = true;
+                       }
+                       else
+                       {
+                               $this->db->transaction_begin();
+                       }
+
+                       $bilagsnr_ut = $oRsBilag[0]['bilagsnr_ut'];
+                       if(!$bilagsnr_ut)
+                       {
+                               $get_bilagsnr_ut = false;
+                               foreach ($oRsBilag as $line)
+                               {
+                                       if(abs($line['godkjentbelop']) > 0)
+                                       {
+                                               $get_bilagsnr_ut = true;
+                                       }
+                               }
+
+                               if($get_bilagsnr_ut)
+                               {
+                                       $bilagsnr_ut = 
$this->increment_voucher_id();
+                               }
+                       }
+
+                       $purchaseorderstatus = 'OK';
+                       if(!$bilagsnr_ut)
+                       {
+                               $Filnavn = str_replace('_OK_', '_E_', $Filnavn);
+                               $purchaseorderstatus = 'Feil';
+                       }
+                       
+                       $tranfser_bilag = $bilagsnr_ut ? array($bilagsnr_ut) : 
array($voucher_id);
+
+                       $localtime = phpgwapi_datetime::user_localtime();
+
+                       $transactioninformation = array
+                       (
+                               0 => array
+                               (
+                                       'TRANSACTIONTYPE' => 'X114',
+                                       'TRANSFER' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'TRANSFERDATE' => 
date('d.m.Y', $localtime),//28.05.2009
+                                                       'TRANSFERTIME' => 
date('H:i:s', $localtime)//14:29:52
+                                               )
+                                       )
+                               )
+                       );
+
+                       $invoiceheader = array
+                       (
+                               0 => array
+                               (
+                                       'TRANSACTIONTYPE'                       
=> 'X114',
+                                       'KEY'                                   
        => $oRsBilag[0]['external_voucher_id'], //dummy
+                                       'VOUCHERID'                             
        => $bilagsnr_ut,
+                                       'SCANNINGNO'                            
=> $oRsBilag[0]['external_ref'], // 11E28NJINL3VR6
+                                       'PROFILE'                               
        => 'TRAINVPOMA',
+                                       'CLIENT.CODE'                           
=> $this->client_code, //14,
+                                       'POATTRIB1'                             
        => '', //dummy
+                                       'POATTRIB2'                             
        => '', //dummy
+                                       'POPURCHASER'                           
=> '', //dummy
+                                       'PREVOUCHERID'                          
=> '', //dummy
+                                       'PURCHASEORDERNO'                       
=> $oRsBilag[0]['order_id'], // 1409220008
+                                       'PURCHASEORDEROWNER.CODE'       => 
$oRsBilag[0]['spvend_code'], // 100644
+                                       'PURCHASEORDERSTATUS.CODE'      => 
$purchaseorderstatus,
+                                       'GENERALCOMMENT'                        
=> $comment, // Denne er fakturert i 3 deler OBS OBS!
+                               )
+                       );
+
+                       $accountline = array();
+
+                       if ( $oRsBilag[0]['periode'] )
+                       {
+                               if((int)$this->min_period < 
(int)$oRsBilag[0]['periode'])
+                               {
+                                       $periode = $this->min_period;
+                               }
+                               else
+                               {
+                                       $periode = $oRsBilag[0]['periode'];
+                               }
+                       }
+                       else if 
(isset($this->config->config_data['export']['dato_aarsavslutning']) && time() < 
$this->config->config_data['export']['dato_aarsavslutning'] )
+                       {
+                               if(date('Y',time()) == date('Y', 
$this->config->config_data['export']['dato_aarsavslutning']))
+                               {
+                                       $periode = date('Y',time()) - 1 . '12';
+                               }
+                               else
+                               {
+                                       $periode = date('Ym',time());
+                               }       
+                       }
+                       else
+                       {
+                               $time = time();
+
+                               if ( date('j',$time) < 7 ) //Day of the month 
without leading zeros
+                               {
+                                       $time = $time - (7 * 24 * 3600);
+                               }
+                               
+                               $periode = date('Ym',$time);
+                       }
+
+                       $comment = array();
+                       foreach ($oRsBilag as $line)
+                       {
+                               $comment[] = 
"{$line['belop']}::{$line['process_log']}";
+
+                               $BelopFelt = 'godkjentbelop';
+
+/*
+                               //Bestem belops felt
+                               if ($line['splitt'] == 0)
+                               {
+                                       //Bilaget er ikke splittet
+                                       if ($line['godkjentbelop'] <> 
$line['belop'])
+                                       {
+                                               $BelopFelt = 'godkjentbelop';
+                                               //Logg til avviks tabell
+                                               if ($download=='on')
+                                               {
+//                                                     
$this->soXport->log_to_deviation_table($line);
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $BelopFelt = 'belop';
+                                       }
+                               }
+
+*/
+                               //Bilaget er splittet
+/*
+                               if ($line['godkjentbelop'] == $line['belop'])
+                               {
+                                       $BelopFelt = 'godkjentbelop';
+                               }
+                               else
+                               {
+                                        //Ikke lovlig
+                                       $message = lang('Avvik mellom 
fakturabelop og godkjent belop pa splittet faktura!');
+                                       $this->errorhandler($batchid,$message);
+                                       return $message;
+                               }
+*/
+                               $amount =  $line[$BelopFelt] * 100;
+                               $amount =  number_format($amount,0,'','');
+
+                               if($line['order_id'])
+                               {
+                                       $orders_affected[$line['order_id']] = 
true;
+
+                                       //Oppdater beløp på arbeidsordre
+                                       if ($download=='on')
+                                       {
+                                               if ($line['dimd'] % 2 == 0)
+                                               {
+                                                       
$actual_cost_field='act_mtrl_cost';
+                                               }
+                                               else
+                                               {
+                                                       
$actual_cost_field='act_vendor_cost';
+                                               }
+                                               $operator='+';
+
+                                               if(!$this->debug)
+                                               {
+                                                       
$this->soXport->correct_actual_cost($line['order_id'],$amount, 
$actual_cost_field,$operator);
+                                               }
+                                       }
+                               }
+
+                               $oRsOverfBilag                                  
= $line;
+                               $oRsOverfBilag['filnavn']               = 
$Filnavn? basename($Filnavn) : date('d.m.Y-H:i:s', 
phpgwapi_datetime::user_localtime());
+                               $oRsOverfBilag['ordrebelop']    = 
$line[$BelopFelt];
+                               $oRsOverfBilag['pmwrkord_code'] = 
$line['order_id'];
+                               $oRsOverfBilag['bilagsnr_ut']   = $bilagsnr_ut;
+                               $oRsOverfBilag['periode']               = 
$periode;
+
+                               if($line['dime'])
+                               {
+                                       $category               = 
$this->cats->return_single($line['dime']);
+                                       $category_arr   = 
explode('-',$category[0]['name']);
+                                       $dim6                   = 
(int)trim($category_arr[0]);
+                               }
+                               else
+                               {
+                                       $dim6                   = '';           
                
+                               }
+
+                               //Kopier verdier  til fm_ecobilagoverf
+                               if ($download=='on' && !$this->debug)
+                               {
+                                       
$this->soXport->add_OverfBilag($oRsOverfBilag);
+                               }
+
+                               if ($line['order_id'])
+                               {
+                                       $order_info = 
$this->get_order_info($line['order_id']);
+                                       if(!$dim6)
+                                       {
+                                               $dim6 = 
isset($order_info['category']) && $order_info['category'] ? 
$order_info['category'] : '';
+                                       }
+                               }
+
+                               $descr = '';
+                               if($line['line_text'])
+                               {
+                                       $descr = 
substr($line['line_text'],0,60);
+                               }
+                               else if ($line['order_id'])
+                               {
+                                       $descr = 
substr($order_info['title'],0,60);
+                               }
+
+                               $accountline[] = array
+                               (
+                                       'TRANSACTIONTYPE'               => 
'R114',
+                                       'ACCOUNTLINK.CODE'              => 
$line['spbudact_code'], // 4180
+                                       'AMOUNT'                                
=> $amount, // 312500
+                                       'APPROVER.FULLNAME'             => 
$line['budsjettansvarligid'], //Batch 04 - 14
+                                       'DIMENSION.D1.CODE'             => 
$line['dimb'], // 1111
+                                       'DIMENSION.D2.CODE'             => 
'',//$line['dima'], // 62000
+                                       'DIMENSION.D3.CODE'             => '',
+                                       'DIMENSION.D4.CODE'             => 
$line['project_id'], // dummy
+                                       'DIMENSION.D5.CODE'             => 
$dim5, // dummy
+                                       'DIMENSION.D6.CODE'             => 
$dim6, // dummy
+                                       'DIMENSION.D7.CODE'             => 
$dim7, // dummy
+                                       'DIMENSION.D8.CODE'             => 
$dim8, // dummy
+                                       'POITEMDESCRIPTION'             => 
$descr, // Sugerør,plast,fleksibelt,20cm
+                                       'POITEMNUMBER'                  => 
$itemnumber, //200200
+                                       'POITEMTYPE'                    => 'C', 
// A = Item, B = Special Product (SP), C = Text based  (Misc.)
+                                       'POLINENUMBER'                  => 
$linenumber, // 10
+                                       'RECEIVER.FULLNAME'             => 
$line['budsjettansvarligid'], // Batch 04 - 14
+                                       'STATUS'                                
=> 5,
+                                       'SUBACCOUNT'                    => 
$periode, //200905 Accounting period YYYYMM
+                                       'ALLOCATION.KEY'                => 
$line['periodization'],//0
+                                       'ALLOCATION.PERIOD'             => 
$line['periodization_start'] //dummy
+                               );
+
+                       }
+
+                       $invoiceheader[0]['GENERALCOMMENT'] = 
implode("\n",$comment);
+                       $invoices = array
+                       (
+                               0 => array
+                               (
+                                       'INVOICE' => array
+                                       (
+                                               0 => array
+                                               (
+                                                       'INVOICEHEADER' => 
$invoiceheader,
+                                                       'ACCOUNTLINES' => array
+                                                       (
+                                                               0 => array
+                                                               (
+                                                                       
'ACCOUNTLINE' => $accountline
+                                                               )
+                                                       )
+                                               )
+                                       )
+                               )
+                       );
+
+                       $export_data = array
+                       (
+                               'TRANSACTIONINFORMATION'        => 
$transactioninformation,
+                               'INVOICES'                                      
=> $invoices
+                       );
+
+                       $xmltool = CreateObject('phpgwapi.xmltool');
+
+                       $buffer = $xmltool->import_var('INVOICEIMPORT', 
$export_data,true, true);
+                       $buffer = str_replace('<INVOICEIMPORT>', 
'<INVOICEIMPORT TYPE="INVOICE">', $buffer);
+
+                       //Slett bilaget i fm_ecobilag
+                       if ($download=='on' && !$this->debug)
+                       {
+                               $this->_delete_from_fm_ecobilag($voucher_id);
+                               //Logg transaksjon
+                               
$this->soXport->log_transaction($batchid,$voucher_id,lang('Invoice 
transferred'));
+                       }
+
+                       //Fullfør transaksjon
+                       if ($download=='on' && !$this->debug)
+                       {
+                       //      $file_written = true;
+
+                       // -- Start
+                        
+                               if($skip_agresso)
+                               {
+                                       if ( !$this->global_lock )
+                                       {
+                                               $this->db->transaction_commit();
+                                       }
+                                       $message = "Antall bilag/underbilag 
overført til historikk (ikke til Agresso): {$antall}";
+                                       return $message;
+                               }
+
+                               $file_written = false;
+                               $fp = fopen($Filnavn, "wb");
+                               fwrite($fp,$buffer);
+
+                               if(fclose($fp))
+                               {
+                                       $file_written=true;
+                               }
+
+                       // -- END
+                               if( $file_written && 
($this->config->config_data['common']['method'] != 'ftp' && 
$this->config->config_data['common']['method'] != 'ssh'))
+                               {
+                                       $transfer_ok = true;
+                               }
+                               else if($file_written)
+                               {
+                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
+                               }
+
+                               if($transfer_ok)
+                               {

@@ Diff output truncated at 153600 characters. @@



reply via email to

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