Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
modwdoc.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Affect a worflow
9  *
10  * @author Anakeen 2000
11  * @version $Id: modwdoc.php,v 1.6 2009/01/02 17:45:18 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 
19 include_once ("FDL/Class.Doc.php");
20 include_once ("FDL/Class.Dir.php");
21 include_once ("FDL/Class.DocAttr.php");
22 include_once ("FDL/freedom_util.php");
23 // -----------------------------------
24 function modwdoc(&$action)
25 {
26  // -----------------------------------
27 
28  // Get all the params
29  $docid = GetHttpVars("docid");
30  $current = (GetHttpVars("current", "N") == "Y");
31  $wid = GetHttpVars("wid");
32 
33  if ($docid == 0) $action->exitError(_("the document is not referenced: cannot apply profile access modification"));
34 
35  $dbaccess = $action->GetParam("FREEDOM_DB");
36  // initialise object
38  $doc->wid = $wid; // new default workflow
39  // test object permission before modify values (no access control on values yet)
40  $doc->lock(true); // enabled autolock
41  $err = $doc->canEdit();
42  if ($err != "") $action->ExitError($err);
43 
44  $doc->Modify();
45 
46  $doc->unlock(true); // disabled autolock
47  // update document already created to be conform to new workflow
48  $doc->exec_query("update doc" . $doc->id . " set wid=$wid where usefor != 'W'");
49 
50  $wdoc = new_Doc($dbaccess, $wid);
51  $firststate = $wdoc->firstState;
52  $doc->exec_query("update doc" . $doc->id . " set state='$firststate' where usefor != 'W' and (state is null or state='')");
53 
54  redirect($action, "FDL", "FDL_CARD&id=$docid", $action->GetParam("CORE_STANDURL"));
55 }
56 ?>
← centre documentaire © anakeen - published under CC License - Dynacase