[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11186] Merge 11162:11185 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11186] Merge 11162:11185 from trunk |
Date: |
Mon, 17 Jun 2013 13:26:53 +0000 |
Revision: 11186
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11186
Author: sigurdne
Date: 2013-06-17 13:26:53 +0000 (Mon, 17 Jun 2013)
Log Message:
-----------
Merge 11162:11185 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/booking/inc/class.async_task_update_reservation_state.inc.php
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation.inc.php
branches/Version-1_0-branch/controller/inc/class.socase.inc.php
branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
branches/Version-1_0-branch/controller/js/controller/case.js
branches/Version-1_0-branch/controller/js/controller/check_list.js
branches/Version-1_0-branch/controller/setup/phpgw_no.lang
branches/Version-1_0-branch/controller/setup/setup.inc.php
branches/Version-1_0-branch/controller/setup/tables_current.inc.php
branches/Version-1_0-branch/controller/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
branches/Version-1_0-branch/controller/templates/base/case/case_row.xsl
branches/Version-1_0-branch/controller/templates/base/case/view_closed_cases.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
branches/Version-1_0-branch/controller/templates/base/css/base.css
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
branches/Version-1_0-branch/property/inc/class.soentity.inc.php
branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
branches/Version-1_0-branch/rental/templates/base/contract_list.php
Added Paths:
-----------
branches/Version-1_0-branch/controller/js/controller/check_list_update_status.js
branches/Version-1_0-branch/controller/js/controller/control_group_to_component.js
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
+
/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
Modified:
branches/Version-1_0-branch/booking/inc/class.async_task_update_reservation_state.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.async_task_update_reservation_state.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/booking/inc/class.async_task_update_reservation_state.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -7,7 +7,12 @@
public function run($options = array()) {
$db = & $GLOBALS['phpgw']->db;
- $reservation_types = array('booking', 'event',
'allocation');
+ $reservation_types = array
+ (
+ 'booking',
+ 'event',
+ 'allocation'
+ );
$completed_so =
CreateObject('booking.socompleted_reservation');
foreach ($reservation_types as $reservation_type) {
@@ -31,3 +36,40 @@
}
}
}
+
+/*
+Begreper:
+application - Søknad
+allocation - tildeling
+booking - Booking
+event - Arrangementer
+reservation - reservasjon / betalingsgrunnlag
+
+En Søknad (application) kan resultere i en tildeling(allocation) eller et
Arrangement(event).
+En tildeling(allocation) kan deles opp i flere Booking(booking).
+
+Utgangspunktet for 'Klar for fakturering' ligger i tabellen
'bb_completed_reservation'
+
+Denne (reservation) er satt sammen av tre ulike element-typer:
tildeling(allocation), Booking(booking) og Arrangement(event)
+
+En Booking referer til en tildeling (allocation_id).
+
+For å produsere innholdet i bb_completed_reservation:
+
+cron-job som starter i
booking/inc/class.async_task_update_reservation_state.inc.php
+
+async_task_update_reservation_state::run()
+
+Uttrekket defineres her (pr type):
+
+ booking_sobooking::find_expired();
+ booking_soallocation::find_expired();
+ booking_soevent::find_expired();
+
+Oppgaven her blir da:
+
+1) Alle kandidater for 'booking' skal faktureres (som før)
+2) Alle kandidater for 'event' skal faktureres (som før)
+3) kandidater for 'allocation' som ikke er referert til fra 'booking' skal
faktureres (omarbeides)
+
+*/
Modified:
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation.inc.php
===================================================================
---
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/booking/inc/class.socompleted_reservation.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -122,7 +122,7 @@
|| count($reservation['resources']) <=
0)
{
- //Note that the loggin is stupidly enough done
in the database so if the transaction fails
+ //Note that if the transaction fails
//we may very well not get anything in the log
if(is_object($GLOBALS['phpgw']->log))
{
Modified: branches/Version-1_0-branch/controller/inc/class.socase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socase.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.socase.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -84,6 +84,7 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
return $case;
}
@@ -124,7 +125,8 @@
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
$case->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
-
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
+
$cases_array[] = $case;
}
@@ -152,7 +154,8 @@
'modified_date',
'modified_by',
'measurement',
- 'location_code'
+ 'location_code',
+ 'component_id'
);
$values = array(
@@ -166,7 +169,8 @@
$this->marshal($case->get_modified_date(),
'int'),
$this->marshal($case->get_modified_by(), 'int'),
$this->marshal($case->get_measurement(),
'string'),
- $this->marshal($case->get_location_code(),
'string')
+ $this->marshal($case->get_location_code(),
'string'),
+ $this->marshal($case->get_component_id(),
'int'),
);
$sql = 'INSERT INTO controller_check_item_case (' .
join(',', $cols) . ') VALUES (' . join(',', $values) . ')';
@@ -287,16 +291,7 @@
function delete($case_id)
{
$case_id = (int) $case_id;
- $status = $this->db->query("DELETE FROM
controller_check_item_case WHERE id = $case_id");
-
- if( $status )
- {
- return true;
- }
- else
- {
- return false;
- }
+ return $this->db->query("DELETE FROM
controller_check_item_case WHERE id = $case_id");
}
function get_id_field_name(){}
Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -272,10 +272,14 @@
public function get_check_items_with_cases($check_list_id,
$type = "control_item_type_1", $status = "open", $messageStatus = null,
$location_code = null)
{
$check_list_id = (int) $check_list_id;
- $sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, ";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
check_list_id, component_location_id,";
$sql .= "cic.id as cic_id, cic.status as cic_status,
cic.*, ";
$sql .= "coi.id as coi_id, coi.* ";
- $sql .= "FROM controller_check_item ci ";
+ // $sql .= "FROM controller_check_item ci ";
+
+ $sql .= "FROM controller_control_group JOIN
controller_control_item ON
controller_control_item.control_group_id=controller_control_group.id ";
+ $sql .= "JOIN controller_check_item ci ON
ci.control_item_id = controller_control_item.id ";
+
$sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id = coi.id ";
$sql .= "LEFT JOIN controller_check_item_case as cic ON
ci.id = cic.check_item_id ";
$sql .= "WHERE ci.check_list_id = {$check_list_id} ";
@@ -311,7 +315,7 @@
$sql .= "AND cic.location_item_id > 0 ";
}
- if($location_code != null)
+ if($location_code != null)
{
$sql .= "AND cic.location_code =
'$location_code' ";
}
@@ -343,6 +347,7 @@
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
+
$control_item->set_component_location_id($this->db->f('component_location_id'),
'int');
$control_item->set_type($this->db->f('type', true), 'string');
$check_item->set_control_item($control_item);
@@ -363,7 +368,7 @@
$case->set_modified_date($this->unmarshal($this->db->f('modified_date'),
'int'));
$case->set_modified_by($this->unmarshal($this->db->f('modified_by'), 'int'));
$case->set_measurement($this->unmarshal($this->db->f('measurement', true),
'string'));
-
+
$case->set_component_id($this->unmarshal($this->db->f('component_id'), 'int'));
$cases_array[] = $case;
}
@@ -395,10 +400,11 @@
{
$message_ticket_id = (int) $message_ticket_id;
- $sql = "SELECT ci.id as ci_id, control_item_id, ";
+ $sql = "SELECT ci.id as ci_id, control_item_id,
component_location_id,";
$sql .= "check_list_id, cic.id as cic_id, cic.status as
cic_status, cic.*, ";
$sql .= "coi.id as coi_id, coi.* ";
- $sql .= "FROM controller_check_item ci ";
+ $sql .= "FROM controller_control_group JOIN
controller_control_item ON
controller_control_item.control_group_id=controller_control_group.id ";
+ $sql .= "JOIN controller_check_item ci ON
ci.control_item_id = controller_control_item.id ";
$sql .= "LEFT JOIN controller_control_item as coi ON
ci.control_item_id = coi.id ";
$sql .= "LEFT JOIN controller_check_item_case as cic ON
ci.id = cic.check_item_id ";
$sql .= "WHERE cic.location_item_id =
{$message_ticket_id}";
@@ -428,6 +434,7 @@
$control_item->set_what_to_do($this->db->f('what_to_do', true), 'string');
$control_item->set_how_to_do($this->db->f('how_to_do', true), 'string');
$control_item->set_control_group_id($this->db->f('control_group_id'), 'int');
+
$control_item->set_component_location_id($this->db->f('component_location_id'),
'int');
$control_item->set_type($this->db->f('type', true), 'string');
$check_item->set_control_item($control_item);
Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -654,12 +654,22 @@
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
+ $location_arr = explode('-', $location_code);
+ $loc_name_arr = array();
+ $i = 1;
+ foreach ($location_arr as $_part)
+ {
+ $loc_name_arr[] =
$location_array["loc{$i}_name"];
+ $i++;
+ }
+
$controls_array[] = array
(
- "id" => $control_id,
- "title" => $title,
- "location_code" => $location_code,
- "loc1_name" =>
$location_array["loc1_name"]
+ 'id' => $control_id,
+ 'title' => $title,
+ 'location_code' => $location_code,
+ 'loc1_name' =>
$location_array['loc1_name'],
+ 'loc_name' => implode(',
', $loc_name_arr)
);
}
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -62,7 +62,9 @@
'group_name',
'procedure_id',
'control_area_id',
- 'building_part_id'
+ 'building_part_id',
+ 'component_location_id',
+ 'component_criteria'
);
$values = array(
@@ -70,6 +72,8 @@
$this->marshal($control_group->get_procedure_id(), 'int'),
$this->marshal($control_group->get_control_area_id(), 'int'),
$this->marshal($control_group->get_building_part_id(), 'string'),
+
$this->marshal($control_group->get_component_location_id(), 'int'),
+
$this->marshal(serialize($control_group->get_component_criteria()), 'string')
);
$result = $this->db->query('INSERT INTO
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',',
$values) . ')', __LINE__,__FILE__);
@@ -100,7 +104,9 @@
'group_name = ' .
$this->marshal($control_group->get_group_name(), 'string'),
'procedure_id = '.
$this->marshal($control_group->get_procedure_id(), 'int'),
'control_area_id = ' .
$this->marshal($control_group->get_control_area_id(), 'int'),
- 'building_part_id = ' .
$this->marshal($control_group->get_building_part_id(), 'string')
+ 'building_part_id = ' .
$this->marshal($control_group->get_building_part_id(), 'string'),
+ 'component_location_id = '.
$this->marshal($control_group->get_component_location_id(), 'int'),
+ 'component_criteria = ' .
$this->marshal(serialize($control_group->get_component_criteria()), 'string')
);
$result = $this->db->query('UPDATE
controller_control_group SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
@@ -136,6 +142,10 @@
$category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
$control_group->set_control_area_name($category[0]['name']);
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
+ $component_criteria =
$this->db->f('component_criteria') ?
unserialize($this->db->f('component_criteria',true)) : array();
+
$control_group->set_component_criteria($component_criteria);
+
return $control_group;
}
@@ -225,6 +235,7 @@
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$results[] = $control_group->toArray();
}
@@ -322,6 +333,9 @@
$category =
execMethod('phpgwapi.categories.return_single',
$this->unmarshal($this->db->f('control_area_id', 'int')));
$control_group->set_control_area_name($category[0]['name']);
+
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
+
}
return $control_group;
@@ -353,7 +367,7 @@
$control_group->set_control_area_name($category[0]['name']);
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'string'));
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr',
true), 'string'));
-
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
$control_groups_array[] =
$control_group->toArray();
}
@@ -439,13 +453,16 @@
* @param $component id component id
* @return void
*/
+
+ //FIXME: Sigurd : Not used
function add_component_to_control_group($control_group_id,
$location_id)
{
$sql = "INSERT INTO
controller_control_group_component_list (control_group_id, location_id)
values($control_group_id, $location_id)";
$this->db->query($sql);
}
- function exist_component_control_group($control_group_id,
$location_id)
+ //FIXME: Sigurd : Not used
+ function exist_component_control_group($control_group_id,
$location_id)
{
$sql = "SELECT * FROM
controller_control_group_component_list WHERE
control_group_id=$control_group_id AND location_id=$location_id";
$this->db->query($sql);
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -223,7 +223,11 @@
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'int'));
+
$control_group->set_component_location_id($this->unmarshal($this->db->f('component_location_id'),
'int'));
+ $component_criteria =
$this->db->f('component_criteria') ?
unserialize($this->db->f('component_criteria',true)) : array();
+
$control_group->set_component_criteria($component_criteria);
+
if($returnType == "array")
{
$control_group_list[] =
$control_group->toArray();
Modified: branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.uicalendar.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -445,9 +445,9 @@
{
static $_location_name = array();
- $control_id = phpgw::get_var('control_id');
+ $control_id = phpgw::get_var('control_id', 'int');
$control = $this->so_control->get_single($control_id);
- $year = phpgw::get_var('year');
+ $year = phpgw::get_var('year', 'int');
if (is_numeric($control_id) & $control_id > 0)
{
@@ -574,13 +574,13 @@
$heading_array = year_calendar::get_heading_array();
$data = array
- (
- 'my_locations' => $my_locations,
- 'control' => $control->toArray(),
- 'heading_array' => $heading_array,
- 'locations_with_calendar_array' =>
$locations_with_calendar_array,
- 'components_with_calendar_array' =>
$components_with_calendar_array,
- 'current_year' => $year,
+ (
+ 'my_locations'
=> $my_locations,
+ 'control'
=> $control->toArray(),
+ 'heading_array'
=> $heading_array,
+ 'locations_with_calendar_array' =>
$locations_with_calendar_array,
+ 'components_with_calendar_array' =>
$components_with_calendar_array,
+ 'current_year'
=> $year,
);
self::render_template_xsl(array('calendar/view_calendar_year_for_locations',
'calendar/check_list_status_manager',
Modified: branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.uicase.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -67,9 +67,9 @@
private $delete;
var $public_functions = array(
- 'add_case' => true,
+ 'add_case' => true,
'save_case' => true,
- 'save_case_ajax' => true,
+ 'save_case_ajax' => true,
'create_case_message' => true,
'view_case_message' => true,
'send_case_message' => true,
@@ -77,7 +77,7 @@
'delete_case' => true,
'close_case' => true,
'open_case' => true,
- 'view_open_cases' => true,
+ 'view_open_cases' => true,
'view_closed_cases' => true
);
@@ -85,17 +85,17 @@
{
parent::__construct();
- $this->so =
CreateObject('controller.socase');
- $this->so_control =
CreateObject('controller.socontrol');
+ $this->so =
CreateObject('controller.socase');
+ $this->so_control =
CreateObject('controller.socontrol');
$this->so_control_item =
CreateObject('controller.socontrol_item');
$this->so_check_item =
CreateObject('controller.socheck_item');
$this->so_procedure =
CreateObject('controller.soprocedure');
$this->so_control_group_list =
CreateObject('controller.socontrol_group_list');
$this->so_control_group =
CreateObject('controller.socontrol_group');
$this->so_control_item_list =
CreateObject('controller.socontrol_item_list');
- $this->so_check_list =
CreateObject('controller.socheck_list');
+ $this->so_check_list =
CreateObject('controller.socheck_list');
- $this->location_finder = new location_finder();
+ $this->location_finder = new location_finder();
$this->read =
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_READ, 'controller');//1
$this->add =
$GLOBALS['phpgw']->acl->check('.checklist', PHPGW_ACL_ADD, 'controller');//2
@@ -106,8 +106,9 @@
function add_case()
{
$check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
$check_list =
$this->so_check_list->get_single($check_list_id);
- $control =
$this->so_control->get_single($check_list->get_control_id());
+ $control =
$this->so_control->get_single($check_list->get_control_id());
$saved_control_groups =
$this->so_control_group_list->get_control_groups_by_control($control->get_id());
@@ -125,7 +126,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$type = 'component';
@@ -134,57 +135,117 @@
else
{
$location_code =
$check_list->get_location_code();
+ $location_code_search_components =
$case_location_code ? $case_location_code : $location_code;
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$type = 'location';
}
+
+ //Populating array with saved control items for each
group
+ //Cache result
+ $components_at_location = array();
- //Populating array with saved control items for each
group
foreach ($saved_control_groups as $control_group)
{
$saved_control_items =
$this->so_control_item_list->get_control_items_and_options_by_control_and_group($control->get_id(),
$control_group->get_id(), "return_array");
if(count($saved_control_items) > 0)
{
- $control_groups_with_items_array[] =
array("control_group" => $control_group->toArray(), "control_items" =>
$saved_control_items);
+ $component_location_id =
$control_group->get_component_location_id();
+ if($component_location_id)
+ {
+ //// start components
+ $criterias_array = array();
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+ $criterias_array['location_id']
= $component_location_id;
+
$criterias_array['location_code'] = $location_code_search_components;
+ $criterias_array['allrows'] =
true;
+
+ $component_criteria =
$control_group->get_component_criteria();
+ $conditions = array();
+ foreach ($component_criteria as
$attribute_id => $condition_value)
+ {
+ if($condition_value)
+ {
+ $conditions[] =
array
+ (
+
'attribute_id' => $attribute_id,
+
'operator' => 'equal',
+ 'value'
=> $condition_value,
+ );
+ }
+ }
+ $criterias_array['conditions']
= $conditions;
+
+ if(
!isset($components_at_location[$component_location_id][$location_code_search_components])
|| !$_components_at_location =
$components_at_location[$component_location_id][$location_code_search_components])
+ {
+
$_components_at_location = execMethod('property.soentity.get_eav_list',
$criterias_array);
+
$components_at_location[$component_location_id][$location_code_search_components]
= $_components_at_location;
+ }
+
+ /// end components
+
+ if($_components_at_location)
+ {
+
$control_groups_with_items_array[] = array
+ (
+ 'control_group'
=> $control_group->toArray(),
+ 'control_items'
=> $saved_control_items,
+
'components_at_location' => array('component_options' =>
$_components_at_location)
+ );
+ }
+ }
+ else
+ {
+
$control_groups_with_items_array[] = array
+ (
+ 'control_group' =>
$control_group->toArray(),
+ 'control_items' =>
$saved_control_items
+ );
+ }
}
+
}
-
$level =
$this->location_finder->get_location_level($location_code);
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
- $user_role = true;
+ $user_role = true;
// Fetches buildings on property
$buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
-
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id'] ==
$case_location_code ? 1 : 0;
+ }
+
$data = array
(
'control'
=> $control,
'check_list'
=> $check_list,
- 'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'buildings_on_property'
=> $buildings_on_property,
+ 'location_array'
=> $location_array,
'component_array'
=> $component_array,
'control_groups_with_items_array' =>
$control_groups_with_items_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code'
=> $building_location_code,
+ // 'building_location_code'
=> $building_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
- 'cases_view' => 'add_case',
+ 'cases_view'
=> 'add_case',
);
phpgwapi_jquery::load_widget('core');
self::add_javascript('controller', 'controller',
'custom_ui.js');
self::add_javascript('controller', 'controller',
'ajax.js');
- self::add_javascript('controller', 'controller', 'case.js');
- self::add_javascript('controller', 'controller', 'check_list.js');
-
+ self::add_javascript('controller', 'controller',
'case.js');
+ self::add_javascript('controller', 'controller',
'check_list.js');
+ self::add_javascript('controller', 'controller',
'check_list_update_status.js');
+
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/nav_control_plan',
-
'check_list/fragments/check_list_top_section', 'case/add_case',
-
'check_list/fragments/select_buildings_on_property'), $data);
+
'check_list/fragments/check_list_top_section', 'case/add_case',
+
'check_list/fragments/select_buildings_on_property'), $data);
}
function save_case_ajax()
@@ -199,7 +260,9 @@
$case_descr = phpgw::get_var('case_descr');
$type = phpgw::get_var('type');
$status = phpgw::get_var('status');
- $location_code = phpgw::get_var('location_code');
+ $location_code = phpgw::get_var('location_code');
+ $component_id = phpgw::get_var('component_id', 'int');
+
$check_list =
$this->so_check_list->get_single($check_list_id);
@@ -232,7 +295,8 @@
$case->set_modified_by($user_id);
$case->set_modified_by($user_id);
$case->set_status($status);
- $case->set_location_code( $location_code );
+ $case->set_location_code( $location_code );
+ $case->set_component_id($component_id);
// Saves selected value from or measurement
if($type == 'control_item_type_2')
@@ -336,7 +400,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$building_location_code =
$this->location_finder->get_building_location_code($component_arr['location_code']);
@@ -519,7 +583,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$type = 'component';
@@ -538,18 +602,18 @@
$data = array
(
- 'control' =>
$control->toArray(),
+ 'control' =>
$control->toArray(),
'message_ticket_id' =>
$message_ticket_id,
- 'message_ticket' => $message_ticket,
- 'category' =>
$category[0]['name'],
- 'location_array' => $location_array,
+ 'message_ticket' =>
$message_ticket,
+ 'category' =>
$category[0]['name'],
+ 'location_array' =>
$location_array,
'component_array' => $component_array,
- 'control_array' =>
$control->toArray(),
- 'check_list' =>
$check_list->toArray(),
+ 'control_array' =>
$control->toArray(),
+ 'check_list' =>
$check_list->toArray(),
'check_items_and_cases' =>
$check_items_and_cases,
- 'current_year' => $year,
+ 'current_year' => $year,
'current_month_nr' => $month,
- 'type' => $type,
+ 'type' => $type,
'building_location_code' =>
$building_location_code,
'location_level' =>
$level
);
@@ -665,13 +729,13 @@
function view_open_cases()
{
- $check_list_id = phpgw::get_var('check_list_id');
- $case_location_code = phpgw::get_var('location_code');
+ $check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
$check_list =
$this->so_check_list->get_single($check_list_id);
$control =
$this->so_control->get_single($check_list->get_control_id());
- $check_list_location_code = $check_list->get_location_code();
+ $check_list_location_code =
$check_list->get_location_code();
$component_id = $check_list->get_component_id();
@@ -685,7 +749,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$type = 'component';
@@ -699,67 +763,85 @@
}
- $level =
$this->location_finder->get_location_level($check_list_location_code);
+ $level =
$this->location_finder->get_location_level($check_list_location_code);
$year = date("Y", $check_list->get_deadline());
$month = date("n", $check_list->get_deadline());
- $user_role = true;
+ $user_role = true;
// Fetches buildings on property
$buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role,
$check_list_location_code, $level);
- if( count($buildings_on_property) > 0 )
- {
- if($case_location_code == "")
- {
- $case_location_code = $buildings_on_property[0]['id'];
- }
+ if( count($buildings_on_property) > 0 )
+ {
+ // $case_location_code = $case_location_code ?
$case_location_code : $buildings_on_property[0]['id'];
- $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, $case_location_code);
- }
+ $open_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, $type = null,
'open_or_waiting', null, $case_location_code);
+
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id']
== $case_location_code ? 1 : 0;
+ }
+
+ }
foreach($open_check_items_and_cases as $key =>
$check_item)
{
$control_item_with_options =
$this->so_control_item->get_single_with_options(
$check_item->get_control_item_id() );
+
+ $component_location_id =
$check_item->get_control_item()->get_component_location_id();
- $check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
+ foreach($check_item->get_cases_array() as $case)
+ {
+ $component_id =
$case->get_component_id();
+ if($component_id)
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
+
$case->set_component_descr($short_desc);
+ }
+ }
+
+ $check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
$open_check_items_and_cases[$key] = $check_item;
}
$data = array
(
- 'control' => $control,
+ 'control' => $control,
'check_list'
=> $check_list,
'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'location_array' =>
$location_array,
'component_array'
=> $component_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code' =>
$case_location_code,
+ // 'building_location_code' =>
$case_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
'open_check_items_and_cases' =>
$open_check_items_and_cases,
- 'cases_view' => 'open_cases'
+ 'cases_view' =>
'open_cases'
);
- phpgwapi_jquery::load_widget('core');
- self::add_javascript('controller', 'controller', 'case.js');
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller',
'case.js');
+ self::add_javascript('controller', 'controller',
'check_list_update_status.js');
self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_open_cases', 'case/case_row',
-
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
-
'check_list/fragments/select_buildings_on_property'), $data );
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
}
function view_closed_cases()
{
$check_list_id = phpgw::get_var('check_list_id');
+ $case_location_code = phpgw::get_var('location_code');
+
$check_list =
$this->so_check_list->get_single($check_list_id);
- // Check list top section info
+ // Check list top section info
$control =
$this->so_control->get_single($check_list->get_control_id());
- $location_code = $check_list->get_location_code();
+ $location_code = $check_list->get_location_code();
- $component_id = $check_list->get_component_id();
+ $component_id = $check_list->get_component_id();
if($component_id > 0)
{
@@ -771,7 +853,7 @@
$component = new controller_component();
$component->set_location_code(
$component_arr['location_code'] );
- $component->set_xml_short_desc( $short_desc );
+ $component->set_xml_short_desc( $short_desc );
$component_array = $component->toArray();
$type = 'component';
@@ -783,47 +865,78 @@
$location_array =
execMethod('property.bolocation.read_single', array('location_code' =>
$location_code));
$type = 'location';
}
- // Check list top section info
+ // Check list top section info
- $level =
$this->location_finder->get_location_level($location_code);
- $year = date("Y", $check_list->get_deadline());
- $month = date("n", $check_list->get_deadline());
+ $level =
$this->location_finder->get_location_level($location_code);
+ $year = date("Y", $check_list->get_deadline());
+ $month = date("n", $check_list->get_deadline());
- $user_role = true;
+ $user_role = true;
- // Fetches buildings on property
- $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
+ // Fetches buildings on property
+ $buildings_on_property =
$this->location_finder->get_buildings_on_property($user_role, $location_code,
$level);
- if( count($buildings_on_property) > 0 )
- {
- $building_location_code = $buildings_on_property[0]['id'];
- $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, $building_location_code);
- }
+ if( count($buildings_on_property) > 0 )
+ {
+ // $building_location_code =
$buildings_on_property[0]['id'];
+ $closed_check_items_and_cases =
$this->so_check_item->get_check_items_with_cases($check_list_id, null,
'closed', null, $case_location_code);
+ foreach ( $buildings_on_property as &$building)
+ {
+ $building['selected'] = $building['id']
== $case_location_code ? 1 : 0;
+ }
+//---------
+ foreach($closed_check_items_and_cases as $key
=> $check_item)
+ {
+ // $control_item_with_options =
$this->so_control_item->get_single_with_options(
$check_item->get_control_item_id() );
+
+ $component_location_id =
$check_item->get_control_item()->get_component_location_id();
+
+ foreach($check_item->get_cases_array()
as $case)
+ {
+ $component_id =
$case->get_component_id();
+ if($component_id)
+ {
+ $short_desc =
execMethod('property.soentity.get_short_description', array('location_id' =>
$component_location_id, 'id' => $component_id));
+
$case->set_component_descr($short_desc);
+ }
+ }
+
+ //
$check_item->get_control_item()->set_options_array(
$control_item_with_options->get_options_array() );
+ // $closed_check_items_and_cases[$key] =
$check_item;
+ }
+
+
+//-------
+
+
+ }
+
$data = array
(
- 'control' =>
$control,
+ 'control'
=> $control,
'check_list'
=> $check_list,
'buildings_on_property' =>
$buildings_on_property,
- 'location_array' =>
$location_array,
+ 'location_array' =>
$location_array,
'component_array'
=> $component_array,
'type'
=> $type,
'location_level'
=> $level,
- 'building_location_code' =>
$building_location_code,
+ // 'building_location_code' =>
$building_location_code,
'current_year'
=> $year,
'current_month_nr'
=> $month,
'closed_check_items_and_cases' =>
$closed_check_items_and_cases,
- 'check_list' => $check_list,
- 'cases_view' => 'closed_cases',
- 'building_location_code' => $building_location_code
+ 'check_list' =>
$check_list,
+ 'cases_view' =>
'closed_cases',
+ 'building_location_code' =>
$building_location_code
);
- phpgwapi_jquery::load_widget('core');
- self::add_javascript('controller', 'controller', 'case.js');
+ phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller',
'case.js');
+ self::add_javascript('controller', 'controller',
'check_list_update_status.js');
- self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_closed_cases', 'case/case_row',
-
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
-
'check_list/fragments/select_buildings_on_property'), $data );
+ self::render_template_xsl(
array('check_list/fragments/check_list_menu', 'case/cases_tab_menu',
'case/view_closed_cases', 'case/case_row',
+
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
+
'check_list/fragments/select_buildings_on_property'), $data );
}
public function query(){}
Modified: branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.uicheck_list.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -426,6 +426,7 @@
self::add_javascript('controller', 'controller',
'custom_ui.js');
self::add_javascript('controller', 'controller',
'ajax.js');
self::add_javascript('controller', 'controller',
'check_list.js');
+ self::add_javascript('controller', 'controller',
'check_list_update_status.js');
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/nav_control_plan',
'check_list/fragments/check_list_top_section',
'check_list/edit_check_list',
@@ -589,6 +590,7 @@
);
phpgwapi_jquery::load_widget('core');
+ self::add_javascript('controller', 'controller',
'check_list_update_status.js');
self::render_template_xsl(array('check_list/fragments/check_list_menu',
'check_list/fragments/check_list_top_section',
'check_list/fragments/nav_control_plan',
'check_list/view_control_info',
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -221,15 +221,19 @@
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'controller.uicontrol_group.index'));
}
+ $entity_id = phpgw::get_var('entity_id', 'int');
+ $category_id = phpgw::get_var('category_id',
'int');
+ $component_location_id =
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$entity_id}.{$category_id}");
+
if(isset($control_group)) // Add new values to
the control item
{
$control_group->set_group_name(phpgw::get_var('group_name'));
$control_group->set_procedure_id(
phpgw::get_var('procedure') );
$control_group->set_control_area_id(
phpgw::get_var('control_area') );
$control_group->set_building_part_id(
phpgw::get_var('building_part') );
+
$control_group->set_component_location_id($component_location_id);
+ $control_group->set_component_criteria(
phpgw::get_var('attributes') );
- //$this->so->store($control_item);
-
if(isset($control_group_id) &&
$control_group_id > 0)
{
$ctrl_group_id =
$control_group_id;
@@ -451,6 +455,7 @@
(
'id' => $cat_list['cat_id'],
'name' => $cat_list['name'],
+ 'selected' =>
$control_group->get_control_area_id() == $cat_list['cat_id'] ? 1 : 0
);
}
// END as categories
@@ -464,46 +469,15 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
-/* foreach ($control_area_array as $control_area)
- {
-
if($control_group->get_control_area_id() && $control_area->get_id() ==
$control_group->get_control_area_id())
- {
- $control_area_options[] = array
- (
- 'id' =>
$control_area->get_id(),
- 'name' =>
$control_area->get_title(),
- 'selected' => 'yes'
- );
- }
- else
- {
- $control_area_options[] = array
- (
- 'id' =>
$control_area->get_id(),
- 'name' =>
$control_area->get_title()
- );
- }
- }*/
foreach ($procedure_array as $procedure)
{
- if($control_group->get_procedure_id()
&& $procedure->get_id() == $control_group->get_procedure_id())
- {
- $procedure_options[] = array
- (
- 'id' =>
$procedure->get_id(),
- 'name' =>
$procedure->get_title(),
- 'selected' => 'yes'
- );
- }
- else
- {
- $procedure_options[] = array
- (
- 'id' =>
$procedure->get_id(),
- 'name' =>
$procedure->get_title()
- );
- }
+ $procedure_options[] = array
+ (
+ 'id' => $procedure->get_id(),
+ 'name' =>
$procedure->get_title(),
+ 'selected' =>
$procedure->get_id() == $control_group->get_procedure_id() ? 1 : 0
+ );
}
array_unshift($procedure_options,array
('id'=>'','name'=> lang('select value')));
@@ -529,8 +503,66 @@
}
phpgwapi_yui::tabview_setup('control_group_tabview');
+
+
+ //--- sigurd 10.juni 13
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $custom =
createObject('phpgwapi.custom_fields');
+ $entity_list = $entity_so->read(array('allrows'
=> true));
+
+ array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
+
+ $component_location_id =
$control_group->get_component_location_id();
+ if($component_location_id)
+ {
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($component_location_id);
+ $entity_arr =
explode('.',$loc_arr['location']);
+
+ $entity =
$entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ foreach ($entity_list as &$e)
+ {
+ if($e['id'] == $entity['id'])
+ {
+ $e['selected'] = 1;
+ }
+ }
+ $category_list =
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$entity_arr[2]));
+ array_unshift($category_list,array
('id'=>'','name'=> lang('select value')));
+ foreach ($category_list as &$c)
+ {
+ if($c['id'] == $category['id'])
+ {
+ $c['selected'] = 1;
+ }
+ }
+
+ $attributes =
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0,
'','','',true, true);
+
+ $component_criteria =
$control_group->get_component_criteria();
+ foreach ($attributes as $key => &$a)
+ {
+
if(isset($component_criteria[$key]) && $component_criteria[$key])
+ {
+ $a['value'] =
$component_criteria[$key];
+ if(isset($a['choice'])
&& $a['choice'])
+ {
+
foreach($a['choice'] as &$choise)
+ {
+
$choise['selected'] = $choise['id'] == $component_criteria[$key] ? 1 : 0;
+ }
+ }
+ }
+ }
+ }
+
+ //---
+
$data = array
(
+ 'entities'
=> array('options' => $entity_list),
+ 'categories'
=> array('options' => $category_list),
+ 'attributes'
=> $attributes,
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, $tab_to_display),
'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
'editable'
=> true,
@@ -557,6 +589,7 @@
self::add_javascript('controller', 'yahoo',
'control_tabs.js');
self::add_javascript('controller',
'controller', 'ajax.js');
+ self::add_javascript('controller',
'controller', 'control_group_to_component.js');
self::render_template_xsl(array('control_group/control_group_tabs','control_group/control_group','control_group/control_group_items'),
$data);
}
}
@@ -732,6 +765,8 @@
{
$GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ $entity_so =
CreateObject('property.soadmin_entity');
+
$tabs = array
(
'control_group' => array('label' =>
lang('Control_group'), 'link' => '#control_group'),
@@ -766,6 +801,31 @@
$control_group_array =
$control_group->toArray();
//var_dump($control_group_array);
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($control_group->get_component_location_id());
+ $entity_arr = explode('.',$loc_arr['location']);
+
+ $entity =
$entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+
+ $custom =
createObject('phpgwapi.custom_fields');
+ $attributes =
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0,
'','','',true, true);
+
+ $component_criteria =
$control_group->get_component_criteria();
+ foreach ($attributes as $key => &$a)
+ {
+ if(isset($component_criteria[$key]) &&
$component_criteria[$key])
+ {
+ $a['value'] =
$component_criteria[$key];
+ if(isset($a['choice']) &&
$a['choice'])
+ {
+ foreach($a['choice'] as
&$choise)
+ {
+
$choise['selected'] = $choise['id'] == $component_criteria[$key] ? 1 : 0;
+ }
+ }
+ }
+ }
+
$control_items_array =
$this->so_control_item_list->get_control_items($control_group_id);
$control_items = array();
@@ -782,6 +842,9 @@
'tabs'
=> phpgwapi_yui::tabview_generate($tabs, 'control_group'),
'value_id'
=> !empty($control_group) ? $control_group->get_id() : 0,
'control_group'
=> $control_group_array,
+ 'entity'
=> $entity,
+ 'category'
=> $category,
+ 'attributes'
=> $attributes,
'selected_control_items' =>
$control_items,
);
Modified:
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/component/class.date_generator.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -15,18 +15,20 @@
private $calendar_array = array();
- public function __construct($start_date, $end_date, $period_start_date,
$period_end_date, $repeat_type, $repeat_interval){
+ public function __construct($start_date, $end_date, $period_start_date,
$period_end_date, $repeat_type, $repeat_interval)
+ {
$this->start_date = $start_date;
- $this->end_date = $end_date;
- $this->period_start_date = $period_start_date;
- $this->period_end_date = $period_end_date;
- $this->repeat_type = $repeat_type;
- $this->repeat_interval = $repeat_interval;
+ $this->end_date = $end_date;
+ $this->period_start_date = $period_start_date;
+ $this->period_end_date = $period_end_date;
+ $this->repeat_type = $repeat_type;
+ $this->repeat_interval = $repeat_interval;
- $this->generate_calendar();
- }
+ $this->generate_calendar();
+ }
- function generate_calendar(){
+ function generate_calendar()
+ {
$control_start_date = $this->find_control_start_date();
$control_end_date = $this->end_date;
@@ -55,7 +57,8 @@
{
$month = date("m",
$interval_date)+$this->repeat_interval;
$year = date("Y", $interval_date);
- if($month > 12){
+ if($month > 12)
+ {
$month = $month % 12;
$year += 1;
}
@@ -68,12 +71,12 @@
$interval_date = mktime(0,0,0, date("m",
$interval_date), date("d", $interval_date), date("Y",
$interval_date)+$this->repeat_interval);
}
}
- }
+ }
- public function find_control_start_date(){
-
- if( $this->repeat_type == 0 )
- {
+ public function find_control_start_date()
+ {
+ if( $this->repeat_type == 0 )
+ {
$control_start_date = $this->start_date;
}
else if( $this->repeat_type == 1 )
@@ -94,27 +97,31 @@
}
}
}
- else if( $this->repeat_type == 2 ){
+ else if( $this->repeat_type == 2 )
+ {
$num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
date("m", $this->start_date), date("y", $this->start_date));
$control_start_date = mktime(0,0,0, date("m",
$this->start_date), $num_days_in_month, date("y", $this->start_date));
}
- else if( $this->repeat_type == 3 ){
- $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
12, date("y", $this->start_date));
- $control_start_date = mktime(0,0,0, 12,
$num_days_in_month, date("y", $this->start_date));
+ else if( $this->repeat_type == 3 )
+ {
+// $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
12, date("y", $this->start_date));
+ $num_days_in_month = cal_days_in_month(CAL_GREGORIAN,
date("m", $this->start_date), date("y", $this->start_date));
+// $control_start_date = mktime(0,0,0, 12,
$num_days_in_month, date("y", $this->start_date));
+ $control_start_date = mktime(0,0,0, date("m",
$this->start_date), $num_days_in_month, date("y", $this->start_date));
}
return $control_start_date;
}
- public function find_start_date_for_period( $trail_period_start_date )
- {
- while( $trail_period_start_date < $this->period_start_date )
- {
+ public function find_start_date_for_period( $trail_period_start_date )
+ {
+ while( $trail_period_start_date < $this->period_start_date )
+ {
if($this->repeat_type == 0)
{
$trail_period_start_date = mktime(0,0,0,
date("m", $trail_period_start_date), date("d", $trail_period_start_date) +
$this->repeat_interval, date("Y", $trail_period_start_date));
}
- else if($this->repeat_type == 1)
+ else if($this->repeat_type == 1)
{
$trail_period_start_date = mktime(0,0,0,
date("m", $trail_period_start_date), date("d", $trail_period_start_date) +
($this->repeat_interval * 7), date("Y", $trail_period_start_date));
}
@@ -123,7 +130,8 @@
$month = date("m", $trail_period_start_date) +
$this->repeat_interval;
$year = date("Y", $trail_period_start_date);
- if($month > 12){
+ if($month > 12)
+ {
$month = $month % 12;
$year += 1;
}
@@ -140,7 +148,8 @@
return $trail_period_start_date;
}
- public function get_dates(){
+ public function get_dates()
+ {
return $this->calendar_array;
}
}
Modified:
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/component/class.year_calendar.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -32,47 +32,47 @@
function init_calendar()
{
// Sets null values for twelve months in calendar array
- for($i = 1;$i <= 12;$i++)
- {
- $this->calendar_array[$i] = null;
- }
+ for($i = 1;$i <= 12;$i++)
+ {
+ $this->calendar_array[$i] = null;
+ }
- $ctr_start_date_ts = $this->control->get_start_date();
- $ctr_end_date_ts = $this->control->get_end_date();
- $period_start_date_ts = $this->get_start_date_year_ts($this->year);
- $period_end_date_ts = $this->get_start_date_year_ts($this->year+1);
- $repeat_type = $this->control->get_repeat_type();
- $repeat_interval = $this->control->get_repeat_interval();
+ $ctr_start_date_ts = $this->control->get_start_date();
+ $ctr_end_date_ts = $this->control->get_end_date();
+ $period_start_date_ts = $this->get_start_date_year_ts($this->year);
+ $period_end_date_ts = $this->get_start_date_year_ts($this->year+1);
+ $repeat_type = $this->control->get_repeat_type();
+ $repeat_interval = $this->control->get_repeat_interval();
// Generates dates for time period with specified interval
- $date_generator = new date_generator($ctr_start_date_ts, $ctr_end_date_ts,
$period_start_date_ts, $period_end_date_ts, $repeat_type, $repeat_interval);
- $dates_array = $date_generator->get_dates();
+ $date_generator = new date_generator($ctr_start_date_ts,
$ctr_end_date_ts, $period_start_date_ts, $period_end_date_ts, $repeat_type,
$repeat_interval);
+ $dates_array = $date_generator->get_dates();
// Set status for control on each date to NOT DONE or REGISTERED
- foreach($dates_array as $date_ts)
- {
- $check_list = new controller_check_list();
- $check_list->set_deadline( $date_ts );
- $check_list->set_control_id( $this->control->get_id() );
+ foreach($dates_array as $date_ts)
+ {
+ $check_list = new controller_check_list();
+ $check_list->set_deadline( $date_ts );
+ $check_list->set_control_id( $this->control->get_id() );
- if($this->type == "component")
- {
- $check_list->set_component_id( $this->component->get_id() );
- $check_list->set_location_id(
$this->component->get_location_id() );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "component" );
- }
- else
- {
- $check_list->set_location_code( $this->location_code );
- $check_list_status_manager = new check_list_status_manager(
$check_list, "location" );
- }
+ if($this->type == "component")
+ {
+ $check_list->set_component_id(
$this->component->get_id() );
+ $check_list->set_location_id(
$this->component->get_location_id() );
+ $check_list_status_manager = new
check_list_status_manager( $check_list, "component" );
+ }
+ else
+ {
+ $check_list->set_location_code( $this->location_code );
+ $check_list_status_manager = new
check_list_status_manager( $check_list, "location" );
+ }
$check_list_status_info =
$check_list_status_manager->get_status_for_check_list();
$month_nr = date("n", $date_ts);
- $this->calendar_array[ $month_nr ]["status"] =
$check_list_status_info->get_status();
- $this->calendar_array[ $month_nr ]["info"] =
$check_list_status_info->serialize();
+ $this->calendar_array[ $month_nr ]["status"] =
$check_list_status_info->get_status();
+ $this->calendar_array[ $month_nr ]["info"] =
$check_list_status_info->serialize();
}
}
@@ -122,4 +122,4 @@
return $start_date_year_ts;
}
-}
\ No newline at end of file
+}
Modified:
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/helper/class.location_finder.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -49,9 +49,19 @@
return $locations;
}
- function get_buildings_on_property($user_role, $location_code, $level)
+ function get_buildings_on_property($user_role,
$parent_location_code, $level)
{
+ $children =
execMethod('property.solocation.get_children', $parent_location_code);
+
+ foreach ($children as &$entry)
+ {
+ $entry['id'] =
"{$parent_location_code}-{$entry['id']}";
+ }
+
+ return $children;
+
+/*
// Property level
if ($level == 1)
{
@@ -79,9 +89,11 @@
}
return $buildings_on_property;
+
+*/
}
- function get_building_location_code($location_code)
+ function get_building_location_code($location_code)
{
if( strlen( $location_code ) == 6 )
{
Modified:
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/model/class.check_item_case.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -50,6 +50,8 @@
protected $modified_by;
protected $measurement;
protected $location_code;
+ protected $component_id;
+ protected $component_descr;
/**
@@ -140,47 +142,68 @@
$this->measurement = $measurement;
}
- public function get_location_code() { return $this->location_code; }
+ public function get_location_code() { return $this->location_code; }
public function set_location_code($location_code)
{
$this->location_code = $location_code;
}
-
- public function validate()
+
+ public function get_component_id()
+ {
+ return $this->component_id;
+ }
+
+ public function set_component_id($component_id)
{
+ $this->component_id = $component_id;
+ }
+
+
+ public function get_component_descr()
+ {
+ return $this->component_descr;
+ }
+
+ public function set_component_descr($component_descr)
+ {
+ $this->component_descr = $component_descr;
+ }
+
+ public function validate()
+ {
$status = true;
// Validate DESCRIPTION
if( empty( $this->descr ) )
- {
- $status = false;
- $this->error_msg_array['descr'] = "error_msg_1";
- }
+ {
+ $status = false;
+ $this->error_msg_array['descr'] = "error_msg_1";
+ }
// Validate STATUS
if( empty( $this->status ) && ( (intval($this->status)
== self::STATUS_OPEN) || (intval($this->status) == self::STATUS_CLOSED) ||
(intval($this->status) == self::STATUS_PENDING)) )
- {
- $status = false;
- $this->error_msg_array['status'] = "error_msg_1";
- }
+ {
+ $status = false;
+ $this->error_msg_array['status'] =
"error_msg_1";
+ }
// Validate LOCATION CODE
- if( empty($this->location_code) )
- {
- $status = false;
- $this->error_msg_array['location_code'] = "error_msg_1";
- }
+ if( empty($this->location_code) )
+ {
+ $status = false;
+ $this->error_msg_array['location_code'] =
"error_msg_1";
+ }
// Validate CHECK ITEM ID
if( empty($this->check_item_id) )
- {
- $status = false;
- $this->error_msg_array['check_item_id'] = "error_msg_4";
- }
+ {
+ $status = false;
+ $this->error_msg_array['check_item_id'] =
"error_msg_4";
+ }
//to do: return $status;
- return true;
+ return true;
}
}
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
===================================================================
---
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/inc/model/class.control_group.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -43,6 +43,8 @@
protected $building_part_id;
protected $building_part_descr;
protected $order_nr;
+ protected $component_location_id;
+ protected $component_criteria = array();
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -118,6 +120,27 @@
public function get_order_nr(){ return $this->order_nr; }
+
+ public function
set_component_location_id($component_location_id)
+ {
+ $this->component_location_id = $component_location_id;
+ }
+
+ public function get_component_location_id()
+ {
+ return $this->component_location_id;
+ }
+
+ public function set_component_criteria($component_criteria)
+ {
+ $this->component_criteria = $component_criteria;
+ }
+
+ public function get_component_criteria()
+ {
+ return $this->component_criteria;
+ }
+
public function serialize()
{
$result = array();
@@ -127,6 +150,8 @@
$result['control_area'] =
$this->get_control_area_name();
$result['building_part'] =
$this->get_building_part_descr();
$result['order_nr'] = $this->get_order_nr();
+ $result['component_location_id'] =
$this->get_component_location_id();
+ $result['component_criteria'] =
$this->get_component_criteria();
return $result;
}
Modified:
branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/inc/model/class.control_item.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -46,6 +46,7 @@
protected $control_area_id;
protected $control_area_name;
protected $type;
+ protected $component_location_id;
protected $options_array;
protected $error_msg_array;
@@ -131,11 +132,22 @@
public function get_type() { return $this->type; }
+
+ public function
set_component_location_id($component_location_id)
+ {
+ $this->component_location_id = $component_location_id;
+ }
+
+ public function get_component_location_id()
+ {
+ return $this->component_location_id;
+ }
+
public function set_options_array($options_array)
{
$this->options_array = $options_array;
}
-
+
public function get_options_array() { return
$this->options_array; }
public function get_control_item_types()
@@ -209,4 +221,4 @@
}
return $status;
}
- }
\ No newline at end of file
+ }
Modified: branches/Version-1_0-branch/controller/js/controller/case.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/case.js
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/js/controller/case.js
2013-06-17 13:26:53 UTC (rev 11186)
@@ -10,9 +10,12 @@
var requestUrl = $(thisForm).attr("action");
var location_code = $("#choose-building-on-property
option:selected").val();
+ $(thisForm).find("input[name=location_code]").val(location_code);
+
+ var control_group_id =
$(thisForm).find("input[name=control_group_id]").val();
+ var component_id = $("#component_at_control_group_" +
control_group_id).val();
+ $(thisForm).find("input[name=component_id]").val(component_id);
- $(thisForm).find("input[name=location_code]").val(location_code);
-
var validate_status = validate_form( thisForm );
if( validate_status ){
@@ -32,9 +35,13 @@
// Changes text on save button back
to original
window.setTimeout(function() {
if( type ==
"control_item_type_2")
+ {
$(submitBnt).val('Lagre måling');
+ }
else
+ {
$(submitBnt).val('Lagre sak');
+ }
$(submitBnt).addClass("not_active");
}, 1000);
@@ -255,14 +262,29 @@
return false;
});
+ $("#choose-building-on-property").change(function () {
+ var location_code = $(this).val();
+ var search = location.search.substring(1);
+ var oArgs = search?JSON.parse('{"' + search.replace(/&/g,
'","').replace(/=/g,'":"') + '"}',
+
function(key, value) { return key===""?value:decodeURIComponent(value) }):{}
+
+ oArgs.location_code = location_code;
+ delete oArgs.click_history;
+ var reloadPageUrl = phpGWLink('index.php', oArgs);
+ //var reloadPageUrl = location.pathname + location.search +
"&location_code=" + location_code;
+ location.href = reloadPageUrl;
+ });
+
+
+/*
$("#choose-building-on-property.view-cases").change(function () {
var location_code = $(this).val();
var reloadPageUrl = location.pathname + location.search +
"&location_code=" + location_code;
-
+alert(reloadPageUrl);
location.href = reloadPageUrl;
});
-
+ */
});
function validate_form( formObj )
@@ -278,7 +300,7 @@
{
if( $(thisInput).attr("type") == 'hidden' )
{
- $(formObj).prepend("<div class='input_error_msg'>Du må velge
bygg</div>");
+ $(formObj).prepend("<div class='input_error_msg'>Du må
spesifisere lokalisering</div>");
}else
{
$(thisInput).before("<div class='input_error_msg'>Du må fylle ut dette
feltet</div>");
Modified: branches/Version-1_0-branch/controller/js/controller/check_list.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/check_list.js
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/js/controller/check_list.js
2013-06-17 13:26:53 UTC (rev 11186)
@@ -71,46 +71,4 @@
}
}
});
-
- // UPDATE CHECKLIST STATUS
- $("#update-check-list-status").live("submit", function(e){
- e.preventDefault();
-
- var thisForm = $(this);
-
- var statusClass = $(thisForm).attr("class");
-
- var requestUrl = $(thisForm).attr("action");
-
- var submitBnt = $(thisForm).find("input[type='submit']");
-
- $.ajax({
- type: 'POST',
- url: requestUrl + "&" + $(thisForm).serialize(),
- success: function(data) {
- if(data){
- var jsonObj = jQuery.parseJSON(data);
-
- if(jsonObj.status == 'not_saved')
- {
- $(submitBnt).val("feil ved
lagring");
- }
- else if(jsonObj.status == '1')
- {
- $(submitBnt).val("Utført");
-
$("#update-check-list-status-value").val(0);
- //
$("#update-check-list-status-icon.not_done").hide();
- //
$("#update-check-list-status-icon-done.done").show();
- }
- else
- {
- $(submitBnt).val("Ikke utført");
-
$("#update-check-list-status-value").val(1);
- //
$("#update-check-list-status-icon.not_done").show();
- //
$("#update-check-list-status-icon-done.done").hide();
- }
- }
- }
- });
- });
});
Copied:
branches/Version-1_0-branch/controller/js/controller/check_list_update_status.js
(from rev 11185, trunk/controller/js/controller/check_list_update_status.js)
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/check_list_update_status.js
(rev 0)
+++
branches/Version-1_0-branch/controller/js/controller/check_list_update_status.js
2013-06-17 13:26:53 UTC (rev 11186)
@@ -0,0 +1,44 @@
+$(document).ready(function(){
+
+ // UPDATE CHECKLIST STATUS
+ $("#update-check-list-status").live("submit", function(e){
+ e.preventDefault();
+
+ var thisForm = $(this);
+
+ var statusClass = $(thisForm).attr("class");
+
+ var requestUrl = $(thisForm).attr("action");
+
+ var submitBnt = $(thisForm).find("input[type='submit']");
+
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&" + $(thisForm).serialize(),
+ success: function(data) {
+ if(data){
+ var jsonObj = jQuery.parseJSON(data);
+
+ if(jsonObj.status == 'not_saved')
+ {
+ $(submitBnt).val("feil ved
lagring");
+ }
+ else if(jsonObj.status == '1')
+ {
+ $(submitBnt).val("Utført");
+
$("#update-check-list-status-value").val(0);
+ //
$("#update-check-list-status-icon.not_done").hide();
+ //
$("#update-check-list-status-icon-done.done").show();
+ }
+ else
+ {
+ $(submitBnt).val("Ikke utført");
+
$("#update-check-list-status-value").val(1);
+ //
$("#update-check-list-status-icon.not_done").show();
+ //
$("#update-check-list-status-icon-done.done").hide();
+ }
+ }
+ }
+ });
+ });
+});
Copied:
branches/Version-1_0-branch/controller/js/controller/control_group_to_component.js
(from rev 11185, trunk/controller/js/controller/control_group_to_component.js)
===================================================================
---
branches/Version-1_0-branch/controller/js/controller/control_group_to_component.js
(rev 0)
+++
branches/Version-1_0-branch/controller/js/controller/control_group_to_component.js
2013-06-17 13:26:53 UTC (rev 11186)
@@ -0,0 +1,86 @@
+$(document).ready(function(){
+
+ $("#entity_id").change(function () {
+ $("#attributes").html( '' );
+ var oArgs =
{menuaction:'property.boadmin_entity.get_category_list', entity_id:
$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ htmlString = "<option value =
''>Velg</option>";
+
+ $.each(data, function(i) {
+ var selected = '';
+ htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
+ });
+
+ $("#category_id").html( htmlString );
+ }
+ else
+ {
+ $("#category_id").html( htmlString );
+ }
+ }
+ });
+ });
+
+ $("#category_id").change(function () {
+ var oArgs =
{menuaction:'property.boadmin_entity.get_attrib_list', entity_id:
$("#entity_id").val(), cat_id: $(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ htmlString += '<table>';
+ $.each(data, function(i) {
+ htmlString += "<tr>";
+ htmlString += "<td>" +
data[i].input_text + " (" + data[i].trans_datatype + ')</td>';
+ htmlString += "<td>";
+
if(typeof(data[i].choice)!='undefined')
+ {
+ htmlString +=
" <select name='attributes["+ data[i].id +"]' id='attribute_"+ data[i].id
+"'>";
+ htmlString += "<option
value = ''>Velg</option>";
+ choice = data[i].choice;
+ $.each(choice,
function(j) {
+ selected = '';
+ htmlString +=
"<option value='" + choice[j].id + "'" + selected + ">" + choice[j].value +
"</option>";
+ });
+ htmlString +=
"</select>";
+ }
+ else
+ {
+ htmlString +=
" <input type= 'text' name='attributes["+ data[i].id +"]' id='attribute_"+
data[i].id +"'/>";
+ }
+
+
+ htmlString += "</td></tr>";
+ });
+
+ htmlString += '</table>';
+ $("#attributes").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#attributes").html( htmlString );
+ }
+ }
+ });
+ });
+
+});
Modified: branches/Version-1_0-branch/controller/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2013-06-17
13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/setup/phpgw_no.lang 2013-06-17
13:26:53 UTC (rev 11186)
@@ -4,6 +4,7 @@
controller common no Kontroll
Register control item controller no Legg til nytt kontrollpunkt
Edit control item controller no Endre kontrollpunkt
+Entity controller no Komponentregister
View control item controller no Vis kontrollpunkt
control_item_type_1 controller no Ved innskriving av kommentar
control_item_type_2 controller no Ved innskriving av måling i et
tekstfelt
@@ -236,6 +237,7 @@
status_date controller no den
status_unknown controller no Ukjent status
status controller no Status
+status not done controller no Ikke utført
Success controller no Suksess
sum controller no Sum
System setting for responsibility id for the current user must be 6
characters. controller no Systeminnstilling for ansvar må være
seks tegn.
@@ -364,4 +366,4 @@
Register new message controller no Registrer ny melding
Show message controller no Vis melding
Status not done controller no Status: Ikke utført
-Status done controller no Status: Utført
\ No newline at end of file
+Status done controller no Status: Utført
Modified: branches/Version-1_0-branch/controller/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/setup.inc.php 2013-06-17
13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/setup/setup.inc.php 2013-06-17
13:26:53 UTC (rev 11186)
@@ -1,6 +1,6 @@
<?php
$setup_info['controller']['name'] = 'controller';
- $setup_info['controller']['version'] = '0.1.44';
+ $setup_info['controller']['version'] = '0.1.47';
$setup_info['controller']['app_order'] = 100;
$setup_info['controller']['enable'] = 1;
$setup_info['controller']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/controller/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/setup/tables_current.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -109,7 +109,9 @@
'group_name' => array('type' =>
'varchar','precision' => '255','nullable' => false),
'procedure_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
'control_area_id' => array('type' => 'int',
'precision' => 4, 'nullable' => True),
- 'building_part_id' => array('type' =>
'varchar', 'precision' => 30, 'nullable' => True)
+ 'building_part_id' => array('type' =>
'varchar', 'precision' => 30, 'nullable' => True),
+ 'component_location_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => True),
+ 'component_criteria' => array('type' =>
'text', 'nullable' => true)
),
'pk' => array('id'),
'fk' => array(),
@@ -174,10 +176,10 @@
),
'controller_document' => array(
'fd' => array(
- 'id' => array('type' => 'auto',
'nullable' => false),
- 'name' => array('type' => 'varchar',
'precision' => '255', 'nullable' => false),
+ 'id' => array('type' =>
'auto', 'nullable' => false),
+ 'name' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => false),
'procedure_id' => array('type' => 'int',
'precision' => '4', 'nullable' => true),
- 'title' => array('type' => 'varchar',
'precision' => '255', 'nullable' => true),
+ 'title' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => true),
'description' => array('type' => 'text',
'nullable' => true),
'type_id' => array('type' => 'int',
'precision' => '4', 'nullable' => false)
),
@@ -191,18 +193,19 @@
),
'controller_check_item_case' => array(
'fd' => array(
- 'id' => array('type'
=> 'auto', 'nullable' => false),
+ 'id' =>
array('type' => 'auto', 'nullable' => false),
'check_item_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
- 'status'
=> array('type' => 'int', 'precision' => '4', 'nullable' => false),
- 'measurement' => array('type' =>
'varchar', 'precision' => '50', 'nullable' => True),
+ 'status' =>
array('type' => 'int', 'precision' => '4', 'nullable' => false),
+ 'measurement' => array('type'
=> 'varchar', 'precision' => '50', 'nullable' => True),
'location_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => true), // representer
meldingsfregisteret
- 'location_item_id' => array('type' => 'int', 'precision' => '8',
'nullable' => true), //meldings id
- 'descr' => array('type'
=> 'text','nullable' => true),
- 'user_id' => array('type' =>
'int','precision' => '4','nullable' => true),
- 'entry_date' => array('type' => 'int',
'precision' => 8,'nullable' => false),
- 'modified_date' => array('type' => 'int',
'precision' => 8,'nullable' => True),
- 'modified_by' => array('type' => 'int', 'precision'
=> 4,'nullable' => True),
- 'location_code' => array('type'
=> 'varchar', 'precision' => 30, 'nullable' => True)
+ 'location_item_id' => array('type'
=> 'int', 'precision' => '8', 'nullable' => true), //meldings id
+ 'descr' =>
array('type' => 'text','nullable' => true),
+ 'user_id' =>
array('type' => 'int','precision' => '4','nullable' => true),
+ 'entry_date' => array('type'
=> 'int', 'precision' => 8,'nullable' => false),
+ 'modified_date' => array('type'
=> 'int', 'precision' => 8,'nullable' => True),
+ 'modified_by' => array('type'
=> 'int', 'precision' => 4,'nullable' => True),
+ 'location_code' => array('type'
=> 'varchar', 'precision' => 30, 'nullable' => True),
+ 'component_id' => array('type'
=> 'int', 'precision' => '4', 'nullable' => false),
),
'pk' => array('id'),
'fk' => array('controller_check_item' => array('check_item_id' => 'id')),
Modified: branches/Version-1_0-branch/controller/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/setup/tables_update.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -171,8 +171,8 @@
return $GLOBALS['setup_info']['controller']['currentver'];
}
- /* Update Controller from v 0.1.9 to 0.1.10
- * Add table for connecting equipment (BIM) and control
+ /* Update Controller from v 0.1.9 to 0.1.10
+ * Add table for connecting equipment (BIM) and control
*/
$test[] = '0.1.9';
@@ -197,7 +197,7 @@
}
/* Update Controller from v 0.1.10 to 0.1.11
- * Alter from naming from equipment to more generic component
+ * Alter from naming from equipment to more generic component
*/
$test[] = '0.1.10';
@@ -347,13 +347,13 @@
function controller_upgrade0_1_16()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','message_ticket_id',array(
- 'type' => 'int',
+ 'type' => 'int',
'precision' => '8',
'nullable' => true
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','measurement',array(
- 'type' => 'varchar',
+ 'type' => 'varchar',
'precision' => '50',
'nullable' => true
));
@@ -362,7 +362,7 @@
return $GLOBALS['setup_info']['controller']['currentver'];
}
- $test[] = '0.1.17';
+ $test[] = '0.1.17';
function controller_upgrade0_1_17()
{
$GLOBALS['phpgw_setup']->oProc->DropTable('controller_check_item_case');
@@ -402,13 +402,13 @@
function controller_upgrade0_1_18()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','entry_date',array(
- 'type' => 'int',
+ 'type' => 'int',
'precision' => 8,
'nullable' => false
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item_case','modified_date',array(
- 'type' => 'int',
+ 'type' => 'int',
'precision' => 8,
'nullable' => true
));
@@ -455,7 +455,7 @@
function controller_upgrade0_1_21()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_item','comment',array(
- 'type' => 'varchar',
+ 'type' => 'varchar',
'precision' => '255',
'nullable' => true
));
@@ -464,7 +464,7 @@
return $GLOBALS['setup_info']['controller']['currentver'];
}
- /* Update Controller from v 0.1.22 to 0.1.23
+ /* Update Controller from v 0.1.22 to 0.1.23
* Add table for configurable status
*/
@@ -501,7 +501,7 @@
function controller_upgrade0_1_23()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_procedure','reference',array(
- 'type' => 'text',
+ 'type' => 'text',
'nullable' => true
));
@@ -531,7 +531,7 @@
}
/* Update Controller from v 0.1.25 to 0.1.26
- * Added table for connecting gontrol groups to components
+ * Added table for connecting gontrol groups to components
*/
$test[] = '0.1.25';
@@ -611,7 +611,7 @@
function controller_upgrade0_1_29()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_procedure','responsibility',array(
- 'type' => 'text',
+ 'type' => 'text',
'nullable' => true
));
@@ -627,7 +627,7 @@
function controller_upgrade0_1_30()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_control','description',array(
- 'type' => 'text',
+ 'type' => 'text',
'nullable' => true
));
@@ -650,7 +650,7 @@
function controller_upgrade0_1_32()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','comment',array(
- 'type' => 'text',
+ 'type' => 'text',
'nullable' => true
));
@@ -776,7 +776,7 @@
));
$GLOBALS['phpgw_setup']->oProc->AlterColumn('controller_check_list','location_code',array(
- 'type' => 'varchar',
+ 'type' => 'varchar',
'precision' => '30',
'nullable' => true
));
@@ -828,7 +828,7 @@
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','location_code',array(
- 'type' => 'varchar',
+ 'type' => 'varchar',
'precision' => '30',
'nullable' => true
));
@@ -846,7 +846,7 @@
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group_list','temp_order_nr',array(
- 'type' => 'int',
+ 'type' => 'int',
'precision' => '4',
'nullable' => true
));
@@ -871,13 +871,13 @@
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','assigned_to',array(
- 'type' => 'int',
+ 'type' => 'int',
'precision' => '4',
'nullable' => true
));
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_list','billable_hours',array(
- 'type' => 'decimal',
+ 'type' => 'decimal',
'precision' => '20',
'scale' => '2',
'nullable' => true
@@ -889,3 +889,56 @@
return
$GLOBALS['setup_info']['controller']['currentver'];
}
}
+
+ $test[] = '0.1.44';
+ function controller_upgrade0_1_44()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','component_location_id',array(
+ 'type' => 'int',
+ 'precision' => '4',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.45';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
+
+ $test[] = '0.1.45';
+ function controller_upgrade0_1_45()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_check_item_case','component_id',array(
+ 'type' => 'int',
+ 'precision' => '4',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.46';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
+
+ $test[] = '0.1.46';
+ function controller_upgrade0_1_46()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('controller_control_group','component_criteria',array(
+ 'type' => 'text',
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['controller']['currentver'] =
'0.1.47';
+ return
$GLOBALS['setup_info']['controller']['currentver'];
+ }
+ }
Modified:
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_month_for_locations.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -71,7 +71,7 @@
<xsl:value-of
select="location/location_code"/>
</td>
<td class="location-name">
- <xsl:value-of
select="location/loc1_name"/>
+ <xsl:value-of
select="location/loc_name"/>
</td>
<xsl:for-each
select="calendar_array">
Modified:
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/calendar/view_calendar_year_for_locations.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -70,7 +70,7 @@
<xsl:value-of
select="location/location_code"/>
</td>
<td class="location-name">
- <xsl:value-of
select="location/loc1_name"/>
+ <xsl:value-of
select="location/loc_name"/>
</td>
<xsl:for-each
select="calendar_array">
Modified:
branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/templates/base/case/add_case.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -24,46 +24,65 @@
<li>
<h3 class="expand-trigger"><img
src="controller/images/arrow_right.png" /><xsl:value-of
select="control_group/group_name"/></h3>
<ul class="expand_list"
style="display:none;">
+ <xsl:choose>
+
<xsl:when test="components_at_location/child::node()">
+
<select name="component_at_control_group_{control_group/id}"
id="component_at_control_group_{control_group/id}">
+
<xsl:apply-templates select="components_at_location/component_options"/>
+
</select>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:variable
name="control_group_id"><xsl:value-of select="control_group/id"/></xsl:variable>
<xsl:for-each
select="control_items">
<li>
-
<h4><img src="controller/images/arrow_right.png" /><span><xsl:value-of
select="title"/></span></h4>
+
<h4><img src="controller/images/arrow_right.png" /><span><xsl:value-of
select="title"/></span></h4>
+
<form class="frm_register_case expand_item" action="{$action_url}"
method="post">
+ <input
type="hidden" name="location_code" value="" class="required" />
+ <input
type="hidden" name="control_group_id" value="{$control_group_id}" />
+ <input
type="hidden" name="component_id" value="" />
+
<xsl:choose>
+
<xsl:when test="what_to_do !=''">
+
<!-- WHAT TO DO -->
+
<div class="row what-to-do">
+
<label>Hva skal sjekkes:</label>
+
<div>
+
<xsl:value-of disable-output-escaping="yes"
select="what_to_do"/>
+
</div>
+
</div>
+
</xsl:when>
+
</xsl:choose>
+
+
<xsl:choose>
+
<xsl:when test="how_to_do !=''">
+
<!-- HOW TO DO -->
+
<div class="row how-to-do">
+
<label>Utførelsesbeskrivelse:</label>
+
<div>
+
<xsl:value-of disable-output-escaping="yes"
select="how_to_do"/>
+
</div>
+
</div>
+
</xsl:when>
+
</xsl:choose>
+
+
<xsl:choose>
<xsl:when test="type = 'control_item_type_1'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input type="hidden"
name="check_list_id"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
-
<input type="hidden" name="status" value="0" />
- <input type="hidden" name="type"
value="control_item_type_1" />
- <input type="hidden" name="location_code" value=""
class="required" />
-
- <!-- WHAT TO DO -->
- <div class="row what-to-do">
- <label>Hva skal sjekkes:</label>
- <div>
- <xsl:value-of disable-output-escaping="yes"
select="what_to_do"/>
- </div>
- </div>
-
- <!-- HOW TO DO -->
- <div class="row how-to-do">
- <label>Utførelsesbeskrivelse:</label>
- <div>
- <xsl:value-of disable-output-escaping="yes"
select="how_to_do"/>
- </div>
- </div>
-
-
<div>
- <label class="comment">Beskrivelse av sak</label>
+
<input type="hidden" name="status" value="0" />
+
<input type="hidden" name="type" value="control_item_type_1" />
+
+
<div>
+
<label class="comment">Beskrivelse av sak</label>
<textarea name="case_descr" class="required">
<xsl:value-of select="comment"/>
</textarea>
</div>
<input type="submit" class="btn" name="save_control"
value="Lagre sak" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_2'">
-
<form class="frm_register_case expand_item" action="{$action_url}"
method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -95,10 +114,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_3'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -131,10 +150,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
sak/måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
<xsl:when test="type = 'control_item_type_4'">
-
<form class="frm_register_case expand_item"
action="{$action_url}" method="post">
+
<xsl:variable name="control_item_id"><xsl:value-of
select="id"/></xsl:variable>
<input type="hidden" name="control_item_id"
value="{$control_item_id}" />
<input name="check_list_id"
type="hidden"><xsl:attribute name="value"><xsl:value-of
select="//check_list/id"/></xsl:attribute></input>
@@ -167,9 +186,10 @@
</div>
<xsl:variable name="lang_save"><xsl:value-of
select="php:function('lang', 'register_error')" /></xsl:variable>
<input type="submit" name="save_control" value="Lagre
sak/måling" title="{$lang_save}" />
-
</form>
+
</xsl:when>
</xsl:choose>
+
</form>
</li>
</xsl:for-each>
</ul>
@@ -188,3 +208,13 @@
</div>
</div>
</xsl:template>
+
+<xsl:template match="component_options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of select="id"/> - <xsl:value-of
disable-output-escaping="yes" select="short_description"/>
+ </option>
+</xsl:template>
+
Modified:
branches/Version-1_0-branch/controller/templates/base/case/case_row.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/case/case_row.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/templates/base/case/case_row.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -33,6 +33,20 @@
<!-- ==================== COL2: CASE CONTENT
===================== -->
<div class="col_2">
<div class="case_info">
+
+ <xsl:choose>
+ <xsl:when test="component_descr != ''">
+ <div class="row">
+ <label>
+
<xsl:value-of select="php:function('lang','component')" />
+ </label>
+ </div>
+ <div class="component_descr">
+ <xsl:value-of
select="component_descr"/>
+ </div>
+ </xsl:when>
+ </xsl:choose>
+
<!-- STATUS -->
<xsl:if test="$control_item_type = 'control_item_type_2' or
$control_item_type = 'control_item_type_3' or $control_item_type =
'control_item_type_4'">
Modified:
branches/Version-1_0-branch/controller/templates/base/case/view_closed_cases.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/case/view_closed_cases.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/case/view_closed_cases.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -37,7 +37,25 @@
<!-- =============== SHOW CASE INFO ============= -->
<div class="case_info">
-
+
+
<xsl:choose>
+
<xsl:when test="component_descr != ''">
+
<div class="row">
+
<label>
+
<xsl:value-of
select="php:function('lang','component')" />
+
</label>
+
</div>
+
<div class="component_descr">
+
<xsl:value-of select="component_descr"/>
+
</div>
+
</xsl:when>
+
</xsl:choose>
+
+
<!-- DESCRIPTION -->
+
<div class="row">
+
<label>Beskrivelse:</label>
+
</div>
+
<!-- DESCRIPTION -->
<div class="case_descr"><xsl:value-of select="descr"/></div>
<!-- === QUICK EDIT MENU === -->
Modified:
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/check_list/edit_check_list.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -68,7 +68,7 @@
</div>
<div class="row">
<label>Utført dato</label>
- <input class="date" readonly="readonly">
+ <input class="date" >
<xsl:attribute
name="id">completed_date</xsl:attribute>
<xsl:attribute
name="name">completed_date</xsl:attribute>
<xsl:attribute name="type">text</xsl:attribute>
Modified:
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/check_list_top_section.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -46,7 +46,7 @@
<input
id='update-check-list-status-value' type="hidden" name="status" value="0" />
<input type="submit"
class="btn">
<xsl:attribute
name="value">
- <xsl:value-of
select="php:function('lang', 'Status done')" />
+ <xsl:value-of
select="php:function('lang', 'is_executed')" />
</xsl:attribute>
</input>
</xsl:otherwise>
Modified:
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/check_list/fragments/select_buildings_on_property.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -1,7 +1,7 @@
<!-- $Id: view_calendar_month.xsl 9200 2012-04-21 20:05:34Z vator $ -->
<xsl:template name="select_buildings_on_property">
- <span style="display: block;font-size: 16px;margin-bottom: 8px;">Velg
hvilket bygg du vil registrere saken pa</span>
+ <span style="display: block;font-size: 16px;margin-bottom: 8px;">Spesifiser
lokalisering du vil registrere saken pa</span>
<select id="choose-building-on-property">
<xsl:choose>
<xsl:when test="cases_view = 'open_cases' or cases_view =
'closed_cases'">
@@ -12,10 +12,10 @@
</xsl:otherwise>
</xsl:choose>
- <option value="">Velg bygg</option>
+ <option value="">Velg lokalisering</option>
<xsl:for-each select="buildings_on_property">
<option>
- <xsl:if test="id = //building_location_code">
+ <xsl:if test="selected = 1">
<xsl:attribute name="selected">selected</xsl:attribute>
</xsl:if>
<xsl:attribute name="value">
Modified:
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
===================================================================
---
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/controller/templates/base/control_group/control_group.xsl
2013-06-17 13:26:53 UTC (rev 11186)
@@ -67,8 +67,114 @@
</xsl:otherwise>
</xsl:choose>
</dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <select
name="entity_id" id="entity_id">
+
<xsl:apply-templates select="entities/options"/>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <select
name="category_id" id="category_id">
+
<xsl:apply-templates select="categories/options"/>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Attributes')" /></label>
+ </dt>
+ <dd>
+ <div
id="attributes">
+ <table>
+
<xsl:for-each select="attributes">
+
<tr>
+
<td>
+
<xsl:value-of select="input_text" /> (
<xsl:value-of select="trans_datatype" /> )
+
</td>
+
<td>
+
<xsl:choose>
+
<xsl:when test="choice!=''">
+
<select name='attributes[{id}]'
id='attribute_{id}'>;
+
<option value =
''>Velg</option>";
+
<xsl:for-each select="choice">
+
<option value="{id}">
+
<xsl:if
test="selected != 0">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of
disable-output-escaping="yes" select="value"/>
+
</option>
+
</xsl:for-each>
+
</select>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type= 'text'
name='attributes[{id}]' id='attribute_{id}' value = '{value}'/>
+
</xsl:otherwise>
+
</xsl:choose>
+
</td>
+
</tr>
+
</xsl:for-each>
+ </table>
+ </div>
+ </dd>
+
+ </xsl:when>
+ <xsl:otherwise>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="entity/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="category/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Chosen attributes')"
/></label>
+ </dt>
+ <dd>
+ <table>
+
<xsl:for-each select="attributes">
+
<xsl:choose>
+
<xsl:when test="value!=''">
+
<tr>
+
<td>
+
<xsl:value-of select="input_text" /> (
<xsl:value-of select="trans_datatype" /> )
+
</td>
+
<td>
+
<xsl:text> => </xsl:text>
+
</td>
+
<td>
+
<xsl:choose>
+
<xsl:when test="choice!=''">
+
<xsl:for-each select="choice">
+
<xsl:if test="selected
!= 0">
+
<xsl:value-of
disable-output-escaping="yes" select="value"/>
+
</xsl:if>
+
</xsl:for-each>
+
</xsl:when>
+
<xsl:otherwise>
+
<xsl:value-of
disable-output-escaping="yes" select="value"/>
+
</xsl:otherwise>
+
</xsl:choose>
+
</td>
+
</tr>
+
</xsl:when>
+
</xsl:choose>
+
</xsl:for-each>
+ </table>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
</dl>
-
+
<div class="form-buttons">
<xsl:choose>
<xsl:when test="editable">
Modified: branches/Version-1_0-branch/controller/templates/base/css/base.css
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/css/base.css
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/controller/templates/base/css/base.css
2013-06-17 13:26:53 UTC (rev 11186)
@@ -1339,6 +1339,7 @@
#calendar .location-name, #calendar .component-type {
width: 150px;
text-align: left;
+ white-space: nowrap;
}
#calendar .frequency {
Modified:
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
===================================================================
---
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
2013-06-17 13:23:53 UTC (rev 11185)
+++
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
2013-06-17 13:26:53 UTC (rev 11186)
@@ -14,7 +14,7 @@
{
if( data != null)
{
- htmlString = "<option>Velg</option>"
+ htmlString = "<option value =
''>Velg</option>";
$.each(data, function(i) {
var selected = '';
@@ -61,4 +61,4 @@
});
});
-});
\ No newline at end of file
+});
Modified: branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/property/inc/class.boadmin_entity.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -81,11 +81,13 @@
protected $custom;
var $public_functions = array
(
- 'read' => true,
- 'read_single' => true,
- 'save' => true,
- 'delete' => true,
- 'check_perms' => true
+ 'read' => true,
+ 'read_single' => true,
+ 'save' => true,
+ 'delete' => true,
+ 'check_perms' => true,
+ 'get_category_list' => true,
+ 'get_attrib_list' => true
);
var $type_app = array
(
@@ -214,6 +216,26 @@
return $category;
}
+
+ public function get_category_list()
+ {
+ $entity_id =
phpgw::get_var('entity_id','int');
+ return
$this->so->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+ }
+
+
+ /**
+ * Fetch custom attributes for an given komponent type
+ */
+ public function get_attrib_list()
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $cat_id = phpgw::get_var('cat_id');
+
+ return
$this->custom->find('property',".entity.{$entity_id}.{$cat_id}", 0,
'','','',true, true);
+ }
+
+
function read_single( $id )
{
return $this->so->read_single( $id );
Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -231,6 +231,7 @@
$results = isset($data['results']) &&
$data['results'] ? (int)$data['results'] : 0;
$location_id = isset($data['location_id']) &&
$data['location_id'] ? (int)$data['location_id'] : 0;
$conditions = isset($data['conditions']) &&
$data['conditions'] ? $data['conditions'] : array();
+ $location_code = isset($data['location_code']) ?
$data['location_code'] : '';
$query = isset($data['query']) ?
$data['query'] : '';
$allrows = isset($data['allrows']) ?
$data['allrows'] : '';
@@ -243,6 +244,10 @@
$__querymethod = array();
// $__querymethod = array("fm_bim_item.id = -1"); // block
query waiting for conditions
+ if($location_code)
+ {
+ $_querymethod =
array("fm_bim_item.location_code {$this->like} '{$location_code}%'");
+ }
$attribute_table = 'phpgw_cust_attribute';
@@ -267,7 +272,7 @@
case '=':
case 'equal':
case 'eq':
-
$_querymethod[]= "xmlexists('//{$attribute_name}[text() =
''{$condition['value']}'']' PASSING BY REF xml_representation)";
+
$_querymethod[]= "xmlexists_('//{$attribute_name}[text() =
''{$condition['value']}'']' PASSING BY REF xml_representation)";
break;
case 'gt':
case '>':
@@ -1698,13 +1703,14 @@
$prop_array = $this->read_single($params,
$cache_attributes[$location_id]);
$_short_description = array();
- foreach ($prop_array['attributes'] as $attribute)
+
+ foreach ($prop_array['attributes'] as $key =>
$attribute)
{
$description_value = $attribute['value'];
-
if(isset($cache_attributes[$location_id]['attributes'][$attribute['value']]['choice'])
&&
$cache_attributes[$location_id]['attributes'][$attribute['value']]['choice'])
+
if(isset($cache_attributes[$location_id]['attributes'][$key]['choice']) &&
$cache_attributes[$location_id]['attributes'][$key]['choice'])
{
- $choice =
$cache_attributes[$location_id]['attributes'][$attribute['value']]['choice'];
+ $choice =
$cache_attributes[$location_id]['attributes'][$key]['choice'];
foreach($choice as $choice_value)
{
if ($choice_value['id'] ==
$attribute['value'])
@@ -1715,7 +1721,10 @@
}
}
- $short_description[] =
"{$attribute['input_text']}: {$description_value}";
+ if($description_value)
+ {
+ $short_description[] =
"{$attribute['input_text']}: {$description_value}";
+ }
}
$short_description = implode(', ', $short_description);
Modified: branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -12,10 +12,10 @@
{
protected static $so;
protected $fields_of_responsibility; // Used for caching the values
-
+
/**
* Get a static reference to the storage object associated with this
model object
- *
+ *
* @return rental_socontract the storage object
*/
public static function get_instance()
@@ -25,7 +25,7 @@
}
return self::$so;
}
-
+
/**
* Filters:
* Contracts with party as contract party
@@ -36,16 +36,16 @@
* Contracts with composite as contract composite
* Contracts with contract status
* Contracts for billing
- *
+ *
* @see rental/inc/rental_socommon#get_query($sort_field, $ascending,
$search_for, $search_type, $filters, $return_count)
*/
protected function get_query(string $sort_field, boolean $ascending,
string $search_for, string $search_type, array $filters, boolean $return_count)
- {
+ {
$clauses = array('1=1');
-
+
//Add columns to this array to include them in the query
$columns = array();
-
+
$dir = $ascending ? 'ASC' : 'DESC';
if($sort_field == null || $sort_field == '')
{
@@ -63,18 +63,18 @@
else if($sort_field == 'term_label'){
$sort_field = 'contract.term_id';
}
-
-
+
+
//Contracts for billing should always be sorted on biling start
if(isset($filters['contracts_for_billing']))
{
- $order = "ORDER BY contract.billing_start ASC";
+ $order = "ORDER BY contract.billing_start ASC";
}
else
{
$order = "ORDER BY {$sort_field} {$dir}";
}
-
+
// Search for based on search type
if($search_for)
{
@@ -101,7 +101,7 @@
$like_clauses[] = "r_u.location_code
like '{$search_for}%'";
break;
case "all":
-
+
$like_clauses[] =
"contract.old_contract_id $this->like $like_pattern";
$like_clauses[] = "contract.comment
$this->like $like_pattern";
$like_clauses[] = "party.first_name
$this->like $like_pattern";
@@ -111,7 +111,7 @@
$like_clauses[] = "r_u.location_code
$this->like $like_pattern";
break;
}
-
+
if($composite_address)
{
$sql_composite_address = "select
rental_composite.id as rc_id from rental_composite,rental_unit,fm_gab_location
where rental_unit.composite_id=rental_composite.id and
fm_gab_location.location_code=rental_unit.location_code and
fm_gab_location.address like upper({$like_pattern})";
@@ -131,24 +131,24 @@
$like_clauses[] = "composite.id in
(-1)";
}
}
-
-
+
+
if(count($like_clauses))
{
$clauses[] = '(' . join(' OR ', $like_clauses)
. ')';
}
-
-
+
+
}
-
+
$filter_clauses = array();
-
+
// Contracts with party as contract party
if(isset($filters['party_id'])){
$party_id =
$this->marshal($filters['party_id'],'int');
$filter_clauses[] = "party.id = $party_id";
}
-
+
// Contracts for this executive officer
if(isset($filters['executive_officer'])){
$account_id =
$this->marshal($filters['executive_officer'],'int');
@@ -160,60 +160,60 @@
$type =
$this->marshal($filters['contract_type'],'field');
$filter_clauses[] = "contract.location_id IN ($type)";
}
-
+
// Contracts with this id (filter for retrieveing a single
contract)
if(isset($filters[$this->get_id_field_name()])){
$id =
$this->marshal($filters[$this->get_id_field_name()],'int');
$filter_clauses[] = "contract.id = {$id}";
}
-
+
// All contracts with composite as contract composite
if(isset($filters['composite_id']))
- {
+ {
$composite_id =
$this->marshal($filters['composite_id'],'int');
$filter_clauses[] = "composite.id = {$composite_id}";
}
-
+
// Affected contracts by regulation
if(isset($filters['adjustment_interval']) &&
isset($filters['adjustment_year']))
{
$adjustment_interval =
$this->marshal($filters['adjustment_interval'],'int');
$adjustment_year =
$this->marshal($filters['adjustment_year'],'int');
-
+
if($filters['adjustment_is_executed']){
$filter_clauses[] = "contract.adjustment_year =
{$adjustment_year}";
}
else{
$filter_clauses[] = "contract.adjustment_year +
{$adjustment_interval} <= {$adjustment_year}";
}
-
+
$firstJanAdjYear = mktime(0,0,0,1,1,$adjustment_year);
-
+
//make sure the contracts are active
$filter_clauses[] = "(contract.date_end is null OR
contract.date_end >= {$firstJanAdjYear})";
$filter_clauses[] = "contract.date_start is not null
AND contract.date_start <= {$firstJanAdjYear}";
-
+
$filter_clauses[] = "contract.adjustable IS true";
$filter_clauses[] = "contract.adjustment_interval =
{$adjustment_interval}";
-
+
}
-
- /*
+
+ /*
* Contract status is defined by the dates in each contract
compared to the target date (default today):
- * - contracts under planning:
+ * - contracts under planning:
* the start date is larger (in the future) than the target
date, or start date is undefined
- * - active contracts:
- * the start date is smaller (in the past) than the target
date, and the end date is undefined (running) or
+ * - active contracts:
+ * the start date is smaller (in the past) than the target
date, and the end date is undefined (running) or
* larger (fixed) than the target date
- * - under dismissal:
- * the start date is smaller than the target date,
- * the end date is larger than the target date, and
+ * - under dismissal:
+ * the start date is smaller than the target date,
+ * the end date is larger than the target date, and
* the end date substracted the contract type notification
period is smaller than the target date
* - ended:
* the end date is smaller than the target date
*/
- if(isset($filters['contract_status']) &&
$filters['contract_status'] != 'all'){
-
+ if(isset($filters['contract_status']) &&
$filters['contract_status'] != 'all'){
+
if(isset($filters['status_date_hidden']) &&
$filters['status_date_hidden'] != "")
{
$ts_query =
strtotime($filters['status_date_hidden']); // target timestamp specified by user
@@ -245,7 +245,7 @@
break;
}
}
-
+
/*
* Contracts for billing
*/
@@ -274,23 +274,23 @@
}
$timestamp_end = strtotime('+1 month', $timestamp_end);
// The first day in the month after the one to bill for
//$timestamp_start = strtotime("{$year}-{$month}-01");
-
+
$filter_clauses[] = "contract.term_id =
{$billing_term_id}";
$filter_clauses[] = "contract.date_start <
$timestamp_end";
$filter_clauses[] = "(contract.date_end IS NULL OR
contract.date_end >= {$timestamp_start})";
$filter_clauses[] = "(contract.billing_start IS NULL OR
contract.billing_start < {$timestamp_end})";
-
+
$specific_ordering = 'invoice.timestamp_end DESC,
contract.billing_start DESC, contract.date_start DESC, contract.date_end DESC';
$order = $order ? $order.', '.$specific_ordering :
"ORDER BY {$specific_ordering}";
}
-
+
if(count($filter_clauses))
{
$clauses[] = join(' AND ', $filter_clauses);
}
-
+
$condition = join(' AND ', $clauses);
-
+
if($return_count) // We should only return a count
{
$cols = 'COUNT(DISTINCT(contract.id)) AS count';
@@ -302,17 +302,17 @@
$columns[] = 'contract.id AS contract_id';
$columns[] = 'contract.date_start, contract.date_end,
contract.old_contract_id, contract.executive_officer, contract.last_updated,
contract.location_id, contract.billing_start, contract.service_id,
contract.responsibility_id, contract.reference, contract.invoice_header,
contract.project_id, billing.deleted, contract.account_in,
contract.account_out, contract.term_id, contract.security_type,
contract.security_amount, contract.comment, contract.due_date,
contract.contract_type_id,contract.rented_area,contract.adjustable,contract.adjustment_interval,contract.adjustment_share,contract.adjustment_year,contract.publish_comment';
$columns[] = 'party.id AS party_id';
- $columns[] = 'party.first_name, party.last_name,
party.company_name';
- $columns[] = 'c_t.is_payer';
+ $columns[] = 'party.first_name, party.last_name,
party.company_name, party.department, party.org_enhet_id';
+ $columns[] = 'c_t.is_payer';
$columns[] = 'composite.id AS composite_id';
$columns[] = 'composite.name AS composite_name';
$columns[] = 'type.title, type.notify_before,
type.notify_before_due_date, type.notify_after_termination_date';
$columns[] = 'last_edited.edited_on';
- $columns[] = 'invoice.timestamp_end';
+ $columns[] = 'invoice.timestamp_end';
$columns[] = 'r_b_t.title AS term_title';
$cols = implode(',',$columns);
}
-
+
$tables = "rental_contract contract";
$join_contract_type = $this->left_join.'
rental_contract_responsibility type ON (type.location_id =
contract.location_id)';
$join_parties = $this->left_join.' rental_contract_party c_t ON
(contract.id = c_t.contract_id) LEFT JOIN rental_party party ON (c_t.party_id =
party.id)';
@@ -324,10 +324,10 @@
$joins = $join_contract_type.' '.$join_parties.'
'.$join_composites.' '.$join_units.' '.$join_last_edited.'
'.$join_last_billed.' '.$join_term_title;
//var_dump("SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}");
-
+
return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
}
-
+
public function get_id_field_name($extended_info = false)
{
if(!$extended_info)
@@ -346,13 +346,13 @@
return $ret;
}
-
+
function populate(int $contract_id, &$contract)
{
-
+
if($contract == null ) // new contract
{
- $contract_id = (int) $contract_id;
+ $contract_id = (int) $contract_id;
$contract = new rental_contract($contract_id);
$contract->set_contract_date(new rental_contract_date
(
@@ -390,23 +390,23 @@
$contract->set_notify_before($this->unmarshal($this->db->f('notify_before'),'int'));
$contract->set_notify_before_due_date($this->unmarshal($this->db->f('notify_before_due_date'),'int'));
$contract->set_notify_after_termination_date($this->unmarshal($this->db->f('notify_after_termination_date'),'int'));
-
-
+
+
}
-
+
$timestamp_end =
$this->unmarshal($this->db->f('timestamp_end'),'int');
$billing_deleted =
$this->unmarshal($this->db->f('deleted'),'bool');
if($timestamp_end && !$billing_deleted)
{
$contract->add_bill_timestamp($timestamp_end);
}
-
+
$total_price =
$this->unmarshal($this->db->f('total_price'),'int');
if($total_price)
{
$contract->set_total_price($total_price);
}
-
+
$party_id = $this->unmarshal($this->db->f('party_id', true),
'int');
if($party_id)
{
@@ -414,6 +414,8 @@
$party->set_first_name($this->unmarshal($this->db->f('first_name', true),
'string'));
$party->set_last_name($this->unmarshal($this->db->f('last_name', true),
'string'));
$party->set_company_name($this->unmarshal($this->db->f('company_name', true),
'string'));
+
$party->set_department($this->unmarshal($this->db->f('department', true),
'string'));
+
$party->set_org_enhet_id($this->unmarshal($this->db->f('org_enhet_id'), 'int'));
$is_payer = $this->unmarshal($this->db->f('is_payer',
true), 'bool');
if($is_payer)
{
@@ -421,7 +423,7 @@
}
$contract->add_party($party);
}
-
+
$composite_id = $this->unmarshal($this->db->f('composite_id',
true), 'int');
if($composite_id)
{
@@ -431,10 +433,10 @@
}
return $contract;
}
-
+
/**
* Get a key/value array of contract type titles keyed by their id
- *
+ *
* @return array
*/
function get_fields_of_responsibility(){
@@ -451,7 +453,7 @@
}
return $this->fields_of_responsibility;
}
-
+
function get_default_account(int $location_id, bool $in){
if(isset($location_id) && $location_id > 0)
{
@@ -463,7 +465,7 @@
{
$col = 'account_out';
}
-
+
$sql = "SELECT {$col} FROM
rental_contract_responsibility WHERE location_id = {$location_id}";
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
@@ -471,7 +473,7 @@
}
return '';
}
-
+
function get_default_project_number(int $location_id)
{
if(isset($location_id) && $location_id > 0)
@@ -480,9 +482,9 @@
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
return $this->db->f('project_number',true);
- }
+ }
}
-
+
function get_responsibility_title(int $location_id)
{
if(isset($location_id) && $location_id > 0)
@@ -491,14 +493,14 @@
$this->db->query($sql, __LINE__, __FILE__);
$this->db->next_record();
return $this->db->f('title',true);
- }
+ }
}
-
+
/**
* Returns the range of year there are contracts. That is, the array
* returned contains reversed chronologically all the years from the
earliest start
- * year of the contracts to next year.
- *
+ * year of the contracts to next year.
+ *
* @return array of string values, never null.
*/
public function get_year_range()
@@ -523,20 +525,20 @@
{
$year_range[] = $year;
}
-
+
return $year_range;
}
-
+
/**
* Update the database values for an existing contract object.
- *
+ *
* @param $contract the contract to be updated
* @return result receipt from the db operation
*/
function update($contract)
{
$id = intval($contract->get_id());
-
+
$values = array();
// Set all fields in form
@@ -544,18 +546,18 @@
// FORM COLUMN 1
$values[] = "contract_type_id = ".
$this->marshal($contract->get_contract_type_id(), 'int');
$values[] = "executive_officer = ".
$this->marshal($contract->get_executive_officer_id(), 'int');
-
+
if ($contract->get_contract_date()) {
$values[] = "date_start = " .
$this->marshal($contract->get_contract_date()->get_start_date(), 'int');
$values[] = "date_end = " .
$this->marshal($contract->get_contract_date()->get_end_date(), 'int');
}
-
+
$values[] = "due_date = " .
$this->marshal($contract->get_due_date(), 'int');
$values[] = "invoice_header = ".
$this->marshal($contract->get_invoice_header(),'string');
$values[] = "term_id = " .
$this->marshal($contract->get_term_id(), 'int');
$values[] = "billing_start = " .
$this->marshal($contract->get_billing_start_date(), 'int');
$values[] = "reference = ".
$this->marshal($contract->get_reference(),'string');
-
+
// FORM COLUMN 2
$values[] = "service_id = ".
$this->marshal($contract->get_service_id(),'string');
$values[] = "responsibility_id = ".
$this->marshal($contract->get_responsibility_id(),'string');
@@ -569,45 +571,45 @@
$values[] = "adjustment_interval = ".
$this->marshal($contract->get_adjustment_interval(),'int');
$values[] = "adjustment_share = ".
$this->marshal($contract->get_adjustment_share(),'int');
$values[] = "publish_comment = ".
($contract->get_publish_comment() ? "true" : "false");
-
+
// FORM COLUMN 3
$values[] = "comment = ".
$this->marshal($contract->get_comment(), 'string');
-
-
+
+
// Set date last updated
$values[] = "last_updated = ". strtotime('now');
-
+
$result = $this->db->query('UPDATE rental_contract SET ' .
join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
-
+
if(isset($result))
{
$this->last_edited_by($id);
return true;
}
-
+
return false;
}
-
+
/**
* This method marks the combination contract/user account with the
current timestamp. It updates the record if the user has updated
- * this contract before; inserts a new record if the user has never
updated this contract.
- *
+ * this contract before; inserts a new record if the user has never
updated this contract.
+ *
* @param $contract_id
* @return true if the contract was marker, false otherwise
*/
public function last_edited_by($contract_id){
$account_id = $GLOBALS['phpgw_info']['user']['account_id']; //
current user
$ts_now = strtotime('now');
-
+
$sql_has_edited_before = "SELECT account_id FROM
rental_contract_last_edited WHERE contract_id = $contract_id AND account_id =
$account_id";
$result = $this->db->query($sql_has_edited_before);
-
+
if(isset($result))
{
if($this->db->next_record())
{
$sql = "UPDATE rental_contract_last_edited SET
edited_on=$ts_now WHERE contract_id = $contract_id AND account_id =
$account_id";
- }
+ }
else
{
$sql = "INSERT INTO rental_contract_last_edited
VALUES ($contract_id,$account_id,$ts_now)";
@@ -620,13 +622,13 @@
}
return false;
}
-
+
public function remove_Last_edited_by_information()
{
$sql = "DELETE * FROM rental_contract_last_edited";
$this->db->query($sql);
}
-
+
public function get_last_edited_by($contract_id)
{
$sql = "SELECT account_id FROM rental_contract_last_edited
where contract_id={$contract_id} ORDER by edited_on DESC";
@@ -641,10 +643,10 @@
}
return "";
}
-
+
/**
* This method markw the given contract with the current timestamp
- *
+ *
* @param $contract_id
* @return true if the contract was marked, false otherwise
*/
@@ -661,16 +663,16 @@
return false;
}
}
-
+
/**
* Add a new contract to the database. Adds the new insert id to the
object reference.
- *
+ *
* @param $contract the contract to be added
* @return array result receipt from the db operation
*/
function add(&$contract)
{
-
+
$contract->set_id(self::get_new_id($contract->get_old_contract_id()));
// Contract has no old or new ID, get next ID available from DB
@@ -681,7 +683,7 @@
// These are the columns we know we have or that are nullable
$cols = array('location_id', 'term_id');//
-
+
// Start making a db-formatted list of values of the columns we
have to have
$values = array(
$this->marshal($contract->get_location_id(), 'int'),
@@ -693,101 +695,101 @@
$values[] = $new_id ? $new_id : $this->marshal($contract->get_id(),
'int');
-
+
// Check values that can be null before trying to add them to
the db-pretty list
if ($contract->get_billing_start_date()) {
$cols[] = 'billing_start';
$values[] =
$this->marshal($contract->get_billing_start_date(), 'int');
}
-
+
if ($contract->get_contract_date()) {
$cols[] = 'date_start';
$cols[] = 'date_end';
$values[] =
$this->marshal($contract->get_contract_date()->get_start_date(), 'int');
$values[] =
$this->marshal($contract->get_contract_date()->get_end_date(), 'int');
}
-
+
if($contract->get_executive_officer_id()) {
$cols[] = 'executive_officer';
$values[] =
$this->marshal($contract->get_executive_officer_id(), 'int');
}
-
+
$cols[] = 'created';
$cols[] = 'created_by';
$values[] = strtotime('now');
$values[] = $GLOBALS['phpgw_info']['user']['account_id'];
-
-
+
+
$cols[] = 'service_id';
$cols[] = 'responsibility_id';
$values[] =
$this->marshal($contract->get_service_id(),'string');
$values[] =
$this->marshal($contract->get_responsibility_id(),'string');
-
+
$cols[] = 'reference';
$cols[] = 'invoice_header';
$values[] = $this->marshal($contract->get_reference(),'string');
$values[] =
$this->marshal($contract->get_invoice_header(),'string');
-
+
$cols[] = 'account_in';
$cols[] = 'account_out';
$values[] =
$this->marshal($contract->get_account_in(),'string');
$values[] =
$this->marshal($contract->get_account_out(),'string');
-
+
$cols[] = 'project_id';
$values[] =
$this->marshal($contract->get_project_id(),'string');
-
+
$cols[] = 'old_contract_id';
$values[] = $new_id ?
$this->marshal(self::get_old_id($new_id),'string') :
$this->marshal($contract->get_old_contract_id(),'string');
-
+
$cols[] = 'rented_area';
$values[] = $this->marshal($contract->get_rented_area(),'float');
-
+
$cols[] = 'comment';
$values[] = $this->marshal($contract->get_comment(),'string');
-
+
$cols[] = 'adjustment_interval';
$values[] =
$this->marshal($contract->get_adjustment_interval(),'int');
-
+
$cols[] = 'adjustment_share';
$values[] =
$this->marshal($contract->get_adjustment_share(),'int');
-
+
$cols[] = 'adjustable';
$values[] = ($contract->get_adjustable() ? "true" : "false");
-
+
$cols[] = 'adjustment_year';
$values[] =
$this->marshal($contract->get_adjustment_year(),'int');
-
+
$cols[] = 'publish_comment';
$values[] = ($contract->get_publish_comment() ? "true" :
"false");
-
-
+
+
if ($contract->get_security_type()) {
$cols[] = 'security_type';
$values[] =
$this->marshal($contract->get_security_type(),'int');
$cols[] = 'security_amount';
$values[] =
$this->marshal($contract->get_security_amount(),'string');
}
-
+
if ($contract->get_due_date()) {
$cols[] = 'due_date';
$values[] = $this->marshal($contract->get_due_date(),
'int');
}
-
+
if($contract->get_contract_type_id()) {
$cols[] = 'contract_type_id';
$values[] =
$this->marshal($contract->get_contract_type_id(), 'int');
}
-
+
// Insert the new contract
$q ="INSERT INTO rental_contract (" . join(',', $cols) . ")
VALUES (" . join(',', $values) . ")";
$result = $this->db->query($q);
-
+
return $contract;
}
-
+
/**
* This method adds a party to a contract. Updates last edited history.
- *
+ *
* @param $contract_id the given contract
* @param $party_id the party to add
* @return true if successful, false otherwise
@@ -804,10 +806,10 @@
}
return false;
}
-
+
/**
* This method removes a party from a contract. Updates last edited
history.
- *
+ *
* @param $contract_id the given contract
* @param $party_id the party to remove
* @return true if successful, false otherwise
@@ -824,10 +826,10 @@
}
return false;
}
-
+
/**
* This method adds a composite to a contract. Updates last edited
history.
- *
+ *
* @param $contract_id the given contract
* @param $composite_id the composite to add
* @return true if successful, false otherwise
@@ -844,10 +846,10 @@
}
return false;
}
-
+
/**
* This method removes a composite from a contract. Updates last edited
history.
- *
+ *
* @param $contract_id the given contract
* @param $party_id the composite to remove
* @return true if successful, false otherwise
@@ -864,12 +866,12 @@
}
return false;
}
-
-
-
+
+
+
/**
* This method sets a payer on a contract
- *
+ *
* @param $contract_id the given contract
* @param $party_id the party to be the payer
* @return true if successful, false otherwise
@@ -877,7 +879,7 @@
function set_payer($contract_id, $party_id)
{
$pid =$this->marshal($party_id, 'int');
- $cid = $this->marshal($contract_id, 'int');
+ $cid = $this->marshal($contract_id, 'int');
$this->db->transaction_begin();
$q = "UPDATE rental_contract_party SET is_payer = true WHERE
party_id = ".$pid." AND contract_id = ".$cid;
$result = $this->db->query($q);
@@ -927,7 +929,7 @@
return $prefix.$cid;
}
-
+
public function get_contract_types($location_id){
$q1="SELECT rct.id, rct.label FROM rental_contract_types rct,
rental_contract_responsibility rcr WHERE rcr.location_id={$location_id} AND
rct.responsibility_id=rcr.id";
$this->db->query($q1, __LINE__, __FILE__);
@@ -935,10 +937,10 @@
while($this->db->next_record()){
$results[$this->db->f('id')] = $this->db->f('label');
}
-
+
return $results;
}
-
+
public function get_contract_type_label($contract_type_id){
$result = "Ingen";
if(isset($contract_type_id)){
@@ -948,10 +950,10 @@
$result = $this->db->f('label');
}
}
-
+
return $result;
}
-
+
public function get_contract_type_account($contract_type_id)
{
$q1="SELECT rct.account FROM rental_contract_types rct WHERE
rct.id={$contract_type_id}";
@@ -960,11 +962,11 @@
while($this->db->next_record()){
$result = $this->db->f('account');
}
-
+
return $result;
}
-
-
+
+
public function get_term_label($billing_term_id){
$q1="SELECT rbt.title FROM rental_billing_term rbt WHERE
rbt.id={$billing_term_id}";
$this->db->query($q1, __LINE__, __FILE__);
@@ -972,7 +974,7 @@
while($this->db->next_record()){
$result = $this->db->f('title');
}
-
+
return $result;
}
@@ -988,7 +990,7 @@
$success_composites = true;
$success_parties = true;
$success_price_items = true;
-
+
//composites
$this->db->query($q_composites);
while($this->db->next_record()){
@@ -1003,7 +1005,7 @@
$success_composites = false;
}
}
-
+
//parties
$this->db->query($q_parties);
while($this->db->next_record()){
@@ -1020,7 +1022,7 @@
$success_parties = false;
}
}
-
+
//price items
$this->db->query($q_price_items);
while($this->db->next_record()){
@@ -1059,9 +1061,9 @@
return false;
}
}
-
+
public function get_months_in_term($term_id)
- {
+ {
$sql = "SELECT months FROM rental_billing_term WHERE id =
{$term_id}";
$result = $this->db->query($sql);
if(!$result)
@@ -1075,7 +1077,7 @@
$months = $this->unmarshal($this->db->f('months', true), 'int');
return $months;
}
-
+
public function update_price_items($contract_id, $rented_area){
$success_price_item = true;
$new_area = $rented_area;
@@ -1101,14 +1103,14 @@
return false;
}
}
-
+
public function import_contract_reference($contract_id, $reference)
{
$reference = $this->marshal($reference,'string');
$sql = "UPDATE rental_contract SET reference={$reference} WHERE id =
{$contract_id}";
$this->db->query($sql);
}
-
+
public function update_adjustment_year_interval($contract_id,
$adjusted_year, $adjustment_interval)
{
$new_adjusted_year = $this->marshal($adjusted_year, 'int');
@@ -1117,7 +1119,7 @@
$this->db->query($sql);
return $this->db->affected_rows() > 0 ? true : false;
}
-
+
public function update_contract_end_date($contract_id, $date)
{
$cid = $this->marshal($contract_id, 'int');
@@ -1125,7 +1127,7 @@
$sql = "UPDATE rental_contract SET date_end={$end_date} WHERE id =
{$cid}";
$this->db->query($sql);
}
-
+
public function update_adjustment_year($contract_id, $adjusted_year)
{
$new_adjusted_year = $this->marshal($adjusted_year, 'int');
@@ -1133,20 +1135,20 @@
$this->db->query($sql);
return $this->db->affected_rows() > 0 ? true : false;
}
-
+
public function update_adjustment_share($contract_id, $adjustment_share)
{
$new_adjustment_share = $this->marshal($adjustment_share, 'int');
$sql = "UPDATE rental_contract SET
adjustment_share={$new_adjustment_share} WHERE id = {$contract_id}";
$this->db->query($sql);
}
-
+
public function get_default_price_items($location_id)
{
$price_items = array();
$loc_id = $this->marshal($location_id, 'int');
-
- //select all standard price_items for given location_id
+
+ //select all standard price_items for given location_id
$sql = "SELECT id FROM rental_price_item WHERE
responsibility_id={$loc_id} AND NOT is_inactive AND standard";
$this->db->query($sql);
while($this->db->next_record())
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
2013-06-17 13:23:53 UTC (rev 11185)
+++ branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
2013-06-17 13:26:53 UTC (rev 11186)
@@ -11,10 +11,10 @@
const SECURITY_TYPE_DEPOSIT = 2;
const SECURITY_TYPE_ADVANCE = 3;
const SECURITY_TYPE_OTHER_GUARANTEE = 4;
-
+
public static $so;
public static $types;
-
+
protected $id;
protected $parties;
protected $contract_date;
@@ -55,11 +55,11 @@
protected $bill_only_one_time;
protected $publish_comment;
protected $total_price_current_year;
-
+
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
* the database the ID should be empty so the database can add
one according to its logic.
- *
+ *
* @param int $id the id of this composite
*/
public function __construct(int $id = null)
@@ -67,10 +67,10 @@
$this->id = (int)$id;
$this->parties = array();
$this->composites = array();
- $this->bill_timestamps = array(); // Consider to have
all invoices here if other data than billing timetamps are needed
+ $this->bill_timestamps = array(); // Consider to have
all invoices here if other data than billing timetamps are needed
$bill_only_one_time = false;
}
-
+
public function toArray()
{
@@ -87,7 +87,7 @@
'get_composites', //returnerer objekt
'get_parties' //returnerer objekt
);
-
+
$class_methods = get_class_methods($this);
$contract_arr = array();
foreach ($class_methods as $class_method)
@@ -107,78 +107,78 @@
{
$this->id = $id;
}
-
+
public function get_id() { return $this->id; }
-
+
public function set_payer($id)
{
$so = self::get_so();
$so->set_payer($this->get_id(),$id);
}
-
+
public function set_payer_id($id){
$this->payer_id = $id;
}
-
+
public function set_old_contract_id($id){
$this->old_contract_id = $id;
}
-
+
public function get_old_contract_id(){
return $this->old_contract_id;
}
-
+
public function get_payer_id() { return $this->payer_id; }
-
+
public function set_parties($parties)
{
$this->parties = $parties;
}
-
+
public function set_contract_date($date)
{
$this->contract_date = $date;
}
-
+
public function get_contract_date() {
return $this->contract_date;
}
-
+
public function set_billing_start_date($date)
{
$this->billing_start_date = $date;
}
-
+
public function set_next_bill_timestamp($next_bill_timestamp)
{
$this->next_bill_timestamp = $next_bill_timestamp;
}
-
+
public function get_next_bill_timestamp()
{
return $this->next_bill_timestamp;
}
-
+
public function get_executive_officer_id() {
return $this->executive_officer_id;
}
-
+
public function set_executive_officer_id($id)
{
$this->executive_officer_id = $id;
}
-
+
/**
* Returns date of when the first invoice should be produced
for the
* contract.
* @return string with UNIX time.
*/
- public function get_billing_start_date() {
+ public function get_billing_start_date() {
if(isset($this->billing_start_date))
{
return $this->billing_start_date;
}
-
+
if(isset($this->contract_date))
{
return $this->contract_date->get_start_date();
@@ -186,89 +186,89 @@
return '';
}
-
+
public function set_location_id($location_id)
{
$this->field_of_responsibility_id = (int) $location_id;
$this->location_id = (int) $location_id;
}
-
+
public function set_project_id($project_id)
{
$this->project_id = $project_id;
}
-
+
public function get_project_id(){ return $this->project_id; }
-
+
public function get_location_id() { return $this->location_id; }
-
+
public function set_service_id($service_id)
{
$this->service_id = $service_id;
}
-
+
public function get_service_id() { return $this->service_id; }
-
+
public function set_responsibility_id($responsibility_id)
{
$this->responsibility_id = $responsibility_id;
}
-
+
public function get_responsibility_id() { return
$this->responsibility_id; }
-
+
public function set_term_id(int $term_id)
{
$this->term_id = (int)$term_id;
}
-
+
public function get_term_id() { return $this->term_id; }
-
+
public function get_account_in() { return $this->account_in; }
-
+
public function set_account_in($account_in)
{
$this->account_in = $account_in;
}
-
+
public function get_account_out() { return $this->account_out; }
-
+
public function set_account_out($account_out)
{
$this->account_out = $account_out;
}
-
+
public function get_reference() { return $this->reference; }
-
+
public function set_reference($reference)
{
$this->reference = $reference;
}
-
+
public function get_invoice_header() { return
$this->invoice_header; }
-
+
public function set_invoice_header($invoice_header)
{
$this->invoice_header = $invoice_header;
}
-
-
-
+
+
+
public function set_term_id_title($term_id_title)
{
$this->term_id_title = $term_id_title;
}
- public function get_term_id_title(){
+ public function get_term_id_title(){
if(isset($this->term_id_title) && $this->term_id_title
!= '')
- {
- return lang($this->term_id_title);
+ {
+ return lang($this->term_id_title);
}
else
{
return null;
}
}
-
+
public function set_security_type(int $security_type = null)
{
switch($security_type)
@@ -290,41 +290,41 @@
break;
}
}
-
+
public function get_security_type() { return
$this->security_type; }
-
+
public function set_security_amount($security_amount)
{
$this->security_amount = $security_amount;
}
-
+
public function get_security_amount() { return
$this->security_amount; }
-
+
/**
* Get the name of the contract type @see get_location_id()
- *
+ *
* @return string
*/
public function get_contract_type_title()
{
return $this->contract_type_title;
}
-
+
public function set_contract_type_title($title)
{
$this->contract_type_title = $title;
}
-
+
public function get_bill_only_one_time()
{
return $this->bill_only_one_time;
}
-
+
public function set_bill_only_one_time()
{
$this->bill_only_one_time = true;
}
-
+
public function get_party_name(){
$names = '';
foreach($this->parties as $party) {
@@ -332,7 +332,15 @@
}
return $names;
}
-
+
+ public function get_party_department(){
+ $names = '';
+ foreach($this->parties as $party) {
+ $names .= $party->get_department()."<br/>";
+ }
+ return $names;
+ }
+
public function get_party_name_as_list(){
$names = '';
$tot_parties = count($this->parties);
@@ -346,7 +354,7 @@
}
return $names;
}
-
+
public function get_composite_name(){
$names = '';
foreach($this->composites as $composite) {
@@ -354,7 +362,7 @@
}
return $names;
}
-
+
public function get_composite_name_as_list(){
$names = '';
$tot_composites = count($this->composites);
@@ -368,34 +376,34 @@
}
return $names;
}
-
+
public function set_composites($composites)
{
$this->composites = $composites;
}
-
+
public function set_last_edited_by_current_user($date)
{
$this->last_edited_by_current_user = $date;
}
-
+
public function get_last_edited_by_current_user() { return
$this->last_edited_by_current_user;}
-
+
/**
* Get a list of the composites associated with this contract.
- *
+ *
* @return array with rental_composite objects, empty array if
none, never null.
*/
public function get_composites()
{
return $this->composites;
}
-
+
/**
* Get a list of the composites associated with this contract.
The composites are loaded
* lazily, so they will not be populated at object
construction, but rather at first call
* of this function.
- *
+ *
* @return rental_composite[]
*/
public function get_available_composites()
@@ -403,59 +411,59 @@
$so = self::get_so();
return
$so->get_available_composites_for_contract($this->get_id());
}
-
+
/**
* Get a list of the parties associated with this contract.
The parties are loaded
* lazily, so they will not be populated at object
construction, but rather at first call
* of this function.
- *
+ *
* @return rental_party[]
*/
public function get_parties()
{
return $this->parties;
}
-
+
public function set_comment($comment)
{
$this->comment = $comment;
}
-
+
/**
* Get the timestamp for the last update on this contract
- *
+ *
* @return int timestamp for last update
*/
public function get_last_updated()
{
return $this->last_updated;
}
-
+
/**
* Set the timestamp for the last update on this contract
- *
+ *
* @param $timestamp last update
*/
public function set_last_updated($timestamp)
{
$this->last_updated = $timestamp;
}
-
+
/**
* Get comment associated with this contract.
- *
+ *
* @return string comment
*/
public function get_comment()
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11186] Merge 11162:11185 from trunk,
Sigurd Nes <=