[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11729] Merge 11719:11728 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11729] Merge 11719:11728 from trunk |
Date: |
Fri, 21 Feb 2014 10:21:39 +0000 |
Revision: 11729
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11729
Author: sigurdne
Date: 2014-02-21 10:21:38 +0000 (Fri, 21 Feb 2014)
Log Message:
-----------
Merge 11719:11728 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/header.inc.php.template
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
branches/Version-1_0-branch/phpgwapi/inc/sso/include_login.inc.php
branches/Version-1_0-branch/phpgwapi/templates/base/login.tpl
branches/Version-1_0-branch/property/inc/class.boXport.inc.php
branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
branches/Version-1_0-branch/setup/manageheader.php
branches/Version-1_0-branch/setup/templates/base/manageheader.tpl
Removed Paths:
-------------
branches/Version-1_0-branch/property/inc/export/default/Agresso
branches/Version-1_0-branch/property/inc/export/default/Ecolink
branches/Version-1_0-branch/property/inc/export/default/GABNr
branches/Version-1_0-branch/property/inc/export/default/Kemner_kvittering
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,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728
Modified: branches/Version-1_0-branch/header.inc.php.template
===================================================================
--- branches/Version-1_0-branch/header.inc.php.template 2014-02-21 10:19:58 UTC
(rev 11728)
+++ branches/Version-1_0-branch/header.inc.php.template 2014-02-21 10:21:38 UTC
(rev 11729)
@@ -119,21 +119,36 @@
* An optional text to be displayed to the left on the login form.
* FORMATTING HAS TO BE EDITED MANUALLY (links and linebreak)
*/
- $GLOBALS['phpgw_info']['login_left_message'] = <<<HTML
+ $login_left_message = <<<HTML
{LOGIN_LEFT_MESSAGE}
HTML;
+ $GLOBALS['phpgw_info']['login_left_message'] =
nl2br(str_replace(array('[',']'), array('<','>'), $login_left_message));
+
/**
* @global string $phpgw_info['login_right_message']
* An optional text to be displayed to the right on the login form.
* FORMATTING HAS TO BE EDITED MANUALLY (links and linebreak)
*/
- $GLOBALS['phpgw_info']['login_right_message'] = <<<HTML
+ $login_right_message = <<<HTML
{LOGIN_RIGHT_MESSAGE}
HTML;
+ $GLOBALS['phpgw_info']['login_right_message'] =
nl2br(str_replace(array('[',']'), array('<','>'), $login_right_message));
/**
+ * @global string $phpgw_info['new_user_url']
+ * An otpional url to new user registration
+ */
+ $GLOBALS['phpgw_info']['server']['new_user_url'] = '{NEW_USER_URL}';
+
+ /**
+ * @global string $phpgw_info['lost_password_url']
+ * An otpional url to remedy lost passwords
+ */
+ $GLOBALS['phpgw_info']['server']['lost_password_url'] =
'{LOST_PASSWORD_URL}';
+
+ /**
* @global boolean $phpgw_info['server']['mcrypt_enabled']
* This is used to control mcrypt's use
*/
Modified:
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
===================================================================
---
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++
branches/Version-1_0-branch/phpgwapi/inc/class.vfs_fileoperation_braArkiv.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -42,7 +42,6 @@
$location_url =
$c->config_data[$section]['location_url'];//'http://braarkiv.adm.bgo/service/services.asmx';
$braarkiv_user =
$c->config_data[$section]['braarkiv_user'];
$braarkiv_pass =
$c->config_data[$section]['braarkiv_pass'];
-//$location_url = 'http://braarkiv.adm.bgo/service/services.asmx';
if(!isset($c->config_data) || !$c->config_data)
{
@@ -266,32 +265,64 @@
public function touch($p)
{
$document = new Document();
- $document->BaseClassName = "Library";
- $document->ClassName = "Ebook";
+ $document->BBRegTime = date('Y-m-d');
+ $document->BaseClassName = "Eiendomsarkiver";
+ $document->ClassName = "Byggesak";
$attributter = array();
+
$att1 = new Attribute();
- $att1->AttribType = 'braArkivString';
- $att1->Name = "Tittel";
- $att1->Value = array("Testtittel");
+ $att1->AttribType = 'braArkivDate';
+ $att1->Name = "Saksdato";
+ $att1->Value = array(date('Y-m-d'));
$attributter[] = $att1;
$att2 = new Attribute();
-
- // $braArkivAttributeType = new braArkivAttributeType();
- // $att2->AttribType =
$braArkivAttributeType->braArkivDate;
- $att2->AttribType = 'braArkivDate';
- $att2->Name = "CreatedDate";
- $att2->Value = array(date('Y-m-d'));
+ $att2->AttribType = 'braArkivString';
+ $att2->Name = "Tiltakstype";
+ $att2->Value = array("Testtittel");
$attributter[] = $att2;
+ $att3 = new Attribute();
+ $att3->AttribType = 'braArkivString';
+ $att3->Name = "Tiltaksart";
+ $att3->Value = array("Testtittel");
+ $attributter[] = $att3;
+
+ $att4 = new Attribute();
+ $att4->AttribType = 'braArkivString';
+ $att4->Name = "ASTA_Signatur";
+ $att4->Value = array("Testtittel");
+ $attributter[] = $att4;
+
+ $att5 = new Attribute();
+ $att5->AttribType = 'braArkivDate';
+ $att5->Name = "Dokumentdato";
+ $att5->Value = array(date('Y-m-d'));
+ $attributter[] = $att5;
+
+ $att5 = new Attribute();
+ $att5->AttribType = 'braArkivString';
+ $att5->Name = "BrukerID";
+ $att5->Value = array("1");
+ $attributter[] = $att5;
+
+ $att6 = new Attribute();
+ $att6->AttribType = 'braArkivString';
+ $att6->Name = "Team";
+ $att6->Value = array("Testtittel");
+ $attributter[] = $att6;
+
+
$document->Attributes = $attributter;
$createDocument = new createDocument();
$createDocument->secKey = $this->secKey;
- $createDocument->assignDocKey = false;
+ $createDocument->assignDocKey = 0;
$createDocument->doc = $document;
+ // _debug_array($createDocument);die();
+
$createDocumentResponse =
$this->Services->createDocument($createDocument);
$document_id =
$createDocumentResponse->createDocumentResult;
return $document_id;
@@ -986,7 +1017,7 @@
* @access public
* @var sboolean
*/
- public $UsesLookupValues;
+ public $UsesLookupValues = false;
/**
* @access public
@@ -1303,31 +1334,31 @@
* @access public
* @var sstring
*/
- public $ID;
+ public $ID = '';
/**
* @access public
* @var sstring
*/
- public $BFDocKey;
+ public $BFDocKey = '';
/**
* @access public
* @var sstring
*/
- public $BFNoSheets;
+ public $BFNoSheets = '';
/**
* @access public
* @var sboolean
*/
- public $BFDoubleSided;
+ public $BFDoubleSided = false;
/**
* @access public
* @var sboolean
*/
- public $BFSeparateKeySheet;
+ public $BFSeparateKeySheet = false;
/**
* @access public
@@ -1345,13 +1376,13 @@
* @access public
* @var sboolean
*/
- public $Classified;
+ public $Classified = false;
/**
* @access public
* @var sint
*/
- public $Priority;
+ public $Priority = 0;
/**
* @access public
Modified: branches/Version-1_0-branch/phpgwapi/inc/sso/include_login.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/sso/include_login.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/phpgwapi/inc/sso/include_login.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -478,15 +478,35 @@
$this->tmpl->set_var('lang_new_user', lang('new user'));
$this->tmpl->set_var('lang_forgotten_password',
lang('forgotten password'));
- $url_new_user =
"{$webserver_url}/registration/main.php";
+
if(isset($GLOBALS['phpgw_info']['server']['new_user_url']) &&
$GLOBALS['phpgw_info']['server']['new_user_url'])
+ {
+ $url_new_user =
$GLOBALS['phpgw_info']['server']['new_user_url'];
+ $action_new_user = $url_new_user;
+ }
+ else
+ {
+ $url_new_user =
"{$webserver_url}/registration/main.php";
+ $action_new_user = 'javascript:new_user();';
+ }
$this->tmpl->set_var('url_new_user', $url_new_user);
- $url_lost_password =
"{$webserver_url}/registration/main.php?" . http_build_query(array(
+
if(isset($GLOBALS['phpgw_info']['server']['lost_password_url']) &&
$GLOBALS['phpgw_info']['server']['lost_password_url'])
+ {
+ $url_lost_password =
$GLOBALS['phpgw_info']['server']['lost_password_url'];
+ $action_lost_password = $url_lost_password;
+ }
+ else
+ {
+ $url_lost_password =
"{$webserver_url}/registration/main.php?" . http_build_query(array(
'menuaction'
=>'registration.uireg.lostpw1')
);
+ $action_lost_password =
'javascript:lost_password();';
+ }
$this->tmpl->set_var('url_lost_password',
$url_lost_password);
+ $this->tmpl->set_var('action_new_user',
$action_new_user);
+ $this->tmpl->set_var('action_lost_password',
$action_lost_password);
$this->tmpl->set_var('website_title',
isset($GLOBALS['phpgw_info']['server']['site_title'])
?
$GLOBALS['phpgw_info']['server']['site_title']
Modified: branches/Version-1_0-branch/phpgwapi/templates/base/login.tpl
===================================================================
--- branches/Version-1_0-branch/phpgwapi/templates/base/login.tpl
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/phpgwapi/templates/base/login.tpl
2014-02-21 10:21:38 UTC (rev 11729)
@@ -202,10 +202,10 @@
<p>{instruction}</p>
<p >
- <a
href="javascript:new_user();">{lang_new_user}</a>
+ <a
href="{action_new_user}">{lang_new_user}</a>
</p>
</p>
- <a
href="javascript:lost_password();">{lang_forgotten_password}</a>.
+ <a
href="{action_lost_password}">{lang_forgotten_password}</a>.
</p>
<div id="lock"></div>
Modified: branches/Version-1_0-branch/property/inc/class.boXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boXport.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/class.boXport.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -1,5 +1,4 @@
<?php
-
/**
* phpGroupWare - property: a Facilities Management System.
*
@@ -36,10 +35,10 @@
{
var $public_functions = array
- (
- 'import' => true,
- 'export' => true,
- 'export_cron' => true
+ (
+ 'import' => true,
+ 'export' => true,
+ 'export_cron' => true
);
var $start;
var $query;
@@ -47,58 +46,58 @@
var $order;
var $filter;
var $cat_id;
- var $use_session = false;
+ var $use_session = false;
- function property_boXport( $session = false )
+ function property_boXport($session = false)
{
$GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
- $this->config = CreateObject( 'phpgwapi.config',
'property' );
+ $this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
- if ( $session )
+ if($session)
{
$this->read_sessiondata();
$this->use_session = true;
}
- $start = phpgw::get_var( 'start', 'int', 'REQUEST', 0
);
- $query = phpgw::get_var( 'query' );
- $sort = phpgw::get_var( 'sort' );
- $order = phpgw::get_var( 'order' );
- $filter = phpgw::get_var( 'filter', 'int' );
- $cat_id = phpgw::get_var( 'cat_id', 'int' );
+ $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+ $query = phpgw::get_var('query');
+ $sort = phpgw::get_var('sort');
+ $order = phpgw::get_var('order');
+ $filter = phpgw::get_var('filter', 'int');
+ $cat_id = phpgw::get_var('cat_id', 'int');
- if ( $start || $start == 0 )
+ if($start || $start == 0)
{
$this->start = $start;
}
- if ( $query )
+ if($query)
{
$this->query = $query;
}
- if ( $sort )
+ if($sort)
{
$this->sort = $sort;
}
- if ( $order )
+ if($order)
{
$this->order = $order;
}
- if ( $filter )
+ if($filter)
{
- $this->filter = $filter;
+ $this->filter = $filter;
}
- $this->cat_id = $cat_id;
+ $this->cat_id = $cat_id;
}
function save_sessiondata()
{
- if ( $this->use_session )
+ if($this->use_session)
{
$data = array
- (
+ (
'start' => $this->start,
'query' => $this->query,
'sort' => $this->sort,
@@ -106,18 +105,18 @@
'filter' => $this->filter,
'cat_id' => $this->cat_id
);
- if ( $this->debug )
+ if($this->debug)
{
echo '<br>Save:';
- _debug_array( $data );
+ _debug_array($data);
}
- $GLOBALS['phpgw']->session->appsession(
'session_data', 'export', $data );
+
$GLOBALS['phpgw']->session->appsession('session_data', 'export', $data);
}
}
function read_sessiondata()
{
- $data = $GLOBALS['phpgw']->session->appsession(
'session_data', 'export' );
+ $data =
$GLOBALS['phpgw']->session->appsession('session_data', 'export');
$this->start = $data['start'];
$this->query = $data['query'];
@@ -127,27 +126,27 @@
$this->cat_id = $data['cat_id'];
}
- function select_import_conv( $selected = '' )
+ function select_import_conv($selected = '')
{
- $dir_handle = @opendir( PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}" );
+ $dir_handle = @opendir(PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}");
$i = 0;
$myfilearray = array();
- while ( $file = readdir( $dir_handle ) )
+ while($file = readdir($dir_handle))
{
- if ( (substr( $file, 0, 1 ) != '.') && is_file(
PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
+ if((substr($file, 0, 1) != '.') &&
is_file(PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}"))
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir( $dir_handle );
- sort( $myfilearray );
+ closedir($dir_handle);
+ sort($myfilearray);
- for ( $i = 0; $i < count( $myfilearray ); $i++ )
+ for($i = 0; $i < count($myfilearray); $i++)
{
- $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $fname = preg_replace('/_/', ' ',
$myfilearray[$i]);
$sel_file = '';
- if ( $myfilearray[$i] == $selected )
+ if($myfilearray[$i] == $selected)
{
$sel_file = 'selected';
}
@@ -160,38 +159,38 @@
);
}
- for ( $i = 0; $i < count( $conv_list ); $i++ )
+ for($i = 0; $i < count($conv_list); $i++)
{
- if ( $conv_list[$i]['selected'] != 'selected' )
+ if($conv_list[$i]['selected'] != 'selected')
{
- unset( $conv_list[$i]['selected'] );
+ unset($conv_list[$i]['selected']);
}
}
return $conv_list;
}
- function select_export_conv( $selected = '' )
+ function select_export_conv($selected = '')
{
- $dir_handle = @opendir( PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}" );
+ $dir_handle = @opendir(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}");
$i = 0;
$myfilearray = array();
- while ( $file = readdir( $dir_handle ) )
+ while($file = readdir($dir_handle))
{
- if ( (substr( $file, 0, 1 ) != '.') && is_file(
PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}" ) )
+ if((substr($file, 0, 1) != '.') &&
is_file(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$file}"))
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir( $dir_handle );
- sort( $myfilearray );
+ closedir($dir_handle);
+ sort($myfilearray);
- for ( $i = 0; $i < count( $myfilearray ); $i++ )
+ for($i = 0; $i < count($myfilearray); $i++)
{
- $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $fname = preg_replace('/_/', ' ',
$myfilearray[$i]);
$sel_file = '';
- if ( $myfilearray[$i] == $selected )
+ if($myfilearray[$i] == $selected)
{
$sel_file = 'selected';
}
@@ -204,41 +203,40 @@
);
}
- for ( $i = 0; $i < count( $conv_list ); $i++ )
+ for($i = 0; $i < count($conv_list); $i++)
{
- if ( $conv_list[$i]['selected'] != 'selected' )
+ if($conv_list[$i]['selected'] != 'selected')
{
- unset( $conv_list[$i]['selected'] );
+ unset($conv_list[$i]['selected']);
}
}
return $conv_list;
}
- function select_rollback_file( $selected = '' )
+ function select_rollback_file($selected = '')
{
- $this->config->read();
- $file_catalog =
$this->config->config_data['export_path'];
+ $file_catalog =
$this->config->config_data['export']['path'];
- $dir_handle = @opendir( $file_catalog );
+ $dir_handle = @opendir($file_catalog);
$i = 0;
$myfilearray = '';
- while ( $file = readdir( $dir_handle ) )
+ while($file = readdir($dir_handle))
{
- if ( (substr( $file, 0, 1 ) != '.') && is_file(
"{$file_catalog}/{$file}" ) )
+ if((substr($file, 0, 1) != '.') &&
is_file("{$file_catalog}/{$file}"))
{
$myfilearray[$i] = $file;
$i++;
}
}
- closedir( $dir_handle );
- @sort( $myfilearray );
+ closedir($dir_handle);
+ @sort($myfilearray);
- for ( $i = 0; $i < count( $myfilearray ); $i++ )
+ for($i = 0; $i < count($myfilearray); $i++)
{
- $fname = preg_replace( '/_/', ' ',
$myfilearray[$i] );
+ $fname = preg_replace('/_/', ' ',
$myfilearray[$i]);
$sel_file = '';
- if ( $myfilearray[$i] == $selected )
+ if($myfilearray[$i] == $selected)
{
$sel_file = 'selected';
}
@@ -251,24 +249,24 @@
);
}
- for ( $i = 0; $i < count( $rollback_list ); $i++ )
+ for($i = 0; $i < count($rollback_list); $i++)
{
- if ( $rollback_list[$i]['selected'] !=
'selected' )
+ if($rollback_list[$i]['selected'] != 'selected')
{
- unset( $rollback_list[$i]['selected'] );
+ unset($rollback_list[$i]['selected']);
}
}
return $rollback_list;
}
- function import( $invoice_common, $download )
+ function import($invoice_common, $download)
{
include (PHPGW_SERVER_ROOT .
"/property/inc/import/{$GLOBALS['phpgw_info']['user']['domain']}/{$invoice_common['conv_type']}");
$invoice = new import_conv;
- $buffer = $invoice->import( $invoice_common, $download
);
- if ( $download )
+ $buffer = $invoice->import($invoice_common, $download);
+ if($download)
{
$header = $invoice->header;
$import = $invoice->import;
@@ -281,7 +279,7 @@
return $buffer;
}
- function export( $data )
+ function export($data)
{
$conv_type = $data['conv_type'];
$download = $data['download'];
@@ -291,32 +289,31 @@
include(PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
$invoice = new export_conv;
- $buffer = $invoice->overfor( $download, $pre_transfer,
$force_period_year );
+ $buffer = $invoice->overfor($download, $pre_transfer,
$force_period_year);
return $buffer;
}
- function rollback( $conv_type, $role_back_date, $rollback_file,
- $rollback_voucher )
+ function rollback($conv_type, $role_back_date, $rollback_file,
$rollback_voucher)
{
include (PHPGW_SERVER_ROOT .
"/property/inc/export/{$GLOBALS['phpgw_info']['user']['domain']}/{$conv_type}");
$invoice = new export_conv;
- $buffer = $invoice->RullTilbake( $role_back_date,
$rollback_file,
-
$rollback_voucher );
+ $buffer = $invoice->RullTilbake($role_back_date,
$rollback_file, $rollback_voucher);
return $buffer;
}
- function export_cron( $data = array())
+ function export_cron($data = array())
{
if(!$data)
{
- $data =
unserialize(urldecode(phpgw::get_var('data')));
- $data = phpgw::clean_value($data);
+ $data =
unserialize(urldecode(phpgw::get_var('data')));
+ $data = phpgw::clean_value($data);
}
_debug_array($data);
- $receipt = $this->export( $data );
+ $receipt = $this->export($data);
{
- _debug_array( $receipt );
+ _debug_array($receipt);
}
}
- }
+
+ }
\ No newline at end of file
Modified: branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/class.botenant_claim.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -320,5 +320,25 @@
return $record_history;
}
+ public function get_files($id = 0)
+ {
+ $vfs = CreateObject('phpgwapi.vfs');
+ $vfs->override_acl = 1;
+ $files = $vfs->ls(array(
+ 'string' => "/property/tenant_claim/{$id}",
+ 'relatives' => array(RELATIVE_NONE)
+ ));
+
+ $vfs->override_acl = 0;
+
+ foreach($files as & $file)
+ {
+ $file['file_name']=urlencode($file['name']);
+
+ }
+
+ return $files;
+ }
+
}
Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -49,7 +49,9 @@
$this->like = &
$this->db->like;
$this->config =
CreateObject('phpgwapi.config', 'property');
$this->config->read();
- $this->invoice_approval =
isset($this->config->config_data['invoice_approval']) &&
$this->config->config_data['invoice_approval'] ?
$this->config->config_data['invoice_approval'] : 2;
+ $custom_config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
+
+ $this->invoice_approval =
isset($custom_config->config_data['common']['invoice_approval']) &&
$custom_config->config_data['common']['invoice_approval'] ?
$custom_config->config_data['common']['invoice_approval'] : 2;
}
function read_invoice($data)
Modified: branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/class.uiXport.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -1,48 +1,46 @@
<?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 admin
- * @version $Id$
- */
-
+ * 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 admin
+ * @version $Id$
+ */
phpgw::import_class('phpgwapi.datetime');
/**
* Description
* @package property
*/
-
class property_uiXport
{
+
var $public_functions = array
(
- 'import' => true,
- 'export' => true,
- 'rollback' => true
- );
-
+ 'import' => true,
+ 'export' => true,
+ 'rollback' => true
+ );
var $start;
var $query;
var $sort;
@@ -53,65 +51,65 @@
function property_uiXport()
{
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::invoice';
- $this->bo =
CreateObject('property.boXport',true);
- $this->invoice =
CreateObject('property.boinvoice');
- $this->bocommon =
CreateObject('property.bocommon');
- $this->contacts = CreateObject('property.sogeneric');
- $this->contacts->get_location_info('vendor',false);
+ $GLOBALS['phpgw_info']['flags']['xslt_app']
= true;
+ $GLOBALS['phpgw_info']['flags']['menu_selection']
= 'property::invoice';
+ $this->bo
= CreateObject('property.boXport',
true);
+ $this->invoice
= CreateObject('property.boinvoice');
+ $this->bocommon
= CreateObject('property.bocommon');
+ $this->contacts
= CreateObject('property.sogeneric');
+ $this->contacts->get_location_info('vendor', false);
- $this->acl = &
$GLOBALS['phpgw']->acl;
- $this->acl_location = '.invoice';
- $this->acl_read =
$this->acl->check('.invoice', PHPGW_ACL_READ, 'property');
- $this->acl_add =
$this->acl->check('.invoice', PHPGW_ACL_ADD, 'property');
- $this->acl_edit =
$this->acl->check('.invoice', PHPGW_ACL_EDIT, 'property');
- $this->acl_delete =
$this->acl->check('.invoice', PHPGW_ACL_DELETE, 'property');
- $this->acl_manage =
$this->acl->check('.invoice', 16, 'property');
+ $this->acl = &
$GLOBALS['phpgw']->acl;
+ $this->acl_location = '.invoice';
+ $this->acl_read =
$this->acl->check('.invoice', PHPGW_ACL_READ, 'property');
+ $this->acl_add =
$this->acl->check('.invoice', PHPGW_ACL_ADD, 'property');
+ $this->acl_edit =
$this->acl->check('.invoice', PHPGW_ACL_EDIT, 'property');
+ $this->acl_delete =
$this->acl->check('.invoice', PHPGW_ACL_DELETE, 'property');
+ $this->acl_manage =
$this->acl->check('.invoice', 16, 'property');
- $this->start = $this->bo->start;
- $this->query = $this->bo->query;
- $this->sort = $this->bo->sort;
- $this->order = $this->bo->order;
- $this->filter = $this->bo->filter;
- $this->cat_id = $this->bo->cat_id;
+ $this->start = $this->bo->start;
+ $this->query = $this->bo->query;
+ $this->sort = $this->bo->sort;
+ $this->order = $this->bo->order;
+ $this->filter = $this->bo->filter;
+ $this->cat_id = $this->bo->cat_id;
}
function import()
{
if(!$this->acl_add)
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>2, 'acl_location'=> $this->acl_location));
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop', 'perm' => 2, 'acl_location'
=> $this->acl_location));
}
$GLOBALS['phpgw_info']['flags']['menu_selection'] .=
'::import';
- $receipt =
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt');
-
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt','');
+ $receipt =
$GLOBALS['phpgw']->session->appsession('session_data', 'import_receipt');
+ $GLOBALS['phpgw']->session->appsession('session_data',
'import_receipt', '');
- $art = phpgw::get_var('art',
'int');
- $type =
phpgw::get_var('type');
- $dim_b =
phpgw::get_var('dim_b', 'int');
- $invoice_num = phpgw::get_var('invoice_num');
- $kid_nr =
phpgw::get_var('kid_nr');
- $vendor_id =
phpgw::get_var('vendor_id', 'int');
- $vendor_name = phpgw::get_var('vendor_name');
- $janitor =
phpgw::get_var('janitor');
- $supervisor =
phpgw::get_var('supervisor');
- $budget_responsible =
phpgw::get_var('budget_responsible');
- $invoice_date =
urldecode(phpgw::get_var('invoice_date'));
- $num_days =
phpgw::get_var('num_days', 'int');
- $payment_date =
urldecode(phpgw::get_var('payment_date'));
- $cancel =
phpgw::get_var('cancel', 'bool');
- $convert =
phpgw::get_var('convert', 'bool');
- $conv_type =
phpgw::get_var('conv_type');
- $sday =
phpgw::get_var('sday', 'int');
- $smonth =
phpgw::get_var('smonth', 'int');
- $syear =
phpgw::get_var('syear', 'int');
- $eday =
phpgw::get_var('eday', 'int');
- $emonth =
phpgw::get_var('emonth', 'int');
- $eyear =
phpgw::get_var('eyear', 'int');
- $download =
phpgw::get_var('download', 'bool');
- $auto_tax =
phpgw::get_var('auto_tax', 'bool');
+ $art =
phpgw::get_var('art', 'int');
+ $type =
phpgw::get_var('type');
+ $dim_b =
phpgw::get_var('dim_b', 'int');
+ $invoice_num =
phpgw::get_var('invoice_num');
+ $kid_nr =
phpgw::get_var('kid_nr');
+ $vendor_id =
phpgw::get_var('vendor_id', 'int');
+ $vendor_name =
phpgw::get_var('vendor_name');
+ $janitor =
phpgw::get_var('janitor');
+ $supervisor =
phpgw::get_var('supervisor');
+ $budget_responsible =
phpgw::get_var('budget_responsible');
+ $invoice_date =
urldecode(phpgw::get_var('invoice_date'));
+ $num_days =
phpgw::get_var('num_days', 'int');
+ $payment_date =
urldecode(phpgw::get_var('payment_date'));
+ $cancel =
phpgw::get_var('cancel', 'bool');
+ $convert =
phpgw::get_var('convert', 'bool');
+ $conv_type =
phpgw::get_var('conv_type');
+ $sday =
phpgw::get_var('sday', 'int');
+ $smonth =
phpgw::get_var('smonth', 'int');
+ $syear =
phpgw::get_var('syear', 'int');
+ $eday =
phpgw::get_var('eday', 'int');
+ $emonth =
phpgw::get_var('emonth', 'int');
+ $eyear =
phpgw::get_var('eyear', 'int');
+ $download =
phpgw::get_var('download', 'bool');
+ $auto_tax =
phpgw::get_var('auto_tax', 'bool');
$tsvfile = $_FILES['tsvfile']['tmp_name'];
@@ -120,113 +118,113 @@
$tsvfile = phpgw::get_var('tsvfile');
}
- if ($cancel && $tsvfile)
+ if($cancel && $tsvfile)
{
- unlink ($tsvfile);
+ unlink($tsvfile);
}
- if ($convert)
+ if($convert)
{
unset($receipt);
- if ($conv_type=='')
+ if($conv_type == '')
{
- $receipt['error'][] =
array('msg'=>lang('Please - select a import format !'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select a import format !'));
}
- if (!$tsvfile)
+ if(!$tsvfile)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select a file to import from !'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select a file to import from !'));
}
- if (!$art)
+ if(!$art)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select type invoice!'));
}
- if (!$vendor_id)
+ if(!$vendor_id)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select Vendor!'));
}
- if (!$type)
+ if(!$type)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select type order!'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select type order!'));
}
- if (!$budget_responsible)
+ if(!$budget_responsible)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select budget responsible!'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select budget responsible!'));
}
- if (!$this->invoice->check_vendor($vendor_id))
+ if(!$this->invoice->check_vendor($vendor_id))
{
- $receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' . $vendor_id);
+ $receipt['error'][] = array('msg' =>
lang('That Vendor ID is not valid !') . ' : ' . $vendor_id);
}
- if (!$payment_date && !$num_days)
+ if(!$payment_date && !$num_days)
{
- $receipt['error'][] =
array('msg'=>lang('Please - select either payment date or number of days from
invoice date !'));
+ $receipt['error'][] = array('msg' =>
lang('Please - select either payment date or number of days from invoice date
!'));
}
- if (!file_exists($tsvfile))
+ if(!file_exists($tsvfile))
{
- $receipt['error'][] =
array('msg'=>lang('The file is empty or removed!'));
+ $receipt['error'][] = array('msg' =>
lang('The file is empty or removed!'));
}
- if (!is_array($receipt['error']))
+ if(!is_array($receipt['error']))
{
if($invoice_date)
{
- $sdateparts =
phpgwapi_datetime::date_array($invoice_date);
- $sday = $sdateparts['day'];
- $smonth = $sdateparts['month'];
- $syear = $sdateparts['year'];
+ $sdateparts =
phpgwapi_datetime::date_array($invoice_date);
+ $sday =
$sdateparts['day'];
+ $smonth =
$sdateparts['month'];
+ $syear =
$sdateparts['year'];
unset($sdateparts);
- $edateparts =
phpgwapi_datetime::date_array($payment_date);
- $eday = $edateparts['day'];
- $emonth = $edateparts['month'];
- $eyear = $edateparts['year'];
+ $edateparts =
phpgwapi_datetime::date_array($payment_date);
+ $eday =
$edateparts['day'];
+ $emonth =
$edateparts['month'];
+ $eyear =
$edateparts['year'];
unset($edateparts);
}
- $old = $tsvfile;
- $tsvfile =
$GLOBALS['phpgw_info']['server']['temp_dir'].'/invoice_import_'.basename($tsvfile);
- rename($old,$tsvfile);
+ $old = $tsvfile;
+ $tsvfile =
$GLOBALS['phpgw_info']['server']['temp_dir'] . '/invoice_import_' .
basename($tsvfile);
+ rename($old, $tsvfile);
- $invoice_common=array
+ $invoice_common = array
(
- 'bilagsnr'
=> $this->invoice->next_bilagsnr(),
- 'art'
=> $art,
- 'type'
=> $type,
- 'dim_b'
=> $dim_b,
- 'invoice_num'
=> $invoice_num,
- 'kid_nr'
=> $kid_nr,
- 'vendor_id'
=> $vendor_id,
- 'vendor_name'
=> $vendor_name,
- 'janitor'
=> $janitor,
- 'supervisor'
=> $supervisor,
- 'budget_responsible'
=> $budget_responsible,
- 'num_days'
=> $num_days,
- 'sday'
=> $sday,
- 'smonth'
=> $smonth,
- 'syear'
=> $syear,
- 'eday'
=> $eday,
- 'emonth'
=> $emonth,
- 'eyear'
=> $eyear,
- 'tsvfile'
=> $tsvfile,
- 'conv_type'
=> $conv_type,
- 'invoice_date'
=> $invoice_date,
- 'payment_date'
=> $payment_date,
- 'auto_tax'
=> $auto_tax
- );
+ 'bilagsnr'
=> $this->invoice->next_bilagsnr(),
+ 'art'
=> $art,
+ 'type'
=> $type,
+ 'dim_b'
=> $dim_b,
+ 'invoice_num' =>
$invoice_num,
+ 'kid_nr'
=> $kid_nr,
+ 'vendor_id'
=> $vendor_id,
+ 'vendor_name' =>
$vendor_name,
+ 'janitor'
=> $janitor,
+ 'supervisor' =>
$supervisor,
+ 'budget_responsible' =>
$budget_responsible,
+ 'num_days'
=> $num_days,
+ 'sday'
=> $sday,
+ 'smonth'
=> $smonth,
+ 'syear'
=> $syear,
+ 'eday'
=> $eday,
+ 'emonth'
=> $emonth,
+ 'eyear'
=> $eyear,
+ 'tsvfile'
=> $tsvfile,
+ 'conv_type'
=> $conv_type,
+ 'invoice_date' =>
$invoice_date,
+ 'payment_date' =>
$payment_date,
+ 'auto_tax'
=> $auto_tax
+ );
- $buffer =
$this->bo->import($invoice_common,$download);
+ $buffer =
$this->bo->import($invoice_common, $download);
if(!$download)
{
$receipt = $buffer;
-
$GLOBALS['phpgw']->session->appsession('session_data','import_receipt',$receipt);
- unlink ($tsvfile);
+
$GLOBALS['phpgw']->session->appsession('session_data', 'import_receipt',
$receipt);
+ unlink($tsvfile);
unset($invoice_common);
unset($art);
unset($type);
@@ -248,7 +246,7 @@
else
{
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
$this->debug_import($buffer,$invoice_common);
+ $this->debug_import($buffer,
$invoice_common);
return;
}
}
@@ -259,9 +257,9 @@
$link_data = array
(
- 'menuaction' =>
'property.uiXport.import',
- 'sub' => $sub
- );
+ 'menuaction' => 'property.uiXport.import',
+ 'sub' => $sub
+ );
$msgbox_data = $this->bocommon->msgbox_data($receipt);
@@ -271,139 +269,122 @@
$data = array
(
- 'menu'
=> $this->bocommon->get_menu(),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'menu'
=> $this->bocommon->get_menu(),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'form_action'
=> $GLOBALS['phpgw']->link('/index.php', $link_data),
+ 'cancel_action'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiinvoice.index', 'sub' => $sub)),
+ 'lang_cancel'
=> lang('Cancel'),
+ 'lang_cancel_statustext'
=> lang('cancel the import'),
+ 'action_url'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property' . '.uiXport.import')),
+ 'tsvfilename'
=> '',
+ 'lang_debug'
=> lang('Debug output in browser'),
+ 'lang_debug_statustext'
=> lang('Check this to have the output to screen before import (recommended)'),
+ 'value_debug'
=> $download,
+ 'lang_import'
=> lang('Import'),
+ 'lang_import_statustext'
=> lang('click this button to start the import'),
+ 'lang_invoice_date'
=> lang('invoice date'),
+ 'lang_payment_date'
=> lang('Payment date'),
+ 'lang_no_of_days'
=> lang('Days'),
+ 'lang_invoice_number'
=> lang('Invoice Number'),
+ 'lang_invoice_num_statustext' =>
lang('Enter Invoice Number'),
+ 'lang_select'
=> lang('Select per button !'),
+ 'lang_kidnr'
=> lang('KID nr'),
+ 'lang_kid_nr_statustext'
=> lang('Enter Kid nr'),
+ 'lang_vendor'
=> lang('Vendor'),
+ 'addressbook_link'
=> $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uilookup.vendor')),
+ 'lang_invoice_date_statustext' =>
lang('Enter the invoice date'),
+ 'lang_num_days_statustext'
=> lang('Enter the payment date or the payment delay'),
+ 'lang_payment_date_statustext' =>
lang('Enter the payment date or the payment delay'),
+ 'lang_file_statustext'
=> lang('Select the file to import from'),
+ 'lang_vendor_statustext'
=> lang('Select the vendor by clicking the button'),
+ 'lang_vendor_name_statustext' =>
lang('Select the vendor by clicking the button'),
+ 'lang_select_vendor_statustext' =>
lang('Select the vendor by clicking this button'),
+ 'value_invoice_date'
=> $invoice_date,
+ 'value_payment_date'
=> $payment_date,
+ 'value_belop'
=> $belop,
+ 'value_vendor_id'
=> $vendor_id,
+ 'value_vendor_name'
=> $vendor_name,
+ 'value_kid_nr'
=> $kid_nr,
+ 'value_dim_b'
=> $dim_b,
+ 'value_invoice_num'
=> $invoice_num,
+ 'value_merknad'
=> $merknad,
+ 'value_num_days'
=> $num_days,
+ // 'value_tsvfile'
=> $tsvfile,
+ 'lang_file'
=> lang('File'),
+ 'lang_conv'
=> lang('Conversion'),
+ 'conv_list'
=> $this->bo->select_import_conv($conv_type),
+ 'select_conv'
=> 'conv_type',
+ 'lang_select_conversion'
=> lang('Select the type of conversion:'),
+ 'lang_conv_statustext'
=> lang('You have to select the Conversion for this import'),
+ 'lang_auto_tax'
=> lang('Auto TAX'),
+ 'lang_auto_tax_statustext'
=> lang('Set tax during import'),
+ 'lang_art'
=> lang('Art'),
+ 'art_list'
=> $this->invoice->get_lisfm_ecoart($art),
+ 'select_art'
=> 'art',
+ 'lang_select_art'
=> lang('Select Invoice Type'),
+ 'lang_art_statustext'
=> lang('You have to select type of invoice'),
+ 'lang_type'
=> lang('Type invoice II'),
+ 'type_list'
=> $this->invoice->get_type_list($type),
+ 'select_type'
=> 'type',
+ 'lang_no_type'
=> lang('No type'),
+ 'lang_type_statustext'
=> lang('Select the type invoice. To do not use type - select NO TYPE'),
+ 'lang_dimb'
=> lang('Dim B'),
+ 'dimb_list'
=> $this->invoice->select_dimb_list($dim_b),
+ 'select_dimb'
=> 'dim_b',
+ 'lang_no_dimb'
=> lang('No Dim B'),
+ 'lang_dimb_statustext'
=> lang('Select the Dim B for this invoice. To do not use Dim B - select NO
DIM B'),
+ 'lang_janitor'
=> lang('Janitor'),
+ 'janitor_list'
=> $this->bocommon->get_user_list_right(32, $janitor, '.invoice'),
+ 'select_janitor'
=> 'janitor',
+ 'lang_no_janitor'
=> lang('No janitor'),
+ 'lang_janitor_statustext'
=> lang('Select the janitor responsible for this invoice. To do not use
janitor - select NO JANITOR'),
+ 'lang_supervisor'
=> lang('Supervisor'),
+ 'supervisor_list'
=> $this->bocommon->get_user_list_right(64, $supervisor, '.invoice'),
+ 'select_supervisor'
=> 'supervisor',
+ 'lang_no_supervisor'
=> lang('No supervisor'),
+ 'lang_supervisor_statustext' =>
lang('Select the supervisor responsible for this invoice. To do not use
supervisor - select NO SUPERVISOR'),
+ 'lang_budget_responsible'
=> lang('B - responsible'),
+ 'budget_responsible_list'
=> $this->bocommon->get_user_list_right(128, $budget_responsible, '.invoice'),
+ 'select_budget_responsible'
=> 'budget_responsible',
+ 'lang_select_budget_responsible' =>
lang('Select B-Responsible'),
+ 'lang_budget_responsible_statustext' =>
lang('You have to select a budget responsible for this invoice in order to make
the import')
+ );
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'cancel_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.index', 'sub'=> $sub)),
- 'lang_cancel'
=> lang('Cancel'),
- 'lang_cancel_statustext'
=> lang('cancel the import'),
- 'action_url'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property' .'.uiXport.import')),
- 'tsvfilename'
=> '',
-
- 'lang_debug'
=> lang('Debug output in browser'),
- 'lang_debug_statustext'
=> lang('Check this to have the output to screen before import
(recommended)'),
- 'value_debug'
=> $download,
-
- 'lang_import'
=> lang('Import'),
- 'lang_import_statustext'
=> lang('click this button to start the import'),
-
- 'lang_invoice_date'
=> lang('invoice date'),
- 'lang_payment_date'
=> lang('Payment date'),
- 'lang_no_of_days'
=> lang('Days'),
- 'lang_invoice_number'
=> lang('Invoice Number'),
- 'lang_invoice_num_statustext'
=> lang('Enter Invoice Number'),
-
- 'lang_select'
=> lang('Select per button !'),
- 'lang_kidnr'
=> lang('KID nr'),
- 'lang_kid_nr_statustext'
=> lang('Enter Kid nr'),
-
- 'lang_vendor'
=> lang('Vendor'),
- 'addressbook_link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uilookup.vendor')),
-
- 'lang_invoice_date_statustext'
=> lang('Enter the invoice date'),
- 'lang_num_days_statustext'
=> lang('Enter the payment date or the payment delay'),
- 'lang_payment_date_statustext'
=> lang('Enter the payment date or the payment delay'),
- 'lang_file_statustext'
=> lang('Select the file to import from'),
- 'lang_vendor_statustext'
=> lang('Select the vendor by clicking the button'),
- 'lang_vendor_name_statustext'
=> lang('Select the vendor by clicking the button'),
- 'lang_select_vendor_statustext'
=> lang('Select the vendor by clicking this button'),
-
-
- 'value_invoice_date'
=> $invoice_date,
- 'value_payment_date'
=> $payment_date,
- 'value_belop'
=> $belop,
- 'value_vendor_id'
=> $vendor_id,
- 'value_vendor_name'
=> $vendor_name,
- 'value_kid_nr'
=> $kid_nr,
- 'value_dim_b'
=> $dim_b,
- 'value_invoice_num'
=> $invoice_num,
- 'value_merknad'
=> $merknad,
- 'value_num_days'
=> $num_days,
- // 'value_tsvfile'
=> $tsvfile,
-
- 'lang_file'
=> lang('File'),
- 'lang_conv'
=> lang('Conversion'),
- 'conv_list'
=> $this->bo->select_import_conv($conv_type),
- 'select_conv'
=> 'conv_type',
- 'lang_select_conversion'
=> lang('Select the type of conversion:'),
- 'lang_conv_statustext'
=> lang('You have to select the Conversion for this import'),
-
- 'lang_auto_tax'
=> lang('Auto TAX'),
- 'lang_auto_tax_statustext'
=> lang('Set tax during import'),
-
- 'lang_art'
=> lang('Art'),
- 'art_list'
=> $this->invoice->get_lisfm_ecoart($art),
- 'select_art'
=> 'art',
- 'lang_select_art'
=> lang('Select Invoice Type'),
- 'lang_art_statustext'
=> lang('You have to select type of invoice'),
-
- 'lang_type'
=> lang('Type invoice II'),
- 'type_list'
=> $this->invoice->get_type_list($type),
- 'select_type'
=> 'type',
- 'lang_no_type'
=> lang('No type'),
- 'lang_type_statustext'
=> lang('Select the type invoice. To do not use type - select NO
TYPE'),
-
- 'lang_dimb'
=> lang('Dim B'),
- 'dimb_list'
=> $this->invoice->select_dimb_list($dim_b),
- 'select_dimb'
=> 'dim_b',
- 'lang_no_dimb'
=> lang('No Dim B'),
- 'lang_dimb_statustext'
=> lang('Select the Dim B for this invoice. To do not use Dim B -
select NO DIM B'),
-
- 'lang_janitor'
=> lang('Janitor'),
- 'janitor_list'
=> $this->bocommon->get_user_list_right(32,$janitor,'.invoice'),
- 'select_janitor'
=> 'janitor',
- 'lang_no_janitor'
=> lang('No janitor'),
- 'lang_janitor_statustext'
=> lang('Select the janitor responsible for this invoice. To do not use
janitor - select NO JANITOR'),
-
- 'lang_supervisor'
=> lang('Supervisor'),
- 'supervisor_list'
=>
$this->bocommon->get_user_list_right(64,$supervisor,'.invoice'),
- 'select_supervisor'
=> 'supervisor',
- 'lang_no_supervisor'
=> lang('No supervisor'),
- 'lang_supervisor_statustext'
=> lang('Select the supervisor responsible for this invoice. To do not use
supervisor - select NO SUPERVISOR'),
-
- 'lang_budget_responsible'
=> lang('B - responsible'),
- 'budget_responsible_list'
=>
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice'),
- 'select_budget_responsible'
=> 'budget_responsible',
- 'lang_select_budget_responsible'
=> lang('Select B-Responsible'),
- 'lang_budget_responsible_statustext'=>
lang('You have to select a budget responsible for this invoice in order to make
the import')
- );
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice'));
- $appname = lang('Invoice');
- $function_msg = lang('Import from CSV');
+ $appname = lang('Invoice');
+ $function_msg = lang('Import from CSV');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('import' => $data));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('import' => $data));
// $GLOBALS['phpgw']->xslttpl->pp();
}
- function debug_import($buffer='',$invoice_common='')
+ function debug_import($buffer = '', $invoice_common = '')
{
- $table = $buffer['table'];
- $header = $buffer['header'];
- $import = $buffer['import'];
+ $table = $buffer['table'];
+ $header = $buffer['header'];
+ $import = $buffer['import'];
- $sum=0;
+ $sum = 0;
$i = 0;
- foreach ($table as $dummy => $record)
+ foreach($table as $dummy => $record)
{
- $k=0;
- foreach ($import as $text => $key)
+ $k = 0;
+ foreach($import as $text => $key)
{
- $content[$i]['row'][$k]['value']
= $record[$key];
- $content[$i]['row'][$k]['align']
= 'center';
- if ($key=='belop')
+ $content[$i]['row'][$k]['value'] =
$record[$key];
+ $content[$i]['row'][$k]['align'] =
'center';
+ if($key == 'belop')
{
-
$content[$i]['row'][$k]['align'] = 'right';
- $sum=$sum+$record[$key];
-
$content[$i]['row'][$k]['value'] = number_format($record[$key], 2, ',',
'');
+
$content[$i]['row'][$k]['align'] = 'right';
+ $sum
= $sum + $record[$key];
+
$content[$i]['row'][$k]['value'] = number_format($record[$key], 2, ',', '');
}
- else if ($key=='stedsnavn')
+ else if($key == 'stedsnavn')
{
-
$content[$i]['row'][$k]['align'] = 'left';
+
$content[$i]['row'][$k]['align'] = 'left';
}
$k++;
@@ -411,49 +392,47 @@
$i++;
}
- foreach ($import as $text => $key)
+ foreach($import as $text => $key)
{
$table_header[] = array
(
- 'header' => $text,
- 'width' => '5%',
- 'align' => 'center'
- );
+ 'header' => $text,
+ 'width' => '5%',
+ 'align' => 'center'
+ );
}
$link_data_add = array
(
- 'menuaction' =>
'property.uiXport.import',
- 'convert' => 'true'
- );
+ 'menuaction' => 'property.uiXport.import',
+ 'convert' => 'true'
+ );
$link_data_cancel = array
(
- 'menuaction' =>
'property.uiXport.import',
- 'cancel' => true
+ 'menuaction' => 'property.uiXport.import',
+ 'cancel' => true
+ );
- );
+ $link_data_add = $link_data_add +
$invoice_common;
+ $link_data_cancel = $link_data_cancel +
$invoice_common;
- $link_data_add = $link_data_add +
$invoice_common;
- $link_data_cancel = $link_data_cancel +
$invoice_common;
-
$table_add[] = array
(
- 'lang_add'
=> lang('Import'),
- 'lang_add_statustext' =>
lang('Import this invoice'),
- 'add_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_add),
- 'lang_cancel'
=> lang('cancel'),
- 'lang_cancel_statustext' =>
lang('Do not import this invoice'),
- 'cancel_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data_cancel)
+ 'lang_add' =>
lang('Import'),
+ 'lang_add_statustext' => lang('Import this
invoice'),
+ 'add_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data_add),
+ 'lang_cancel' =>
lang('cancel'),
+ 'lang_cancel_statustext' => lang('Do not import
this invoice'),
+ 'cancel_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data_cancel)
+ );
- );
+ $vendor = $this->contacts->read_single(array('id' =>
$invoice_common['vendor_id']), array('attributes' => array(array('column_name'
=> 'org_name'))));
- $vendor = $this->contacts->read_single(array('id' =>
$invoice_common['vendor_id']), array('attributes'=>array(array('column_name' =>
'org_name'))));
-
foreach($vendor['attributes'] as $attribute)
{
- if($attribute['column_name']=='org_name')
+ if($attribute['column_name'] == 'org_name')
{
$vendor_name = $attribute['value'];
break;
@@ -462,39 +441,39 @@
$data = array
(
- 'artid'
=> $invoice_common['art'],
- 'lang_type'
=> lang('Type'),
- 'lang_bilagsnr'
=> lang('bilagsnr'),
- 'bilagsnr'
=> $invoice_common['bilagsnr'],
- 'lang_vendor'
=> lang('Vendor'),
- 'vendor_name'
=> $vendor_name,
- 'spvend_code'
=> $invoice_common['vendor_id'],
- 'lang_fakturadato'
=> lang('invoice date'),
- 'fakturadato'
=>
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['fakturadato'])),
- 'lang_forfallsdato'
=> lang('Payment date'),
- 'forfallsdato'
=>
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],strtotime($table[0]['forfallsdato'])),
- 'lang_janitor'
=> lang('Janitor'),
- 'oppsynsmannid'
=> $invoice_common['janitor'],
- 'lang_supervisor'
=> lang('Supervisor'),
- 'saksbehandlerid'
=> $invoice_common['supervisor'],
- 'lang_budget_responsible'
=> lang('Budget Responsible'),
- 'budsjettansvarligid'
=> $invoice_common['budget_responsible'],
- 'lang_sum'
=> lang('Sum'),
- 'sum'
=> number_format($sum, 2, ',', ''),
- 'table_header'
=> $table_header,
- 'values'
=> $content,
- 'table_add'
=> $table_add
- );
+ 'artid'
=> $invoice_common['art'],
+ 'lang_type'
=> lang('Type'),
+ 'lang_bilagsnr' =>
lang('bilagsnr'),
+ 'bilagsnr'
=> $invoice_common['bilagsnr'],
+ 'lang_vendor' =>
lang('Vendor'),
+ 'vendor_name' =>
$vendor_name,
+ 'spvend_code' =>
$invoice_common['vendor_id'],
+ 'lang_fakturadato' =>
lang('invoice date'),
+ 'fakturadato' =>
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
strtotime($table[0]['fakturadato'])),
+ 'lang_forfallsdato' =>
lang('Payment date'),
+ 'forfallsdato' =>
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
strtotime($table[0]['forfallsdato'])),
+ 'lang_janitor' =>
lang('Janitor'),
+ 'oppsynsmannid' =>
$invoice_common['janitor'],
+ 'lang_supervisor' =>
lang('Supervisor'),
+ 'saksbehandlerid' =>
$invoice_common['supervisor'],
+ 'lang_budget_responsible' =>
lang('Budget Responsible'),
+ 'budsjettansvarligid' =>
$invoice_common['budget_responsible'],
+ 'lang_sum'
=> lang('Sum'),
+ 'sum'
=> number_format($sum, 2, ',', ''),
+ 'table_header' =>
$table_header,
+ 'values'
=> $content,
+ 'table_add'
=> $table_add
+ );
unset($content);
-
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice','table_header'));
- $appname
= lang('Invoice');
- $function_msg = lang('Debug');
+ $GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
'table_header'));
+ $appname = lang('Invoice');
+ $function_msg = lang('Debug');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('debug' => $data));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('debug' => $data));
// $GLOBALS['phpgw']->xslttpl->pp();
}
@@ -502,89 +481,85 @@
{
if(!$this->acl_manage)
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>16, 'acl_location'=> $this->acl_location));
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop', 'perm' => 16, 'acl_location'
=> $this->acl_location));
}
$GLOBALS['phpgw_info']['flags']['menu_selection'] .=
'::export';
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
'search_field'));
- $values = phpgw::get_var('values');
- $date = phpgw::get_var('date');
+ $values = phpgw::get_var('values');
+ $date = phpgw::get_var('date');
$receipt = array();
if($values['submit'])
{
- if (!$values['conv_type'] && !$values['file'] )
+ if(!$values['conv_type'] && !$values['file'])
{
- $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') . ' - ' . lang('Please choose a
conversion type from the list'));
+ $receipt['error'][] = array('msg' =>
lang('No conversion type could be located.') . ' - ' . lang('Please choose a
conversion type from the list'));
}
else if($values['conv_type'] &&
!$values['file'])
{
- $receipt =
$this->bo->export(array('conv_type'=>$values['conv_type'],'download'=>$values['download'],'force_period_year'=>$values['force_period_year']));
+ $receipt =
$this->bo->export(array('conv_type' => $values['conv_type'], 'download' =>
$values['download'], 'force_period_year' => $values['force_period_year']));
if(!$values['download'])
{
-
$GLOBALS['phpgw_info']['flags'][noheader] = true;
-
$GLOBALS['phpgw_info']['flags'][nofooter] = true;
-
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
$GLOBALS['phpgw_info']['flags'][noheader] = true;
+
$GLOBALS['phpgw_info']['flags'][nofooter] = true;
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
echo '<pre>' .
$receipt['message'][0]['msg'] . '</pre>';
- echo ' <a
href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.export')) . '">' . lang('Back') . '</a>';
+ echo ' <a href="' .
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiXport.export')) . '">' . lang('Back') . '</a>';
}
}
}
else
{
- $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $date =
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"),
date("Y")),
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
//_debug_array($receipt);
$link_data = array
(
- 'menuaction' =>
'property.uiXport.export'
- );
+ 'menuaction' => 'property.uiXport.export'
+ );
$msgbox_data = $this->bocommon->msgbox_data($receipt);
$data = array
(
- 'menu'
=> $this->bocommon->get_menu(),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'lang_export_statustext' =>
lang('click this button to start the export'),
- 'lang_select_conv'
=> lang('Select conversion'),
- 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
- 'select_conv'
=> 'values[conv_type]',
- 'lang_conv_statustext' =>
lang('Select conversion'),
+ 'menu' =>
$this->bocommon->get_menu(),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_export_statustext' => lang('click this
button to start the export'),
+ 'lang_select_conv' =>
lang('Select conversion'),
+ 'conv_list' =>
$this->bo->select_export_conv($values['conv_type']),
+ 'select_conv' =>
'values[conv_type]',
+ 'lang_conv_statustext' => lang('Select
conversion'),
+ 'lang_rollback_file' => lang('Roll back'),
+ 'link_rollback_file' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiXport.rollback')),
+ 'lang_export_to_file' => lang('Export to
file'),
+ 'value_debug' =>
$values['debug'],
+ 'lang_debug_statustext' => lang('Uncheck to
debug the result'),
+ 'lang_submit' =>
lang('Submit'),
+ 'lang_cancel' =>
lang('Cancel'),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data),
+ 'lang_save' =>
lang('save')
+ );
- 'lang_rollback_file' =>
lang('Roll back'),
- 'link_rollback_file' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.rollback')),
-
- 'lang_export_to_file' =>
lang('Export to file'),
- 'value_debug'
=> $values['debug'],
- 'lang_debug_statustext' =>
lang('Uncheck to debug the result'),
-
- 'lang_submit'
=> lang('Submit'),
- 'lang_cancel'
=> lang('Cancel'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_save'
=> lang('save')
- );
-
//_debug_array($data);
- $appname = lang('Invoice');
- $function_msg = lang('Export invoice');
+ $appname = lang('Invoice');
+ $function_msg = lang('Export invoice');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('export' => $data));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('export' => $data));
}
function rollback()
{
if(!$this->acl_manage)
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>16, 'acl_location'=> $this->acl_location));
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'property.uilocation.stop', 'perm' => 16, 'acl_location'
=> $this->acl_location));
}
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
'property::invoice::rollback';
@@ -592,33 +567,33 @@
$GLOBALS['phpgw']->xslttpl->add_file(array('invoice',
'search_field'));
- $values = phpgw::get_var('values');
- $date = phpgw::get_var('date');
+ $values = phpgw::get_var('values');
+ $date = phpgw::get_var('date');
//_debug_array($values);
if($values['submit'])
{
- if (!$values['conv_type'])
+ if(!$values['conv_type'])
{
- $receipt['error'][] = array('msg'=>
lang('No conversion type could be located.') .' - ' . lang('Please choose a
conversion type from the list'));
+ $receipt['error'][] = array('msg' =>
lang('No conversion type could be located.') . ' - ' . lang('Please choose a
conversion type from the list'));
}
if(!$values['file'] && !$values['voucher_id'])
{
- $receipt['error'][] =
array('msg'=>lang('Please choose a file or a voucher'));
+ $receipt['error'][] = array('msg' =>
lang('Please choose a file or a voucher'));
}
if(!$receipt['error'])
{
- $receipt =
$this->bo->rollback($values['conv_type'],$values['file'],$date,$values['voucher_id']);
+ $receipt =
$this->bo->rollback($values['conv_type'], $values['file'], $date,
$values['voucher_id']);
}
}
else
{
- $date =
$GLOBALS['phpgw']->common->show_date(mktime(0,0,0,date("m"),date("d"),date("Y")),$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
+ $date =
$GLOBALS['phpgw']->common->show_date(mktime(0, 0, 0, date("m"), date("d"),
date("Y")),
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
}
- $link_data = array('menuaction' =>
'property.uiXport.rollback');
+ $link_data = array('menuaction' =>
'property.uiXport.rollback');
//_debug_array($receipt);
$GLOBALS['phpgw']->jqcal->add_listener('date');
@@ -627,40 +602,35 @@
$data = array
(
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'lang_select_conv' =>
lang('Select conversion'),
+ 'conv_list' =>
$this->bo->select_export_conv($values['conv_type']),
+ 'select_conv' =>
'values[conv_type]',
+ 'lang_conv_statustext' => lang('Select
conversion'),
+ 'lang_select_file' =>
lang('Select file to roll back'),
+ 'lang_no_file' => lang('No
file selected'),
+ 'lang_file_statustext' => lang('Select file
to roll back'),
+ 'select_file' =>
'values[file]',
+ 'rollback_file_list' =>
$this->bo->select_rollback_file($values['file']),
+ 'lang_export_to_file' => lang('Export to
file'),
+ 'value_debug' =>
$values['debug'],
+ 'value_date' => $date,
+ 'lang_date' =>
lang('Export date'),
+ 'lang_date_statustext' => lang('Select date
for the file to roll back'),
+ 'lang_submit' =>
lang('Submit'),
+ 'lang_cancel' =>
lang('Cancel'),
+ 'form_action' =>
$GLOBALS['phpgw']->link('/index.php', $link_data),
+ 'lang_save' =>
lang('save')
+ );
- 'lang_select_conv'
=> lang('Select conversion'),
- 'conv_list'
=> $this->bo->select_export_conv($values['conv_type']),
- 'select_conv'
=> 'values[conv_type]',
- 'lang_conv_statustext' =>
lang('Select conversion'),
-
- 'lang_select_file'
=> lang('Select file to roll back'),
- 'lang_no_file'
=> lang('No file selected'),
- 'lang_file_statustext' =>
lang('Select file to roll back'),
- 'select_file'
=> 'values[file]',
-
- 'rollback_file_list' =>
$this->bo->select_rollback_file($values['file']),
- 'lang_export_to_file' =>
lang('Export to file'),
- 'value_debug'
=> $values['debug'],
-
- 'value_date'
=> $date,
- 'lang_date'
=> lang('Export date'),
- 'lang_date_statustext' =>
lang('Select date for the file to roll back'),
-
- 'lang_submit'
=> lang('Submit'),
- 'lang_cancel'
=> lang('Cancel'),
-
- 'form_action'
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
- 'lang_save'
=> lang('save')
- );
-
//_debug_array($data);
- $appname = lang('Invoice');
- $function_msg = lang('Rollback invoice');
+ $appname = lang('Invoice');
+ $function_msg = lang('Rollback invoice');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('property') . ' - ' . $appname . ': ' . $function_msg;
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('rollback' => $data));
+ $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('rollback' => $data));
}
- }
+
+ }
\ No newline at end of file
Modified: branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/class.uitenant_claim.inc.php
2014-02-21 10:21:38 UTC (rev 11729)
@@ -98,6 +98,16 @@
$this->bo->save_sessiondata($data);
}
+ function view_file()
+ {
+ if(!$this->acl_read)
+ {
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>PHPGW_ACL_READ, 'acl_location'=>
$this->acl_location));
+ }
+ $bofiles = CreateObject('property.bofiles');
+ $bofiles->view_file('tenant_claim');
+ }
+
function index($project_id='')
{
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim',
@@ -107,7 +117,7 @@
if(!$this->acl_read)
{
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>1, 'acl_location'=> $this->acl_location));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uilocation.stop', 'perm'=>PHPGW_ACL_READ, 'acl_location'=>
$this->acl_location));
}
$receipt =
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
@@ -622,7 +632,7 @@
$this->boproject= CreateObject('property.boproject');
-
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim','files'));
if ($values['save'] || $values['apply'])
{
@@ -648,6 +658,43 @@
$claim_id = $receipt['claim_id'];
$this->cat_id =
($values['cat_id']?$values['cat_id']:$this->cat_id);
+ //----------files
+ $bofiles =
CreateObject('property.bofiles');
+ if(isset($values['file_action']) &&
is_array($values['file_action']))
+ {
+
$bofiles->delete_file("/tenant_claim/{$claim_id}/", $values);
+ }
+
+ $file_name = @str_replace('
','_',$_FILES['file']['name']);
+
+ if($file_name)
+ {
+ $to_file =
"{$bofiles->fakebase}/tenant_claim/{$claim_id}/{$file_name}";
+
+
if($bofiles->vfs->file_exists(array(
+ 'string' => $to_file,
+ 'relatives' =>
Array(RELATIVE_NONE)
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('This file already exists !'));
+ }
+ else
+ {
+
$bofiles->create_document_dir("tenant_claim/$claim_id");
+
$bofiles->vfs->override_acl = 1;
+
+ if(!$bofiles->vfs->cp
(array (
+ 'from' =>
$_FILES['file']['tmp_name'],
+ 'to' =>
$to_file,
+ 'relatives'
=> array (RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
+ {
+
$receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
+ }
+
$bofiles->vfs->override_acl = 0;
+ }
+ }
+ //-----------
+
if ($values['save'])
{
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
@@ -854,8 +901,62 @@
$record_history = array();
}
+
+//--------------files
+ $link_file_data = array
+ (
+ 'menuaction' =>
'property.uitenant_claim.view_file',
+ 'id' => $claim_id
+ );
+
+ $link_to_files
=(isset($config->config_data['files_url'])?$config->config_data['files_url']:'');
+
+ $link_view_file =
$GLOBALS['phpgw']->link('/index.php',$link_file_data);
+
+ $_files = $this->bo->get_files($claim_id);
+
+ $lang_view_file = lang('click to view file');
+ $lang_delete_file = lang('Check to delete file');
+ $z=0;
+ $content_files = array();
+ foreach( $_files as $_file )
+ {
+ if ($link_to_files)
+ {
+ $content_files[$z]['file_name'] = "<a
href='{$link_to_files}/{$_file['directory']}/{$_file['file_name']}'
target=\"_blank\" title='{$lang_view_file}'>{$_file['name']}</a>";
+ }
+ else
+ {
+ $content_files[$z]['file_name'] = "<a
href=\"{$link_view_file}&file_name={$_file['file_name']}\"
target=\"_blank\" title=\"{$lang_view_file}\">{$_file['name']}</a>";
+ }
+ $content_files[$z]['delete_file'] = "<input
type=\"checkbox\" name=\"values[file_action][]\" value=\"{$_file['name']}\"
title=\"{$lang_delete_file}\">";
+ $z++;
+ }
+
$datavalues[1] = array
+ (
+ 'name' => "1",
+ 'values' =>
json_encode($content_files),
+ 'total_records' =>
count($content_files),
+ 'edit_action' => "''",
+ 'is_paginator' => 1,
+ 'rows_per_page' =>
5,//$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'],
+ 'footer' => 0
+ );
+
+ $myColumnDefs[1] = array
(
+ 'name' => "1",
+ 'values' =>
json_encode(array( array('key' =>
'file_name','label'=>lang('Filename'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'delete_file','label'=>lang('Delete
file'),'sortable'=>false,'resizeable'=>true)))
+ );
+
+//--------------files
+
+
+
+ $datavalues[2] = array
+ (
'name'
=> "1",
'values'
=> json_encode($record_history),
'total_records' =>
count($record_history),
@@ -864,9 +965,9 @@
'footer'
=> 0
);
- $myColumnDefs[1] = array
+ $myColumnDefs[2] = array
(
- 'name' => "1",
+ 'name' => "2",
'values' =>
json_encode(array( array('key' => 'value_date','label' =>
lang('Date'),'sortable'=>true,'resizeable'=>true),
array('key' => 'value_user','label' =>
lang('User'),'Action'=>true,'resizeable'=>true),
array('key' => 'value_action','label' =>
lang('Action'),'sortable'=>true,'resizeable'=>true),
Deleted: branches/Version-1_0-branch/property/inc/export/default/Agresso
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Agresso
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/export/default/Agresso
2014-02-21 10:21:38 UTC (rev 11729)
@@ -1,1151 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C)
2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 Free Software Foundation,
Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage export
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class export_conv
- {
- //var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
-
- protected $old_files_deleted;
- protected $debug;
- protected $orders_affected = array();
- protected $db;
- protected $db2;
- protected $soXport;
- protected $config;
-
- function __construct()
- {
- $this->db = & $GLOBALS['phpgw']->db;
- $this->join = & $this->db->join;
- $this->db2 = clone($this->db);
- $this->soXport = CreateObject('property.soXport');
- $this->config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.invoice'));
- }
-
- function
select_periods_with_invoice_to_transfer($pre_transfer='')
- {
- if($pre_transfer)
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE utbetalingsigndato IS NULL";
- }
- else
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag
WHERE budsjettsigndato is not null and (saksigndato is not null or
oppsynsigndato is not null) and utbetalingsigndato is not null";
- }
-
- $periode = array();
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $periode[] = $this->db->f('periode');
- }
-
- return $periode;
- }
-
- function log_end($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function log_error($batchid,$error_desr)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function increment_batchid()
- {
-
- $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->next_record();
- $bilagsnr = $this->db->f('value');
- return $bilagsnr;
-
- }
-
- function next_batchid()
- {
-
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'",__LINE__,__FILE__);
- $this->db->next_record();
- $batchid = $this->db->f('value')+1;
-
- return $batchid;
- }
-
- //Lagre start melding
- function log_start($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function get_vendor_info($vendor_id='')
- {
- $sql = "select org_nr,konto_nr from fm_vendor where
id='$vendor_id'";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
-
- $vendor_info= array(
- 'org_nr' => $this->db->f('org_nr'),
- 'konto_nr' => $this->db->f('konto_nr')
- );
-
- return $vendor_info;
- }
-
- function get_order_title($order_id='')
- {
- $sql = "select type from fm_orders where
id='$order_id'";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
-
- switch($this->db->f('type'))
- {
- case 'workorder':
- $sql2 = "select title from fm_workorder
where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
- $this->db->next_record();
- $order_title = $this->db->f('title');
- break;
- case 's_agreement':
- $sql2 = "select descr as title from
fm_s_agreement where id='$order_id'";
-
$this->db->query($sql2,__LINE__,__FILE__);
- $this->db->next_record();
- $order_title = $this->db->f('title');
- break;
- }
-
- return $order_title;
- }
-
-
- function select_invoice_rollback($day,$month,$year,$Filnavn)
- {
-
- switch($GLOBALS['phpgw_info']['server']['db_type'])
- {
- case 'mssql':
- $datepart_year =
"datepart(year,overftid)";
- $datepart_month =
"datepart(month,overftid)";
- $datepart_day =
"datepart(day,overftid)";
- break;
- case 'mysql':
- $datepart_year =
"YEAR(overftid)";
- $datepart_month =
"MONTH(overftid)";
- $datepart_day =
"DAYOFMONTH(overftid)";
- break;
- case 'pgsql':
- case 'postgres':
- $datepart_year =
"date_part('year',overftid)";
- $datepart_month =
"date_part('month',overftid)";
- $datepart_day =
"date_part('day',overftid)";
- break;
- }
-
-
- $sql = "SELECT * FROM fm_ecobilagoverf WHERE filnavn='$Filnavn'
and $datepart_year=$year and $datepart_month=$month and $datepart_day= $day";
- $this->db->query($sql,__LINE__,__FILE__);
-
- $i = 0;
- while ($this->db->next_record())
- {
- $invoice_roleback[$i]['id'] =
$this->db->f('id');
- $invoice_roleback[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
- $invoice_roleback[$i]['kidnr'] =
$this->db->f('kidnr');
- $invoice_roleback[$i]['typeid'] =
$this->db->f('typeid');
- $invoice_roleback[$i]['kildeid'] =
$this->db->f('kildeid');
- $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $invoice_roleback[$i]['belop'] =
$this->db->f('belop');
- $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
- $invoice_roleback[$i]['periode'] =
$this->db->f('periode');
- $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
- $invoice_roleback[$i]['fakturanr'] =
$this->db->f('fakturanr');
- $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
- $invoice_roleback[$i]['regtid'] =
$this->db->f('regtid');
- $invoice_roleback[$i]['artid'] =
$this->db->f('artid');
- $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
- $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
- $invoice_roleback[$i]['dima'] =
$this->db->f('dima');
- $invoice_roleback[$i]['loc1'] =
$this->db->f('loc1');
- $invoice_roleback[$i]['dimb'] =
$this->db->f('dimb');
- $invoice_roleback[$i]['mvakode'] =
$this->db->f('mvakode');
- $invoice_roleback[$i]['dimd'] =
$this->db->f('dimd');
- $invoice_roleback[$i]['project_id'] =
$this->db->f('project_id');
- $invoice_roleback[$i]['kostra_id'] =
$this->db->f('kostra_id');
- $invoice_roleback[$i]['item_type'] =
$this->db->f('item_type');
- $invoice_roleback[$i]['item_id'] =
$this->db->f('item_id');
-
- if($this->db->f('oppsynsmannid'))
- {
- $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
- }
- if($this->db->f('saksbehandlerid'))
- {
-
$invoice_roleback[$i]['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
- }
-
- $invoice_roleback[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
-
- if($this->db->f('oppsynsigndato'))
- {
- $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
- }
- if($this->db->f('saksigndato'))
- {
- $invoice_roleback[$i]['saksigndato']
= $this->db->f('saksigndato');
- }
-
- $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
- $invoice_roleback[$i]['merknad'] =
$this->db->f('merknad');
- $invoice_roleback[$i]['splitt'] =
$this->db->f('splitt');
- $invoice_roleback[$i]['ordrebelop'] =
$this->db->f('ordrebelop');
- $invoice_roleback[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
- $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
- $i++;
- }
- return $invoice_roleback;
- }
-
-
- //rollback function
- function bilag_update_overf($BilagOverf)
- {
- $values= array(
- $BilagOverf['project_id'],
- $BilagOverf['kostra_id'],
- $BilagOverf['pmwrkord_code'],
- $BilagOverf['bilagsnr'],
- $BilagOverf['splitt'],
- $BilagOverf['kildeid'],
- $BilagOverf['kidnr'],
- $BilagOverf[typeid],
- $BilagOverf['fakturadato'],
- $BilagOverf['forfallsdato'],
- $BilagOverf['regtid'],
- $BilagOverf['artid'],
- $BilagOverf['spvend_code'],
- $BilagOverf['dimb'],
- $BilagOverf['oppsynsmannid'],
- $BilagOverf['saksbehandlerid'],
- $BilagOverf['budsjettansvarligid'],
- $BilagOverf['fakturanr'],
- $BilagOverf['spbudact_code'],
- $BilagOverf['dima'],
- $BilagOverf['loc1'],
- $BilagOverf['dimd'],
- $BilagOverf['mvakode'],
- $BilagOverf['periode'],
-
$this->db->db_addslashes($BilagOverf['merknad']),
- $BilagOverf['utbetalingid'],
- $BilagOverf['oppsynsigndato'],
- $BilagOverf['saksigndato'],
- $BilagOverf['budsjettsigndato'],
- $BilagOverf['utbetalingsigndato'],
- $BilagOverf['item_type'],
- $BilagOverf['item_id'],
- );
-
- $values = $this->db->validate_insert($values);
-
- $sql= "INSERT INTO fm_ecobilag
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
- . "
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
- . "
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
- . "
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
- . " values ($values,"
- . $this->db->money_format($BilagOverf['belop']) . ","
- . $this->db->money_format($BilagOverf['godkjentbelop'])
. ")";
-
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function
overfor($download,$pre_transfer='',$force_period_year='')
- {
-
-// $download = 'on';
-// $download = False;
- $pre_transfer=True;
-// $this->debug=True;
-
- //Generer batch ID
- $batchid = $this->soXport->next_batchid();
- if ($download=='on')
- {
- $this->increment_batchid();
- //Lagre melding
- $this->log_start($batchid);
- }
-
- //Velg ut alle perioder som har bilag som skal overføres
- if ($pre_transfer)
- {
- $periodes =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
- foreach ($periodes as $periode)
- {
-
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer);
- }
- }
-
- $pre_transfer=False;
-
- $periodes =
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
- foreach ($periodes as $periode)
- {
-
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer,$force_period_year);
- }
-
- //Lagre melding
- if ($download=='on' || $pre_transfer)
- {
- $this->log_end($batchid); //Lagre melding
- }
-
- if (!$download=='on')
- {
- $GLOBALS['phpgw_info']['flags']['noheader'] =
true;
- $GLOBALS['phpgw_info']['flags']['nofooter'] =
true;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] =
false;
- $GLOBALS['phpgw_info']['flags']['noframework']
= true;
- echo ' <a
href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiXport.export')) . '">' . lang('Back') . '</a></br>';
- $GLOBALS['phpgw']->common->phpgw_exit();
- }
-
- return $receipt;
- }
-
- function errorhandler($batchid,$error_desr)
- {
- $this->db->transaction_abort();
-
- $meld = $error_desr;
-
- phpgwapi_cache::message_set($error_desr, 'error');
- //Vis feilmelding
-// echo $meld;
-
- //Lagre feilmelding
- $this->log_error($batchid,$error_desr);
- }
-
- function RullTilbake($Filnavn,$Dato)
- {
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat = str_replace(".","",$dateformat);
- $dateformat = str_replace("-","",$dateformat);
- $dateformat = str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/', $Dato);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- /* $date1 = mktime (2,0,0,$month,$day,$year);
- if ($date1)
- {
- $Dato=$date1;
- }
-
- $Dato= date("M d Y",$Dato);
- */
-
-
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
- $this->db->transaction_begin();
-
- for ($i=0;$i<count($BilagOverf);$i++)
- {
- $this->bilag_update_overf($BilagOverf[$i]);
-
-
- if($BilagOverf[$i]['pmwrkord_code'])
- {
-
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
-
- $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
-
- if ($BilagOverf[$i]['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
-
- $operator='-';
-
-
$this->soXport->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
- }
-
- //Slett fra avviks tabell
- //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-
- //Slett fra arkiv
-
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
-
- $antall = $antall + 1;
- }
-
- if($antall > 0)
- {
- $fil_katalog =
$this->config->config_data['export']['path'];
-
- if(unlink ($fil_katalog. '/' . $Filnavn))
- {
- $this->db->transaction_commit();
- $receipt['message'][]= array('msg' =>
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
- $receipt['message'][]= array('msg' =>
lang('File %1 is deleted',$Filnavn));
- }
- else
- {
- $this->db->transaction_abort();
- $receipt['message'][]= array('msg' =>
'Noe gikk galt!');
- }
- }
- else
- {
- $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
- }
- return $receipt;
- }
-
-
- function LagFilnavn ($batchid,$pre_transfer='')
- {
- if($pre_transfer)
- {
- $fil_katalog =
$this->config->config_data['export']['pre_path'];
-
- // Slett gamle filer
-
- if(!$this->old_files_deleted)
- {
- for ($i=0;$i<13;$i++)
- {
- @unlink($fil_katalog . '/FDA_'
. $i. '.TXT');
- }
-
- $this->old_files_deleted= True;
- }
-
-
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDA_' . $i.
'.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($i < 13);
-
- }
- else
- {
- $fil_katalog =
$this->config->config_data['export']['path'];
- $continue = True;
- $i = 1;
- do
- {
- $Filnavn = $fil_katalog . '/FDB' .
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- $i++;
- }
- while ($continue);
- }
-
-
- //Ingen løpenr er ledige, gi feilmelding
- return False;
- }
-
-
- private function
get_vouchers_to_transfer($periode,$pre_transfer=false)
- {
- if($pre_transfer)
- {
- $sql= "SELECT sum(belop) as belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND utbetalingsigndato IS
NULL GROUP BY bilagsnr, fakturanr";
- }
- else
- {
- $sql="SELECT sum(belop) as belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS
NOT NULL AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
- }
-
- $this->db->query($sql,__LINE__,__FILE__);
-
- $values = array();
- while ($this->db->next_record())
- {
- $values[] = array
- (
- 'belop' =>
$this->db->f('belop'),
- 'bilagsnr' =>
$this->db->f('bilagsnr'),
- 'fakturanr' =>
$this->db->f('fakturanr'),
- );
- }
-
-
- foreach ($values as &$entry)
- {
- $sql= "SELECT fm_ecobilag.*,fm_ecouser.initials
as saksbehandler FROM fm_ecobilag {$this->join} fm_ecouser ON
fm_ecobilag.budsjettansvarligid=fm_ecouser.lid"
- . " WHERE bilagsnr='{$entry['bilagsnr']}' AND
fakturanr = '{$entry['fakturanr']}'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
-
- $entry['id']
= $this->db->f('id');
- $entry['kidnr']
= $this->db->f('kidnr');
- $entry['typeid']
= $this->db->f('typeid');
- $entry['kildeid']
= $this->db->f('kildeid');
- $entry['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $entry['fakturadato'] =
$this->db->f('fakturadato');
- $entry['periode']
= $this->db->f('periode');
- $entry['forfallsdato'] =
$this->db->f('forfallsdato');
- $entry['fakturanr']
= $this->db->f('fakturanr');
- $entry['spbudact_code'] =
$this->db->f('spbudact_code');
- $entry['regtid']
= $this->db->f('regtid');
- $entry['artid']
= $this->db->f('artid');
- $entry['godkjentbelop'] =
$entry['belop'];
- $entry['spvend_code'] =
$this->db->f('spvend_code');
- $entry['dima']
= $this->db->f('dima');
- $entry['dimb']
= $this->db->f('dimb');
- $entry['mvakode']
= $this->db->f('mvakode');
- $entry['dimd']
= $this->db->f('dimd');
- $entry['dime']
= $this->db->f('dime');
- $entry['oppsynsmannid'] =
$this->db->f('oppsynsmannid');
- $entry['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
- $entry['budsjettansvarligid'] =
$this->db->f('budsjettansvarligid');
- $entry['oppsynsigndato'] =
$this->db->f('oppsynsigndato');
- $entry['saksigndato'] =
$this->db->f('saksigndato');
- $entry['budsjettsigndato'] =
$this->db->f('budsjettsigndato');
- $entry['merknad']
= $this->db->f('merknad');
- $entry['line_text']
= $this->db->f('line_text');
- $entry['splitt']
= $this->db->f('splitt');
- $entry['utbetalingid'] =
$this->db->f('utbetalingid');
- $entry['utbetalingsigndato'] =
$this->db->f('utbetalingsigndato');
- $entry['saksbehandler'] =
$this->db->f('saksbehandler');
- $entry['invoice_line']
= $this->get_invoice($entry['bilagsnr'], $entry['fakturanr']);
-
- }
-
- return $values;
- }
-
-
- //Velg ut alle underbilag
-
- private function get_invoice($bilagsnr, $fakturanr)
- {
- if(!$fakturanr)
- {
- throw new Exception('Mangler fakturanr');
- }
-
- $sql= "SELECT fm_ecobilag.*
,fm_part_of_town.district_id"
- . " FROM (fm_location1 {$this->join} fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)"
- . " {$this->join} fm_ecobilag ON fm_location1.loc1 =
fm_ecobilag.loc1"
- . " WHERE bilagsnr='$bilagsnr' AND fakturanr =
'{$fakturanr}'";
-
- $this->db2->query($sql,__LINE__,__FILE__);
-
- $values = array();
- while ($this->db2->next_record())
- {
- $values[] = array
- (
- 'id'
=> $this->db2->f('id'),
- 'bilagsnr'
=> $this->db2->f('bilagsnr'),
- 'kidnr'
=> $this->db2->f('kidnr'),
- 'typeid'
=> $this->db2->f('typeid'),
- 'kildeid'
=> $this->db2->f('kildeid'),
- 'pmwrkord_code' =>
$this->db2->f('pmwrkord_code'),
- 'belop'
=> $this->db2->f('belop'),
- 'fakturadato' =>
$this->db2->f('fakturadato'),
- 'periode'
=> $this->db2->f('periode'),
- 'forfallsdato' =>
$this->db2->f('forfallsdato'),
- 'fakturanr'
=> $this->db2->f('fakturanr'),
- 'spbudact_code' =>
$this->db2->f('spbudact_code'),
- 'regtid'
=> $this->db2->f('regtid'),
- 'artid'
=> $this->db2->f('artid'),
- 'godkjentbelop' =>
$this->db2->f('godkjentbelop'),
- 'spvend_code' =>
$this->db2->f('spvend_code'),
- 'dima'
=> $this->db2->f('dima'),
- 'loc1'
=> $this->db2->f('loc1'),
- 'dimb'
=> $this->db2->f('dimb'),
- 'mvakode'
=> $this->db2->f('mvakode'),
- 'dimd'
=> $this->db2->f('dimd'),
- 'dime'
=> $this->db2->f('dime'),
- 'project_id' =>
$this->db2->f('project_id'),
- 'kostra_id'
=> $this->db2->f('kostra_id'),
- 'oppsynsmannid' =>
$this->db2->f('oppsynsmannid'),
- 'saksbehandlerid' =>
$this->db2->f('saksbehandlerid'),
- 'budsjettansvarligid' =>
$this->db2->f('budsjettansvarligid'),
- 'oppsynsigndato' =>
$this->db2->f('oppsynsigndato'),
- 'saksigndato' =>
$this->db2->f('saksigndato'),
- 'budsjettsigndato' =>
$this->db2->f('budsjettsigndato'),
- 'merknad'
=> $this->db2->f('merknad'),
- 'line_text'
=> $this->db2->f('line_text'),
- 'splitt'
=> $this->db2->f('splitt'),
- 'utbetalingid' =>
$this->db2->f('utbetalingid'),
- 'utbetalingsigndato' =>
$this->db2->f('utbetalingsigndato'),
- 'district_id' =>
$this->db2->f('district_id'),
- 'item_type'
=> $this->db2->f('item_type'),
- 'item_id'
=> $this->db2->f('item_id')
- );
-
- }
-
- return $values;
- }
-
-
- function
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
- {
- $BilagId = 'NULL';
-
- //Bestem filnavn
-
-
- $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
- if (!$Filnavn)
- {
- $message='LagFilnavn: Alle loepenr for filnavn
er i bruk';
- $this->errorhandler($batchid,$message);
- phpgwapi_cache::message_set($message, 'error');
- return false;
- }
-
- //Test om filen kan opprettes og skrives til
- if (@fopen($Filnavn, "wb"))
- {
- unlink($Filnavn);
- }
- else
- {
- phpgwapi_cache::message_set('kan ikke lagre til
fil: '. $Filnavn, 'error');
- return false;
- }
-
- //Velg ut alle hoved bilag som skal overføres
-
- $this->db->transaction_begin();
-
- $oRsBilag =
$this->get_vouchers_to_transfer($periode,$pre_transfer);
-
- $buffer = '';
-
- foreach($oRsBilag as $invoice)
- {
-
- $tranfser_bilag[] = $invoice['bilagsnr'];
-
- //Bestem belops felt
- if ($invoice['splitt']==0)
- {
- //Bilaget er ikke splittet
- if ($invoice['godkjentbelop'] <>
$invoice['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- //Logg til avviks tabell
- if ($download=='on' &&
!$pre_transfer)
- {
-//
$this->soXport->log_to_deviation_table($invoice);
- }
- }
- else
- {
- $BelopFelt = 'belop';
- }
- }
-
- //Bilaget er splittet
- if ($invoice['godkjentbelop'] ==
$invoice['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- }
- else
- {
- //Ikke lovlig
- $message = lang('Avvik mellom
fakturabelop og godkjent belop pa splittet faktura!');
- $this->errorhandler($batchid,$message);
- return $message;
- }
-
- $Belop_motpost =$invoice[$BelopFelt] *100;
-
- //Skriv hovedbilag
-
- $Buntnr =
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass:
1 - 12
- $Forsystem = 'BI';// verdi: BI, type: c2,
plass: 13 - 14
-
- $Transtype = 'GL';// verdi: GL, type: c2,
plass: 17 - 18
- $Firmakode = sprintf("%-2s",'BB');//
verdi: Firmakode, type: c2, plass: 19 - 20
-
- $Valuteringsdato=
date(Ymd,strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass:
251 - 258
- $Bilagsdato =
date(Ymd,strtotime($invoice['fakturadato'])) ;// verdi: Dato, type: date,
plass: 259 - 266
- $Bilagsnr =
sprintf("%-9s",substr($invoice['bilagsnr'],-8));// verdi: Bilagsnummer, type:
i4, plass: 267 - 275
- // $_periode =
sprintf("%06s",date(Y,strtotime($invoice['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
- $ESL = sprintf("%1s",'');// verdi:
Blank, type: i+C481, plass: 282 - 282
-
- if($pre_transfer)
- {
- if(abs(date('m',time()) - $periode) >1)
- {
- $temp_period = date('m',time())
-1;
-
- if($temp_period == 0)
- {
- $temp_period =1;
- }
-
- $temp_year = date('Y',time());
- }
- else
- {
- $temp_period = $periode;
- $temp_year =
date('Y',strtotime($invoice['fakturadato']));
- }
-
- $_periode =
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode,
type: i4, plass: 276 - 281
- $Bilagsart =
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
- $Forfall = '20991231';// verdi:
Forfallsdato , type: date, plass: 298 - 305
- }
- else
- {
- $_periode = $periode;
-
- $Bilagsart =
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
- $Forfall =
date(Ymd,strtotime($invoice['forfallsdato']));// verdi: Forfallsdato , type:
date, plass: 298 - 305
- }
-
- $Rab_forf = sprintf("%-8s",'');// verdi:
Blank, type: date, plass: 306 - 313
- $Rabatt = sprintf("%020s",'');// verdi:
Blank, type: money, plass: 314 - 333
- $Avt_Kon = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 334 - 341
-
- $Kid =
sprintf("%-27s",$invoice['kidnr']);// verdi: Kid, type: c27, plass: 351 - 377
- $Bet_overforing = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 378 - 379
- $Status = 'N';// verdi: N, type: c1,
plass: 380 - 380
- $Resk_type = 'P';// verdi: Blank, type:
c1, plass: 381 - 381
- $Resk_nr =
sprintf("%-9s",$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382
- 390
- $Forskudd = '0';// verdi: 0, type: i1,
plass: 391 - 391
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 392 - 400
- $Fakturaref = '000000000';// verdi: 0,
type: i4, plass: 401 - 409
- $Inkassokode = sprintf("%-6s",'');// verdi:
Blank, type: c6, plass: 410 - 415
- $Bet_mottager = sprintf("%-8s",'');// verdi:
Blank, type: c8, plass: 416 - 423
- $Att_ansvarlig =
sprintf("%-6s",utf8_decode($invoice['saksbehandler']));// verdi: Blank, type:
c6, plass: 424 - 429
-
- $vendor_info =
$this->get_vendor_info($invoice['spvend_code']);
-
- if(!$vendor_info['org_nr'])
- {
- $message = 'mangler org_nr for
reskontronr: ' . $invoice['spvend_code'];
- $this->errorhandler($batchid,$message);
- return $message;
- }
-
- if(!$vendor_info['konto_nr'])
- {
- $message = 'mangler konto for
reskontronr: ' . $invoice['spvend_code'];
- $this->errorhandler($batchid,$message);
- return $message;
- }
-
- $Resk_navn =
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass:
430 - 479
- $Postadresse = sprintf("%-160s",'');//
verdi: Blank, type: c160, plass: 480 - 639
- $Stat_Provins = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 640 - 689
- $Sted = sprintf("%-50s",'');// verdi:
Blank, type: c50, plass: 690 - 739
- $Bank_Postgiro_kontonr =
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi:
konto_nr, type: c35, plass: 740 - 774
- $Betalingsmate = sprintf("%-2s",'');// verdi:
Blank, type: c2, plass: 775 - 776
- $Mva_reg_nr = sprintf("%-25s",'');// verdi:
Blank, type: c25, plass: 777 - 801
- $Postnummer = sprintf("%-15s",'');// verdi:
Blank, type: c15, plass: 802 - 816
- $Val_dok = sprintf("%-3s",'');// verdi:
Blank, type: c3, plass: 817 - 819
-
-
- $underbilag_count=
count($invoice['invoice_line']);
- $last_record = $underbilag_count - 1;
-
- //Velg ut alle underbilag
- foreach($invoice['invoice_line'] as $_key =>
$invoice_line)
- {
-
- $BilagId = $invoice_line['id'];
-
- $Belop = $invoice_line[$BelopFelt]*100;
- $Belop_ = $Belop;
-
- if($Belop < 0)
- {
- $Belop = abs($Belop);
- $Belop =
sprintf("%019s",$Belop);
- $Belop = '-' . $Belop;
- }
- else
- {
- $Belop =
sprintf("%019s",$Belop);
- $Belop = '+' . $Belop;
- }
-
-
- if($invoice_line['pmwrkord_code'])
- {
-
-
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
-
- //Oppdater beløp på arbeidsordre
- if ($download=='on' &&
!$pre_transfer)
- {
- if
($invoice_line['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
- $operator='+';
-
- if(!$this->debug)
- {
-
$this->soXport->correct_actual_cost($invoice_line['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
- }
- }
- }
-
- //Overfør til fm_ecobilagoverf
- $invoice_line['filnavn']=
basename($Filnavn);
-
$invoice_line['ordrebelop']=$invoice_line[$BelopFelt];
-
- //dersom det mangler budsjett konto -
kun aktuelt for ikke godkjent - sett konto til 2899999
-
- if(!$invoice_line['spbudact_code'] &&
$pre_transfer)
- {
- $invoice_line['spbudact_code']
= 12304361;
- }
-
-
- //dersom ikke gyldig objekt - kun
aktuelt for ikke godkjent - sett objekt til 9999
-
- if(!($invoice_line['kostra_id']>0) &&
$pre_transfer)
- {
- $invoice_line['kostra_id'] =
26550;
- $invoice_line['mvakode'] = 0;
- $invoice_line['dima'] = 9999;
- }
-
- $Konto =
sprintf("%08s",$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass:
21 - 28
- $Dim_1 =
sprintf("%8s",$invoice_line['district_id']);// verdi: Ansvarssted, type: c8,
plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",$invoice_line['kostra_id']);// verdi: Tjeneste, type: c8, plass:
37 - 44
-
- if($pre_transfer)
- {
- $Dim_3 =
sprintf("%-8s",substr($invoice_line['dima'],0,4));// verdi: Objekt, type: c8,
plass: 45 - 52
- }
- else
- {
- $Dim_3 =
sprintf("%-8s",substr($invoice_line['dima'],0,6));// verdi: Objekt-bygg, type:
c8, plass: 45 - 52
- }
-
-
- $Dim_4 = sprintf("%-8s",'');//
verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",$invoice_line['project_id']);// verdi: Prosjekt, type: c12,
plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",$invoice_line['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 = sprintf("%-4s",'');//
verdi: Blank, type: c4, plass: 77 - 80
-
-
$Avgiftskode=sprintf("%-2s",$invoice_line['mvakode']);// verdi: Avgiftskode,
type: c2, plass: 81 - 82
-
- $Avgiftssystem = sprintf("%2s",'');//
verdi: Blank, type: c2, plass: 83 - 84
- $Valutakode ='NOK';// verdi: NOK,
type: c3, plass: 85 - 87
- $Debet_Kredit = sprintf("%2s",'');//
verdi: Blank, type: i2, plass: 88 - 89
- $Valutabelop = $Belop;// verdi:
Beløp, type: money, plass: 90 - 109
- $Belop_i_firmavaluta=$Belop;// verdi:
Beløp, type: money, plass: 110 - 129
- $Antall = sprintf("%11s",'');//
verdi: Blank, type: i4, plass: 130 - 140
- $Belop2 = sprintf("%20s",'');//
verdi: Blank, type: f8, plass: 141 - 160
- $Belop3 = sprintf("%20s",'');//
verdi: Blank, type: money, plass: 161 - 180
-
- // $Belop4 (også kalt "money3" )blir brukt
for identifisere overføring på tvers av filer.
- $Belop4 =
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
-
-
- if($invoice_line['pmwrkord_code'])
- {
- $Tekst =
sprintf("%-50s",substr(utf8_decode($this->get_order_title($invoice_line['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
- else
- {
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
-
- $Fakturanr =
sprintf("%-15s",substr(utf8_decode($invoice_line['fakturanr']), 0, 15));//
verdi: Fakturanr, type: c15, plass: 283 - 297
-
- $Ordrenummer =
sprintf("%-9s",$invoice_line['pmwrkord_code']);// verdi: Infodoc ordrenr, type:
i4, plass: 342 - 350
-
-
- //Kopier verdier
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
- {
-
$this->soXport->add_OverfBilag($invoice_line);
- }
-
- //Skriv til fil
-
- $buffer .= $Buntnr . $Forsystem .
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall .
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing . $Status .
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr . $Betalingsmate
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
-
- if($_key==$last_record)
- {
- $Konto =
sprintf("%-8s",'2327010');// verdi: Art, type: c8, plass: 21 - 28
- $Dim_1 =
sprintf("%-8s",'');// verdi: Ansvarssted, type: c8, plass: 29 - 36
- $Dim_2 =
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
- $Dim_3 =
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
- $Dim_4 =
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
- $Dim_5 =
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
- $Dim_6 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
- $Dim_7 =
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
- // $Fakturanr =
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
- $Ordrenummer =
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
-
- if($Belop_motpost < 0)
- {
- $Belop_motpost =
sprintf("%019s",abs($Belop_motpost));
- $Belop_motpost = '+' .
$Belop_motpost;
- }
- else
- {
- $Belop_motpost =
sprintf("%019s",$Belop_motpost);
- $Belop_motpost = '-' .
$Belop_motpost;
-
- }
-
- $Transtype = 'AP';//
verdi: GL, type: c2, plass: 17 - 18
- $Valutabelop =
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
-
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Beløp, type: money, plass: 110 -
129
-
- $buffer .= $Buntnr . $Forsystem
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 .
$Dim_4 .
- $Dim_5 . $Dim_6 . $Dim_7 .
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop .
- $Belop_i_firmavaluta . $Antall
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato .
- $Bilagsnr . $_periode . $ESL .
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer .
- $Kid . $Bet_overforing .
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref .
- $Inkassokode . $Bet_mottager .
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted .
- $Bank_Postgiro_kontonr .
$Betalingsmate . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
- }
-
- //Slett post i fm_ecobilag
- if ($download=='on' && !$pre_transfer
&& !$this->debug)
- {
-
$this->soXport->delete_from_fm_ecobilag($invoice_line['id']);
- //Logg transaksjon
-
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice transferred'));
- }
-
- $BilagId = 'NULL';
-
- $antall = $antall + 1;
- }
- }
-
- //Fullfør transaksjon
-
- if ($download=='on' && !$pre_transfer && !$this->debug):
- {
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- if($file_written &&
$this->config->config_data['common']['method']!='ftp'):
- {
- $transfer_ok = True;
- }
- elseif($file_written):
- {
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
- }
- endif;
-
- if($transfer_ok)
- {
- $this->db->transaction_commit();
- $message = 'Godkjent: periode:
'.$_periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' .
$Filnavn;
- phpgwapi_cache::message_set($message,
'message');
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt med
overforing av godkjendte fakturaer!';
- phpgwapi_cache::message_set($message,
'error');
- }
- }
- elseif($download=='on' && $pre_transfer &&
!$this->debug):
- {
-
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- if($file_written &&
$this->config->config_data['common']['method']!='ftp'):
- {
- $transfer_ok = True;
- }
- elseif($file_written):
- {
- $transfer_ok =
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
- }
- endif;
-
- if($transfer_ok)
- {
-
$this->soXport->update_actual_cost_from_archive($this->orders_affected);
-
- $this->db->transaction_commit();
- $message = 'Ankomstregistrering:
periode: '.$periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' .
$Filnavn;
- phpgwapi_cache::message_set($message,
'message');
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt med
ankomstregistrering!';
- phpgwapi_cache::message_set($message,
'error');
- }
- }
- else:
- {
- $this->db->transaction_abort();
-
- _debug_array($Filnavn);
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
-
- if(fclose($fp))
- {
- $file_written=True;
- }
-
- echo "<pre>{$buffer}</pre>";
- }
- endif;
- }
-
- function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
- {
-
-
if($this->config->config_data['common']['method']=='ftp')
- {
- $ftp = $this->phpftp_connect();
-
- $basedir =
$this->config->config_data['common']['remote_basedir'];
- if($basedir)
- {
- $newfile = $basedir . '/' .
basename($Filnavn);
- }
- else
- {
- $newfile = basename($Filnavn);
- }
-
- if (ftp_put($ftp,$newfile, $Filnavn,
FTP_BINARY))
- {
- for
($i=0;$i<count($tranfser_bilag);$i++)
- {
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice
pre_transferred %1',basename($Filnavn)));
- }
- $transfer_ok = True;
- }
- else
- {
- for
($i=0;$i<count($tranfser_bilag);$i++)
- {
-
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to
pre_transfere %1 to agresso',basename($Filnavn)));
- }
- $transfer_ok = False;
- }
- if(!$transfer_ok)
- {
- unlink($Filnavn);
- }
-
- ftp_quit($ftp);
- }
- return $transfer_ok;
- }
-
- function phpftp_connect()
- {
- $host =
$this->config->config_data['common']['host'];
- $user =
$this->config->config_data['common']['user'];
- $password =
$this->config->config_data['common']['password'];
-
-// echo "connecting to $host with $user and $pass\n <br>";
- $ftp = ftp_connect($host);
- if($ftp)
- {
- if (ftp_login($ftp,$user,$password))
- {
- return $ftp;
- }
- }
- }
- }
Modified:
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
===================================================================
---
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
2014-02-21 10:19:58 UTC (rev 11728)
+++
branches/Version-1_0-branch/property/inc/export/default/Agresso_Bergen_Kostfordeling
2014-02-21 10:21:38 UTC (rev 11729)
@@ -43,6 +43,7 @@
protected $db2;
protected $soXport;
protected $config;
+ protected $invoice_approval = 2;
function __construct()
{
@@ -51,12 +52,21 @@
$this->db2 = clone($this->db);
$this->soXport = CreateObject('property.soXport');
$this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
+ $this->invoice_approval =
isset($this->config->config_data['common']['invoice_approval']) &&
$this->config->config_data['common']['invoice_approval'] ?
$this->config->config_data['common']['invoice_approval'] : 2;
}
function select_periods_with_invoice_to_transfer()
{
- $sql = "SELECT DISTINCT periode from fm_ecobilag WHERE
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is
not null) and utbetalingsigndato is not null";
+ if($this->invoice_approval == 2)
+ {
+ $sql = "SELECT DISTINCT periode FROM
fm_ecobilag WHERE budsjettsigndato IS NOT NULL AND (saksigndato IS NOT NULL or
oppsynsigndato IS NOT NULL) AND utbetalingsigndato IS NOT NULL";
+ }
+ else
+ {
+ $sql = "SELECT DISTINCT periode FROM
fm_ecobilag WHERE budsjettsigndato IS NOT NULL AND utbetalingsigndato IS NOT
NULL";
+ }
+
$periode = array();
$this->db->query($sql, __LINE__, __FILE__);
while($this->db->next_record())
@@ -449,7 +459,14 @@
private function get_vouchers_to_transfer($periode)
{
- $sql = "SELECT sum(belop) as belop, fakturanr, bilagsnr
FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS NOT NULL
AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
+ if($this->invoice_approval == 2)
+ {
+ $sql = "SELECT sum(belop) AS belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS
NOT NULL AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
+ }
+ else
+ {
+ $sql = "SELECT sum(belop) AS belop, fakturanr,
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS
NOT NULL AND utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
+ }
$this->db->query($sql, __LINE__, __FILE__);
@@ -659,7 +676,7 @@
$Valuteringsdato = date(Ymd,
strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass: 251 - 258
$Bilagsdato = date(Ymd,
strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass: 259 - 266
- $Bilagsnr = sprintf("%-9s",
substr($invoice['bilagsnr'], -8));// verdi: Bilagsnummer, type: i4, plass: 267
- 275
+ $Bilagsnr = sprintf("%-9s",
'');// verdi: Bilagsnummer, type: i4, plass: 267 - 275
// $_periode =
sprintf("%06s",date(Y,strtotime($invoice['fakturadato'])) .
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
$ESL = sprintf("%1s",
'');// verdi: Blank, type: i+C481, plass: 282 - 282
@@ -675,8 +692,12 @@
$Kid = sprintf("%-27s",
$invoice['kidnr']);// verdi: Kid, type: c27, plass: 351 - 377
$Bet_overforing = sprintf("%-2s", '');//
verdi: Blank, type: c2, plass: 378 - 379
$Status = 'N';// verdi: N,
type: c1, plass: 380 - 380
- $Resk_type = 'P';// verdi: Blank,
type: c1, plass: 381 - 381
- $Resk_nr = sprintf("%-9s",
$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382 - 390
+// $Resk_type = 'P';// verdi: Blank,
type: c1, plass: 381 - 381
+ $Resk_type = ' ';// verdi: Blank,
type: c1, plass: 381 - 381
+
+// $Resk_nr = sprintf("%-9s",
$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382 - 390
+ $Resk_nr = sprintf("%-9s",
'');// verdi: Blank., type: i4, plass: 382 - 390
+
$Forskudd = '0';// verdi: 0,
type: i1, plass: 391 - 391
$Fakturaref = '000000000';//
verdi: 0, type: i4, plass: 392 - 400
$Fakturaref = '000000000';//
verdi: 0, type: i4, plass: 401 - 409
@@ -762,8 +783,8 @@
$invoice_line['filnavn'] =
basename($Filnavn);
$invoice_line['ordrebelop'] =
$invoice_line[$BelopFelt];
- $Konto = sprintf("%08s",
$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass: 21 - 28
- $Dim_1 = sprintf("%08s",
$invoice_line['dimb']);// 64040 verdi: Ansvarssted, type: c8, plass: 29 - 36
+ $Konto = sprintf("%-8s",
$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass: 21 - 28
+ $Dim_1 = sprintf("%-8s",
"0{$invoice_line['dimb']}");// 64040 verdi: Ansvarssted, type: c8, plass: 29 -
36
$Dim_2 = sprintf("%-8s",
$invoice_line['kostra_id']);// verdi: Tjeneste, type: c8, plass: 37 - 44
$Dim_3 = sprintf("%-8s",
substr($invoice_line['dima'], 0, 6));// verdi: Objekt-bygg, type: c8, plass: 45
- 52
@@ -785,21 +806,12 @@
$Belop2 =
sprintf("%20s", '');// verdi: Blank, type: f8, plass: 141 - 160
$Belop3 =
sprintf("%20s", '');// verdi: Blank, type: money, plass: 161 - 180
// $Belop4 (også kalt "money3"
)blir brukt for identifisere overføring på tvers av filer.
- $Belop4 =
sprintf("%20s", $batchid);// verdi: Blank, type: money, plass: 181 - 200 -
batch_id høyre justert
+ $Belop4 =
sprintf("%20s", '');// verdi: Blank, type: money, plass: 181 - 200 - batch_id
høyre justert
- /*
- if($invoice_line['pmwrkord_code'])
- {
- $Tekst =
sprintf("%-50s",substr(utf8_decode($this->get_order_title($invoice_line['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
- else
- {
- $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- }
- */
- $Tekst = sprintf("%-50s",
substr($invoice_line['fakturanr'], 0, 50));
+ $Tekst = sprintf("%-50s",
substr("{$invoice['spvend_code']}::{$invoice_line['fakturanr']}", 0, 50));
- $Fakturanr = sprintf("%-15s",
substr(utf8_decode($invoice_line['fakturanr']), 0, 15));// verdi: Fakturanr,
type: c15, plass: 283 - 297
+ // $Fakturanr = sprintf("%-15s",
substr(utf8_decode($invoice_line['fakturanr']), 0, 15));// verdi: Fakturanr,
type: c15, plass: 283 - 297
+ $Fakturanr = sprintf("%-15s", '');//
verdi: Fakturanr, type: c15, plass: 283 - 297
$Ordrenummer = sprintf("%-9s",
$invoice_line['pmwrkord_code']);// verdi: Infodoc ordrenr, type: i4, plass: 342
- 350
//Kopier verdier
@@ -821,7 +833,7 @@
if($_key == $last_record)
{
$Konto =
sprintf("%-8s", '2139915');// verdi: Art, type: c8, plass: 21 - 28
- $Dim_1 =
sprintf("%08s", $invoice_line['dimb']);//sprintf("%-8s",'');// verdi:
Ansvarssted, type: c8, plass: 29 - 36
+ // $Dim_1 =
sprintf("%-8s", $invoice_line['dimb']);//sprintf("%-8s",'');// verdi:
Ansvarssted, type: c8, plass: 29 - 36
$Dim_2 =
sprintf("%-8s", '');// verdi: Tjeneste, type: c8, plass: 37 - 44
$Dim_3 =
sprintf("%-8s", '');// verdi: Objekt, type: c8, plass: 45 - 52
$Dim_4 =
sprintf("%-8s", '');// verdi: Ressurs, type: c8, plass: 53 - 60
@@ -831,17 +843,17 @@
$Fakturanr =
sprintf("%-15s", '');// verdi: Fakturanr, type: c15, plass: 283 - 297
$Ordrenummer = sprintf("%-9s",
'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
// $Tekst =
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
verdi: Tekst, type: text (50), plass: 201 - 250
- $Tekst =
sprintf("%-50s", substr($invoice_line['fakturanr'], 0, 50));// verdi: Tekst,
type: text (50), plass: 201 - 250
+ // $Tekst =
sprintf("%-50s", '');// verdi: Tekst, type: text (50), plass: 201 - 250
//Ikke fortegnskifte for
kostfordeling (GL)
if($Belop_motpost < 0)
{
$Belop_motpost =
sprintf("%019s", abs($Belop_motpost));
- $Belop_motpost = '-'
. $Belop_motpost;
+ $Belop_motpost =
"+{$Belop_motpost}";
}
else
{
$Belop_motpost =
sprintf("%019s", $Belop_motpost);
- $Belop_motpost = '+'
. $Belop_motpost;
+ $Belop_motpost =
"-{$Belop_motpost}";
}
$Transtype
= 'GL';// verdi: GL, type: c2, plass: 17 - 18
Deleted: branches/Version-1_0-branch/property/inc/export/default/Ecolink
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Ecolink
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/export/default/Ecolink
2014-02-21 10:21:38 UTC (rev 11729)
@@ -1,662 +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 export
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class export_conv
- {
- //var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
- function export_conv()
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- // $this->db = $GLOBALS['phpgw']->db;
-
- $this->soXport = CreateObject('property.soXport');
- $this->config =
CreateObject('phpgwapi.config','property');
- $this->config->read_repository();
- $this->bocommon =
CreateObject($this->currentapp.'.bocommon');
- $this->db = $this->bocommon->new_db();
- }
-
- function select_periods_with_invoice_to_transfer()
- {
- $sql= "SELECT DISTINCT periode from fm_ecobilag where
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is
not null) and utbetalingsigndato is not null ";
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $periode[] = $this->db->f('periode');
- }
- return $periode;
- }
-
- function log_end($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','End transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function log_error($batchid,$error_desr)
- {
- $tid=date($this->datetimeformat);
- $sql= "insert into fm_ecologg
(batchid,ecobilagid,status,melding,tid) values
('$batchid',NULL,0,'$error_desr','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function increment_batchid()
- {
-
- $this->db->query("update fm_idgenerator set value =
value + 1 where name = 'Ecobatchid'");
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
- $this->db->next_record();
- $bilagsnr = $this->db->f('value');
- return $bilagsnr;
-
- }
-
- function next_batchid()
- {
-
- $this->db->query("select value from fm_idgenerator
where name = 'Ecobatchid'");
- $this->db->next_record();
- $batchid = $this->db->f('value')+1;
-
- return $batchid;
- }
-
- //Lagre start melding
- function log_start($batchid)
- {
- $tid=date($this->soXport->datetimeformat);
- $sql= "insert into fm_ecologg (batchid,melding,tid)
values ('$batchid','Start transfer','$tid')";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- function select_invoice_roleback($day,$month,$year,$Filnavn)
- {
-
- switch($GLOBALS['phpgw_info']['server']['db_type'])
- {
- case 'mssql':
- $datepart_year =
"datepart(year,overftid)";
- $datepart_month =
"datepart(month,overftid)";
- $datepart_day =
"datepart(day,overftid)";
- break;
- case 'mysql':
- $datepart_year =
"YEAR(overftid)";
- $datepart_month =
"MONTH(overftid)";
- $datepart_day =
"DAYOFMONTH(overftid)";
- break;
- case 'pgsql':
- $datepart_year =
"date_part('year',overftid)";
- $datepart_month =
"date_part('month',overftid)";
- $datepart_day =
"date_part('day',overftid)";
- break;
- case 'postgres':
- $datepart_year =
"date_part('year',overftid)";
- $datepart_month =
"date_part('month',overftid)";
- $datepart_day =
"date_part('day',overftid)";
- break;
- }
-
-
- $sql="select * from fm_ecobilagoverf where
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and
$datepart_day= $day";
- $this->db->query($sql,__LINE__,__FILE__);
-
- $i = 0;
- while ($this->db->next_record())
- {
- $invoice_roleback[$i]['id'] =
$this->db->f('id');
- $invoice_roleback[$i]['bilagsnr'] =
$this->db->f('bilagsnr');
- $invoice_roleback[$i]['kidnr'] =
$this->db->f('kidnr');
- $invoice_roleback[$i]['typeid'] =
$this->db->f('typeid');
- $invoice_roleback[$i]['kildeid'] =
$this->db->f('kildeid');
- $invoice_roleback[$i]['pmwrkord_code'] =
$this->db->f('pmwrkord_code');
- $invoice_roleback[$i]['belop'] =
$this->db->f('belop');
- $invoice_roleback[$i]['fakturadato'] =
$this->db->f('fakturadato');
- $invoice_roleback[$i]['periode'] =
$this->db->f('periode');
- $invoice_roleback[$i]['forfallsdato'] =
$this->db->f('forfallsdato');
- $invoice_roleback[$i]['fakturanr'] =
$this->db->f('fakturanr');
- $invoice_roleback[$i]['spbudact_code'] =
$this->db->f('spbudact_code');
- $invoice_roleback[$i]['regtid'] =
$this->db->f('regtid');
- $invoice_roleback[$i]['artid'] =
$this->db->f('artid');
- $invoice_roleback[$i]['godkjentbelop'] =
$this->db->f('godkjentbelop');
- $invoice_roleback[$i]['spvend_code'] =
$this->db->f('spvend_code');
- $invoice_roleback[$i]['dima'] =
$this->db->f('dima');
- $invoice_roleback[$i]['loc1'] =
$this->db->f('loc1');
- $invoice_roleback[$i]['dimb'] =
$this->db->f('dimb');
- $invoice_roleback[$i]['mvakode'] =
$this->db->f('mvakode');
- $invoice_roleback[$i]['dimd'] =
$this->db->f('dimd');
- if($this->db->f('oppsynsmannid'))
- {
- $invoice_roleback[$i]['oppsynsmannid']
= $this->db->f('oppsynsmannid');
- }
- if($this->db->f('saksbehandlerid'))
- {
-
$invoice_roleback[$i]['saksbehandlerid'] =
$this->db->f('saksbehandlerid');
- }
-
- $invoice_roleback[$i]['budsjettansvarligid']
= $this->db->f('budsjettansvarligid');
-
- if($this->db->f('oppsynsigndato'))
- {
- $invoice_roleback[$i]['oppsynsigndato']
= $this->db->f('oppsynsigndato');
- }
- if($this->db->f('saksigndato'))
- {
- $invoice_roleback[$i]['saksigndato']
= $this->db->f('saksigndato');
- }
-
- $invoice_roleback[$i]['budsjettsigndato']
= $this->db->f('budsjettsigndato');
- $invoice_roleback[$i]['merknad'] =
$this->db->f('merknad');
- $invoice_roleback[$i]['splitt'] =
$this->db->f('splitt');
- $invoice_roleback[$i]['ordrebelop'] =
$this->db->f('ordrebelop');
- $invoice_roleback[$i]['utbetalingid'] =
$this->db->f('utbetalingid');
- $invoice_roleback[$i]['utbetalingsigndato']
= $this->db->f('utbetalingsigndato');
- $i++;
- }
- return $invoice_roleback;
- }
-
-
- //roleback function
- function bilag_update_overf($BilagOverf)
- {
- $values= array(
- $BilagOverf['pmwrkord_code'],
- $BilagOverf['bilagsnr'],
- $BilagOverf['splitt'],
- $BilagOverf['kildeid'],
- $BilagOverf['kidnr'],
- $BilagOverf[typeid],
- $BilagOverf['fakturadato'],
- $BilagOverf['forfallsdato'],
- $BilagOverf['regtid'],
- $BilagOverf['artid'],
- $BilagOverf['spvend_code'],
- $BilagOverf['dimb'],
- $BilagOverf['oppsynsmannid'],
- $BilagOverf['saksbehandlerid'],
- $BilagOverf['budsjettansvarligid'],
- $BilagOverf['fakturanr'],
- $BilagOverf['spbudact_code'],
- $BilagOverf['dima'],
- $BilagOverf['loc1'],
- $BilagOverf['dimd'],
- $BilagOverf['mvakode'],
- $BilagOverf['periode'],
- $BilagOverf['merknad'],
- $BilagOverf['utbetalingid'],
- $BilagOverf['oppsynsigndato'],
- $BilagOverf['saksigndato'],
- $BilagOverf['budsjettsigndato'],
- $BilagOverf['utbetalingsigndato'],
- );
-
- $values = $this->db->validate_insert($values);
-
- $sql= "INSERT INTO fm_ecobilag
(pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
- . "
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
- . "
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
- . "
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,belop,godkjentbelop)"
- . " values ($values,"
- . $this->db->money_format($BilagOverf['belop']) . ","
- . $this->db->money_format($BilagOverf['godkjentbelop'])
. ")";
-
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
-
- //Oppdater beløp på arbeidsordre operator="-" ved tilbakerulling
- function
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
- {
- $Belop=$Belop/100;
-
- $sql="update fm_workorder set
$actual_cost_field=$actual_cost_field $operator $Belop where
id='$pmwrkord_code'";
- $this->db->query($sql,__LINE__,__FILE__);
- }
-
- // Hent leverandørklasse
-
- function select_vendor_class($spvend_code)
- {
- $sql= "select klasse from fm_vendor where
id=$spvend_code";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- $pmlabor_code = $this->db->f('klasse');
-
- return $pmlabor_code;
- }
-
- function overfor($download)
- {
- //Generer batch ID
- $batchid = $this->soXport->next_batchid();
- if ($download=='on')
- {
- $this->increment_batchid();
- //Lagre melding
- $this->log_start($batchid);
- }
-
- //Velg ut alle perioder som har bilag som skal overføres
-
- $periode =
$this->select_periods_with_invoice_to_transfer();
-
- for ($i=0;$i<count($periode);$i++)
- {
- $receipt['message'][]= array('msg' =>
$this->OverforPeriode($batchid,$periode[$i],$download));
- }
-
- //Lagre melding
- if ($download=='on')
- {
- $this->log_end($batchid); //Lagre melding
- }
-
- return $receipt;
- }
-
- function errorhandler($error_desr)
- {
- $meld = $error_desr;
-
- //Vis feilmelding
-// echo $meld;
-
- //Lagre feilmelding
- $this->log_error($batchid,$error_desr);
- }
-
- function RullTilbake($Filnavn,$Dato)
- {
- $dateformat =
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
- $dateformat = str_replace(".","",$dateformat);
- $dateformat = str_replace("-","",$dateformat);
- $dateformat = str_replace("/","",$dateformat);
- $y=strpos($dateformat,'y');
- $d=strpos($dateformat,'d');
- $m=strpos($dateformat,'m');
-
- $dateparts = explode('/', $Dato);
- $day = $dateparts[$d];
- $month = $dateparts[$m];
- $year = $dateparts[$y];
- /* $date1 = mktime (2,0,0,$month,$day,$year);
- if ($date1)
- {
- $Dato=$date1;
- }
-
- $Dato= date("M d Y",$Dato);
- */
-
-
$BilagOverf=$this->select_invoice_roleback($day,$month,$year,$Filnavn);
- $this->db->transaction_begin();
-
- for ($i=0;$i<count($BilagOverf);$i++)
- {
- $this->bilag_update_overf($BilagOverf[$i]);
-
-
- if($BilagOverf[$i]['pmwrkord_code'])
- {
- if ($BilagOverf[$i]['artid']==1)
- {
- $Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
- }
- else
- {
- $Belop = sprintf("%01.2f",
-$BilagOverf[$i]['ordrebelop'])*100;
- }
-
- if ($BilagOverf[$i]['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
-
- $operator='-';
-
-
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
- }
-
- //Slett fra avviks tabell
- //
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-
- //Slett fra arkiv
-
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
-
- $antall = $antall + 1;
- }
-
- if($antall > 0)
- {
- $fil_katalog =
$this->config->config_data['export_path'];
-
- if(unlink ($fil_katalog. '/' . $Filnavn))
- {
- $this->db->transaction_commit();
- $receipt['message'][]= array('msg' =>
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
- $receipt['message'][]= array('msg' =>
lang('File %1 is deleted',$Filnavn));
- }
- else
- {
- $this->db->transaction_abort();
- $receipt['message'][]= array('msg' =>
'Noe gikk galt!');
- }
- }
- else
- {
- $receipt['error'][]= array('msg' => lang('Sorry
- None hits'));
- }
- return $receipt;
- }
-
-
- function LagFilnavn ($batchid)
- {
- $fil_katalog =
$this->config->config_data['export_path'];
- //Beregn løpenr
- $StartLopeNr = ($batchid % 30) + 70;
- $LopeNr = $StartLopeNr;
-
- do
- {
- //Konstruer filnavn
- $Filnavn = $fil_katalog . '/DTF1'.
sprintf("%2d",$LopeNr) . '10.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- //Genererer nytt løpenr
- $batchid = $batchid + 1;
- $LopeNr = ($batchid % 30) + 70;
- }
- while ($LopeNr != $StartLopeNr);
-
- //Ingen løpenr er ledige, gi feilmelding
- return False;
- }
-
- function OverforPeriode($batchid,$periode,$download)
- {
- $BilagId = 'NULL';
-
- //Bestem filnavn
-
- $Filnavn = $this->LagFilnavn($batchid);
- if (!$Filnavn)
- {
- $message='LagFilnavn'.lang('Alle løpenr for
filnavn er i bruk!');
- $this->errorhandler($message);
- return $message;
- }
-
- //Test om filen kan opprettes og skrives til
- if (@fopen($Filnavn, "wb"))
- {
- unlink($Filnavn);
- }
- else
- {
- $message='kan ikke lagre til fil: '. $Filnavn
.'<br>';
- return $message;
- }
-
- //Velg ut alle hoved bilag som skal overføres
-
- $oRsBilag=$this->soXport->hoved_bilag($periode);
-
- $this->db->transaction_begin();
-
- $bilag_count= count($oRsBilag);
- for ($k=0;$k<$bilag_count;$k++)
- {
- //Hent leverandørklasse
-
- $pmlabor_code
=$this->select_vendor_class($oRsBilag[$k]['spvend_code']);
-
- //Bestem belops felt
- if ($oRsBilag[$k]['splitt']==0)
- {
- //Bilaget er ikke splittet
- if ($oRsBilag[$k]['godkjentbelop'] <>
$oRsBilag[$k]['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- //Logg til avviks tabell
- if ($download=='on')
- {
-//
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
- }
- }
- else
- {
- $BelopFelt = 'belop';
- }
- }
-
- //Bilaget er splittet
- if ($oRsBilag[$k]['godkjentbelop'] ==
$oRsBilag[$k]['belop'])
- {
- $BelopFelt = 'godkjentbelop';
- }
- else
- {
- //Ikke lovlig
- $message = lang('Avvik mellom
fakturabeløp og godkjent beløp på splittet faktura!');
- $this->errorhandler($message);
- return $message;
- }
-
- //Formater beløp
- if ($oRsBilag[$k]['artid'] == 2)
- {
- $Belop = sprintf("%01.2f",
$oRsBilag[$k][$BelopFelt]);
- }
- else
- {
- $Belop = sprintf("%01.2f",
-$oRsBilag[$k][$BelopFelt]);
-
- }
-
- $Belop =$Belop *100;
- // $Belop = substr($Belop,0,strlen($Belop) - 3) +
substr($Belop, -2);
-
- //Skriv hovedbilag
-
- $periode_aar = $periode;
- $f1per =
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
- $f1bilnr =
substr($oRsBilag[$k]['bilagsnr'],-6);
- $f1bildat =
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
- $f1bilart = $oRsBilag[$k]['artid'];
- $f1belop = $Belop;
- $f1fordat =
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
- $f1tekst = '';
- $f1iper =
substr($periode_aar,2,2);//date(m,strtotime($oRsBilag[$k]['fakturadato']));
- $f1dime = $oRsBilag[$k]['spvend_code'];
-
- $f3per =
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
- $f3bilnr =
substr($oRsBilag[$k]['bilagsnr'],-6);
- $f3rkonto = $oRsBilag[$k]['spvend_code'];
- $f3pnr =
substr($oRsBilag[$k]['bilagsnr'],-6);
- $f3klasse = $pmlabor_code;
- $f3bildat =
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
- $f3bilart = $oRsBilag[$k]['artid'];
- $f3belopr = $Belop;
- $f3fordat =
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
- $f3sakb =
$oRsBilag[$k]['saksbehandler'];
- $f3idkode = $oRsBilag[$k]['kidnr'];
- $f3tekst = '';
-
- $buffer .= 'F3 7 1'. $f3per . $f3bilnr .
sprintf("%6s",$f3rkonto) . sprintf("%6s",$f3pnr)
- . ' 0'. sprintf("%-4s",$f3klasse). ' ' .
sprintf("%6s",$f3bildat).sprintf("%2s",$f3bilart)
- . 'NOK 1000
10005'.sprintf("%14s",$f3belopr).' '.sprintf("%6s",$f3fordat)
- . sprintf("%6s",$f3fordat).' 0 0 0
001 '
- . sprintf("%-8s",$f3sakb).' 0 0 0
0 0 01 0 0'
- . sprintf("%-28s",$f3idkode).' 0'."\r\n"
- .'F112
1'.sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).' 2001 2001 0
0 0'
- .
sprintf("%2s",$f1bilart).'0'.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat)
- .'NOK 1000 1000'.sprintf("%6s",$f1dime).'
0 0 0 0 0 0 0 0'
- .
sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101
0'
- . sprintf("%6s",$f1bilnr).' 0
'."\r\n";
-
-
- //Velg ut alle underbilag
-
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);
-
- $underbilag_count= count($oRsUnderbilag);
- for ($i=0;$i<$underbilag_count;$i++)
- {
- $BilagId = $oRsUnderbilag[$i]['id'];
-
- if ($oRsUnderbilag[$i]['artid'] == 2)
- {
- $Belop = sprintf("%01.2f",
-$oRsUnderbilag[$i][$BelopFelt]);
- }
- else
- {
- $Belop = sprintf("%01.2f",
$oRsUnderbilag[$i][$BelopFelt]);
- }
-
- $Belop =$Belop *100;
-
- //$Belop =
substr($Belop,0,strlen($Belop) - 3) + substr($Belop, -2);
-
-
- if($oRsUnderbilag[$i]['pmwrkord_code'])
- {
- //Hent DIM C
- $dimc =
$this->soXport->select_dimc($oRsUnderbilag[$i]['pmwrkord_code']);
-
- //Oppdater beløp på arbeidsordre
- if ($download=='on')
- {
- if
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
- {
-
$actual_cost_field='act_mtrl_cost';
- }
- else
- {
-
$actual_cost_field='act_vendor_cost';
- }
- $operator='+';
-
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
- }
- }
- else
- {
- $dimc = '';
- }
-
- //Overfør til fm_ecobilagoverf
-
- $oRsOverfBilag=$oRsUnderbilag[$i];
- $oRsOverfBilag['filnavn']=
basename($Filnavn);
-
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
-
$oRsOverfBilag['dima']=substr($oRsOverfBilag['dima'],0,6);
-
- //Kopier verdier
- if ($download=='on')
- {
-
$this->soXport->add_OverfBilag($oRsOverfBilag);
- }
- //Skriv til fil
-
- $f1kto =
$oRsOverfBilag['spbudact_code'];
- $f1dima =
substr($oRsOverfBilag['dima'],0,6);
- $f1dimb =
$oRsOverfBilag['dimb'];
- $f1dimc = $dimc;
- $f1dimd =
$oRsOverfBilag['dimd'];
- $f1avgkod =
$oRsOverfBilag['mvakode'];
- $f1belop = $Belop;
- $f1tekst =
'';//$oRsOverfBilag['merknad'];
-
- $buffer .='F1 2 1'.
sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).sprintf("%8s",$f1kto).' 0'
-
.sprintf("%6s",$f1dima).sprintf("%6s",$f1dimb).sprintf("%6s",$f1dimc).sprintf("%6s",$f1dimd).sprintf("%2s",$f1bilart).'0'
-
.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat).'NOK 1000
1000'.sprintf("%6s",$f1dime).' 0 0 0 0 0 0 0'
-
.sprintf("%2s",$f1avgkod).sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101
0'
- .sprintf("%6s",$f1bilnr).' 0
'."\r\n";
-
-
- //Slett post i fm_ecobilag
- if ($download=='on')
- {
-
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);
- //Logg transaksjon
-
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice transferred'));
- }
-
- $BilagId = 'NULL';
-
- $antall = $antall + 1;
- }
- }
-
- $f9per = $periode_aar;
- $buffer .='F999 1'.sprintf("%4s",$f9per).'
0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0
'."\r\n";
-
- //Fullfør transaksjon
- //g_db.SluttTransaksjon
-
-
- if ($download=='on')
- {
- $message = 'periode: '.$periode_aar.' antall
bilag/underbilag overført:'.$antall . ' , fil: ' . $Filnavn;
- $fp = fopen($Filnavn, "wb");
- fwrite($fp,$buffer);
- if(fclose($fp))
- {
- $this->db->transaction_commit();
-
- }
- else
- {
- $this->db->transaction_abort();
- $message = 'Noe gikk galt!';
- }
- }
- else
- {
- $message = $buffer;
- }
-
- return $message;
- }
- }
-?>
Deleted: branches/Version-1_0-branch/property/inc/export/default/GABNr
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/GABNr
2014-02-21 10:19:58 UTC (rev 11728)
+++ branches/Version-1_0-branch/property/inc/export/default/GABNr
2014-02-21 10:21:38 UTC (rev 11729)
@@ -1,175 +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 export
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- class export_conv
- {
- function export_conv()
- {
- $this->soXport =
CreateObject('property.soXport');
- $this->config =
CreateObject('phpgwapi.config','property');
- $this->socommon =
CreateObject('property.socommon');
- $this->solocation =
CreateObject('property.solocation');
- $this->config->read_repository();
-
- $this->db = $this->socommon->new_db();
-
- $this->join = $this->socommon->join;
-
- }
-
- function overfor($download)
- {
- //Generer batch ID
- $batchid = $this->soXport->next_batchid();
-
- $receipt['message'][]= array('msg' =>
$this->OverforGAB($batchid,$download));
-
- return $receipt;
- }
-
-
- function LagFilnavn ($batchid)
- {
- $fil_katalog =
$this->config->config_data['export_path'];
- //Beregn l\xF8penr
- $StartLopeNr = ($batchid % 30) + 70;
- $LopeNr = $StartLopeNr;
-
- do
- {
- //Konstruer filnavn
- $Filnavn = $fil_katalog . '/GABNr'.
sprintf("%2d",$LopeNr) . '10.TXT';
-
- //Sjekk om filen eksisterer
- If (!file_exists($Filnavn))
- {
- return $Filnavn;
- }
-
- //Genererer nytt l\xF8penr
- $batchid = $batchid + 1;
- $LopeNr = ($batchid % 30) + 70;
- }
- while ($LopeNr != $StartLopeNr);
-
- //Ingen l\xF8penr er ledige, gi feilmelding
- return False;
- }
-
- function OverforGAB($batchid,$download)
- {
- //Bestem filnavn
-
- $Filnavn = $this->LagFilnavn($batchid);
- if (!$Filnavn)
- {
- $message='LagFilnavn'.lang('Alle l\xF8penr for
filnavn er i bruk!');
- return $message;
- }
-
- //Test om filen kan opprettes og skrives til
- if (@fopen($Filnavn, "wb"))
- {
- unlink($Filnavn);
- }
- else
- {
- $message='kan ikke lagre til fil: '. $Filnavn;
- return $message;
- }
-
- //Velg ut alle GABNr som skal overf\xF8res
-
- $sql = "SELECT
loc1_name,gab_id,fm_gab_location.loc1,fm_gab_location.address FROM
fm_gab_location $this->join fm_location1 on fm_gab_location.loc1 =
fm_location1.loc1 WHERE owner = 'yes' AND ((fm_location1.category <> 99) OR
(fm_location1.category IS NULL)) GROUP BY
gab_id,fm_gab_location.loc1,loc1_name, fm_gab_location.address ORDER by gab_id
asc";
-
- $this->db->query($sql,__LINE__,__FILE__);
-
- while ($this->db->next_record())
- {
- $gab_list[] = array
- (
- 'gab_id' => $this->db->f('gab_id'),
- 'location_code' => $this->db->f('loc1'),
- 'address' => $this->db->f('address'),
- 'loc1_name' =>
$this->db->f('loc1_name'),
- );
- }
-
- $cols_extra=array(0=>'loc1_name');
-
- $gab_count = count($gab_list);
-
-/* for ($i=0;$i<$gab_count;$i++)
- {
-
$location_data=$this->solocation->read_single($gab_list[$i]['location_code']);
- for ($j=0;$j<count($cols_extra);$j++)
- {
- $gab_list[$i][$cols_extra[$j]] =
$location_data[$cols_extra[$j]];
- }
-
- }
-*/
- $buffer = 'GABNr'. ' ' .'Objekt'.' '.'Adresse' .
"\r\n";
-
- $check_gab_id=array();
-
- for ($k=0;$k<$gab_count;$k++)
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11729] Merge 11719:11728 from trunk,
Sigurd Nes <=