[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9837] Merge 9833:9836 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9837] Merge 9833:9836 from trunk |
Date: |
Wed, 08 Aug 2012 07:22:55 +0000 |
Revision: 9837
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9837
Author: sigurdne
Date: 2012-08-08 07:22:55 +0000 (Wed, 08 Aug 2012)
Log Message:
-----------
Merge 9833:9836 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/property/inc/class.soXport.inc.php
branches/Version-1_0-branch/property/inc/class.soproject.inc.php
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv
branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml
branches/Version-1_0-branch/property/setup/default_records.inc.php
branches/Version-1_0-branch/property/setup/tables_current.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
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
+
/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
Modified: branches/Version-1_0-branch/property/inc/class.soXport.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soXport.inc.php
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/inc/class.soXport.inc.php
2012-08-08 07:22:55 UTC (rev 9837)
@@ -126,7 +126,7 @@
function anleggsnr_to_objekt($anleggsnr,$meter_table)
{
- $this->db->query("SELECT
$meter_table.ext_meter_id,$meter_table.loc1,$meter_table.loc2,$meter_table.loc3,fm_part_of_town.district_id
"
+ $this->db->query("SELECT
$meter_table.maaler_nr,$meter_table.loc1,$meter_table.loc2,$meter_table.loc3,fm_part_of_town.district_id
"
. " FROM $meter_table $this->join fm_location1
ON $meter_table.loc1 = fm_location1.loc1 $this->join "
. " fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id WHERE
$meter_table.ext_system_id='$anleggsnr'");
@@ -141,7 +141,7 @@
$maalerinfo['loc1']=$loc1;
$maalerinfo['dima']=$dima;
- $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+ $maalerinfo['maalernr']=$this->db->f('maaler_nr');
$maalerinfo['district']=$this->db->f('district_id');
return $maalerinfo;
Modified: branches/Version-1_0-branch/property/inc/class.soproject.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/inc/class.soproject.inc.php
2012-08-08 07:22:55 UTC (rev 9837)
@@ -856,7 +856,7 @@
return false;
}
- $this->db->query("SELECT ext_meter_id as power_meter
FROM $meter_table where location_code='$location_code' and
category='1'",__LINE__,__FILE__);
+ $this->db->query("SELECT maaler_nr as power_meter FROM
$meter_table where location_code='$location_code' and
category='1'",__LINE__,__FILE__);
$this->db->next_record();
@@ -1121,14 +1121,14 @@
if ( $this->db->f('cnt'))
{
- $this->db->query("update $meter_table set
ext_meter_id='$power_meter',address='$address' where
location_code='$location_code' and category='1'",__LINE__,__FILE__);
+ $this->db->query("update $meter_table set
maaler_nr='$power_meter',address='$address' where
location_code='$location_code' and category='1'",__LINE__,__FILE__);
}
else
{
$id = $this->bocommon->next_id($meter_table);
$meter_id =
$this->generate_meter_id($meter_table);
- $this->db->query("insert into $meter_table
(id,num,ext_meter_id,category,location_code,entry_date,user_id,address $cols) "
+ $this->db->query("insert into $meter_table
(id,num,maaler_nr,category,location_code,entry_date,user_id,address $cols) "
. "VALUES ('"
. $id. "','"
. $meter_id. "','"
Modified:
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
===================================================================
---
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
2012-08-08 07:20:16 UTC (rev 9836)
+++
branches/Version-1_0-branch/property/inc/custom/default/hent_maaler_nr_til_besikt_rapport.php
2012-08-08 07:22:55 UTC (rev 9837)
@@ -11,7 +11,7 @@
//'property' = $GLOBALS['phpgw_info']['flags']['currentapp'];
- $sql = "SELECT ext_meter_id as maaler_nr FROM fm_entity_1_11
WHERE location_code='" . $values['location_code'] . "'";
+ $sql = "SELECT maaler_nr as maaler_nr FROM fm_entity_1_11 WHERE
location_code='" . $values['location_code'] . "'";
$this->db->query($sql,__LINE__,__FILE__);
$this->db->next_record();
$maaler_nr = $this->db->f('maaler_nr');
@@ -66,7 +66,7 @@
{
$new_value =
$entry['value'];
-
$this->db->query("SELECT maaler_stand, id FROM fm_entity_1_11 WHERE
ext_meter_id = '$maaler_nr' AND location_code ='" . $values['location_code'].
"'",__LINE__,__FILE__);
+
$this->db->query("SELECT maaler_stand, id FROM fm_entity_1_11 WHERE maaler_nr =
'$maaler_nr' AND location_code ='" . $values['location_code'].
"'",__LINE__,__FILE__);
$this->db->next_record();
$old_value =
$this->db->f('maaler_stand');
$id =
$this->db->f('id');
@@ -77,7 +77,7 @@
{
$historylog = CreateObject('property.historylog','entity_1_11');
$historylog->add('SO',$id,$new_value,false, $attrib_id,$besiktet_dato);
-
$this->db->query("UPDATE fm_entity_1_11 SET maaler_stand = '{$new_value}' WHERE
ext_meter_id = '{$maaler_nr}' AND location_code
='{$values['location_code']}'",__LINE__,__FILE__);
+
$this->db->query("UPDATE fm_entity_1_11 SET maaler_stand = '{$new_value}' WHERE
maaler_nr = '{$maaler_nr}' AND location_code
='{$values['location_code']}'",__LINE__,__FILE__);
}
}
}
Copied: branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
(from rev 9836, trunk/property/inc/export/default/El_anlegg_LRS)
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
(rev 0)
+++ branches/Version-1_0-branch/property/inc/export/default/El_anlegg_LRS
2012-08-08 07:22:55 UTC (rev 9837)
@@ -0,0 +1,428 @@
+<?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
+ */
+
+ phpgw::import_class('phpgwapi.datetime');
+ phpgw::import_class('phpgwapi.xmlhelper');
+
+ 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;
+
+ $doc = new DOMDocument('1.0', 'utf-8');
+ $domElement = $doc->createElement('AttributeList');
+
+
+ while ($this->db->next_record())
+ {
+ $Attribute = array
+ (
+ 'ID' => 'TJ',
+ 'Name' =>
'MALEPID',
+ 'Value' =>
substr($this->db->f('maalepunkt_id'),-8),
+ // 'id' =>
$this->db->f('id'),
+ 'Description' =>
$this->db->f('address'),
+ 'PeriodFrom' => $PeriodFrom,
+ 'PeriodTo' =>
$PeriodTo,
+ 'Status' => 'N',
+ 'Percentage' => '100',
+ 'RelationList' => array
+ (
+ 'RelationValue' => array
+ (
+ array
+ (
+ 'ID'
=> 'A3',
+ 'Name'
=> 'FIRMA',
+ 'Value'
=> 'BB',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> 'A0',
+ 'Name'
=> 'Art',
+ 'Value'
=> '12304121',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> 'C1',
+ 'Name'
=> 'Ansvar',
+ 'Value'
=> '45',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> 'F0',
+ 'Name'
=> 'Objekt',
+ 'Value'
=> $this->db->f('loc1'),
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> 'B0',
+ 'Name'
=> 'Prosjekt',
+ 'Value'
=> '',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> 'B1',
+ 'Name'
=> 'Fagkode',
+ 'Value'
=> '999',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ array
+ (
+ 'ID'
=> '',
+ 'Name'
=> 'Prosent',
+ 'Value'
=> '100',
+
'Description' => '',
+
'PeriodFrom' => '',
+
'PeriodTo' => '',
+
'Status' => '',
+
'Percentage' => '100'
+ ),
+ )
+ )
+ );
+
+ $xmldata =
phpgwapi_xmlhelper::toXML($Attribute, 'Attribute');
+
+ $reader = new XMLReader();
+ $reader->XML($xmldata,'utf-8');
+
+ while ($reader->read())
+ {
+ if ($reader->nodeType ==
XMLREADER::ELEMENT && $reader->localName == 'Attribute')
+ {
+ $domnode = $reader->expand();
+
$domElement->appendChild($domnode);
+ break;
+ }
+ }
+ $reader->close();
+ }
+ $doc->appendChild($domElement);
+
+ $doc->formatOutput = true;
+ $doc->preserveWhiteSpace = true;
+ $xml = $doc->saveXML();
+
+ 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/inc/import/default/Import_fra_BKK_csv
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/inc/import/default/Import_fra_BKK_csv
2012-08-08 07:22:55 UTC (rev 9837)
@@ -296,9 +296,9 @@
function anleggsnr_to_objekt($anleggsnr,$meter_table)
{
- $sql = "SELECT
{$meter_table}.ext_meter_id,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
"
+ $sql = "SELECT
{$meter_table}.maaler_nr,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
"
. " FROM {$meter_table} {$this->join} fm_location1 ON
{$meter_table}.loc1 = fm_location1.loc1 $this->join "
- . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id WHERE {$meter_table}.ext_system_id2
{$this->like} '%{$anleggsnr}'";
+ . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id WHERE {$meter_table}.maalepunkt_id
{$this->like} '%{$anleggsnr}'";
// _debug_array($sql);
$this->db->query($sql);
@@ -309,7 +309,7 @@
$maalerinfo['loc1']=$loc1;
$maalerinfo['dima']=$loc1.$loc2;//.$loc3;
- $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+ $maalerinfo['maalernr']=$this->db->f('maaler_nr');
$maalerinfo['district']=$this->db->f('district_id');
return $maalerinfo;
}
Modified:
branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml
===================================================================
--- branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/inc/import/default/efaktura_dnb_xml
2012-08-08 07:22:55 UTC (rev 9837)
@@ -288,9 +288,9 @@
function anleggsnr_to_objekt($anleggsnr,$meter_table)
{
- $sql = "SELECT
{$meter_table}.ext_meter_id,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
"
+ $sql = "SELECT
{$meter_table}.maaler_nr,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
"
. " FROM {$meter_table} {$this->join} fm_location1 ON
{$meter_table}.loc1 = fm_location1.loc1 $this->join "
- . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id WHERE {$meter_table}.ext_system_id2
{$this->like} '%{$anleggsnr}'";
+ . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id WHERE {$meter_table}.maalepunkt_id
{$this->like} '%{$anleggsnr}'";
// _debug_array($sql);
$this->db->query($sql);
@@ -300,7 +300,7 @@
$maalerinfo['loc1']=$loc1;
$maalerinfo['dima']=$loc1.$loc2;
- $maalerinfo['maalernr']=$this->db->f('ext_meter_id');
+ $maalerinfo['maalernr']=$this->db->f('maaler_nr');
$maalerinfo['district']=$this->db->f('district_id');
return $maalerinfo;
}
Modified: branches/Version-1_0-branch/property/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/default_records.inc.php
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/setup/default_records.inc.php
2012-08-08 07:22:55 UTC (rev 9837)
@@ -419,7 +419,7 @@
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 1, 'status', 'Status', 'Status', 'LB', NULL, 1, NULL, NULL,
NULL, NULL, 'True')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 2, 'category', 'Category', 'Category statustext', 'LB', NULL, 2,
NULL, NULL, NULL, NULL, 'True')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 3, 'ext_system_id', 'Ext system id', 'External system id', 'V',
NULL, 3, NULL, 12, NULL, NULL, 'False')");
-$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 4, 'ext_meter_id', 'Ext meter id', 'External meter id', 'V',
NULL, 4, NULL, 12, NULL, NULL, 'False')");
+$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 4, 'maaler_nr', 'Ext meter id', 'External meter id', 'V', NULL,
4, NULL, 12, NULL, NULL, 'False')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_attribute
(location_id, id, column_name, input_text, statustext, datatype, list,
attrib_sort, size, precision_, scale, default_value, nullable) VALUES
($location_id, 5, 'remark', 'Remark', 'Remark status text', 'T', NULL, 5, NULL,
NULL, NULL, NULL, 'True')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice
(location_id, attrib_id, id, value) VALUES ($location_id, 1, 1, 'status 1')");
$GLOBALS['phpgw_setup']->oProc->query("INSERT INTO phpgw_cust_choice
(location_id, attrib_id, id, value) VALUES ($location_id, 1, 2, 'status 2')");
Modified: branches/Version-1_0-branch/property/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_current.inc.php
2012-08-08 07:20:16 UTC (rev 9836)
+++ branches/Version-1_0-branch/property/setup/tables_current.inc.php
2012-08-08 07:22:55 UTC (rev 9837)
@@ -1781,7 +1781,7 @@
'status' => array('type' => 'int','precision'
=> '4','nullable' => True),
'category' => array('type' => 'int','precision'
=> '4','nullable' => False),
'ext_system_id' => array('type' =>
'varchar','precision' => '20','nullable' => False),
- 'ext_meter_id' => array('type' =>
'varchar','precision' => '20','nullable' => False),
+ 'maaler_nr' => array('type' =>
'varchar','precision' => '20','nullable' => False),
'remark' => array('type' =>
'varchar','precision' => '255','nullable' => True)
),
'pk' => array('id'),
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9837] Merge 9833:9836 from trunk,
Sigurd Nes <=