Platform  3.1
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  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Regenrate workflow attributes
9  *
10  * @author Anakeen 2000
11  * @version $Id: workflow_init.php,v 1.5 2008/12/31 14:39:52 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 include_once ("FDL/Class.Doc.php");
20 include_once ("FDL/Class.SearchDoc.php");
21 include_once ("FDL/Lib.Attr.php");
22 include_once ("FDL/Class.DocFam.php");
23 // -----------------------------------
25 {
26 
27  $docid = GetHttpVars("id"); // view doc abstract attributes
28  if ($docid == "") {
29  $action->exitError(_("workflow_init :: id is empty"));
30  }
31 
32  $dbaccess = $action->GetParam("FREEDOM_DB");
33 
34  $wdoc = new_Doc($dbaccess, $docid);
35  $wdoc->CreateProfileAttribute();
36  if ($wdoc->doctype == 'C') $cid = $wdoc->id;
37  else $cid = $wdoc->fromid;
38 
39  $query = new QueryDb($dbaccess, "DocFam");
40  $query->AddQuery("id=$cid");
41  $table1 = $query->Query(0, 0, "TABLE");
42  if ($query->nb > 0) {
43  $tdoc = $table1[0];
44 
45  if ($wdoc->isAffected() && $wdoc->usefor == "W") {
46 
49  } else {
50  $action->exitError(sprintf(_("workflow_init :: id %s is not a workflow") , $docid));
51  }
52  } else {
53  $action->exitError(sprintf(_("workflow_init :: workflow id %s not found") , $cid));
54  }
55 
56  $s = new SearchDoc($dbaccess, $wdoc->fromid);
57  $s->setObjectReturn();
58  $s->search();
59  while ($doc = $s->nextDoc()) {
60  $doc->postModify();
61  }
62 
63  $action->addWarningMsg(_("workflow has been recomposed"));
64  redirect($action, "FDL", "FDL_CARD&id=$docid");
65 }
66 ?>
← centre documentaire © anakeen - published under CC License - Dynacase