[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, 12 Mar 2007 18:15:14 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/03/12 18:15:14
Modified files:
inc : class.ged_dm.inc.php
Log message:
removed bug : version number did not increment on update after a reject
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.9&r2=1.10
Patches:
Index: class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- class.ged_dm.inc.php 12 Mar 2007 17:54:55 -0000 1.9
+++ class.ged_dm.inc.php 12 Mar 2007 18:15:14 -0000 1.10
@@ -261,9 +261,9 @@
// MEMO gestion des numeros de versions
-
$cur_version=$this->get_current_version($new_version['element_id']);
- $major=$cur_version['major'];
- $minor=$cur_version['minor'];
+
$cur_or_rejected_version=$this->get_current_or_rejected_version($new_version['element_id']);
+ $major=$cur_or_rejected_version['major'];
+ $minor=$cur_or_rejected_version['minor'];
$last_version=$this->get_last_version($new_version['element_id']);
if ($last_version['status'] == 'current' ||
$last_version['status'] == 'rejected' )
@@ -320,10 +320,10 @@
}
- if ($new_version['status']=="current")
+ if ($new_version['status']=="current" &&
$cur_or_rejected_version['status']=="current")
{
$sql_model2="UPDATE %s set status='obsolete' WHERE version_id=%d";
- $sql2=sprintf($sql_model2, $this->tables['versions'],
$cur_version['version_id']);
+ $sql2=sprintf($sql_model2, $this->tables['versions'],
$cur_or_rejected_version['version_id']);
$this->db->query($sql2, __LINE__, __FILE__);
$this->db->unlock();
@@ -620,6 +620,54 @@
return $version;
}
+ function get_current_or_rejected_version($element_id)
+ {
+ if ( $this->debug('get_current_version') )
+ print ( "get_current_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='rejected') ";
+ $sql.="ORDER BY version_id DESC LIMIT 1";
+
+ if ( $this->debug('get_current_version') )
+ print ( "get_current_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_working_version($element_id)
{
if ( $this->debug('get_working_version') )