[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [12043] Merge 12039:12042 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [12043] Merge 12039:12042 from trunk |
Date: |
Wed, 30 Jul 2014 13:43:30 +0000 |
Revision: 12043
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=12043
Author: sigurdne
Date: 2014-07-30 13:43:29 +0000 (Wed, 30 Jul 2014)
Log Message:
-----------
Merge 12039:12042 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
branches/Version-1_0-branch/rental/inc/class.menu.inc.php
branches/Version-1_0-branch/rental/inc/class.sobilling.inc.php
branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
branches/Version-1_0-branch/rental/inc/class.soprice_item.inc.php
branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
branches/Version-1_0-branch/rental/inc/class.uicontract.inc.php
branches/Version-1_0-branch/rental/inc/class.uiprice_item.inc.php
branches/Version-1_0-branch/rental/inc/model/class.agresso_gl07.inc.php
branches/Version-1_0-branch/rental/inc/model/class.agresso_lg04.inc.php
branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
branches/Version-1_0-branch/rental/setup/phpgw_no.lang
branches/Version-1_0-branch/rental/setup/setup.inc.php
branches/Version-1_0-branch/rental/setup/tables_current.inc.php
branches/Version-1_0-branch/rental/setup/tables_update.inc.php
branches/Version-1_0-branch/rental/templates/base/billing.php
branches/Version-1_0-branch/rental/templates/base/composite.php
branches/Version-1_0-branch/rental/templates/base/contract.php
Removed Paths:
-------------
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
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,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871,9873-9893,9895,9897-9912,9914-9919,9921-9928,9930-9952,9954,9956,9958-9963,9965-9993,9995-9997,9999-10001,10003-10004,10006-10007,10009-10012,10014-10031,10033-10073,10075-10107,10109-10165,10167-10210,10222-10226,10228-10311,10313-10378,10380,10382,10384-10393,10395-10478,10480-10482,10484-10494,10496-10503,10505,10507,10509-10521,10523,10525-10528,10530-10540,10542-10543,10545-10568,10570-10584,10586-10590,10592-10594,10596,10598-10599,10601-10611,10613,10615,10617-10626,10628-10636,10638,10640-10654,10656-10658,10660,10662-10672,10674,10676-10682,10684,10686,10688-10690,10692-10694,10696-10697,10699-10701,10703,10705-10706,10708-10724,10726-10731,10734,10736-10748,10750-10796,10798-10939,10941,10943,10945,10947-10953,10955,10957-10961,10963,10965-10966,10968-11001,11003-11030,11032-11034,11036,11038,11040,11042-11053,11055-11059,11061-11062,11064-11068,11070-11073,11075-11077,11079-11083,11085,11087-11088,11090-11093,11095-11108,11110-11111,11113,11115-11116,11118-11120,11122,11124-11129,11131-11132,11134,11136,11138,11140-11151,11153-11161,11163-11185,11187-11189,11191-11229,11231,11233,11235-11264,11266-11267,11269-11278,11280-11282,11284-11291,11293-11295,11297,11299-11302,11304,11306,11309,11311,11313-11316,11318-11323,11325-11332,11334,11336-11344,11346,11348-11354,11356,11358-11360,11363-11386,11388-11389,11391-11392,11394,11396-11403,11405-11406,11408,11410,11412,11415,11417,11419-11420,11422,11424-11429,11431-11442,11444-11445,11447-11460,11462-11464,11466-11470,11472-11475,11477-11478,11480-11487,11489-11492,11494,11496,11498,11500-11502,11504-11506,11508,11510-11511,11513,11515,11517-11523,11525-11526,11528-11531,11533,11535-11538,11540-11546,11548-11560,11563-11572,11574,11576,11578,11580-11581,11583,11585,11587,11589-11592,11594-11595,11597,11599,11601,11603,11605-11607,11609-11611,11613,11615-11619,11621-11622,11624-11630,11632,11634-11635,11637,11639-11640,11642,11644-11655,11657-11659,11661-11675,11677-11679,11681-11684,11686,11688,11690-11691,11693-11706,11708-11709,11711-11714,11716-11718,11720-11728,11730,11732,11734-11739,11741-11757,11759-11760,11762-11766,11768,11770-11771,11773,11775,11777,11779-11780,11782,11784,11786,11788,11790,11792-11793,11795,11797,11799,11801,11803-11804,11806-11807,11809,11811-11814,11816-11820,11822,11824-11826,11828,11830,11832,11834,11836-11837,11839,11841,11843,11845-11847,11849-11852,11854-11856,11858-11860,11862-11863,11865,11867,11869-11870,11872,11874,11876-11879,11881-11891,11893,11895,11897-11899,11901,11903,11905-11906,11908-11917,11919,11921,11923-11925,11927-11931,11933-11954,11956-11962,11964-11969,11971-11973,11975-11976,11978,11980,11982,11984,11986-11991,11993,11995,11997-12000,12002,12004-12006,12008,12010-12011,12013,12015,12017-12018,12020-12021,12023,12025,12027-12028,12030,12032-12036,12038,12040-12042
Modified: branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/property/inc/class.db_mssql.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -13,22 +13,23 @@
class db_mssql
{
- var $Host = '';
- var $Database = '';
- var $User = '';
- var $Password = '';
+ var $Host = '';
+ var $Database = '';
+ var $User = '';
+ var $Password = '';
- var $Link_ID = 0;
- var $Query_ID = 0;
- var $Record = array();
- var $Row = 0;
- var $VEOF = -1;
+ var $Link_ID = 0;
+ var $Query_ID = 0;
+ var $Record = array();
+ var $Row = 0;
+ var $VEOF = -1;
- var $Errno = 0;
- var $Error = '';
- var $Auto_Free = 0; ## set this to 1 to automatically
free results
- var $Debug = false;
- protected $Transaction = false;
+ var $Errno = 0;
+ var $Error = '';
+ var $Auto_Free = 0; ## set this to 1 to
automatically free results
+ var $Debug = false;
+ var $auto_stripslashes = false;
+ protected $Transaction = false;
function connect()
{
@@ -230,12 +231,17 @@
for($i=0; $i<$count; $i++)
{
$info = mssql_fetch_field($id, $i);
+ $res[$info->name] = $info;
+/*
$res[$i]['table'] = $table;
- $res[$i]['name'] = $info['name'];
- $res[$i]['len'] = $info['max_length'];
- $res[$i]['flags'] = $info['numeric'];
- }
- $this->free_result();
+ $res[$i]['name'] = $info->name;
+ $res[$i]['len'] = $info->max_length;
+ $res[$i]['flags'] = $info->numeric;
+ $res[$i]['type'] = $info->type;
+*/
+ }
+
+ $this->free_result();
return $res;
}
@@ -272,9 +278,20 @@
print $this->num_rows();
}
- function f($Field_Name)
+ public function f($name, $strip_slashes = False)
{
- return $this->Record[strtolower($Field_Name)];
+ if( isset($this->Record[$name]) )
+ {
+ if ($strip_slashes || ($this->auto_stripslashes
&& ! $strip_slashes))
+ {
+ return
htmlspecialchars_decode(stripslashes($this->Record[$name]));
+ }
+ else
+ {
+ return $this->Record[$name];
+ }
+ }
+ return '';
}
function p($Field_Name)
Modified: branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/property/inc/class.sogeneric.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -2746,8 +2746,62 @@
break;
// END CONTROLLER TABLES
+// START RENTAL TABLES
+ case 'composite_standard':
+ $info = array
+ (
+ 'table'
=> 'rental_composite_standard',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar'
+ ),
+ array
+ (
+ 'name' =>
'factor',
+ 'descr' =>
lang('factor'),
+ 'type'
=> 'numeric',
+ 'nullable'
=> false,
+ 'size'
=> 4,
+ 'sortable'
=> true
+ )
+ ),
+ 'edit_msg'
=> lang('edit unit'),
+ 'add_msg'
=> lang('add unit'),
+ 'name'
=> lang('unit'),
+ 'acl_app'
=> 'rental',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::rental::composite_standard'
+ );
+ break;
+ case 'responsibility_unit':
+ $info = array
+ (
+ 'table'
=> 'rental_contract_responsibility_unit',
+ 'id'
=> array('name' => 'id', 'type' => 'int'),
+ 'fields'
=> array
+ (
+ array
+ (
+ 'name' =>
'name',
+ 'descr' =>
lang('name'),
+ 'type' =>
'varchar'
+ ),
+ ),
+ 'edit_msg'
=> lang('edit unit'),
+ 'add_msg'
=> lang('add unit'),
+ 'name'
=> lang('unit'),
+ 'acl_app'
=> 'rental',
+ 'acl_location' =>
'.admin',
+ 'menu_selection' =>
'admin::rental::responsibility_unit'
+ );
+ break;
+// END RENTAL TABLES
-
default:
$message =lang('ERROR: illegal type %1', $type);
phpgwapi_cache::message_set($message, 'error');
Deleted:
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
===================================================================
---
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
2014-07-30 13:39:00 UTC (rev 12042)
+++
branches/Version-1_0-branch/property/inc/cron/default/oppdater_namssakstatus_pr_leietaker.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -1,133 +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 custom
- * @version $Id$
- */
-
- /**
- * Description
- * @package property
- */
-
- include_class('property', 'cron_parent', 'inc/cron/');
-
- class oppdater_namssakstatus_pr_leietaker extends property_cron_parent
- {
-
- function __construct()
- {
- parent::__construct();
-
- $this->function_name = get_class($this);
- $this->sub_location = lang('location');
- $this->function_msg = 'Oppdatere namssaksstatus pr
leietater';
-
- $this->bocommon =
CreateObject('property.bocommon');
- $this->db = &
$GLOBALS['phpgw']->db;
- $this->db2 =
clone($this->db);
- $this->join =
$this->db->join;
- $this->like =
$this->db->like;
- $this->left_join = " LEFT JOIN ";
-
- if(isset($this->db->adodb) && $this->db->adodb)
- {
- $this->db_boei =
CreateObject('phpgwapi.db',false,$GLOBALS['external_db']['boei']['db_type']);
- $this->db_boei->Host =
$GLOBALS['external_db']['boei']['db_host'];
- $this->db_boei->Type =
$GLOBALS['external_db']['boei']['db_type'];
- $this->db_boei->Database =
$GLOBALS['external_db']['boei']['db_name'];
- $this->db_boei->User =
$GLOBALS['external_db']['boei']['db_user'];
- $this->db_boei->Password =
$GLOBALS['external_db']['boei']['db_pass'];
- $this->db_boei->Halt_On_Error = 'yes';
- $this->db_boei->connect();
- }
- else
- {
- $this->db_boei =
CreateObject('property.db_mssql');
- $this->db_boei->Host =
$GLOBALS['external_db']['boei']['db_host'];
- $this->db_boei->Type =
$GLOBALS['external_db']['boei']['db_type'];
- $this->db_boei->Database =
$GLOBALS['external_db']['boei']['db_name'];
- $this->db_boei->User =
$GLOBALS['external_db']['boei']['db_user'];
- $this->db_boei->Password =
$GLOBALS['external_db']['boei']['db_pass'];
- $this->db_boei->Halt_On_Error = 'yes';
- }
- }
-
-
- function execute()
- {
-
- $sql = "SELECT TOP 100 PERCENT fm_tenant.id"
- . " FROM fm_tenant LEFT OUTER JOIN"
- . " v_Leietaker ON fm_tenant.id = v_Leietaker.leietaker_id
AND "
- . " fm_tenant.status_drift =
v_Leietaker.namssakstatusdrift_id AND "
- . " fm_tenant.status_eco =
v_Leietaker.namssakstatusokonomi_id"
- . " WHERE (v_Leietaker.leietaker_id IS
NULL)";
-
- $this->db_boei->query($sql,__LINE__,__FILE__);
-
- $this->db->transaction_begin();
- $this->db_boei->transaction_begin();
-
- while ($this->db_boei->next_record())
- {
- $leietaker[]= $this->db_boei->f('id');
- }
-
- for ($i=0; $i<count($leietaker); $i++)
- {
- $sql = "SELECT namssakstatusokonomi_id,
namssakstatusdrift_id"
- . " FROM v_Leietaker"
- . " WHERE (v_Leietaker.leietaker_id =
'" . $leietaker[$i] . "')";
-
- $this->db_boei->query($sql,__LINE__,__FILE__);
-
- $this->db_boei->next_record();
- $leietaker_oppdatert[]= array (
- 'id' =>
$leietaker[$i],
- 'status_drift' =>
$this->db_boei->f('namssakstatusdrift_id'),
- 'status_eco' =>
$this->db_boei->f('namssakstatusokonomi_id')
- );
-
- }
-
- for ($i=0; $i<count($leietaker_oppdatert); $i++)
- {
- $sql = " UPDATE fm_tenant SET "
- . " status_eco = '" .
$leietaker_oppdatert[$i]['status_eco'] . "',"
- . " status_drift = '" .
$leietaker_oppdatert[$i]['status_drift'] . "'"
- . " WHERE id = '" .
$leietaker_oppdatert[$i]['id'] . "'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db_boei->query($sql,__LINE__,__FILE__);
- }
-
- $this->db->transaction_commit();
- $this->db_boei->transaction_commit();
-
- $msg = $i . ' namssakstatus er oppdatert';
- $this->receipt['message'][]=array('msg'=> $msg);
- }
- }
Modified:
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
===================================================================
---
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
2014-07-30 13:39:00 UTC (rev 12042)
+++
branches/Version-1_0-branch/property/inc/cron/default/synkroniser_med_boei.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -34,7 +34,7 @@
include_class('property', 'cron_parent', 'inc/cron/');
- class synkroniser_med_boei extends property_cron_parent
+ class synkroniser_med_boei_2 extends property_cron_parent
{
function __construct()
@@ -74,41 +74,36 @@
}
$this->db_boei2 = clone($this->db_boei);
+ $this->db2 = clone($this->db);
}
function execute()
{
- set_time_limit(500);
- $receipt = $this->legg_til_eier_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_gateadresse_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_objekt_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_bygg_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_seksjon_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_leieobjekt_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->legg_til_leietaker_phpgw();
- $this->cron_log($receipt,$cron);
- $receipt = $this->oppdater_leieobjekt();
- $this->cron_log($receipt,$cron);
- $receipt = $this->oppdater_boa_objekt();
- $this->cron_log($receipt,$cron);
- $receipt = $this->oppdater_boa_bygg();
- $this->cron_log($receipt,$cron);
- $receipt = $this->oppdater_boa_del();
- $this->cron_log($receipt,$cron);
- $receipt = $this->oppdater_oppsagtdato();
- $this->cron_log($receipt,$cron);
- $receipt = $this->slett_feil_telefon();
- $this->cron_log($receipt,$cron);
- $receipt = $this->update_tenant_name();
- $this->cron_log($receipt,$cron);
+ $start = time();
+ set_time_limit(1200);
+ $this->update_tables();
+ $this->legg_til_eier_phpgw();
+ $this->legg_til_gateadresse_phpgw();
+ $this->legg_til_objekt_phpgw();
+ $this->legg_til_bygg_phpgw();
+ $this->legg_til_seksjon_phpgw();
+ $this->legg_til_leieobjekt_phpgw();
+ $this->legg_til_leietaker_phpgw();
+ $this->oppdater_leieobjekt();
+ $this->oppdater_boa_objekt();
+ $this->oppdater_boa_bygg();
+ $this->oppdater_boa_del();
+ $this->oppdater_oppsagtdato();
+ $this->slett_feil_telefon();
+ $this->update_tenant_name();
+ $this->oppdater_namssakstatus_pr_leietaker();
+ $msg = 'Tidsbruk: ' . (time() - $start) . ' sekunder';
+ $this->cron_log($msg,$cron);
+
+ $this->receipt['message'][]=array('msg'=> $msg);
+
}
function cron_log($receipt='')
@@ -128,99 +123,692 @@
$this->db->query($sql,__LINE__,__FILE__);
}
- function legg_til_eier_phpgw()
+ /**
+ * v_Eier
+ * v_Gateadresse
+ * boei_objekt
+ * boei_bygg
+ * boei_seksjon
+ * boei_leieobjekt
+ * boei_leietaker
+ * boei_reskontro
+ */
+ function update_tables()
{
- $sql = " SELECT TOP 100 PERCENT v_Eier.id,
v_Eier.category"
- . " FROM v_Eier";
+ $this->update_table_eier();
+ $this->update_table_gateadresse();
+ $this->update_table_Objekt();
+ $this->update_table_Bygg();
+ $this->update_table_seksjon();
+ $this->update_table_leieobjekt();
+ $this->update_table_leietaker();
+ $this->update_table_reskontro();
+ }
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ function update_table_eier()
+ {
+ $metadata = $this->db_boei->metadata('Eier');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_eier');
+//_debug_array($metadata);
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_eier
+ (
+ eier_id integer NOT NULL,
+ navn character varying(50),
+ eiertype_id integer NOT NULL,
+ CONSTRAINT boei_eier_pkey PRIMARY KEY
(eier_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_eier', __LINE__,
__FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Eier';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_eier (eier_id, navn,
eiertype_id)'
+ . ' VALUES(?, ?, ?)';
+ $valueset=array();
+
while ($this->db_boei->next_record())
{
- if($this->db_boei->f('category')==0)
- {
- $category = 4;
- }
- else
- {
- $category =
$this->db_boei->f('category');
- }
- $owner[]= array (
- 'id' => $this->db_boei->f('id'),
- 'category' => $category,
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Eier_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 2 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Navn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('EierType_ID'),
+ 'type' => PDO::PARAM_INT
+ )
+ );
+
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function update_table_Gateadresse()
+ {
+ $metadata = $this->db_boei->metadata('Gateadresse');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_gateadresse');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_gateadresse
+ (
+ gateadresse_id integer NOT NULL,
+ gatenavn character varying(50),
+ nasjonalid integer,
+ CONSTRAINT boei_gateadresse_pkey PRIMARY KEY
(gateadresse_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_gateadresse',
__LINE__, __FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Gateadresse';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_gateadresse (gateadresse_id,
gatenavn, nasjonalid)'
+ . ' VALUES(?, ?, ?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Gateadresse_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 2 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('GateNavn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('NasjonalID'),
+ 'type' => PDO::PARAM_INT
+ )
+ );
+
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function update_table_Objekt()
+ {
+ $metadata = $this->db_boei->metadata('Objekt');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_objekt');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_objekt
+ (
+ objekt_id character varying(4) NOT NULL,
+ navn character varying(50),
+ generelladresse character varying(50),
+ bydel_id integer,
+ postnr_id character varying(4),
+ eier_id integer,
+ tjenestested integer,
+ CONSTRAINT boei_objekt_pkey PRIMARY KEY
(objekt_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_objekt', __LINE__,
__FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Objekt';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_objekt (objekt_id, navn,
generelladresse, bydel_id,postnr_id,eier_id,tjenestested)'
+ . ' VALUES(?, ?, ?, ?,
?, ?, ?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
$this->db_boei->f('Objekt_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 2 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Navn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('GenerellAdresse')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 4 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Bydel_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 5 => array
+ (
+ 'value' =>
$this->db_boei->f('Postnr_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 6 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Eier_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 7 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Tjenestested'),
+ 'type' => PDO::PARAM_INT
+ )
+ );
+
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function update_table_Bygg()
+ {
+ $metadata = $this->db_boei->metadata('Bygg');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_bygg');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_bygg
+ (
+ objekt_id character varying(4) NOT NULL,
+ bygg_id character varying(2) NOT NULL,
+ byggnavn character varying(50),
+ generelladresse character varying(50),
+ driftstatus smallint,
+ CONSTRAINT boei_bygg_pkey PRIMARY KEY
(objekt_id, bygg_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_bygg', __LINE__,
__FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Bygg';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_bygg (objekt_id, bygg_id,
byggnavn, generelladresse, driftstatus)'
+ . ' VALUES(?, ?, ?, ?,
?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
$this->db_boei->f('Objekt_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 2 => array
+ (
+ 'value' =>
$this->db_boei->f('Bygg_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('ByggNavn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 4 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('GenerellAdresse')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 5 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Driftstatus'),
+ 'type' => PDO::PARAM_INT
+ ),
+ );
+
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function update_table_Seksjon()
+ {
+ $metadata = $this->db_boei->metadata('Seksjon');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_seksjon');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_seksjon
+ (
+ objekt_id character varying(4) NOT NULL,
+ bygg_id character varying(2) NOT NULL,
+ seksjons_id character varying(2) NOT
NULL,
+ beskrivelse character varying(35),
+ CONSTRAINT boei_seksjon_pkey PRIMARY KEY
(objekt_id, bygg_id, seksjons_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_seksjon', __LINE__,
__FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Seksjon';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_seksjon (objekt_id, bygg_id,
seksjons_id, beskrivelse)'
+ . ' VALUES(?, ?, ?, ?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
$this->db_boei->f('Objekt_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 2 => array
+ (
+ 'value' =>
$this->db_boei->f('Bygg_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
$this->db_boei->f('Seksjons_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 4 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Beskrivelse')),
+ 'type' => PDO::PARAM_STR
+ )
+ );
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+
+ function update_table_leieobjekt()
+ {
+ $metadata = $this->db_boei->metadata('Leieobjekt');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_leieobjekt');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_leieobjekt
+ (
+ objekt_id character varying(4) NOT NULL,
+ bygg_id character varying(2) NOT NULL,
+ seksjons_id character varying(2) NOT
NULL,
+ leie_id character varying(3) NOT NULL,
+ flyttenr smallint,
+ formaal_id smallint,
+ gateadresse_id integer,
+ gatenr character varying(30),
+ etasje character varying(5),
+ antallrom smallint,
+ boareal integer,
+ andelavfellesareal smallint,
+ livslopsstd smallint,
+ heis smallint,
+ driftsstatus_id smallint,
+ leietaker_id integer,
+ beregnet_boa numeric(20,2),
+
+ CONSTRAINT boei_leieobjekt_pkey PRIMARY KEY
(objekt_id, bygg_id, seksjons_id, leie_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_leieobjekt',
__LINE__, __FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Leieobjekt';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_leieobjekt (objekt_id,
bygg_id, seksjons_id, leie_id, flyttenr, formaal_id, gateadresse_id, gatenr,
etasje, antallrom, boareal, andelavfellesareal,livslopsstd, heis,
driftsstatus_id, leietaker_id,beregnet_boa)'
+ . ' VALUES(?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
$this->db_boei->f('Objekt_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 2 => array
+ (
+ 'value' =>
$this->db_boei->f('Bygg_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
$this->db_boei->f('Seksjons_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 4 => array
+ (
+ 'value' =>
$this->db_boei->f('Leie_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 5 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Flyttenr'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 6 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Formaal_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 7 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Gateadresse_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 8 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Gatenr')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 9 => array
+ (
+ 'value' =>
$this->db_boei->f('Etasje'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 10 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('AntallRom'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 11 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Boareal'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 12 => array
+ (
+ 'value' =>(int)
$this->db_boei->f('AndelAvFellesareal'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 13 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Livslopsstd'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 14 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Heis'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 15 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Driftsstatus_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 16 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Leietaker_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 17 => array
+ (
+ 'value' =>
(float)$this->db_boei->f('Beregnet_Boa'),
+ 'type' => PDO::PARAM_STR
+ )
+ );
+
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+
+ function update_table_leietaker()
+ {
+ $metadata = $this->db_boei->metadata('Leietaker');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_leietaker');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_leietaker
+ (
+ leietaker_id integer NOT NULL,
+ fornavn character varying(30),
+ etternavn character varying(30),
+ kjonn_juridisk smallint,
+ oppsagtdato character varying(10),
+ namssakstatusdrift_id smallint,
+ namssakstatusokonomi_id smallint,
+ hemmeligadresse smallint,
+ CONSTRAINT boei_leietaker_pkey PRIMARY
KEY (leietaker_id)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_leietaker',
__LINE__, __FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM Leietaker';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_leietaker (leietaker_id,
fornavn, etternavn,
kjonn_juridisk,oppsagtdato,namssakstatusdrift_id,namssakstatusokonomi_id,hemmeligadresse)'
+ . ' VALUES(?, ?, ?, ?,
?, ?, ?, ?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Leietaker_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 2 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Fornavn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
utf8_encode($this->db_boei->f('Etternavn')),
+ 'type' => PDO::PARAM_STR
+ ),
+ 4 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Kjonn_Juridisk'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 5 => array
+ (
+ 'value' =>
$this->db_boei->f('OppsagtDato'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 6 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('NamssakStatusDrift_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 7 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('NamssakStatusOkonomi_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 8 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('hemmeligAdresse'),
+ 'type' => PDO::PARAM_INT
+ )
+ );
+
+ }
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function update_table_reskontro()
+ {
+ $metadata = $this->db_boei->metadata('reskontro');
+//_debug_array($metadata);
+ $metadata = $this->db->metadata('boei_reskontro');
+//_debug_array($metadata);
+//die();
+ if(!$metadata)
+ {
+ $sql_table = <<<SQL
+ CREATE TABLE boei_reskontro
+ (
+ objekt_id character varying(4) NOT NULL,
+ leie_id character varying(3) NOT NULL,
+ flyttenr smallint,
+ leietaker_id integer NOT NULL,
+ innflyttetdato character varying(10),
+ CONSTRAINT boei_reskontro_pkey PRIMARY
KEY (objekt_id,leie_id,flyttenr)
+ );
+SQL;
+ $this->db->query($sql_table,__LINE__,__FILE__);
+ }
+ $this->db->query('DELETE FROM boei_reskontro',
__LINE__, __FILE__);
+ $sql_boei = 'SELECT TOP 100 PERCENT * FROM reskontro';
+ $this->db_boei->query($sql_boei,__LINE__,__FILE__);
+ // using stored prosedures
+ $sql = 'INSERT INTO boei_reskontro
(objekt_id,leie_id,flyttenr,leietaker_id, innflyttetdato )'
+ . ' VALUES(?, ?, ?, ?,
?)';
+ $valueset=array();
+
+ while ($this->db_boei->next_record())
+ {
+ $valueset[] = array
+ (
+ 1 => array
+ (
+ 'value' =>
$this->db_boei->f('Objekt_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 2 => array
+ (
+ 'value' =>
$this->db_boei->f('Leie_ID'),
+ 'type' => PDO::PARAM_STR
+ ),
+ 3 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Flyttenr'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 4 => array
+ (
+ 'value' =>
(int)$this->db_boei->f('Leietaker_ID'),
+ 'type' => PDO::PARAM_INT
+ ),
+ 5 => array
+ (
+ 'value' =>
$this->db_boei->f('InnflyttetDato'),
+ 'type' => PDO::PARAM_STR
+ )
+ );
+ }
+
+ $this->db->insert($sql, $valueset, __LINE__, __FILE__);
+ }
+
+ function legg_til_eier_phpgw()
+ {
+ $sql = " SELECT boei_eier.eier_id as id,
boei_eier.eiertype_id as category"
+ . " FROM boei_eier";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $owners = array();
+ while ($this->db->next_record())
+ {
+ $category = $this->db->f('category');
+ $owners[]= array
+ (
+ 'id' =>
(int)$this->db->f('id'),
+ 'category' => $category == 0 ? 4 :
$category
);
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($owner); $i++)
+ foreach ($owners as $owner)
{
- $sql2 = "UPDATE fm_owner set category =
'{$owner[$i]['category']}' WHERE id = '{$owner[$i]['id']}'";
+ $sql2 = "UPDATE fm_owner set category =
'{$owner['category']}' WHERE id = '{$owner['id']}'";
$this->db->query($sql2,__LINE__,__FILE__);
- $this->db_boei->query($sql2,__LINE__,__FILE__);
}
unset($owner);
+ $owners = array();
- $sql = "SELECT v_Eier.id,
v_Eier.org_name,v_Eier.category FROM fm_owner RIGHT OUTER JOIN "
- . " v_Eier ON fm_owner.id = v_Eier.id"
+ $sql = "SELECT boei_eier.eier_id, boei_eier.navn as
org_name,boei_eier.eiertype_id as category FROM fm_owner RIGHT OUTER JOIN "
+ . " boei_eier ON fm_owner.id =
boei_eier.eier_id"
. " WHERE (fm_owner.id IS NULL)";
- $this->db_boei->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ while ($this->db->next_record())
{
- if($this->db_boei->f('category')==0)
- {
- $category = 4;
- }
- else
- {
- $category =
$this->db_boei->f('category');
- }
- $owner_utf[]= array (
- 'id' => $this->db_boei->f('id'),
- 'org_name' =>
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
- 'remark' =>
$this->db->db_addslashes(utf8_encode($this->db_boei->f('org_name'))),
- 'category' => $category,
- 'entry_date' => time(),
- 'owner_id' => 6
- );
+ $category = $this->db->f('category');
- $owner_latin[]= array (
- 'id' => $this->db_boei->f('id'),
- 'org_name' =>
$this->db->db_addslashes($this->db_boei->f('org_name')),
- 'remark' =>
$this->db->db_addslashes($this->db_boei->f('org_name')),
- 'category' => $category,
- 'entry_date' => time(),
- 'owner_id' => 6
- );
+ $owners[]= array
+ (
+ 'id' =>
$this->db->f('eier_id'),
+ 'org_name' =>
$this->db->f('org_name'),
+ 'remark' =>
$this->db->f('org_name'),
+ 'category' => $category ==
0 ? 4 : $category,
+ 'entry_date' => time(),
+ 'owner_id' => 6
+ );
}
- for ($i=0; $i<count($owner_utf); $i++)
+ foreach ($owners as $owner)
{
- $sql2_utf = "INSERT INTO fm_owner
(id,org_name,remark,category,entry_date,owner_id)"
- . "VALUES (" .
$this->db->validate_insert($owner_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_owner
(id,org_name,remark,category,entry_date,owner_id)"
- . "VALUES (" .
$this->db->validate_insert($owner_latin[$i]) . ")";
+ $sql2 = "INSERT INTO fm_owner
(id,org_name,remark,category,entry_date,owner_id)"
+ . "VALUES (" .
$this->db->validate_insert($owner) . ")";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
+ $this->db->query($sql2,__LINE__,__FILE__);
- $owner_msg[]=$owner_utf[$i]['org_name'];
+ $owner_msg[]=$owner['org_name'];
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
- $msg = count($owner) . ' eier er lagt til: ' .
@implode(",", $owner_msg);
+ $msg = count($owners) . ' eier er lagt til: ' .
@implode(",", $owner_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($owner_utf);
- unset ($owner_latin);
- unset ($owner_msg);
- return $msg;
-
+ $this->cron_log($msg);
}
@@ -228,683 +816,504 @@
function legg_til_gateadresse_phpgw()
{
//legg til
- $sql = "SELECT v_Gateadresse.gateadresse_id,
v_Gateadresse.gatenavn FROM fm_streetaddress RIGHT OUTER JOIN "
- . " v_Gateadresse ON fm_streetaddress.id =
v_Gateadresse.gateadresse_id"
+ $sql = "SELECT boei_gateadresse.gateadresse_id,
boei_gateadresse.gatenavn FROM fm_streetaddress RIGHT OUTER JOIN "
+ . " boei_gateadresse ON fm_streetaddress.id =
boei_gateadresse.gateadresse_id"
. " WHERE (fm_streetaddress.id IS
NULL)";
- $this->db_boei->query($sql,__LINE__,__FILE__);
- $gate = array();
- while ($this->db_boei->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ $gater = array();
+ while ($this->db->next_record())
{
- $gate[]= array (
- 'id' =>
$this->db_boei->f('gateadresse_id'),
- 'descr' => $this->db_boei->f('gatenavn')
+ $gater[]= array
+ (
+ 'id' =>
(int)$this->db->f('gateadresse_id'),
+ 'descr' =>
$this->db->f('gatenavn')
);
}
$this->db->transaction_begin();
- $this->db_boei->transaction_begin();
- for ($i=0; $i<count($gate); $i++)
+ foreach($gater as $gate)
{
+ $sql2 = "INSERT INTO fm_streetaddress
(id,descr)"
+ . " VALUES ({$gate['id']},
'{$gate['descr']}')";
- $sql = "DELETE from fm_streetaddress WHERE id =
" . (int)$gate[$i]['id'];
- $sql2_latin = "INSERT INTO fm_streetaddress
(id,descr)"
- . " VALUES (" . $gate[$i]['id'] . ",
'". $gate[$i]['descr']. "')";
-
- $sql2_utf = "INSERT INTO fm_streetaddress
(id,descr)"
- . " VALUES (" . $gate[$i]['id'] . ",
'". utf8_encode($gate[$i]['descr']). "')";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db_boei->query($sql,__LINE__,__FILE__);
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
- $gate_msg[]=utf8_encode($gate[$i]['descr']);
+ $this->db->query($sql2,__LINE__,__FILE__);
+ $gate_msg[]=$gate[$i]['descr'];
}
//oppdater gatenavn - om det er endret
- $sql = "SELECT v_Gateadresse.gateadresse_id,
v_Gateadresse.gatenavn FROM v_Gateadresse";
+ $sql = "SELECT boei_gateadresse.gateadresse_id,
boei_gateadresse.gatenavn FROM boei_gateadresse";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
$msg = count($gate) . ' gateadresser er lagt til: ' .
@implode(",", $gate_msg);
$gate = array();
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
$gate[]= array
(
- 'id' =>
$this->db_boei->f('gateadresse_id'),
- 'descr' =>
$this->db_boei->f('gatenavn')
+ 'id' =>
(int)$this->db->f('gateadresse_id'),
+ 'descr' =>
$this->db->f('gatenavn')
);
}
-
+
foreach ($gate as $gate_info)
{
- $descr = utf8_encode($gate_info['descr']);
- $sql_utf = "UPDATE fm_streetaddress SET descr =
'{$descr}' WHERE id = " . (int)$gate_info['id'];
+ $sql_utf = "UPDATE fm_streetaddress SET descr =
'{$gate_info['descr']}' WHERE id = " . (int)$gate_info['id'];
$this->db->query($sql_utf,__LINE__,__FILE__);
}
$this->db->transaction_commit();
- $this->db_boei->transaction_commit();
-
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($gate);
- unset ($gate_msg);
- return $msg;
-
+ $this->cron_log($msg);
}
function legg_til_objekt_phpgw()
{
- $sql = "SELECT v_Objekt.objekt_id, v_Objekt.navn,
v_Objekt.bydel_id, v_Objekt.eier_id,v_Objekt.tjenestested"
+ $sql = "SELECT boei_objekt.objekt_id, boei_objekt.navn,
boei_objekt.bydel_id, boei_objekt.eier_id,boei_objekt.tjenestested"
. " FROM fm_location1 RIGHT OUTER JOIN "
- . " v_Objekt ON fm_location1.loc1 =
v_Objekt.objekt_id"
+ . " boei_objekt ON fm_location1.loc1 =
boei_objekt.objekt_id"
. " WHERE fm_location1.loc1 IS NULL";
- $this->db_boei->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ $objekt_latin = array();
+ while ($this->db->next_record())
{
- $objekt_utf[]= array (
- 'location_code' =>
$this->db_boei->f('objekt_id'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc1_name' =>
utf8_encode($this->db_boei->f('navn')),
- 'part_of_town_id' =>
$this->db_boei->f('bydel_id'),
- 'owner_id' =>
$this->db_boei->f('eier_id'),
- 'kostra_id' =>
$this->db_boei->f('tjenestested'),
- 'category' => 1
+ $objekt_latin[]= array
+ (
+ 'location_code' =>
$this->db->f('objekt_id'),
+ 'loc1' =>
$this->db->f('objekt_id'),
+ 'loc1_name' =>
$this->db->f('navn'),
+ 'part_of_town_id' =>
$this->db->f('bydel_id'),
+ 'owner_id' =>
$this->db->f('eier_id'),
+ 'kostra_id' =>
$this->db->f('tjenestested'),
+ 'category' => 1
);
- $objekt_latin[]= array (
- 'location_code' =>
$this->db_boei->f('objekt_id'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc1_name' =>
$this->db_boei->f('navn'),
- 'part_of_town_id' =>
$this->db_boei->f('bydel_id'),
- 'owner_id' =>
$this->db_boei->f('eier_id'),
- 'kostra_id' =>
$this->db_boei->f('tjenestested'),
- 'category' => 1
- );
-
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($objekt_latin); $i++)
+ foreach($objekt_latin as $objekt)
{
- $sql2_utf = "INSERT INTO fm_location1
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id,category)
"
- . "VALUES (" .
$this->db->validate_insert($objekt_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_location1
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id,category)
"
- . "VALUES (" .
$this->db->validate_insert($objekt_latin[$i]) . ")";
+ $sql2 = "INSERT INTO fm_location1
(location_code, loc1, loc1_name, part_of_town_id, owner_id, kostra_id,category)
"
+ . "VALUES (" .
$this->db->validate_insert($objekt) . ")";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
- $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (1, '{$objekt_utf[$i]['location_code']}',
'{$objekt_utf[$i]['loc1']}')",__LINE__,__FILE__);
+ $this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (1, '{$objekt['location_code']}',
'{$objekt['loc1']}')",__LINE__,__FILE__);
- $obj_msg[]=$objekt_utf[$i]['loc1'];
+ $obj_msg[]=$objekt['loc1'];
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
$msg = count($objekt_latin) . ' Objekt er lagt til: ' .
@implode(",", $obj_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($objekt_utf);
- unset ($objekt_latin);
- unset ($obj_msg);
- return $msg;
+ $this->cron_log($msg);
}
function legg_til_bygg_phpgw()
{
- $sql = "SELECT v_Bygg.objekt_id + '-' + v_Bygg.bygg_id
AS location_code, v_Bygg.objekt_id, v_Bygg.bygg_id,
v_Bygg.byggnavn,v_Bygg.driftstatus"
- . " FROM v_Bygg LEFT OUTER JOIN"
- . " fm_location2 ON v_Bygg.objekt_id =
fm_location2.loc1 AND v_Bygg.bygg_id = fm_location2.loc2"
+ $sql = "SELECT boei_bygg.objekt_id || '-' ||
boei_bygg.bygg_id AS location_code, boei_bygg.objekt_id, boei_bygg.bygg_id,
boei_bygg.byggnavn,boei_bygg.driftstatus"
+ . " FROM boei_bygg LEFT OUTER JOIN"
+ . " fm_location2 ON boei_bygg.objekt_id =
fm_location2.loc1 AND boei_bygg.bygg_id = fm_location2.loc2"
. " WHERE fm_location2.loc1 IS NULL";
-
- $this->db_boei->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ $bygg_latin = array();
+ while ($this->db->next_record())
{
- $bygg_utf[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc2_name' =>
utf8_encode($this->db_boei->f('byggnavn')),
- 'category' => 98
- );
- $bygg_latin[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc2_name' =>
$this->db_boei->f('byggnavn'),
- 'category' => 98
- );
+ $bygg_latin[]= array
+ (
+ 'location_code' =>
$this->db->f('location_code'),
+ 'loc1' =>
$this->db->f('objekt_id'),
+ 'loc2' =>
$this->db->f('bygg_id'),
+ 'loc2_name' =>
$this->db->f('byggnavn'),
+ 'category' => 98
+ );
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($bygg_latin); $i++)
+ foreach($bygg_latin as $bygg)
{
- $sql2_utf = "INSERT INTO fm_location2
(location_code, loc1, loc2, loc2_name,category) "
- . "VALUES (" .
$this->db->validate_insert($bygg_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_location2
(location_code, loc1, loc2, loc2_name,category) "
- . "VALUES (" .
$this->db->validate_insert($bygg_latin[$i]) . ")";
+ $sql2 = "INSERT INTO fm_location2
(location_code, loc1, loc2, loc2_name,category) "
+ . "VALUES (" .
$this->db->validate_insert($bygg) . ")";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
- $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (2, '{$bygg_utf[$i]['location_code']}',
'{$objekt_utf[$i]['loc1']}')",__LINE__,__FILE__);
+ $this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (2, '{$bygg['location_code']}',
'{$bygg['loc1']}')",__LINE__,__FILE__);
- $bygg_msg[]=$bygg_utf[$i]['location_code'];
+ $bygg_msg[]=$bygg['location_code'];
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
$msg = count($bygg_latin) . ' Bygg er lagt til: ' .
@implode(",", $bygg_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($bygg_utf);
- unset ($bygg_latin);
- unset ($bygg_msg);
- return $msg;
-
+ $this->cron_log($msg);
}
function legg_til_seksjon_phpgw()
{
- $sql = "SELECT v_Seksjon.objekt_id + '-' +
v_Seksjon.bygg_id + '-' + v_Seksjon.seksjons_id AS location_code,
v_Seksjon.objekt_id, v_Seksjon.bygg_id,"
- . " v_Seksjon.seksjons_id,
v_Seksjon.beskrivelse, v_Seksjon.totalt_fellesareal"
- . " FROM v_Seksjon LEFT OUTER JOIN"
- . " fm_location3 ON v_Seksjon.objekt_id =
fm_location3.loc1 AND v_Seksjon.bygg_id = fm_location3.loc2 AND "
- . " v_Seksjon.seksjons_id = fm_location3.loc3"
+ $sql = "SELECT boei_seksjon.objekt_id || '-' ||
boei_seksjon.bygg_id || '-' || boei_seksjon.seksjons_id AS location_code,
boei_seksjon.objekt_id, boei_seksjon.bygg_id,"
+ . " boei_seksjon.seksjons_id,
boei_seksjon.beskrivelse"
+ . " FROM boei_seksjon LEFT OUTER JOIN"
+ . " fm_location3 ON boei_seksjon.objekt_id =
fm_location3.loc1 AND boei_seksjon.bygg_id = fm_location3.loc2 AND "
+ . " boei_seksjon.seksjons_id =
fm_location3.loc3"
. " WHERE fm_location3.loc1 IS NULL";
-
- $this->db_boei->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $this->db->query($sql,__LINE__,__FILE__);
+ $seksjon_latin = array();
+ while ($this->db->next_record())
{
- $seksjon_utf[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc3' =>
$this->db_boei->f('seksjons_id'),
- 'loc3_name' =>
utf8_encode($this->db_boei->f('beskrivelse')),
- 'fellesareal' =>
$this->db_boei->f('totalt_fellesareal'),
- 'category' => 98
- );
$seksjon_latin[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc3' =>
$this->db_boei->f('seksjons_id'),
- 'loc3_name' =>
$this->db_boei->f('beskrivelse'),
- 'fellesareal' =>
$this->db_boei->f('totalt_fellesareal'),
+ 'location_code' =>
$this->db->f('location_code'),
+ 'loc1' =>
$this->db->f('objekt_id'),
+ 'loc2' =>
$this->db->f('bygg_id'),
+ 'loc3' =>
$this->db->f('seksjons_id'),
+ 'loc3_name' =>
$this->db->f('beskrivelse'),
'category' => 98
);
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($seksjon_latin); $i++)
+ foreach($seksjon_latin as $seksjon)
{
+ $sql2 = "INSERT INTO fm_location3
(location_code, loc1, loc2, loc3, loc3_name, category) "
+ . "VALUES (" .
$this->db->validate_insert($seksjon) . ")";
- $sql2_utf = "INSERT INTO fm_location3
(location_code, loc1, loc2, loc3, loc3_name, fellesareal,category) "
- . "VALUES (" .
$this->db->validate_insert($seksjon_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_location3
(location_code, loc1, loc2, loc3, loc3_name, fellesareal,category) "
- . "VALUES (" .
$this->db->validate_insert($seksjon_latin[$i]) . ")";
+ $this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (3, '{$seksjon['location_code']}',
'{$seksjon['loc1']}')",__LINE__,__FILE__);
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
- $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (3, '{$seksjon_utf[$i]['location_code']}',
'{$objekt_utf[$i]['loc1']}')",__LINE__,__FILE__);
-
-
$seksjon_msg[]=$seksjon_utf[$i]['location_code'];
+ $seksjon_msg[]=$seksjon['location_code'];
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
$msg = count($seksjon_latin) . ' Seksjon er lagt til: '
. @implode(",", $seksjon_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($seksjon_utf);
- unset ($seksjon_latin);
- unset ($seksjon_msg);
- return $msg;
+ $this->cron_log($msg);
}
function legg_til_leieobjekt_phpgw()
{
-
- $sql = "SELECT v_Leieobjekt.objekt_id + '-' +
v_Leieobjekt.bygg_id + '-' + v_Leieobjekt.seksjons_id + '-' +
v_Leieobjekt.leie_id AS location_code,"
- . " v_Leieobjekt.objekt_id, v_Leieobjekt.leie_id,
v_Leieobjekt.leieobjekttype_id, v_Leieobjekt.bygg_id, v_Leieobjekt.seksjons_id,"
- . " v_Leieobjekt.formaal_id, v_Leieobjekt.gateadresse_id,
v_Leieobjekt.gatenr, v_Leieobjekt.etasje, v_Leieobjekt.antallrom,"
- . " v_Leieobjekt.boareal, v_Leieobjekt.livslopsstd,
v_Leieobjekt.heis, v_Leieobjekt.driftsstatus_id, v_Leieobjekt.leietaker_id,"
- . " v_Leieobjekt.beregnet_boa, v_Leieobjekt.flyttenr"
- . " FROM v_Leieobjekt LEFT OUTER JOIN"
- . " fm_location4 ON v_Leieobjekt.objekt_id =
fm_location4.loc1 AND v_Leieobjekt.leie_id = fm_location4.loc4"
+ $sql = "SELECT boei_leieobjekt.objekt_id || '-' ||
boei_leieobjekt.bygg_id || '-' || boei_leieobjekt.seksjons_id || '-' ||
boei_leieobjekt.leie_id AS location_code,"
+ . " boei_leieobjekt.objekt_id, boei_leieobjekt.leie_id,
boei_leieobjekt.bygg_id, boei_leieobjekt.seksjons_id,"
+ . " boei_leieobjekt.formaal_id,
boei_leieobjekt.gateadresse_id, boei_leieobjekt.gatenr, boei_leieobjekt.etasje,
boei_leieobjekt.antallrom,"
+ . " boei_leieobjekt.boareal, boei_leieobjekt.livslopsstd,
boei_leieobjekt.heis, boei_leieobjekt.driftsstatus_id,
boei_leieobjekt.leietaker_id,"
+ . " boei_leieobjekt.beregnet_boa, boei_leieobjekt.flyttenr"
+ . " FROM boei_leieobjekt LEFT OUTER JOIN"
+ . " fm_location4 ON boei_leieobjekt.objekt_id =
fm_location4.loc1 AND boei_leieobjekt.leie_id = fm_location4.loc4"
. " WHERE fm_location4.loc1 IS NULL";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $leieobjekt_latin = array();
+
+ while ($this->db->next_record())
{
- $leieobjekt_utf[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc4' =>
$this->db_boei->f('leie_id'),
- 'leieobjekttype_id'=>
$this->db_boei->f('leieobjekttype_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc3' =>
$this->db_boei->f('seksjons_id'),
- 'category' =>
$this->db_boei->f('formaal_id'),
- 'street_id' =>
$this->db_boei->f('gateadresse_id'),
- 'street_number' =>
utf8_encode($this->db_boei->f('gatenr')),
- 'etasje' =>
utf8_encode($this->db_boei->f('etasje')),
- 'antallrom' =>
$this->db_boei->f('antallrom'),
- 'boareal' =>
$this->db_boei->f('boareal'),
- 'livslopsstd' =>
$this->db_boei->f('livslopsstd'),
- 'heis' =>
$this->db_boei->f('heis'),
- 'driftsstatus_id' =>
$this->db_boei->f('driftsstatus_id'),
- 'tenant_id' =>
$this->db_boei->f('leietaker_id'),
- 'beregnet_boa' =>
$this->db_boei->f('beregnet_boa'),
- 'flyttenr' =>
$this->db_boei->f('flyttenr')
- );
- $leieobjekt_latin[]= array (
- 'location_code' =>
$this->db_boei->f('location_code'),
- 'loc1' =>
$this->db_boei->f('objekt_id'),
- 'loc4' =>
$this->db_boei->f('leie_id'),
- 'leieobjekttype_id'=>
$this->db_boei->f('leieobjekttype_id'),
- 'loc2' =>
$this->db_boei->f('bygg_id'),
- 'loc3' =>
$this->db_boei->f('seksjons_id'),
- 'category' =>
$this->db_boei->f('formaal_id'),
- 'street_id' =>
$this->db_boei->f('gateadresse_id'),
- 'street_number' =>
$this->db_boei->f('gatenr'),
- 'etasje' =>
$this->db_boei->f('etasje'),
- 'antallrom' =>
$this->db_boei->f('antallrom'),
- 'boareal' =>
$this->db_boei->f('boareal'),
- 'livslopsstd' =>
$this->db_boei->f('livslopsstd'),
- 'heis' =>
$this->db_boei->f('heis'),
- 'driftsstatus_id' =>
$this->db_boei->f('driftsstatus_id'),
- 'tenant_id' =>
$this->db_boei->f('leietaker_id'),
- 'beregnet_boa' =>
$this->db_boei->f('beregnet_boa'),
- 'flyttenr' =>
$this->db_boei->f('flyttenr')
- );
-
+ $leieobjekt_latin[]= array
+ (
+ 'location_code' =>
$this->db->f('location_code'),
+ 'loc1' =>
$this->db->f('objekt_id'),
+ 'loc4' =>
$this->db->f('leie_id'),
+ 'loc2' =>
$this->db->f('bygg_id'),
+ 'loc3' =>
$this->db->f('seksjons_id'),
+ 'category' =>
$this->db->f('formaal_id'),
+ 'street_id' =>
$this->db->f('gateadresse_id'),
+ 'street_number' =>
$this->db->f('gatenr'),
+ 'etasje' =>
$this->db->f('etasje'),
+ 'antallrom' =>
$this->db->f('antallrom'),
+ 'boareal' =>
$this->db->f('boareal'),
+ 'livslopsstd' =>
$this->db->f('livslopsstd'),
+ 'heis' =>
$this->db->f('heis'),
+ 'driftsstatus_id' =>
$this->db->f('driftsstatus_id'),
+ 'tenant_id' =>
$this->db->f('leietaker_id'),
+ 'beregnet_boa' =>
$this->db->f('beregnet_boa'),
+ 'flyttenr' =>
$this->db->f('flyttenr')
+ );
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($leieobjekt_latin); $i++)
+ foreach($leieobjekt_latin as $leieobjekt)
{
-
- $sql2_utf = "INSERT INTO fm_location4
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id,
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
+ $sql2 = "INSERT INTO fm_location4
(location_code, loc1, loc4, loc2, loc3, category, street_id, street_number,
etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
tenant_id, beregnet_boa, flyttenr)"
- . "VALUES (" .
$this->db->validate_insert($leieobjekt_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_location4
(location_code, loc1, loc4, leieobjekttype_id, loc2, loc3, category, street_id,
street_number, etasje, antallrom, boareal, livslopsstd, heis, driftsstatus_id,
- tenant_id, beregnet_boa, flyttenr)"
- . "VALUES (" .
$this->db->validate_insert($leieobjekt_latin[$i]) . ")";
+ . "VALUES (" .
$this->db->validate_insert($leieobjekt) . ")";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
- $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (4,
'{$leieobjekt_utf[$i]['location_code']}',
'{$objekt_utf[$i]['loc1']}')",__LINE__,__FILE__);
+ $this->db->query($sql2,__LINE__,__FILE__);
+ $this->db->query("INSERT INTO fm_locations
(level, location_code, loc1) VALUES (4, '{$leieobjekt['location_code']}',
'{$leieobjekt['loc1']}')",__LINE__,__FILE__);
-
$leieobjekt_msg[]=$leieobjekt_utf[$i]['location_code'];
+ $leieobjekt_msg[]=$leieobjekt['location_code'];
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
$msg = count($leieobjekt_latin) . ' Leieobjekt er lagt
til: ' . @implode(",", $leieobjekt_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($leieobjekt_latin);
- unset ($leieobjekt_utf);
- unset ($leieobjekt_msg);
- return $msg;
+ $this->cron_log($msg);
}
function legg_til_leietaker_phpgw()
{
- $sql = " SELECT v_Leietaker.leietaker_id,
v_Leietaker.fornavn, v_Leietaker.etternavn, v_Leietaker.kjonn_juridisk,"
- . " v_Leietaker.namssakstatusokonomi_id,
v_Leietaker.namssakstatusdrift_id"
+ $sql = " SELECT boei_leietaker.leietaker_id,
boei_leietaker.fornavn, boei_leietaker.etternavn,
boei_leietaker.kjonn_juridisk,"
+ . " boei_leietaker.namssakstatusokonomi_id,
boei_leietaker.namssakstatusdrift_id"
. " FROM fm_tenant RIGHT OUTER JOIN"
- . " v_Leietaker ON fm_tenant.id =
v_Leietaker.leietaker_id"
+ . " boei_leietaker ON fm_tenant.id =
boei_leietaker.leietaker_id"
. " WHERE fm_tenant.id IS NULL";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ $leietaker_latin = array();
+
+ while ($this->db->next_record())
{
- $leietaker_utf[]= array (
- 'id' =>
$this->db_boei->f('leietaker_id'),
- 'first_name' =>
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))),
- 'last_name' =>
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))),
- 'category' =>
$this->db_boei->f('kjonn_juridisk') + 1,
- 'status_eco' =>
$this->db_boei->f('namssakstatusokonomi_id'),
- 'status_drift' =>
$this->db_boei->f('namssakstatusdrift_id'),
- 'entry_date' => time(),
- 'owner_id' => 6
+ $leietaker_latin[]= array
+ (
+ 'id' =>
$this->db->f('leietaker_id'),
+ 'first_name' =>
$this->db->f('fornavn'),
+ 'last_name' =>
$this->db->f('etternavn'),
+ 'category' =>
$this->db->f('kjonn_juridisk') + 1,
+ 'status_eco' =>
$this->db->f('namssakstatusokonomi_id'),
+ 'status_drift' =>
$this->db->f('namssakstatusdrift_id'),
+ 'entry_date' => time(),
+ 'owner_id' => 6
);
- $leietaker_latin[]= array (
- 'id' =>
$this->db_boei->f('leietaker_id'),
- 'first_name' =>
$this->db->db_addslashes($this->db_boei->f('fornavn')),
- 'last_name' =>
$this->db->db_addslashes($this->db_boei->f('etternavn')),
- 'category' =>
$this->db_boei->f('kjonn_juridisk') + 1,
- 'status_eco' =>
$this->db_boei->f('namssakstatusokonomi_id'),
- 'status_drift' =>
$this->db_boei->f('namssakstatusdrift_id'),
- 'entry_date' => time(),
- 'owner_id' => 6
- );
}
- // $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
+ $this->db->transaction_begin();
- for ($i=0; $i<count($leietaker_latin); $i++)
+ foreach($leietaker_latin as $leietaker)
{
- $this->db->query("DELETE FROM fm_tenant WHERE
id=" . (int)$leietaker_latin[$i]['id'],__LINE__,__FILE__);
- $this->db_boei->query("DELETE FROM fm_tenant
WHERE id=" . (int)$leietaker_latin[$i]['id'],__LINE__,__FILE__);
+ $sql2 = "INSERT INTO fm_tenant (id, first_name,
last_name, category, status_eco, status_drift,entry_date,owner_id)"
+ . "VALUES (" .
$this->db->validate_insert($leietaker) . ")";
- $sql2_utf = "INSERT INTO fm_tenant (id,
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
- . "VALUES (" .
$this->db->validate_insert($leietaker_utf[$i]) . ")";
- $sql2_latin = "INSERT INTO fm_tenant (id,
first_name, last_name, category, status_eco, status_drift,entry_date,owner_id)"
- . "VALUES (" .
$this->db->validate_insert($leietaker_latin[$i]) . ")";
+ $this->db->query($sql2,__LINE__,__FILE__);
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei->query($sql2_latin,__LINE__,__FILE__);
-
- $leietaker_msg[]= '['
.$leietaker_utf[$i]['last_name'] . ', ' . $leietaker_utf[$i]['first_name'] .
']';
+ $leietaker_msg[]= "[{$leietaker['last_name']},
'{$leietaker['first_name']}']";
}
- // $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
+ $this->db->transaction_commit();
$msg = count($leietaker_latin) . ' Leietaker er lagt
til: ' . @implode(",", $leietaker_msg);
$this->receipt['message'][]=array('msg'=> $msg);
- unset ($leietaker);
- unset ($leietaker_msg);
- return $msg;
-
+ $this->cron_log($msg);
}
function update_tenant_name()
{
- $sql = " SELECT leietaker_id, fornavn, etternavn FROM
v_Leietaker";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $sql = "SELECT boei_leietaker.leietaker_id,
boei_leietaker.fornavn, boei_leietaker.etternavn FROM boei_leietaker"
+ . " JOIN fm_tenant ON boei_leietaker.leietaker_id =
fm_tenant.id"
+ . " WHERE first_name != fornavn OR last_name !=
etternavn";
+ $this->db->query($sql,__LINE__,__FILE__);
$i=0;
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $sql2_utf = " UPDATE fm_tenant SET "
- . " first_name = '" .
$this->db->db_addslashes(utf8_encode($this->db_boei->f('fornavn'))) . "',"
- . " last_name = '" .
$this->db->db_addslashes(utf8_encode($this->db_boei->f('etternavn'))) ."'"
- . " WHERE id = " .
(int)$this->db_boei->f('leietaker_id');
-
- $sql2_latin = " UPDATE fm_tenant SET "
- . " first_name = '" .
$this->db->db_addslashes($this->db_boei->f('fornavn')) . "',"
- . " last_name = '" .
$this->db->db_addslashes($this->db_boei->f('etternavn')) ."'"
- . " WHERE id = " .
(int)$this->db_boei->f('leietaker_id');
-
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+ $sql2 = "UPDATE fm_tenant SET"
+ . " first_name = '" . $this->db->f('fornavn') .
"',"
+ . " last_name = '" . $this->db->f('etternavn')
."'"
+ . " WHERE id = " .
(int)$this->db->f('leietaker_id');
+//_debug_array($sql2);
+ $this->db2->query($sql2,__LINE__,__FILE__);
$i++;
}
$msg = $i . ' Leietakere er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
function oppdater_leieobjekt()
{
- $sql = " SELECT TOP 100 PERCENT
v_Leieobjekt.objekt_id,v_Leieobjekt.leie_id,v_Leieobjekt.leietaker_id, boareal,
formaal_id, gateadresse_id, gatenr, etasje,driftsstatus_id,
v_Leieobjekt.flyttenr, innflyttetdato"
- . " FROM v_Leieobjekt LEFT JOIN v_reskontro ON
v_Leieobjekt.objekt_id=v_reskontro.objekt_id AND
v_Leieobjekt.leie_id=v_reskontro.leie_id"
- . " AND
v_Leieobjekt.flyttenr=v_reskontro.flyttenr AND
v_Leieobjekt.leietaker_id=v_reskontro.leietaker_id";
+ $sql = "SELECT
boei_leieobjekt.objekt_id,boei_leieobjekt.leie_id,boei_leieobjekt.leietaker_id,
boareal, formaal_id, gateadresse_id, gatenr, etasje,driftsstatus_id,
boei_leieobjekt.flyttenr, innflyttetdato"
+ . " FROM boei_leieobjekt LEFT JOIN
boei_reskontro ON boei_leieobjekt.objekt_id=boei_reskontro.objekt_id AND
boei_leieobjekt.leie_id=boei_reskontro.leie_id"
+ . " AND
boei_leieobjekt.flyttenr=boei_reskontro.flyttenr AND
boei_leieobjekt.leietaker_id=boei_reskontro.leietaker_id";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
- // $this->db->transaction_begin();
- // $this->db_boei2->transaction_begin();
+ $this->db->transaction_begin();
$i=0;
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $sql2_utf = " UPDATE fm_location4 SET "
- . " tenant_id = '" .
$this->db_boei->f('leietaker_id') . "',"
- . " category = '" .
$this->db_boei->f('formaal_id') . "',"
- . " etasje = '" .
utf8_encode($this->db_boei->f('etasje')) . "',"
- . " street_id = '" .
$this->db_boei->f('gateadresse_id') . "',"
- . " street_number = '" .
utf8_encode($this->db_boei->f('gatenr')) . "',"
- . " driftsstatus_id = '" .
$this->db_boei->f('driftsstatus_id') . "',"
- . " boareal = '" . $this->db_boei->f('boareal')
. "',"
- . " flyttenr = '" .
$this->db_boei->f('flyttenr') . "',"
- . " innflyttetdato = '" .
date($this->db->date_format(),strtotime($this->db_boei->f('innflyttetdato'))) .
"'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc4= '" .
$this->db_boei->f('leie_id') . "'";
- $sql2_latin = " UPDATE fm_location4 SET "
- . " tenant_id = '" .
$this->db_boei->f('leietaker_id') . "',"
- . " category = '" .
$this->db_boei->f('formaal_id') . "',"
- . " etasje = '" . $this->db_boei->f('etasje') .
"',"
- . " street_id = '" .
$this->db_boei->f('gateadresse_id') . "',"
- . " street_number = '" .
$this->db_boei->f('gatenr') . "',"
- . " driftsstatus_id = '" .
$this->db_boei->f('driftsstatus_id') . "',"
- . " boareal = '" . $this->db_boei->f('boareal')
. "',"
- . " flyttenr = '" .
$this->db_boei->f('flyttenr') . "',"
- . " innflyttetdato = '" . date("M d
Y",strtotime($this->db_boei->f('innflyttetdato'))) . "'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc4= '" .
$this->db_boei->f('leie_id') . "'";
+ $sql2 = " UPDATE fm_location4 SET "
+ . " tenant_id = '" .
$this->db->f('leietaker_id') . "',"
+ . " category = '" . $this->db->f('formaal_id')
. "',"
+ . " etasje = '" . $this->db->f('etasje') . "',"
+ . " street_id = '" .
$this->db->f('gateadresse_id') . "',"
+ . " street_number = '" . $this->db->f('gatenr')
. "',"
+ . " driftsstatus_id = '" .
$this->db->f('driftsstatus_id') . "',"
+ . " boareal = '" . $this->db->f('boareal') .
"',"
+ . " flyttenr = '" . $this->db->f('flyttenr') .
"',"
+ . " innflyttetdato = '" . date("M d
Y",strtotime($this->db->f('innflyttetdato'))) . "'"
+ . " WHERE loc1 = '" .
$this->db->f('objekt_id') . "' AND loc4= '" . $this->db->f('leie_id') . "'";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+ $this->db2->query($sql2,__LINE__,__FILE__);
$i++;
}
- // $this->db->transaction_commit();
- // $this->db_boei2->transaction_commit();
+ $this->db->transaction_commit();
$msg = $i . ' Leieobjekt er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
function oppdater_boa_objekt()
{
- $sql = " SELECT TOP 100 PERCENT
v_Objekt.objekt_id,bydel_id,tjenestested,navn,v_Objekt.eier_id FROM v_Objekt";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $sql = " SELECT
boei_objekt.objekt_id,bydel_id,tjenestested,navn,boei_objekt.eier_id"
+ . " FROM boei_objekt JOIN fm_location1 ON
boei_objekt.objekt_id = fm_location1.loc1"
+ . " WHERE boei_objekt.navn != fm_location1.loc1_name"
+ . " OR boei_objekt.bydel_id !=
fm_location1.part_of_town_id"
+ . " OR boei_objekt.eier_id != fm_location1.owner_id"
+ . " OR boei_objekt.tjenestested !=
fm_location1.kostra_id";
+ $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $sql2_utf = " UPDATE fm_location1 SET "
- . " loc1_name = '" .
utf8_encode($this->db_boei->f('navn')) . "',"
- . " part_of_town_id = " .
(int)$this->db_boei->f('bydel_id') . ","
- . " owner_id = " .
(int)$this->db_boei->f('eier_id') . ","
- . " kostra_id = " .
(int)$this->db_boei->f('tjenestested')
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "'";
- $sql2_latin = " UPDATE fm_location1 SET "
- . " loc1_name = '" . $this->db_boei->f('navn')
. "',"
- . " part_of_town_id = " .
(int)$this->db_boei->f('bydel_id') . ","
- . " owner_id = " .
(int)$this->db_boei->f('eier_id') . ","
- . " kostra_id = " .
(int)$this->db_boei->f('tjenestested')
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "'";
+ $sql2 = " UPDATE fm_location1 SET "
+ . " loc1_name = '" . $this->db->f('navn') . "',"
+ . " part_of_town_id = " .
(int)$this->db->f('bydel_id') . ","
+ . " owner_id = " . (int)$this->db->f('eier_id')
. ","
+ . " kostra_id = " .
(int)$this->db->f('tjenestested')
+ . " WHERE loc1 = '" .
$this->db->f('objekt_id') . "'";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+ $this->db2->query($sql2,__LINE__,__FILE__);
}
- $sql = " SELECT TOP 100 PERCENT
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
- . " v_Objekt.objekt_id FROM v_Objekt
{$this->join} v_Leieobjekt ON v_Objekt.objekt_id = v_Leieobjekt.objekt_id"
- . " WHERE v_Leieobjekt.formaal_id NOT
IN (99)"
- . " GROUP BY v_Objekt.objekt_id";
+ $sql = " SELECT sum(boei_leieobjekt.boareal) as
sum_boa, count(leie_id) as ant_leieobjekt,"
+ . " boei_objekt.objekt_id FROM
boei_objekt {$this->join} boei_leieobjekt ON boei_objekt.objekt_id =
boei_leieobjekt.objekt_id"
+ . " WHERE boei_leieobjekt.formaal_id
NOT IN (99)"
+ . " GROUP BY boei_objekt.objekt_id";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
// $this->db->transaction_begin();
- // $this->db_boei2->transaction_begin();
$i=0;
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
$sql2 = " UPDATE fm_location1 SET "
- . " sum_boa = '" . $this->db_boei->f('sum_boa')
. "',"
- . " ant_leieobjekt = " .
(int)$this->db_boei->f('ant_leieobjekt')
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "'";
- $this->db->query($sql2,__LINE__,__FILE__);
- $this->db_boei2->query($sql2,__LINE__,__FILE__);
+ . " sum_boa = '" . $this->db->f('sum_boa') .
"',"
+ . " ant_leieobjekt = " .
(int)$this->db->f('ant_leieobjekt')
+ . " WHERE loc1 = '" .
$this->db->f('objekt_id') . "'";
+ $this->db2->query($sql2,__LINE__,__FILE__);
$i++;
}
// $this->db->transaction_commit();
- // $this->db_boei2->transaction_commit();
$msg = $i . ' Objekt er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
function oppdater_boa_bygg()
{
- $sql = " SELECT TOP 100 PERCENT
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
- . " v_Bygg.objekt_id,v_Bygg.bygg_id ,
byggnavn FROM v_Bygg $this->join v_Leieobjekt "
- . " ON v_Bygg.objekt_id =
v_Leieobjekt.objekt_id AND v_Bygg.bygg_id = v_Leieobjekt.bygg_id"
- . " WHERE v_Leieobjekt.formaal_id NOT
IN (99)"
- . " GROUP BY
v_Bygg.objekt_id,v_Bygg.bygg_id ,byggnavn";
+ $sql = " SELECT sum(boei_leieobjekt.boareal) as
sum_boa, count(leie_id) as ant_leieobjekt,"
+ . "
boei_bygg.objekt_id,boei_bygg.bygg_id , byggnavn FROM boei_bygg $this->join
boei_leieobjekt "
+ . " ON boei_bygg.objekt_id =
boei_leieobjekt.objekt_id AND boei_bygg.bygg_id = boei_leieobjekt.bygg_id"
+ . " WHERE boei_leieobjekt.formaal_id
NOT IN (99)"
+ . " GROUP BY
boei_bygg.objekt_id,boei_bygg.bygg_id ,byggnavn";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
// $this->db->transaction_begin();
- // $this->db_boei2->transaction_begin();
$i=0;
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $sql2_utf = " UPDATE fm_location2 SET "
- . " loc2_name = '" .
utf8_encode($this->db_boei->f('byggnavn')) . "',"
- . " sum_boa = '" . $this->db_boei->f('sum_boa')
. "',"
- . " ant_leieobjekt = '" .
$this->db_boei->f('ant_leieobjekt') . "'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc2= '" .
$this->db_boei->f('bygg_id') . "'";
- $sql2_latin = " UPDATE fm_location2 SET "
- . " loc2_name = '" .
$this->db_boei->f('byggnavn') . "',"
- . " sum_boa = '" . $this->db_boei->f('sum_boa')
. "',"
- . " ant_leieobjekt = '" .
$this->db_boei->f('ant_leieobjekt') . "'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc2= '" .
$this->db_boei->f('bygg_id') . "'";
+ $sql2 = " UPDATE fm_location2 SET "
+ . " loc2_name = '" . $this->db->f('byggnavn') .
"',"
+ . " sum_boa = '" . $this->db->f('sum_boa') .
"',"
+ . " ant_leieobjekt = '" .
$this->db->f('ant_leieobjekt') . "'"
+ . " WHERE loc1 = '" .
$this->db->f('objekt_id') . "' AND loc2= '" . $this->db->f('bygg_id') . "'";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+ $this->db2->query($sql2,__LINE__,__FILE__);
$i++;
}
// $this->db->transaction_commit();
- // $this->db_boei2->transaction_commit();
$msg = $i . ' Bygg er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
function oppdater_boa_del()
{
+ $sql = " SELECT sum(boei_leieobjekt.boareal) as
sum_boa, count(leie_id) as ant_leieobjekt,"
+ . "
boei_seksjon.objekt_id,boei_seksjon.bygg_id,boei_seksjon.seksjons_id ,
beskrivelse FROM boei_seksjon $this->join boei_leieobjekt "
+ . " ON boei_seksjon.objekt_id =
boei_leieobjekt.objekt_id"
+ . " AND boei_seksjon.bygg_id =
boei_leieobjekt.bygg_id"
+ . " AND boei_seksjon.seksjons_id =
boei_leieobjekt.seksjons_id"
+ . " WHERE boei_leieobjekt.formaal_id
NOT IN (99)"
+ . " GROUP BY
boei_seksjon.objekt_id,boei_seksjon.bygg_id,boei_seksjon.seksjons_id,beskrivelse";
- $sql = " SELECT TOP 100 PERCENT
sum(v_Leieobjekt.boareal) as sum_boa, count(leie_id) as ant_leieobjekt,"
- . "
v_Seksjon.objekt_id,v_Seksjon.bygg_id,v_Seksjon.seksjons_id , beskrivelse
FROM v_Seksjon $this->join v_Leieobjekt "
- . " ON v_Seksjon.objekt_id =
v_Leieobjekt.objekt_id"
- . " AND v_Seksjon.bygg_id =
v_Leieobjekt.bygg_id"
- . " AND v_Seksjon.seksjons_id =
v_Leieobjekt.seksjons_id"
- . " WHERE v_Leieobjekt.formaal_id NOT
IN (99)"
- . " GROUP BY
v_Seksjon.objekt_id,v_Seksjon.bygg_id,v_Seksjon.seksjons_id,beskrivelse";
+ $this->db->query($sql,__LINE__,__FILE__);
- $this->db_boei->query($sql,__LINE__,__FILE__);
-
$i=0;
// $this->db->transaction_begin();
- // $this->db_boei2->transaction_begin();
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $sql2_utf = " UPDATE fm_location3 SET "
- . " loc3_name = '" .
utf8_encode($this->db_boei->f('beskrivelse')) . "',"
- . " sum_boa = '" . $this->db_boei->f('sum_boa')
. "',"
- . " ant_leieobjekt = '" .
$this->db_boei->f('ant_leieobjekt') . "'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc2= '" .
$this->db_boei->f('bygg_id') . "' AND loc3= '" .
$this->db_boei->f('seksjons_id') . "'";
- $sql2_latin = " UPDATE fm_location3 SET "
- . " loc3_name = '" .
$this->db_boei->f('beskrivelse') . "',"
- . " sum_boa = '" . $this->db_boei->f('sum_boa')
. "',"
- . " ant_leieobjekt = '" .
$this->db_boei->f('ant_leieobjekt') . "'"
- . " WHERE loc1 = '" .
$this->db_boei->f('objekt_id') . "' AND loc2= '" .
$this->db_boei->f('bygg_id') . "' AND loc3= '" .
$this->db_boei->f('seksjons_id') . "'";
+ $sql2 = "UPDATE fm_location3 SET "
+ . " loc3_name = '" .
$this->db->f('beskrivelse') . "',"
+ . " sum_boa = '" . $this->db->f('sum_boa') .
"',"
+ . " ant_leieobjekt = '" .
$this->db->f('ant_leieobjekt') . "'"
+ . " WHERE loc1 = '" .
$this->db->f('objekt_id') . "' AND loc2= '" . $this->db->f('bygg_id') . "'
AND loc3= '" . $this->db->f('seksjons_id') . "'";
- $this->db->query($sql2_utf,__LINE__,__FILE__);
-
$this->db_boei2->query($sql2_latin,__LINE__,__FILE__);
+ $this->db2->query($sql2,__LINE__,__FILE__);
$i++;
}
// $this->db->transaction_commit();
- // $this->db_boei2->transaction_commit();
$msg = $i . ' Seksjoner er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
function oppdater_oppsagtdato()
{
-
- $sql = "SELECT TOP 100 PERCENT fm_tenant.id"
+ $sql = "SELECT fm_tenant.id,boei_leietaker.oppsagtdato"
. " FROM fm_tenant LEFT OUTER JOIN"
- . " v_Leietaker ON fm_tenant.id = v_Leietaker.leietaker_id
AND "
- . " fm_tenant.oppsagtdato = v_Leietaker.oppsagtdato"
- . " WHERE (v_Leietaker.leietaker_id IS
NULL)";
+ . " boei_leietaker ON fm_tenant.id =
boei_leietaker.leietaker_id AND "
+ . " fm_tenant.oppsagtdato = boei_leietaker.oppsagtdato"
+ . " WHERE (boei_leietaker.leietaker_id
IS NULL)";
- $this->db_boei->query($sql,__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
// $this->db->transaction_begin();
- // $this->db_boei->transaction_begin();
- while ($this->db_boei->next_record())
+ while ($this->db->next_record())
{
- $leietaker[]= $this->db_boei->f('id');
- }
+ $sql2 = "UPDATE fm_tenant SET "
+ . " oppsagtdato = '" .
$this->db->f('oppsagtdato') . "'"
+ . " WHERE id = " . (int)$this->db->f('id');
- for ($i=0; $i<count($leietaker); $i++)
- {
- $sql = "SELECT oppsagtdato"
- . " FROM v_Leietaker"
- . " WHERE (v_Leietaker.leietaker_id =
'" . $leietaker[$i] . "')";
-
- $this->db_boei->query($sql,__LINE__,__FILE__);
-
- $this->db_boei->next_record();
- $leietaker_oppdatert[]= array (
- 'id' =>
$leietaker[$i],
- 'oppsagtdato' =>
$this->db_boei->f('oppsagtdato')
- );
-
+ $this->db2->query($sql,__LINE__,__FILE__);
}
-
- for ($i=0; $i<count($leietaker_oppdatert); $i++)
- {
- $sql = " UPDATE fm_tenant SET "
- . " oppsagtdato = '" .
$leietaker_oppdatert[$i]['oppsagtdato'] . "'"
- . " WHERE id = '" .
$leietaker_oppdatert[$i]['id'] . "'";
-
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db_boei->query($sql,__LINE__,__FILE__);
- }
-
// $this->db->transaction_commit();
- // $this->db_boei->transaction_commit();
$msg = $i . ' oppsagtdato er oppdatert';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
-
function slett_feil_telefon()
{
$sql = "SELECT count(contact_phone) as ant_tlf from
fm_tenant WHERE id > 99999 OR id = 0";
@@ -921,6 +1330,59 @@
$msg = $ant_tlf . ' Telefon nr er slettet';
$this->receipt['message'][]=array('msg'=> $msg);
- return $msg;
+ $this->cron_log($msg);
}
- }
+
+ function oppdater_namssakstatus_pr_leietaker()
+ {
+
+ $sql = "SELECT fm_tenant.id"
+ . " FROM fm_tenant LEFT OUTER JOIN"
+ . " boei_leietaker ON fm_tenant.id =
boei_leietaker.leietaker_id AND "
+ . " fm_tenant.status_drift =
boei_leietaker.namssakstatusdrift_id AND "
+ . " fm_tenant.status_eco =
boei_leietaker.namssakstatusokonomi_id"
+ . " WHERE (boei_leietaker.leietaker_id
IS NULL)";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $this->db->transaction_begin();
+
+ while ($this->db->next_record())
+ {
+ $leietaker[]= (int)$this->db->f('id');
+ }
+
+ for ($i=0; $i<count($leietaker); $i++)
+ {
+ $sql = "SELECT namssakstatusokonomi_id,
namssakstatusdrift_id"
+ . " FROM boei_leietaker"
+ . " WHERE (boei_leietaker.leietaker_id
= '" . $leietaker[$i] . "')";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $this->db->next_record();
+ $leietaker_oppdatert[]= array (
+ 'id' =>
(int)$leietaker[$i],
+ 'status_drift' =>
(int)$this->db->f('namssakstatusdrift_id'),
+ 'status_eco' =>
(int)$this->db->f('namssakstatusokonomi_id')
+ );
+ }
+
+ for ($i=0; $i<count($leietaker_oppdatert); $i++)
+ {
+ $sql = " UPDATE fm_tenant SET "
+ . " status_eco = '" .
$leietaker_oppdatert[$i]['status_eco'] . "',"
+ . " status_drift = '" .
$leietaker_oppdatert[$i]['status_drift'] . "'"
+ . " WHERE id = '" .
$leietaker_oppdatert[$i]['id'] . "'";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ $this->db->transaction_commit();
+
+ $msg = $i . ' namssakstatus er oppdatert';
+ $this->receipt['message'][]=array('msg'=> $msg);
+ $this->cron_log($msg);
+ }
+
+ }
\ No newline at end of file
Modified: branches/Version-1_0-branch/rental/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.menu.inc.php 2014-07-30
13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.menu.inc.php 2014-07-30
13:43:29 UTC (rev 12043)
@@ -5,13 +5,13 @@
{
function get_menu()
{
- $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] =
'rental';
$config = CreateObject('phpgwapi.config','rental');
$config->read();
- $use_fellesdata =
$config->config_data['use_fellesdata'];
-
+ $use_fellesdata =
$config->config_data['use_fellesdata'];
+
$menus = array();
$menus['navbar'] = array
@@ -135,16 +135,26 @@
$menus['admin'] = array
(
- 'index' => array
- (
- 'text' => lang('Configuration'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'rental') )
- ),
+ 'index' => array
+ (
+ 'text' => lang('Configuration'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'rental') )
+ ),
'acl' => array
(
'text' => lang('Configure Access
Permissions'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app' => 'rental') )
),
+ 'composite_standard' => array
+ (
+ 'text' => lang('composite standard'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'composite_standard', 'admin' => true) )
+ ),
+ 'responsibility_unit' => array
+ (
+ 'text' => lang('responsibility'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.index', 'type' => 'responsibility_unit', 'admin' => true) )
+ ),
'import' => array
(
'text' => lang('facilit_import'),
@@ -163,13 +173,13 @@
$menus['preferences'] = array
(
- array
- (
- 'text' => lang('Preferences'),
- 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'rental', 'type'=> 'user') )
- ),
array
(
+ 'text' => lang('Preferences'),
+ 'url' =>
$GLOBALS['phpgw']->link('/preferences/preferences.php', array('appname' =>
'rental', 'type'=> 'user') )
+ ),
+ array
+ (
'text' => lang('Grant Access'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'preferences.uiadmin_acl.list_acl', 'acl_app'=> 'rental'))
)
@@ -178,4 +188,4 @@
return $menus;
}
}
-?>
+?>
Modified: branches/Version-1_0-branch/rental/inc/class.sobilling.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.sobilling.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.sobilling.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -348,7 +348,7 @@
*
* @param $billing_job
*/
- public function generate_export(&$billing_job, $excel_export =
false)
+ public function generate_export(&$billing_job,
$excel_export_type = false)
{
$exportable = null;
switch($billing_job->get_export_format())
@@ -365,9 +365,9 @@
}
if($exportable != null)
{
- if($excel_export)
+ if($excel_export_type)
{
- $export_data =
$exportable->get_contents_excel();
+ $export_data =
$exportable->get_contents_excel($excel_export_type);
//_debug_array($export_data[1]);
return $export_data;
}
Modified: branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.socomposite.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -172,7 +172,7 @@
$cols = "rental_composite.id AS composite_id,";
}
$cols .= "rental_unit.id AS unit_id,
rental_unit.location_code, rental_composite.name,
rental_composite.has_custom_address, rental_composite.address_1,
rental_composite.house_number,
- rental_composite.address_2,
rental_composite.postcode, rental_composite.place, rental_composite.is_active,
rental_composite.area, rental_composite.description,
rental_composite.furnish_type_id, ";
+ rental_composite.address_2,
rental_composite.postcode, rental_composite.place, rental_composite.is_active,
rental_composite.area, rental_composite.description,
rental_composite.furnish_type_id, rental_composite.standard_id, ";
$cols .= "rental_contract.id AS contract_id,
rental_contract.date_start, rental_contract.date_end,
rental_contract.old_contract_id, ";
$cols .= "
CASE WHEN
@@ -214,7 +214,8 @@
$composite->set_custom_postcode($this->unmarshal($this->db->f('postcode',
true), 'string'));
$composite->set_custom_place($this->unmarshal($this->db->f('place', true),
'string'));
$composite->set_area($this->unmarshal($this->db->f('area', true), 'float'));
-
$composite->set_furnish_type_id($this->unmarshal($this->db->f('furnish_type_id',
true), 'int'));
+
$composite->set_furnish_type_id($this->unmarshal($this->db->f('furnish_type_id'),
'int'));
+
$composite->set_standard_id($this->unmarshal($this->db->f('standard_id'),
'int'));
}
// Location code
$location_code = $this->unmarshal($this->db->f('location_code',
true), 'string');
@@ -353,6 +354,7 @@
'object_type_id = '.$composite->get_object_type_id(),
'area = ' . $this->marshal($composite->get_area(), 'float'),
'furnish_type_id = '.$composite->get_furnish_type_id(),
+ 'standard_id = '.$composite->get_standard_id(),
);
$result = $this->db->query('UPDATE rental_composite SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
@@ -370,7 +372,7 @@
public function add(&$composite)
{
// Build a db-friendly array of the composite object
- $cols = array('name', 'description', 'has_custom_address',
'address_1', 'address_2', 'house_number', 'postcode', 'place',
'object_type_id', 'area', 'furnish_type_id');
+ $cols = array('name', 'description', 'has_custom_address',
'address_1', 'address_2', 'house_number', 'postcode', 'place',
'object_type_id', 'area', 'furnish_type_id', 'standard_id');
$values = array(
"'".$composite->get_name()."'",
"'".$composite->get_description()."'",
@@ -382,7 +384,8 @@
"'".$composite->get_custom_place()."'",
$composite->get_object_type_id(),
$this->marshal($composite->get_area(), 'float'),
- $composite->get_furnish_type_id()
+ $composite->get_furnish_type_id(),
+ $composite->get_standard_id()
);
$query ="INSERT INTO rental_composite (" . join(',', $cols) .
") VALUES (" . join(',', $values) . ")";
Modified: branches/Version-1_0-branch/rental/inc/class.soprice_item.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.soprice_item.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.soprice_item.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -334,8 +334,9 @@
* @param $price_item the price item to add
* @return true if successful, false otherwise
*/
- function add_price_item($contract_id, $price_item_id)
+ function add_price_item($contract_id, $price_item_id,$factor)
{
+ $factor = $factor ? (float) $factor : 1;
$price_item = $this->get_single($price_item_id);
$contract =
rental_socontract::get_instance()->get_single($contract_id);
$rented_area = 0;
@@ -345,7 +346,7 @@
if($rented_area == ''){
$rented_area = 0;
}
- $total_price = ($rented_area *
$price_item->get_price());
+ $total_price = ($rented_area * $price_item->get_price()
* $factor);
//var_dump($total_price, $rented_area,
$price_item->get_price());
}
if($price_item)
@@ -357,7 +358,7 @@
str_replace(',','.',$rented_area),
"'" . $price_item->get_agresso_id() . "'",
$price_item->is_area() ? 'true' : 'false',
- str_replace(',','.',$price_item->get_price()),
+ (str_replace(',','.',$price_item->get_price())
* $factor),
str_replace(',','.',$total_price)
);
$q = "INSERT INTO rental_contract_price_item
(price_item_id, contract_id, title, area, agresso_id, is_area, price,
total_price) VALUES (" . join(',', $values) . ")";
Modified: branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.uibilling.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -652,9 +652,9 @@
}
else
{
- $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
- $billing_info_array =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
-
+ $billing_job =
rental_sobilling::get_instance()->get_single((int)phpgw::get_var('id'));
+ $billing_info_array =
rental_sobilling_info::get_instance()->get(null, null, null, null, null, null,
array('billing_id' => phpgw::get_var('id')));
+ $type = phpgw::get_var('type',
'string', 'GET', 'bk');
if($billing_job == null) // Not found
{
$errorMsgs[] = lang('Could not find specified
billing job.');
@@ -675,7 +675,7 @@
$billing_job->set_year($year);
$billing_job->set_month($month);
- $list =
rental_sobilling::get_instance()->generate_export($billing_job, true);
+ $list =
rental_sobilling::get_instance()->generate_export($billing_job, $type);
//_debug_array($list[0]);
/*foreach ($list as $l)
{
Modified: branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.uicomposite.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -348,6 +348,7 @@
$composite->set_is_active(phpgw::get_var('is_active') == 'on' ? true : false);
$composite->set_description(phpgw::get_var('description'));
$composite->set_furnish_type_id(phpgw::get_var('furnish_type_id'));
+
$composite->set_standard_id(phpgw::get_var('composite_standard_id','int'));
if(rental_socomposite::get_instance()->store($composite))
{
Modified: branches/Version-1_0-branch/rental/inc/class.uicontract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uicontract.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.uicontract.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -839,11 +839,12 @@
{
$contract_id = (int)phpgw::get_var('contract_id');
$price_item_id = (int)phpgw::get_var('price_item_id');
+ $factor = phpgw::get_var('factor','float');
$so_contract = rental_socontract::get_instance();
$contract = $so_contract->get_single($contract_id);
if($contract->has_permission(PHPGW_ACL_EDIT))
{
- return
rental_soprice_item::get_instance()->add_price_item($contract_id,
$price_item_id);
+ return
rental_soprice_item::get_instance()->add_price_item($contract_id,
$price_item_id, $factor);
}
return false;
}
Modified: branches/Version-1_0-branch/rental/inc/class.uiprice_item.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.uiprice_item.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/class.uiprice_item.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -289,6 +289,17 @@
$value['ajax'][] = true;
$value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'rental.uicontract.add_price_item', 'price_item_id' => $value['id'],
'contract_id' => $contract_id)));
$value['labels'][] = lang('add');
+
+ $sogeneric =
CreateObject('property.sogeneric','composite_standard');
+ $composite_standards =
$sogeneric->read(array('allrows' => true));
+ foreach($composite_standards as
$composite_standard)
+ {
+ $value['ajax'][] = true;
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'rental.uicontract.add_price_item', 'price_item_id' => $value['id'],
'contract_id' => $contract_id, 'factor' => $composite_standard['factor'])));
+ $value['labels'][] =
lang('add') . " {$composite_standard['name']}";
+ }
+
+ //FIXME: Add actions for composite standard factors
}
break;
default:
Modified:
branches/Version-1_0-branch/rental/inc/model/class.agresso_gl07.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.agresso_gl07.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/model/class.agresso_gl07.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -44,6 +44,21 @@
public function get_missing_billing_info($contract)
{
+
+ //FIXME: Might have to check for this one...
+ /*
+ static $responsibility_arr = array();
+ static $responsibility_check = array();
+ if(!$responsibility_arr)
+ {
+ $responsibility_arr =
execMethod('property.bogeneric.get_list',array('type' =>
'responsibility_unit'));
+ foreach ($responsibility_arr as $responsibility_entry)
+ {
+
$responsibility_check[$responsibility_entry['id']] = true;
+ }
+ }
+ */
+
$missing_billing_info = array();
$payer_id = $contract->get_payer_id();
Modified:
branches/Version-1_0-branch/rental/inc/model/class.agresso_lg04.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.agresso_lg04.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/model/class.agresso_lg04.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -1,5 +1,6 @@
<?php
phpgw::import_class('rental.socomposite');
+ phpgw::import_class('rental.socontract');
include_class('rental', 'exportable', 'inc/model/');
class rental_agresso_lg04 implements rental_exportable
@@ -46,11 +47,11 @@
return $contents;
}
- public function get_contents_excel()
+ public function get_contents_excel($excel_export_type)
{
if($this->orders == null) // Data hasn't been created
yet
{
- $this->run_excel_export();
+ $this->run_excel_export($excel_export_type);
}
return $this->orders;
}
@@ -167,8 +168,21 @@
return $so_invoice->transaction_commit();
}
- protected function run_excel_export()
+ protected function run_excel_export($excel_export_type)
{
+ switch($excel_export_type)
+ {
+ case 'bk':
+ $get_order_excel = 'get_order_excel_bk';
+ break;
+ case 'nlsh':
+ $get_order_excel =
'get_order_excel_nlsh';
+ break;
+
+ default:
+ $get_order_excel = 'get_order_excel_bk';
+ break;
+ }
$this->orders = array();
$decimal_separator =
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['decimal_separator'])
? $GLOBALS['phpgw_info']['user']['preferences']['rental']['decimal_separator']
: ',';
$thousands_separator =
isset($GLOBALS['phpgw_info']['user']['preferences']['rental']['thousands_separator'])
?
$GLOBALS['phpgw_info']['user']['preferences']['rental']['thousands_separator']
: '.';
@@ -190,6 +204,12 @@
// HACK to get the needed location code for the
building
$building_location_code =
rental_socomposite::get_instance()->get_building_location_code($invoice->get_contract_id());
+ /**Sigurd:Start contract type**/
+ $contract =
rental_socontract::get_instance()->get_single($invoice->get_contract_id());
+ $current_contract_type_id =
$contract->get_contract_type_id();
+ $contract_type_label =
lang(rental_socontract::get_instance()->get_contract_type_label($current_contract_type_id));
+ /**End contract type**/
+
$price_item_data = array();
$price_item_counter = 0;
foreach($price_items as $price_item) // Runs
through all items
@@ -210,8 +230,26 @@
$serialized_party =
$invoice->get_party()->serialize();
$party_name =
$serialized_party['name'];
- $this->orders[] =
$this->get_order_excel(
- $invoice->get_header(),
$invoice->get_party()->get_identifier(), $party_name, $invoice->get_id(),
$this->billing_job->get_year(), $this->billing_job->get_month(),
$invoice->get_account_out(), $data, $invoice->get_responsibility_id(),
$invoice->get_service_id(), $building_location_code,
$invoice->get_project_id(), $composite_name, $invoice->get_reference(),
$price_item_counter
+ $this->orders[] =
$this->$get_order_excel(
+ $invoice->get_header(),
+
$invoice->get_party()->get_identifier(),
+ $party_name,
+ $invoice->get_id(),
+ $this->billing_job->get_year(),
+ $this->billing_job->get_month(),
+ $invoice->get_account_out(),
+ $data,
+
$invoice->get_responsibility_id(),
+ $invoice->get_service_id(),
+ $building_location_code,
+ $invoice->get_project_id(),
+ $composite_name,
+ $invoice->get_reference(),
+ $price_item_counter,
+ $invoice->get_account_in(),//ny
+
$invoice->get_responsibility_id(),//ny
+ $contract_type_label //ny
+
);
$price_item_counter++;
}
@@ -405,7 +443,7 @@
* Builds one single order of the excel file.
*
*/
- protected function get_order_excel($header, $party_id,
$party_name, $order_id, $bill_year, $bill_month, $account, $product_item,
$responsibility, $service, $building, $project, $text, $client_ref, $counter)
+ protected function get_order_excel_bk($header, $party_id,
$party_name, $order_id, $bill_year, $bill_month, $account, $product_item,
$responsibility, $service, $building, $project, $text, $client_ref, $counter)
{
//$order_id = $order_id + 39500000;
@@ -444,6 +482,46 @@
return str_replace(array("\n", "\r"), '', $order);
}
+ protected function get_order_excel_nlsh($header, $party_id,
$party_name, $order_id, $bill_year, $bill_month, $account_out, $product_item,
$responsibility, $service, $building, $project, $text, $client_ref,
$counter,$account_in,$responsibility_id, $contract_type_label)
+ {
+
+//_debug_array(func_get_args());
+ $item_counter = $counter;
+ $order = array
+ (
+ 'Kontraktstype' =>
$contract_type_label,//FIXME
+ 'Art/konto inntektsside' => $account_in,
+ 'Art/konto utgiftsside' => $account_out,//FIXME
+ 'client_ref' => $client_ref,
+ 'header' =>
utf8_decode($header),
+ 'bill_year' =>
$bill_year,
+ 'bill_month' => $bill_month,
+ 'Ansvar' =>
$responsibility_id,//FIXME
+// 'Ansvar2' =>
'BKBPE',//FIXME
+ 'Party' =>
$party_id,
+ 'name' =>
$party_name,
+ 'amount' =>
$this->get_formatted_amount_excel($product_item['amount']),
+// 'amount' =>
$this->get_formatted_amount($product_items[0]['amount']),
+ 'article description' =>
utf8_decode($product_item['article_description']),
+ 'article_code' =>
$product_item['article_code'],
+ 'batch_id' =>
"BKBPE{$this->date_str}",
+ 'client' =>
'BY',
+ 'responsibility' =>
$responsibility,
+ 'service' =>
$service,
+ 'project' =>
$project,
+ 'counter' =>
++$item_counter,
+ 'bill_year' =>
$bill_year,
+ 'bill_month' => $bill_month,
+ 'batch_id' =>
"BKBPE{$this->date_str}",
+ 'client' =>
'BY',
+ 'item_counter' =>
$item_counter,
+ 'text' =>
utf8_decode($text),
+ 'Kommentar' =>
'Kommentar',//FIXME
+ );
+
+ return str_replace(array("\n", "\r"), '', $order);
+ }
+
protected function get_formatted_amount($amount)
{
$amount = round($amount, 2) * 100;
Modified: branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/model/class.composite.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -23,6 +23,7 @@
protected $area;
protected $status;
protected $furnish_type_id;
+ protected $standard_id;
protected $units;
protected $contracts;
@@ -269,7 +270,7 @@
public function get_furnish_type_id() {
return (int) $this->furnish_type_id;
}
-
+
public function get_furnish_type() {
$furnish_types = $this->get_furnish_types();
@@ -289,6 +290,30 @@
return self::$furnish_types_arr;
}
+ public function set_standard_id($standard_id)
+ {
+// _debug_array($standard_id);die();
+ $this->standard_id = (int)$standard_id;
+ }
+
+ public function get_standard_id()
+ {
+ return (int) $this->standard_id;
+ }
+
+ /**
+ * Fetch composite standards on the form array(array('id' => 1,
'name' => 'some text', 'selected' => 1|0))
+ * @return array
+ */
+ public function get_standards($selected)
+ {
+ if( $composite_standards =
execMethod('property.bogeneric.get_list',array('type' => 'composite_standard',
'selected' => $selected)))
+ {
+ array_unshift ($composite_standards,array('id'
=> '', 'name' => lang('none')));
+ }
+ return $composite_standards;
+ }
+
public function set_area($area) {
$this->area = $area;
}
Modified: branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -1085,6 +1085,19 @@
return false;
}
+ /**
+ * Fetch responsibility candidates on the form array(array('id'
=> 1, 'name' => 'some text', 'selected' => 1|0))
+ * @return array
+ */
+ public function get_responsibility_arr($selected)
+ {
+ if( $responsibility_arr =
execMethod('property.bogeneric.get_list',array('type' => 'responsibility_unit',
'selected' => $selected)))
+ {
+ array_unshift ($responsibility_arr,array('id'
=> '', 'name' => lang('none')));
+ }
+ return $responsibility_arr;
+ }
+
public function set_rented_area($rented_area)
{
$this->rented_area = $rented_area;
@@ -1143,6 +1156,11 @@
$this->set_validation_error('responsibility_id',
lang('responsibility_id_not_numeric'));
$valid_numeric = false;
}
+
+ if($this->get_responsibility_id() != null &&
is_numeric($this->get_responsibility_id()) && $this->get_responsibility_arr()){
+ $valid_numeric = true; // this one is ok
+ }
+
if($this->get_account_in() != null &&
!is_numeric($this->get_account_in())){
$this->set_validation_error('account_in',
lang('account_in_not_numeric'));
$valid_numeric = false;
Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang 2014-07-30
13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang 2014-07-30
13:43:29 UTC (rev 12043)
@@ -101,6 +101,8 @@
composite_back rental no Leieobjektsliste
composite_has_contract rental no Leieobjekt med aktive kontrakter
composite_has_no_contract rental no Leieobjekt uten aktive
kontrakter
+composite standard rental no Leieobjekt standard
+factor common no Faktor
contract rental no Kontrakt
contract_back rental no Kontraktsliste
contract_id rental no Kontraktsnummer
Modified: branches/Version-1_0-branch/rental/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/setup.inc.php 2014-07-30
13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/setup/setup.inc.php 2014-07-30
13:43:29 UTC (rev 12043)
@@ -1,6 +1,6 @@
<?php
$setup_info['rental']['name'] = 'rental'; // Module
identifier
- $setup_info['rental']['version'] = '0.1.0.17'; // Current module
version
+ $setup_info['rental']['version'] = '0.1.0.18'; // Current module
version
$setup_info['rental']['app_order'] = 51; // (?)
$setup_info['rental']['tables'] = array(
'rental_party', // All
contract participants, tenants etc.
@@ -8,7 +8,9 @@
'rental_contract_composite', // Connection between
contracts and composites
'rental_contract_party', // Connection
between tenants and contracts
'rental_composite', //
Rental object, an aggregation of rental units
+ 'rental_composite_standard', // Optional standard
clsasses
'rental_contract_price_item', // Price items from the
price book tied to a contract
+ 'rental_contract_responsibility_unit', // optional list of
candidates
'rental_billing', //
Contains information about the job creating invoices
'rental_invoice', //
Contract invoices
'rental_invoice_price_item', // Price items from the
contract tied to a past invoice
Modified: branches/Version-1_0-branch/rental/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/tables_current.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/setup/tables_current.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -28,13 +28,25 @@
'has_custom_address' => array('type' =>
'bool','nullable' => false,'default' => 'false'),
'object_type_id' => array('type' => 'int', 'precision'
=> 2, 'nullable' => true, 'default' => null),
'area' => array('type' => 'decimal',
'precision' => '20','scale' => '2', 'nullable' => true),
- 'furnish_type_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true)
+ 'furnish_type_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true),
+ 'standard_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => true)
),
'pk' => array('id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
),
+ 'rental_composite_standard' => array(
+ 'fd' => array(
+ 'id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'name' =>
array('type' => 'varchar','precision' => '255','nullable' => false),
+ 'factor' => array('type' => 'decimal',
'precision' => '20','scale' => '2', 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
'rental_unit' => array(
'fd' => array(
'id' => array('type'
=> 'auto', 'nullable' => false),
@@ -70,6 +82,17 @@
'ix' => array(),
'uc' => array()
),
+ 'rental_contract_responsibility_unit' => array(
+ 'fd' => array(
+ 'id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'name' =>
array('type' => 'varchar','precision' => '255','nullable' => false)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ ),
+
// Describes different billing terms like 'Monthly', 'Yearly',
etc.
'rental_billing_term' => array(
'fd' => array(
Modified: branches/Version-1_0-branch/rental/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/setup/tables_update.inc.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/setup/tables_update.inc.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -297,3 +297,47 @@
$GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.17';
return $GLOBALS['setup_info']['rental']['currentver'];
}
+
+
+ $test[] = '0.1.0.17';
+ function rental_upgrade0_1_0_17()
+ {
+ $GLOBALS['phpgw']->locations->add('.admin', 'Admin section',
'rental');
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('rental_composite','standard_id',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => 'True'
+ ));
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_composite_standard', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => false),
+ 'name' => array('type' =>
'varchar','precision' => '255','nullable' => false),
+ 'factor' => array('type' => 'decimal', 'precision' =>
'20','scale' => '2', 'nullable' => true),
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->CreateTable(
+ 'rental_contract_responsibility_unit', array(
+ 'fd' => array(
+ 'id' => array('type' =>
'int','precision' => '4','nullable' => false),
+ 'name' => array('type' =>
'varchar','precision' => '255','nullable' => false)
+ ),
+ 'pk' => array('id'),
+ 'fk' => array(),
+ 'ix' => array(),
+ 'uc' => array()
+ )
+ );
+
+ $GLOBALS['setup_info']['rental']['currentver'] = '0.1.0.18';
+ return $GLOBALS['setup_info']['rental']['currentver'];
+ }
+
Modified: branches/Version-1_0-branch/rental/templates/base/billing.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/billing.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/templates/base/billing.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -107,7 +107,8 @@
{
?>
<a href="<?php echo $download_link ?>"><?php
echo lang('Download export') ?></a><br />
- <a href="<?php echo $download_link . '&toExcel=true'
?>">Last ned eksportfil i Excel-format</a>
+ <a href="<?php echo $download_link .
'&toExcel=true&type=bk' ?>"><?php echo lang('Download Excel export') .
' BK'?></a><br />
+ <a href="<?php echo $download_link .
'&toExcel=true&type=nlsh' ?>">Last ned eksportfil i Excel-format
NLSH</a>
<?php
if(!$billing_job->is_commited())
{
Modified: branches/Version-1_0-branch/rental/templates/base/composite.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/composite.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/templates/base/composite.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -73,6 +73,47 @@
?>
</dd>
<dt>
+ <!-- composite standard -->
+ <label
for="composite_standard_id"><?php echo lang('composite standard') ?></label>
+ <?php
+
$cur_standard_id = $composite->get_standard_id();
+
+
$composite_standard_arr = $composite->get_standards($cur_standard_id);
+
+ // Edit composite
+ if ($editable &&
$composite_standard_arr)
+ {
+ ?>
+ <select
name="composite_standard_id">
+ <?php
+
foreach($composite_standard_arr as $composite_standard)
+ {
+
echo "<option ".($composite_standard['selected'] == 1 ? 'selected="selected"' :
"")."
value=\"{$composite_standard['id']}\">{$composite_standard['name']}</option>";
+ }
+ ?>
+ </select>
+ <?php
+ // View composite
+ }
+ else
if($composite_standard_arr)
+ {
+
$composite_standard_name = '';
+
foreach($composite_standard_arr as $composite_standard)
+ {
+ if
($composite_standard['selected'] == 1)
+ {
+
$composite_standard_name = $composite_standard['name'];
+
break;
+ }
+ }
+
+ ?>
+ <input
type="text" id="composite_standard_id" value='<?php echo
$composite_standard_name; ?>' disabled="disabled" />
+ <?php
+
+ } ?>
+ </dt>
+ <dt>
<!-- Furnish status -->
<label
for="furnish_type_id"><?php echo lang('furnish_type') ?></label>
<?php
@@ -82,21 +123,21 @@
// Edit composite
if ($editable) { ?>
<select
name="furnish_type_id">
- <?php
+ <?php
foreach($furnish_types_arr as $id => $title){
if($cur_furnish_type_id == $id)
echo "<option selected='true' value='$id'>" . $title . "</option>";
-
else
+
else
echo "<option value='$id'>" . $title . "</option>";
}
?>
- </select>
- <?php
+ </select>
+ <?php
// View composite
}else{ ?>
<input
type="text" id="furnish_type_id" value='<?php echo
$furnish_types_arr[$cur_furnish_type_id]; ?>' disabled="disabled" />
<?php } ?>
- </dt>
+ </dt>
<?php if ($editable) { // Only show
custom address fields if we're in edit mode ?>
<dt>
<label
for="has_custom_address"><?php echo lang('has_custom_address') ?></label>
Modified: branches/Version-1_0-branch/rental/templates/base/contract.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/contract.php
2014-07-30 13:39:00 UTC (rev 12042)
+++ branches/Version-1_0-branch/rental/templates/base/contract.php
2014-07-30 13:43:29 UTC (rev 12043)
@@ -491,10 +491,30 @@
</dt>
<dd>
<?php
- if ($editable) {
- ?>
- <input type="text"
name="responsibility_id" id="responsibility_id" value="<?php echo
$contract->get_responsibility_id(); ?>"/>
- <?php
+ if ($editable)
+ {
+ $cur_responsibility_id
= $contract->get_responsibility_id();
+
$contract_responsibility_arr =
$contract->get_responsibility_arr($cur_responsibility_id);
+
+
if($contract_responsibility_arr)
+ {
+ ?>
+ <select
name="responsibility_id">
+ <?php
+
foreach($contract_responsibility_arr as $contract_responsibility)
+ {
+
echo "<option ".($contract_responsibility['selected'] == 1 ?
'selected="selected"' : "")."
value=\"{$contract_responsibility['id']}\">{$contract_responsibility['name']}</option>";
+ }
+ ?>
+ </select>
+ <?php
+ }
+ else
+ {
+ ?>
+ <input
type="text" name="responsibility_id" id="responsibility_id" value="<?php echo
$contract->get_responsibility_id(); ?>"/>
+ <?php
+ }
}
else
{
@@ -556,7 +576,7 @@
$cid =
$contract->get_id();
if(!isset($cid) || $cid
<= 0)
{
- echo '';
+ echo
rental_socontract::get_instance()->get_default_account($contract->get_location_id(),
false);
}
else
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [12043] Merge 12039:12042 from trunk,
Sigurd Nes <=