18 include_once (
"FDL/Lib.Attr.php");
19 include_once (
"FDL/Class.DocFam.php");
28 print "Database not found : appl->dbaccess";
33 $usage->setDefinitionText(
"Execute Dynacase Processes");
34 $docid =
$usage->addOptionalParameter(
"docid",
"special docid", null, 0);
35 $comment = base64_decode(
$usage->addOptionalParameter(
"comment",
"additionnal comment", null,
""));
45 if (
$doc->locked == - 1) {
49 $doc->setValue(
"exec_status",
"progressing");
50 $doc->setValue(
"exec_statusdate",
$doc->getTimeDate());
51 $doc->modify(
true, array(
59 $cmd.=
">$fout 2>$ferr";
61 system(
$cmd, $statut);
63 $ms = gmstrftime(
"%H:%M:%S", $m2);
65 if (file_exists($fout)) {
66 $doc->setValue(
"exec_detail", file_get_contents($fout));
69 if (file_exists($ferr)) {
70 $doc->setValue(
"exec_detaillog", file_get_contents($ferr));
74 $doc->clearValue(
"exec_nextdate");
75 $doc->setValue(
"exec_elapsed", $ms);
76 $doc->setValue(
"exec_date", date(
"d/m/Y H:i "));
77 $doc->clearValue(
"exec_status");
78 $doc->clearValue(
"exec_statusdate");
79 $doc->setValue(
"exec_state", (($statut == 0) ?
"OK" : $statut));
80 $puserid =
$doc->getRawValue(
"exec_iduser");
81 $doc->setValue(
"exec_iduser",
$doc->getExecUserID());
86 $err =
$doc->revise(sprintf(_(
"execution by %s done %s") ,
$doc->getTitle(
$doc->getExecUserID()) , $statut));
88 $doc->clearValue(
"exec_elapsed");
89 $doc->clearValue(
"exec_detail");
90 $doc->clearValue(
"exec_detaillog");
91 $doc->clearValue(
"exec_date");
92 $doc->clearValue(
"exec_state");
93 $doc->setValue(
"exec_iduser", $puserid);
foreach($argv as $arg) $cmd
getFamIdFromName($dbaccess, $name)
new_Doc($dbaccess, $id= '', $latest=false)
if($file) if($subject==""&&$file) if($subject=="") $err
Verify arguments for wsh programs.