fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11561] Merge 11547:11560 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [11561] Merge 11547:11560 from trunk
Date: Sun, 22 Dec 2013 21:41:30 +0000

Revision: 11561
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11561
Author:   sigurdne
Date:     2013-12-22 21:41:30 +0000 (Sun, 22 Dec 2013)
Log Message:
-----------
Merge 11547:11560 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
    branches/Version-1_0-branch/property/inc/class.historylog.inc.php
    branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
    branches/Version-1_0-branch/property/inc/class.soproject.inc.php
    branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
    
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
    branches/Version-1_0-branch/property/inc/hook_config.inc.php
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service
    branches/Version-1_0-branch/property/setup/phpgw_no.lang

Added Paths:
-----------
    
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_EBF

Removed Paths:
-------------
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv
    branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner
    
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_xml
    
branches/Version-1_0-branch/property/inc/import/default/import_fra_Service_xls

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


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

Modified: branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/class.boworkorder.inc.php  
2013-12-22 21:41:30 UTC (rev 11561)
@@ -713,7 +713,7 @@
                                                
$record_history[$i]['value_old_value']  = $category[0]['name'];
                                        }
                                }
-                               else if ($value['status'] == 'S' || 
$value['status'] == 'SO')
+                               else if ($value['status'] == 'S' || 
$value['status'] == 'SO'  || $value['status'] == 'R' || $value['status'] == 'X')
                                {
                                        $record_history[$i]['value_new_value']  
= $status_text[$value['new_value']];
                                        $record_history[$i]['value_old_value']  
= $status_text[$value['old_value']];

Modified: branches/Version-1_0-branch/property/inc/class.historylog.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.historylog.inc.php   
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/class.historylog.inc.php   
2013-12-22 21:41:30 UTC (rev 11561)
@@ -131,11 +131,6 @@
 
                function add($status,$record_id,$new_value,$old_value 
='',$attrib_id='', $date=0,$detail_id='')
                {
-                       $attrib_id_field = $this->attrib_id_field;
-                       $attrib_id_value = (isset($attrib_id) && $attrib_id ? 
",$attrib_id" : '');
-                       $detail_id_field = $this->detail_id_field;
-                       $detail_id_value = (isset($detail_id) && $detail_id ? 
",$detail_id" : '');
-
                        if($date)
                        {
                                $timestamp = 
date($this->db->date_format(),$date);
@@ -145,13 +140,30 @@
                                $timestamp = date($this->db->datetime_format());
                        }
 
-                       $this->db->query("INSERT INTO {$this->table} 
(history_record_id,"
-                               . 
"history_appname,history_owner,history_status,history_new_value, 
history_old_value, history_timestamp $attrib_id_field $detail_id_field) "
-                               . "values ('{$record_id}','{$this->appname}','"
-                               . $this->account . "','$status','"
-                               . $this->db->db_addslashes($new_value) . "','"
-                               . $this->db->db_addslashes($old_value) . "','" 
. $timestamp
-                               . "' $attrib_id_value 
$detail_id_value)",__LINE__,__FILE__);
+                       $value_set = array
+                       (
+                               'history_record_id'             => $record_id,
+                               'history_appname'               => 
$this->appname,
+                               'history_owner'                 => 
$this->account,
+                               'history_status'                => $status,
+                               'history_new_value'             => 
$this->db->db_addslashes($new_value),
+                               'history_old_value'             => 
$this->db->db_addslashes($old_value),
+                               'history_timestamp'             => $timestamp
+                       );
+
+                       if($this->attrib_id_field && $attrib_id)
+                       {
+                               $value_set[$this->attrib_id_field]      = 
$attrib_id;
+                       }
+                       if($this->detail_id_field && $detail_id)
+                       {
+                               $value_set[$this->detail_id_field]      = 
$detail_id;
+                       }
+
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->db->validate_insert(array_values($value_set));
+                       $sql = "INSERT INTO {$this->table} ({$cols}) VALUES 
({$values})";
+                       $this->db->query($sql,__LINE__,__FILE__);
                }
 
                // array $filter_out

Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php    
2013-12-22 21:41:30 UTC (rev 11561)
@@ -784,6 +784,7 @@
 
                function update_invoice_sub($values)
                {
+                       $update_status = array();
                        $receipt = array();
                        $GLOBALS['phpgw']->db->transaction_begin();
 
@@ -897,11 +898,20 @@
 
                        }
 
-                       if (isset($update_status) AND is_array($update_status))
+                       if ($update_status)
                        {
-                               $closed = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : 'closed';
-                               $reopen = 
isset($this->config->config_data['workorder_reopen_status']) && 
$this->config->config_data['workorder_reopen_status'] ? 
$this->config->config_data['workorder_reopen_status'] : 're_opened';
+                               $closed = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : '';
+                               $reopen = 
isset($this->config->config_data['workorder_reopen_status']) && 
$this->config->config_data['workorder_reopen_status'] ? 
$this->config->config_data['workorder_reopen_status'] : '';
 
+                               if(!$closed)
+                               {
+                                       throw new 
Exception('property_soinvoice::update_invoice_sub() - "workorder_closed_status" 
not configured');
+                               }
+                               if(!$reopen)
+                               {
+                                       throw new 
Exception('property_soinvoice::update_invoice_sub() - "workorder_reopen_status" 
not configured');
+                               }
+
                                $status_code=array('X' => $closed,'R' => 
$reopen);
 
                                $historylog_workorder   = 
CreateObject('property.historylog','workorder');
@@ -2341,7 +2351,7 @@
 */
                        if( isset($data['order_id']) && $data['order_id'])
                        {
-                               if(isset($data['close_order']) && 
$data['close_order'])
+                               if(isset($data['close_order']) && 
$data['close_order'] && !$data['close_order_orig'])
                                {
                                        
execMethod('property.soworkorder.close_orders',array($data['order_id']));
                                }

Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php    
2013-12-22 21:41:30 UTC (rev 11561)
@@ -2054,7 +2054,6 @@
 
                }
 
-
                function get_budget($project_id)
                {
                        $project_id = (int) $project_id;
@@ -2068,7 +2067,7 @@
                        . " GROUP BY fm_project_budget.year, 
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed, 
fm_project_budget.active"
                        . " ORDER BY fm_project_budget.year, 
fm_project_budget.month";
                        $this->db->query($sql,__LINE__,__FILE__);
-//     _debug_array($sql);
+
                        while ($this->db->next_record())
                        {
                                $period = $this->db->f('year') . 
sprintf("%02s", $this->db->f('month'));
@@ -2084,7 +2083,6 @@
                                . " FROM fm_workorder"
                                . " WHERE project_id = {$project_id}";
 
-//     _debug_array($sql);die();
                        $this->db->query($sql,__LINE__,__FILE__);
                        $_order_list = array();
                        while ($this->db->next_record())
@@ -2103,13 +2101,6 @@
                        foreach ($order_budgets  as $_order_id => $order_budget 
)
                        {
 
-/*
-if(!$order_budget[0]['closed_order'])
-{
-//     _debug_array($order_budget);
-}
-*/
-
                                foreach ($order_budget as $budget_entry)
                                {
                                        $period = $budget_entry['period'];
@@ -2125,8 +2116,6 @@
                                        $_found = false;
                                        if(isset($project_budget[$period]) && 
!$budget_entry['closed_order'])
                                        {
-//_debug_array($_order_id);
-//_debug_array($budget_entry);
                                                
$_orders[$period]['sum_oblications'] += $budget_entry['sum_oblications'];
                                                $_orders[$period]['sum_orders'] 
+= $budget_entry['sum_orders'];
                                                $_found = true;
@@ -2164,8 +2153,6 @@
                                }
                        }
                        $sort_period = array();
-//_debug_array($_orders);
-//die();
 
                        $_values = array();
                        foreach ($project_budget as $period => $_budget)
@@ -2205,10 +2192,9 @@
                        }
 
                        ksort($_values);
-//_debug_array($_values);die();
 
                        $values = array();
-//_debug_array($active_period);die();
+
                        $total_sum = 0;
                        foreach ($_values as $period => $_budget)
                        {
@@ -2219,8 +2205,6 @@
                                }
                        }
 
-//_debug_array($values);die();
-//_debug_array($total_sum);
                        $corretion = $total_sum >= 0 ? 1 : -1; 
                        $deviation_acc = 0;
                        $budget_acc = 0;
@@ -2230,14 +2214,12 @@
                                $month = substr( $entry['period'], 4, 2 );
                                $entry['month'] = $month == '00' ? '' : $month;
 
-       //                      if($active_period[$entry['period']])
                                if($closed_period[$entry['period']])
                                {
                                        $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
                                        $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
 
                                        $_deviation = $entry['budget'] - 
$entry['actual_cost'];
-       //                              $deviation = abs($entry['actual_cost']) 
> 0 ? $_deviation : 0;
                                        $deviation = $_deviation;
                                }
                                else
@@ -2262,8 +2244,6 @@
                                $entry['active'] = 
$active_period[$entry['period']];
                        }
 
-//_debug_array($values);die();
-
                        return $values;
                }
 

Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php  
2013-12-22 21:41:30 UTC (rev 11561)
@@ -1648,8 +1648,13 @@
                {
                        $config         = 
CreateObject('phpgwapi.config','property');
                        $config->read();
-                       $closed = 
isset($config->config_data['workorder_closed_status']) && 
$config->config_data['workorder_closed_status'] ? 
$config->config_data['workorder_closed_status'] : 'closed';
+                       $closed = 
isset($config->config_data['workorder_closed_status']) && 
$config->config_data['workorder_closed_status'] ? 
$config->config_data['workorder_closed_status'] : '';
 
+                       if(!$closed)
+                       {
+                               throw new 
Exception('property_soworkorder::close_orders() - "workorder_closed_status" not 
configured');
+                       }
+
                        if ( $this->db->get_transaction() )
                        {
                                $this->global_lock = true;
@@ -1662,6 +1667,7 @@
 
                        if ($orders && is_array($orders))
                        {
+                               $lang_closed = lang('closed');
                                $historylog_workorder   = 
CreateObject('property.historylog','workorder');
 
                                foreach ($orders as $id)
@@ -1671,14 +1677,10 @@
                                        switch ( $this->db->f('type') )
                                        {
                                                case 'workorder':
-                                                       
$historylog_workorder->add($entry,$id,$closed);
+                                                       
$historylog_workorder->add('X',$id,$closed);
                                                        
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder SET status='{$closed}' WHERE 
id = '{$id}'");
                                                        
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder SET paid_percent=100 WHERE 
id= '{$id}'");
-                                                       $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $closed));
-                                                       
$this->db->query("SELECT project_id FROM fm_workorder WHERE 
id='{$id}'",__LINE__,__FILE__);
-                                                       
$this->db->next_record();
-                                                       $project_id = 
$this->db->f('project_id');
-                               //                      
$this->update_planned_cost($project_id);
+                                                       $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $lang_closed));
                                                        break;
                                        }
                                }
@@ -1705,22 +1707,27 @@
 
                        $config         = 
CreateObject('phpgwapi.config','property');
                        $config->read();
-                       $reopen = 
isset($config->config_data['workorder_reopen_status']) && 
$config->config_data['workorder_reopen_status'] ? 
$config->config_data['workorder_reopen_status'] : 're_opened';
-                       $status_code=array('X' => $closed,'R' => $reopen);
+                       $reopen = 
isset($config->config_data['workorder_reopen_status']) && 
$config->config_data['workorder_reopen_status'] ? 
$config->config_data['workorder_reopen_status'] : '';
 
+                       if(!$reopen)
+                       {
+                                       throw new 
Exception('property_soworkorder::close_orders() - "workorder_reopen_status" not 
configured');
+                       }
+
+                       $lang_reopen = lang('Re-opened');
+
                        $historylog_workorder   = 
CreateObject('property.historylog','workorder');
 
                        foreach ($orders as $id)
                        {
-                               $id = (int) $id;
-                               $this->db->query("SELECT type FROM fm_orders 
WHERE id={$id}",__LINE__,__FILE__);
+                               $this->db->query("SELECT type FROM fm_orders 
WHERE id='{$id}'",__LINE__,__FILE__);
                                $this->db->next_record();
                                switch ( $this->db->f('type') )
                                {
                                        case 'workorder':
                                                $historylog_workorder->add('R', 
$id, $reopen);
-                                               
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status='{$reopen}' WHERE 
id = {$id}");
-                                               $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $status_code[$entry]));
+                                               
$GLOBALS['phpgw']->db->query("UPDATE fm_workorder set status='{$reopen}' WHERE 
id = '{$id}'");
+                                               $receipt['message'][] = 
array('msg'=>lang('Workorder %1 is %2',$id, $lang_reopen));
                                }
                        }
 
@@ -1826,7 +1833,6 @@
                                                
if(isset($order_budget[$_period]))
                                                {
                                                        
$order_budget[$_period]['actual_cost'] += $this->db->f('actual_cost');
-//_debug_array($test+=$this->db->f('actual_cost'));
                                                        $_found = true;
                                                        break;
                                                }
@@ -1844,8 +1850,6 @@
 
                        $sort_period = array();
                        $values = array();
-//_debug_array($order_budget);die();
-//$test = 0;
                        $_current_period = date('Ym');
                        $_delay_period_sum = 0;
                        $_delay_period = false;
@@ -1857,42 +1861,32 @@
                                $_actual_cost = 0;
 
                                $_actual_cost += $_budget['actual_cost'];
-//_debug_array( $test+= $_budget['actual_cost']);
                                $_sum_orders += $_budget['combined_cost'];
 
-                               if(!$_budget['closed_order'])// && 
$active_period[$period])
+                               if(!$_budget['closed_order'])
                                {
                                        if($active_period[$period])
                                        {
-                                       $_sum_oblications += 
$_budget['combined_cost'];
-                                       $_sum_oblications -= 
$_budget['actual_cost'];
+                                               $_sum_oblications += 
$_budget['combined_cost'];
+                                               $_sum_oblications -= 
$_budget['actual_cost'];
 
-                       //              if($project_total_budget >= 0)
-                                       if($_budget['budget'] >= 0)
-                                       {
-                                               if($_sum_oblications < 0)
+                                               if($_budget['budget'] >= 0)
                                                {
-                                                       $_sum_oblications = 0;
+                                                       if($_sum_oblications < 
0)
+                                                       {
+                                                               
$_sum_oblications = 0;
+                                                       }
                                                }
-                                       }
-                                       else // income
-                                       {
-                                               if($_sum_oblications > 0)
+                                               else // income
                                                {
-                                                       $_sum_oblications = 0;
+                                                       if($_sum_oblications > 
0)
+                                                       {
+                                                               
$_sum_oblications = 0;
+                                                       }
                                                }
                                        }
-                                       }
                                }
 
-/*
-                               if(($period < $_current_period) && 
$active_period[$period] && !$closed_period[$period])
-                               {
-                                       $_delay_period = true;
-                                       $_delay_period_sum += $_sum_oblications;
-                                       $_sum_oblications = 0;
-                               }
-*/
                                //override if periode is closed
                                if(!isset($active_period[$period]) || 
!$active_period[$period])
                                {
@@ -1911,7 +1905,7 @@
                                        $_delay_period_sum =0;
                                }
                                $_delay_period = false;
-//die();
+
                                $values[] = array
                                (
                                        'year'                                  
=> $_budget['year'],
@@ -1938,16 +1932,13 @@
                        $budget_acc = 0;
                        foreach ($values as &$entry)
                        {
-                       //      if($active_period[$entry['period']])
                                if($closed_period[$entry['period']])
                                {
                                        $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
                                        $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
 
                                        $_deviation = $entry['budget'] - 
$entry['actual_cost'];
-       //                              $deviation = abs($entry['actual_cost']) 
> 0 ? $_deviation : 0;
                                        $deviation = $_deviation;
-
                                }
                                else
                                {
@@ -1958,7 +1949,6 @@
                                $entry['deviation_period'] = $deviation;
                                $budget_acc +=$entry['budget'];
 
-       //                      if($active_period[$entry['period']])
                                if($closed_period[$entry['period']])
                                {
                                        $deviation_acc += $deviation;

Modified: 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
===================================================================
--- 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
   2013-12-22 21:25:35 UTC (rev 11560)
+++ 
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_agresso_X205.php
   2013-12-22 21:41:30 UTC (rev 11561)
@@ -191,7 +191,6 @@
                        foreach($file_list as $file)
                        {
                                $file_parts = explode('_', basename($file, 
'.xml'));
-                       //      $external_ref = $file_parts[2];
                                $external_voucher_id = $file_parts[2];
 
                                $duplicate = false;
@@ -224,7 +223,7 @@
                                return;
                        }
 
-                       if($this->skip_email)
+                       if($this->skip_email || $this->debug)
                        {
                                return;
                        }
@@ -322,6 +321,12 @@
                                {
                                        $this->db->transaction_begin();
                                        $bilagsnr = $this->import($file);
+                                       if($this->debug)
+                                       {
+                                               _debug_array("Behandler fil: 
{$file}");
+                                               _debug_array("Bilagsnr: 
{$bilagsnr}");
+                                       }
+
                                        if ($bilagsnr)
                                        {
                                                // move file
@@ -337,7 +342,6 @@
                                                $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");
                                                }
@@ -563,7 +567,7 @@
                                else if (!$order_info['order_exist'])
                                {
                                        $merknad = 'bestillingsnummeret ikke 
gyldig: ' . $_order_id;
-                                       $this->receipt['error'][] = array('msg' 
=> $merknad);
+                                       $this->receipt['error'][] = array('msg' 
=> "{$merknad}, fil: {$file}");
                                }
                                else
                                {
@@ -646,7 +650,7 @@
                                        }
                                        else
                                        {
-                                               $this->receipt['error'][] = 
array('msg' => "Bilag ikke rullet tilbake fra historikk : {$__bilagsnr}, extern 
ref: {$_data['SCANNINGNO']}");
+                                               $this->receipt['error'][] = 
array('msg' => "Bilag ikke rullet tilbake fra historikk : {$__bilagsnr}, 
Skanningreferanse: {$_data['SCANNINGNO']}, FakturaNr: {$fakturanr}");
                                        }
                                        unset($_bilagsnr_ut);
                                }
@@ -656,14 +660,19 @@
                                $sql = 'SELECT id FROM fm_vendor WHERE id = ' . 
(int) $vendor_id;
                                $this->db->query($sql,__LINE__,__FILE__);
 
-                               if(!$_data['SUPPLIER.CODE'])
+                               if(!abs($belop) > 0)
                                {
+                                       $this->receipt['error'][] = array('msg' 
=> "Importeres ikke: Beløpet er 0 for Skanningreferanse: 
{$_data['SCANNINGNO']}, FakturaNr: {$fakturanr}, fil: {$file}");
+                                       $this->skip_import = true;              
                
+                               }
+                               else 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->receipt['error'][] = array('msg' 
=> "Importeres ikke: Ikke gyldig LeverandørId: {$_data['SUPPLIER.CODE']}, 
Skanningreferanse: {$_data['SCANNINGNO']}, FakturaNr: {$fakturanr}, fil: 
{$file}");
                                        $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'] : '';
@@ -720,7 +729,7 @@
 
                                if(isset($order_info['supervisor']) && 
$order_info['supervisor'])
                                {
-                               $buffer[$i]['saksbehandlerid']          = 
$order_info['supervisor'];
+                                       $buffer[$i]['saksbehandlerid']          
= $order_info['supervisor'];
                                }
 
                                if(isset($order_info['budget_responsible']) && 
$order_info['budget_responsible'])
@@ -732,8 +741,18 @@
 //_debug_array($buffer);
 //_debug_array($this->receipt);
 //_debug_array($order_info['toarray']);
-                       if(!$this->skip_import)
+                       if($this->debug && $this->skip_import)
                        {
+                               _debug_array("Skip import - file: {$file}");
+                       }
+                       
+                       if($this->skip_import)
+                       {
+                               $this->skip_import = false;
+                               return false;
+                       }
+                       else
+                       {
                                if($update_voucher && $bilagsnr)
                                {
                                        $this->db->query("DELETE FROM 
fm_ecobilag WHERE external_ref = '{$_data['SCANNINGNO']}'",__LINE__,__FILE__);
@@ -749,7 +768,7 @@
                                        }
                                }
 
-                               if($order_info['toarray'] && !$this->skip_email)
+                               if($order_info['toarray'] && 
(!$this->skip_email || !$this->debug))
                                {
 
                                        $from = "Ikke svar<address@hidden>";
@@ -801,8 +820,6 @@
                                $GLOBALS['phpgw']->db->Exception_On_Error = 
false;
                                return $bilagsnr;
                        }
-                       $this->skip_import = false;
-                       return false;
                }
 
                function get_order_info($order_id = '')
@@ -856,6 +873,14 @@
                function import_end_file($buffer)
                {
                        $num = $this->soXport->add($buffer);
+                       if($this->debug)
+                       {
+                               _debug_array("import_end_file() ");
+                               echo 'buffer: ';
+                               _debug_array($buffer);
+                               _debug_array("num: {$num}");
+                       }
+
                        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']}");

Modified: branches/Version-1_0-branch/property/inc/hook_config.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/hook_config.inc.php        
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/hook_config.inc.php        
2013-12-22 21:41:30 UTC (rev 11561)
@@ -157,7 +157,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -184,7 +184,7 @@
                $out = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
                foreach ( $status_entries as $status)
                {
-                       $selected =  $status['selected'] ? 'selected =  
"selected"' : '';
+                       $selected =  $status['selected'] ? ' selected = 
"selected"' : '';
 
                        $out .=  <<<HTML
                        <option 
value='{$status['id']}'{$selected}>{$status['name']}</option>
@@ -212,7 +212,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -238,7 +238,7 @@
                $out = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
                foreach ( $status_entries as $status)
                {
-                       $selected =  $status['selected'] ? 'selected =  
"selected"' : '';
+                       $selected =  $status['selected'] ? ' selected = 
"selected"' : '';
 
                        $out .=  <<<HTML
                        <option 
value='{$status['id']}'{$selected}>{$status['name']}</option>
@@ -266,7 +266,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -295,7 +295,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -353,7 +353,7 @@
                        $selected = '';
                        if ( ($level['id'] == $level_assigned))
                        {
-                               $selected = ' selected';
+                               $selected = ' selected = "selected"';
                        }
                        $out .=  <<<HTML
                        <option value="{$level['id']}" 
{$selected}><label>{$level['name']}</label></option>
@@ -399,7 +399,7 @@
                                $selected = '';
                                if ( isset($filter_assigned[$filter_key]) && 
$filter_assigned[$filter_key] == $key)
                                {
-                                       $selected = 'selected =  "selected"';
+                                       $selected = ' selected = "selected"';
                                }
 
                                $out .=  <<<HTML
@@ -452,7 +452,7 @@
                                $selected = '';
                                if ( isset($filter_assigned[$filter_key]) && 
$filter_assigned[$filter_key] == $category['id'])
                                {
-                                       $selected = 'selected =  "selected"';
+                                       $selected = ' selected = "selected"';
                                }
 
                                $out .=  <<<HTML
@@ -485,7 +485,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -514,7 +514,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML
@@ -543,7 +543,7 @@
                        $selected = '';
                        if ( $status_assigned == $status['id'])
                        {
-                               $selected = 'selected =  "selected"';
+                               $selected = ' selected = "selected"';
                        }
 
                        $out .=  <<<HTML

Deleted: branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK      
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK      
2013-12-22 21:41:30 UTC (rev 11561)
@@ -1,319 +0,0 @@
-<?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: Import_fra_BKK,v 1.11 2007/01/26 14:58:55 sigurdne Exp $
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class import_conv
-       {
-               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
-               var $id = -1;
-               var $spbudact_code='12304121';
-               var $mvakode=0;
-               var $kildeid=1;
-               var $splitt=0;
-               var $type = 'fixed';
-               var $header_count = 1;
-               var $soXport;
-               var $invoice;
-               var $meter_table;
-
-               var $import = array(
-                       'Bestilling' => 'pmwrkord_code', 
-                       'Fakt. Nr' => 'fakturanr',
-                       'M\xE5ler nr' => 'maalernr',
-                       'Konto' => 'spbudact_code',
-                       'Objekt' => 'dima',
-                       'Omr' => 'omraade',
-                       'Adresse' => 'merknad',
-                       'MVA' => 'mvakode',
-                       'Tjeneste'=> 'kostra_id',
-                       'Bel\xF8p [kr]' => 'belop'
-                       );
-
-               var $header = array('Fakt. Nr','M\xE5ler 
nr','Konto','Objekt','MVA','Bel\xF8p [kr]','Omr','Adresse');
-
-               var $import_bkk = 
array('boligbyggelag','dato','kundenr','lopenr', 'maalernr' , 
'installasjonsnr', 
-                       
'anleggsid','stedsnavn','kunde_navn','navn','netto','mva');
-                       
-               var $import_bkk_offset = array(
-                       'boligbyggelag' => '0', 
-                       'dato' => '5', 
-                       'kundenr' => '16', 
-                       'lopenr' => '25', 
-                       'maalernr' => '30', 
-                       'installasjonsnr' => '43', 
-                       'anleggsid' => '54', 
-                       'stedsnavn' => '59',
-                       'kunde_navn' => '95',
-                       'navn' => '126',
-                       'netto' => '157',
-                       'mva' => '172'
-                       );
-
-               var $import_bkk_len = array(
-                       'boligbyggelag' => '5', 
-                       'dato' => '10', 
-                       'kundenr' => '8', 
-                       'lopenr' => '4', 
-                       'maalernr' => '8', 
-                       'installasjonsnr' => '9', 
-                       'anleggsid' => '4', 
-                       'stedsnavn' => '35',
-                       'kunde_navn' => '30',
-                       'navn' => '30',
-                       'netto' => '14',
-                       'mva' => '14'
-                       );
-
-               function import_conv()
-               {
-                       $this->soXport          = 
CreateObject('property.soXport');     
-                       $this->invoice          = 
CreateObject('property.boinvoice');
-                       $this->dateformat       = 
$GLOBALS['phpgw']->db->date_format();
-                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
-                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
-                       $this->config = 
CreateObject('phpgwapi.config','property');
-                       $this->config->read_repository();
-                       $this->meter_table = 
$this->config->config_data['meter_table'];
-
-               }
-
-               function import($invoice_common,$download)
-               {
-
-                       $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
-
-                       if(!$buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'])
-                       {
-                               echo '<b>KID-nummer mangler</b><br><br>';
-                               return;
-                       }
-                       $valid_data= False;
-                       $buffer = array();
-                       $buffer = $this->import_start_file($buffer);
-                       $fp = fopen($tsvfile,'rb');
-//print_r($buffer);
-
-//print_r($header);
-//echo '<br>';
-                       for ($i = 0; $i < $this->header_count && 
fgets($fp,8000); ++$i);
-
-                       while ($data = fgets($fp,8000))
-                       {
-//print_r($data);
-                               $num = count($this->import_bkk);
-//echo 'data :'.$data.'<br>';
-                               $buffer = $this->import_start_record($buffer);
-//print_r($buffer);
-                               for ($c=0; $c<$num; $c++ )
-                               {
-                                       //Send name/value pairs along with the 
buffer
-                                       if ($this->import_bkk[$c] != '' && 
substr($data,5,10) !='')
-                                       {
-//echo 'len :'.$this->import_bkk_len[$this->import_bkk[$c]].'<br>';
-//print_r(fread($data,$this->import_bkk_len[$this->import_bkk[$c]]));
-//print_r($this->import_bkk[$c]);
-                                               
$value=substr($data,$this->import_bkk_offset[$this->import_bkk[$c]],$this->import_bkk_len[$this->import_bkk[$c]]);
-                                               $name=$this->import_bkk[$c];
-                                               if ($name=='installasjonsnr')
-                                               {
-                                                       $name='anleggsnr';
-                                                       
$value=substr($data,43,9)." ".substr($data,54,4);
-                                               }
-                                               if ($name=='netto')
-                                               {
-                                                       $name='belop';
-                                                       
$value=(floatval(substr($data,157,14)) + floatval(substr($data,172,14)))/100;
-                                                       $valid_data= True;      
                        
-                                               }
-//echo 'name :'.$name;
-//echo '  value :'.$value.'<br>';
-//print_r($buffer);
-
-                                               $buffer = 
$this->import_new_attrib($buffer,$name,$value,$invoice_common);
-                                       }
-                               }
-                               if ($valid_data)
-                               {
-                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
-                                       $valid_data= False;
-                               }
-                       }
-                       fclose($fp);
-//print_r($buffer);
-
-
-//echo 'download'.$download.'<br>';
-
-                       if(!$download)
-                       {
-                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
-                       }
-
-                       $this->header = array('Fakt. Nr','M\xE5ler 
nr','Konto','Objekt','MVA','Tjeneste','Bel\xF8p [kr]','Omr','Adresse');
-
-                       return $buffer;
-               }
-               
-
-               function import_start_file($buffer)
-               {
-                       return $buffer;
-               }
-
-               function import_start_record($buffer)
-               {
-//print_r($buffer);
-                       $top=array();
-                       ++$this->id;
-                       $this->currentrecord = $top;
-                       return $buffer;
-               }
-
-               function import_new_attrib($buffer,$name,$value,$invoice_common)
-               {
-
-                       $value = trim($value);
-               //      $value = str_replace('\n','<BR>',$value);
-               //      $value = str_replace('\r','',$value);
-
-                       $this->currentrecord += array($name => $value);
-//print_r($buffer);
-                       return $buffer;
-               }
-
-               function import_end_record($buffer,$invoice_common)
-               {
-                       $buffer[$this->id]='';
-                       while ( list($name, $value) = 
each($this->currentrecord))
-                       {
-                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
-                               if($invoice_common['num_days'])
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
-                               }
-                               else
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
-                               }
-
-                               if($name=='belop')
-                               {
-                                       $value = str_replace('kr','',$value);
-                                       $value = str_replace(' ','',$value);
-                                       $value = str_replace(',','.',$value);
-
-                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
-                                       {
-                                               $value = -1 * abs($value);
-                                       }
-
-                                       $godkjentbelop=$value;
-                               }
-
-                               if($name=='anleggsnr')
-                               {
-                                       $buffer[$this->id]['merknad'] = 
'anleggsnr:' . $value;
-                                       
-                                       
$maalerinfo=$this->soXport->anleggsnr_to_objekt($value,$this->meter_table);
-                                       $dima=$maalerinfo['dima'];
-                                       $loc1=$maalerinfo['loc1'];
-//                                     $maalernr=$maalerinfo['maalernr'];
-                                       $omraade=$maalerinfo['district'];
-                                       if($invoice_common['auto_tax'])
-                                       {
-                                               
$mvakode=$this->soXport->auto_tax($loc1);
-                                               
-                                               if($mvakode)
-                                               {
-                                                       
$buffer[$this->id]['mvakode'] = $mvakode;
-                                               }
-                                               else
-                                               {
-                                                       
$buffer[$this->id]['mvakode'] = $this->mvakode;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
-                                       }
-
-                               }
-                               if($name=='stedsnavn')
-                               {
-                                       $buffer[$this->id]['merknad'] .= "\r\n" 
. $value;
-                               }
-
-                               $buffer[$this->id][$name] = $value;
-                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
-                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
-                               $buffer[$this->id]['dima'] = $dima;
-                               $buffer[$this->id]['loc1'] = $loc1;
-                               $buffer[$this->id]['omraade'] = $omraade;
-//                             $buffer[$this->id]['maalernr'] = $maalernr;
-                               $buffer[$this->id]['splitt'] = $this->splitt;
-                               $buffer[$this->id]['kildeid'] = $this->kildeid;
-//                             $buffer[$this->id]['mvakode'] = $this->mvakode;
-                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
-                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
-                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
-                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
-                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
-                               $buffer[$this->id]['periode'] = 
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
-                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
-                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
-                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
-                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
-                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
-                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
-                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
-                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
-
-                               if($invoice_common['auto_tax'])
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
-                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
-                               }
-                       }
-                       return $buffer;
-               }
-
-               function import_end_file($buffer,$bilagsnr)
-               {
-                       $num    = $this->soXport->add($buffer);
-                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
-                       return $receipt;
-               }
-       }

Deleted: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv  
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv  
2013-12-22 21:41:30 UTC (rev 11561)
@@ -1,381 +0,0 @@
-<?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: Import_fra_BKK_csv,v 1.8 2007/03/18 16:33:16 sigurdne 
Exp $
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class import_conv
-       {
-               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
-               var $id = -1;
-               var $spbudact_code='12304121';
-               var $mvakode=0;
-               var $kildeid=1;
-               var $splitt=0;
-               var $type = 'fixed';
-               var $header_count = 1;
-               var $soXport;
-               var $invoice;
-               var $meter_table;
-               var $bilagsnr_0 = 0;
-               var $bilagsnr_1 = 0;
-               var $bilagsnr_2 = 0;
-
-               var $import = array(
-                       'Bestilling' => 'pmwrkord_code', 
-                       'Fakt. Nr' => 'fakturanr',
-                       'Måler nr' => 'maalernr',
-                       'Konto' => 'spbudact_code',
-                       'Objekt' => 'dima',
-                       'Omr' => 'omraade',
-                       'Adresse' => 'stedsnavn',
-                       'MVA' => 'mvakode',
-                       'Tjeneste'=> 'kostra_id',
-                       'Belop [kr]' => 'belop'
-                       );
-
-               var $header = array('Fakt. Nr','Måler 
nr','Konto','Objekt','MVA','Belop [kr]','Omr','Adresse');
-
-               var $import_bkk = 
array('kundenr','under_fakturanr','Utskriftsdato','Forfdato','Maalepunktid',
-                       'stedsnavn','Girobeloep','maalernr','kunde_navn');
-       
-
-               var $import_bkk_offset = array(
-                       'kundenr' => 0, 
-                       'under_fakturanr' => 1,
-                       'Utskriftsdato' => 2,
-                       'Forfdato' => 3,
-                       'Maalepunktid' => 4,
-                       'stedsnavn' => 8,
-                       'Girobeloep' => 14,
-                       'maalernr' => 19, 
-                       'kunde_navn' => 6
-                       );
-
-               function import_conv()
-               {
-                       $this->soXport          = 
CreateObject('property.soXport');     
-                       $this->invoice          = 
CreateObject('property.boinvoice');
-                       $this->config = 
CreateObject('phpgwapi.config','property');
-                       $this->config->read_repository();
-                       $this->meter_table = 
$this->config->config_data['meter_table'];
-
-                       $this->db                               = & 
$GLOBALS['phpgw']->db;
-                       $this->join                             = & 
$this->db->join;
-                       $this->left_join                = & 
$this->db->left_join;
-                       $this->like                             = & 
$this->db->like;
-                       $this->datetimeformat   = $this->db->datetime_format();
-                       $this->dateformat               = 
$this->db->date_format();
-               }
-
-               function import($invoice_common,$download)
-               {
-
-                       $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
-
-                       if(!$buffer[0]['kidnr'] = $invoice_common['kid_nr'])
-                       {
-                               echo '<b>KID-nummer mangler</b><br><br>';
-                               return;
-                       }
-                       $valid_data= False;
-                       $buffer = array();
-                       $fp = fopen($tsvfile,'rb');
-                       $column_header = true;
-                       $this->id = -1;
-                       while ($data = fgetcsv($fp,8000,";"))
-                       {
-                               $num = count($this->import_bkk);
-                               
-                               $this->currentrecord = array();
-                               for ($c=0; $c<$num; $c++ )
-                               {
-                                       //Send name/value pairs along with the 
buffer
-                                       if ($data[14] && !$column_header)
-                                       {
-                                               
$value=$data[$this->import_bkk_offset[$this->import_bkk[$c]]];
-                                               $name=$this->import_bkk[$c];
-                                               if ($name=='Maalepunktid')
-                                               {
-                                                       $name='anleggsnr';
-                       //                              $value= '7070575000' . 
$value;
-                                               }
-                                               if ($name=='Girobeloep')
-                                               {
-                                                       $name='belop';          
                                        
-                                                       $valid_data= True;      
                        
-                                               }
-                                               
$this->import_new_attrib($name,$value,$invoice_common);
-                                       }
-                               }
-                               if ($valid_data)
-                               {
-                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
-                                       $valid_data= False;
-                               }
-                               
-                               unset($column_header);
-                               $this->id++;
-                       }
-
-                       fclose($fp);
-
-
-                       if(!$download)
-                       {
-                               $buffer = $this->import_end_file($buffer);
-                       }
-
-                       $this->header = array('Fakt. Nr','Måler 
nr','Konto','Objekt','MVA','Tjeneste','Belop [kr]','Omr','Adresse');
-                       return $buffer;
-               }
-               
-
-               function import_new_attrib($name,$value,$invoice_common)
-               {
-
-                       $value = trim($value);
-               //      $value = str_replace('\n','<BR>',$value);
-               //      $value = str_replace('\r','',$value);
-
-                       $this->currentrecord += array($name => $value);
-               }
-
-               function import_end_record($buffer,$invoice_common)
-               {
-                       $buffer[$this->id]='';
-                       while ( list($name, $value) = 
each($this->currentrecord))
-                       {
-                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
-                               if($invoice_common['num_days'])
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
-                               }
-                               else
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
-                               }
-
-                               if($name=='belop')
-                               {
-                                       $value = str_replace('kr','',$value);
-                                       $value = str_replace(' ','',$value);
-                                       $value = str_replace(',','.',$value);
-
-
-                                       if($value < 0)
-                                       {
-                                               $buffer[$this->id]['artid'] = 
2;                                        
-                                               $buffer[$this->id]['bilagsnr'] 
= $this->next_bilagsnr_2() . '_k';
-                                       }
-                                       else
-                                       {
-                                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
-                                               $buffer[$this->id]['bilagsnr'] 
= $this->next_bilagsnr_1();
-                                       }
-
-                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
-                                       {
-                                               $value = -1 * abs($value);
-                                       }
-
-                                       $godkjentbelop=$value;
-                               }
-
-                               if($name=='anleggsnr')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nanleggsnr: {$value}";                                     
-                                       
$maalerinfo=$this->anleggsnr_to_objekt($value,$this->meter_table);
-                                       $dima=$maalerinfo['dima'];
-                                       $loc1=$maalerinfo['loc1'];
-                                       $omraade=$maalerinfo['district'];
-
-                                       if($invoice_common['auto_tax'])
-                                       {
-                                               
$mvakode=$this->soXport->auto_tax($loc1);
-                                               
-                                               if($mvakode)
-                                               {
-                                                       
$buffer[$this->id]['mvakode'] = $mvakode;
-                                               }
-                                               else
-                                               {
-                                                       
$buffer[$this->id]['mvakode'] = $this->mvakode;
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
-                                       }
-
-                               }
-                               if($name=='maalernr')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nmaalernr: {$value}";
-                               }
-                               if($name=='under_fakturanr')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nFakturanr: {$value}";
-                               }
-                               if($name=='kundenr')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nKundenr: {$value}";
-                               }
-                               if($name=='kunde_navn')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nKundenavn: {$value}";                                     
-                               }
-                               if($name=='stedsnavn')
-                               {
-                                       $buffer[$this->id]['merknad'] .= 
"\r\nAdresse: {$value}";
-                               }
-
-                               $buffer[$this->id][$name] = $value;
-                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
-                               $buffer[$this->id]['dima'] = $dima;
-                               $buffer[$this->id]['loc1'] = $loc1;
-                               $buffer[$this->id]['omraade'] = $omraade;
-                               $buffer[$this->id]['splitt'] = $this->splitt;
-                               $buffer[$this->id]['kildeid'] = $this->kildeid;
-                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
-                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
-                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
-                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
-                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
-                               $buffer[$this->id]['periode'] = 
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
-                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
-
-                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
-                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
-                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
-                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
-                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
-                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
-
-                               if($invoice_common['auto_tax'])
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
-                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
-                               }
-                       }
-
-                       return $buffer;
-               }
-
-
-               function anleggsnr_to_objekt($anleggsnr,$meter_table)
-               {
-                       $sql = "SELECT 
{$meter_table}.maaler_nr,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
 "
-                       . " FROM {$meter_table} {$this->join} fm_location1 ON 
{$meter_table}.loc1 = fm_location1.loc1 $this->join "
-                         . " fm_part_of_town ON fm_location1.part_of_town_id = 
fm_part_of_town.part_of_town_id WHERE {$meter_table}.maalepunkt_id 
{$this->like} '%{$anleggsnr}'";
-//     _debug_array($sql);
-                       $this->db->query($sql);
-
-                       $this->db->next_record();
-                       $loc1 = $this->db->f('loc1');
-                       $loc2 = $this->db->f('loc2');
-       //              $loc3 = $this->db->f('loc3');
-
-                       $maalerinfo['loc1']=$loc1;
-                       $maalerinfo['dima']=$loc1.$loc2;//.$loc3;
-                       $maalerinfo['maalernr']=$this->db->f('maaler_nr');
-                       $maalerinfo['district']=$this->db->f('district_id');
-                       return $maalerinfo;
-               }
-
-               function import_end_file($buffer)
-               {
-                       $num    = $this->soXport->add($buffer);
-                       
-                       $_bilagsnr = array();
-                       if($this->bilagsnr_1)
-                       {
-                               $_bilagsnr[] = $this->bilagsnr_1;
-                       }
-                       if($this->bilagsnr_2)
-                       {
-                               $_bilagsnr[] = $this->bilagsnr_2;
-                       }
-                       
-                       $bilagsnr = max($_bilagsnr);
-                       $this->db->query("UPDATE fm_idgenerator SET VALUE 
={$bilagsnr} WHERE name = 'Bilagsnummer'");
-
-                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. implode(',', $_bilagsnr));
-                       return $receipt;
-               }
-
-               protected function next_bilagsnr_1()
-               {
-                       if ($this->bilagsnr_1)
-                       {
-                               return $this->bilagsnr_1;
-                       }
-                       else
-                       {
-                               if(!$this->bilagsnr_0)
-                               {
-                                       $this->bilagsnr_0 = 
$this->invoice->next_bilagsnr();
-                                       $this->bilagsnr_1 = $this->bilagsnr_0;
-                               }
-                               else
-                               {
-                                       $this->bilagsnr_1 = $this->bilagsnr_0 + 
1;                              
-                               }
-
-                               return $this->bilagsnr_1;
-                       }
-               }
-
-               protected function next_bilagsnr_2()
-               {
-                       if ($this->bilagsnr_2)
-                       {
-                               return $this->bilagsnr_2;
-                       }
-                       else
-                       {
-                               if(!$this->bilagsnr_0)
-                               {
-                                       $this->bilagsnr_0 = 
$this->invoice->next_bilagsnr();
-                                       $this->bilagsnr_2 = $this->bilagsnr_0;
-                               }
-                               else
-                               {
-                                       $this->bilagsnr_2 = $this->bilagsnr_0 + 
1;                              
-                               }
-
-                               return $this->bilagsnr_2;
-                       }
-               }
-       }

Deleted: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner   
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_Kemner   
2013-12-22 21:41:30 UTC (rev 11561)
@@ -1,402 +0,0 @@
-<?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: Import_fra_Kemner,v 1.9 2007/01/26 14:58:56 sigurdne 
Exp $
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-       class import_conv
-       {
-               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
-               var $id = -1;
-               var $spbudact_code='11954111';
-               var $dimb=40;
-               var $mvakode=0;
-               var $kildeid=1;
-               var $splitt=0;
-               var $type = 'fixed';
-               var $header_count = 0;
-               var $soXport;
-               var $invoice;
-
-               var $import = array(
-                       'Bilagsnr' => 'bilagsnr', 
-                       'Ref.' => 'fakturanr', 
-                       'Gnr/Bnr-seksjon' => 'gid',
-                       'Konto' => 'spbudact_code',
-                       'Objekt' => 'dima', //objectclass: organizationalPerson
-                       'DimB' => 'dimb',
-                       'KID' => 'kidnr',
-                       'MVA' => 'mvakode',
-                       'Tjeneste'=> 'kostra_id',
-                       'Bel\xF8p [kr]' => 'belop',
-                       'Referanse' => 'referanse',
-                       'BOEI Gateadresse' => 'boei_gateadresse',
-                       );
-
-       //      var $header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
 [kr]','Referanse','BOEI Gateadresse');
-               var $header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
 [kr]','Referanse');
-
-               function import_conv()
-               {
-                       $this->soXport                  = 
CreateObject('property.soXport');     
-                       $this->invoice                  = 
CreateObject('property.boinvoice');
-                       $this->dateformat               = 
$GLOBALS['phpgw']->db->date_format();
-                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
-               }
-
-               function import($invoice_common,$download)
-               {
-               
-                       $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
-
-                       $Ingen = 0;
-                       $FilGodkjent = 1;
-                       $Betalingskrav = 2;
-                       $Bel\xF8pspost1 = 3;
-                       $Bel\xF8pspost2 = 4;
-                       $Spesifikasjon = 5;
-                       $LinjeNr = 0;
-                       $ePostNiv\xE5 = $Ingen;
-                       $errorcount = 0;
-                       $last_case_merknad='';
-                       $bilagsnr = $this->invoice->next_bilagsnr();
-                       $buffer = array();
-                       $buffer = $this->import_start_file($buffer);
-                       $fp = fopen($tsvfile,'r');
-
-                       while ($data = fgets($fp,8000))
-                       {
-//-----------------------------
-//print_r($buffer);
-                               
-                               $LinjeNr = $LinjeNr + 1;
-                               if (strlen($data) >= 80)
-                               {
-                                       if ($last_case_merknad && 
substr($data,0,8)!=$last_case_merknad)
-                                       {
-                                               if ($Merknad)
-                                               {
-                                                       $buffer = 
$this->import_new_attrib($buffer,merknad,$Merknad,$invoice_common);
-                                               }
-                                               $Merknad='';
-                                               $buffer = 
$this->import_end_record($buffer,$invoice_common);
-                                               $last_case_merknad='';
-                                       }
-                                   switch(substr($data,0,8))
-                                   {
-                                       Case 'NY000010':
-                                           //Start forsendelse
-                                           if (($LinjeNr == 1) && 
($ePostNiv\xE5 == $Ingen))
-                                           {
-                                               $ePostNiv\xE5 = $FilGodkjent;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') . 
lang('Filen inneholder flere start poster p\xE5 linje nr:') . $LinjeNr . 
lang('Importen kan ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                       break;
-                                       
-                                       Case 'NY210020':
-                                           //Start betalingskrav
-                                           if ($ePostNiv\xE5 == $FilGodkjent)
-                                           {
-                                               $ePostNiv\xE5 = $Betalingskrav;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                           $OppdragsNr = substr($data,17,7);
-                                           $OppdragsKonto = substr($data, 24, 
11);
-                                       break;
-                                       
-                                       Case 'NY210230':
-                                       break;
-                                       
-                                       Case 'NY212130':
-                                       $buffer = 
$this->import_start_record($buffer);
-
-             
-                                           //Bel\xF8pspost 1
-                                           if ($ePostNiv\xE5 == $Betalingskrav 
Or $ePostNiv\xE5 >= $Bel\xF8pspost2)
-                                           {
-                                               $ePostNiv\xE5 = $Bel\xF8pspost1;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                           //Lagre eksisterende post
-                                           if (!oRsTmp.EOF && !oRsTmp.BOF)
-                                           {
-                                               if (oRsTmp.EditMode == 
adEditAdd)
-                                               {
-                                                   oRsTmp.Update;
-                                               }
-                                           }
-                       
-                                           //Opprett post
-                                               $TransaksjonsNr = substr($data, 
8, 7);
-                                               $Gnr = substr($data, 56, 5);
-                                               $Bnr = substr($data, 61, 4);
-                                               $sekjonnr = substr($data, 69, 
3);
-                       
-                                               $forfall_day = substr($data, 
15, 2);
-                                               $forfall_month = substr($data, 
17, 2);
-                                               $forfall_year = substr($data, 
19, 2);
-               //                              $periode = $forfall_month - 1;
-                                               $periode = $forfall_year . 
sprintf("%02d",($forfall_month - 1));
-
-                                               $forfallsdato = 
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year));
-                                               $fakturadato= 
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year)-(86400*30));
-
-                                               $belop = 
intval(substr($data,32,17))/100;
-
-                                               if( $invoice_common['art'] == 2 
) // kreditnota
-                                               {
-                                                       $belop = -1 * 
abs($belop);
-                                               }
-
-                                               $kidnr = substr($data, 54, 20);
-                                               $gid = 
$Gnr.'/'.$Bnr.'-'.$sekjonnr;
-                       
-                                               $buffer = 
$this->import_new_attrib($buffer,periode,$periode,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,forfallsdato,$forfallsdato,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,fakturadato,$fakturadato,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,belop,$belop,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,kidnr,$kidnr,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,gid,$gid,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,bilagsnr,$bilagsnr,$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,dimb,$this->dimb,$invoice_common);
-                                               $bilagsnr++;
-
-                                   //Finn dima fra Boei
-                                   $gabinfo = 
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
-                                               $buffer = 
$this->import_new_attrib($buffer,'dima',$gabinfo['dima'],$invoice_common);
-                                               $buffer = 
$this->import_new_attrib($buffer,'loc1',$gabinfo['loc1'],$invoice_common);
-                                               //finn boei gateadresse for 
kongroll
-                                               
$boei_gateadresse=$this->soXport->dima_to_address($dima);
-                                               $buffer = 
$this->import_new_attrib($buffer,boei_gateadresse,$boei_gateadresse,$invoice_common);
-                                               
-                                       break;
-                                       
-                                       Case 'NY210231':
-                                       break;
-                                       
-                                       Case 'NY212131':
-                                           //Bel\xF8pspost 2
-                                           if ($ePostNiv\xE5 == 
$Bel\xF8pspost1)
-                                           {
-                                               $ePostNiv\xE5 = $Bel\xF8pspost2;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                           //Sjekk transaksjonsnr
-                                           if ((intval(substr($data, 8, 7))) 
<> $TransaksjonsNr)
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Transaksjonsnr p\xE5 bel\xF8pspost 2 stemmer ikke med nr p\xE5 
bel\xF8pspost 1. Linjenr:') . $LinjeNr . lang('Importen kan ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                           $Navn = substr($data, 15, 10);
-                                           $referanse = substr($data, 50, 25);
-                                           $buffer = 
$this->import_new_attrib($buffer,referanse,$referanse,$invoice_common);         
       
-                                       $Merknad = 'Kemner adr: 
'.$referanse."\r\n".'BOEI adr: '.$boei_gateadresse."\r\n";
-                                       break;
-                                       
-                                       Case 'NY212149':
-                                           //Spesifikasjonsrecord
-                                           if ($ePostNiv\xE5 >= 
$Bel\xF8pspost2)
-                                           {
-                                               $ePostNiv\xE5 = $Spesifikasjon;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                           //Hent merknad
-                                       $Merknad.=strval(substr($data, 20, 
40))."\r\n";
-                                       $last_case_merknad=substr($data,0,8);
-                       
-                                       break;
-                                       
-                                       Case 'NY210088':
-                                           //Slutt betalingskrav
-                                           if ($ePostNiv\xE5 >= $Betalingskrav 
&& $ePostNiv\xE5 <> $Bel\xF8pspost1)
-                                           {
-                                               $ePostNiv\xE5 = $FilGodkjent;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                       
-                                       break;
-                                       
-                                       Case 'NY000089':
-                                           //Slutt forsendelse
-                                           if ($ePostNiv\xE5 == $FilGodkjent)
-                                           {
-                                               $ePostNiv\xE5 = $Ingen;
-                                           }
-                                           else
-                                           {
-                                               echo lang('Importer_BBS') 
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan 
ikke fortsette');
-                                               break 2;
-                                           }
-                                       
-                                       break;
-                                   }
-                       
-                                   //Filen m\xE5 altid begynne med en gyldig 
start record
-                                   if ($LinjeNr == 1 && $ePostNiv\xE5 == 
$Ingen)
-                                   {
-                                       echo lang('Importer_BBS') . lang('Filen 
starter ikke med riktig recordtype. Importen kan ikke fortsette');
-                                       break;
-                                   }
-                               }
-//-----------------------------
-                       }
-                       fclose($fp);
-
-                       if(!$download)
-                       {
-                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
-                       }
-//print_r($buffer);
-                       $this->header = 
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Tjeneste','Bel\xF8p
 [kr]','Referanse');
-                       return $buffer;
-
-               }
-               
-
-               function import_start_file($buffer)
-               {
-                       return $buffer;
-               }
-
-               function import_start_record($buffer)
-               {
-                       $top=array();
-                       ++$this->id;
-                       $this->currentrecord = $top;
-                       return $buffer;
-               }
-
-               function import_new_attrib($buffer,$name,$value,$invoice_common)
-               {
-//                     $value = trim($value);
-//                     $value = str_replace('\n','<BR>',$value);
-//                     $value = str_replace('\r','',$value);
-//echo '<br> '.$name.': => '.$value;
-
-                       $this->currentrecord += array($name => $value);
-                       return $buffer;
-               }
-
-               function import_end_record($buffer,$invoice_common)
-               {
-                       $buffer[$this->id]='';
-
-                       while ( list($name, $value) = 
each($this->currentrecord))
-                       {
-                               if($name=='belop')
-                               {
-                                       $godkjentbelop=$value;
-                               }
-
-
-                               if($name=='loc1' && 
$invoice_common['auto_tax']):
-                               {
-                                       
$mvakode=$this->soXport->auto_tax($value);
-                                       
-                                       if($mvakode)
-                                       {
-                                               $buffer[$this->id]['mvakode'] = 
$mvakode;
-                                       }
-                                       else
-                                       {
-                                               $buffer[$this->id]['mvakode'] = 
$this->mvakode;
-                                       }
-                               }
-                               elseif($name=='loc1' && 
!$invoice_common['auto_tax']):
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->mvakode;
-                               }
-                               endif;
-
-                               $buffer[$this->id][$name] = $value;
-                               $buffer[$this->id]['fakturanr'] = 
$invoice_common['invoice_num'];
-                               $buffer[$this->id]['splitt'] = $this->splitt;
-                               $buffer[$this->id]['kildeid'] = $this->kildeid;
-
-                               $buffer[$this->id]['spbudact_code'] = 
$this->spbudact_code;
-                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
-                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
-                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
-                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
-                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
-//                             $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
-                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
-                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
-                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
-
-                               if($invoice_common['auto_tax'])
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
-                                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
-                               }
-                       }
-                       return $buffer;
-               }
-
-               function import_end_file($buffer,$bilagsnr)
-               {
-                       $num    = $this->soXport->add($buffer);
-                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
-                       return $receipt;
-               }
-       }
-?>

Modified: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service  
2013-12-22 21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service  
2013-12-22 21:41:30 UTC (rev 11561)
@@ -167,9 +167,7 @@
                                        }
                                        else
                                        {
-                                               $workorder = 
execMethod('property.soworkorder.read_single', (int)$value);
-                                               
$buffer[$this->id]['project_id'] = $workorder['project_id'];
-                                               $buffer[$this->id]['dime']      
= $workorder['cat_id'];
+                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value));
                                        }
                                }
                                if($name=='spbudact_code')

Copied: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_EBF 
(from rev 11560, trunk/property/inc/import/default/Import_fra_Service_EBF)
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_EBF  
                            (rev 0)
+++ 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_EBF  
    2013-12-22 21:41:30 UTC (rev 11561)
@@ -0,0 +1,302 @@
+<?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: Import_fra_Service,v 1.19 2007/03/18 16:33:16 sigurdne 
Exp $
+       */
+
+       /**
+        * Description
+        * @package property
+        */
+
+       class import_conv
+       {
+               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
+               var $id = -1;
+               var $kildeid=1;
+               var $splitt=0;
+               var $type = 'csv';
+               var $header_count = 18;
+               var $soXport;
+               var $invoice;
+
+               var $import = array(
+                       'Bestilling' => 'pmwrkord_code', 
+                       'Fakt. Nr' => 'fakturanr',
+                       'Konto' => 'spbudact_code',
+                       'Objekt' => 'dima',
+                       'DIM 6' => 'dimd',//utgår fra import - kopieres fra 
kategori
+                       'MVA' => 'mvakode',
+                       'Tjeneste'=> 'kostra_id',
+                       'Belop [kr]' => 'belop'
+                       );
+
+               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','DIM 6','MVA','Belop [kr]');
+
+               function import_conv()
+               {
+                       $this->db                               = 
clone($GLOBALS['phpgw']->db);
+                       $this->soXport                  = 
CreateObject('property.soXport');     
+                       $this->invoice                  = 
CreateObject('property.boinvoice');
+                       $this->bocommon                 = 
CreateObject('property.bocommon');
+                       $this->dateformat               = 
$GLOBALS['phpgw']->db->date_format();
+                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
+                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
+               }
+
+               function import($invoice_common,$download)
+               {
+                       $tsvfile        = $invoice_common['tsvfile'];
+
+                       $conv_type      = $invoice_common['conv_type'];
+                       $buffer = array();
+
+//-----------
+
+                       phpgw::import_class('phpgwapi.phpexcel');
+
+                       $objPHPExcel = PHPExcel_IOFactory::load($tsvfile);
+
+                       $data = 
$objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
+
+                       $result = array();
+
+                       $rows = count($data)+1;
+
+                       for ($row = $this->header_count; $row < $rows; $row++ )
+                       {
+                               $this->currentrecord = array();
+
+                               $j=0;
+                               foreach($data[$row] as $key => $_dummy)
+                               {
+                                       $value = 
$objPHPExcel->getActiveSheet()->getCellByColumnAndRow($j,$row)->getCalculatedValue();
+
+                                       if ($name = 
$this->import[$this->header[$j]])
+                                       {
+                                               
+                                               $value = 
str_replace(array('\n','\r'),array('<BR>',''),$value);
+                                               $this->currentrecord += 
array($name => $value);
+                                       }
+                                       $j++;
+                               }
+
+                               if($this->currentrecord['fakturanr'] && 
$this->currentrecord['belop']) // fakturanr og beløp
+                               {
+                                       ++$this->id;
+                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
+                               }
+                       }
+
+//----------
+
+                       if(!$download)
+                       {
+                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
+                       }
+
+                       return $buffer;
+               }
+               
+
+               function import_end_record($buffer,$invoice_common)
+               {
+                       $buffer[$this->id] = array();
+
+                       foreach ($this->currentrecord as $name => $value)
+                       {
+                               if($name=='belop')
+                               {
+                                       $value = str_replace('kr','',$value);
+                                       $value = str_replace(' ','',$value);
+                                       $value = str_replace(',','.',$value);
+                                       
+                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
+                                       {
+                                               $value = -1 * abs($value);
+                                       }
+                                       
+                                       $buffer[$this->id]['godkjentbelop'] = 
$value;
+                               }
+                               if($name=='pmwrkord_code')
+                               {
+                                       
if(!$this->soXport->check_order((int)$value))
+                                       {
+                                               $value='';
+                                       }
+                                       else
+                                       {
+                                               $workorder = 
execMethod('property.soworkorder.read_single', (int)$value);
+                                               
$buffer[$this->id]['project_id'] = 
$this->soXport->get_project((int)$value);//Agresso prosjekt
+                                               $buffer[$this->id]['dime']      
= $workorder['cat_id']; // Dim 6
+                                               $buffer[$this->id]['dimb']      
= $workorder['ecodimb']; // Ansvarssted
+                                       }
+                               }
+
+                               if($name=='spbudact_code')
+                               {
+                                       continue;
+                               //      $value = 
$this->check_spbudact_code($value);
+
+                               }
+
+                               if($name=='dima')
+                               {
+                                       $value = $this->check_dima($value);
+                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
+                               }
+
+                               if($name=='mvakode')
+                               {
+                                       if( $invoice_common['auto_tax'])
+                                       {
+                                               $value = 
(int)$this->soXport->auto_tax($buffer[$this->id]['loc1']);
+                                       }
+                                       else
+                                       {
+                                               $value = (int) $value;
+                                       }
+                               }
+                               
+                               $buffer[$this->id][$name] = $value;
+                       }
+
+                       $buffer[$this->id]['bilagsnr'] = $this->next_bilagsnr;
+                       $buffer[$this->id]['splitt'] = $this->splitt;
+                       $buffer[$this->id]['kildeid'] = $this->kildeid;
+                       $buffer[$this->id]['kidnr'] = $invoice_common['kid_nr'];
+                       $buffer[$this->id]['typeid'] = $invoice_common['type'];
+                       $buffer[$this->id]['periode'] = 
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
+                       $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
+                       $buffer[$this->id]['artid'] = $invoice_common['art'];
+                       $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
+                       $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
+                       $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
+                       $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
+                       
+                       $buffer[$this->id]['dimd'] = $buffer[$this->id]['dime'];
+
+                       $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
+
+                       if($invoice_common['num_days'])
+                       {
+                               $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
+                       }
+                       else
+                       {
+                               $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
+                       }
+
+                       $buffer[$this->id]['fakturadato'] = $invoice_date;
+                       $buffer[$this->id]['forfallsdato'] = $payment_date;
+
+
+                       if($workorder)
+                       {
+                               $buffer[$this->id]['spbudact_code'] = 
$workorder['b_account_id'];
+                       }
+                       else
+                       {
+                               $buffer[$this->id]['spbudact_code'] = '123014'; 
                
+                       }
+
+                       if($invoice_common['auto_tax'])
+                       {
+                               $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
+                               $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
+                       }
+
+                       $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
+
+                       if(!isset($buffer[$this->id]['fakturanr']) || 
!$buffer[$this->id]['fakturanr']) // fakturanr
+                       {
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['invoice_num'];
+                       }
+
+                       if(!isset($buffer[$this->id]['dimb']) || 
!$buffer[$this->id]['dimb']) // Ansvarssted
+                       {
+                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
+                       }
+                       
+
+                       return $buffer;
+               }
+               
+               function check_spbudact_code($id)
+               {
+                       $b_account='';
+                       $this->db->query("select id from fm_b_account where 
id='$id'");
+                       $this->db->next_record();
+                       if ($this->db->f('id'))
+                       { 
+                               $b_account = $this->db->f('id');
+                       }
+                       else
+                       {
+                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
+                               $this->db->next_record();
+                               $b_account = $this->db->f('id');
+                       }
+                       
+                       return $b_account;
+               }
+
+               function check_dima($id)
+               {
+                       $loc1=substr($id,0,4);
+                       $loc2=substr($id,4,2);
+                       
+                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
+                       $this->db->next_record();
+                       if ($this->db->f('loc1'))
+                       { 
+                               $dima = $this->db->f('loc1');
+                               
+                               if ($loc2)
+                               {
+                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
+                                       $this->db->next_record();
+                                       if ($this->db->f('location_code'))
+                                       { 
+                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
+                                       }
+                                       else
+                                       {
+                                               unset($dima);
+                                       }
+                               }
+                       }
+                       
+                       return $dima;
+               }
+
+               function import_end_file($buffer,$bilagsnr)
+               {
+                       $num    = $this->soXport->add($buffer);
+                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
+                       return $receipt;
+               }
+       }

Deleted: 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_xml
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_xml  
    2013-12-22 21:25:35 UTC (rev 11560)
+++ 
branches/Version-1_0-branch/property/inc/import/default/Import_fra_Service_xml  
    2013-12-22 21:41:30 UTC (rev 11561)
@@ -1,311 +0,0 @@
-<?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: Import_fra_Service_xml,v 1.18 2007/02/06 08:02:49 
sigurdne Exp $
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class import_conv
-       {
-               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
-               var $id = -1;
-               var $kildeid=1;
-               var $splitt=0;
-               var $type = 'csv';
-               var $header_count = 17;
-               var $soXport;
-               var $invoice;
-
-               var $import = array(
-                       'Bestilling' => 'pmwrkord_code', 
-                       'Fakt. Nr' => 'fakturanr',
-                       'Konto' => 'spbudact_code',
-                       'Objekt' => 'dima',
-                       'Fag/Timer/Matr' => 'dimd',
-                       'MVA' => 'mvakode',
-                       'Tjeneste'=> 'kostra_id',
-                       'Bel\xF8p [kr]' => 'belop'
-                       );
-
-               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Bel\xF8p [kr]');
-
-               function import_conv()
-               {
-                       $this->db                               = 
clone($GLOBALS['phpgw']->db);
-                       $this->soXport                  = 
CreateObject('property.soXport');     
-                       $this->invoice                  = 
CreateObject('property.boinvoice');
-                       $this->dateformat               = 
$GLOBALS['phpgw']->db->date_format();
-                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
-                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
-                       $this->xmltool                  = 
CreateObject('phpgwapi.xmltool');
-               }
-
-               function import($invoice_common,$download)
-               {
-                       $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
-                       $valid_data= False;
-                       $buffer = array();
-                       $buffer = $this->import_start_file($buffer);
-
-                       $xmldata=file_get_contents($tsvfile);
-                       $this->xmltool->import_xml($xmldata);
-                       $var_result = $this->xmltool->export_var();
-                       if(is_array($var_result['Worksheet']['Table']['Row']))
-                       {
-                               
$data_temp=$var_result['Worksheet']['Table']['Row'];
-                       }
-                       else
-                       {
-                               
$data_temp=$var_result['Worksheet'][0]['Table']['Row'];
-                       }
-                       $rows = count($data_temp);
-//_debug_array($data_temp);
-//  _debug_array($var_result['Worksheet'][0]['Table']['Row']);
-//_debug_array($var_result['Worksheet']['Table']['Row']);
-
-                       if (isset($data_temp) AND is_array($data_temp))
-                       {
-
-                               for ($i = $this->header_count; $i < $rows; ++$i)
-                               {
-                                       $data=$data_temp[$i]['Cell'];
-                       
-                                       $num = count($data);
-                                       $buffer = 
$this->import_start_record($buffer);
-                                       $valid_data=0;
-                                       for ($c=0; $c<$num; $c++ )
-                                       {
-                                               //Send name/value pairs along 
with the buffer
-                                               if 
($this->import[$this->header[$c]] != '' && $data[$c]['Data'] != '')
-                                               {
-
-//echo '<br>'.$c.': '.$this->import[$this->header[$c]].' => 
'.$data[$c]['Data'];
-                                                       $buffer = 
$this->import_new_attrib($buffer, 
$this->import[$this->header[$c]],$data[$c]['Data'],$invoice_common);
-                                                       $valid_data= True;
-                                                       if($data[$c]['Data'])
-                                                       {
-                                                               $valid_data++;
-                                                       }
-                                               }
-                                       }
-                                       if ($valid_data > 0)
-                                       {
-                                               $buffer = 
$this->import_end_record($buffer,$invoice_common);
-                                               $valid_data= False;
-                                       }
-                               }
-                       }
-
-
-                       if(!$download)
-                       {
-                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
-                       }
-
-//print_r($buffer);
-                       $this->header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Bel\xF8p [kr]');
-                       return $buffer;
-               }
-               
-
-               function import_start_file($buffer)
-               {
-                       return $buffer;
-               }
-
-               function import_start_record($buffer)
-               {
-                       $top=array();
-                       ++$this->id;
-                       $this->currentrecord = $top;
-                       return $buffer;
-               }
-
-               function import_new_attrib($buffer,$name,$value,$invoice_common)
-               {
-
-                       $value = trim($value);
-                       $value = str_replace('\n','<BR>',$value);
-                       $value = str_replace('\r','',$value);
-
-                       $this->currentrecord += array($name => $value);
-
-                       return $buffer;
-               }
-
-               function import_end_record($buffer,$invoice_common)
-               {
-                       $buffer[$this->id]='';
-                       while ( list($name, $value) = 
each($this->currentrecord))
-                       {
-                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
-                               if($invoice_common['num_days'])
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
-                               }
-                               else
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
-                               }
-
-                               if($name=='belop')
-                               {
-                                       $value = str_replace('kr','',$value);
-                                       $value = str_replace(' ','',$value);
-                                       $value = str_replace(',','.',$value);
-
-                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
-                                       {
-                                               $value = -1 * abs($value);
-                                       }
-
-                                       $godkjentbelop=$value;
-                               }
-                               if($name=='pmwrkord_code')
-                               {
-                                       
if(!$this->soXport->check_order(intval($value)))
-                                       {
-                                               $value='';
-                                       }
-                                       else
-                                       {
-                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value)); 
-                                       }
-                               }
-                               if($name=='spbudact_code')
-                               {
-                                       $value = 
$this->check_spbudact_code($value);
-                               }
-
-                               if($name=='fakturanr')
-                               {
-                                       if($invoice_common['invoice_num'])
-                                       {
-                                               
$value=$invoice_common['invoice_num'];
-                                       }
-                               }
-
-                               if($name=='dima')
-                               {
-                                       $value = $this->check_dima($value);
-                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
-                               }
-
-                               if($name=='mvakode' && 
$invoice_common['auto_tax'])
-                               {
-                                       $value = 
$this->soXport->auto_tax($buffer[$this->id]['loc1']);
-                               }
-
-                               $buffer[$this->id][$name] = $value;
-                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
-                               $buffer[$this->id]['splitt'] = $this->splitt;
-                               $buffer[$this->id]['kildeid'] = $this->kildeid;
-                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
-                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
-                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
-                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
-                               $buffer[$this->id]['periode'] = 
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
-                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
-                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
-                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
-                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
-                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
-                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
-                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
-                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
-
-                               if($invoice_common['auto_tax'])
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
-                               }
-                               $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
-                       }
-                       return $buffer;
-               }
-
-               function check_spbudact_code($id)
-               {
-                       $b_account='';
-                       $this->db->query("select id from fm_b_account where 
id='$id'");
-                       $this->db->next_record();
-                       if ($this->db->f('id'))
-                       { 
-                               $b_account = $this->db->f('id');
-                       }
-                       else
-                       {
-                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
-                               $this->db->next_record();
-                               $b_account = $this->db->f('id');
-                       }
-                       
-                       return $b_account;
-               }
-
-               function check_dima($id)
-               {
-                       $loc1=substr($id,0,4);
-                       $loc2=substr($id,4,2);
-                       
-                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
-                       $this->db->next_record();
-                       if ($this->db->f('loc1'))
-                       { 
-                               $dima = $this->db->f('loc1');
-                               
-                               if ($loc2)
-                               {
-                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
-                                       $this->db->next_record();
-                                       if ($this->db->f('location_code'))
-                                       { 
-                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
-                                       }
-                                       else
-                                       {
-                                               unset($dima);
-                                       }
-                               }
-                       }
-                       
-                       return $dima;
-               }
-
-               function import_end_file($buffer,$bilagsnr)
-               {
-                       $num    = $this->soXport->add($buffer);
-                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
-                       return $receipt;
-               }
-       }
-?>

Deleted: 
branches/Version-1_0-branch/property/inc/import/default/import_fra_Service_xls
===================================================================
--- 
branches/Version-1_0-branch/property/inc/import/default/import_fra_Service_xls  
    2013-12-22 21:25:35 UTC (rev 11560)
+++ 
branches/Version-1_0-branch/property/inc/import/default/import_fra_Service_xls  
    2013-12-22 21:41:30 UTC (rev 11561)
@@ -1,280 +0,0 @@
-<?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: import_fra_Service_xls 18358 2007-11-27 04:43:37Z 
skwashd $
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class import_conv
-       {
-               var $currentrecord = array(); //used for buffering to allow uid 
lines to go first
-               var $id = -1;
-               var $kildeid=1;
-               var $splitt=0;
-               var $type = 'csv';
-               var $header_count = 18;
-               var $soXport;
-               var $invoice;
-
-               var $import = array(
-                       'Bestilling' => 'pmwrkord_code', 
-                       'Fakt. Nr' => 'fakturanr',
-                       'Konto' => 'spbudact_code',
-                       'Objekt' => 'dima',
-                       'Fag/Timer/Matr' => 'dimd',
-                       'MVA' => 'mvakode',
-                       'Tjeneste'=> 'kostra_id',
-                       'Belop [kr]' => 'belop'
-                       );
-
-               var $header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Belop [kr]');
-
-               function import_conv()
-               {
-                       $this->db                               = 
clone($GLOBALS['phpgw']->db);
-                       $this->soXport                  = 
CreateObject('property.soXport');     
-                       $this->invoice                  = 
CreateObject('property.boinvoice');
-                       $this->bocommon                 = 
CreateObject('property.bocommon');
-                       $this->dateformat               = 
$GLOBALS['phpgw']->db->date_format();
-                       $this->datetimeformat   = 
$GLOBALS['phpgw']->db->datetime_format();
-                       $this->next_bilagsnr    = 
$this->invoice->next_bilagsnr();
-               }
-
-               function import($invoice_common,$download)
-               {
-                       $tsvfile        = $invoice_common['tsvfile'];
-                       $conv_type      = $invoice_common['conv_type'];
-                       $valid_data= False;
-                       $buffer = array();
-                       $data = CreateObject('phpgwapi.excelreader');
-                       
-                       $data->setOutputEncoding('CP1251');
-                       $data->read($tsvfile);
-
-                       $this->id = 0;
-                       $num = count($this->header)+1;
-                       $rows = $data->sheets[0]['numRows']+1;
-                       for ($i=18; $i<$rows; $i++ ) //First data entry on row 
18
-                       {
-                               $this->currentrecord = array();
-                               
-                               $valid_data=0;
-                               for ($c=1; $c<$num; $c++ )
-                               {
-                                       //Send name/value pairs along with the 
buffer
-                                       if ($data->sheets[0]['cells'][$i][$c] 
!= '')
-                                       {
-                                               
$this->import_new_attrib($this->import[$this->header[$c-1]],$data->sheets[0]['cells'][$i][$c],$invoice_common);
-                                               
if($data->sheets[0]['cells'][$i][$c])
-                                               {
-                                                       $valid_data++;
-                                               }
-                                       }
-                               }
-                               if ($valid_data > 0)
-                               {
-                                       $buffer = 
$this->import_end_record($buffer,$invoice_common);
-                                       $valid_data= False;
-                                       $this->id++;
-                               }
-                       }
-
-                       if(!$download)
-                       {
-                               $buffer = 
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
-                       }
-
-                       $this->header = array('Bestilling','Fakt. 
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Belop [kr]');
-                       return $buffer;
-               }
-
-               function import_new_attrib($name,$value,$invoice_common)
-               {
-                       $value = $this->bocommon->ascii2utf(trim($value));
-                       $value = str_replace('\n','<BR>',$value);
-                       $value = str_replace('\r','',$value);
-
-                       $this->currentrecord += array($name => $value);
-               }
-
-               function import_end_record($buffer,$invoice_common)
-               {
-                       $buffer[$this->id]=array();
-                       while ( list($name, $value) = 
each($this->currentrecord))
-                       {
-                               $invoice_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
-                               if($invoice_common['num_days'])
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
-                               }
-                               else
-                               {
-                                       $payment_date = 
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
                       
-                               }
-
-                               if($name=='belop')
-                               {
-                                       $value = str_replace('kr','',$value);
-                                       $value = str_replace(' ','',$value);
-                                       $value = str_replace(',','.',$value);
-
-                                       if( $invoice_common['art'] == 2 ) // 
kreditnota
-                                       {
-                                               $value = -1 * abs($value);
-                                       }
-
-                                       $godkjentbelop=$value;
-                               }
-                               if($name=='pmwrkord_code')
-                               {
-                                       
if(!$this->soXport->check_order(intval($value)))
-                                       {
-                                               $value='';
-                                       }
-                                       else
-                                       {
-                                               
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value)); 
-                                       }
-                               }
-                               if($name=='spbudact_code')
-                               {
-                                       $value = 
$this->check_spbudact_code($value);
-                               }
-
-                               if($name=='fakturanr')
-                               {
-                                       if($invoice_common['invoice_num'])
-                                       {
-                                               
$value=$invoice_common['invoice_num'];
-                                       }
-                               }
-
-                               if($name=='dima')
-                               {
-                                       $value = $this->check_dima($value);
-                                       $buffer[$this->id]['loc1'] = 
$loc1=substr($value,0,4);
-                               }
-
-                               if($name=='mvakode')
-                               {
-                                       if( $invoice_common['auto_tax'])
-                                       {
-                                               $value = 
(int)$this->soXport->auto_tax($buffer[$this->id]['loc1']);
-                                       }
-                                       else
-                                       {
-                                               $value = (int) $value;
-                                       }
-                               }
-
-                               $buffer[$this->id][$name] = $value;
-                               $buffer[$this->id]['bilagsnr'] = 
$this->next_bilagsnr;
-                               $buffer[$this->id]['splitt'] = $this->splitt;
-                               $buffer[$this->id]['kildeid'] = $this->kildeid;
-                               $buffer[$this->id]['kidnr'] = 
$invoice_common['kid_nr'];
-                               $buffer[$this->id]['typeid'] = 
$invoice_common['type'];
-                               $buffer[$this->id]['fakturadato'] = 
$invoice_date;
-                               $buffer[$this->id]['forfallsdato'] = 
$payment_date;
-                               $buffer[$this->id]['periode'] = 
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
-                               $buffer[$this->id]['regtid'] = 
date($this->datetimeformat);
-                               $buffer[$this->id]['artid'] = 
$invoice_common['art'];
-                               $buffer[$this->id]['godkjentbelop'] = 
$godkjentbelop;
-                               $buffer[$this->id]['spvend_code'] = 
$invoice_common['vendor_id'];
-                               $buffer[$this->id]['dimb'] = 
$invoice_common['dim_b'];
-                               $buffer[$this->id]['oppsynsmannid'] = 
$invoice_common['janitor'];
-                               $buffer[$this->id]['saksbehandlerid'] = 
$invoice_common['supervisor'];
-                               $buffer[$this->id]['budsjettansvarligid'] = 
$invoice_common['budget_responsible'];
-
-                               if($invoice_common['auto_tax'])
-                               {
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spbudact_code']);
-                                       $buffer[$this->id]['mvakode'] = 
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode'] 
,$buffer[$this->id]['spvend_code']);
-                               }
-                               $buffer[$this->id]['kostra_id'] = 
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
-                       }
-                       return $buffer;
-               }
-               
-               function check_spbudact_code($id)
-               {
-                       $b_account='';
-                       $this->db->query("select id from fm_b_account where 
id='$id'");
-                       $this->db->next_record();
-                       if ($this->db->f('id'))
-                       { 
-                               $b_account = $this->db->f('id');
-                       }
-                       else
-                       {
-                               $this->db->query("select id from 
fm_b_account_convert where old_id='$id'");
-                               $this->db->next_record();
-                               $b_account = $this->db->f('id');
-                       }
-                       
-                       return $b_account;
-               }
-
-               function check_dima($id)
-               {
-                       $loc1=substr($id,0,4);
-                       $loc2=substr($id,4,2);
-                       
-                       $this->db->query("select loc1 from fm_location1 where 
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS 
NULL))");
-                       $this->db->next_record();
-                       if ($this->db->f('loc1'))
-                       { 
-                               $dima = $this->db->f('loc1');
-                               
-                               if ($loc2)
-                               {
-                                       $this->db->query("select location_code 
from fm_location2 where loc1='$loc1' AND loc2='$loc2'  AND 
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
-                                       $this->db->next_record();
-                                       if ($this->db->f('location_code'))
-                                       { 
-                                               $dima = 
str_replace('-','',$this->db->f('location_code'));
-                                       }
-                                       else
-                                       {
-                                               unset($dima);
-                                       }
-                               }
-                       }
-                       return $dima;
-               }
-
-               function import_end_file($buffer,$bilagsnr)
-               {
-                       $num    = $this->soXport->add($buffer);
-                       $receipt['message'][]= array('msg' => 
lang('Successfully imported %1 records into your invoice register.',$num).' 
'.lang('ID').': '. $bilagsnr);
-                       return $receipt;
-               }
-       }
-?>

Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang    2013-12-22 
21:25:35 UTC (rev 11560)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang    2013-12-22 
21:41:30 UTC (rev 11561)
@@ -1376,7 +1376,7 @@
 rental agreement categories    property        no      Leieavtale kategorier
 rental agreement item attributes       property        no      Attributter for 
utleie - detaljer
 rental type    property        no      Utleietype
-re-opened      property        no      gjenåpnet
+re-opened      property        no      Gjenåpnet
 repeat property        no      serie
 repeat type    property        no      type serie
 repeat day     property        no      gjenta dag




reply via email to

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