[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11084] Merge 11078:11083 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11084] Merge 11078:11083 from trunk |
Date: |
Mon, 29 Apr 2013 13:53:41 +0000 |
Revision: 11084
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11084
Author: sigurdne
Date: 2013-04-29 13:53:36 +0000 (Mon, 29 Apr 2013)
Log Message:
-----------
Merge 11078:11083 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/setup/setup.inc.php
branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
branches/Version-1_0-branch/logistic/templates/base/allocation/book_resources.xsl
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
branches/Version-1_0-branch/property/inc/class.boentity.inc.php
branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.interlink.inc.php
branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
branches/Version-1_0-branch/property/inc/class.soentity.inc.php
branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
branches/Version-1_0-branch/property/js/yahoo/property.js
branches/Version-1_0-branch/property/setup/phpgw_no.lang
branches/Version-1_0-branch/property/templates/base/invoice.xsl
branches/Version-1_0-branch/property/templates/base/request.xsl
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
+
/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
Modified:
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -47,16 +47,24 @@
{
$this->db->transaction_begin();
+ $allocation_id = $resource_alloc->get_id();
+
+ if($allocation_id)
+ {
+ throw new exception("FIXME: oppdater allokering
{$allocation_id}");
+ }
+
$value_set = array
(
- 'location_id' =>
$resource_alloc->get_location_id(),
- 'item_id' =>
$this->marshal($resource_alloc->get_resource_id(), 'int'),
- 'item_inventory_id' =>
$this->marshal($resource_alloc->get_inventory_id(), 'int'),
- 'allocation_id' => 0,//not known yet
- 'create_user' =>
$resource_alloc->get_create_user(),
- 'create_date' => time(),
- 'start_date' =>
$resource_alloc->get_start_date(),
- 'end_date' =>
$resource_alloc->get_end_date(),
+ 'location_id' =>
$resource_alloc->get_location_id(),
+ 'item_id' =>
$this->marshal($resource_alloc->get_resource_id(), 'int'),
+ 'item_inventory_id' =>
$this->marshal($resource_alloc->get_inventory_id(), 'int'),
+ 'item_inventory_amount' =>
$this->marshal($resource_alloc->get_allocated_amount(), 'int'),
+ // 'allocation_id' => 0,//not
known yet
+ 'create_user' =>
$resource_alloc->get_create_user(),
+ 'create_date' => time(),
+ 'start_date' =>
$resource_alloc->get_start_date(),
+ 'end_date' =>
$resource_alloc->get_end_date(),
);
$sql = 'INSERT INTO lg_calendar (' . implode(',',
array_keys($value_set)) . ') VALUES (' . implode(',', array_values($value_set))
. ')';
@@ -89,7 +97,7 @@
if($result)
{
$allocation_id =
$this->db->get_last_insert_id('lg_requirement_resource_allocation', 'id');
- $this->db->query("UPDATE lg_calendar SET
allocation_id = {$allocation_id} WHERE id = {$calendar_id}", __LINE__,__FILE__);
+// $this->db->query("UPDATE lg_calendar SET
allocation_id = {$allocation_id} WHERE id = {$calendar_id}", __LINE__,__FILE__);
}
else
{
@@ -113,6 +121,14 @@
$result = $this->db->query('UPDATE
lg_requirement_resource_allocation SET ' . join(',', $values) . " WHERE
id=$id", __LINE__,__FILE__);
+ $item_inventory_amount =
(int)$resource_alloc->get_allocated_amount();
+
+ $this->db->query("SELECT calendar_id FROM
lg_requirement_resource_allocation WHERE id = {$id}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $calendar_id = (int)$this->db->f('calendar_id');
+
+ $this->db->query("UPDATE lg_calendar SET
item_inventory_amount = {$item_inventory_amount} WHERE id =
{$calendar_id}",__LINE__,__FILE__);
+
if($result)
{
return $id;
@@ -123,6 +139,30 @@
}
}
+
+ public function count_allocated($requirement_id)
+ {
+
+ $requirement_id = (int) $requirement_id;
+
+ $sql = "SELECT item_inventory_amount as count FROM
lg_requirement_resource_allocation"
+ . " {$this->join } lg_calendar ON
lg_requirement_resource_allocation.calendar_id = lg_calendar.id"
+ . " WHERE
lg_requirement_resource_allocation.requirement_id = {$requirement_id}";
+
+ $this->db->query($sql, __LINE__,__FILE__);
+ $sum = 0;
+ while ($this->db->next_record())
+ {
+ if(!$count = $this->db->f('count'))
+ {
+ $count = 1;
+ }
+ $sum += $count;
+ }
+
+ return $sum;
+ }
+
protected function get_id_field_name()
{
if(!$extended_info)
@@ -169,6 +209,7 @@
$tables = "lg_requirement_resource_allocation
allocation";
+ $joins .= " {$this->join } lg_calendar ON
allocation.calendar_id = lg_calendar.id";
$joins .= " {$this->left_join} phpgw_locations ON
(phpgw_locations.location_id = allocation.location_id)";
$joins .= " {$this->left_join} fm_bim_item ON
(fm_bim_item.location_id = allocation.location_id and fm_bim_item.id =
allocation.resource_id )";
@@ -179,6 +220,8 @@
else
{
$cols .= "allocation.*, ";
+ $cols .= "lg_calendar.item_inventory_amount as
count,";
+ $cols .= "lg_calendar.item_inventory_id as
inventory_id,";
$cols .= "phpgw_locations.descr AS
resource_type_descr, ";
$cols .= "fm_bim_item.location_code AS
location_code, (xpath('//address/node()',
fm_bim_item.xml_representation))[1]::text AS fm_bim_item_address,
(xpath('//navn[1]/text()', fm_bim_item.xml_representation))[1]::text AS
fm_bim_item_name ";
}
@@ -201,6 +244,8 @@
$allocation->set_resource_type_descr($this->unmarshal($this->db->f('resource_type_descr'),
'string'));
$allocation->set_location_code($this->unmarshal($this->db->f('location_code'),
'string'));
$allocation->set_fm_bim_item_address($this->unmarshal($this->db->f('fm_bim_item_address'),
'string'));
+
$allocation->set_allocated_amount($this->unmarshal($this->db->f('count'),
'int'));
+
$allocation->set_inventory_id($this->unmarshal($this->db->f('inventory_id'),
'int'));
$fm_bim_name = $this->unmarshal(
$this->db->f('fm_bim_item_name'), 'string');
@@ -215,39 +260,90 @@
* Finds allocated items within timespan
*
*/
- public function check_calendar($location_id = 0, $ids =
array(), $start_date, $end_date)
+ public function check_calendar($requirement, $ids = array())
{
- $location_id = (int)$location_id;
+ $start_date =
$requirement->get_start_date();
+ $end_date =
$requirement->get_end_date();
+ $location_id =
$requirement->get_location_id();
+ $requirement_id = (int)$requirement->get_id();
+
$values = array();
$items = array();
+ $inventory = array();
+ $allocations = array();
if (!$ids)
{
return $values;
}
- $sql = "SELECT lg_calendar.item_id,
lg_requirement.activity_id,"
- . " lg_calendar.start_date, lg_calendar.end_date"
+
+ // for this requirement
+ $sql = "SELECT
lg_calendar.item_id,lg_calendar.item_inventory_id,lg_calendar.item_inventory_amount,"
+ . " lg_requirement.id AS
requirement_id,lg_requirement.activity_id, lg_calendar.start_date,
lg_calendar.end_date,"
+ . " lg_requirement_resource_allocation.id AS
allocation_id"
. " FROM lg_requirement_resource_allocation"
. " {$this->join} lg_calendar ON
lg_requirement_resource_allocation.calendar_id = lg_calendar.id"
. " {$this->join} lg_requirement ON
lg_requirement_resource_allocation.requirement_id = lg_requirement.id"
. " WHERE lg_calendar.location_id = {$location_id}"
. " AND lg_calendar.item_id IN (" . implode(',', $ids)
. ')'
- . " AND lg_calendar.end_date >= {$start_date} AND
lg_calendar.start_date <= {$end_date}";
+ . " AND lg_calendar.end_date >= {$start_date} AND
lg_calendar.start_date <= {$end_date}"
+ . " AND lg_requirement.id = {$requirement_id}";
+
$this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
+ $allocation_id = $this->db->f('allocation_id');
$item_id = $this->db->f('item_id');
+ $item_inventory_id =
$this->db->f('item_inventory_id');
+ $item_allocated_amount =
$this->db->f('item_inventory_amount');
+ $start_date =
$this->db->f('start_date');
+ $end_date =
$this->db->f('end_date');
+
+
$items[$item_id] = true;
+ $inventory[$item_inventory_id] =
$item_allocated_amount;
+ $allocations[$item_inventory_id] = array
+ (
+ 'requirement_id' =>
$this->db->f('requirement_id'),
+ 'allocation_id' =>
$allocation_id,
+ 'start_date' =>
$start_date,
+ 'end_date'
=> $end_date
+ );
+
$values[$item_id][] = array
(
- 'start_date' =>
$this->db->f('start_date'),
- 'end_date' =>
$this->db->f('end_date'),
- 'activity_id' =>
$this->db->f('activity_id'),
- 'item_id' => $item_id
+ 'start_date' =>
$start_date,
+ 'end_date'
=> $end_date,
+ 'activity_id' =>
$this->db->f('activity_id'),
+ 'item_id'
=> $item_id,
+ 'item_inventory_id' =>
$item_inventory_id,
+ 'item_allocated_amount' =>
$item_inventory_amount
);
}
- return array('calendar' => $values, 'items' => $items);
+
+
+ //total
+ $sql = "SELECT
lg_calendar.item_id,lg_calendar.item_inventory_id,lg_calendar.item_inventory_amount,"
+ . " lg_requirement.id AS
requirement_id,lg_requirement.activity_id, lg_calendar.start_date,
lg_calendar.end_date,"
+ . " lg_requirement_resource_allocation.id AS
allocation_id"
+ . " FROM lg_requirement_resource_allocation"
+ . " {$this->join} lg_calendar ON
lg_requirement_resource_allocation.calendar_id = lg_calendar.id"
+ . " {$this->join} lg_requirement ON
lg_requirement_resource_allocation.requirement_id = lg_requirement.id"
+ . " WHERE lg_calendar.location_id = {$location_id}"
+ . " AND lg_calendar.item_id IN (" . implode(',', $ids)
. ')'
+ . " AND lg_calendar.end_date >= {$start_date} AND
lg_calendar.start_date <= {$end_date}";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ $allocation_id = $this->db->f('allocation_id');
+ $item_inventory_id =
$this->db->f('item_inventory_id');
+
$allocations[$item_inventory_id]['total_allocated'] +=
$this->db->f('item_inventory_amount');
+ }
+
+ return array('calendar' => $values, 'items' => $items,
'inventory' => $inventory, 'allocations' => $allocations);
}
function delete($resource_allocation_id)
@@ -255,9 +351,13 @@
$this->db->transaction_begin();
$resource_allocation_id = (int) $resource_allocation_id;
- $this->db->query("DELETE FROM
lg_requirement_resource_allocation WHERE id = $resource_allocation_id");
- $this->db->query("DELETE FROM lg_calendar WHERE
allocation_id = $resource_allocation_id");
+ $this->db->query("SELECT calendar_id FROM
lg_requirement_resource_allocation WHERE id =
{$resource_allocation_id}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $calendar_id = (int)$this->db->f('calendar_id');
+ $this->db->query("DELETE FROM
lg_requirement_resource_allocation WHERE id = {$resource_allocation_id}");
+ $this->db->query("DELETE FROM lg_calendar WHERE id =
{$calendar_id}");
+
return !!$this->db->transaction_commit();
}
Modified: branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -217,8 +217,7 @@
$num_required = $entry['no_of_items'];
- $filters = array('requirement_id' =>
$entry['id']);
- $num_allocated =
$this->so_resource_allocation->get_count($search_for, $search_type, $filters);
+ $num_allocated =
$this->so_resource_allocation->count_allocated($entry['id']);
$entry['allocated'] = $num_allocated;
$entry['select'] = "<input
class=\"select_line\" type =\"radio\" {$_checked} name=\"values[select_line]\"
value=\"{$entry['id']}\">";
Modified:
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -238,10 +238,41 @@
$requirement['fm_bim_item_name'] = $short_desc;
}
- $delete_href = self::link(
-
array('menuaction' =>
'logistic.uirequirement_resource_allocation.delete',
-
'id' =>
$requirement['id'],
-
'phpgw_return_as' => 'json')
+ if($requirement['inventory_id'])
+ {
+ $inventory =
execMethod('property.soentity.get_inventory',array('inventory_id' =>
$requirement['inventory_id']));
+
+ $system_location =
$GLOBALS['phpgw']->locations->get_name($inventory[0]['p_location_id']);
+
+ $name = 'N∕A';
+ if( preg_match('/.location./i',
$system_location['location']) )
+ {
+ $location_code =
execMethod('property.solocation.get_location_code', $inventory[0]['p_id']);
+ $location =
execMethod('property.solocation.read_single', $location_code);
+ $location_arr =
explode('-', $location_code);
+ $i=1;
+ $name_arr = array();
+ foreach($location_arr
as $_dummy)
+ {
+ $name_arr[] =
$location["loc{$i}_name"];
+ $i++;
+ }
+
+ $name = implode('::',
$name_arr);
+ }
+ else if(
preg_match('/.entity./i', $system_location['location']) )
+ {
+ $name =
execMethod('property.soentity.get_short_description',
+
array('location_id' => $inventory[0]['p_location_id'], 'id' =>
$inventory[0]['p_id']));
+ }
+
+ $requirement['location_code'] =
$location_code;
+
$requirement['fm_bim_item_address'] = $name;
+ }
+
+ $delete_href =
self::link(array('menuaction' =>
'logistic.uirequirement_resource_allocation.delete',
+
'id' =>
$requirement['id'],
+
'phpgw_return_as' =>
'json')
);
$requirement['delete_link'] = "<a
class=\"btn-sm delete\" href=\"{$delete_href}\">Slett</a>";
$rows[] = $requirement;
@@ -380,7 +411,7 @@
reset($allocation_suggestions);
- $allocated = $this->so->check_calendar($location_id,
$suggestion_ids, $requirement->get_start_date(), $requirement->get_end_date() );
+ $allocated = $this->so->check_calendar($requirement,
$suggestion_ids);
//_debug_array($allocated);die();
//end fuzzy
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
@@ -416,6 +447,32 @@
$allocation_suggestion['allocated_date'] = implode('; ', $allocated_date);
$allocation_suggestion['allocated_where'] = implode('; ', $allocated_where);
}
+ if(isset($allocation_suggestion['inventory']))
+ {
+ foreach
($allocation_suggestion['inventory'] as & $inventory)
+ {
+
+ //Allocated to another
requirement:
+
if(isset($allocated['allocations'][$inventory['inventory_id']]['requirement_id'])
&& $requirement->get_id() !=
$allocated['allocations'][$inventory['inventory_id']]['requirement_id'])
+ {
+ $inventory['disabled']
= true;
+ }
+
+ $inventory['allocated_amount']
= $allocated['inventory'][$inventory['inventory_id']];
+
+ $inventory['bookable_amount'] =
(int)$inventory['inventory'] -
(int)$allocated['allocations'][$inventory['inventory_id']]['total_allocated'];
+
+ $inventory['allocation_id'] =
$allocated['allocations'][$inventory['inventory_id']]['allocation_id'];
+
+
if($allocated['allocations'][$inventory['inventory_id']]['start_date'])
+ {
+
$inventory['allocated_date'] =
$GLOBALS['phpgw']->common->show_date($allocated['allocations'][$inventory['inventory_id']]['start_date']
,$dateformat)
+
. ' - ' .
$GLOBALS['phpgw']->common->show_date($allocated['allocations'][$inventory['inventory_id']]['end_date']
,$dateformat);
+ }
+
+
+ }
+ }
}
$activity = $this->so_activity->get_single(
$requirement->get_activity_id() );
@@ -446,7 +503,10 @@
$chosen_resources = phpgw::get_var('chosen_resources');
$inventory_ids = phpgw::get_var('inventory_ids');
+ $allocations = phpgw::get_var('allocations');
+ //FIXME: Bruk 'allocation_id' i staden.
+//_debug_array($inventory_ids_orig);die();
$filters = array('requirement_id' =>
$requirement->get_id());
$num_allocated = $this->so->get_count($search_for,
$search_type, $filters);
@@ -456,9 +516,9 @@
if($inventory_ids)
{
- foreach ($inventory_ids as $resource =>
$inventory)
+ foreach ($inventory_ids as $resource =>
$allocated_amount)
{
- if($inventory)
+ if($allocated_amount)
{
$resource_arr = explode('_',
$resource);
$resource_id = $resource_arr[0];
@@ -467,9 +527,9 @@
$resource_alloc = new
logistic_requirement_resource_allocation();
$resource_alloc->set_requirement_id( $requirement->get_id() );
$resource_alloc->set_resource_id( $resource_id );
- //FIXME:
-_debug_array($inventory_id);
$resource_alloc->set_inventory_id( $inventory_id );
+
$resource_alloc->set_allocated_amount( $allocated_amount );
+ $resource_alloc->set_id(
$allocations[$resource] );
$resource_alloc->set_location_id( $requirement->get_location_id() );
$resource_alloc->set_create_user( $user_id );
$resource_alloc->set_start_date( $requirement->get_start_date() );
Modified:
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -36,7 +36,8 @@
protected $id;
protected $requirement_id;
protected $resource_id;
- protected $inventory;
+ protected $inventory_id;
+ protected $inventory_amount;
protected $location_id;
protected $create_user;
@@ -46,7 +47,8 @@
protected $fm_bim_item_name;
protected $start_date;
protected $end_date;
-
+ protected $allocated_amount;
+ protected $allocated_amount_orig;
/**
* 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.
@@ -99,6 +101,16 @@
return $this->inventory_id;
}
+ public function set_inventory_amount($inventory_amount)
+ {
+ $this->inventory_amount = $inventory_amount;
+ }
+
+ public function get_inventory_amount()
+ {
+ return $this->inventory_amount;
+ }
+
public function set_location_id($location_id)
{
$this->location_id = $location_id;
@@ -180,6 +192,27 @@
return $this->start_date;
}
+ public function set_allocated_amount($allocated_amount)
+ {
+ $this->allocated_amount = $allocated_amount ?
$allocated_amount : 1;
+ }
+
+ public function get_allocated_amount()
+ {
+ return $this->allocated_amount;
+ }
+
+ public function set_allocated_amount_orig($allocated_amount)
+ {
+ $this->allocated_amount_orig = $allocated_amount ?
$allocated_amount : 1;
+ }
+
+ public function get_allocated_amount_orig()
+ {
+ return $this->allocated_amount_orig;
+ }
+
+
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -196,12 +229,16 @@
public function serialize()
{
- return array(
+ $values = array
+ (
'id' =>
$this->get_id(),
'resource_type_descr' =>
$this->get_resource_type_descr(),
'requirement_id' =>
$this->get_requirement_id(),
'resource_id' =>
$this->get_resource_id(),
'inventory_id' =>
$this->get_inventory_id(),
+ //FIXME
+ 'inventory_amount' =>
$this->get_inventory_amount(),
+ 'allocated_amount' =>
$this->get_allocated_amount(),
'location_id' =>
$this->get_location_id(),
'location_code' =>
$this->get_location_code(),
'fm_bim_item_address' =>
$this->get_fm_bim_item_address(),
@@ -209,5 +246,7 @@
'start_date' =>
$this->get_start_date(),
'end_date' =>
$this->get_end_date()
);
+
+ return $values;
}
}
Modified: branches/Version-1_0-branch/logistic/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/setup.inc.php 2013-04-28
11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/logistic/setup/setup.inc.php 2013-04-29
13:53:36 UTC (rev 11084)
@@ -1,6 +1,6 @@
<?php
$setup_info['logistic']['name'] = 'logistic';
- $setup_info['logistic']['version'] = '0.0.5';
+ $setup_info['logistic']['version'] = '0.0.6';
$setup_info['logistic']['app_order'] = 70;
$setup_info['logistic']['enable'] = 1;
$setup_info['logistic']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -76,7 +76,8 @@
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'item_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'item_inventory_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'item_inventory_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => true),
+ 'item_inventory_amount' =>
array('type' => 'int', 'precision' => 4, 'nullable' => true),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 8, 'nullable' => false),
'start_date' => array('type' =>
'int', 'precision' => 8, 'nullable' => false),
Modified: branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -173,15 +173,20 @@
{
$GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+// $GLOBALS['phpgw_setup']->oProc->DropColumn('lg_calendar',
array(), 'allocation_id');
- $GLOBALS['phpgw_setup']->oProc->DropColumn('lg_calendar',
array(), 'allocation_id');
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','item_inventory_id',array(
'type' => 'int',
'precision' => 4,
'nullable' => true
));
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_calendar','item_inventory_amount',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ ));
+
if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
{
$GLOBALS['setup_info']['logistic']['currentver'] =
'0.0.6';
Modified:
branches/Version-1_0-branch/logistic/templates/base/allocation/book_resources.xsl
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/allocation/book_resources.xsl
2013-04-28 11:06:50 UTC (rev 11083)
+++
branches/Version-1_0-branch/logistic/templates/base/allocation/book_resources.xsl
2013-04-29 13:53:36 UTC (rev 11084)
@@ -108,25 +108,45 @@
<xsl:when
test="inventory != ''">
<xsl:for-each select="inventory">
<div>
-
<span class="loc_code"></span>
+
<span class="loc_code"><xsl:value-of select="unit" /></span>
<span class="loc_code">
-
<input type="text" value="{allocated}"
name="inventory_ids[{//allocation_suggestions/id}_{inventory_id}]" size='4'>
+
<input type="text" value="{allocated_amount}"
name="inventory_ids[{//allocation_suggestions/id}_{inventory_id}]" size='4'>
+
<xsl:if test="disabled = '1'">
+
<xsl:attribute name="disabled">
+
<xsl:text>disabled</xsl:text>
+
</xsl:attribute>
+
</xsl:if>
</input>
+
<input type="hidden" value="{allocation_id}"
name="allocations[{//allocation_suggestions/id}_{inventory_id}]">
+
</input>
</span>
-
<span class="loc_code"><xsl:value-of disable-output-escaping="yes"
select="where" /></span>
-
<span class="loc_code"><xsl:value-of select="unit" /></span>
-
<span class="loc_code"><xsl:value-of select="inventory" /></span>
-
+
<span class="loc_code">
+
<xsl:value-of select="bookable_amount" />
+
<xsl:text> ( </xsl:text>
+
<xsl:value-of select="inventory" />
+
<xsl:text> )</xsl:text>
+
</span>
+
<span class="loc_code"><xsl:value-of disable-output-escaping="yes"
select="where_name" /></span>
+
+
<xsl:choose>
+
<xsl:when test="allocated_amount != ''">
+
<span class="loc_code">
+
<xsl:value-of select="allocated_amount" />
+
<xsl:text> ( </xsl:text>
+
<xsl:value-of select="allocated_date" />
+
<xsl:text> )</xsl:text>
+
</span>
+
</xsl:when>
+
</xsl:choose>
</div>
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
- <span
class="loc_id"><xsl:value-of select="location_id" /></span>
- <!-- <span
class="type"><xsl:value-of select="type_lokale" /></span> -->
- <span
class="loc_code"><xsl:value-of select="location_code" /></span>
- <span
class="loc_code"><xsl:value-of select="allocated_date" /></span>
- <span
class="loc_code"><xsl:value-of select="allocated_where" /></span>
-
+ <span
class="loc_id"><xsl:value-of select="location_id" /></span>
+ <!-- <span
class="type"><xsl:value-of select="type_lokale" /></span> -->
+ <span
class="loc_code"><xsl:value-of select="location_code" /></span>
+ <span
class="loc_code"><xsl:value-of select="allocated_date" /></span>
+ <span
class="loc_code"><xsl:value-of select="allocated_where" /></span>
</xsl:otherwise>
</xsl:choose>
Modified:
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
2013-04-28 11:06:50 UTC (rev 11083)
+++
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_overview.xsl
2013-04-29 13:53:36 UTC (rev 11084)
@@ -114,6 +114,7 @@
{key:"id", label:'Id', sortable:true},
{key:"fm_bim_item_name", label:'Navn på
ressurs', sortable:true},
{key:"resource_type_descr",
label:'Ressurstype', sortable:true},
+ {key:"allocated_amount", label:'Antall',
sortable:false},
{key:"location_code", label:'Lokasjonskode',
sortable:true},
{key:"fm_bim_item_address", label:'Adresse',
sortable:true},
{key:"delete_link", label:'Slett bestilling',
sortable:true}
Modified:
branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -185,6 +185,11 @@
public function read($data = array())
{
$values = $this->so->read($data);
+ foreach($values as & $entry)
+ {
+ $entry['year'] = date('Y',
$entry['entry_date']);
+ }
+
$this->total_records = $this->so->total_records;
return $values;
}
Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -680,9 +680,13 @@
return $this->so->read_entity_to_link($data);
}
- public function get_inventory($location_id, $id, $inventory_id
= 0)
+ /**
+ * array('id' => $id, 'location_id' => $location_id,
'inventory_id' => $inventory_id)
+ */
+
+ public function get_inventory($data)
{
- $values = $this->so->get_inventory( array('id' => $id,
'location_id' => $location_id, 'inventory_id' => $inventory_id) );
+ $values = $this->so->get_inventory( $data );
$interlink = CreateObject('property.interlink');
@@ -690,8 +694,9 @@
{
$link_info =
$interlink->get_location_link($entry['p_location_id'], $entry['p_id'],'view');
$entry['where'] = "<a
href='{$link_info['link']}'>{$link_info['name']}</a>";
- $entry['location_id'] = $location_id;
- $entry['id'] = $id;
+ $entry['where_name'] = $link_info['name'];
+ $entry['location_id'] = $data['location_id'];
+ $entry['id'] = $data['id'];
}
return $values;
Modified: branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.boinvoice.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -235,9 +235,9 @@
return $this->so->update_invoice_sub($values);
}
- function update_single_line($values)
+ function update_single_line($values, $paid = false)
{
- return $this->so->update_single_line($values);
+ return $this->so->update_single_line($values, $paid);
}
function select_account_class($selected='')
@@ -770,9 +770,9 @@
return $values;
}
- public function get_single_line($id)
+ public function get_single_line($id, $paid = false)
{
- $line = $this->so->get_single_line($id);
+ $line = $this->so->get_single_line($id, $paid);
$soXport = CreateObject('property.soXport');
$soworkorder = CreateObject('property.soworkorder');
Modified: branches/Version-1_0-branch/property/inc/class.interlink.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.interlink.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.interlink.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -204,8 +204,19 @@
$name = 'N∕A';
if( preg_match('/.location./i',
$system_location['location']) )
{
- $id =
execMethod('property.solocation.get_location_code',$id);
- $name = $id;
+ $location_code =
execMethod('property.solocation.get_location_code',$id);
+
+ $location =
execMethod('property.solocation.read_single', $location_code);
+ $location_arr = explode('-', $location_code);
+ $i=1;
+ $name_arr = array();
+ foreach($location_arr as $_dummy)
+ {
+ $name_arr[] = $location["loc{$i}_name"];
+ $i++;
+ }
+
+ $name = implode('::', $name_arr);
}
else if( preg_match('/.entity./i',
$system_location['location']) )
{
Modified:
branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.socondition_survey.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -56,6 +56,15 @@
$table = 'fm_condition_survey';
if ($sort)
{
+ switch($sort)
+ {
+ case 'year':
+ $sort = 'entry_date';
+ break;
+ default:
+ //
+ }
+
$metadata = $this->_db->metadata($table);
if(isset($metadata[$sort]))
{
Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -2378,11 +2378,8 @@
$id = (int)$data['id'];
$inventory_id = isset($data['inventory_id']) &&
$data['inventory_id'] ? (int)$data['inventory_id'] : 0;
- if(!$location_id || ! $id)
- {
- return array();
- }
-
+ $filtermethod = '';
+
if($inventory_id)
{
$filtermethod = "WHERE fm_bim_item_inventory.id
= {$inventory_id}";
@@ -2392,6 +2389,11 @@
$filtermethod = "WHERE location_id =
{$location_id} AND fm_bim_item_inventory.item_id = {$id} AND expired_on IS
NULL";
}
+ if(!$filtermethod)
+ {
+ return array();
+ }
+
$sql = "SELECT fm_bim_item_inventory.*,
fm_standard_unit.name AS unit FROM fm_bim_item_inventory"
. " {$this->join} fm_standard_unit ON
fm_bim_item_inventory.unit_id = fm_standard_unit.id"
. " {$filtermethod}"
Modified: branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.soinvoice.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -935,13 +935,33 @@
return $receipt;
}
- function update_single_line($values)
+ function update_single_line($values, $paid = false)
{
- $table ='fm_ecobilag';
+ $this->db->transaction_begin();
+
$id = (int)$values['id'];
- $this->db->transaction_begin();
+ $table ='fm_ecobilag';
+ if($paid) // only minor corrections are allowed
+ {
+ $table = 'fm_ecobilagoverf';
+
+ $value_set = array
+ (
+ // 'project_id' =>
$values['project_group'] ? $values['project_group'] : '',
+ 'pmwrkord_code' => $values['order_id'],
+ // 'process_log' =>
$this->db->db_addslashes($values['process_log']),
+ // 'process_code' =>
$values['process_code'],
+ );
+
+ $value_set =
$this->db->validate_update($value_set);
+
+ $this->db->query("UPDATE {$table} SET
$value_set WHERE id= {$id}" ,__LINE__,__FILE__);
+
+ return $this->db->transaction_commit();
+ }
+
if( $values['approve'] != $values['sign_orig'] )
{
switch ( $values['sign_orig'] )
@@ -973,12 +993,6 @@
break;
}
- // $sql ="SELECT bilagsnr FROM {$table} WHERE id=
{$id}";
- // $this->db->query($sql,__LINE__,__FILE__);
- // $this->db->next_record();
- // $bilagsnr = (int)$this->db->f('bilagsnr');
- // $value_set =
$this->db->validate_update($value_set);
- // $this->db->query("UPDATE {$table} SET
$value_set WHERE bilagsnr= {$bilagsnr}" ,__LINE__,__FILE__);
if(isset($value_set['budsjettansvarligid']) &&
!$value_set['budsjettansvarligid'])
{
@@ -1054,7 +1068,7 @@
$this->db->query("UPDATE {$table} SET
$value_set WHERE id= {$new_id}" ,__LINE__,__FILE__);
}
- $this->db->transaction_commit();
+ return $this->db->transaction_commit();
}
function read_remark($id='',$paid='')
@@ -1412,9 +1426,13 @@
$this->db->query("DELETE FROM fm_ecobilag WHERE
bilagsnr ='" . $bilagsnr ."'",__LINE__,__FILE__);
}
- function read_single_voucher($bilagsnr = 0, $id = 0)
+ function read_single_voucher($bilagsnr = 0, $id = 0, $paid =
false)
{
$table = 'fm_ecobilag';
+ if($paid)
+ {
+ $table = 'fm_ecobilagoverf';
+ }
$bilagsnr =(int)$bilagsnr;
$id = (int)$id;
@@ -1803,9 +1821,9 @@
}
- public function get_single_line($id)
+ public function get_single_line($id,$paid = false)
{
- $line = $this->read_single_voucher(0, $id);
+ $line = $this->read_single_voucher(0, $id, $paid);
return $line[0];
}
Modified:
branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -184,10 +184,15 @@
),
array(
'key' => 'address',
- 'label' =>
lang('address'),
+ 'label' =>
lang('buildingname'),
'sortable' => true
),
array(
+ 'key' => 'year',
+ 'label' => lang('year'),
+ 'sortable' => true,
+ ),
+ array(
'key' => 'cnt',
'label' =>
lang('count'),
'sortable' => false,
Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -2885,7 +2885,7 @@
$location_id =
$GLOBALS['phpgw']->locations->get_id($this->type_app[$this->type],
".{$this->type}.{$this->entity_id}.{$this->cat_id}");
}
- $inventory = $this->bo->get_inventory($location_id,
$id);
+ $inventory = $this->bo->get_inventory(array('id' =>
$id, 'location_id' => $location_id));
if( phpgw::get_var('phpgw_return_as') == 'json' )
{
@@ -2919,7 +2919,7 @@
$GLOBALS['phpgw']->common->phpgw_exit();
}
$unit_id = '';
- if( $inventory = $this->bo->get_inventory($location_id,
$id, $inventory_id) )
+ if( $inventory = $this->bo->get_inventory(array('id' =>
$id, 'location_id' => $location_id, 'inventory_id' => $inventory_id)) )
{
$unit_id = $inventory[0]['unit_id'];
}
@@ -3041,7 +3041,7 @@
}
$unit_id = '';
- if( $inventory = $this->bo->get_inventory($location_id,
$id) )
+ if( $inventory = $this->bo->get_inventory(array('id' =>
$id, 'location_id' => $location_id)) )
{
$unit_id = $inventory[0]['unit_id'];
}
Modified: branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/inc/class.uiinvoice.inc.php
2013-04-29 13:53:36 UTC (rev 11084)
@@ -2210,7 +2210,8 @@
'menuaction'
=> 'property.uiinvoice.edit',
'voucher_id'
=> $voucher_id,
'user_lid'
=> $this->user_lid,
- 'target'
=> '_lightbox'
+ 'target'
=> '_tinybox',
+ 'paid'
=> $paid
)),
'parameters' => $parameters
);
@@ -2260,6 +2261,12 @@
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+
+ $GLOBALS['phpgw']->js->validate_file( 'tinybox2',
'packed', 'phpgwapi' );
+
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/tinybox2/style.css');
+
+
+
//Title of Page
$appname = lang('location');
if ($paid)
@@ -2285,6 +2292,7 @@
{
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $paid = phpgw::get_var('paid', 'bool');
$id = phpgw::get_var('id', 'int',
'GET' , 0);
$user_lid = phpgw::get_var('user_lid', 'string',
'GET');
$voucher_id = phpgw::get_var('voucher_id', 'int',
'GET');
@@ -2349,11 +2357,11 @@
{
$redirect = true;
$values['id'] = $id;
- $line =
$this->bo->update_single_line($values);
+ $line =
$this->bo->update_single_line($values,$paid);
}
}
- $line = $this->bo->get_single_line($id);
+ $line = $this->bo->get_single_line($id, $paid);
// _debug_array($line);
@@ -2437,7 +2445,7 @@
$data = array
(
- 'redirect'
=> $redirect ? $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiinvoice.list_sub', 'user_lid' => $user_lid, 'voucher_id' =>
$voucher_id)) : null,
+ 'redirect'
=> $redirect ? $GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiinvoice.list_sub', 'user_lid' => $user_lid, 'voucher_id' =>
$voucher_id, 'paid' => $paid)) : null,
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($GLOBALS['phpgw']->common->msgbox_data($receipt)),
'from_name'
=> $GLOBALS['phpgw_info']['user']['fullname'],
'form_action' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uiinvoice.edit', 'id' => $id, 'user_lid' => $user_lid, 'voucher_id'
=> $voucher_id)),
@@ -2451,7 +2459,8 @@
'value_amount' =>
$line['amount'],
'value_approved_amount' =>
$line['approved_amount'],
'value_currency' =>
$line['currency'],
- 'value_process_log' =>
isset($values['process_log']) && $values['process_log'] ?
$values['process_log'] : $line['process_log']
+ 'value_process_log' =>
isset($values['process_log']) && $values['process_log'] ?
$values['process_log'] : $line['process_log'],
+ 'paid'
=> $paid
);
$GLOBALS['phpgw']->xslttpl->add_file('invoice');
Modified: branches/Version-1_0-branch/property/js/yahoo/property.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/property.js 2013-04-28
11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/js/yahoo/property.js 2013-04-29
13:53:36 UTC (rev 11084)
@@ -1483,7 +1483,7 @@
iframe:sUrl,
boxid:'frameless',
width:750,
- height:450,
+ height:500,
fixed:false,
maskid:'darkmask',
maskopacity:40,
Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-04-28
11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-04-29
13:53:36 UTC (rev 11084)
@@ -255,6 +255,7 @@
building common property no Bygnings felles
building has been edited property no Bygning er endret
building has been saved property no Bygning er lagret
+buildingname property no BygningsNavn
building id property no bygnings ID
building part property no Bygningsdel
building_part property no Bygningsdel
@@ -338,7 +339,8 @@
click this link to view the remark property no klikk her for å
vise merknad
click this to add an order to an existing project property no
klikk her for å legge til en ny bestilling til et eksisterende prosjekt
click this to generate a request with this information property no
klikk her for å generere et behov med basis i denne informasjonen
-click this to generate a project with this information property no
klikk her for å lage ett nytt prosjekt med informasjon fra denne saken
+click this to generate a project with this information property no
klikk her for å lage et nytt prosjekt med informasjon fra denne saken
+click this to link this request to an existing project property no
klikk her for å lenke dette behovet til et eksisterende prosjekt
click to view file property no Klikk for vise fil
close property no Avslutt
closed property no Avsluttet
Modified: branches/Version-1_0-branch/property/templates/base/invoice.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/invoice.xsl
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/templates/base/invoice.xsl
2013-04-29 13:53:36 UTC (rev 11084)
@@ -1376,6 +1376,7 @@
</xsl:when>
</xsl:choose>
<form name="form" method="post" action="{form_action}">
+ <input type="hidden" name="paid" value="{paid}"/>
<table cellpadding="0" cellspacing="0" width="100%">
<xsl:choose>
<xsl:when test="msgbox_data != ''">
@@ -1386,6 +1387,21 @@
</tr>
</xsl:when>
</xsl:choose>
+ <tr>
+ <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
+ <xsl:value-of
select="php:function('lang', 'order id')"/>
+ </td>
+ <td align="left" class="th_text"
valign="top">
+ <input type="text"
name="values[order_id]" value="{order_id}">
+ <xsl:attribute
name="size">
+
<xsl:text>20</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute
name="title">
+ <xsl:value-of
select="php:function('lang', 'order id')"/>
+ </xsl:attribute>
+ </input>
+ </td>
+ </tr>
<xsl:for-each select="approved_list">
<tr>
@@ -1401,121 +1417,111 @@
</td>
</tr>
</xsl:for-each>
- <tr>
- <input type="hidden"
name="values[sign_orig]" value="{sign_orig}"/>
- <input type="hidden"
name="values[my_initials]" value="{my_initials}"/>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'approve')"/>
- </td>
- <td class="th_text" valign="top"
align="left">
- <select name="values[approve]">
- <xsl:attribute
name="title">
- <xsl:value-of
select="php:function('lang', 'grant')"/>
- </xsl:attribute>
- <option value="">
- <xsl:value-of
select="php:function('lang', 'select')"/>
- </option>
- <xsl:apply-templates
select="approve_list"/>
- </select>
- </td>
- </tr>
+ <xsl:choose>
+ <xsl:when test="paid = ''">
+ <tr>
+ <input type="hidden"
name="values[sign_orig]" value="{sign_orig}"/>
+ <input type="hidden"
name="values[my_initials]" value="{my_initials}"/>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
+ <xsl:value-of
select="php:function('lang', 'approve')"/>
+ </td>
+ <td class="th_text"
valign="top" align="left">
+ <select
name="values[approve]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'grant')"/>
+
</xsl:attribute>
+ <option
value="">
+
<xsl:value-of select="php:function('lang', 'select')"/>
+
</option>
+
<xsl:apply-templates select="approve_list"/>
+ </select>
+ </td>
+ </tr>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'voucher process code')"/>
- </td>
- <td align="left" class="th_text"
valign="top">
- <select
name="values[process_code]">
- <xsl:attribute
name="title">
+ <tr>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
<xsl:value-of
select="php:function('lang', 'voucher process code')"/>
- </xsl:attribute>
- <option value="">
- <xsl:value-of
select="php:function('lang', 'voucher process code')"/>
- </option>
- <xsl:apply-templates
select="process_code_list"/>
- </select>
- </td>
- </tr>
- <xsl:call-template name="project_group_form"/>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'order id')"/>
- </td>
- <td align="left" class="th_text"
valign="top">
- <input type="text"
name="values[order_id]" value="{order_id}">
- <xsl:attribute
name="size">
-
<xsl:text>20</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="title">
- <xsl:value-of
select="php:function('lang', 'order id')"/>
- </xsl:attribute>
- </input>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'voucher process log')"/>
- </td>
- <td align="left">
- <textarea cols="60" rows="10"
name="values[process_log]" wrap="virtual">
- <xsl:attribute
name="title">
+ </td>
+ <td align="left"
class="th_text" valign="top">
+ <select
name="values[process_code]">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'voucher process code')"/>
+
</xsl:attribute>
+ <option
value="">
+
<xsl:value-of select="php:function('lang', 'voucher process code')"/>
+
</option>
+
<xsl:apply-templates select="process_code_list"/>
+ </select>
+ </td>
+ </tr>
+ <xsl:call-template
name="project_group_form"/>
+ <tr>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
<xsl:value-of
select="php:function('lang', 'voucher process log')"/>
- </xsl:attribute>
- <xsl:value-of
select="value_process_log"/>
- </textarea>
- </td>
- </tr>
+ </td>
+ <td align="left">
+ <textarea
cols="60" rows="10" name="values[process_log]" wrap="virtual">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'voucher process log')"/>
+
</xsl:attribute>
+
<xsl:value-of select="value_process_log"/>
+ </textarea>
+ </td>
+ </tr>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'approved amount')"/>
- </td>
- <td align="left" class="th_text"
valign="top">
- <input type="text"
name="values[approved_amount]" value="{value_approved_amount}">
- <xsl:attribute
name="size">
-
<xsl:text>20</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="title">
+ <tr>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
<xsl:value-of
select="php:function('lang', 'approved amount')"/>
- </xsl:attribute>
- </input>
- </td>
- </tr>
+ </td>
+ <td align="left"
class="th_text" valign="top">
+ <input
type="text" name="values[approved_amount]" value="{value_approved_amount}">
+
<xsl:attribute name="size">
+
<xsl:text>20</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'approved amount')"/>
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'split line')"/>
- </td>
- <td align="left" valign="top">
- <input type="checkbox"
name="values[split_line]" value="1">
- <xsl:attribute
name="title">
+ <tr>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
<xsl:value-of
select="php:function('lang', 'split line')"/>
- </xsl:attribute>
- </input>
- <xsl:text> [ </xsl:text>
- <xsl:value-of
select="value_amount"/>
- <xsl:text> </xsl:text>
- <xsl:value-of
select="value_currency"/>
- <xsl:text> ]</xsl:text>
- </td>
- </tr>
- <tr>
- <td class="th_text" align="left"
valign="top" style="white-space: nowrap;">
- <xsl:value-of
select="php:function('lang', 'amount')"/>
- </td>
- <td align="left" class="th_text"
valign="top">
- <input type="text"
name="values[split_amount]">
- <xsl:attribute
name="size">
-
<xsl:text>20</xsl:text>
- </xsl:attribute>
- <xsl:attribute
name="title">
+ </td>
+ <td align="left"
valign="top">
+ <input
type="checkbox" name="values[split_line]" value="1">
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'split line')"/>
+
</xsl:attribute>
+ </input>
+ <xsl:text> [
</xsl:text>
+ <xsl:value-of
select="value_amount"/>
+ <xsl:text>
</xsl:text>
+ <xsl:value-of
select="value_currency"/>
+ <xsl:text>
]</xsl:text>
+ </td>
+ </tr>
+ <tr>
+ <td class="th_text"
align="left" valign="top" style="white-space: nowrap;">
<xsl:value-of
select="php:function('lang', 'amount')"/>
- </xsl:attribute>
- </input>
- </td>
- </tr>
+ </td>
+ <td align="left"
class="th_text" valign="top">
+ <input
type="text" name="values[split_amount]">
+
<xsl:attribute name="size">
+
<xsl:text>20</xsl:text>
+
</xsl:attribute>
+
<xsl:attribute name="title">
+
<xsl:value-of select="php:function('lang', 'amount')"/>
+
</xsl:attribute>
+ </input>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+
<tr height="50">
<td>
<xsl:variable name="lang_send">
Modified: branches/Version-1_0-branch/property/templates/base/request.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/request.xsl
2013-04-28 11:06:50 UTC (rev 11083)
+++ branches/Version-1_0-branch/property/templates/base/request.xsl
2013-04-29 13:53:36 UTC (rev 11084)
@@ -162,7 +162,7 @@
<input
type="hidden" name="query" value="{loc1}"/>
<input
type="submit" name="location" value="{php:function('lang', 'add to project as
relation')}">
<xsl:attribute name="title">
-
<xsl:value-of select="php:function('lang', 'click this to add an order to an
existing project')"/>
+
<xsl:value-of select="php:function('lang', 'click this to link this request to
an existing project')"/>
</xsl:attribute>
</input>
</form>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11084] Merge 11078:11083 from trunk,
Sigurd Nes <=