[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [7760] Merge 7753:7759 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [7760] Merge 7753:7759 from trunk |
Date: |
Fri, 30 Sep 2011 12:08:20 +0000 |
Revision: 7760
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7760
Author: sigurdne
Date: 2011-09-30 12:08:19 +0000 (Fri, 30 Sep 2011)
Log Message:
-----------
Merge 7753:7759 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/catch/inc/custom/default/update_location_at_record.php
branches/Version-1_0-branch/catch/setup/setup.inc.php
branches/Version-1_0-branch/catch/setup/tables_current.inc.php
branches/Version-1_0-branch/catch/setup/tables_update.inc.php
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
branches/Version-1_0-branch/controller/templates/base/control_group.xsl
branches/Version-1_0-branch/phpgwapi/inc/class.jasper_wrapper.inc.php
branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
branches/Version-1_0-branch/property/inc/export/default/Basware_X114
branches/Version-1_0-branch/property/templates/base/config.tpl
branches/Version-1_0-branch/property/templates/base/wo_hour.xsl
Added Paths:
-----------
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750
+
/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
Copied:
branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php (from
rev 7759, trunk/catch/inc/custom/default/notify_by_email.php)
===================================================================
--- branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php
(rev 0)
+++ branches/Version-1_0-branch/catch/inc/custom/default/notify_by_email.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -0,0 +1,124 @@
+<?php
+
+ $validator = CreateObject('phpgwapi.EmailAddressValidator');
+
+ if(!isset($config_data['notify_email']) ||
!$config_data['notify_email'])
+ {
+ throw new Exception("notify_accounting_by_email: missing
'notify_email' in config for this catch schema:{$schema_text}");
+ }
+ else if( !$validator->check_email_address($config_data['notify_email'])
)
+ {
+ throw new Exception("notify_accounting_by_email: not a valid
'notify_email' in config for this catch schema:{$schema_text}");
+ }
+
+ $to_array = array
+ (
+ $config_data['notify_email']
+ );
+
+ $socommon = CreateObject('property.socommon');
+ $prefs = $socommon->create_preferences('property',$user_id);
+//_debug_array($prefs);
+ if ($validator->check_email_address($prefs['email']))
+ {
+ $account_name = $GLOBALS['phpgw']->accounts->id2name($user_id);
+ // avoid problems with the delimiter in the send class
+ if(strpos($account_name,','))
+ {
+ $_account_name = explode(',', $account_name);
+ $account_name = ltrim($_account_name[1]) . ' ' .
$_account_name[0];
+ }
+ $from_email = "{$account_name}<{$prefs['email']}>";
+
+ $to_array[] = $from_email;
+ }
+
+ if (!is_object($GLOBALS['phpgw']->send))
+ {
+ $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
+ }
+
+ $_to = implode(';',$to_array);
+
+ $from_name = 'noreply';
+ $from_email = isset($from_email) && $from_email ? $from_email :
"{$from_name}<address@hidden>";
+ $cc = '';
+ $bcc ='';
+ $subject = "{$schema_text}::{$id}";
+
+ /*
+ $_link_to_item = 'http://'.
$GLOBALS['phpgw_info']['server']['hostname'] .
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'property.uientity.view',
+ 'type'
=> 'catch',
+ 'entity_id'
=> $entity_id,
+ 'cat_id'
=> $cat_id,
+ 'id'
=> $id
+ ));
+ */
+ //$body = "<a href='{$_link_to_item}'>{$subject}</a>";
+ unset($_link_to_item);
+
+ $body ="<H2>Det er registrert ny post i {$schema_text}</H2>";
+
+ $jasper_id = isset($config_data['jasper_id']) &&
$config_data['jasper_id'] ? $config_data['jasper_id'] : 0;
+
+ $attachments = array();
+
+ if(!$jasper_id)
+ {
+ $this->receipt['error'][]=array('msg'=>lang('notify_by_email:
missing "jasper_id" in config for catch %1 schema', $schema_text));
+ }
+ else
+ {
+ $jasper_parameters = '';
+ $_parameters = array();
+
+ $_parameters[] = "id|{$id}";
+ $jasper_parameters = '"' . implode(';', $_parameters) . '"';
+
+ unset($_parameters);
+
+ $output_type = 'PDF';
+ $values_jasper =
execMethod('property.bojasper.read_single', $jasper_id);
+ $report_source =
"{$GLOBALS['phpgw_info']['server']['files_dir']}/property/jasper/{$jasper_id}/{$values_jasper['file_name']}";
+ $jasper_wrapper =
CreateObject('phpgwapi.jasper_wrapper');
+
+ //_debug_array($jasper_parameters);
+ //_debug_array($output_type);
+ //_debug_array($report_source);die();
+
+ try
+ {
+ $report = $jasper_wrapper->execute($jasper_parameters,
$output_type, $report_source, true);
+ }
+ catch(Exception $e)
+ {
+ $error = $e->getMessage();
+ echo "<H1>{$error}</H1>";
+ }
+
+ $jasper_fname =
tempnam($GLOBALS['phpgw_info']['server']['temp_dir'], 'PDF_') . '.pdf';
+ file_put_contents($jasper_fname, $report['content'], LOCK_EX);
+
+ $attachments[] = array
+ (
+ 'file' => $jasper_fname,
+ 'name' => $report['filename'],
+ 'type' => $report['mime']
+ );
+
+ if($attachments)
+ {
+ $body .= "</br>Se vedlegg";
+ }
+ }
+
+ if ($GLOBALS['phpgw']->send->msg('email', $_to, $subject,
stripslashes($body), '', $cc, $bcc, $from_email, $from_name, 'html', '',
$attachments , true))
+ {
+ $this->receipt['message'][]=array('msg'=> "email notification
sent to: {$_to}");
+ }
+ if( isset($jasper_fname) && is_file($jasper_fname) )
+ {
+ unlink($jasper_fname);
+ }
Modified:
branches/Version-1_0-branch/catch/inc/custom/default/update_location_at_record.php
===================================================================
---
branches/Version-1_0-branch/catch/inc/custom/default/update_location_at_record.php
2011-09-30 11:59:03 UTC (rev 7759)
+++
branches/Version-1_0-branch/catch/inc/custom/default/update_location_at_record.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -12,8 +12,16 @@
$target_table =
"fm_{$this->type_app[$this->type]}_{$entity_id}_{$cat_id}";
}
+ $sql = "SELECT id FROM {$target_table} WHERE (location_code is
NULL OR location_code = '')";
+ $metadata = $this->db->metadata($target_table);
+
+ if(isset($metadata['target_id']))
+ {
+ $sql .= 'OR (target_id IS NOT NULL AND location_id IS
NOT NULL AND p_num IS NULL)';
+ }
+
$ids = array();
- $this->db->query("SELECT id FROM $target_table WHERE
(location_code is NULL OR location_code = '') OR (target_id IS NOT NULL AND
location_id IS NOT NULL AND p_num IS NULL)",__LINE__,__FILE__);
+ $this->db->query($sql,__LINE__,__FILE__);
while ($this->db->next_record())
{
$ids[] = $this->db->f('id');
Modified: branches/Version-1_0-branch/catch/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/setup.inc.php 2011-09-30
11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/catch/setup/setup.inc.php 2011-09-30
12:08:19 UTC (rev 7760)
@@ -27,7 +27,7 @@
*/
$setup_info['catch']['name'] = 'catch';
- $setup_info['catch']['version'] = '0.9.17.510';
+ $setup_info['catch']['version'] = '0.9.17.511';
$setup_info['catch']['app_order'] = 20;
$setup_info['catch']['enable'] = 1;
$setup_info['catch']['globals_checked'] = True;
Modified: branches/Version-1_0-branch/catch/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_current.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/catch/setup/tables_current.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -111,7 +111,7 @@
'input_type' => array('type' => 'varchar',
'precision' => 10,'nullable' => False),
'name' => array('type' => 'varchar',
'precision' => 50,'nullable' => False),
'descr' => array('type' => 'varchar',
'precision' => 200,'nullable' => true),
- 'value' => array('type' => 'varchar',
'precision' => 1000,'nullable' => False)
+ 'value' => array('type' => 'varchar',
'precision' => 1000,'nullable' => true)
),
'pk' => array('type_id','id'),
'fk' => array(),
Modified: branches/Version-1_0-branch/catch/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/catch/setup/tables_update.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/catch/setup/tables_update.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -324,3 +324,23 @@
return $GLOBALS['setup_info']['catch']['currentver'];
}
}
+
+ /**
+ * Update catch version from 0.9.17.510 to 0.9.17.511
+ * Allow value is null
+ *
+ */
+
+ $test[] = '0.9.17.510';
+ function catch_upgrade0_9_17_510()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_catch_config_attrib','value',array('type'
=> 'varchar', 'precision' => 1000,'nullable' => true));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['catch']['currentver'] =
'0.9.17.511';
+ return $GLOBALS['setup_info']['catch']['currentver'];
+ }
+ }
Modified:
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -89,14 +89,22 @@
{
$id = (int)$id;
- $sql = "SELECT p.* FROM controller_control_group p WHERE p.id =
" . $id;
+ $joins = " {$this->left_join} fm_building_part ON
(p.building_part_id = CAST(fm_building_part.id AS INT))";
+ $joins .= " {$this->left_join} controller_procedure ON
(p.procedure_id = controller_procedure.id)";
+ $joins .= " {$this->left_join} controller_control_area ON
(p.control_area_id = controller_control_area.id)";
+
+ $sql = "SELECT p.*, fm_building_part.descr AS
building_part_descr, controller_procedure.title as procedure_title,
controller_control_area.title as control_area_name FROM
controller_control_group p {$joins} WHERE p.id = " . $id;
$this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
$this->db->next_record();
$control_group = new
controller_control_group($this->unmarshal($this->db->f('id', true), 'int'));
$control_group->set_group_name($this->unmarshal($this->db->f('group_name',
true), 'string'));
-
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id',
true), 'string'));
-
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id',
true), 'string'));
+
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'),
'int'));
+
$control_group->set_procedure_name($this->unmarshal($this->db->f('procedure_title'),
'string'));
+
$control_group->set_control_area_id($this->unmarshal($this->db->f('control_area_id'),
'int'));
+
$control_group->set_control_area_name($this->unmarshal($this->db->f('control_area_name'),
'string'));
+
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
'int'));
+
$control_group->set_building_part_descr($this->unmarshal($this->db->f('building_part_descr'),
'string'));
return $control_group;
}
@@ -145,15 +153,25 @@
return $results;
}
- function get_building_part_select_array()
+ function get_building_part_select_array($selected_building_part_id)
{
$results = array();
$results[] = array('id' => 0,'name' => lang('Not
selected'));
$this->db->query("SELECT id, descr as name FROM
fm_building_part ORDER BY id ASC", __LINE__, __FILE__);
while ($this->db->next_record())
{
- $results[] = array('id' => $this->db->f('id',
false),
- 'name' =>
$this->db->f('name', false));
+ $curr_id = $this->db->f('id', false);
+ if($selected_building_part_id &&
$selected_building_part_id > 0 && $selected_building_part_id == $curr_id)
+ {
+ $results[] = array('id' =>
$this->db->f('id', false),
+ 'name' =>
$this->db->f('name', false),
+
'selected' => 'yes');
+ }
+ else
+ {
+ $results[] = array('id' =>
$this->db->f('id', false),
+ 'name' =>
$this->db->f('name', false));
+ }
}
return $results;
}
Modified:
branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/controller/inc/class.uicontrol_group.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -224,25 +224,47 @@
foreach ($control_area_array as $control_area)
{
- $control_area_options[] = array
- (
- 'id' =>
$control_area->get_id(),
- 'name' =>
$control_area->get_title()
-
- );
+
if($control_group->get_control_area_id() && $control_area->get_id() ==
$control_group->get_control_area_id())
+ {
+ $control_area_options[] = array
+ (
+ 'id' =>
$control_area->get_id(),
+ 'name' =>
$control_area->get_title(),
+ 'selected' => 'yes'
+ );
+ }
+ else
+ {
+ $control_area_options[] = array
+ (
+ 'id' =>
$control_area->get_id(),
+ 'name' =>
$control_area->get_title()
+ );
+ }
}
foreach ($procedure_array as $procedure)
{
- $procedure_options[] = array
- (
- 'id' => $procedure->get_id(),
- 'name' =>
$procedure->get_title()
-
- );
+ if($control_group->get_procedure_id()
&& $procedure->get_id() == $control_group->get_procedure_id())
+ {
+ $procedure_options[] = array
+ (
+ 'id' =>
$procedure->get_id(),
+ 'name' =>
$procedure->get_title(),
+ 'selected' => 'yes'
+ );
+ }
+ else
+ {
+ $procedure_options[] = array
+ (
+ 'id' =>
$procedure->get_id(),
+ 'name' =>
$procedure->get_title()
+ );
+ }
}
- $building_part_options =
$this->so->get_building_part_select_array();
+ $building_part_options =
$this->so->get_building_part_select_array($control_group->get_building_part_id());
$control_group_array =
$control_group->toArray();
@@ -254,7 +276,7 @@
'procedure'
=> array('options' => $procedure_options),
'control_area' =>
array('options' => $control_area_options),
'control_group' =>
$control_group_array,
- 'building_part' =>
array('options' => $building_part_options),
+ 'building_part' =>
array('building_part_options' => $building_part_options),
);
@@ -535,6 +557,7 @@
}
$control_group_array =
$control_group->toArray();
+ var_dump($control_group_array);
$data = array
(
Modified:
branches/Version-1_0-branch/controller/templates/base/control_group.xsl
===================================================================
--- branches/Version-1_0-branch/controller/templates/base/control_group.xsl
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/controller/templates/base/control_group.xsl
2011-09-30 12:08:19 UTC (rev 7760)
@@ -39,7 +39,7 @@
</select>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="control_group/control_area_id" />
+ <xsl:value-of
select="control_group/control_area_name" />
</xsl:otherwise>
</xsl:choose>
</dd>
@@ -54,7 +54,7 @@
</select>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="control_group/procedure_id" />
+ <xsl:value-of
select="control_group/procedure_name" />
</xsl:otherwise>
</xsl:choose>
</dd>
@@ -65,11 +65,11 @@
<xsl:choose>
<xsl:when test="editable">
<select
id="building_part" name="building_part">
-
<xsl:apply-templates select="building_part/options"/>
+
<xsl:apply-templates select="building_part/building_part_options"/>
</select>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of
select="control_group/building_part_descr" />
+ <xsl:value-of
select="control_group/building_part_id" /> - <xsl:value-of
select="control_group/building_part_descr" />
</xsl:otherwise>
</xsl:choose>
</dd>
@@ -105,3 +105,12 @@
</option>
</xsl:template>
+<xsl:template match="building_part_options">
+ <option value="{id}">
+ <xsl:if test="selected != 0">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of select="id"/> - <xsl:value-of
disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
+
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.jasper_wrapper.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.jasper_wrapper.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.jasper_wrapper.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -99,7 +99,7 @@
* unique
*/
- public function execute($parameters = '', $output_type,
$report_source)
+ public function execute($parameters = '', $output_type,
$report_source, $return_content = false)
{
if( !$parameters )
{
@@ -255,14 +255,26 @@
$mime=
'application/octet-stream';
$filename
="{$report_name}.dat";
}
-
- $browser = CreateObject('phpgwapi.browser');
-
$browser->content_header($filename,$mime,strlen($output));
- echo $output;
}
if(isset($error) && $error)
{
throw new Exception($error);
}
+ if($return_content)
+ {
+ return array
+ (
+ 'content' => $output,
+ 'mime' => $mime,
+ 'filename' => $filename
+ );
+ }
+ else
+ {
+ $browser = CreateObject('phpgwapi.browser');
+
$browser->content_header($filename,$mime,strlen($output));
+ echo $output;
+ return false;
+ }
}
}
Modified: branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -1429,7 +1429,9 @@
'values_view_order'
=> $values_hour,
'sms_data'
=> $sms_data,
'use_yui_table'
=> true,
- 'contact_data'
=> $contact_data
+ 'contact_data'
=> $contact_data,
+ 'order_footer_header'
=> $this->config->config_data['order_footer_header'],
+ 'order_footer'
=> $this->config->config_data['order_footer']
);
if($send_order && !$to_email)
Modified:
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
---
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2011-09-30 11:59:03 UTC (rev 7759)
+++
branches/Version-1_0-branch/property/inc/cron/default/Import_fra_basware_X205.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -76,6 +76,8 @@
$this->like = &
$this->db->like;
$this->dateformat =
$this->db->date_format();
$this->datetimeformat = $this->db->datetime_format();
+ $this->config =
CreateObject('phpgwapi.config','property');
+ $this->config->read();
}
function pre_run($data='')
@@ -147,9 +149,8 @@
public function execute($cron='')
{
- $config = CreateObject('phpgwapi.config','property');
- $config->read();
- $dirname = $config->config_data['import_path'];
+ $this->get_files();
+ $dirname = $this->config->config_data['import_path'];
// prevent path traversal
if ( preg_match('/\./', $dirname)
|| !is_dir($dirname) )
@@ -224,8 +225,91 @@
}
- function import($file)
+ protected function get_files()
{
+ $server =
$this->config->config_data['invoice_ftp_host'];
+ $user =
$this->config->config_data['invoice_ftp_user'];
+ $password =
$this->config->config_data['invoice_ftp_password'];
+ $directory_remote =
rtrim($this->config->config_data['invoice_ftp_import_basedir'],'/');
+ $directory_local =
rtrim($this->config->config_data['import_path'],'/');
+ $port = 22;
+
+ $debug = false;
+
+ if (!function_exists("ssh2_connect"))
+ {
+ die("function ssh2_connect doesn't exist");
+ }
+ if(!($connection = ssh2_connect("$server", $port)))
+ {
+ echo "fail: unable to establish connection\n";
+ }
+ else
+ {
+ // try to authenticate with username root,
password secretpassword
+ if(!ssh2_auth_password($connection, $user,
$password))
+ {
+ echo "fail: unable to authenticate\n";
+ }
+ else
+ {
+ // allright, we're in!
+ echo "okay: logged in...<br/>";
+
+ // execute a command
+ if (!($stream = ssh2_exec($connection,
"ls -al {$directory_remote}" )))
+ {
+ echo "fail: unable to execute
command\n";
+ }
+ else if ($debug)
+ {
+ // collect returning data from
command
+ stream_set_blocking($stream,
true);
+ $data = "";
+ while ($buf =
fread($stream,4096))
+ {
+ $data .= $buf;
+ }
+ fclose($stream);
+ _debug_array($data);
+ }
+ else
+ {
+ $com ="ls {$directory_remote}";
+ $stream =
ssh2_exec($connection, $com);
+
stream_set_blocking($stream,true);
+ $cmd = fread($stream,4096);
+ $arr=explode("\n",$cmd);
+ $total_files=count($arr);
+ $sftp = ssh2_sftp($connection);
+ // _debug_array($arr);
+ for($i=0;$i<$total_files;$i++)
+ {
+
$file_name=trim($arr[$i]);
+ if($file_name!='' &&
stripos( $file_name, 'x205' ) === 0)
+ {
+ $file_remote =
"{$directory_remote}/{$file_name}";
+ $file_local =
"{$directory_local}/{$file_name}";
+
if(ssh2_scp_recv($connection, $file_remote,$file_local))
+ {
+ echo
"File remote: ".$file_remote." was copied to local: $file_local<br/>";
+ if(
ssh2_sftp_rename ($sftp, $file_remote,
"{$directory_remote}/archive/{$file_name}" ))
+ {
+
echo "File remote: ".$file_remote." was moved to remote:
{$directory_remote}/archive/{$file_name}<br/>";
+ }
+ }
+ }
+ }
+ fclose($stream);
+ }
+ }
+ }
+
+ }
+
+
+ protected function import($file)
+ {
// $valid_data= False;
$buffer = array();
Modified: branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/property/inc/cron/default/catch_ppc.php
2011-09-30 12:08:19 UTC (rev 7760)
@@ -42,6 +42,7 @@
$this->db = & $GLOBALS['phpgw']->db;
$this->join = & $this->db->join;
$this->like = & $this->db->like;
+ set_time_limit(1000);
}
function pre_run($data = array())
Modified: branches/Version-1_0-branch/property/inc/export/default/Basware_X114
===================================================================
--- branches/Version-1_0-branch/property/inc/export/default/Basware_X114
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/property/inc/export/default/Basware_X114
2011-09-30 12:08:19 UTC (rev 7760)
@@ -40,6 +40,7 @@
var $debug;
var $client_code = 14;
+ protected $connection = false;
function __construct()
{
@@ -356,6 +357,18 @@
$receipt['message'][]= array('msg' =>
$this->transfer_voucher($batchid, $voucher_id, $download, $force_period_year));
}
+ if($this->connection)
+ {
+ switch
($this->config->config_data['invoice_export_method'])
+ {
+ case 'ftp';
+ ftp_quit($this->connection);
+ break;
+ case 'ssh';
+ ssh2_exec($this->connection,
'exit');
+ break;
+ }
+ }
//Lagre melding
if ($download=='on')
{
@@ -745,7 +758,7 @@
}
// -- END
- if( $file_written &&
$this->config->config_data['invoice_export_method'] != 'ftp' )
+ if( $file_written &&
($this->config->config_data['invoice_export_method'] != 'ftp' &&
$this->config->config_data['invoice_export_method'] != 'ssh'))
{
$transfer_ok = true;
}
@@ -837,28 +850,41 @@
protected function
transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
{
-
-
if($this->config->config_data['invoice_export_method']=='ftp')
+
if($this->config->config_data['invoice_export_method']=='ftp' ||
$this->config->config_data['invoice_export_method']=='ssh')
{
- $ftp = $this->phpftp_connect();
+ if(!$connection = $this->connection)
+ {
+ $connection =
$this->phpftp_connect();
+ }
$basedir =
$this->config->config_data['invoice_ftp_basedir'];
if($basedir)
{
- $newfile = $basedir . '/' .
basename($Filnavn);
+ $remote_file = $basedir . '/' .
basename($Filnavn);
}
else
{
- $newfile = basename($Filnavn);
+ $remote_file = basename($Filnavn);
}
- if (ftp_put($ftp,$newfile, $Filnavn,
FTP_BINARY))
+ switch
($this->config->config_data['invoice_export_method'])
{
+ case 'ftp';
+ $transfer_ok =
ftp_put($connection,$remote_file, $Filnavn, FTP_BINARY);
+ break;
+ case 'ssh';
+ $transfer_ok =
ssh2_scp_send($connection, $Filnavn, $remote_file );
+ break;
+ default:
+ $transfer_ok = false;
+
+ }
+ if ($send_ok)
+ {
for
($i=0;$i<count($tranfser_bilag);$i++)
{
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice
pre_transferred %1',basename($Filnavn)));
}
- $transfer_ok = True;
}
else
{
@@ -866,33 +892,54 @@
{
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to
pre_transfere %1 to agresso',basename($Filnavn)));
}
- $transfer_ok = False;
}
if(!$transfer_ok)
{
unlink($Filnavn);
}
-
- ftp_quit($ftp);
}
return $transfer_ok;
}
protected function phpftp_connect()
{
- $host = $this->config->config_data['invoice_ftp_host'];
- $user = $this->config->config_data['invoice_ftp_user'];
- $pass =
$this->config->config_data['invoice_ftp_password'];
+ $server =
$this->config->config_data['invoice_ftp_host'];
+ $user =
$this->config->config_data['invoice_ftp_user'];
+ $password =
$this->config->config_data['invoice_ftp_password'];
+ $port = 22;
-// echo "connecting to $host with $user and $pass\n <br>";
- $ftp = ftp_connect($host);
- if($ftp)
+ switch
($this->config->config_data['invoice_export_method'])
{
- if (ftp_login($ftp,$user,$pass))
- {
- return $ftp;
- }
+ 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/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/config.tpl
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/property/templates/base/config.tpl
2011-09-30 12:08:19 UTC (rev 7760)
@@ -97,6 +97,7 @@
<select
name="newsettings[invoice_export_method]">
<option value="local"
{selected_invoice_export_method_local}>Local</option>
<option value="ftp"
{selected_invoice_export_method_ftp}>Local and ftp</option>
+ <option value="ssh"
{selected_invoice_export_method_ssh}>Local and ssh</option>
</select>
</td>
</tr>
@@ -113,9 +114,13 @@
<td><input type ="password"
name="newsettings[invoice_ftp_password]"
value="{value_invoice_ftp_password}"></td>
</tr>
<tr class="row_on">
-
<td>{lang_invoice_ftp_host_basedir_with_NO_trailing_slash}:</td>
+
<td>{lang_invoice_ftp_host_export_basedir_with_NO_trailing_slash}:</td>
<td><input name="newsettings[invoice_ftp_basedir]"
value="{value_invoice_ftp_basedir}"></td>
</tr>
+ <tr class="row_on">
+
<td>{lang_invoice_ftp_host_import_basedir_with_NO_trailing_slash}:</td>
+ <td><input
name="newsettings[invoice_ftp_import_basedir]"
value="{value_invoice_ftp_import_basedir}"></td>
+ </tr>
</tr>
<tr class="row_off">
<td>{lang_dimb_responsible_1}:</td>
Modified: branches/Version-1_0-branch/property/templates/base/wo_hour.xsl
===================================================================
--- branches/Version-1_0-branch/property/templates/base/wo_hour.xsl
2011-09-30 11:59:03 UTC (rev 7759)
+++ branches/Version-1_0-branch/property/templates/base/wo_hour.xsl
2011-09-30 12:08:19 UTC (rev 7760)
@@ -927,6 +927,26 @@
<xsl:apply-templates
select="sms_data"/>
</xsl:when>
</xsl:choose>
+
+ <xsl:choose>
+ <xsl:when
test="order_footer_header!=''">
+ <tr>
+ <td>
+ <br/>
+
<h4><xsl:value-of select="order_footer_header"/></h4>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="order_footer!=''">
+ <tr>
+ <td>
+ <xsl:value-of
select="order_footer"/>
+ </td>
+ </tr>
+ </xsl:when>
+ </xsl:choose>
</table>
</font>
</xsl:template>
@@ -2441,6 +2461,7 @@
<xsl:template match="sms_data">
<tr>
<td>
+ <br/>
<xsl:value-of select="heading"/>
</td>
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [7760] Merge 7753:7759 from trunk,
Sigurd Nes <=