[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] ged templates/base/review_file.tpl inc/class.fl...
From: |
Pascal Vilarem |
Subject: |
[Phpgroupware-cvs] ged templates/base/review_file.tpl inc/class.fl... |
Date: |
Sat, 20 Oct 2007 22:09:39 +0000 |
CVSROOT: /sources/phpgroupware
Module name: ged
Changes by: Pascal Vilarem <maat> 07/10/20 22:09:39
Added files:
templates/base : review_file.tpl
inc : class.flows.inc.php class.flow_client.inc.php
class.soflows.inc.php
Log message:
feature preparation : true workflow system for ged
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/ged/templates/base/review_file.tpl?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flows.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.flow_client.inc.php?cvsroot=phpgroupware&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/ged/inc/class.soflows.inc.php?cvsroot=phpgroupware&rev=1.1
Patches:
Index: templates/base/review_file.tpl
===================================================================
RCS file: templates/base/review_file.tpl
diff -N templates/base/review_file.tpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ templates/base/review_file.tpl 20 Oct 2007 22:09:39 -0000 1.1
@@ -0,0 +1,40 @@
+<form name="FileList" enctype="multipart/form-data" action="{action_review}"
method="post">
+<input type="hidden" name="{element_id_field}" value="{element_id_value}">
+<table cellpadding="5">
+<tr>
+<td colspan="2">
+<h2>{review_title}</h2>
+</td>
+</tr>
+<tr>
+<td>
+{comment_label} :
+</td>
+<td>
+<textarea name="{comment_field}" rows="10" cols="50" wrap="off"
>{comment_value}</textarea>
+</td>
+</tr>
+<tr>
+<td>
+{probable_reference_label} :
+</td>
+<td>
+{probable_reference_value}
+</td>
+</tr>
+<tr>
+<td>
+{lang_file} :
+</td>
+<td>
+<input name="{file_field}" type="file" value="{file_value}""/>
+</td>
+</tr>
+
+<tr>
+<td colspan="2" align="center" >
+<input type="submit" name="review_file" value="{lang_do_transition}" />
+</td>
+</tr>
+</table>
+</form>
\ No newline at end of file
Index: inc/class.flows.inc.php
===================================================================
RCS file: inc/class.flows.inc.php
diff -N inc/class.flows.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inc/class.flows.inc.php 20 Oct 2007 22:09:39 -0000 1.1
@@ -0,0 +1,300 @@
+<?php
+
/**************************************************************************
+ * phpGroupWare - flow
+ * http://www.phpgroupware.org
+ * Written by Pascal Vilarem <address@hidden>
+ *
+ *
--------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at
your
+ * option) any later version
+
***************************************************************************/
+
+ /**
+ * flow object class
+ *
+ * @package flows
+ */
+ class flows
+ {
+ var $soflows;
+
+ /**
+ * flow class initialization method
+ *
+ * @access public
+ * @return nothing
+ */
+ function flows()
+ {
+ $this->soflows=CreateObject('ged.soflows', True);
+ }
+
+
+ /**
+ * STANDARD INFORMATION METHODS
+ */
+
+ /**
+ * Returns available transitions from a given status in a flow
+ *
+ * @access public
+ * @param string $flow workflow in which we are
running
+ * @param string $status status from which we are
starting
+ * @return array list of possible transitions
+ */
+ function get_available_transitions($flow,$status)
+ {
+
$available_transitions=$this->soflows->get_available_transitions($flow,$status);
+ return ($available_transitions);
+ }
+
+ /**
+ * Returns flows linked with a given application
+ *
+ * @access public
+ * @param string $app application
+ * @return array list of possible flows
+ */
+ function get_app_flows ( $app )
+ {
+ $app_flows=$this->soflows->get_app_flows ($app);
+ return($app_flows);
+ }
+
+ function get_transition_status_from($transition)
+ {
+
return($this->soflows->get_transition_status_from($transition));
+ }
+
+
+ /**
+ * Checks if a given account is entitled to perform
+ * a transition on a given object
+ *
+ * @access public
+ * @param string $transition_id transition
+ * @param array $context set of vars depending on
needs
+ * @return array list of phpgw accounts
+ */
+ function check_transition_role($transition,$context=null)
+ {
+
+ }
+
+
+ /**
+ * STANDARD ACTION METHODS
+ */
+
+ /**
+ * Performs a workflow transition on a given object of a given
application
+ *
+ * @access public
+ * @param string $transition_id transition
+ * @param array $context set of vars depending on
needs
+ * @return TOTO error message ?
+ */
+ function do_transition($transition,$context=null)
+ {
+ /**
+ * Needs to checks conditions,
+ * Perform the status changes
+ * And launch triggers registered by the application
+ */
+ // DEBUG
+ //print ( "hop : ". $transition );
+ $transition_result=Array('status' => 'processing');
+
+ //récupérer l'application
+ $app=$this->soflows->get_transition_app($transition);
+
+ if ( $app != '')
+ {
+ //instancier le plugin de flow
+
$this->app_flow_client=CreateObject($app.'.flow_client', True);
+
+ //récupérer le flow
+
$flow=$this->app_flow_client->get_flow($context['object']);
+
+ //contrôler que la transition appratient bien
au flow en question
+
$transition_is_in_flow=$this->soflows->check_if_transition_is_in_flow($transition,
$flow);
+
+ if ( $transition_is_in_flow )
+ {
+ //récupérer le statut de départ de
l'objet
+
$object_status_from=$this->app_flow_client->get_status($context['object']);
+
+
$transition_status_from=$this->soflows->get_transition_status_from($transition);
+
+ //contrôler la transition
+ if ($object_status_from ==
$transition_status_from )
+ {
+ // DEBUG
+ //print ( "<br>\nok available");
+
+ //contrôler les rôles
+
$user_has_required_role=$this->soflows->check_if_user_has_required_role($transition);
+
+ if ($user_has_required_role)
+ {
+
+ //contrôler les
conditions
+
$conditions_of_transition_are_filled=$this->soflows->check_if_conditions_of_transition_are_filled($transition,$context['object']);
+
+ if (
$conditions_of_transition_are_filled )
+ {
+ //effectuer la
transition
+
+
//get_next_status
+
$next_status=$this->soflows->get_next_status($transition);
+
+ if (
$next_status != "")
+ {
+ //DEBUG
+ //print
( "<br>\nnext status: ".$next_status);
+
+
//vérifier quelle fonction du client utiliser en fonction de la transition
+
$client_set_next_method=$this->soflows->get_transition_method($transition);
+
+ //set
next_status
+
$action=$this->soflows->get_transition_action($transition);
+
$custom_fields=$this->soflows->get_custom_fields($transition);
+
$transition_context=Array('action' => $action, 'custom_fields'
=>$custom_fields);
+ if (
is_callable(array(&$this->app_flow_client, $client_set_next_method)))
+ {
+
$method_result=call_user_func(array(&$this->app_flow_client,
$client_set_next_method),$context['object'], $next_status,$transition_context);
+
+
if ( $method_result['status'] == 'ok')
+
{
+
//set_history
+
if ( isset($method_result['comment']))
+
{
+
$comment=$method_result['comment'];
+
}
+
else
+
{
+
$comment=$action;
+
}
+
+
$comment_context=Array('comment' => $comment);
+
$this->app_flow_client->set_history($context['object'],
$action."[".$transition."]", $comment_context);
+
+
//récupérer les triggers
+
$triggers=$this->soflows->get_transition_triggers($transition);
+
+
//déclencher les triggers
+
foreach ($triggers as $trigger)
+
{
+
if ($trigger['app']==$app )
+
{
+
$trigger_object=&$this->app_flow_client;
+
}
+
else
+
{
+
$trigger_object=CreateObject($trigger['app'].'.flow_client', True);
+
}
+
+
// TODO : récupérer les paramètres dont a besoin le trigger
+
$trigger_context=Array();
+
+
$trigger_result=call_user_func(array(&$trigger_object,
$trigger['method']),$context['object'],$trigger_context);
+
+
//TODO : contrôler le résultat des triggers
+
}
+
+
$transition_result=$method_result;
+
}
+
elseif ($method_result['status'] == 'processing' )
+
{
+
// la méthode a besoin d'interagir avec l'utilisateur
+
$transition_result=$method_result;
+
}
+
else
+
{
+
//ça a merdé
+
$transition_result=$method_result;
+
}
+
+ }
+ elseif
(is_callable(array(&$this->app_flow_client, 'set_status' )))
+ {
+
//ALERTE : méthode non trouvée mais il existe une méthode par défaut
+
//$flow=$this->app_flow_client->set_status($context['object'], $next_status,
$transition_context);
+ }
+ else
+ {
+
//oula : gros bug dans le client de workflow
+
$transition_result['status']='error';
+
$transition_result['error_message']='unknown flow method';
+ }
+
+ }
+ else
+ {
+ // no
next status == bug !
+
$transition_result['status']='error';
+
$transition_result['error_message']='next status unknown';
+ }
+ }
+ else
+ {
+ // Conditions
non réunies == plutot bug que petit malin
+
$transition_result['status']='error';
+
$transition_result['error_message']='conditions not filled';
+ }
+ }
+ else
+ {
+ // the user is not
entitled to perform the transition == petit malin ou bug
+
$transition_result['status']='error';
+
$transition_result['error_message']='roles violation';
+ }
+ }
+ else
+ {
+ // Les status ne correspondent
pas == petit malin ou bug
+
$transition_result['status']='error';
+
$transition_result['error_message']='status mismatch';
+ }
+ }
+ else
+ {
+ // transition hors flow == petit malin
ou bug
+ $transition_result['status']='error';
+
$transition_result['error_message']='transition not in flow';
+ }
+ }
+ else
+ {
+ // Pas d'application associée == gros problème
+ $transition_result['status']='error';
+ $transition_result['error_message']='no app
linked';
+ }
+ // Return en fonction du résultat
+ return ($transition_result);
+ }
+
+
+ /**
+ * STANDARD TRIGGERS
+ */
+
+ /**
+ * 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
+ */
+ function send_status_notification($flow,$status,$context=null)
+ {
+
+ }
+
+ }
+
+?>
\ No newline at end of file
Index: inc/class.flow_client.inc.php
===================================================================
RCS file: inc/class.flow_client.inc.php
diff -N inc/class.flow_client.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inc/class.flow_client.inc.php 20 Oct 2007 22:09:39 -0000 1.1
@@ -0,0 +1,243 @@
+<?php
+
/**************************************************************************
+ * phpGroupWare - ged
+ * http://www.phpgroupware.org
+ * Written by Pascal Vilarem <address@hidden>
+ *
+ *
--------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at
your
+ * option) any later version
+
***************************************************************************/
+
+ /**
+ * flow object class
+ *
+ * @package ged
+ */
+
+ class flow_client
+ {
+ var $ged_dm;
+ var $t;
+
+ function flow_client()
+ {
+ if ( isset($GLOBALS['ged_ui']))
+ {
+
+ $this->ged_dm=&$GLOBALS['ged_ui']->ged_dm;
+ $this->t =&$GLOBALS['ged_ui']->t;
+ }
+ else
+ {
+ $this->ged_dm=CreateObject('ged.ged_dm', True);
+
+ // WHAT IF AN OTHER APP TRIGGERS A GED
TRANSITION ?
+ $this->t = clone ($GLOBALS['phpgw']->template);
+ $this->t->set_root(PHPGW_APP_TPL);
+ }
+ }
+
+ function display_app_header()
+ {
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
+ }
+
+ function get_flow($object)
+ {
+ // TODO : récupérer le flow de l'objet
+ // TODO : si non récupérer celui du type/projet
+ // TODO : sinon récupérer celui du type
+ // TODO : sinon renvoyer le type par défaut
+ return 1;
+ }
+
+ /*
+ * Be careful : an object can be a element or a version
+ */
+ function get_status($object)
+ {
+ $last_version=$this->ged_dm->get_version_info($object);
+
+ return($last_version['status']);
+ }
+
+ function set_status($object,$status,$context=null)
+ {
+ //DEBUG
+ //print ( "<br/>\n".$status );
+ $this->ged_dm->set_version_status($object,$status);
+
+ $function_result=Array('status' => 'ok');
+ return($function_result);
+ }
+
+ function set_status_with_review($object,$status,$context=null)
+ {
+ $function_result=Array('status' => 'processing');
+
+ $last_version=$this->ged_dm->get_version_info($object);
+
$element=$this->ged_dm->get_element_info($last_version['element_id']);
+
+ $review_file=get_var('review_file',array('POST'));
+ $comment=addslashes(get_var('comment', array( 'POST')));
+
+ // Récupérer le type de review file en fonction de la
transition
+ // Du type de fichier, du projet concerné
+ // Et de l'âge du capitaine
+ if (
isset($context['custom_fields']['review_file_type']))
+ {
+
$review_file_type_for_transition=$context['custom_fields']['review_file_type'];
+ }
+ else
+ {
+ // no default review_file_type
+ $review_file_type_for_transition='';
+ }
+ // Puis récupérer la référence probable
+
$next_reference_for_review_file=$this->ged_dm->get_next_available_reference($review_file_type_for_transition,
$element['project_root']);
+
+
+ if ($review_file==lang($context['action']))
+ {
+ //DEBUG
+ //print ( "hop");
+
+ if ( isset($_FILES['file']) &&
$_FILES['file']['name'] != '')
+ {
+
$new_file['file_name']=$_FILES['file']['name'];
+
$new_file['file_size']=$_FILES['file']['size'];
+
$new_file['file_tmp_name']=$_FILES['file']['tmp_name'];
+
$new_file['file_mime_type']=$_FILES['file']['type'];
+
+
$new_file['doc_type']=$review_file_type_for_transition;
+
$new_file['name']=$this->ged_dm->get_type_desc($new_file['doc_type'])." /
".$element['name'];
+ $new_file['description']=$comment;
+
$new_file['reference']=$next_reference_for_review_file;
+ $new_file['major']=1;
+ $new_file['minor']=0;
+ $new_file['validity_period']=0;
+
+ $new_place=null;
+
$new_place=$this->ged_dm->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->ged_dm->add_file($new_file);
+
+
$new_version=$this->ged_dm->get_last_version($new_id);
+
+
$new_relations[0]['linked_version_id']=$last_version['version_id'];
+
$new_relations[0]['relation_type']='review';
+
+
$this->ged_dm->set_relations($new_version['version_id'],$new_relations);
+
+ }
+
+
$this->ged_dm->set_version_status($object,$status);
+ $function_result['comment']=$comment;
+ $function_result['status']='ok';
+ }
+
+ if ( $function_result['status'] != 'ok')
+ {
+ //$this->set_template_defaults();
+
+
$this->t->set_file(array('review_file_tpl'=>'review_file.tpl'));
+
+ $this->t->set_var('probable_reference_value',
$next_reference_for_review_file);
+
+ $this->t->set_var('probable_reference_label',
lang('Probable reference'));
+ $this->t->set_var('review_title',
lang($context['action']));
+ $this->t->set_var('lang_file', 'Review file');
+
+ $this->t->set_var('element_id_value',
$last_version['element_id']);
+
+ $this->t->set_var('file_field', 'file');
+
+ $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_do_transition', lang(
$context['action']));
+
+ $this->display_app_header();
+
+ $this->t->pfp('out', 'review_file_tpl');
+ }
+ return ($function_result);
+ }
+
+ function set_history($version_id, $action, $context=null)
+ {
+ if ( isset($context))
+ {
+ if (isset($context['comment']))
+ {
+ $comment=$context['comment'];
+ }
+ else
+ {
+ $comment='';
+ }
+ }
+ else
+ {
+ $comment='';
+
+ }
+ $this->ged_dm->store_history ($action, $comment,
$version_id);
+ }
+
+ /*
+ * TRIGGERS
+ */
+
+ function
apply_transition_to_previous_versions_matching_status($version_id,$trigger_context=null)
+ {
+ //TODO : set as parameter
+ $transition=11;
+
+ $sub_flow=CreateObject('ged.flows');
+
$status_from=$sub_flow->get_transition_status_from($transition);
+
+
$versions=$this->ged_dm->get_previous_versions_matching_status($version_id,$status_from);
+
+ // CARE : triggered transition should always be
'automatic' ones
+ foreach ($versions as $version)
+ {
+ $context['object']=$version['version_id'];
+
$do_transition_result=$sub_flow->do_transition($transition, $context);
+ }
+ }
+
+ // Mettre en alerte les dépendances quand on passe obsolète
+ function
apply_transition_to_linked_versions_with_link_type($version_id,$trigger_context=null)
+ {
+ $transition=13;
+ $link_type='dependancy';
+
+ $sub_flow=CreateObject('ged.flows');
+
$status_from=$sub_flow->get_transition_status_from($transition);
+
+
$versions=$this->ged_dm->get_versions_linking_and_matching_criteria($version_id,$status_from,
$link_type);
+
+ // CARE : triggered transition should always be
'automatic' ones
+ foreach ($versions as $version)
+ {
+ $context['object']=$version['version_id'];
+
$do_transition_result=$sub_flow->do_transition($transition, $context);
+ }
+
+ }
+
+ }
+
+?>
\ No newline at end of file
Index: inc/class.soflows.inc.php
===================================================================
RCS file: inc/class.soflows.inc.php
diff -N inc/class.soflows.inc.php
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ inc/class.soflows.inc.php 20 Oct 2007 22:09:39 -0000 1.1
@@ -0,0 +1,322 @@
+<?php
+
/**************************************************************************
+ * phpGroupWare - flows
+ * http://www.phpgroupware.org
+ * Written by Pascal Vilarem <address@hidden>
+ *
+ *
--------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at
your
+ * option) any later version
+
***************************************************************************/
+
+
+ /**
+ * soflows business object class
+ *
+ * @package flows
+ */
+ class soflows
+ {
+ var $db;
+
+ /**
+ * soflow class initialization method
+ *
+ * @access public
+ * @return nothing
+ */
+ function soflows()
+ {
+ $this->db=clone($GLOBALS['phpgw']->db);
+ }
+
+ /**
+ * STANDARD INFORMATION METHODS
+ */
+
+ /**
+ * Returns the app linked with the flow the given transition
belongs to
+ *
+ * @access public
+ * @param string $transition transition
+ * @return string app name
+ */
+ function get_transition_app($transition)
+ {
+ $sql="SELECT flow FROM phpgw_flows_transitions WHERE
transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $flow=$this->db->f('flow');
+
+ $sql2="SELECT app from phpgw_flows WHERE
flow=".$flow;
+
+ $this->db->query($sql2, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $app=$this->db->f('app');
+ }
+ else
+ {
+ $app='';
+ }
+ }
+ else
+ {
+ $app='';
+ }
+ return ($app);
+ }
+
+ /**
+ * Returns true if user has the required role for triggering the
given transition
+ *
+ * @access public
+ * @param string $transition transition
+ * @param integer $account account_id (current uid by
default)
+ * @return bool result
+ */
+ function
check_if_user_has_required_role($transition,$accound_id=null)
+ {
+ if (is_null($accound_id))
+ {
+
$accound_id=$GLOBALS['phpgw_info']['user']['account_id'];
+ }
+
+ //if account_id is a user_id get the groups he belongs
to
+
+ return (true);
+ }
+
+ /**
+ * Returns true if conditions for triggering transition on given
object are filled
+ *
+ * @access public
+ * @param string $transition transition
+ * @param TODO $context TODO
+ * @return bool result
+ */
+ function
check_if_conditions_of_transition_are_filled($transition,$context=null)
+ {
+ return (true);
+ }
+
+
+ /**
+ * Returns available transitions from a given status in a flow
+ *
+ * @access public
+ * @param string $flow workflow in which we are
running
+ * @param string $status status from which we are
starting
+ * @return array list of possible transitions
+ */
+ function get_available_transitions($flow,$status)
+ {
+ $sql="SELECT phpgw_flows_transitions.* FROM
phpgw_flows_transitions WHERE phpgw_flows_transitions.flow=".$flow." ";
+ $sql.="AND
phpgw_flows_transitions.from_status='".$status."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ $ii=0;
+ $transitions=Array();
+
+ while ($this->db->next_record())
+ {
+
+
$transitions[$ii]['transition']=$this->db->f('transition');
+
$transitions[$ii]['action']=$this->db->f('action');
+ $ii ++;
+ }
+
+ $this->db->unlock();
+
+ return $transitions;
+ }
+
+ /**
+ * Returns true if given transition is in given flow and false
otherwise
+ *
+ * @access public
+ * @param string $transition transition
+ * @param integer $flow flow
+ * @return bool result
+ */
+ function check_if_transition_is_in_flow($transition, $flow)
+ {
+ $sql="SELECT flow FROM phpgw_flows_transitions WHERE
transition='".$transition."' AND flow=".$flow;
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $check=true;
+ }
+ else
+ {
+ $check=false;
+ }
+ return($check);
+ }
+
+ /**
+ * Returns from status for given transition
+ *
+ * @access public
+ * @param string $transition transition
+ * @return string status
+ */
+ function get_transition_status_from($transition)
+ {
+ $sql="SELECT from_status FROM phpgw_flows_transitions
WHERE transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $from_status=$this->db->f('from_status');
+ }
+ else
+ {
+ $from_status='';
+ }
+ return ($from_status);
+ }
+
+ /**
+ * Returns to status for given transition
+ *
+ * @access public
+ * @param string $transition transition
+ * @return string status
+ */
+ function get_next_status($transition)
+ {
+ $sql="SELECT to_status FROM phpgw_flows_transitions
WHERE transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $to_status=$this->db->f('to_status');
+ }
+ else
+ {
+ $to_status='';
+ }
+ return ($to_status);
+ }
+
+ /**
+ * Returns flows linked with a given application
+ *
+ * @access public
+ * @param string $app application
+ * @return array list of possible flows
+ */
+ function get_app_flows ( $app )
+ {
+
+ }
+
+ /**
+ * Returns accounts linked with a given (transition, context)
+ *
+ * @access public
+ * @param string $transition_id transition
+ * @param TODO $context TODO
+ * @return array list of phpgw accounts
+ */
+ function get_transition_roles($transition,$context=null)
+ {
+
+ }
+
+ function get_transition_action($transition)
+ {
+ $sql="SELECT action FROM phpgw_flows_transitions WHERE
transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $action=$this->db->f('action');
+ }
+ else
+ {
+ $action='';
+ }
+ return ($action);
+ }
+
+ function get_custom_fields($transition)
+ {
+ $sql="SELECT field_name, value FROM
phpgw_flows_transitions_custom_values WHERE transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+ $custom_fields=Array();
+
+ while ($this->db->next_record())
+ {
+
$custom_fields[$this->db->f('field_name')]=$this->db->f('value');
+ }
+
+ return ($custom_fields);
+
+ }
+
+ function get_transition_method($transition)
+ {
+ $sql="SELECT method FROM phpgw_flows_transitions WHERE
transition='".$transition."'";
+
+ $this->db->query($sql, __LINE__, __FILE__);
+
+ if ($this->db->next_record())
+ {
+ $method=$this->db->f('method');
+ }
+ else
+ {
+ $method='set_status';
+ }
+ return ($method);
+ }
+
+ function get_transition_triggers($transition)
+ {
+ if ($transition==5 )
+
$triggers=Array(Array('app'=>'ged','class'=>'flow_client','method'=>
'apply_transition_to_previous_versions_matching_status', 'params' =>
Array('status_from', 'status_to')));
+ elseif($transition==11)
+
$triggers=Array(Array('app'=>'ged','class'=>'flow_client','method'=>
'apply_transition_to_linked_versions_with_link_type', 'params' =>
Array('status_from', 'status_to')));
+ else
+ $triggers=Array();
+
+ return($triggers);
+ }
+
+ /**
+ * STANDARD TRIGGERS
+ */
+
+ /**
+ * 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
+ */
+ function send_status_notification($flow,$status,$context=null)
+ {
+
+ }
+
+
+ }
+
+?>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] ged templates/base/review_file.tpl inc/class.fl...,
Pascal Vilarem <=