phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.flow_cli...


From: Pascal Vilarem
Subject: [Phpgroupware-cvs] ged inc/class.ged_dm.inc.php inc/class.flow_cli...
Date: Thu, 25 Oct 2007 15:54:47 +0000

CVSROOT:        /sources/phpgroupware
Module name:    ged
Changes by:     Pascal Vilarem <maat>   07/10/25 15:54:47

Modified files:
        inc            : class.ged_dm.inc.php class.flow_client.inc.php 
                         class.soflows.inc.php class.ged_ui.inc.php 
        setup          : tables_update.inc.php default_records.inc.php 
                         setup.inc.php tables_current.inc.php 
        templates/base : browse.tpl 

Log message:
        feature activation: workflow in ged 
        (administration ui for workflow will come soon)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_dm.inc.php?cvsroot=phpgroupware&r1=1.49&r2=1.50
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flow_client.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.soflows.inc.php?cvsroot=phpgroupware&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.ged_ui.inc.php?cvsroot=phpgroupware&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_update.inc.php?cvsroot=phpgroupware&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/ged/setup/default_records.inc.php?cvsroot=phpgroupware&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/ged/setup/setup.inc.php?cvsroot=phpgroupware&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/ged/setup/tables_current.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/browse.tpl?cvsroot=phpgroupware&r1=1.8&r2=1.9

Patches:
Index: inc/class.ged_dm.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_dm.inc.php,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- inc/class.ged_dm.inc.php    19 Oct 2007 12:37:16 -0000      1.49
+++ inc/class.ged_dm.inc.php    25 Oct 2007 15:54:46 -0000      1.50
@@ -36,7 +36,7 @@
                // MEMO appartenance � des groupes
                // MEMO $GLOBALS['phpgw']->accounts->memberships[$i][account_id]
                
-               if ( ! $this->admin )
+               if ( $this->admin == false )
                {
                        $or="";
                        $sqlaclbase="( ";
@@ -224,7 +224,7 @@
                        $sep=", ";
                }
 
-               if ( array_key_exists('doc_type', $new_file) && 
$new_file['doc_type'] != '' && $this->admin )
+               if ( array_key_exists('doc_type', $new_file) && 
$new_file['doc_type'] != '' && $this->admin == true )
                {
                        
$sql.=$sep."doc_type='".$this->cleanstr($new_file['doc_type'])."'";
                        $sep=", ";
@@ -233,12 +233,12 @@
                        
$sql.=$sep."reference='".$this->cleanstr($new_file['reference'])."'";
                }
 
-               if ((int)$myelement['project_root'] != 0 && 
$this->is_chrono_type($new_file['doc_type']) && $myelement['doc_type'] != 
$new_file['doc_type'] && $this->admin )
+               if ((int)$myelement['project_root'] != 0 && 
$this->is_chrono_type($new_file['doc_type']) && $myelement['doc_type'] != 
$new_file['doc_type'] && $this->admin == true )
                        
$next_ref=$this->get_next_available_reference($new_file['doc_type'], 
$myelement['project_root'] );
                else
                        $next_ref=$this->cleanstr($new_file['reference']);
 
-               if ( $next_ref != "" && $this->admin )
+               if ( $next_ref != "" && $this->admin == true )
                {
                        $sql.=$sep."reference='".$next_ref."'";
                        $sep=", ";
@@ -897,6 +897,90 @@
                return $version;
        }
        
+       function get_previous_versions_matching_status($version_id,$status)
+       {
+               $version_info=$this->get_version_info($version_id);
+               $element_id=$version_info['element_id'];        
+               $versions=Array();
+
+
+               $sql="SELECT element_id, version_id ";
+               $sql.="FROM ".$this->tables['versions']." ";
+               $sql.="WHERE element_id=".$element_id." ";
+               $sql.="AND version_id < ".$version_id." ";
+               $sql.="AND status='".$status."'";
+
+               $this->db->query($sql, __LINE__, __FILE__);
+
+               $ii=0;
+               while ($this->db->next_record())
+               {
+                       $versions[$ii]['version_id']=$this->db->f('version_id');
+                       $ii++;
+               }
+               
+               $this->db->unlock();
+               return $versions;               
+       }
+       
+       function 
get_versions_linking_and_matching_criteria($version_id,$status, $link_type)
+       {
+               $version_info=$this->get_version_info($version_id);
+               $element_id=$version_info['element_id'];        
+               $versions=Array();
+
+
+               $sql="SELECT ".$this->tables['relations'].".linking_version_id 
AS version_id, ";
+               $sql.=$this->tables['versions'].".element_id AS element_id ";
+               $sql.="FROM ".$this->tables['versions']." JOIN 
".$this->tables['relations']." ";
+               $sql.="ON ".$this->tables['versions'].".version_id = 
".$this->tables['relations'].".linking_version_id ";
+               $sql.="AND 
".$this->tables['relations'].".relation_type='".$link_type."' ";
+               $sql.="WHERE 
".$this->tables['relations'].".linked_version_id=".$version_id." ";
+               $sql.="AND ".$this->tables['versions'].".status='".$status."'";
+
+               $this->db->query($sql, __LINE__, __FILE__);
+
+               $ii=0;
+               while ($this->db->next_record())
+               {
+                       $versions[$ii]['version_id']=$this->db->f('version_id');
+                       $versions[$ii]['element_id']=$this->db->f('element_id');
+                       $ii++;
+               }
+               
+               $this->db->unlock();
+               return $versions;               
+       }
+
+       function get_versions_linked_and_matching_criteria($version_id,$status, 
$link_type)
+       {
+               $version_info=$this->get_version_info($version_id);
+               $element_id=$version_info['element_id'];        
+               $versions=Array();
+
+
+               $sql="SELECT ".$this->tables['relations'].".linked_version_id 
AS version_id, ";
+               $sql.=$this->tables['versions'].".element_id AS element_id ";   
  
+               $sql.="FROM ".$this->tables['versions']." JOIN 
".$this->tables['relations']." ";
+               $sql.="ON ".$this->tables['versions'].".version_id = 
".$this->tables['relations'].".linked_version_id ";
+               $sql.="AND 
".$this->tables['relations'].".relation_type='".$link_type."' ";
+               $sql.="WHERE 
".$this->tables['relations'].".linking_version_id=".$version_id." ";
+               $sql.="AND ".$this->tables['versions'].".status='".$status."'";
+
+               $this->db->query($sql, __LINE__, __FILE__);
+
+               $ii=0;
+               while ($this->db->next_record())
+               {
+                       $versions[$ii]['version_id']=$this->db->f('version_id');
+                       $versions[$ii]['element_id']=$this->db->f('element_id');
+                       $ii++;
+               }
+               
+               $this->db->unlock();
+               return $versions;               
+       }
+       
        function get_current_or_alert_version($element_id)
        {
                if ( $this->debug('get_current_or_alert_version') )
@@ -1340,7 +1424,7 @@
                // db2 neededbecause can_read can be called during a $this->db 
loop;            
                $db2 = clone($this->db);
                
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $result=true;
                }
@@ -1369,7 +1453,7 @@
                // db2 neededbecause can_read can be called during a $this->db 
loop;            
                $db2 = clone($this->db);
 
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $result=true;
                }
@@ -1402,7 +1486,7 @@
                {
                        $out=true;
                }
-               elseif ( $element['lock_status'] == 1 && ( $this->admin || 
($element['lock_user_id'] == $GLOBALS['phpgw_info']['user']['account_id'] && 
$this->can_write($element_id))) )
+               elseif ( $element['lock_status'] == 1 && ( $this->admin == true 
|| ($element['lock_user_id'] == $GLOBALS['phpgw_info']['user']['account_id'] && 
$this->can_write($element_id))) )
                {
                        $out=true;
                }
@@ -1415,7 +1499,7 @@
                // db2 neededbecause can_read can be called during a $this->db 
loop;            
                $db2 = clone($this->db);
 
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $result=true;
                }
@@ -1441,7 +1525,7 @@
        
        function can_delete($element_id)
        {
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $result=true;
                }
@@ -1458,7 +1542,7 @@
        function list_elements($parent_id=0, $type='', $order='name')
        {
 
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $sql="SELECT * FROM ".$this->tables['elements']." ";
                        $sql.="WHERE parent_id=".$parent_id." ";
@@ -1497,7 +1581,7 @@
                        
                        if ( $the_element_type == "file" )
                        {
-                               if ( $this->admin || 
$this->can_write($the_element_id) )
+                               if ( $this->admin == true || 
$this->can_write($the_element_id) )
                                {
                                        $go=true;
                                }
@@ -1561,7 +1645,7 @@
                if ( $this->debug('list_version') )
                        echo "list_versions: entering with 
element_id=".$element_id."<br/>\n";
 
-               if ( $this->admin || $this->can_write($element_id))
+               if ( $this->admin == true || $this->can_write($element_id))
                {
                        if ( $this->debug('list_version') )
                                echo "list_versions: can write<br/>\n";
@@ -2051,346 +2135,7 @@
                return $periods;
        }
        
-       // Say file is OK
-       // User must have acceptation rights on this document
-
-       function accept_file ( $element_id, $comment='accepted', 
$comment_file=null )
-       {
-               
$current_or_alert_version=$this->get_current_or_alert_version($element_id);
-               
$working_or_pending_version=$this->get_working_or_pending_version($element_id);
-               $element=$this->get_element_info($element_id);
-               
-               $result=false;
-               
-               // Need to check if there is a working version
-               if (is_array($working_or_pending_version) )
-               {
-                       if ($working_or_pending_version['version_id'] )
-                       {
-                               // If there is a previous "current" make it 
obsolete
-                               if (is_array($current_or_alert_version) )
-                               {
-                                       if 
($current_or_alert_version['version_id'] )
-                                       {
-                                               $sql="UPDATE ged_versions set 
status='obsolete' WHERE version_id=".$current_or_alert_version['version_id']." 
";
-                                               $sql.="AND status != 
'refused'";                
-                                               $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_version['version_id']);
-                                               
-                                               if ( 
is_array($versions_referring_to))
-                                               {
-                                                       foreach ( 
$versions_referring_to as $version_referring_to)
-                                                       {
-                                                               
$this->alert_version ($version_referring_to['version_id']);
-                                                       }
-                                               }
-                                       }
-                               }
-                               
-                               $sql="UPDATE ged_versions set status='current', 
validation_date=".time()." WHERE 
version_id=".$working_or_pending_version['version_id'];                        
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-
-                               if (isset($comment_file) && 
$comment_file['file_name'] != "")
-                               {
-                                       $new_file=$comment_file;
-                                       
$new_file['doc_type']=$this->external_review_file_type;
-                                       
$new_file['name']=$this->get_type_desc($new_file['doc_type'])." / 
".$element['name'];
-                                       $new_file['description']=$comment;
-                                       
$new_file['reference']=$this->get_next_available_reference($new_file['doc_type'],
 $element['project_root'] );
-                                       $new_file['major']=1;
-                                       $new_file['minor']=0;
-                                       $new_file['validity_period']=0;
-                                       
-                                       $new_place=null;
-                                       
$new_place=$this->get_type_place($new_file['doc_type'],$element['project_root']);
-                                       if ( !isset($new_place))
-                                       {
-                                               
$new_place=$element['parent_id'];
-                                       }
-                                       $new_file['parent_id']=$new_place;
-                                       
-                                       $new_id=$this->add_file($new_file);
-
-                                       
$new_version=$this->get_last_version($new_id);
-                                       
$new_relations[0]['linked_version_id']=$working_or_pending_version['version_id'];
-                                       
$new_relations[0]['relation_type']='comment';
-                                       
-                                       
$this->set_relations($new_version['version_id'],$new_relations);
-                                       
-                               }
-                               
-                               $this->store_history ('accepted', $comment, 
$working_or_pending_version['version_id']);
-                               $result=true;
-                       }
-               }
-               else
-               {
-                       $result=false;
-               }
-               // TODO : check if all is ok
-               return ( $result );
-       }
-
-       function alert_version ( $version_id )
-       {
-               $sql="UPDATE ged_versions set status='alert' WHERE 
version_id=".$version_id." AND status='current'";            
-               $this->db->query($sql, __LINE__, __FILE__);
-               
-               // TODO : recursivite
-                                               
-               $this->db->unlock();
-               
-               $this->store_history ('alerted', 'alerted', 
$version_id['version_id']);
-       }
-
-       // Say file is not valid
-
-       function reject_file ( $element_id, $comment='rejected', 
$comment_file=null )
-       {
-               
$pending_version=$this->get_pending_for_internal_review($element_id);
-               $element=$this->get_element_info($element_id);
-               
-               $result=false;
-               
-               // Need to check if there is a working version
-               if (is_array($pending_version) )
-               {
-                       if ($pending_version['version_id'] )
-                       {
-                               $next_status='working';
-                               
-                               $sql="UPDATE ged_versions set 
status='".$next_status."' WHERE version_id=".$pending_version['version_id'];    
                  
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-                               
-                               if (isset($comment_file) && 
$comment_file['file_name'] != "")
-                               {
-                                       $new_file=$comment_file;
-                                       
-                                       $new_file=$comment_file;
-                                       
$new_file['doc_type']=$this->internal_review_file_type;
-                                       
$new_file['name']=$this->get_type_desc($new_file['doc_type'])." / 
".$element['name'];
-                                       $new_file['description']=$comment;
-                                       
$new_file['reference']=$this->get_next_available_reference($new_file['doc_type'],
 $element['project_root'] );
-                                       $new_file['major']=1;
-                                       $new_file['minor']=0;
-                                       $new_file['validity_period']=0;
-                                       
-                                       $new_place=null;
-                                       
$new_place=$this->get_type_place($new_file['doc_type'],$element['project_root']);
-                                       if ( !isset($new_place))
-                                       {
-                                               
$new_place=$element['parent_id'];
-                                       }
-                                       $new_file['parent_id']=$new_place;
-                                       
-                                       $new_id=$this->add_file($new_file);
-                                       
-                                       
$new_version=$this->get_last_version($new_id);
-                                       
$new_relations[0]['linked_version_id']=$pending_version['version_id'];
-                                       
$new_relations[0]['relation_type']='comment';
-                                       
-                                       
$this->set_relations($new_version['version_id'],$new_relations);
-                                       
-                               }
-                               
-                               $this->store_history ('rejected', $comment, 
$pending_version['version_id']);
-                                                               
-                               $result=true;
-                       }
-               }
-               else
-               {
-                       $result=false;
-               }
-               // TODO : check if all is ok
-               return ( $result );
-       }
-       
-       // Say file is not valid
-       // A new version must be worked on and delivered
-       // User must have acceptation rights on this document
-
-       function refuse_file ( $element_id, $comment='rejected', 
$comment_file=null )
-       {
-               
$pending_version=$this->get_pending_for_acceptation($element_id);
-               $element=$this->get_element_info($element_id);
-               
-               $result=false;
-               
-               // Need to check if there is a working version
-               if (is_array($pending_version) )
-               {
-                       if ($pending_version['version_id'] )
-                       {
-                               // Set "pending_for_internal_review" status
-                               // TODO : Add submission date
-                               $sql="UPDATE ged_versions set status='refused' 
WHERE version_id=".$pending_version['version_id'];                       
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-                               
-                               if (isset($comment_file) && 
$comment_file['file_name'] != "")
-                               {
-                                       
-                                       $new_file=$comment_file;
-                                       
$new_file['doc_type']=$this->external_review_file_type;
-                                       
$new_file['name']=$this->get_type_desc($new_file['doc_type'])." / 
".$element['name'];
-                                       $new_file['description']=$comment;
-                                       
$new_file['reference']=$this->get_next_available_reference($new_file['doc_type'],
 $element['project_root'] );
-                                       $new_file['major']=1;
-                                       $new_file['minor']=0;
-                                       $new_file['validity_period']=0;
-                                       
-                                       $new_place=null;
-                                       
$new_place=$this->get_type_place($new_file['doc_type'],$element['project_root']);
-                                       if ( !isset($new_place))
-                                       {
-                                               
$new_place=$element['parent_id'];
-                                       }
-                                       $new_file['parent_id']=$new_place;
-                                       
-                                       $new_id=$this->add_file($new_file);
-
-                                       
$new_version=$this->get_last_version($new_id);
-                                       
$new_relations[0]['linked_version_id']=$pending_version['version_id'];
-                                       
$new_relations[0]['relation_type']='comment';
-                                       
-                                       
$this->set_relations($new_version['version_id'],$new_relations);
-                                       
-                               }
-                               
-                               $this->store_history ('refused', $comment, 
$pending_version['version_id']);
-                                                               
-                               $result=true;
-                       }
-               }
-               else
-               {
-                       $result=false;
-               }
-               // TODO : check if all is ok
-               return ( $result );
-       }
-       
-       // Submit file to customer for acceptation
-
-       // After a contractual timeout the file is
-       // considered accepted
-       function deliver_file ( $element_id )
-       {
-               $pending_version=$this->get_ready_for_delivery($element_id);
-               
-               // Need to check if there is a working version
-               if (is_array($pending_version) )
-               {
-                       if ($pending_version['version_id'] )
-                       {
-                               // Set "pending_for_internal_review" status
-                               // TODO : Add submission date
-                               $sql="UPDATE ged_versions set 
status='pending_for_acceptation' WHERE 
version_id=".$pending_version['version_id'];                       
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-                               
-                               $this->store_history ('delivered', 'delivered', 
$pending_version['version_id']);
-                       }
-               }
-       }
-
-       // submit file for internal acceptation then delivery
-       // the file must be working
-       // and the performer of this action must have editor role
-       function submit_file ( $element_id )
-       {
-               $working_version=$this->get_working_version($element_id);
-               
-               // Need to check if there is a working version
-               if (is_array($working_version) )
-               {
-                       if ($working_version['version_id'] )
-                       {
-                               // Set "pending_for_internal_review" status
-                               // TODO : Add submission date
-                               $sql="UPDATE ged_versions set 
status='pending_for_technical_review' WHERE 
version_id=".$working_version['version_id'];                  
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-                               
-                               $this->store_history ('submitted', 'submitted', 
$working_version['version_id']);
-                       }
-               }               
-       }
-
-       function approve_file ( $element_id, $comment='approved', 
$comment_file=null )
-       {
-               //_debug_array($comment_file);
-               
-               
$pending_version=$this->get_pending_for_internal_review($element_id);
-               $element=$this->get_element_info($element_id);
-               
-               $result=false;
-               
-               // Need to check if there is a working version
-               if (is_array($pending_version) )
-               {
-                       if ($pending_version['version_id'] )
-                       {
-                               // Set "pending_for_internal_review" status
-                               // TODO : Add submission date
-                               if ( 
$pending_version['status']=='pending_for_technical_review' )
-                                       
$next_status='pending_for_quality_review';
-                               elseif 
($pending_version['status']=='pending_for_quality_review' )
-                                       $next_status='ready_for_delivery';
-                               else
-                                       $next_status=$pending_version['status'];
-                               
-                               $sql="UPDATE ged_versions set 
status='".$next_status."' WHERE version_id=".$pending_version['version_id'];    
                  
-                               $this->db->query($sql, __LINE__, __FILE__);
-                               $this->db->unlock();
-                               
-                               if (isset($comment_file) && 
$comment_file['file_name'] != "")
-                               {
-                                       $new_file=$comment_file;
-                                       
$new_file['doc_type']=$this->internal_review_file_type;
-                                       
$new_file['name']=$this->get_type_desc($new_file['doc_type'])." / 
".$element['name'];
-                                       $new_file['description']=$comment;
-                                       
$new_file['reference']=$this->get_next_available_reference($new_file['doc_type'],
 $element['project_root'] );
-                                       $new_file['major']=1;
-                                       $new_file['minor']=0;
-                                       $new_file['validity_period']=0;
-                                       
-                                       $new_place=null;
-                                       
$new_place=$this->get_type_place($new_file['doc_type'],$element['project_root']);
-                                       if ( !isset($new_place))
-                                       {
-                                               
$new_place=$element['parent_id'];
-                                       }
-                                       $new_file['parent_id']=$new_place;
-                                       
-                                       $new_id=$this->add_file($new_file);
-
-                                       
$new_version=$this->get_last_version($new_id);
-                                       
$new_relations[0]['linked_version_id']=$pending_version['version_id'];
-                                       
$new_relations[0]['relation_type']='comment';
-                                       
-                                       
$this->set_relations($new_version['version_id'],$new_relations);
-                                       
-                               }
-
-                               $this->store_history ('approved', $comment, 
$pending_version['version_id']);
-                                                               
-                               $result=true;
-                       }
-               }
-               else
-               {
-                       $result=false;
-               }
-               // TODO : check if all is ok
-               return ( $result );
-       }
+       // Used by workflow
 
        function set_version_status($version_id, $next_status)
        {
@@ -2518,7 +2263,7 @@
        function list_available_projects()
        {
 
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $sql="SELECT * FROM ".$this->tables['elements']." ";
                        $sql.="WHERE project_root=element_id ";
@@ -2556,7 +2301,7 @@
 
        function list_wanted_projects()
        {
-               if ( $this->admin )
+               if ( $this->admin == true )
                {
                        $sql="SELECT * FROM ".$this->tables['elements']." ";
                        $sql.="WHERE 
".$this->tables['elements'].".project_root=".$this->tables['elements'].".element_id
 ";
@@ -2941,7 +2686,7 @@
        // History
        function get_history ( $element_id)
        {
-               if ( $this->admin || $this->can_write($element_id))
+               if ( $this->admin == true || $this->can_write($element_id))
                {       
                        $sql="SELECT ".$this->tables['history'].".*, 
".$this->tables['versions'].".major, ".$this->tables['versions'].".minor FROM 
".$this->tables['history']." INNER JOIN ".$this->tables['versions']." ";
                        $sql.="ON ".$this->tables['history'].".version_id = 
".$this->tables['versions'].".version_id ";

Index: inc/class.flow_client.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.flow_client.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.flow_client.inc.php       24 Oct 2007 23:06:26 -0000      1.4
+++ inc/class.flow_client.inc.php       25 Oct 2007 15:54:46 -0000      1.5
@@ -26,15 +26,16 @@
                {
                        if ( isset($GLOBALS['ged_ui']))
                        {
-                               
+                               // We are called from ged : easy case
                                $this->ged_dm=&$GLOBALS['ged_ui']->ged_dm;
                                $this->t =&$GLOBALS['ged_ui']->t;
                        }
                        else
                        {
+                               // called from an other app
                                $this->ged_dm=CreateObject('ged.ged_dm', True);
                                                
-                               // WHAT IF AN OTHER APP TRIGGERS A GED 
TRANSITION ?
+                               // TODO : replace PHPGW_APP_TPL with the ged 
app tpl
                                $this->t = clone ($GLOBALS['phpgw']->template);
                                $this->t->set_root(PHPGW_APP_TPL);
                        }

Index: inc/class.soflows.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.soflows.inc.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- inc/class.soflows.inc.php   24 Oct 2007 23:06:26 -0000      1.4
+++ inc/class.soflows.inc.php   25 Oct 2007 15:54:46 -0000      1.5
@@ -104,12 +104,35 @@
                        
$sql_role_base.=$or."phpgw_flows_roles.account_id=".$the_account_id." ";
                        $sql_role_base.=" ) ";
                        
-                       //balayage      des champs de l'objet pour faire n 
objets progressivement renseignés
-                       // 1 champ, 2 champs etc
-                       // puis sérialisation pour enrichir la requête SQL
+                       // looping through object fields 
+                       // to define progressive context arrays
+                       // and serialize them for role sql request part
+                       
+                       $role_contexts=array();
+                       $temp_array=array();
+                       foreach ( $object as $field => $content )
+                       {
+                               if ( $field != 'app')
+                               {
+                                       $temp_array[$field]=$content;
+                                       $role_contexts[]=serialize($temp_array);
+                               }
+                       }
+                       
+                       $or="";
+                       $sql_context_base="( ";
+                       foreach ( $role_contexts as $role_context)
+                       {
+                               
$sql_context_base.=$or."phpgw_flows_roles.context='".$role_context."' ";
+                               $or="OR ";
+                       }
+                       $sql_context_base.=$or."phpgw_flows_roles.context='' ";
+                       $sql_context_base.=$or."phpgw_flows_roles.context IS 
NULL ";
+                       $sql_context_base.=" ) ";
                        
                        $sql="SELECT * FROM phpgw_flows_roles WHERE 
phpgw_flows_roles.transition=".$transition." ";
-                       $sql.="AND ".$sql_role_base;
+                       $sql.="AND ".$sql_role_base." ";
+                       $sql.="AND ".$sql_context_base;
                        
                        // DEBUG
                        //print ($sql);
@@ -141,7 +164,6 @@
                        return (true);
                }
 
-
                /**
                * Returns available transitions from a given status in a flow
                *
@@ -270,6 +292,13 @@
                        
                }
                
+               /**
+               * TODO : description 
+               *
+               * @access  public
+               * @param   TODO
+               * @return  string                   action field (human 
readable) for transition
+               */
                function get_transition_action($transition)
                {
                        $sql="SELECT action FROM phpgw_flows_transitions WHERE 
transition='".$transition."'";
@@ -287,6 +316,13 @@
                        return ($action);
                }
                
+               /**
+               * TODO : description 
+               *
+               * @access  public
+               * @param   TODO
+               * @return  array                   custom fields for transition
+               */
                function get_custom_fields($transition)
                {
                        $sql="SELECT field_name, value FROM 
phpgw_flows_transitions_custom_values WHERE transition='".$transition."'";
@@ -300,9 +336,15 @@
                        }
 
                        return ($custom_fields);
-                       
                }
                
+               /**
+               * TODO : description 
+               *
+               * @access  public
+               * @param   TODO
+               * @return  string                   client method required to 
perform status change
+               */
                function get_transition_method($transition)
                {
                        $sql="SELECT method FROM phpgw_flows_transitions WHERE 
transition='".$transition."'";
@@ -320,6 +362,13 @@
                        return ($method);
                }
                
+               /**
+               * TODO : description 
+               *
+               * @access  public
+               * @param   TODO
+               * @return  array                   list of triggers
+               */
                function get_transition_triggers($transition)
                {
                        $sql="SELECT trigger_id, app, class, method, context 
FROM phpgw_flows_triggers WHERE transition='".$transition."'";
@@ -335,42 +384,6 @@
                                
$triggers[$this->db->f('trigger_id')]['context']=unserialize($this->db->f('context'));
                          
                        }
 
-                       /*
-                       if ($transition==5 )
-                       {
-                               $triggers=Array(
-                                       Array(
-                                               'app'=>'ged',
-                                               'class'=>'flow_client',
-                                               'method'=> 
'apply_transition_to_previous_versions_matching_status', 
-                                               'context' => 
unserialize('a:1:{s:10:"transition";i:11;}'))
-                               );
-                       }
-                       elseif($transition==11)
-                       {
-                               $triggers=Array(
-                                       Array(
-                                               'app'=>'ged',
-                                               'class'=>'flow_client',
-                                               'method'=> 
'apply_transition_to_linked_versions_with_link_type', 
-                                               'context' => 
unserialize('a:2:{s:10:"transition";i:13;s:9:"link_type";s:10:"dependancy";}'))
-                               );
-                       }
-                       elseif($transition==4)
-                       {
-                               $triggers=Array(
-                                       Array(
-                                               'app'=>'ged',
-                                               'class'=>'flow_client',
-                                               'method'=> 
'apply_transition_to_linked_versions_with_link_type', 
-                                               'context' => 
unserialize('a:2:{s:10:"transition";i:4;s:9:"link_type";s:8:"delivery";}'))
-                               );
-                       }                       
-                       else
-                       {
-                               $triggers=Array();
-                       }
-                       */
                        return($triggers);      
                }
                
@@ -382,10 +395,8 @@
                * Sends an email notification to people involved in next 
available transitions (called after a transition)
                *
                * @access  public
-               * @param   string   $flow          workflow in which we are 
running
-               * @param   string   $status        current status
-               * @param   TODO     $context       TODO
-               * @return  array                   list of phpgw accounts
+               * @param   TODO
+               * @return  TODO                   list of phpgw accounts
                */
                function send_status_notification($flow,$status,$context=null)
                {

Index: inc/class.ged_ui.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/inc/class.ged_ui.inc.php,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- inc/class.ged_ui.inc.php    4 Sep 2007 14:38:27 -0000       1.47
+++ inc/class.ged_ui.inc.php    25 Oct 2007 15:54:46 -0000      1.48
@@ -41,15 +41,10 @@
                'unlock_file' => true,  
                'delete_file'=>true, 
                'change_acl'=>true, 
-               'accept_file'=>true, 
-               'submit_file'=> true, 
-               'approve_file'=> true, 
-               'reject_file'=> true, 
-               'deliver_file'=> true, 
-               'refuse_file'=> true, 
                'search' => true, 
                'stats'=> true, 
-               'chrono' => true
+               'chrono' => true,
+               'flow_do' => true
        );
 
        var $icons;
@@ -76,6 +71,8 @@
                $this->categories=CreateObject('phpgwapi.categories');
                $this->browser=CreateObject('phpgwapi.browser');
                
+               $this->flows=CreateObject('ged.flows');
+               
                if(address@hidden($GLOBALS['phpgw']->css))
                {
                        $GLOBALS['phpgw']->css = createObject('phpgwapi.css');
@@ -116,6 +113,8 @@
                $this->icons["wmv"]="wmv_movie";
                $this->icons["default"]="default";
 
+               //_debug_array($GLOBALS);
+               //die();
        }
 
        function debug ($thefunction)
@@ -765,7 +764,7 @@
                else
                        $extension='default';
 
-               if ( $element_info['validity_period'] > 0)
+               if ( $element_info['validity_period'] > 0 and 
isset($current_version['validation_date']))
                {
                        
$expiration_date=$current_version['validation_date']+$element_info['validity_period'];
                        
@@ -941,7 +940,8 @@
                if ( $this->debug('browse') )
                        print ( "browse: entering<br>\n");
 
-               $focused_id=get_var('focused_id',array('GET','POST'));
+               $focused_id=(int)get_var('focused_id',array('GET','POST'));
+               
$focused_version_id=(int)get_var('version_id',array('GET','POST'));
 
                if ($focused_id=="" || ! $this->ged_dm->can_read($focused_id))
                        $focused_id=0;
@@ -957,8 +957,11 @@
                // MEMO Link to go up
                $link_data=null;
                $link_data['menuaction']='ged.ged_ui.browse';
+               
                if ( $focused_id != 0)
+               {
                $link_data['focused_id']=$focused_element['parent_id'];
+               }
                
                $up_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
                $this->t->set_var('up_link', "<a 
href=\"".$up_url."\">".lang('Up')."</a>" );
@@ -982,6 +985,19 @@
                                
$last_version=$this->ged_dm->get_last_version($focused_id);
                                
$current_version=$this->ged_dm->get_current_or_pending_for_acceptation_version($focused_id);
 
+                               if ($focused_version_id != 0)
+                               {
+                                       
$focused_version=$this->ged_dm->get_version_info($focused_version_id);
+                               }
+                               elseif(isset($current_version))
+                               {
+                                       $focused_version=$current_version;
+                               }
+                               else
+                               {
+                                       $focused_version=$last_version;
+                               }
+                               
                                // No current version and no write acl : 
cheater !
                                if ( ! is_array($current_version) && ! 
$this->ged_dm->can_write($focused_id))
                                {
@@ -999,82 +1015,52 @@
                                $this->t->set_var('add_file', '');
                                $this->t->set_var('lang_add_file', '');
                                
-                               // DONE if acl write 
-                               if ( (!$this->ged_dm->is_locked($focused_id)) 
&& $this->ged_dm->can_write($focused_id) && ( $last_version['status'] == 
'working' || $last_version['status'] == 'current' || $last_version['status'] == 
'refused' || $last_version['status'] == 'alert' ) )
-                               {
-                                       $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.update_file';
-                                       $link_data['element_id']=$focused_id;
-                                       
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('update_file', "<a 
href=\"".$update_file_url."\">".lang('Update file')."</a>");
-                               }
-                               
-                               if ( $this->ged_dm->can_change_acl($focused_id) 
)
-                               {
-                                       $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.change_acl';
-                                       $link_data['element_id']=$focused_id;
-                                       
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('change_acl', "<a 
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
-                               }
-                               
-                               // DONE : Add actions depending on document 
status and user roles
-                               // DONE : if can_write and exist working version
-                               // DONE : add a "submit" document link
-                               if ( (!$this->ged_dm->is_locked($focused_id)) 
&& $this->ged_dm->can_write($focused_id) && $last_version['status'] == 
'working' )
-                               {
-                                       $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.submit_file';
-                                       $link_data['element_id']=$focused_id;
-                                       
$accept_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('submit_file', "<a 
href=\"".$accept_file_url."\">".lang('Submit file')."</a>");
-                                       
-                               }
+                               $flow_object=array(
+                                       'app' => 'ged',
+                                       'project_root' => 
$focused_element['project_root'], 
+                                       'doc_type' => 
$focused_element['doc_type'], 
+                                       'element_id' => $focused_id, 
+                                       'version_id' => 
$focused_version['version_id']
+                               );
+                               
$flow_actions=$this->flows->get_available_transitions($flow_object);
                                
+                               $this->t->set_block('browse_file_tpl', 
'flow_actions_list', 'flow_actions_list_handle');
                                
-                               // TODO : droit specifique d'approbation ?
-                               if ( $this->ged_dm->admin && 
($last_version['status'] == 'working' || $last_version['status'] == 
'pending_for_technical_review' || $last_version['status'] == 
'pending_for_quality_review' || $last_version['status'] == 
'pending_for_acceptation' )  )
+                               foreach ($flow_actions as $flow_action)
                                {
-                                       $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.accept_file';
-                                       $link_data['element_id']=$focused_id;
-                                       
$accept_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('accept_file', "<a 
href=\"".$accept_file_url."\">".lang('accept file')."</a>");
-                               }
+                                       $this->t->set_var('flow_do', 
$flow_action['action']);
                                
-                               if ( $this->ged_dm->admin && ( 
$last_version['status'] == 'pending_for_technical_review' || 
$last_version['status'] == 'pending_for_quality_review' ) )
-                               {
                                        $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.approve_file';
+                                       
$link_data['menuaction']='ged.ged_ui.flow_do';
                                        $link_data['element_id']=$focused_id;
-                                       
$approve_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('approve_file', "<a 
href=\"".$approve_file_url."\">".lang('approve file')."</a>");
+                                       
$link_data['version_id']=$focused_version['version_id'];
+                                       
$link_data['transition']=$flow_action['transition'];
+                                       $this->t->set_var('flow_do_link', 
$GLOBALS['phpgw']->link('/index.php', $link_data));
 
-                                       $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.reject_file';
-                                       $link_data['element_id']=$focused_id;
-                                       
$reject_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('reject_file', "<a 
href=\"".$reject_file_url."\">".lang('reject file')."</a>");
+                                       
$this->t->fp('flow_actions_list_handle', 'flow_actions_list', True);
                                }
 
-                               if ( $this->ged_dm->admin && 
$last_version['status'] == 'ready_for_delivery' )
+                               // DONE if acl write 
+                               // TODO : Allow update only if workflow status 
allows it
+                               if ( (!$this->ged_dm->is_locked($focused_id)) 
&& $this->ged_dm->can_write($focused_id) && ( $last_version['status'] == 
'working' || $last_version['status'] == 'current' || $last_version['status'] == 
'refused' || $last_version['status'] == 'alert' ) )
                                {
                                        $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.deliver_file';
+                                       
$link_data['menuaction']='ged.ged_ui.update_file';
                                        $link_data['element_id']=$focused_id;
-                                       
$approve_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('deliver_file', "<a 
href=\"".$approve_file_url."\">".lang('Deliver file')."</a>");
+                                       
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
+                                       $this->t->set_var('update_file', "<a 
href=\"".$update_file_url."\">".lang('Update file')."</a>");
                                }
                                
-                               if ( $this->ged_dm->admin && 
$last_version['status'] == 'pending_for_acceptation' )
+                               if ( $this->ged_dm->can_change_acl($focused_id) 
)
                                {
                                        $link_data=null;
-                                       
$link_data['menuaction']='ged.ged_ui.refuse_file';
+                                       
$link_data['menuaction']='ged.ged_ui.change_acl';
                                        $link_data['element_id']=$focused_id;
-                                       
$approve_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('refuse_file', "<a 
href=\"".$approve_file_url."\">".lang('refuse file')."</a>");
+                                       
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
+                                       $this->t->set_var('change_acl', "<a 
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
                                }
                                
+                               // TODO : Allow lock only if workflow status 
allows it
                                if ($last_version['status'] == 'working' && 
$this->ged_dm->can_change_file_lock($focused_id) )
                                {
                                        $this->t->set_var('lock_file', '');
@@ -1145,7 +1131,7 @@
                                        
$link_data['menuaction']='ged.ged_ui.change_acl';
                                        $link_data['element_id']=$focused_id;
                                        
$update_file_url=$GLOBALS['phpgw']->link('/index.php', $link_data);
-                                       $this->t->set_var('accept_file', "<a 
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
+                                       $this->t->set_var('change_acl', "<a 
href=\"".$update_file_url."\">".lang('Change ACL')."</a>");
                                }
                                
                                // TODO : droit specifique de delete ?
@@ -2331,235 +2317,39 @@
        
        }
        
-       function accept_file()
-       {
-               // element data
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
$pending_version=$this->ged_dm->get_pending_for_internal_review($element_id);
-               $element=$this->ged_dm->get_element_info($element_id);
-               
-               // Comment file data
-               $accept_file=get_var('accept_file',array('POST'));
-               $comment=addslashes(get_var('comment', array( 'POST')));
-
-               if ($accept_file==lang('Accept file'))
-               {
-                       $comment_file['file_name']=$_FILES['file']['name'];
-                       $comment_file['file_size']=$_FILES['file']['size'];
-                       
$comment_file['file_tmp_name']=$_FILES['file']['tmp_name'];
-                       $comment_file['file_mime_type']=$_FILES['file']['type'];
-
-                       if ( $this->ged_dm->accept_file ( $element_id, 
$comment, $comment_file ))
+       // Just one workflow method remains
+       // (removed all the previous hardcoded flow functions)
+       function flow_do()
                        {
-                               $link_data=null;
-                               $link_data['menuaction']='ged.ged_ui.browse';
-                               $link_data['focused_id']=$element_id;
-                               
$link_data['version_id']=$pending_version['version_id'];
-                       
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
-                       }
-                       // TODO : else get error message and display it
-               }
-               
-               $this->set_template_defaults();
-
-               $this->t->set_file(array('accept_file_tpl'=>'accept_file.tpl'));
-       
-               $this->t->set_var('probable_reference_label', lang('Probable 
reference'));
-               $this->t->set_var('probable_reference_value', 
$this->ged_dm->get_next_available_reference($this->ged_dm->external_review_file_type,
 $element['project_root']));
-               
-               $this->t->set_var('element_id_value', $element_id);
-               $this->t->set_var('comment_field', 'comment');
-               $this->t->set_var('comment_label', lang('comment'));
-               $this->t->set_var('comment_value', $comment);
-               $this->t->set_var('lang_accept_file', lang('Accept file'));
-
-               $accept_link_data['menuaction']='ged.ged_ui.accept_file';
-               $this->t->set_var('action_accept', 
$GLOBALS['phpgw']->link('/index.php', $accept_link_data));
-               
-               $this->display_app_header();
-
-               $this->t->pfp('out', 'accept_file_tpl');
-       }
-
-       function submit_file()
-       {
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
-               $this->ged_dm->submit_file ( $element_id );
-
-               $link_data=null;
-               $link_data['menuaction']='ged.ged_ui.browse';
-               $link_data['focused_id']=$element_id;
-       
-               $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
-       }
-
-       function reject_file()
-       {
-               // element data
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
$pending_version=$this->ged_dm->get_pending_for_internal_review($element_id);
-               $element=$this->ged_dm->get_element_info($element_id);
-               
-               // Comment file data
-               $reject_file=get_var('reject_file',array('POST'));
-               $comment=addslashes(get_var('comment', array( 'POST')));
-
-               if ($reject_file==lang('Reject file'))
-               {
-                       $comment_file['file_name']=$_FILES['file']['name'];
-                       $comment_file['file_size']=$_FILES['file']['size'];
-                       
$comment_file['file_tmp_name']=$_FILES['file']['tmp_name'];
-                       $comment_file['file_mime_type']=$_FILES['file']['type'];
-
-                       if ( $this->ged_dm->reject_file ( $element_id, 
$comment, $comment_file ))
-                       {
-                               $link_data=null;
-                               $link_data['menuaction']='ged.ged_ui.browse';
-                               $link_data['focused_id']=$element_id;
-                               
$link_data['version_id']=$pending_version['version_id'];
-                       
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
-                       }
-                       // TODO : else get error message and display it
-               }
-               
-               $this->set_template_defaults();
-
-               $this->t->set_file(array('reject_file_tpl'=>'reject_file.tpl'));
-               
-               $this->t->set_var('probable_reference_label', lang('Probable 
reference'));
-               $this->t->set_var('probable_reference_value', 
$this->ged_dm->get_next_available_reference($this->ged_dm->internal_review_file_type,
 $element['project_root']));         
-               
-               $this->t->set_var('element_id_value', $element_id);
-               $this->t->set_var('comment_field', 'comment');
-               $this->t->set_var('comment_label', lang('comment'));
-               $this->t->set_var('comment_value', $comment);
-               $this->t->set_var('lang_reject_file', lang('Reject file'));
-
-               $reject_link_data['menuaction']='ged.ged_ui.reject_file';
-               $this->t->set_var('action_reject', 
$GLOBALS['phpgw']->link('/index.php', $reject_link_data));
-               
-               $this->display_app_header();
-
-               $this->t->pfp('out', 'reject_file_tpl');
-       }
+               $transition=get_var('transition', array('POST', 'GET'));
+               $element_id=get_var('element_id', array('POST', 'GET'));
+               $version_id=get_var('version_id', array('POST', 'GET'));
 
-       function approve_file()
-       {
-               // element data
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
$pending_version=$this->ged_dm->get_pending_for_internal_review($element_id);
                $element=$this->ged_dm->get_element_info($element_id);
+               $version=$this->ged_dm->get_version_info($version_id);
                
-               // Comment file data
-               $approve_file=get_var('approve_file',array('POST'));
-               $comment=addslashes(get_var('comment', array( 'POST')));
-
-               if ($approve_file==lang('Approve file'))
-               {
-                       $comment_file['file_name']=$_FILES['file']['name'];
-                       $comment_file['file_size']=$_FILES['file']['size'];
-                       
$comment_file['file_tmp_name']=$_FILES['file']['tmp_name'];
-                       $comment_file['file_mime_type']=$_FILES['file']['type'];
-
-                       if ( $this->ged_dm->approve_file ( $element_id, 
$comment, $comment_file ))
-                       {
-                               $link_data=null;
-                               $link_data['menuaction']='ged.ged_ui.browse';
-                               $link_data['focused_id']=$element_id;
-                               
$link_data['version_id']=$pending_version['version_id'];
-                       
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
-                       }
-                       // TODO : else get error message and display it
-               }
-               
-               $this->set_template_defaults();
-
-               
$this->t->set_file(array('approve_file_tpl'=>'approve_file.tpl'));
-               
-               $this->t->set_var('probable_reference_label', lang('Probable 
reference'));
-               $this->t->set_var('probable_reference_value', 
$this->ged_dm->get_next_available_reference($this->ged_dm->internal_review_file_type,
 $element['project_root']));
-               
-               $this->t->set_var('element_id_value', $element_id);
-               $this->t->set_var('comment_field', 'comment');
-               $this->t->set_var('comment_label', lang('comment'));
-               $this->t->set_var('comment_value', $comment);
-               $this->t->set_var('lang_approve_file', lang('Approve file'));
-
-               $approve_link_data['menuaction']='ged.ged_ui.approve_file';
-               $this->t->set_var('action_approve', 
$GLOBALS['phpgw']->link('/index.php', $approve_link_data));
-               
-               $this->display_app_header();
-
-               $this->t->pfp('out', 'approve_file_tpl');
-       }
+               $flow_object=array(
+                       'app' => 'ged',
+                       'project_root' => $element['project_root'], 
+                       'doc_type' => $element['doc_type'], 
+                       'element_id' => $element_id, 
+                       'version_id' => $version_id
+               );
+               $do_transition_result=$this->flows->do_transition($transition, 
$flow_object);
 
-       function deliver_file()
+               if ( $do_transition_result['status'] == 'ok')
        {
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
-               $this->ged_dm->deliver_file ( $element_id );
-
                $link_data=null;
                $link_data['menuaction']='ged.ged_ui.browse';
                $link_data['focused_id']=$element_id;
+                       $link_data['version_id']=$version_id;
        
                $GLOBALS['phpgw']->redirect_link('/index.php', $link_data);
        }
-
-       function refuse_file()
-       {
-               // element data
-               $element_id=get_var('element_id', array('GET', 'POST'));
-               
$pending_version=$this->ged_dm->get_pending_for_internal_review($element_id);
-               $element=$this->ged_dm->get_element_info($element_id);
-               
-               // Comment file data
-               $refuse_file=get_var('refuse_file',array('POST'));
-               $comment=addslashes(get_var('comment', array( 'POST')));
-
-               if ($refuse_file==lang('Refuse file'))
-               {
-                       $comment_file['file_name']=$_FILES['file']['name'];
-                       $comment_file['file_size']=$_FILES['file']['size'];
-                       
$comment_file['file_tmp_name']=$_FILES['file']['tmp_name'];
-                       $comment_file['file_mime_type']=$_FILES['file']['type'];
-
-                       if ( $this->ged_dm->refuse_file ( $element_id, 
$comment, $comment_file ))
+               elseif ( isset($do_transition_result['error_message']) )
                        {
-                               $link_data=null;
-                               $link_data['menuaction']='ged.ged_ui.browse';
-                               $link_data['focused_id']=$element_id;
-                               
$link_data['version_id']=$pending_version['version_id'];
-                       
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+                       print ( $do_transition_result['error_message'] );
                        }
-                       // TODO : else get error message and display it
-               }
-               
-               $this->set_template_defaults();
-
-               $this->t->set_file(array('refuse_file_tpl'=>'refuse_file.tpl'));
-
-               $this->t->set_var('probable_reference_label', lang('Probable 
reference'));
-               $this->t->set_var('probable_reference_value', 
$this->ged_dm->get_next_available_reference($this->ged_dm->external_review_file_type,
 $element['project_root']));
-               
-               $this->t->set_var('element_id_value', $element_id);
-               $this->t->set_var('comment_field', 'comment');
-               $this->t->set_var('comment_label', lang('comment'));
-               $this->t->set_var('comment_value', $comment);
-               $this->t->set_var('lang_refuse_file', lang('Refuse file'));
-
-               $refuse_link_data['menuaction']='ged.ged_ui.refuse_file';
-               $this->t->set_var('action_refuse', 
$GLOBALS['phpgw']->link('/index.php', $refuse_link_data));
-               
-               $this->display_app_header();
-
-               $this->t->pfp('out', 'refuse_file_tpl');
-
        }
        
        // Search

Index: setup/tables_update.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_update.inc.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- setup/tables_update.inc.php 1 Aug 2007 17:28:49 -0000       1.12
+++ setup/tables_update.inc.php 25 Oct 2007 15:54:46 -0000      1.13
@@ -18,6 +18,7 @@
        $test[]='0.9.18.003';
        $test[]='0.9.18.004';
        $test[]='0.9.18.005';
+       $test[]='0.9.18.006';
                                        
        function ged_upgrade0_9_16_000()
        {
@@ -217,4 +218,167 @@
 
        }       
        
+       function ged_upgrade0_9_18_005()
+       {
+
+               $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows' => 
array(
+                       'fd' => array(
+                               'flow' => array('type' => 'auto','nullable' => 
False),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 20,'nullable' => False),
+                               'flow_name' => array('type' => 'varchar', 
'precision' => 252,'nullable' => False)
+                       ),
+                       'pk' => array('flow'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               $GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_roles' 
=> array(
+                       'fd' => array(
+                               'role' => array('type' => 'auto','nullable' => 
False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'account_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'context' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True)
+                       )
+                       'pk' => array('role'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_statuses' => array(
+                       'fd' => array(
+                               'status_id' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 20,'nullable' => False),
+                               'status_name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('status_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_transitions' => array(
+                       'fd' => array(
+                               'transition' => array('type' => 
'auto','nullable' => False),
+                               'flow' => array('type' => 'int', 'precision' => 
4,'nullable' => False),
+                               'from_status' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'to_status' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'action' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'method' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False,'default' => 'set_status')
+                       ),
+                       'pk' => array('transition'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_transitions_custom_values'
 => array(
+                       'fd' => array(
+                               'custom_value_id' => array('type' => 
'auto','nullable' => False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'field_name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('custom_value_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               
$GLOBALS['phpgw_setup']->oProc->CreateTable('phpgw_flows_triggers' => array(
+                       'fd' => array(
+                               'trigger_id' => array('type' => 
'auto','nullable' => False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '11'),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 255,'nullable' => False),
+                               'class' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False,'default' => 'flow_client'),
+                               'method' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'context' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('trigger_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               )
+               );
+               
+               // ged default flow : flow
+               
+               $oProc->query ("INSERT INTO `phpgw_flows` VALUES 
(1,'ged','default');" );
+               
+               // ged default flow : statuses
+               
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('working','ged','working')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_technical_review','ged','pending for technical review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_quality_review','ged','pending for quality review')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('ready_for_delivery','ged','ready for delivery')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_acceptation','ged','pending for final acceptation')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('current','ged','current')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('refused','ged','refused')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('obsolete','ged','obsolete')," );
+               $oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('alert','ged','alert');" );
+               
+               // ged default flow : transitions
+               
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(1,1,'working','pending_for_technical_review','submit file','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(2,1,'pending_for_technical_review','pending_for_quality_review','approve file 
(technical)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(3,1,'pending_for_quality_review','ready_for_delivery','approve file 
(quality)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(4,1,'ready_for_delivery','pending_for_acceptation','deliver 
file','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(5,1,'pending_for_acceptation','current','accept file 
(final)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(6,1,'pending_for_acceptation','refused','refuse file 
(final)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(7,1,'pending_for_technical_review','working','reject file 
(technical)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(8,1,'pending_for_quality_review','working','reject file 
(quality)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(9,1,'pending_for_technical_review','current','accept file 
(force)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(10,1,'pending_for_quality_review','current','accept file 
(force)','set_status_with_review')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(11,1,'current','obsolete','obsolete','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(12,1,'working','current','accept file (force)','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(13,1,'current','alert','alert','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(14,1,'alert','current','cancel alert','set_status')" );
+               $oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(15,1,'alert','obsolete','obsolete','set_status')" );
+               
+               // ged default flow : transitions custom values
+               
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(1,2,'review_file_type','fiche-relecture-interne')" );
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(2,3,'review_file_type','fiche-relecture-interne')" );
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(3,5,'review_file_type','fiche-relecture-externe')" );
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(4,6,'review_file_type','fiche-relecture-externe')" );
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(5,7,'review_file_type','fiche-relecture-interne')" );
+               $oProc->query ("INSERT INTO 
`phpgw_flows_transitions_custom_values` VALUES 
(6,8,'review_file_type','fiche-relecture-interne')" );
+               
+               // ged default flow : triggers
+               
+               $oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(1,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:11;}')"
 );
+               $oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(2,11,'ged','flow_client','apply_transition_to_linking_versions_with_link_type','a:2:{s:10:\"transition\";i:13;s:9:\"link_type\";s:10:\"dependancy\";}')"
 );
+               $oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(3,4,'ged','flow_client','apply_transition_to_linked_versions_with_link_type','a:2:{s:10:\"transition\";i:4;s:9:\"link_type\";s:8:\"delivery\";}')"
 );
+               $oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(4,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:15;}')"
 );
+               
+               // ged default flow : admin roles
+               
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(1,1,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(2,2,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(3,3,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(4,4,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(5,5,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(6,6,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(7,7,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(8,8,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(9,9,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(10,10,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(11,11,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(12,12,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(13,13,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(14,14,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(15,15,6,NULL)" );
+               $oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES 
(16,1,16,NULL)" );
+               
+               $GLOBALS['setup_info']['ged']['currentver']='0.9.18.007';
+               return $GLOBALS['setup_info']['ged']['currentver'];             
        
+               
+       }       
+       
 ?>
\ No newline at end of file

Index: setup/default_records.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/default_records.inc.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- setup/default_records.inc.php       17 Jun 2006 18:25:07 -0000      1.2
+++ setup/default_records.inc.php       25 Oct 2007 15:54:46 -0000      1.3
@@ -140,7 +140,7 @@
 $oProc->query ("INSERT INTO ged_mimes VALUES ('gz', 'application/x-gzip')");
 $oProc->query ("INSERT INTO ged_mimes VALUES ('tgz', 'application/x-gzip')");
 
-// remplissage de la table lifetimes avec les durées de rétension standard
+// remplissage de la table lifetimes avec les dur�es de r�tension standard
 
 $oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 0, 
'aeternel')" );
 $oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 3600, 
'1 hour')" );
@@ -152,4 +152,73 @@
 $oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 
93312000, '3 years')" );
 $oProc->query ("INSERT INTO ged_periods ( period, description) VALUES ( 
155520000, '5 years')" );
 
+// ged default flow : flow
+
+$oProc->query ("INSERT INTO `phpgw_flows` VALUES (1,'ged','default');" );
+
+// ged default flow : statuses
+
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('working','ged','working')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_technical_review','ged','pending for technical review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_quality_review','ged','pending for quality review')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('ready_for_delivery','ged','ready for delivery')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('pending_for_acceptation','ged','pending for final acceptation')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('current','ged','current')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('refused','ged','refused')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('obsolete','ged','obsolete')," );
+$oProc->query ("INSERT INTO `phpgw_flows_statuses` VALUES 
('alert','ged','alert');" );
+
+// ged default flow : transitions
+
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(1,1,'working','pending_for_technical_review','submit file','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(2,1,'pending_for_technical_review','pending_for_quality_review','approve file 
(technical)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(3,1,'pending_for_quality_review','ready_for_delivery','approve file 
(quality)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(4,1,'ready_for_delivery','pending_for_acceptation','deliver 
file','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(5,1,'pending_for_acceptation','current','accept file 
(final)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(6,1,'pending_for_acceptation','refused','refuse file 
(final)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(7,1,'pending_for_technical_review','working','reject file 
(technical)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(8,1,'pending_for_quality_review','working','reject file 
(quality)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(9,1,'pending_for_technical_review','current','accept file 
(force)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(10,1,'pending_for_quality_review','current','accept file 
(force)','set_status_with_review')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(11,1,'current','obsolete','obsolete','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(12,1,'working','current','accept file (force)','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(13,1,'current','alert','alert','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(14,1,'alert','current','cancel alert','set_status')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions` VALUES 
(15,1,'alert','obsolete','obsolete','set_status')" );
+
+// ged default flow : transitions custom values
+
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(1,2,'review_file_type','fiche-relecture-interne')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(2,3,'review_file_type','fiche-relecture-interne')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(3,5,'review_file_type','fiche-relecture-externe')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(4,6,'review_file_type','fiche-relecture-externe')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(5,7,'review_file_type','fiche-relecture-interne')" );
+$oProc->query ("INSERT INTO `phpgw_flows_transitions_custom_values` VALUES 
(6,8,'review_file_type','fiche-relecture-interne')" );
+
+// ged default flow : triggers
+
+$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(1,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:11;}')"
 );
+$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(2,11,'ged','flow_client','apply_transition_to_linking_versions_with_link_type','a:2:{s:10:\"transition\";i:13;s:9:\"link_type\";s:10:\"dependancy\";}')"
 );
+$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(3,4,'ged','flow_client','apply_transition_to_linked_versions_with_link_type','a:2:{s:10:\"transition\";i:4;s:9:\"link_type\";s:8:\"delivery\";}')"
 );
+$oProc->query ("INSERT INTO `phpgw_flows_triggers` VALUES 
(4,5,'ged','flow_client','apply_transition_to_previous_versions_matching_status','a:1:{s:10:\"transition\";i:15;}')"
 );
+
+// ged default flow : admin roles
+
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (1,1,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (2,2,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (3,3,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (4,4,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (5,5,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (6,6,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (7,7,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (8,8,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (9,9,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (10,10,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (11,11,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (12,12,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (13,13,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (14,14,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (15,15,6,NULL)" );
+$oProc->query ("INSERT INTO `phpgw_flows_roles` VALUES (16,1,16,NULL)" );
+
 ?>
\ No newline at end of file

Index: setup/setup.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/setup.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- setup/setup.inc.php 2 Aug 2007 15:34:11 -0000       1.11
+++ setup/setup.inc.php 25 Oct 2007 15:54:47 -0000      1.12
@@ -13,7 +13,7 @@
 
        $setup_info['ged']['name']='ged';
        $setup_info['ged']['title']='Document Management System';
-       $setup_info['ged']['version']='0.9.18.006';
+       $setup_info['ged']['version']='0.9.18.007';
        $setup_info['ged']['app_order']=17;
        $setup_info['ged']['enable']=1;
        $setup_info['calendar']['app_group']    = 'office';
@@ -51,7 +51,13 @@
                'ged_acl',
                'ged_doc_types',
                'ged_types_places',
-               'ged_periods'
+               'ged_periods',
+               'phpgw_flows',
+               'phpgw_flows_roles',
+               'phpgw_flows_statuses',
+               'phpgw_flows_transitions',
+               'phpgw_flows_transitions_custom_values',
+               'phpgw_flows_triggers'
        );
 
 //     * Dependacies for this app to work

Index: setup/tables_current.inc.php
===================================================================
RCS file: /sources/phpgroupware/ged/setup/tables_current.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- setup/tables_current.inc.php        27 Sep 2007 22:08:49 -0000      1.10
+++ setup/tables_current.inc.php        25 Oct 2007 15:54:47 -0000      1.11
@@ -14,7 +14,7 @@
   * edited by hand.                                                          *
   \**************************************************************************/
 
-  /* $Id: tables_current.inc.php,v 1.10 2007/09/27 22:08:49 maat Exp $ */
+  /* $Id: tables_current.inc.php,v 1.11 2007/10/25 15:54:47 maat Exp $ */
 
   /* table array for ged */
        $phpgw_baseline = array(
@@ -167,5 +167,79 @@
                        'ix' => array(),
                        'uc' => array()
                ),
+                               'phpgw_flows' => array(
+                       'fd' => array(
+                               'flow' => array('type' => 'auto','nullable' => 
False),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 20,'nullable' => False),
+                               'flow_name' => array('type' => 'varchar', 
'precision' => 252,'nullable' => False)
+                       ),
+                       'pk' => array('flow'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'phpgw_flows_roles' => array(
+                       'fd' => array(
+                               'role' => array('type' => 'auto','nullable' => 
False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'account_id' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'context' => array('type' => 'varchar', 
'precision' => 255,'nullable' => True)
+                       ),
+                       'pk' => array('role'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'phpgw_flows_statuses' => array(
+                       'fd' => array(
+                               'status_id' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 20,'nullable' => False),
+                               'status_name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('status_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'phpgw_flows_transitions' => array(
+                       'fd' => array(
+                               'transition' => array('type' => 
'auto','nullable' => False),
+                               'flow' => array('type' => 'int', 'precision' => 
4,'nullable' => False),
+                               'from_status' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'to_status' => array('type' => 'varchar', 
'precision' => 100,'nullable' => False),
+                               'action' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'method' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False,'default' => 'set_status')
+                       ),
+                       'pk' => array('transition'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'phpgw_flows_transitions_custom_values' => array(
+                       'fd' => array(
+                               'custom_value_id' => array('type' => 
'auto','nullable' => False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False),
+                               'field_name' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'value' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('custom_value_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
+               'phpgw_flows_triggers' => array(
+                       'fd' => array(
+                               'trigger_id' => array('type' => 
'auto','nullable' => False),
+                               'transition' => array('type' => 'int', 
'precision' => 4,'nullable' => False,'default' => '11'),
+                               'app' => array('type' => 'varchar', 'precision' 
=> 255,'nullable' => False),
+                               'class' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False,'default' => 'flow_client'),
+                               'method' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False),
+                               'context' => array('type' => 'varchar', 
'precision' => 255,'nullable' => False)
+                       ),
+                       'pk' => array('trigger_id'),
+                       'fk' => array(),
+                       'ix' => array(),
+                       'uc' => array()
+               ),
        );
 ?>

Index: templates/base/browse.tpl
===================================================================
RCS file: /sources/phpgroupware/ged/templates/base/browse.tpl,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- templates/base/browse.tpl   31 Jul 2007 17:02:11 -0000      1.8
+++ templates/base/browse.tpl   25 Oct 2007 15:54:47 -0000      1.9
@@ -1,4 +1,4 @@
-<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} 
{delete_folder} {add_file} {edit_file} {update_file} {lock_file} {refuse_file} 
{accept_file} {submit_file} {deliver_file} {reject_file} {approve_file} 
{delete_file} {change_acl} {search} {stats} {chrono}</div>
+<div id="ged_top_menu">{top_link} {up_link} {update_folder} {add_folder} 
{delete_folder} {add_file} {edit_file} {update_file} {lock_file} <!-- BEGIN 
flow_actions_list --><a href="{flow_do_link}">{flow_do}</a>&nbsp;<!-- END 
flow_actions_list --> {delete_file} {change_acl} {search} {stats} {chrono}</div>
 <br/>
 <div id="ged_info">
 {main_content}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]