[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16312] more on eventplanner
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16312] more on eventplanner |
Date: |
Wed, 15 Feb 2017 10:51:32 -0500 (EST) |
Revision: 16312
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16312
Author: sigurdne
Date: 2017-02-15 10:51:32 -0500 (Wed, 15 Feb 2017)
Log Message:
-----------
more on eventplanner
Modified Paths:
--------------
trunk/eventplannerfrontend/inc/class.hook_helper.inc.php
trunk/property/inc/cron/default/Import_fra_agresso_X205_BK.php
Modified: trunk/eventplannerfrontend/inc/class.hook_helper.inc.php
===================================================================
--- trunk/eventplannerfrontend/inc/class.hook_helper.inc.php 2017-02-15
15:51:06 UTC (rev 16311)
+++ trunk/eventplannerfrontend/inc/class.hook_helper.inc.php 2017-02-15
15:51:32 UTC (rev 16312)
@@ -195,7 +195,7 @@
/**
* hook to add account
*
- * this function is a wrapper function for emailadmin
+ * this function is a wrapper function for eventplanner
*
* @param _hookValues contains the hook values as array
* @returns nothing
Modified: trunk/property/inc/cron/default/Import_fra_agresso_X205_BK.php
===================================================================
--- trunk/property/inc/cron/default/Import_fra_agresso_X205_BK.php
2017-02-15 15:51:06 UTC (rev 16311)
+++ trunk/property/inc/cron/default/Import_fra_agresso_X205_BK.php
2017-02-15 15:51:32 UTC (rev 16312)
@@ -65,18 +65,6 @@
$this->dateformat = $this->db->date_format();
$this->datetimeformat = $this->db->datetime_format();
$this->config = CreateObject('admin.soconfig',
$GLOBALS['phpgw']->locations->get_id('property', '.invoice'));
- $this->send = CreateObject('phpgwapi.send');
-
- $now = time() +
(int)$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'] *
3600;
-
- $now_hour = date('G', $now);
- $now_day = date('N', $now);
-
- if (($now_hour < 6 || $now_hour > 17) || $now_day > 5)
- {
-
- $this->skip_email = true;
- }
}
public function execute()
@@ -154,77 +142,9 @@
$this->receipt['error'][] = array('msg' =>
"Arkiv katalog '{$dirname}/arkiv/' ikke er ikke skrivbar - kontakt
systemadminstrator for å korrigere");
}
- $this->remind();
}
- protected function remind()
- {
- if
(!isset($GLOBALS['phpgw_info']['server']['smtp_server']) ||
!$GLOBALS['phpgw_info']['server']['smtp_server'])
- {
- return;
- }
-
- if ($this->skip_email || $this->debug)
- {
- return;
- }
-
- // max. one mail each day
- if
((int)$GLOBALS['phpgw_info']['server']['invoice_mail_reminder_time'] < (time()
- (3600 * 24)))
- {
- $toarray = array();
- $sql = 'SELECT DISTINCT oppsynsmannid as
responsible FROM fm_ecobilag WHERE oppsynsigndato IS NULL AND oppsynsmannid IS
NOT NULL AND saksigndato IS NULL';
- $this->db->query($sql, __LINE__, __FILE__);
- while ($this->db->next_record())
- {
- $toarray[$this->db->f('responsible')] =
true;
- }
-/*
- $sql = 'SELECT DISTINCT saksbehandlerid as
responsible FROM fm_ecobilag WHERE saksigndato IS NULL AND saksbehandlerid IS
NOT NULL AND oppsynsigndato IS NULL';
- $this->db->query($sql, __LINE__, __FILE__);
- while ($this->db->next_record())
- {
- $toarray[$this->db->f('responsible')] =
true;
- }
- $sql = 'SELECT DISTINCT budsjettansvarligid as
responsible FROM fm_ecobilag WHERE saksigndato IS NOT NULL AND budsjettsigndato
IS NULL AND budsjettansvarligid IS NOT NULL';
- $this->db->query($sql, __LINE__, __FILE__);
-
- while ($this->db->next_record())
- {
- $toarray[$this->db->f('responsible')] =
true;
- }
-*/
- $subject = 'Du har faktura til behandling';
-
-
- $from = "Ikke svar<address@hidden>";
-
- foreach ($toarray as $lid => $dummy)
- {
- $prefs =
$this->bocommon->create_preferences('property',
$GLOBALS['phpgw']->accounts->name2id($lid));
- if (isset($prefs['email']) &&
$prefs['email'])
- {
- $body = '<a href ="' .
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiinvoice2.index',
- 'voucher_id' =>
$bilagsnr, 'user_lid' => $lid), false, true) . '">Link til
fakturabehandling</a>';
- try
- {
- $rc =
$this->send->msg('email', $prefs['email'], $subject, stripslashes($body), '',
'', '', $from, '', 'html');
- }
- catch (phpmailerException $e)
- {
-
$this->receipt['error'][] = array('msg' => $e->getMessage());
- }
- }
- }
- // save time of mail, to not send to many mails
- $config = createObject('phpgwapi.config',
'phpgwapi');
- $config->read_repository();
- $config->value('invoice_mail_reminder_time',
time());
- $config->save_repository();
- }
- }
-
protected function get_files()
{
$method =
$this->config->config_data['common']['method'];
@@ -315,119 +235,6 @@
}
}
- protected function get_files_old()
- {
- $method =
$this->config->config_data['common']['method'];
- if($method == 'local')
- {
- return;
- }
-
- $server = $this->config->config_data['common']['host'];
- $user = $this->config->config_data['common']['user'];
- $password =
$this->config->config_data['common']['password'];
- $directory_remote =
rtrim($this->config->config_data['import']['remote_basedir'], '/');
- $directory_local =
rtrim($this->config->config_data['import']['local_path'], '/');
- $port = 22;
-
- 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/>";
-
- // Enter "sftp" mode
- $sftp = @ssh2_sftp($connection);
-
- // Scan directory
- $files = array();
- echo "Scanning
{$directory_remote}<br/>";
- $dir =
"ssh2.sftp://$sftp$directory_remote";
- $handle = opendir($dir);
- while (false !== ($file =
readdir($handle)))
- {
- if (is_dir($file))
- {
- echo "Directory:
$file<br/>";
- continue;
- }
-
- /*
if ($this->debug)
- {
- $size =
filesize("ssh2.sftp://$sftp$directory_remote/$file");
- echo "File $file Size:
$size<br/>";
-
- $stream =
@fopen("ssh2.sftp://$sftp$directory_remote/$file", 'r');
- $contents = fread($stream,
filesize("ssh2.sftp://$sftp$directory_remote/$file"));
- @fclose($stream);
- echo "CONTENTS:
$contents<br/><br/>";
- }
- */
- $files[] = $file;
- }
-
- if ($this->debug)
- {
- _debug_array($files);
- }
- else
- {
- foreach ($files as $file_name)
- {
-
if(preg_match('/^X205/i', (string)$file_name ))
- {
- //
_debug_array($file_name);
- $file_remote =
"{$directory_remote}/{$file_name}";
- $file_local =
"{$directory_local}/{$file_name}";
-
- $stream =
fopen("ssh2.sftp://$sftp$file_remote", 'r');
- $contents =
fread($stream, filesize("ssh2.sftp://$sftp$file_remote"));
- fclose($stream);
-
- $fp =
fopen($file_local, "wb");
- fwrite($fp,
$contents);
-
- if (fclose($fp))
- {
- echo
"File remote: {$file_remote} was copied to local: $file_local<br/>";
- if
(ssh2_sftp_unlink($sftp, "{$directory_remote}/arkiv/{$file_name}"))
- {
-
echo "Deleted duplicate File remote:
{$directory_remote}/arkiv/{$file_name}<br/>";
- }
- if
(ssh2_sftp_rename($sftp, $file_remote,
"{$directory_remote}/arkiv/{$file_name}"))
- {
-
echo "File remote: {$file_remote} was moved to remote:
{$directory_remote}/arkiv/{$file_name}<br/>";
- }
- else
- {
-
echo "ERROR! File remote: {$file_remote} failed to move to remote:
{$directory_remote}/arkiv/{$file_name}<br/>";
-
if (unlink($file_local))
-
{
-
echo "Lokal file was deleted: {$file_local}<br/>";
-
}
- }
- }
- }
- }
- }
- }
- }
- }
-
protected function check_storage_dir($files_path)
{
if (is_dir($files_path) && is_writable($files_path) &&
is_readable($files_path) )
@@ -644,28 +451,6 @@
$this->receipt['error'][] = array('msg'
=> "Importeres ikke: Ikke gyldig LeverandørId: {$_data['SUPPLIER.CODE']},
Skanningreferanse: {$_data['SCANNINGNO']}, FakturaNr: {$fakturanr}, fil:
{$file}");
$this->skip_import = true;
- $to =
isset($this->config->config_data['import']['email_on_error']) &&
$this->config->config_data['import']['email_on_error'] ?
$this->config->config_data['import']['email_on_error'] : '';
-
- if ($to && !$this->skip_email)
- {
- $from = "Ikke
svar<address@hidden>";
- $body = "Ikke gyldig
leverandør, id: {$_data['SUPPLIER.CODE']}</br>";
- $body .= '<a href ="' .
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uigeneric.edit',
- 'appname' =>
'property', 'type' => 'vendor'), false, true) . '">Link til å legge inn ny
leverandør</a>';
-
- try
- {
- $rc =
$this->send->msg('email', $to, 'Ikke gyldig leverandør ved import av faktura
til Portico', $body, '', '', '', $from, '', 'html');
- if ($rc)
- {
-
$this->receipt['message'][] = array('msg' => "epost sendt til {$to}");
- }
- }
- catch (phpmailerException $e)
- {
-
$this->receipt['error'][] = array('msg' => $e->getMessage());
- }
- }
}
else if ($order_info['vendor_id'] != $vendor_id)
{
@@ -735,34 +520,6 @@
}
}
- if ($order_info['toarray'] &&
(!$this->skip_email || !$this->debug))
- {
-
- $from = "Ikke svar<address@hidden>";
-
- $to = implode(';',
$order_info['toarray']);
-
- if
(isset($GLOBALS['phpgw_info']['server']['smtp_server']) &&
$GLOBALS['phpgw_info']['server']['smtp_server'])
- {
- $subject = 'Ny faktura venter
på behandling';
- $body = '<a href ="' .
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiinvoice2.index',
- 'voucher_id' =>
$bilagsnr, 'query' => $bilagsnr, 'user_lid' => 'all'), false, true) . '">Link
til fakturabehandling</a>';
-
- try
- {
- $rc =
$this->send->msg('email', $to, $subject, stripslashes($body), '', $cc, $bcc,
$from, '', 'html');
- }
- catch (phpmailerException $e)
- {
-
$this->receipt['error'][] = array('msg' => $e->getMessage());
- }
- }
- else
- {
- $this->receipt['error'][] =
array('msg' => lang('SMTP server is not set! (admin section)'));
- }
- }
-
$GLOBALS['phpgw']->db->Exception_On_Error =
true;
try
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16312] more on eventplanner,
sigurdne <=