Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
modstate.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  * Document State modification
9  *
10  * @author Anakeen 2000
11  * @version $Id: modstate.php,v 1.11 2008/10/30 16:11:44 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/modcard.php");
21 /**
22  * Edition to send mail
23  * @param Action &$action current action
24  * @global id Http var : document id to change
25  * @global state Http var : new state
26  * @global comment Http var : additionnal comment for history
27  * @global force Http var : to force transition [Y|N]
28  */
29 function modstate(&$action)
30 {
31  // Get all the params
32  $docid = GetHttpVars("id");
33  $state = GetHttpVars("newstate"); // new state
34  $comment = GetHttpVars("comment"); // comment
35  $comment = rawurldecode($comment);
36  $force = (GetHttpVars("fstate", "no") == "yes"); // force change
37  if ($docid == 0) $action->exitError(_("the document is not referenced: cannot apply state modification"));
38 
39  $dbaccess = $action->GetParam("FREEDOM_DB");
40  // initialise object
42 
43  if ($doc->wid > 0) {
44  if ($state != "-") {
45  $wdoc = new_Doc($dbaccess, $doc->wid);
46  $wdoc->Set($doc);
47  $wdoc->disableEditControl(); // only to pass ask parameters
48  setPostVars($wdoc);
49  $wdoc->enableEditControl();
50  $err = $wdoc->ChangeState($state, $comment, $force);
51  if ($err != "") $action->AddWarningMsg($err);
52  else $action->info(sprintf("Change state %s [%d] : %s", $doc->title, $doc->id, $state));
53  } else {
54  if ($comment != "") {
55  $doc->addComment($comment);
56  $action->log->info(sprintf("Add comment %s [%d] : %s", $doc->title, $doc->id, $comment));
57  }
58  }
59  } else {
60  $action->AddLogMsg(sprintf(_("the document %s is not related to a workflow") , $doc->title));
61  }
62 
63  redirect($action, GetHttpVars("redirect_app", "FDL") , GetHttpVars("redirect_act", "FDL_CARD&refreshfld=Y&id=" . $doc->id) , $action->GetParam("CORE_STANDURL"));
64 }
65 ?>
← centre documentaire © anakeen - published under CC License - Dynacase