[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged/inc class.ged_dm.inc.php
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged/inc class.ged_dm.inc.php |
Date: |
Mon, 02 Apr 2007 17:49:44 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/04/02 17:49:44
Modified files:
inc : class.ged_dm.inc.php
Log message:
fix : obsoletes the current version even when there is a newer rejected
after.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.18&r2=1.19
Patches:
Index: class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- class.ged_dm.inc.php 2 Apr 2007 17:33:17 -0000 1.18
+++ class.ged_dm.inc.php 2 Apr 2007 17:49:44 -0000 1.19
@@ -692,6 +692,55 @@
return $version;
}
+ function get_current_or_alert_version($element_id)
+ {
+ if ( $this->debug('get_current_or_alert_version') )
+ print ( "get_current_or_alert_version: entering with
element_id=".$element_id."<br>\n");
+
+ $sql="SELECT * FROM ".$this->tables['versions']." ";
+ $sql.="WHERE element_id=".$element_id." ";
+ $sql.="AND ( status='current' OR status='alert') ";
+ $sql.="ORDER BY version_id DESC LIMIT 1";
+
+ if ( $this->debug('get_current_or_alert_version') )
+ print ( "get_current_or_alert_version: ".$sql."<br>\n");
+
+ //print ("<pre>");
+ //print_r($this->db->metadata( $this->tables['versions'] ));
+ //print ("</pre>");
+
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record());
+ {
+
+
$version['validation_date']=$this->db->f('validation_date');
+ $version['url']=$this->db->f('url');
+ $version['size']=$this->db->f('size');
+ $version['status']=$this->db->f('status');
+ $version['creator_id']=$this->db->f('creator_id');
+ $version['creation_date']=$this->db->f('creation_date');
+ $version['minor']=$this->db->f('minor');
+ $version['version_id']=$this->db->f('version_id');
+ $version['element_id']=$this->db->f('element_id');
+ $version['description']=$this->db->f('description');
+
$version['file_extension']=$this->db->f('file_extension');
+ $version['file_name']=$this->db->f('file_name');
+ $version['stored_name']=$this->db->f('stored_name');
+ $version['major']=$this->db->f('major');
+
$version['file_full_path']=$this->datadir.'/'.$version['stored_name'];
+
+
$version['mime_type']=$this->get_mime_type($version['file_extension']);
+
+ }
+
+ $this->db->unlock();
+
+ return $version;
+ }
+
+
function get_current_or_alert_or_rejected_version($element_id)
{
if ( $this->debug('get_current_or_alert_or_rejected_version') )
@@ -1645,9 +1694,10 @@
// Say file is OK
// User must have approval rights on this document
+
function approve_file ( $element_id )
{
-
$current_or_alert_or_rejected_version=$this->get_current_or_alert_or_rejected_version($element_id);
+
$current_or_alert_version=$this->get_current_or_alert_version($element_id);
$working_or_pending_version=$this->get_working_or_pending_version($element_id);
// Need to check if there is a working version
@@ -1656,17 +1706,17 @@
if ($working_or_pending_version['version_id'] )
{
// If there is a previous "current" make it
obsolete
- if
(is_array($current_or_alert_or_rejected_version) )
+ if (is_array($current_or_alert_version) )
{
- if
($current_or_alert_or_rejected_version['version_id'] )
+ if
($current_or_alert_version['version_id'] )
{
- $sql="UPDATE ged_versions set
status='obsolete' WHERE
version_id=".$current_or_alert_or_rejected_version['version_id']." ";
+ $sql="UPDATE ged_versions set
status='obsolete' WHERE version_id=".$current_or_alert_version['version_id']."
";
$sql.="AND status !=
'rejected'";
$this->db->query($sql,
__LINE__, __FILE__);
$this->db->unlock();
// TODO : Set status of
depending documents to alert
-
$versions_referring_to=$this->list_versions_referring_to($current_or_alert_or_rejected_version['version_id']);
+
$versions_referring_to=$this->list_versions_referring_to($current_or_alert_version['version_id']);
if (
is_array($versions_referring_to))
{
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php,
Pascal Vilarem <=
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php, Pascal Vilarem, 2007/04/02
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php, Pascal Vilarem, 2007/04/02
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php, Pascal Vilarem, 2007/04/10
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php, Pascal Vilarem, 2007/04/20
- [Phpgroupware-cvs] ged/inc class.ged_dm.inc.php, Pascal Vilarem, 2007/04/20