[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10655] Merge 10639:10654 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10655] Merge 10639:10654 from trunk |
Date: |
Wed, 09 Jan 2013 12:14:52 +0000 |
Revision: 10655
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10655
Author: sigurdne
Date: 2013-01-09 12:14:51 +0000 (Wed, 09 Jan 2013)
Log Message:
-----------
Merge 10639:10654 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
branches/Version-1_0-branch/property/inc/class.borequest.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
branches/Version-1_0-branch/property/js/yahoo/project.edit.js
branches/Version-1_0-branch/property/setup/phpgw_no.lang
branches/Version-1_0-branch/property/setup/tables_update.inc.php
branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
branches/Version-1_0-branch/property/templates/base/project.xsl
branches/Version-1_0-branch/property/templates/base/request.xsl
Added Paths:
-----------
branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS_2
Property Changed:
----------------
branches/Version-1_0-branch/
branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
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
+
/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
Modified:
branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
===================================================================
--- branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
2013-01-09 12:14:51 UTC (rev 10655)
@@ -1,147 +1,150 @@
+// The row that is moved
var placeholder;
+// The row that act as an illusion of where to place the moved row
var drag_elem;
var next_elem;
var prev_elem;
-var adj_y;
+var list_container_pos_y;
$(document).ready(function(){
- // On drag item row
- $(".drag_item a").mousedown(function(e){
- // Setting placeholder to the clicked row
- placeholder = $(this).closest('li');
- init_drag( placeholder, e );
- start_drag("item");
+ // On drag item row
+ $(".drag_item a").mousedown(function(e){
+ // Setting placeholder to the clicked row
+ placeholder = $(this).closest('li');
- return false;
- });
-
- // On drag group
- $(".drag_group h3 a").mousedown(function(e){
- // Setting placeholder to the clicked row
- placeholder = $(this).closest('li');
- init_drag( placeholder, e );
- start_drag("group");
+ init_drag( placeholder, e );
+ start_drag("item");
- return false;
- });
+ return false;
+ });
+
+
+ // On drag group
+ $(".drag_group h3 a").mousedown(function(e){
+ // Setting placeholder to the clicked row
+ placeholder = $(this).closest('li');
+ init_drag( placeholder, e );
+ start_drag("group");
+
+ return false;
+ });
- // Saves group and item order
- $("#saveOrder").click(function(e){
- e.preventDefault();
+ // Saves group and item order
+ $("#saveOrder").click(function(e){
+ e.preventDefault();
- var thisForm = $(this).closest("form");
- var submitBtn = $(this);
- var control_id = $("#control_id").val();
+ var thisForm = $(this).closest("form");
+ var submitBtn = $(this);
+ var control_id = $("#control_id").val();
- var group_order_arr = new Array();
- var item_order_arr = new Array();
- $('ul.groups li.drag_group').each(function(){
+ var group_order_arr = new Array();
+ var item_order_arr = new Array();
+ $('ul.groups li.drag_group').each(function(){
- var group_order_nr =
$(this).find("span.group_order_nr").text();
- var group_id =
$(this).find("input[name=group_id]").val();
+ var group_order_nr = $(this).find("span.group_order_nr").text();
+ var group_id = $(this).find("input[name=group_id]").val();
- group_order_arr.push( group_id + ":" + group_order_nr );
+ group_order_arr.push( group_id + ":" + group_order_nr );
- $(this).find("ul.items li").each(function(){
- var item_order_nr =
$(this).find("span.item_order_nr").text();
- var item_id =
$(this).find("input[name=item_id]").val();
+ $(this).find("ul.items li").each(function(){
+ var item_order_nr = $(this).find("span.item_order_nr").text();
+ var item_id = $(this).find("input[name=item_id]").val();
- item_order_arr.push( item_id + ":" +
item_order_nr );
- });
- });
+ item_order_arr.push( item_id + ":" + item_order_nr );
+ });
+ });
- var requestUrl =
"index.php?menuaction=controller.uicontrol_group.save_group_and_item_order";
+ // Request url for saving groups and items within group
+ var oArgs =
{menuaction:'controller.uicontrol_group.save_group_and_item_order'};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
- $(submitBtn).find(".text").text("Lagrer");
+ $(submitBtn).find(".text").text("Lagrer");
+ $(submitBtn).find(".text").append("<img id='loading'
src='controller/images/loading.gif' />");
- $(submitBtn).find(".text").append("<img id='loading'
src='controller/images/loading.gif' />");
-
- // Saves order for groups and items to db
- $.ajax({
- type: 'POST',
- url: requestUrl + "&control_id=" + control_id +
"&group_order=" + group_order_arr.toString() + "&item_order=" +
item_order_arr.toString(),
- success: function() {
-
- $(submitBtn).find("img").remove();
- $(submitBtn).find(".text").text("Lagre
rekkefølge");
-
-
-
- }
- });
- });
+ // Saves order for groups and items to db
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&control_id=" + control_id + "&group_order=" +
group_order_arr.toString() + "&item_order=" + item_order_arr.toString(),
+ success: function() {
+ $(submitBtn).find("img").remove();
+ $(submitBtn).find(".text").text("Lagre rekkefølge");
+ }
+ });
+ });
});
// Initialises drag. Sets placeholder, next, previous and cloned drag row.
function init_drag(placeholder, e){
- adj_y = e.pageY - $(placeholder).position().top;
+ list_container_pos_y = e.pageY - $(placeholder).position().top;
- next_elem = $(placeholder).next();
- prev_elem = $(placeholder).prev();
- drag_elem = $(placeholder).clone();
+ next_elem = $(placeholder).next();
+ prev_elem = $(placeholder).prev();
+ drag_elem = $(placeholder).clone();
- $(drag_elem).addClass("drag_elem");
- $(drag_elem).removeClass("list_item");
+ $(drag_elem).addClass("drag_elem");
+ $(drag_elem).removeClass("list_item");
- $(drag_elem).insertAfter(placeholder);
+ $(drag_elem).insertAfter(placeholder);
- $(drag_elem).css("left", $(placeholder).position().left + "px");
- $(drag_elem).css("top", $(placeholder).position().top + "px");
+ $(drag_elem).css("left", $(placeholder).position().left + "px");
+ $(drag_elem).css("top", $(placeholder).position().top + "px");
}
function start_drag(drag_type){
- $(document).bind("mouseup", stop_drag);
+ $(document).bind("mouseup", stop_drag);
- $(document).bind("mousemove", function(e){
- var x = 0;
- var y = e.pageY - adj_y;
+ $(document).bind("mousemove", function(e){
+ var drag_elem_rel_pos_y = e.pageY - list_container_pos_y;
- $(drag_elem).css("left", x + "px");
- $(drag_elem).css("top", y + "px");
-
- // Move drag element over next element
- if( $(next_elem).length > 0 && e.pageY >
$(next_elem).offset().top ){
- $(placeholder).insertAfter(next_elem);
- next_elem = $(placeholder).next();
- prev_elem = $(placeholder).prev();
-
- // Updating order number for drag element and previous
element
- update_order_nr($(placeholder).find("span." + drag_type
+ "_order_nr"), "+");
- update_order_nr($(prev_elem).find("span." + drag_type +
"_order_nr"), "-");
- }
- // Move drag element over previous element
- else if( $(prev_elem).length > 0 && e.pageY <
$(prev_elem).offset().top + $(prev_elem).height()/2 ){
- $(placeholder).insertBefore(prev_elem);
- prev_elem = $(placeholder).prev();
- next_elem = $(placeholder).next();
+ $(drag_elem).css("left", "0px");
+ $(drag_elem).css("top", drag_elem_rel_pos_y + "px");
+
+ var agg_drag_elem_half_height_down = drag_elem_rel_pos_y +
parseInt($(drag_elem).css("height"))/2;
+ var agg_drag_elem_half_height_up = drag_elem_rel_pos_y -
parseInt($(drag_elem).css("height"))/2;
+
+ // Move drag element over next element
+ if( $(next_elem).length > 0 && !$(next_elem).hasClass('drag_elem') &&
(agg_drag_elem_half_height_down > $(next_elem).position().top) ){
+ $(placeholder).insertAfter(next_elem);
+ next_elem = $(placeholder).next();
+ prev_elem = $(placeholder).prev();
- // Updating order number for drag element and next
element
- update_order_nr($(placeholder).find("span." + drag_type
+ "_order_nr"), "-");
- update_order_nr($(next_elem).find("span." + drag_type +
"_order_nr"), "+");
- }
-
- return false;
- });
+ // Updating order number for drag element and previous element
+ update_order_nr($(placeholder).find("span." + drag_type + "_order_nr"),
"+");
+ update_order_nr($(prev_elem).find("span." + drag_type + "_order_nr"),
"-");
+ }
+ // Move drag element over previous element
+ else if( $(prev_elem).length > 0 && !$(prev_elem).hasClass('drag_elem') &&
( agg_drag_elem_half_height_up < $(prev_elem).position().top) ){
+ $(placeholder).insertBefore(prev_elem);
+ prev_elem = $(placeholder).prev();
+ next_elem = $(placeholder).next();
+
+ // Updating order number for drag element and next element
+ update_order_nr($(placeholder).find("span." + drag_type + "_order_nr"),
"-");
+ update_order_nr($(next_elem).find("span." + drag_type + "_order_nr"),
"+");
+ }
+
+ return false;
+ });
}
// Release binding for mouse events
function stop_drag(){
- $(drag_elem).remove();
+ $(drag_elem).remove();
- $(document).unbind("mousemove");
- $(document).unbind("mouseup");
+ $(document).unbind("mousemove");
+ $(document).unbind("mouseup");
}
// Updates order number for hidden field and number in front of row
function update_order_nr(element, sign){
- var order_nr = $(element).text();
+ var order_nr = $(element).text();
- if(sign == "+")
- var updated_order_nr = parseInt(order_nr) + 1;
- else
- var updated_order_nr = parseInt(order_nr) - 1;
+ if(sign == "+")
+ var updated_order_nr = parseInt(order_nr) + 1;
+ else
+ var updated_order_nr = parseInt(order_nr) - 1;
- // Updating order number in front of row
- $(element).text(updated_order_nr);
+ // Updating order number in front of row
+ $(element).text(updated_order_nr);
}
\ No newline at end of file
Property changes on:
branches/Version-1_0-branch/controller/js/controller/custom_drag_drop.js
___________________________________________________________________
Added: portico
+ svn://svn.savannah.nongnu.org/fmsystem/trunk
Added: pe_html
+ http://svn.savannah.nongnu.org/svn/fmsystem/trunk
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-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.bocondition_survey.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -307,12 +307,13 @@
public function get_summation($id)
{
$data = $this->so->get_summation($id);
-
+//$total = 0;
+//_debug_array($data);
$values =array();
$i=0;
foreach ($data as $entry)
{
- $i = $entry['building_part'];
+ $i = $entry['building_part'] . '_' .
$entry['cat_id'];
$values[$i]['building_part'] =
$entry['building_part'];
$values[$i]['category'] =
$this->get_category_name($entry['cat_id']);
@@ -330,21 +331,26 @@
for ($j = 1; $j < 7 ; $j++ )
{
+ $values[$i]["period_{$j}"] += 0;
+ $values[$i]['sum'] += 0;
if($j == $period)
{
$values[$i]["period_{$j}"] +=
$entry['amount'];
$values[$i]['sum'] +=
$entry['amount'];
}
- else
- {
- $values[$i]["period_{$j}"] +=
0;
- }
}
+ }
+ unset($entry);
- $i++;
+ $ret =array();
+ foreach ($values as $entry)
+ {
+ $ret[] = $entry;
}
-//_debug_array($values);
- return $values;
+
+//_debug_array($total);
+//_debug_array($ret);
+ return $ret;
}
function get_category_name($cat_id)
Modified: branches/Version-1_0-branch/property/inc/class.borequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.borequest.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.borequest.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -413,6 +413,38 @@
return $this->so->update_priority_key($values);
}
+ public function read_survey_data($data)
+ {
+
+ $interlink = CreateObject('property.interlink');
+
+
+ $values = $this->so->read_survey_data($data);
+
+ foreach($values as &$entry)
+ {
+ $target = $interlink->get_relation('property',
$this->acl_location, $entry['id'], 'target');
+ $related = array();
+ if($target)
+ {
+ foreach($target as $_target_section)
+ {
+ foreach
($_target_section['data'] as $_target_entry)
+ {
+ $related[] = "<a
href=\"{$_target_entry['link']}\"
title=\"{$_target_entry['title']}\">{$_target_section['descr']}::{$_target_entry['id']}::{$_target_entry['statustext']}</a>";
+ }
+ }
+ $entry['related'] = implode('
/</br>',$related);
+ }
+
+ $category =
$this->cats->return_single($entry['cat_id']);
+ $entry['category'] = $category[0]['name'];
+ }
+
+ $this->total_records = $this->so->total_records;
+ return $values;
+ }
+
function read($data)
{
$custom = createObject('phpgwapi.custom_fields');
@@ -460,6 +492,7 @@
$request[$i]['coordinator'] =
$GLOBALS['phpgw']->accounts->id2name($request[$i]['coordinator']);
$request[$i]['start_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['start_date'],$dateformat);
$request[$i]['entry_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['entry_date'],$dateformat);
+ $request[$i]['planned_year'] =
$request[$i]['planned_year'] ? date('Y',$request[$i]['planned_year']) : '';
$request[$i]['closed_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['closed_date'],$dateformat);
$request[$i]['in_progress_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['in_progress_date'],$dateformat);
$request[$i]['delivered_date'] =
$GLOBALS['phpgw']->common->show_date($request[$i]['delivered_date'],$dateformat);
Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -869,7 +869,7 @@
. " WHERE
project_id={$project_id}",__LINE__,__FILE__);
$_orders = array();
-
+
while ($this->db->next_record())
{
$values[] = array(
@@ -910,7 +910,7 @@
foreach ($values as &$entry)
{
$_combined_cost =
round($entry['combined_cost']);
-
+
$_actual_cost =
isset($_actual_cost_arr[$entry['workorder_id']]) &&
$_actual_cost_arr[$entry['workorder_id']] ?
$_actual_cost_arr[$entry['workorder_id']] : 0;
// FIXME
@@ -941,7 +941,7 @@
}
$_diff_start = abs($entry['budget']) > 0 ?
$entry['budget'] : $_combined_cost;
- $entry['diff'] = $_diff_start -
$entry['obligation'] - $entry['actual_cost'];
+ $entry['diff'] = $_diff_start -
$entry['obligation'] - $entry['actual_cost'];
// $entry['diff'] = $entry['budget'] -
$entry['obligation'] - $entry['actual_cost'];
}
@@ -1077,7 +1077,7 @@
if($project['budget'])
{
- $this->update_budget($id,
$project['budget_year'], $project['budget_periodization'], $project['budget']);
+ $this->update_budget($id,
$project['budget_year'], $project['budget_periodization'],
$project['budget'],$project['budget_periodization_all']);
}
if($project['extra']['contact_phone'] &&
$project['extra']['tenant_id'])
@@ -1311,15 +1311,55 @@
$this->_update_buffer_budget($project['id'], $project['budget_year'],
$project['budget'], null,null);
}
+ if(isset($project['transfer_amount']) &&
$project['transfer_amount'] && isset($project['transfer_target']) &&
$project['transfer_target'])
+ {
+
$this->_update_buffer_budget($project['id'], date('Y'),
$project['transfer_amount'],
null,$project['transfer_target'],$project['transfer_remark']);
+
+ if(isset($project['transfer_remark'])
&& $project['transfer_remark'])
+ {
+
$historylog->add('RM',$project['transfer_target'],$project['transfer_remark'],
false);
+ }
+ }
+
+ $this->db->query("SELECT sum(amount_in) AS
amount_in, sum(amount_out) AS amount_out FROM fm_project_buffer_budget WHERE
buffer_project_id = " . (int)$project['id'],__LINE__,__FILE__);
+ $this->db->next_record();
+ $new_budget =(int)$this->db->f('amount_in') -
(int)$this->db->f('amount_out');
+
+ if ($old_budget != $new_budget)
+ {
+ $this->db->query("UPDATE fm_project SET
budget = {$new_budget} WHERE id = " . (int)$project['id'],__LINE__,__FILE__);
+
$historylog->add('B',$project['id'],$project['budget'], $old_budget);
+ }
+
}
else // investment or operation
{
+
+
+ if(isset($project['transfer_amount']) &&
$project['transfer_amount'] && isset($project['transfer_target']) &&
$project['transfer_target'])
+ {
+ $this->db->query("SELECT
project_type_id FROM fm_project WHERE id = " .
(int)$project['transfer_target'],__LINE__,__FILE__);
+ $this->db->next_record();
+ if(!$this->db->f('project_type_id') ==3)
+ {
+ throw new
Exception('property_soproject::edit() - target project is not a
buffer-project');
+ }
+
+
$this->_update_buffer_budget($project['transfer_target'], date('Y'),
$project['transfer_amount'], $project['id'],null,$project['transfer_remark']);
+
+ if(isset($project['transfer_remark'])
&& $project['transfer_remark'])
+ {
+
$historylog->add('RM',$project['id'],$project['transfer_remark'], false);
+ }
+ }
+
+
if($project['budget'])
{
- $this->update_budget($project['id'],
$project['budget_year'], $project['budget_periodization'], $project['budget']);
+ $this->update_budget($project['id'],
$project['budget_year'], $project['budget_periodization'],
$project['budget'],$project['budget_periodization_all']);
}
- $this->db->query("SELECT sum(budget) AS
sum_budget FROM fm_project_budget WHERE project_id = " .
(int)$project['id'],__LINE__,__FILE__);
+ $this->db->query("SELECT sum(budget) AS
sum_budget FROM fm_project_budget WHERE active = 1 AND project_id = " .
(int)$project['id'],__LINE__,__FILE__);
$this->db->next_record();
$new_budget =(int)$this->db->f('sum_budget');
@@ -1409,7 +1449,7 @@
{
$historylog->add('B',$project['id'],0, $old_budget);
}
-
+
$sql = "SELECT sum(budget) AS
sum_budget FROM fm_project_budget WHERE project_id = {$new_project_id}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
@@ -1418,7 +1458,7 @@
$sql = "SELECT ecodimb FROM fm_project
WHERE id = {$new_project_id}";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
- $ecodimb_new_project =
(int)$this->db->f('ecodimb');
+ $ecodimb_new_project =
(int)$this->db->f('ecodimb');
$sql = "SELECT reserve FROM fm_project
WHERE id = " . (int)$project['id'];
$this->db->query($sql,__LINE__,__FILE__);
@@ -1429,7 +1469,7 @@
{
$historylog->add('B',$new_project_id, $new_budget_new_project,
$old_budget_new_project);
}
-
+
$this->db->query("UPDATE fm_workorder
SET project_id = {$new_project_id}, ecodimb = {$ecodimb_new_project} WHERE
project_id = {$project['id']}",__LINE__,__FILE__);
$this->db->query("UPDATE fm_project SET
reserve = 0 WHERE reserve IS NULL AND id = {$new_project_id}"
,__LINE__,__FILE__);
$this->db->query("UPDATE fm_project SET
budget = {$new_budget_new_project}, reserve = reserve + {$reserve_old_project}
WHERE id = {$new_project_id}" ,__LINE__,__FILE__);
@@ -1624,64 +1664,6 @@
}
- function update_budget($project_id, $year, $periodization_id,
$budget)
- {
- $project_id = (int) $project_id;
- $year = $year ? (int) $year : date('Y');
-
- $periodization_id = (int) $periodization_id;
- $periodization_outline = array();
-
- if($periodization_id)
- {
- $this->db->query("SELECT month,
value,dividend,divisor FROM fm_eco_periodization_outline WHERE periodization_id
= {$periodization_id} ORDER BY month ASC",__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $periodization_outline[] = array
- (
- 'month' =>
$this->db->f('month'),
- 'value' =>
$this->db->f('value'),
- 'dividend' =>
$this->db->f('dividend'),
- 'divisor' =>
$this->db->f('divisor')
- );
- }
- }
- else
- {
- $periodization_outline[] = array
- (
- 'month' => 0,
- 'value' => 100,
- 'dividend' => 1,
- 'divisor' => 1,
-
- );
-
- }
-
- foreach ($periodization_outline as $outline)
- {
- if ($outline['dividend'] && $outline['divisor'])
- {
- $partial_budget = $budget *
$outline['dividend'] / $outline['divisor'];
- }
- else
- {
- $partial_budget = $budget *
$outline['value'] / 100;
- }
-
- $this->_update_budget($project_id, $year,
$outline['month'], $partial_budget);
- }
-
- $sql = "SELECT sum(budget) as sum_budget FROM
fm_project_budget WHERE project_id = {$project_id}";
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- $sum_budget = (int)$this->db->f('sum_budget');
- $sql = "UPDATE fm_project SET budget = {$sum_budget}
WHERE id = {$project_id}";
- $this->db->query($sql,__LINE__,__FILE__);
- return $sum_budget;
- }
-
public function get_buffer_budget($project_id)
{
$sql = "SELECT * FROM fm_project_buffer_budget WHERE
buffer_project_id = {$project_id}";
@@ -1706,11 +1688,11 @@
return $values;
}
- private function _update_buffer_budget($project_id, $year,
$amount, $from_project, $to_project)
+ private function _update_buffer_budget($project_id, $year,
$amount, $from_project, $to_project, $transfer_remark)
{
- $year = (int) $year;
- $amount = (int) $amount;
-
+ $year = (int) $year;
+ $amount = (int) $amount;
+
if(!$year)
{
$year = date('Y');
@@ -1730,7 +1712,7 @@
{
throw new
Exception('property_soproject::update_buffer_budget() - wrong input');
}
-
+
$value_set = array
(
'buffer_project_id' => $project_id,
@@ -1741,26 +1723,234 @@
'to_project' => $to_project,
'user_id' =>
$this->account,
'entry_date' => time(),
- 'active' => 1
+ 'active' => 1,
+ 'remark' =>
$this->db->db_addslashes($transfer_remark)
);
+ $from_project = (int) $from_project;
+ $to_project = (int) $to_project;
+
$cols = implode(',', array_keys($value_set));
$values =
$this->db->validate_insert(array_values($value_set));
$this->db->query("INSERT INTO fm_project_buffer_budget
({$cols}) VALUES ({$values})",__LINE__,__FILE__);
+
+ /**
+ * Transfer fund to another project
+ **/
+ if( $amount_out )
+ {
+ $this->db->query("SELECT periodization_id FROM
fm_project WHERE id = {$to_project}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $periodization_id =
$this->db->f('periodization_id');
+ $this->update_budget($to_project, $year,
$periodization_id, $amount_out,false,'add');
+ }
+
+ /**
+ * Transfer fund from another project
+ **/
+ if( $amount_in && $from_project)
+ {
+ $this->db->query("SELECT periodization_id FROM
fm_project WHERE id = {$from_project}",__LINE__,__FILE__);
+ $this->db->next_record();
+ $periodization_id =
$this->db->f('periodization_id');
+ $transferred =
$this->update_budget($from_project, $year, $periodization_id, $amount_in,
false, 'subtract');
+ if(!$transferred == $amount_in)
+ {
+ throw new
Exception('property_soproject::update_buffer_budget() - failed to transefer the
full amount');
+ }
+ }
}
- private function _update_budget($project_id, $year, $month,
$budget)
+
+ function update_budget($project_id, $year, $periodization_id,
$budget, $budget_periodization_all = false, $action = 'update')
{
+ $project_id = (int) $project_id;
+ $year = $year ? (int) $year : date('Y');
+
+
+ if($action == 'subtract')
+ {
+ $incoming_budget = $budget;
+ $acc_partial = 0;
+
+ $orig_budget = $this->get_budget($project_id);
+//_debug_array($orig_budget);
+ $hit = false;
+ foreach ($orig_budget as $entry)
+ {
+ if($entry['year'] == $year &&
$entry['active'])
+ {
+ $partial_budget = 0;
+ $month =
(int)substr($entry['period'],-2);
+ $hit = true; // found at least
one.
+ if($entry['budget'] >= 0)
+ {
+ if($entry['diff'] > 0)
+ {
+
if($entry['diff'] < $budget)
+ {
+
+
$partial_budget = $entry['diff'];
+ $budget
-= $partial_budget;
+ }
+ else
+ {
+
$partial_budget = $budget;
+
$partial_budget = $partial_budget > 0 ? $partial_budget : 0;
+ $budget
= 0;
+ }
+ }
+ }
+ if($entry['budget'] < 0)
+ {
+ if($entry['diff'] < 0)
+ {
+
if($entry['diff'] > $budget)
+ {
+
$partial_budget = $entry['diff'];
+ $budget
-= $partial_budget;
+ }
+ else
+ {
+
$partial_budget = $budget;
+
$partial_budget = $partial_budget < 0 ? $partial_budget : 0;
+ $budget
= 0;
+ }
+ }
+ }
+ if($partial_budget)
+ {
+ $acc_partial +=
$partial_budget;
+
$this->_update_budget($project_id, $year, $month, $partial_budget, $action);
+ }
+ }
+ }
+//_debug_array($budget);
+//die();
+ if($hit && $budget) // still some left to go -
place it on the last one
+ {
+
+ $acc_partial += $budget;
+
+ $this->_update_budget($project_id,
$year, $month, $budget, $action);
+ }
+
+ return $acc_partial;
+ }
+
+ $periodization_id = (int) $periodization_id;
+ $periodization_outline = array();
+ $skip_period = 0;
+
+ if($periodization_id)
+ {
+ $this->db->query("SELECT month,
value,dividend,divisor FROM fm_eco_periodization_outline WHERE periodization_id
= {$periodization_id} ORDER BY month ASC",__LINE__,__FILE__);
+ while ($this->db->next_record())
+ {
+ $month = $this->db->f('month');
+ if($month < date('n'))
+ {
+ $skip_period ++;
+ }
+ $periodization_outline[] = array
+ (
+ 'month' => $month,
+ 'value' =>
$this->db->f('value'),
+ 'dividend' =>
$this->db->f('dividend'),
+ 'divisor' =>
$this->db->f('divisor')
+ );
+ }
+ if($skip_period && $skip_period ==
count($periodization_outline))
+ {
+ $skip_period -= 1;
+ }
+ }
+ else
+ {
+ $periodization_outline[] = array
+ (
+ 'month' => 0,
+ 'value' => 100,
+ 'dividend' => 1,
+ 'divisor' => 1,
+ );
+
+ }
+
+ //reset skip in case of 'all'
+ if($budget_periodization_all)
+ {
+ $skip_period = 0;
+ }
+
+
+ $percentage_to_move = 0;
+ foreach ($periodization_outline as $_key => $outline)
+ {
+ if($skip_period && $skip_period == ($_key+1))
+ {
+ if ($outline['dividend'] &&
$outline['divisor'])
+ {
+ $percentage_to_move +=
$outline['dividend'] / $outline['divisor'];
+ }
+ else
+ {
+ $percentage_to_move +=
$outline['value']/100;
+ }
+
+ continue;
+ }
+
+ if ($outline['dividend'] && $outline['divisor'])
+ {
+ $partial_budget = $budget *
$outline['dividend'] / $outline['divisor'];
+ }
+ else
+ {
+ $partial_budget = $budget *
$outline['value'] / 100;
+ }
+ $partial_budget = $partial_budget * (1 +
$percentage_to_move);
+
+ $this->_update_budget($project_id, $year,
$outline['month'], $partial_budget, $action);
+ }
+
+ $sql = "SELECT sum(budget) as sum_budget FROM
fm_project_budget WHERE active = 1 AND project_id = {$project_id}";
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+ $sum_budget = (int)$this->db->f('sum_budget');
+ $sql = "UPDATE fm_project SET budget = {$sum_budget}
WHERE id = {$project_id}";
+ $this->db->query($sql,__LINE__,__FILE__);
+ return $sum_budget;
+ }
+
+
+ private function _update_budget($project_id, $year, $month,
$budget, $action = 'update')
+ {
$month = (int) $month;
$budget = (int) $budget;
$now = time();
$sql = "SELECT budget FROM fm_project_budget WHERE
project_id = {$project_id} AND year = {$year} AND month = {$month}";
-
+//_debug_array($sql);
$this->db->query($sql,__LINE__,__FILE__);
- if ($this->db->next_record())
+ $this->db->next_record();
+ if ($old_budget = $this->db->f('budget'))
{
- $sql = "UPDATE fm_project_budget SET budget =
{$budget}, modified_date = {$now} WHERE project_id = {$project_id} AND year =
{$year} AND month = {$month}";
+ if($action == 'add')
+ {
+ $new_budget = $old_budget + $budget;
+ }
+ else if ($action == 'update')
+ {
+ $new_budget = $budget;
+ }
+ else if ($action == 'subtract')
+ {
+ $new_budget = $old_budget - $budget;
+ }
+
+ $sql = "UPDATE fm_project_budget SET budget =
{$new_budget}, modified_date = {$now} WHERE project_id = {$project_id} AND year
= {$year} AND month = {$month}";
+//_debug_array($sql);
$this->db->query($sql,__LINE__,__FILE__);
}
else
@@ -1795,17 +1985,19 @@
$sql = "SELECT fm_project_budget.year,
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed,
fm_project_budget.active, sum(combined_cost) AS order_amount, start_date"
. " FROM fm_project_budget {$this->left_join}
fm_workorder ON fm_project_budget.project_id = fm_workorder.project_id WHERE
fm_project_budget.project_id = {$project_id}"
- . " GROUP BY fm_project_budget.year,
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed,
fm_project_budget.active,start_date";
+ . " GROUP BY fm_project_budget.year,
fm_project_budget.month, fm_project_budget.budget, fm_project_budget.closed,
fm_project_budget.active,start_date"
+ . " ORDER BY fm_project_budget.year,
fm_project_budget.month";
$this->db->query($sql,__LINE__,__FILE__);
// _debug_array($sql);
while ($this->db->next_record())
{
$period = $this->db->f('year') .
sprintf("%02s", $this->db->f('month'));
-
+
$project_budget[$period] =
(int)$this->db->f('budget');
$closed_period[$period] =
!!$this->db->f('closed');
$active_period[$period] =
!!$this->db->f('active');
}
+
$project_total_budget = array_sum($project_budget);
$sql = "SELECT fm_workorder.id AS order_id,
fm_workorder_budget.combined_cost, fm_workorder_budget.budget,
fm_workorder_budget.year, fm_workorder_budget.month, fm_workorder_status.closed"
@@ -1813,7 +2005,7 @@
. " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
. " {$this->join} fm_workorder_budget ON
fm_workorder.id = fm_workorder_budget.order_id"
. " WHERE project_id = {$project_id}";
-// _debug_array($sql);
+// _debug_array($sql);die();
$this->db->query($sql,__LINE__,__FILE__);
$_order_list = array();
@@ -1831,7 +2023,7 @@
);
}
-//_debug_array($_orders);
+//_debug_array($_orders);die();
$test = 0;
if ( $_order_list )
{
@@ -1871,7 +2063,7 @@
}
}
}
-
+
if(!$_found)
{
$_orders[$periode][$_order_id]['actual_cost'] += $this->db->f('actual_cost');
@@ -1908,7 +2100,8 @@
$_sum_oblications[$order_id] += $order['combined_cost'];
$_sum_oblications[$order_id] -= $order['actual_cost'];
-
if($project_total_budget >= 0)
+ //
if($project_total_budget >= 0)
+ if($_budget >= 0)
{
if($_sum_oblications[$order_id] < 0)
@@ -2036,7 +2229,7 @@
if($active_period[$entry['period']])
{
$_diff_start = abs($entry['budget']) >
0 ? $entry['budget'] : $entry['sum_orders'];
- $entry['diff'] = $_diff_start -
$entry['sum_oblications'] - $entry['actual_cost'];
+ $entry['diff'] = $_diff_start -
$entry['sum_oblications'] - $entry['actual_cost'];
}
else
{
@@ -2318,7 +2511,7 @@
break;
case 'workorder':
-
+
$table = 'fm_workorder';
$status_table = 'fm_workorder_status';
$title_field = 'fm_workorder.title';
Modified: branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.sorequest.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -193,6 +193,99 @@
}
+ function read_survey_data($data)
+ {
+ $start =
isset($data['start']) && $data['start'] ? (int)$data['start'] : 0;
+ $condition_survey_id = $data['condition_survey_id']
? (int) $data['condition_survey_id'] : 0;
+ $sort =
isset($data['sort']) && $data['sort'] ? $data['sort'] : 'DESC';
+ $order =
isset($data['order'])?$data['order']:'';
+
+
+ if ($order)
+ {
+ switch($order)
+ {
+ case 'planned_year':
+ $ordermethod = " ORDER BY
planned_year $sort";
+ break;
+ case 'url':
+ $ordermethod = " ORDER BY
fm_request.id $sort";
+ break;
+ default:
+ $ordermethod = " ORDER BY
$order $sort";
+ }
+ }
+ else
+ {
+ $ordermethod = ' ORDER BY fm_request.id DESC';
+ }
+
+ $filtermethod = " WHERE fm_request.condition_survey_id
= '{$condition_survey_id}'";
+
+
+ if ($cat_id > 0)
+ {
+ $filtermethod .= " AND
fm_request.category='{$cat_id}'";
+ }
+
+ $sql = "SELECT DISTINCT fm_request.id as
request_id,fm_request_status.descr as status,fm_request.building_part,"
+ . "
fm_request.start_date,fm_request.closed_date,fm_request.in_progress_date,fm_request.category
as cat_id,"
+ . " fm_request.delivered_date,fm_request.title as
title,max(fm_request_condition.degree) as condition_degree,"
+ . " sum(fm_request_planning.amount) as planned_budget,
fm_request.budget,fm_request.score,min(fm_request_planning.date) as
planned_year"
+ . " FROM (((( fm_request LEFT JOIN fm_request_status
ON fm_request.status = fm_request_status.id)"
+ . " LEFT JOIN fm_request_planning ON fm_request.id =
fm_request_planning.request_id)"
+ . " LEFT JOIN fm_request_consume ON fm_request.id =
fm_request_consume.request_id)"
+ . " LEFT JOIN fm_request_condition ON fm_request.id =
fm_request_condition.request_id)"
+ . " {$filtermethod}"
+ . " GROUP BY fm_request_status.descr,fm_request.budget,"
+ . "
building_part,fm_request.start_date,fm_request.entry_date,fm_request.closed_date,"
+ . "
fm_request.in_progress_date,fm_request.delivered_date,title,budget,score,fm_request.id,fm_request_status.descr";
+
+ $sql2 = "SELECT count(*) as cnt, sum(budget) as
sum_budget FROM ({$sql}) as t";
+
+ $this->_db->query($sql2,__LINE__,__FILE__);
+ $this->_db->next_record();
+ $this->_total_records = $this->_db->f('cnt');
+ $this->sum_budget = $this->_db->f('sum_budget');
+//_debug_array($sql);
+
+/*
+ $sql3 = "SELECT sum(fm_request_consume.amount) as
sum_consume FROM {$sql_arr[1]}";
+ $this->_db->query($sql3,__LINE__,__FILE__);
+ $this->_db->next_record();
+ $this->sum_consume = $this->_db->f('sum_consume');
+*/
+
+ if(!$allrows)
+ {
+ $this->_db->limit_query($sql .
$ordermethod,$start,__LINE__,__FILE__);
+ }
+ else
+ {
+ $this->_db->query($sql .
$ordermethod,__LINE__,__FILE__);
+ }
+
+ $values = array();
+
+ while ($this->_db->next_record())
+ {
+ $values[] = array
+ (
+ 'id' =>
$this->_db->f('request_id'),
+ 'status' =>
$this->_db->f('status',true),
+ 'building_part' =>
$this->_db->f('building_part'),
+ 'title' =>
$this->_db->f('title',true),
+ 'condition_degree' =>
$this->_db->f('condition_degree'),
+ 'budget' =>
$this->_db->f('budget'),
+ 'planned_budget' =>
$this->_db->f('planned_budget'),
+ 'score' =>
$this->_db->f('score'),
+ 'planned_year' =>
$this->_db->f('planned_year') ? date('Y', $this->_db->f('planned_year')) : '',
+ 'cat_id' =>
$this->_db->f('cat_id'),
+ );
+ }
+ return $values;
+ }
+
function read($data)
{
$start = isset($data['start']) &&
$data['start'] ? (int)$data['start'] : 0;
@@ -374,6 +467,22 @@
$uicols['classname'][] = '';
$uicols['sortable'][] = true;
+
+ $cols.= ",min(fm_request_planning.date) as
planned_year";
+ $cols_return[] =
'planned_year';
+// $cols_group[] =
'planned_year';
+ $uicols['input_type'][] = 'text';
+ $uicols['name'][] =
'planned_year';
+ $uicols['descr'][] = lang('planned
year');
+ $uicols['statustext'][] = lang('planned year');
+ $uicols['exchange'][] = '';
+ $uicols['align'][] = '';
+ $uicols['datatype'][] = '';
+ $uicols['formatter'][] = '';
+ $uicols['classname'][] = '';
+ $uicols['sortable'][] = true;
+
+
$this->_db->query("SELECT * FROM $attribute_table WHERE
list=1 AND $attribute_filter");
$_attrib = array();
while ($this->_db->next_record())
@@ -414,7 +523,11 @@
$paranthesis = '(';
$joinmethod = "{$this->_left_join} fm_request_status ON
{$entity_table}.status = fm_request_status.id)";
+
$paranthesis .= '(';
+ $joinmethod .= "{$this->_left_join} fm_request_planning
ON {$entity_table}.id = fm_request_planning.request_id)";
+
+ $paranthesis .= '(';
$joinmethod .= "{$this->_left_join} fm_request_consume
ON {$entity_table}.id = fm_request_consume.request_id)";
$paranthesis .= '(';
$joinmethod .= "{$this->_left_join}
fm_request_condition ON {$entity_table}.id = fm_request_condition.request_id)";
@@ -433,7 +546,14 @@
if ($order)
{
- $ordermethod = " order by $order $sort";
+ switch($order)
+ {
+ case 'planned_year':
+ $ordermethod = " ORDER BY
planned_year $sort";
+ break;
+ default:
+ $ordermethod = " order by
$order $sort";
+ }
}
else
{
@@ -816,7 +936,7 @@
$value_set['descr']
= $this->_db->db_addslashes($request['descr']);
// $value_set['location_code'] =
$request['location_code'];
$value_set['entry_date'] =
time();
- $value_set['budget'] =
$request['budget'];
+ $value_set['budget'] =
(int)$request['budget'];
$value_set['status'] =
$request['status'];
$value_set['branch_id'] =
$request['branch_id'];
$value_set['coordinator'] =
$request['coordinator'];
Modified: branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.soworkorder.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -1610,6 +1610,43 @@
set_time_limit (0);
+
+ $this->db->query("SELECT id, budget,project_type_id
FROM fm_project ORDER BY id ASC",__LINE__,__FILE__);
+
+ $projects = array();
+ while ($this->db->next_record())
+ {
+ $projects[] = array
+ (
+ 'id' =>
(int)$this->db->f('id'),
+ 'budget' =>
(int)$this->db->f('budget'),
+ 'project_type_id' =>
(int)$this->db->f('project_type_id')
+ );
+ }
+
+
+ foreach ($projects as $project)
+ {
+ if($project['project_type_id'] == 3)//buffer
+ {
+ $this->db->query("SELECT sum(amount_in)
AS amount_in, sum(amount_out) AS amount_out FROM fm_project_buffer_budget WHERE
buffer_project_id = " . (int)$project['id'],__LINE__,__FILE__);
+ $this->db->next_record();
+ $new_budget
=(int)$this->db->f('amount_in') - (int)$this->db->f('amount_out');
+ }
+ else
+ {
+ $this->db->query("SELECT sum(budget) AS
sum_budget FROM fm_project_budget WHERE active = 1 AND project_id = " .
(int)$project['id'],__LINE__,__FILE__);
+ $this->db->next_record();
+ $new_budget
=(int)$this->db->f('sum_budget');
+ }
+
+ if ($project['budget'] != $new_budget)
+ {
+ $this->db->query("UPDATE fm_project SET
budget = {$new_budget} WHERE id = " . (int)$project['id'],__LINE__,__FILE__);
+ }
+
+ }
+
$this->db->query("SELECT id FROM fm_workorder ORDER BY
id ASC",__LINE__,__FILE__);
$orders = array();
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-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.uicondition_survey.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -47,7 +47,7 @@
'get_users' => true,
'edit_survey_title' => true,
'get_files' => true,
- 'get_related' => true,
+ 'get_request' => true,
'get_summation' => true,
'view_file' => true,
'import' => true,
@@ -330,7 +330,7 @@
$tabs['generic'] = array('label' =>
lang('generic'), 'link' => '#generic');
$active_tab = 'generic';
$tabs['documents'] = array('label' =>
lang('documents'), 'link' => null);
- $tabs['related'] = array('label' =>
lang('related'), 'link' => null);
+ $tabs['request'] = array('label' =>
lang('request'), 'link' => null);
$tabs['summation'] = array('label' =>
lang('summation'), 'link' => null);
$tabs['import'] = array('label' =>
lang('import'), 'link' => null);
@@ -341,7 +341,7 @@
$tabs['import']['link'] = '#import';
}
$tabs['documents']['link'] = '#documents';
- $tabs['related']['link'] = '#related';
+ $tabs['request']['link'] = '#request';
$tabs['summation']['link'] = '#summation';
if (!$values)
@@ -385,23 +385,27 @@
'container' =>
'datatable-container_0',
'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uicondition_survey.get_files', 'id' =>
$id,'phpgw_return_as'=>'json'))),
'ColumnDefs' => $file_def,
-
+
);
$related_def = array
(
- array('key' =>
'url','label'=>lang('id'),'sortable'=>false,'resizeable'=>true),
- array('key' =>
'type','label'=>lang('type'),'sortable'=>true,'resizeable'=>true),
- array('key' =>
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true),
- array('key' =>
'status','label'=>lang('status'),'sortable'=>false,'resizeable'=>true),
- array('key' =>
'user','label'=>lang('user'),'sortable'=>true,'resizeable'=>true),
- array('key' =>
'entry_date','label'=>lang('entry date'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'url','label'=>lang('id'),'sortable'=>true,'resizeable'=>true),
+ array('key' =>
'title','label'=>lang('title'),'sortable'=>false,'resizeable'=>true,'width' =>
'100'),//width not working...
+ array('key' =>
'status','label'=>lang('status'),'sortable'=>true,'resizeable'=>true),
+ array('key' =>
'category','label'=>lang('category'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'condition_degree','label'=>lang('condition
degree'),'sortable'=>false,'resizeable'=>true),
+ array('key' =>
'score','label'=>lang('score'),'sortable'=>true,'resizeable'=>true),
+ array('key' =>
'budget','label'=>lang('budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+// array('key' =>
'planned_budget','label'=>lang('planned
budget'),'sortable'=>true,'resizeable'=>true,'formatter'=>'YAHOO.portico.FormatterAmount0'),
+ array('key' =>
'planned_year','label'=>lang('year'),'sortable'=>true,'resizeable'=>true),
+ array('key' =>
'related','label'=>lang('related'),'sortable'=>false,'resizeable'=>true),
);
$datatable_def[] = array
(
'container' =>
'datatable-container_1',
- 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uicondition_survey.get_related', 'id' =>
$id,'phpgw_return_as'=>'json'))),
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' =>
'property.uicondition_survey.get_request', 'id' =>
$id,'phpgw_return_as'=>'json'))),
'ColumnDefs' => $related_def
);
@@ -563,7 +567,7 @@
$start = phpgw::get_var('startIndex', 'int', 'REQUEST',
0);
$total_records = count($files);
- $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
if($allrows)
{
@@ -591,7 +595,7 @@
'file_name' => "<a
href='{$link_view_file}&file_name={$_entry['name']}' target='_blank'
title='{$lang_view}'>{$_entry['name']}</a>",
'delete_file' => "<input
type='checkbox' name='file_action[]' value='{$_entry['name']}'
title='$lang_delete'>",
);
- }
+ }
$data = array(
'ResultSet' => array(
@@ -618,12 +622,15 @@
}
$values = $this->bo->get_summation($id);
-
+
$total_records = count($values);
- $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
$start = phpgw::get_var('startIndex', 'int', 'REQUEST',
0);
+ $allrows = true;
+ $num_rows = $total_records;
+
if($allrows)
{
$out = $values;
@@ -651,7 +658,7 @@
}
- function get_related()
+ function get_request()
{
$id = phpgw::get_var('id', 'int', 'REQUEST');
@@ -659,60 +666,37 @@
{
return;
}
-
- $interlink = CreateObject('property.interlink');
- $target = $interlink->get_relation('property',
$this->acl_location, $id, 'target');
-
- $values = array();
- if($target)
- {
- foreach($target as $_target_section)
- {
- foreach ($_target_section['data'] as
$_target_entry)
- {
- $values[] = array
- (
- 'url' => "<a
href=\"{$_target_entry['link']}\" > {$_target_entry['id']}</a>",
- 'type' =>
$_target_section['descr'],
- 'title' =>
$_target_entry['title'],
- 'status' =>
$_target_entry['statustext'],
- 'user' =>
$GLOBALS['phpgw']->accounts->get($_target_entry['account_id'])->__toString(),
- 'entry_date'=>
$GLOBALS['phpgw']->common->show_date($_target_entry['entry_date'],$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
- );
- }
- }
- }
-
-//------ Start pagination
-
+ $borequest = CreateObject('property.borequest');
$start = phpgw::get_var('startIndex', 'int', 'REQUEST',
0);
+ $sortKey = phpgw::get_var('sort', 'string', 'REQUEST',
'request_id');
+ $sortDir = phpgw::get_var('dir', 'string', 'REQUEST',
'ASC');
- $total_records = count($values);
+ $criteria = array
+ (
+ 'condition_survey_id' => $id,
+ 'start' =>
$start,
+ 'order' =>
$sortKey,
+ 'sort' =>
$sortDir
+ );
- $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
+ $values = $borequest->read_survey_data($criteria);
+ $total_records = $borequest->total_records;
- if($allrows)
+ $base_url = self::link(array('menuaction' =>
'property.uirequest.edit'));
+ foreach ($values as &$_entry)
{
- $out = $values;
+ $_entry['url'] = "<a
href=\"{$base_url}&id={$_entry['id']}\" >{$_entry['id']}</a>";
}
- else
- {
- $page = ceil( ( $start / $total_records ) *
($total_records/ $num_rows) );
- $values_part = array_chunk($values, $num_rows);
- $out = $values_part[$page];
- }
-//------ End pagination
-
-
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] ? (int)
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] : 15;
$data = array(
'ResultSet' => array(
'totalResultsAvailable' =>
$total_records,
'startIndex' => $start,
- 'sortKey' => 'type',
- 'sortDir' => "ASC",
- 'Result' => $out,
+ 'sortKey' => $sortKey,
+ 'sortDir' => $sortDir,
+ 'Result' => $values,
'pageSize' => $num_rows,
'activePage' => floor($start /
$num_rows) + 1
)
@@ -721,8 +705,6 @@
}
-
-
/**
* Dowloads a single file to the browser
*
@@ -823,7 +805,7 @@
$step = phpgw::get_var('step', 'int',
'REQUEST');
$sheet_id = phpgw::get_var('sheet_id',
'int', 'REQUEST');
-
+
$sheet_id = $sheet_id ? $sheet_id :
phpgw::get_var('selected_sheet_id', 'int', 'REQUEST');
if(!$step )
@@ -874,7 +856,7 @@
}
$tabs = array();
-
+
switch ($step)
{
case 0:
@@ -917,7 +899,7 @@
break;
*/
}
-
+
//-----------
$data = array();
@@ -934,7 +916,7 @@
{
$objPHPExcel =
PHPExcel_IOFactory::load($cached_file);
$AllSheets =
$objPHPExcel->getSheetNames();
-
+
$sheets = array();
if($AllSheets)
{
@@ -986,7 +968,7 @@
$html_table .=
"<tr><td><pre>{$_radio}</pre></td><td>" . implode('</td><td>',
array_values($row)) . '</td></tr>';
$i++;
}
- }
+ }
else if($data && $step == 3)
{
$_options = array
@@ -1011,7 +993,7 @@
foreach($data[$start_line] as $_column =>
$_value)
{
$selected = isset($columns[$_column])
&& $columns[$_column] ? $columns[$_column] : '';
-
+
$_listbox =
phpgwapi_sbox::getArrayItem("columns[{$_column}]", $selected, $_options, true );
$html_table .= "<tr><td>[{$_column}]
{$_value}</td><td>{$_listbox}</td><tr>";
}
@@ -1034,7 +1016,7 @@
{
$_result[$_value_key]
=trim($data[$i][$_row_key]);
}
-
+
}
$import_data[] = $_result;
}
@@ -1180,7 +1162,7 @@
{
return lang('no access');
}
-
+
if ($id )
{
$values = $this->bo->read_single( array('id' =>
$id, 'view' => true) );
Modified: branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.uiproject.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -1130,7 +1130,7 @@
{
if($GLOBALS['phpgw']->session->is_repost())
{
-
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
+//
$receipt['error'][]=array('msg'=>lang('Hmm... looks like a repost!'));
}
$save=true;
@@ -1750,10 +1750,10 @@
array('key' =>
'year','label'=>lang('year'),'sortable'=>false,'resizeable'=>true),
array('key' => 'entry_date','label'=>lang('entry
date'),'sortable'=>true,'resizeable'=>true),
array('key' => 'amount_in','label'=>lang('amount
in'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
-
array('key' => 'from_project','label'=>lang('from
project'),'sortable'=>true,'resizeable'=>true),
+
array('key' => 'from_project','label'=>lang('from
project'),'sortable'=>true,'resizeable'=>true,'formatter'=>'project_link'),
array('key' => 'amount_out','label'=>lang('amount
out'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
-
array('key' => 'to_project','label'=>lang('to
project'),'sortable'=>true,'resizeable'=>true),
-
array('key' =>
'user_name','label'=>lang('user'),'sortable'=>true,'resizeable'=>true)
+
array('key' => 'to_project','label'=>lang('to
project'),'sortable'=>true,'resizeable'=>true,'formatter'=>'project_link'),
+
array('key' =>
'remark','label'=>lang('remark'),'sortable'=>true,'resizeable'=>true)
)
)
);
Modified: branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/inc/class.uirequest.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -1579,9 +1579,23 @@
}
+ $ticket_link_data = array
+ (
+ 'menuaction' => 'property.uitts.add',
+ 'bypass' => true,
+ 'location_code' =>
$values['location_code'],
+ // 'p_num' => 0,
+ // 'p_entity_id' => 0,
+ /// 'p_cat_id' => 0,
+ 'origin' =>
$this->acl_location,
+ 'origin_id' => $id
+ );
+
+
$data = array
(
'mode'
=> $mode,
+ 'ticket_link'
=> $GLOBALS['phpgw']->link('/index.php',$ticket_link_data),
'value_authorities_demands'
=> isset($this->config->config_data['authorities_demands']) &&
$this->config->config_data['authorities_demands'] ?
$this->config->config_data['authorities_demands'] : 0,
'suppressmeter'
=> isset($this->config->config_data['project_suppressmeter'])
&& $this->config->config_data['project_suppressmeter'] ? 1 : '',
'show_dates'
=> $show_dates,
Copied: branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS_2
(from rev 10654, trunk/property/inc/export/default/El_anlegg_LRS_2)
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS_2
(rev 0)
+++ branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS_2
2013-01-09 12:14:51 UTC (rev 10655)
@@ -0,0 +1,369 @@
+<?php
+ /**
+ * phpGroupWare - property: a Facilities Management System.
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
+ * This file is part of phpGroupWare.
+ *
+ * phpGroupWare is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * phpGroupWare is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with phpGroupWare; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
+ *
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package property
+ * @subpackage export
+ * @version $Id: Basware_X114 9585 2012-06-13 18:22:44Z sigurdne $
+ */
+
+ /**
+ * Description
+ * @package property
+ */
+
+ class export_conv
+ {
+ //var $fil_katalog='c:/temp'; //On windows use
"//computername/share/filename" or "\\\\computername\share\filename" to check
files on network shares.
+
+ var $debug;
+ var $client_code = 14;
+ protected $connection = false;
+ protected $receipt = array();
+
+ function __construct()
+ {
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'property';
+ $this->db = &
$GLOBALS['phpgw']->db;
+ $this->join = &
$this->db->join;
+
+ $this->config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property',
'.invoice'));
+ }
+
+ protected function get_anlegg()
+ {
+ $sql= "SELECT * FROM fm_entity_1_11 WHERE
auto_kontering = 1";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $anlegg = array();
+
+ $PeriodFrom = date('Ym');
+ $PeriodTo = 209912;
+
+ $memory = xmlwriter_open_memory();
+ xmlwriter_set_indent ( $memory , true );
+ xmlwriter_start_document($memory,'1.0','UTF-8');
+ xmlwriter_start_element($memory,'MaalepunktListe');
+
xmlwriter_write_attribute($memory,'xmlns:xsi','http://www.w3.org/2001/XMLSchema-instance');
+
xmlwriter_write_attribute($memory,'xsi:noNamespaceSchemaLocation','..\XmlSchema\AttributeValueList.xsd');
+
+ while ($this->db->next_record())
+ {
+ xmlwriter_start_element($memory,'Maalepunkt');
+ xmlwriter_write_element($memory,'ID',
'TJ');
+
xmlwriter_write_element($memory,'Verdi',
substr($this->db->f('maalepunkt_id'),-8));
+
xmlwriter_write_element($memory,'Firma', 'BB');
+
xmlwriter_write_element($memory,'Beskrivelse', $this->db->f('address'));
+
xmlwriter_write_element($memory,'PeriodeFra', $PeriodFrom);
+
xmlwriter_write_element($memory,'PeriodeTil', $PeriodTo);
+
xmlwriter_write_element($memory,'Status', 'N');
+
xmlwriter_start_element($memory,'BegrepsLister');
+
xmlwriter_start_element($memory,'BegrepsListe');
+
xmlwriter_write_attribute($memory,'Prosent', 100);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Firma' );
+
xmlwriter_write_element($memory,'ID', 'A3');
+
xmlwriter_write_element($memory,'Verdi', 'BB');
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Art' );
+
xmlwriter_write_element($memory,'ID', 'A0');
+
xmlwriter_write_element($memory,'Verdi', '12304121');
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Asvar' );
+
xmlwriter_write_element($memory,'ID', 'C1');
+
xmlwriter_write_element($memory,'Verdi', 45);
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Tjeneste' );
+
xmlwriter_write_element($memory,'ID', 'TJE');
+
xmlwriter_write_element($memory,'Verdi', '');
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Objekt' );
+
xmlwriter_write_element($memory,'ID', 'F0');
+
xmlwriter_write_element($memory,'Verdi', $this->db->f('loc1'));
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Prosjekt' );
+
xmlwriter_write_element($memory,'ID', 'B0');
+
xmlwriter_write_element($memory,'Verdi', '');
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'Fagkode' );
+
xmlwriter_write_element($memory,'ID', 'B1');
+
xmlwriter_write_element($memory,'Verdi', '999');
+
xmlwriter_end_element($memory);
+
xmlwriter_start_element($memory,'Begrep');
+
xmlwriter_write_comment($memory , 'AV' );
+
xmlwriter_write_element($memory,'ID', 'AV');
+
xmlwriter_write_element($memory,'Verdi', '');
+
xmlwriter_end_element($memory);
+ xmlwriter_end_element($memory);
+ xmlwriter_end_element($memory);
+ xmlwriter_end_element($memory);
+ }
+ xmlwriter_end_element($memory);
+ $xml = xmlwriter_output_memory($memory,true);
+
+ header('Content-type: text/xml');
+
+ echo $xml; die();
+
+ return $xml;
+ }
+
+ protected function log_end()
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->receipt);
+
+ $insert_values= array
+ (
+ 0,
+ date($this->db->datetime_format()),
+ 'El_anlegg_LRS',
+ implode(',',(array_keys($msgbox_data)))
+ );
+
+ $insert_values =
$this->db->validate_insert($insert_values);
+
+ $sql = "INSERT INTO fm_cron_log
(cron,cron_date,process,message) "
+ . "VALUES ($insert_values)";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
+ public function overfor($download)
+ {
+
+// $download = 'on';
+// $download = False;
+// $this->debug=True;
+
+ //Bestem filnavn
+ $external_ref = '';
+ $Filnavn = $this->LagFilnavn($external_ref);
+
+ if (!$Filnavn)
+ {
+ $message='LagFilnavn: Filnavn er i bruk';
+ $receipt['error'][]= array('msg' => $message);
+ $this->log_end();
+ echo $message;
+ return;
+ }
+
+ //Test om filen kan opprettes og skrives til
+ if (@fopen($Filnavn, "wb"))
+ {
+ unlink($Filnavn);
+ }
+ else
+ {
+ $message='kan ikke lagre til fil: '. $Filnavn
.'<br>';
+ if($this->debug)
+ {
+ echo $message;
+ }
+ else
+ {
+ $receipt['error'][]= array('msg' =>
$message);
+ $this->log_end();
+ }
+ }
+
+ //Velg ut alle anlegg som skal overføres
+ $anlegg = $this->get_anlegg();
+
+ if ($anlegg)
+ {
+ $this->receipt['message'][]= array('msg' =>
$this->transfer_anlegg($anlegg, $Filnavn, $download));
+ }
+
+ if($this->connection)
+ {
+ switch
($this->config->config_data['common']['method'])
+ {
+ case 'ftp';
+ ftp_quit($this->connection);
+ break;
+ case 'ssh';
+ ssh2_exec($this->connection,
'exit');
+ break;
+ }
+ }
+ //Lagre melding
+ if ($download=='on')
+ {
+ $this->log_end();
+ }
+
+ return $receipt;
+ }
+
+
+ protected function LagFilnavn ($external_ref = '')
+ {
+ if(!$external_ref)
+ {
+ $external_ref = mt_rand();
+ }
+ $fil_katalog =
$this->config->config_data['export']['path'];
+
+ $Filnavn = $fil_katalog .
"/x114_14_{$external_ref}.xml";
+
+ //Sjekk om filen eksisterer
+ if (file_exists($Filnavn))
+ {
+ unlink($Filnavn);
+ }
+
+ return $Filnavn;
+ }
+
+ protected function transfer_anlegg($xmldata, $Filnavn,
$download)
+ {
+ if ($download=='on' && !$this->debug)
+ {
+ $file_written = false;
+ $fp = fopen($Filnavn, "wb");
+ fwrite($fp,$xmldata);
+
+ if(fclose($fp))
+ {
+ $file_written=true;
+ }
+
+ if( $file_written &&
($this->config->config_data['common']['method'] != 'ftp' &&
$this->config->config_data['common']['method'] != 'ssh'))
+ {
+ $transfer_ok = true;
+ }
+ else if($file_written)
+ {
+ $transfer_ok =
$this->transfer($xmldata,$Filnavn);
+ }
+
+ if($transfer_ok)
+ {
+ $message = "El Anlegg er overført, fil:
{$Filnavn}";
+ }
+ else
+ {
+ $message = 'Noe gikk galt med
overføring av El Anlegg';
+ }
+ }
+ else
+ {
+ $message = $xmldata;
+ }
+
+ return $message;
+ }
+
+
+ protected function transfer($xmldata,$Filnavn)
+ {
+ $transfer_ok = false;
+
if($this->config->config_data['common']['method']=='ftp' ||
$this->config->config_data['common']['method']=='ssh')
+ {
+ if(!$connection = $this->connection)
+ {
+ $connection =
$this->phpftp_connect();
+ }
+
+ $basedir =
$this->config->config_data['export']['remote_basedir'];
+ if($basedir)
+ {
+ $remote_file = $basedir . '/' .
basename($Filnavn);
+ }
+ else
+ {
+ $remote_file = basename($Filnavn);
+ }
+
+ switch
($this->config->config_data['common']['method'])
+ {
+ case 'ftp';
+ $transfer_ok =
ftp_put($connection,$remote_file, $Filnavn, FTP_BINARY);
+ break;
+ case 'ssh';
+ $sftp = ssh2_sftp($connection);
+ $stream =
@fopen("ssh2.sftp://$sftp$remote_file", 'w');
+ $data_to_send =
@file_get_contents($Filnavn);
+ fwrite($stream, $data_to_send);
+ $transfer_ok = @fclose($stream);
+ break;
+ default:
+ $transfer_ok = false;
+ }
+
+ if (!$transfer_ok)
+ {
+ unlink($Filnavn);
+ }
+ }
+ return $transfer_ok;
+ }
+
+ protected function phpftp_connect()
+ {
+ $server =
$this->config->config_data['common']['host'];
+ $user =
$this->config->config_data['common']['user'];
+ $password =
$this->config->config_data['common']['password'];
+ $port = 22;
+
+ switch ($this->config->config_data['common']['method'])
+ {
+ case 'ftp';
+ if($connection = ftp_connect($server))
+ {
+
ftp_login($connection,$user,$password);
+ }
+ break;
+ case 'ssh';
+ if (!function_exists("ssh2_connect"))
+ {
+ die("function ssh2_connect
doesn't exist");
+ }
+ if(!($connection =
ssh2_connect("$server", $port)))
+ {
+ $message = "fail: unable to
establish connection";
+ _debug_array($message);
+ //$receipt['error'][]=
array('msg' => $message);
+ }
+ else
+ {
+ // try to authenticate with
username root, password secretpassword
+
if(!ssh2_auth_password($connection, $user, $password))
+ {
+ $message = "fail:
unable to authenticate";
+ _debug_array($message);
+ //$receipt['error'][]=
array('msg' => $message);
+ }
+ }
+ break;
+ }
+ $this->connection = $connection;
+ return $connection;
+ }
+ }
Modified: branches/Version-1_0-branch/property/js/yahoo/project.edit.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/project.edit.js
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/js/yahoo/project.edit.js
2013-01-09 12:14:51 UTC (rev 10655)
@@ -60,6 +60,19 @@
};
/********************************************************************************/
+
+ var oArgs_project = {menuaction:'property.uiproject.edit'};
+ var sUrl_project = phpGWLink('index.php', oArgs_project);
+
+ var project_link = function(elCell, oRecord, oColumn, oData)
+ {
+ if(oData > 0)
+ {
+ elCell.innerHTML = "<a href="+sUrl_project +
"&id="+oData+">" + oData + "</a>";
+ }
+ }
+
+
var FormatterRight = function(elCell, oRecord, oColumn, oData)
{
elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
@@ -127,8 +140,12 @@
//call getTotalSum(name of column) in property.js
tmp_sum1 = getTotalSum('amount_in',0,paginator,datatable);
tmp_sum2 = getTotalSum('amount_out',0,paginator,datatable);
- tmp_sum3 = tmp_sum1 + tmp_sum2;
+ tmp_sum3 = parseInt(tmp_sum1.replace(/ /g,''))
+ - parseInt(tmp_sum2.replace(/ /g,''));
+
+ tmp_sum3 = YAHOO.util.Number.format(tmp_sum3, {decimalPlaces:0,
decimalSeparator:",", thousandsSeparator:" "});
+
if(typeof(tableYUI0)=='undefined')
{
tableYUI0 =
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
@@ -147,7 +164,7 @@
td_sum(tmp_sum1);
td_empty(1);
td_sum(tmp_sum2);
- td_empty(1);
+ td_sum('Total');
td_sum(tmp_sum3);
myfoot = tableYUI0.createTFoot();
Modified: branches/Version-1_0-branch/property/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-01-09
12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/setup/phpgw_no.lang 2013-01-09
12:14:51 UTC (rev 10655)
@@ -8,6 +8,10 @@
expences property no Utgifter
income property no Inntekter
about common no Om
+amount in property no Inn
+from project property no Fra prosjekt
+amount out property no Ut
+to project property no Til prosjekt
access error property no Manglende tilgang
accounting property no Regnskap
accounting categories property no Kategorier regnskap
Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php
2013-01-09 12:14:51 UTC (rev 10655)
@@ -7188,6 +7188,7 @@
$GLOBALS['phpgw_setup']->oProc->query('UPDATE fm_project_budget
SET active = 1',__LINE__,__FILE__);
+ $GLOBALS['phpgw_setup']->oProc->query('UPDATE fm_request set
budget = 0 WHERE budget IS NULL',__LINE__,__FILE__);
$GLOBALS['phpgw_setup']->oProc->CreateTable(
'fm_workorder_budget', array(
Modified:
branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/templates/base/condition_survey.xsl
2013-01-09 12:14:51 UTC (rev 10655)
@@ -252,7 +252,7 @@
</xsl:choose>
</dl>
</div>
- <div id="related">
+ <div id="request">
<dl class="proplist-col">
<dt>
<label>
@@ -266,7 +266,7 @@
</dt>
<dt>
- <label><xsl:value-of
select="php:function('lang', 'related')"/></label>
+ <label><xsl:value-of
select="php:function('lang', 'request')"/></label>
</dt>
<dd>
<div style="clear:both;"
id="datatable-container_1"></div>
Modified: branches/Version-1_0-branch/property/templates/base/project.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/project.xsl
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/templates/base/project.xsl
2013-01-09 12:14:51 UTC (rev 10655)
@@ -388,7 +388,7 @@
</xsl:when>
</xsl:choose>
<xsl:choose>
- <xsl:when
test="value_project_id!='' and mode='edit'">
+ <xsl:when
test="value_project_id!='' and mode='edit' and project_type_id !=3">
<tr>
<td valign="top">
<xsl:value-of select="php:function('lang', 'move')"/>
@@ -430,17 +430,28 @@
<xsl:apply-templates select="year_list/options"/>
</select>
</td>
-
<td>
-
<select name="values[budget_periodization]">
-
<xsl:attribute name="title">
-
<xsl:value-of select="php:function('lang',
'periodization')"/>
-
</xsl:attribute>
-
<option value="0">
-
<xsl:value-of select="php:function('lang',
'periodization')"/>
-
</option>
-
<xsl:apply-templates
select="periodization_list/options"/>
-
</select>
-
</td>
+
<xsl:choose>
+
<xsl:when test="project_type_id !='3'">
+
<td>
+
<select name="values[budget_periodization]">
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'periodization')"/>
+
</xsl:attribute>
+
<option value="0">
+
<xsl:value-of
select="php:function('lang', 'periodization')"/>
+
</option>
+
<xsl:apply-templates
select="periodization_list/options"/>
+
</select>
+
</td>
+
<td>
+
<input type="checkbox"
name="values[budget_periodization_all]" value="True">
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'all')"/>
+
</xsl:attribute>
+
</input>
+
</td>
+
</xsl:when>
+
</xsl:choose>
</tr>
</table>
</td>
@@ -454,45 +465,94 @@
<div
id="datatable-container_0"/>
</td>
</tr>
- <xsl:choose>
- <xsl:when test="project_type_id !='3'">
+ <xsl:choose>
+ <xsl:when
test="value_project_id!='' and mode='edit'">
+
<tr>
+
<td valign="top">
+
<xsl:value-of select="php:function('lang', 'transfer')"/>
+
</td>
+
<td>
+
<table>
+
<tr>
+
<td valign="top">
+
<xsl:value-of
select="php:function('lang', 'amount')"/>
+
</td>
+
<td valign="top">
+
<xsl:value-of
select="php:function('lang', 'project')"/>
+
</td>
+
<td valign="top">
+
<xsl:value-of
select="php:function('lang', 'remark')"/>
+
</td>
+
</tr>
+
<tr>
+
<td>
+
<input type="text"
name="values[transfer_amount]" value="">
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'amount to transfer')"/>
+
</xsl:attribute>
+
</input>
+
</td>
+
<td>
+
<input type="text"
name="values[transfer_target]" value="">
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'target project')"/>
+
</xsl:attribute>
+
</input>
+
</td>
+
<td>
+
<input type="text"
name="values[transfer_remark]" value="">
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'remark')"/>
+
</xsl:attribute>
+
</input>
+
</td>
+
</tr>
+
</table>
+
</td>
+
</tr>
+
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:choose>
+ <xsl:when
test="project_type_id !='3'">
+ <tr>
+
<td valign="top">
+
<xsl:value-of select="lang_reserve"/>
+
</td>
+
<td><input type="text" name="values[reserve]"
value="{value_reserve}"><xsl:attribute name="title"><xsl:value-of
select="lang_reserve_statustext"/></xsl:attribute></input><xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
+
</td>
+ </tr>
+ <tr>
+
<td valign="top">
+
<xsl:value-of select="lang_sum"/>
+
</td>
+
<td><xsl:value-of select="value_sum"/><xsl:text> </xsl:text> [ <xsl:value-of
select="currency"/> ]
+
</td>
+ </tr>
+ <tr>
+
<td valign="top">
+
<xsl:value-of select="lang_remainder"/>
+
</td>
+
<td><xsl:value-of select="value_remainder"/><xsl:text> </xsl:text> [
<xsl:value-of select="currency"/> ]
+
</td>
+ </tr>
+ <tr>
+
<td valign="top">
+
<xsl:value-of select="lang_reserve_remainder"/>
+
</td>
+
<td>
+
<xsl:value-of select="value_reserve_remainder"/><xsl:text> </xsl:text>
[ <xsl:value-of select="currency"/> ]
+
<xsl:text> </xsl:text> ( <xsl:value-of
select="value_reserve_remainder_percent"/>
+
<xsl:text> % )</xsl:text>
+
</td>
+ </tr>
+
</xsl:when>
+
<xsl:otherwise>
+
</xsl:otherwise>
+ </xsl:choose>
<tr>
- <td
valign="top">
-
<xsl:value-of select="lang_reserve"/>
- </td>
- <td><input
type="text" name="values[reserve]" value="{value_reserve}"><xsl:attribute
name="title"><xsl:value-of
select="lang_reserve_statustext"/></xsl:attribute></input><xsl:text>
</xsl:text> [ <xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_sum"/>
- </td>
-
<td><xsl:value-of select="value_sum"/><xsl:text> </xsl:text> [ <xsl:value-of
select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_remainder"/>
- </td>
-
<td><xsl:value-of select="value_remainder"/><xsl:text> </xsl:text> [
<xsl:value-of select="currency"/> ]
- </td>
- </tr>
- <tr>
- <td
valign="top">
-
<xsl:value-of select="lang_reserve_remainder"/>
- </td>
- <td>
-
<xsl:value-of select="value_reserve_remainder"/><xsl:text> </xsl:text> [
<xsl:value-of select="currency"/> ]
-
<xsl:text> </xsl:text> ( <xsl:value-of
select="value_reserve_remainder_percent"/>
-
<xsl:text> % )</xsl:text>
- </td>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- </xsl:otherwise>
- </xsl:choose>
- <tr>
<td
class="th_text" valign="top">
<xsl:value-of select="lang_workorder_id"/>
</td>
Modified: branches/Version-1_0-branch/property/templates/base/request.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/request.xsl
2013-01-09 12:09:30 UTC (rev 10654)
+++ branches/Version-1_0-branch/property/templates/base/request.xsl
2013-01-09 12:14:51 UTC (rev 10655)
@@ -136,6 +136,17 @@
</input>
</form>
</td>
+ <td>
+ <form
method="post" action="{ticket_link}">
+
<xsl:variable name="lang_start_ticket">
+
<xsl:value-of select="php:function('lang', 'start ticket')"/>
+
</xsl:variable>
+ <input
type="hidden" name="values[subject]" value="{value_title}"/>
+ <input
type="hidden" name="values[details]" value="{value_descr}"/>
+ <input
type="submit" name="start_ticket" value="{$lang_start_ticket}">
+ </input>
+ </form>
+ </td>
</tr>
</xsl:when>
</xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10655] Merge 10639:10654 from trunk,
Sigurd Nes <=