[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/cron import_from_scanner.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] property/inc/cron import_from_scanner.php |
Date: |
Sun, 07 Oct 2007 15:09:33 +0000 |
CVSROOT: /sources/phpgroupware
Module name: property
Changes by: Sigurd Nes <sigurdne> 07/10/07 15:09:33
Modified files:
inc/cron : import_from_scanner.php
Log message:
more work on scanner integration
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/cron/import_from_scanner.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
Patches:
Index: import_from_scanner.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/cron/import_from_scanner.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- import_from_scanner.php 6 Oct 2007 17:11:48 -0000 1.2
+++ import_from_scanner.php 7 Oct 2007 15:09:33 -0000 1.3
@@ -24,7 +24,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package property
* @subpackage custom
- * @version $Id: import_from_scanner.php,v 1.2 2007/10/06 17:11:48
sigurdne Exp $
+ * @version $Id: import_from_scanner.php,v 1.3 2007/10/07 15:09:33
sigurdne Exp $
*/
/**
@@ -46,6 +46,7 @@
var $bypass = False; // bypass location check (only for
debugging)
var $default_user_id = 6;
var $default_user_last_name = 'Aspevik';
+ var $mail_receipt = True;
var $function_name = 'import_from_scanner';
var $header = array('type','descr','target','user');
@@ -56,7 +57,7 @@
$this->vfs =
CreateObject('phpgwapi.vfs');
$this->rootdir = $this->vfs->basedir;
$this->fakebase = $this->vfs->fakebase;
- $this->db = & $GLOBALS['phpgw']->db;
+ $this->db = clone($GLOBALS['phpgw']->db);
}
@@ -144,7 +145,7 @@
'message' =>
$this->receipt['message'],
'lang_confirm_msg' =>
$lang_confirm_msg,
'lang_yes' =>
$lang_yes,
- 'lang_yes_statustext' => 'Organisere
tegninger i register og pa disk',
+ 'lang_yes_statustext' => 'Legger til
dokumenter fra scanner',
'lang_no_statustext' => 'tilbake',
'lang_no' =>
lang('no'),
'lang_done' =>
'Avbryt',
@@ -195,7 +196,7 @@
}
}
-
$values['category_id'] = '';
+
$values['category_id'] = 2;
$values['values_date'] = time();
$values['version'] = '1';
$values['coordinator'] = '';
@@ -208,7 +209,6 @@
$this->create_loc1_dir($values['loc1']);
$this->copy_files($values);
}
-
}
if($file_entry['type'] ==
'Reklamasjon')
@@ -250,15 +250,30 @@
}
}
}
- }
- }
-//die();
- if(!$cron)
+ if($this->mail_receipt)
{
-
$this->confirm($execute=false,$done=True);
+ $prefs =
$this->bocommon->create_preferences($this->currentapp,$file_entry['user_id']);
+ if
(strlen($prefs['email'])> (strlen($members[$i]['account_name'])+1))
+ {
+ $subject =
'Resultat fra scanner';
+ $msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
+ $body =
implode('</br>',array_keys($msgbox_data));
+ //, '', $cc,
$bcc,$current_user_address,$current_user_name,
+
+ $to =
$prefs['email'];
+ $rc =
$this->send->msg('email', $to, $subject, stripslashes($body), '', $cc,
$bcc,$current_user_address,$current_user_name,'html');
+ }
+ else
+ {
+
$this->receipt['error'][] = array('msg'=> lang('Your message could not be
sent!'));
+
$this->receipt['error'][] = array('msg'=>lang('This user has not defined an
email address !') . ' : ' . $members[$i]['account_name']);
+ }
}
+ unlink($this->dir . SEP .
$file_entry['file_name'] . $this->suffix);
+ unlink($this->dir . SEP .
$file_entry['file_name'] . $this->meta_suffix);
+
$msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
$insert_values= array(
@@ -273,6 +288,14 @@
$sql = "INSERT INTO fm_cron_log
(cron,cron_date,process,message) "
. "VALUES ($insert_values)";
$this->db->query($sql,__LINE__,__FILE__);
+ $receipt = array();
+ }
+ }
+
+ if(!$cron)
+ {
+
$this->confirm($execute=false,$done=True);
+ }
}
}
@@ -346,6 +369,10 @@
{
$this->receipt['error'][]=array('msg'=>lang('Failed to upload file !'));
}
+ else
+ {
+
$this->receipt['message'][]=array('msg'=>lang('File %1 added to ticket
%2',$file_name . $this->suffix,$id));
+ }
$this->vfs->override_acl = 0;
}
}
@@ -433,17 +460,16 @@
function copy_files($values)
{
- $to_file = $this->fakebase . SEP . 'document' . SEP .
$values['loc1'] . SEP . $values['file_name'];
+ $to_file = $this->fakebase . SEP . 'document' . SEP .
$values['loc1'] . SEP . $values['file_name'] . $this->suffix;
$from_file = $this->dir . SEP . $values['file_name'] .
$this->suffix;
$this->vfs->override_acl = 1;
-//_debug_array($to_file);
if($this->vfs->file_exists(array(
'string' => $to_file,
'relatives' => Array(RELATIVE_NONE)
)))
{
-
$this->receipt['error'][]=array('msg'=>lang('File %1 already
exists!',$values['file_name']));
+
$this->receipt['error'][]=array('msg'=>lang('File %1 already
exists!',$values['file_name'] . $this->suffix));
}
else
{
@@ -453,7 +479,7 @@
'to' => $to_file,
'relatives' => array
(RELATIVE_NONE|VFS_REAL, RELATIVE_ALL))))
{
-
$this->receipt['error'][]=array('msg'=>lang('Failed to copy file !') .
$values['file_name']);
+
$this->receipt['error'][]=array('msg'=>lang('Failed to copy file !') .
$values['file_name'] . $this->suffix);
}
else
{
@@ -468,7 +494,7 @@
}
$insert_values= array(
- $values['file_name'],
+ $values['file_name'] .
$this->suffix,
$values['title'],
'public',
$values['category_id'],
@@ -496,10 +522,7 @@
$this->db->query($sql,__LINE__,__FILE__);
- // unlink($from_file);
-
-
$this->receipt['message'][]=array('msg'=>lang('File %1
copied!',$values['file_name']));
-
$this->receipt['message'][]=array('msg'=>lang('File %1 deleted!',$from_file));
+
$this->receipt['message'][]=array('msg'=>lang('File %1
copied!',$values['file_name'] . $this->suffix));
}
}
$this->vfs->override_acl = 0;