[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/inc/class.bos_agreement.inc.php, 1.2
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/inc/class.bos_agreement.inc.php, 1.2 |
Date: |
Mon, 14 Jun 2004 21:58:29 +0200 |
Update of /property/inc
Modified Files:
Branch:
class.bos_agreement.inc.php
date: 2004/06/14 19:58:29; author: sigurdne; state: Exp; lines: +124 -11
Log Message:
no message
=====================================================================
Index: property/inc/class.bos_agreement.inc.php
diff -u property/inc/class.bos_agreement.inc.php:1.1
property/inc/class.bos_agreement.inc.php:1.2
--- property/inc/class.bos_agreement.inc.php:1.1 Fri Jun 11 17:08:51 2004
+++ property/inc/class.bos_agreement.inc.php Mon Jun 14 19:58:29 2004
@@ -41,6 +41,9 @@
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
$this->so =
CreateObject($this->currentapp.'.sos_agreement');
$this->bocommon =
CreateObject($this->currentapp.'.bocommon');
+ $this->vfs =
CreateObject('phpgwapi.vfs');
+ $this->rootdir = $this->vfs->basedir;
+ $this->fakebase = $this->vfs->fakebase;
if ($session)
{
@@ -225,13 +228,28 @@
function read_single($data)
{
-
$s_agreement = $this->so->read_single($data);
$dateformat =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$s_agreement['start_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['start_date'],$dateformat);
$s_agreement['end_date'] =
$GLOBALS['phpgw']->common->show_date($s_agreement['end_date'],$dateformat);
- return $this->convert_attribute($s_agreement);
+ $s_agreement = $this->convert_attribute($s_agreement);
+
+ $this->vfs->override_acl = 1;
+
+ $s_agreement['files'] = $this->vfs->ls (array(
+ 'string' => $this->fakebase. '/' .
'service_agreement' . '/' . $data['s_agreement_id'],
+ 'relatives' => array(RELATIVE_NONE)));
+
+ $this->vfs->override_acl = 0;
+
+ if(!$s_agreement['files'][0]['file_id'])
+ {
+ unset($s_agreement['files']);
+ }
+
+ return $s_agreement;
+
}
function read_single_item($data)
@@ -379,25 +397,56 @@
return $values_attribute;
}
- function save($s_agreement,$values_attribute='')
+ function save($values,$values_attribute='',$action='')
{
- $s_agreement['start_date'] =
$this->bocommon->date_to_timestamp($s_agreement['start_date']);
- $s_agreement['end_date'] =
$this->bocommon->date_to_timestamp($s_agreement['end_date']);
+ $values['start_date'] =
$this->bocommon->date_to_timestamp($values['start_date']);
+ $values['end_date'] =
$this->bocommon->date_to_timestamp($values['end_date']);
$values_attribute =
$this->convert_attribute_save($values_attribute);
- if ($s_agreement['s_agreement_id'])
+ if ($action=='edit')
+// if ($values['s_agreement_id'])
{
- if ($s_agreement['s_agreement_id'] != 0)
+ if ($values['s_agreement_id'] != 0)
{
- $s_agreement_id =
$s_agreement['s_agreement_id'];
-
$receipt=$this->so->edit($s_agreement,$values_attribute);
+
$receipt=$this->so->edit($values,$values_attribute);
+
+ if($values['delete_file'])
+ {
+ for
($i=0;$i<count($values['delete_file']);$i++)
+ {
+ $file =
$this->fakebase. SEP . 'service_agreement' . SEP . $values['s_agreement_id'] .
SEP . $values['delete_file'][$i];
+
+
if($this->vfs->file_exists(array(
+
'string' => $file,
+
'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+
$this->vfs->override_acl = 1;
+
+
if(!$this->vfs->rm (array(
+
'string' => $file,
+
'relatives' => array(
+
RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to delete file') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['s_agreement_id'] .
SEP .$values['delete_file'][$i]);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('file deleted') . ' :'.
$this->fakebase. SEP . 'service_agreement'. SEP . $values['id'] . SEP .
$values['delete_file'][$i]);
+ }
+
$this->vfs->override_acl = 0;
+ }
+ }
+ }
}
}
else
{
- $receipt =
$this->so->add($s_agreement,$values_attribute);
+ $receipt =
$this->so->add($values,$values_attribute);
}
return $receipt;
}
@@ -517,5 +566,69 @@
return $column_list;
}
+
+ function request_next_id()
+ {
+ return $this->so->request_next_id();
+ }
+
+ function create_home_dir($receipt='')
+ {
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'service_agreement',
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'service_agreement',
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement');
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement');
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+ return $receipt;
+ }
+
+ function create_document_dir($id='')
+ {
+
+ if(!$this->vfs->file_exists(array(
+ 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
+ 'relatives' => Array(RELATIVE_NONE)
+ )))
+ {
+ $this->vfs->override_acl = 1;
+ if(!$this->vfs->mkdir (array(
+ 'string' => $this->fakebase. SEP .
'service_agreement' . SEP . $id,
+ 'relatives' => array(
+ RELATIVE_NONE
+ )
+ )))
+ {
+
$receipt['error'][]=array('msg'=>lang('failed to create directory') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
+ }
+ else
+ {
+
$receipt['message'][]=array('msg'=>lang('directory created') . ' :'.
$this->fakebase. SEP . 'service_agreement' . SEP . $id);
+ }
+ $this->vfs->override_acl = 0;
+ }
+
+//_debug_array($receipt);
+ return $receipt;
+ }
+
+
}
?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/inc/class.bos_agreement.inc.php, 1.2,
nomail <=