Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
workflow_init.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Regenrate workflow attributes
8  *
9  * @author Anakeen
10  * @version $Id: workflow_init.php,v 1.5 2008/12/31 14:39:52 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Doc.php");
18 include_once ("FDL/Class.SearchDoc.php");
19 include_once ("FDL/Lib.Attr.php");
20 include_once ("FDL/Class.DocFam.php");
21 // -----------------------------------
23 {
24 
25  $docid = GetHttpVars("id"); // view doc abstract attributes
26  if ($docid == "") {
27  $action->exitError(_("workflow_init :: id is empty"));
28  }
29 
30  $dbaccess = $action->dbaccess;
31  /*
32  * @var WDoc $wdoc
33  */
34  $wdoc = new_Doc($dbaccess, $docid);
35  if (!$wdoc->isAlive()) {
36  $action->exitError(sprintf(_("unknown document id %s") , $docid));
37  }
38  if (($err = $wdoc->control("edit")) !== "") {
39  $action->exitError($err);
40  }
41  $wdoc->CreateProfileAttribute();
42  if ($wdoc->doctype == 'C') $cid = $wdoc->id;
43  else $cid = $wdoc->fromid;
44 
45  $query = new QueryDb($dbaccess, "DocFam");
46  $query->AddQuery("id=$cid");
47  $table1 = $query->Query(0, 0, "TABLE");
48  if ($query->nb > 0) {
49  if ($wdoc->isAffected() && strstr($wdoc->usefor, 'W')) {
51  } else {
52  $action->exitError(sprintf(_("workflow_init :: id %s is not a workflow") , $docid));
53  }
54  } else {
55  $action->exitError(sprintf(_("workflow_init :: workflow id %s not found") , $cid));
56  }
57 
58  $s = new SearchDoc($dbaccess, $wdoc->fromid);
59  $s->setObjectReturn();
60  $s->search();
61  while ($doc = $s->getNextDoc()) {
62  $doc->postStore();
63  }
64 
65  $action->addWarningMsg(_("workflow has been recomposed"));
66  redirect($action, "FDL", "FDL_CARD&id=$docid");
67 }
workflow_init(Action &$action)
addWarningMsg($msg)
global $action
refreshPhpPgDoc($dbaccess, $docid)
Definition: Lib.Attr.php:18
if($famId) $s
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
$dbaccess
Definition: checkVault.php:17
if(($docid!==0)&&(!is_numeric($docid))) $query
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen