Core  3.2
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  * @package FDL
5 */
6 /**
7  * Affect a worflow
8  *
9  * @author Anakeen
10  * @version $Id: modwdoc.php,v 1.6 2009/01/02 17:45:18 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("FDL/Class.Dir.php");
19 include_once ("FDL/Class.DocAttr.php");
20 include_once ("FDL/freedom_util.php");
21 // -----------------------------------
22 function modwdoc(Action & $action)
23 {
24  // -----------------------------------
25  // Get all the params
26  $docid = GetHttpVars("docid");
27  $current = (GetHttpVars("current", "N") == "Y");
28  $wid = GetHttpVars("wid");
29 
30  if ($docid == 0) $action->exitError(_("the document is not referenced: cannot apply profile access modification"));
31 
32  $dbaccess = $action->dbaccess;
33  // initialise object
35  $doc->wid = $wid; // new default workflow
36  // test object permission before modify values (no access control on values yet)
37  $doc->lock(true); // enabled autolock
38  $err = $doc->canEdit();
39  if ($err != "") $action->ExitError($err);
40 
41  $doc->Modify();
42 
43  $doc->unlock(true); // disabled autolock
44  // update document already created to be conform to new workflow
45  $doc->exec_query("update doc" . $doc->id . " set wid=$wid where usefor !~ 'W'");
46  /*
47  * @var WDoc $wdoc
48  */
49  $wdoc = new_Doc($dbaccess, $wid);
50  $firststate = $wdoc->firstState;
51  $doc->exec_query("update doc" . $doc->id . " set state='$firststate' where usefor !~ 'W' and (state is null or state='')");
52 
53  redirect($action, "FDL", "FDL_CARD&id=$docid", $action->GetParam("CORE_STANDURL"));
54 }
global $action
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
modwdoc(Action &$action)
Definition: modwdoc.php:22
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen