16 include_once (
'FDL/Class.Doc.php');
69 if (is_array($this->transitions)) {
70 foreach ($this->transitions as $k => $trans) {
71 $this->extendedAcls[$k] = array(
73 "description" => _($k)
78 if (isset($this->fromid)) $this->defProfFamId =
$this->fromid;
90 if ((!isset($this->doc)) || ($this->doc->id != $doc->id) ||
$force) {
92 if (($doc->doctype !=
'C') && ($doc->state ==
"")) {
111 if ($newstate !=
"") {
129 if ($newstate !=
"") {
130 $auserref = trim($this->
getRawValue($this->_Aid(
"_AFFECTREF", $newstate)));
132 $uid = $this->getAllocatedUser($newstate);
134 if ($uid) $wuid = $this->
getDocValue($uid,
"us_whatid");
136 $lock = (trim($this->
getRawValue($this->_Aid(
"_AFFECTLOCK", $newstate))) ==
"yes");
137 $err = $this->doc->allocate($wuid,
"",
false, $lock);
139 $automail = (trim($this->
getRawValue($this->_Aid(
"_AFFECTMAIL", $newstate))) ==
"yes");
141 include_once (
"FDL/mailcard.php");
145 $subject = sprintf(_(
"allocation for %s document") , $this->doc->title);
147 $err =
sendCard(
$action, $this->doc->id,
$to,
"",
$subject,
"",
true, $commentaction,
"",
"",
"htmlnotif");
153 }
else $err = $this->doc->unallocate(
"",
false);
158 private function getAllocatedUser($newstate)
160 $auserref = trim($this->
getRawValue($this->_Aid(
"_AFFECTREF", $newstate)));
162 if (!$auserref)
return false;
163 $aid = strtok($auserref,
" ");
172 $uid = $this->doc->getFamilyParameterValue($aid);
182 $uid = $this->doc->getRValue($aid);
200 if ($newstate !=
"") {
205 $this->doc->cvid =
$cvid;
207 $fdoc = $this->doc->getFamilyDocument();
208 $this->doc->cvid = $fdoc->ccvid;
213 private function _Aid($fix,
$state)
215 return strtolower($this->attrPrefix . $fix . str_replace(
":",
"_",
$state));
233 return $this->_Aid(
"_id",
$state);
297 if ($this->doctype ==
'C') $cid =
$this->id;
305 $this->
exec_query(sprintf(
"delete from docattr where docid=%d and options ~ 'autocreated=yes'", intval($cid)));
307 foreach ($this->states as $k =>
$state) {
310 $aidframe = $this->_Aid(
"_FR",
$state);
311 $oattr =
new DocAttr($this->dbaccess, array(
315 $oattr->docid = $cid;
316 $oattr->visibility =
"W";
317 $oattr->type =
"frame";
318 $oattr->id = $aidframe;
319 $oattr->frameid =
"wf_tab_states";
320 $oattr->labeltext = sprintf(_(
"parameters for %s step") , _(
$state));
322 $oattr->phpfunc =
"";
323 $oattr->options =
"autocreated=yes";
324 $oattr->ordered = $ordered++;
325 if ($oattr->isAffected()) $oattr->Modify();
329 $aidprofilid = $this->_Aid(
"_ID",
$state);
330 $oattr =
new DocAttr($this->dbaccess, array(
334 $oattr->docid = $cid;
335 $oattr->visibility =
"W";
336 $oattr->type =
'docid("PROFIL")';
337 $oattr->id = $aidprofilid;
338 $oattr->labeltext = sprintf(_(
"%s profile") , _(
$state));
340 $oattr->frameid = $aidframe;
341 $oattr->options =
"autocreated=yes";
343 $oattr->phpfile =
"fdl.php";
344 $oattr->phpfunc =
"lprofil(D,CT,WF_FAMID):$aidprofilid,CT";
345 $oattr->ordered = $ordered++;
346 if ($oattr->isAffected()) $oattr->Modify();
350 $aid = $this->_Aid(
"_MSKID",
$state);
352 $oattr =
new DocAttr($this->dbaccess, array(
356 $oattr->docid = $cid;
357 $oattr->visibility =
"W";
358 $oattr->type =
'docid("MASK")';
360 $oattr->labeltext = sprintf(_(
"%s mask") , _(
$state));
362 $oattr->frameid = $aidframe;
363 $oattr->phpfile =
"fdl.php";
364 $oattr->phpfunc =
"lmask(D,CT,WF_FAMID):$aid,CT";
366 $oattr->options =
'autocreated=yes|creation={autoclose:"yes",msk_famid:wf_famid,ba_title:"' . str_replace(
':',
' ', _(
$state)) .
'"}';
367 $oattr->ordered = $ordered++;
368 if ($oattr->isAffected()) $oattr->Modify();
372 $aid = $this->_Aid(
"_COLOR",
$state);
373 $oattr =
new DocAttr($this->dbaccess, array(
377 $oattr->docid = $cid;
378 $oattr->visibility =
"W";
379 $oattr->type =
"color";
381 $oattr->phpfile =
"";
383 $oattr->frameid = $aidframe;
384 $oattr->ordered = $ordered++;
385 $oattr->phpfunc =
"";
386 $oattr->options =
"autocreated=yes";
387 $oattr->labeltext = sprintf(_(
"%s color") , _(
$state));
388 if ($oattr->isAffected()) $oattr->Modify();
392 $aid = $this->_Aid(
"_CVID",
$state);
393 $oattr =
new DocAttr($this->dbaccess, array(
397 $oattr->docid = $cid;
398 $oattr->visibility =
"W";
399 $oattr->type =
'docid("CVDOC")';
401 $oattr->phpfile =
"fdl.php";
402 $oattr->phpfunc =
"lcvdoc(D,CT,WF_FAMID):$aid,CT";
404 $oattr->options =
'autocreated=yes|creation={autoclose:"yes",cv_famid:wf_famid,ba_title:"' . str_replace(
':',
' ', _(
$state)) .
'"}';
406 $oattr->frameid = $aidframe;
407 $oattr->ordered = $ordered++;
409 $oattr->labeltext = sprintf(_(
"%s cv") , _(
$state));
410 if ($oattr->isAffected()) $oattr->Modify();
414 $aid = $this->_Aid(
"_MTID",
$state);
415 $oattr =
new DocAttr($this->dbaccess, array(
419 $oattr->docid = $cid;
420 $oattr->visibility =
"W";
421 $oattr->type =
'docid("MAILTEMPLATE")';
423 $oattr->phpfile =
"fdl.php";
424 $oattr->phpfunc =
"lmailtemplatedoc(D,CT,WF_FAMID):$aid,CT";
426 $oattr->frameid = $aidframe;
427 $oattr->options =
"multiple=yes|autocreated=yes";
430 $oattr->options =
'autocreated=yes|multiple=yes|creation={autoclose:"yes",tmail_family:wf_famid,tmail_workflow:fromid}';
431 $oattr->ordered = $ordered++;
432 $oattr->labeltext = sprintf(_(
"%s mail template") , _(
$state));
433 if ($oattr->isAffected()) $oattr->Modify();
437 $aid = $this->_Aid(
"_TMID",
$state);
438 $oattr =
new DocAttr($this->dbaccess, array(
442 $oattr->docid = $cid;
443 $oattr->visibility =
"W";
444 $oattr->type =
'docid("TIMER")';
446 $oattr->phpfile =
"fdl.php";
447 $oattr->phpfunc =
"ltimerdoc(D,CT,WF_FAMID):$aid,CT";
450 $oattr->options =
'autocreated=yes|creation={autoclose:"yes",tm_family:wf_famid,tm_workflow:fromid,tm_title:"' . str_replace(
':',
' ', _(
$state)) .
'"}';
451 $oattr->frameid = $aidframe;
452 $oattr->ordered = $ordered++;
453 $oattr->labeltext = sprintf(_(
"%s timer") , _(
$state));
454 if ($oattr->isAffected()) $oattr->Modify();
458 $aid = $this->_Aid(
"_ASKID",
$state);
459 $oattr =
new DocAttr($this->dbaccess, array(
463 $oattr->docid = $cid;
464 $oattr->visibility =
"W";
465 $oattr->type =
'docid("WASK")';
467 $oattr->phpfile =
"";
468 $oattr->phpfunc =
"";
471 $oattr->options =
'multiple=yes|autocreated=yes|creation={autoclose:"yes"}';
472 $oattr->frameid = $aidframe;
473 $oattr->ordered = $ordered++;
474 $oattr->labeltext = sprintf(_(
"%s wask") , _(
$state));
475 if ($oattr->isAffected()) $oattr->Modify();
479 $aid = $this->_Aid(
"_ACTIVITYLABEL", $k);
480 $oattr =
new DocAttr($this->dbaccess, array(
484 $oattr->docid = $cid;
486 if (!(empty($this->stateactivity[$k]))) {
487 $oattr->visibility =
"S";
488 }
else $oattr->visibility =
"W";
489 $oattr->type =
'text';
491 $oattr->phpfile =
"";
492 $oattr->phpfunc =
"";
494 $oattr->options =
"autocreated=yes";
495 $oattr->frameid = $aidframe;
496 $oattr->ordered = $ordered++;
498 $oattr->labeltext = sprintf(_(
"%s activity") , _($k));
499 if ($oattr->isAffected()) $oattr->Modify();
503 $aid = $this->_Aid(
"_T_AFFECT",
$state);
505 $oattr =
new DocAttr($this->dbaccess, array(
509 $oattr->docid = $cid;
510 $oattr->visibility =
"U";
511 $oattr->type =
'array';
513 $oattr->frameid = $aidframe;
514 $oattr->options =
"vlabel=none|autocreated=yes";
515 $oattr->ordered = $ordered++;
516 $oattr->labeltext = sprintf(_(
"%s affectation") , _(
$state));
517 if ($oattr->isAffected()) $oattr->Modify();
520 $aid = $this->_Aid(
"_AFFECTTYPE",
$state);
522 $oattr =
new DocAttr($this->dbaccess, array(
526 $oattr->docid = $cid;
527 $oattr->visibility =
"W";
528 $oattr->type =
'enum';
529 $oattr->options =
"autocreated=yes|system=yes";
530 $oattr->phpfunc =
"F|" . _(
"Utilisateur fixe") .
",D|" . _(
"Attribut relation") .
",PR|" . _(
"Relation parametre") .
",WD|" . _(
"Relation cycle") .
",WPR|" . _(
"Parametre cycle");
532 $oattr->frameid = $afaid;
533 $oattr->ordered = $ordered++;
534 $oattr->labeltext = sprintf(_(
"%s affectation type") , _(
$state));
535 if ($oattr->isAffected()) $oattr->Modify();
538 $aid = $this->_Aid(
"_AFFECTREF",
$state);
539 $oattr =
new DocAttr($this->dbaccess, array(
543 $oattr->docid = $cid;
544 $oattr->visibility =
"W";
545 $oattr->type =
'text';
547 $oattr->options =
"cwidth=160px|autocreated=yes";
548 $oattr->phpfile =
"fdl.php";
549 $oattr->phpfunc =
"tpluser(D,$aidtype,WF_FAMID,FROMID,$aid):$aid";
551 $oattr->frameid = $afaid;
552 $oattr->ordered = $ordered++;
553 $oattr->labeltext = sprintf(_(
"%s affected user") , _(
$state));
554 if ($oattr->isAffected()) $oattr->Modify();
557 $aid = $this->_Aid(
"_AFFECTLOCK",
$state);
558 $oattr =
new DocAttr($this->dbaccess, array(
562 $oattr->docid = $cid;
563 $oattr->visibility =
"W";
564 $oattr->type =
'enum';
566 $oattr->options =
"eformat=bool|autocreated=yes|system=yes";
567 $oattr->phpfunc =
"no|" . _(
"affect no lock") .
",yes|" . _(
"affect auto lock");
569 $oattr->frameid = $afaid;
570 $oattr->ordered = $ordered++;
571 $oattr->labeltext = sprintf(_(
"%s autolock") , _(
$state));
572 if ($oattr->isAffected()) $oattr->Modify();
575 $aid = $this->_Aid(
"_AFFECTMAIL",
$state);
576 $oattr =
new DocAttr($this->dbaccess, array(
580 $oattr->docid = $cid;
581 $oattr->visibility =
"W";
582 $oattr->type =
'enum';
584 $oattr->options =
"eformat=bool|autocreated=yes|system=yes";
585 $oattr->phpfunc =
"no|" . _(
"affect no mail") .
",yes|" . _(
"affect auto mail");
587 $oattr->frameid = $afaid;
588 $oattr->ordered = $ordered++;
589 $oattr->labeltext = sprintf(_(
"%s automail") , _(
$state));
590 if ($oattr->isAffected()) $oattr->Modify();
594 foreach ($this->transitions as $k => $trans) {
597 $aidframe = $this->_Aid(
"_TRANS_FR", $k);
598 $oattr =
new DocAttr($this->dbaccess, array(
602 $oattr->docid = $cid;
603 $oattr->visibility =
"W";
604 $oattr->type =
"frame";
605 $oattr->id = $aidframe;
606 $oattr->frameid =
"wf_tab_transitions";
607 $oattr->labeltext = sprintf(_(
"parameters for %s transition") , _($k));
609 $oattr->phpfunc =
"";
610 $oattr->options =
"autocreated=yes";
611 $oattr->ordered = $ordered++;
612 if ($oattr->isAffected()) $oattr->Modify();
616 $aid = $this->_Aid(
"_TRANS_MTID", $k);
617 $oattr =
new DocAttr($this->dbaccess, array(
621 $oattr->docid = $cid;
622 $oattr->visibility =
"W";
623 $oattr->type =
'docid("MAILTEMPLATE")';
625 $oattr->phpfile =
"fdl.php";
626 $oattr->phpfunc =
"lmailtemplatedoc(D,CT,WF_FAMID):$aid,CT";
629 $oattr->frameid = $aidframe;
630 $oattr->ordered = $ordered++;
631 $oattr->options =
'autocreated=yes|multiple=yes|creation={autoclose:"yes",tmail_family:wf_famid,tmail_workflow:fromid}';
633 $oattr->labeltext = sprintf(_(
"%s mail template") , _($k));
634 if ($oattr->isAffected()) $oattr->Modify();
638 $aid = $this->_Aid(
"_TRANS_TMID", $k);
639 $oattr =
new DocAttr($this->dbaccess, array(
643 $oattr->docid = $cid;
644 $oattr->visibility =
"W";
645 $oattr->type =
'docid("TIMER")';
647 $oattr->phpfile =
"fdl.php";
648 $oattr->phpfunc =
"ltimerdoc(D,CT,WF_FAMID):$aid,CT";
650 $oattr->options =
'autocreated=yes|creation={autoclose:"yes",tm_family:wf_famid,tm_workflow:fromid,tm_title:"' . str_replace(
':',
' ', _($k)) .
'"}';
653 $oattr->frameid = $aidframe;
654 $oattr->ordered = $ordered++;
655 $oattr->labeltext = sprintf(_(
"%s timer") , _($k));
656 if ($oattr->isAffected()) $oattr->Modify();
660 $aid = $this->_Aid(
"_TRANS_PA_TMID", $k);
661 $oattr =
new DocAttr($this->dbaccess, array(
665 $oattr->docid = $cid;
666 $oattr->visibility =
"W";
667 $oattr->type =
'docid("TIMER")';
669 $oattr->phpfile =
"fdl.php";
670 $oattr->phpfunc =
"ltimerdoc(D,CT,WF_FAMID):$aid,CT";
672 $oattr->options =
'multiple=yes|autocreated=yes|creation={autoclose:"yes",tm_family:wf_famid,tm_workflow:fromid,tm_title:"' . str_replace(
':',
' ', _($k)) .
'"}';
675 $oattr->frameid = $aidframe;
676 $oattr->ordered = $ordered++;
677 $oattr->labeltext = sprintf(_(
"%s persistent timer") , _($k));
678 if ($oattr->isAffected()) $oattr->Modify();
682 $aid = $this->_Aid(
"_TRANS_PU_TMID", $k);
683 $oattr =
new DocAttr($this->dbaccess, array(
687 $oattr->docid = $cid;
688 $oattr->visibility =
"W";
689 $oattr->type =
'docid("TIMER")';
691 $oattr->phpfile =
"fdl.php";
692 $oattr->phpfunc =
"ltimerdoc(D,CT,WF_FAMID):$aid,CT";
695 $oattr->options =
"multiple=yes|autocreated=yes";
696 $oattr->frameid = $aidframe;
697 $oattr->ordered = $ordered++;
698 $oattr->labeltext = sprintf(_(
"%s unattach timer") , _($k));
699 if ($oattr->isAffected()) $oattr->Modify();
722 function changeState($newstate, $addcomment =
"",
$force =
false, $withcontrol =
true, $wm1 =
true, $wm2 =
true, $wneed =
true, $wm0 =
true, $wm3 =
true, &$msg =
'')
731 foreach ($this->cycle as $trans) {
732 if (($this->doc->state == $trans[
"e1"])) {
735 if ($newstate == $trans[
"e2"]) {
737 $tr = $this->transitions[$trans[
"t"]];
738 $tname = $trans[
"t"];
743 if ($this->userid != 1) {
744 if (!$foundTo)
return (sprintf(_(
"ChangeState :: the new state '%s' is not known or is not allowed from %s") , _($newstate) , _($this->doc->state)));
745 if (!$foundFrom)
return (sprintf(_(
"ChangeState :: the initial state '%s' is not known") , _($this->doc->state)));
746 if ($this->doc->isLocked()) {
747 $lockUserId = abs($this->doc->locked);
749 if (is_object($lockUserAccount) && $lockUserAccount->isAlive()) {
750 $lockUserTitle = $lockUserAccount->getTitle();
751 if ($lockUserId != $this->userid) {
753 if ($this->doc->locked < 0) {
755 return sprintf(_(
"Could not perform transition because the document is being edited by '%s'") , $lockUserTitle);
758 return sprintf(_(
"Could not perform transition because the document is locked by '%s'") , $lockUserTitle);
770 if ($wm0 && (!empty($tr[
"m0"]))) {
772 if (!method_exists($this, $tr[
"m0"]))
return (sprintf(_(
"the method '%s' is not known for the object class %s") , $tr[
"m0"], get_class($this)));
774 $err = call_user_func(array(
777 ) , $newstate, $this->doc->state, $addcomment);
779 $this->doc->unlock(
true);
780 return (sprintf(_(
"Error : %s") ,
$err));
784 if ($wm1 && (!empty($tr[
"m1"]))) {
786 if (!method_exists($this, $tr[
"m1"]))
return (sprintf(_(
"the method '%s' is not known for the object class %s") , $tr[
"m1"], get_class($this)));
788 $err = call_user_func(array(
791 ) , $newstate, $this->doc->state, $addcomment);
799 if ($addcomment !=
"") $this->doc->addHistoryEntry($addcomment);
805 $this->doc->unlock(
true);
806 return (sprintf(_(
"Error : %s") ,
$err));
811 $err = $this->doc->isCompleteNeeded();
815 $oldstate = $this->doc->state ==
"" ?
" " : $this->doc->state;
816 $this->doc->state = $newstate;
819 $this->doc->disableEditControl();
820 $err = $this->doc->Modify();
823 $revcomment = sprintf(_(
"change state : %s to %s") , _($oldstate) , _($newstate));
824 if ($addcomment !=
"") $this->doc->addHistoryEntry($addcomment);
825 if (isset($tr[
"ask"])) {
826 foreach ($tr[
"ask"] as $vpid) {
828 if ($oa->type ===
"array") {
829 $elem = $this->attributes->getArrayElements($oa->id);
830 foreach ($elem as $aid => $arrayAttribute) {
831 if ($oa->type ==
"password") {
832 $displayValue =
"*****";
834 $displayValue = str_replace(
"\n",
", ", $this->
getRawValue($arrayAttribute->id));
836 $revcomment.= sprintf(
"\n-%s : %s", $arrayAttribute->getLabel() , $displayValue);
842 if ($oa->type ==
"password") {
847 $pv = implode(
", ", $pv);
849 $revcomment.= sprintf(
"\n-%s : %s", $oa->getLabel() , $pv);
854 $incumbentName =
getCurrentUser()->getIncumbentPrivilege($this, $tname);
855 if ($incumbentName) $revcomment = sprintf(_(
"(substitute of %s) : ") , $incumbentName) . $revcomment;
856 $err = $this->doc->revise($revcomment);
858 $this->doc->disableEditControl();
859 $this->doc->state = $oldstate;
862 $err2 = $this->doc->Modify();
863 $this->doc->enableEditControl();
867 AddLogMsg(sprintf(_(
"%s new state %s") , $this->doc->title, _($newstate)));
869 $this->doc->enableEditControl();
872 if ($wm2 && (!empty($tr[
"m2"]))) {
873 if (!method_exists($this, $tr[
"m2"]))
return (sprintf(_(
"the method '%s' is not known for the object class %s") , $tr[
"m2"], get_class($this)));
874 $msg2 = call_user_func(array(
877 ) , $newstate, $oldstate, $addcomment);
879 if ($msg2 ==
"->") $msg2 =
"";
880 if ($msg2) $this->doc->addHistoryEntry($msg2);
881 if ($msg2 !=
"") $msg2 = sprintf(_(
"Warning : %s") , $msg2);
883 $this->doc->addLog(
"state", array(
885 "initid" => $this->initid,
887 "title" => $this->title,
888 "state" => $this->state,
891 $this->doc->disableEditControl();
892 if (!$this->domainid) $this->doc->unlock(
false,
true);
893 $msg.= $this->workflowSendMailTemplate($newstate, $addcomment, $tname);
894 $this->workflowAttachTimer($newstate, $tname);
898 if ($wm3 && (!empty($tr[
"m3"]))) {
899 if (!method_exists($this, $tr[
"m3"]))
return (sprintf(_(
"the method '%s' is not known for the object class %s") , $tr[
"m3"], get_class($this)));
900 $msg3 = call_user_func(array(
903 ) , $newstate, $oldstate, $addcomment);
905 if ($msg3 ==
"->") $msg3 =
"";
906 if ($msg3) $this->doc->addHistoryEntry($msg3);
907 if ($msg3 !=
"") $msg3 = sprintf(_(
"Warning : %s") , $msg3);
909 $msg.= ($msg && $msg2 ?
"\n" :
'') . $msg2;
910 if ($msg && $msg3) $msg.=
"\n";
912 $this->doc->enableEditControl();
923 if ($this->doc->locked == - 1)
return array();
924 if (($this->doc->locked > 0) && ($this->doc->locked != $this->doc->userid))
return array();
925 if ((!$noVerifyDomain) && ($this->doc->lockdomainid > 0))
return array();
927 if ($this->doc->state ==
"") {
931 if ($this->userid == 1) {
934 foreach ($this->cycle as $tr) {
935 if ($this->doc->state == $tr[
"e1"]) {
937 if ($this->
control($tr[
"t"]) ==
"") $fstate[] = $tr[
"e2"];
948 if ($this->states === null) {
949 $this->states = array();
950 foreach ($this->cycle as $k => $tr) {
951 if (!empty($tr[
"e1"])) $this->states[$tr[
"e1"]] = $tr[
"e1"];
952 if (!empty($tr[
"e2"])) $this->states[$tr[
"e2"]] = $tr[
"e2"];
966 $acolor = $this->_Aid(
"_COLOR",
$state);
978 $acolor = $this->_Aid(
"_ACTIVITYLABEL",
$state);
980 if ($v)
return _($v);
1002 function getDocumentWasks(
$state, $control =
true)
1004 $aask = $this->_Aid(
"_ASKID",
$state);
1008 foreach ($vasks as $askid) {
1012 $ask = new_doc($this->dbaccess, $askid);
1013 $ask->set($this->doc);
1014 if ($ask->isAlive() && ($ask->control(
'answer') ==
"")) $cask[] = $ask->id;
1030 $aask = $this->_Aid(
"_ASKID", $state);
1042 function workflowSendMailTemplate(
$state,
$comment =
"", $tname =
"")
1047 $tr = ($tname) ? $this->transitions[$tname] : null;
1048 if ($tmtid && (count($tmtid) > 0)) {
1049 foreach ($tmtid as $mtid) {
1054 $mt = new_doc($this->dbaccess, $mtid);
1055 if ($mt->isAlive()) {
1056 $keys[
"WCOMMENT"] = nl2br(
$comment);
1057 if (isset($tr[
"ask"])) {
1058 foreach ($tr[
"ask"] as $vpid) {
1060 $keys[strtoupper($vpid) ] = $this->
getRawValue($vpid);
1063 $err.= $mt->sendDocument($this->doc, $keys);
1069 if ($tmtid && (count($tmtid) > 0)) {
1070 foreach ($tmtid as $mtid) {
1072 $mt = new_doc($this->dbaccess, $mtid);
1076 if ($mt->isAlive()) {
1077 $keys[
"WCOMMENT"] = nl2br(
$comment);
1078 if (isset($tr[
"ask"])) {
1079 foreach ($tr[
"ask"] as $vpid) {
1081 $keys[strtoupper($vpid) ] = $this->
getRawValue($vpid);
1084 $err.= $mt->sendDocument($this->doc, $keys);
1096 function workflowAttachTimer(
$state, $tname =
"")
1099 $mtid = $this->
getRawValue($this->_Aid(
"_TRANS_TMID", $tname));
1101 $this->doc->unattachAllTimers($this);
1107 $mt = new_doc($this->dbaccess, $mtid);
1108 if ($mt->isAlive()) {
1109 $err = $this->doc->attachTimer($mt, $this);
1114 if ($tmtid && (count($tmtid) > 0)) {
1115 foreach ($tmtid as $mtid) {
1116 $mt = new_doc($this->dbaccess, $mtid);
1117 if ($mt->isAlive()) {
1118 $err.= $this->doc->unattachTimer($mt);
1125 $mt = new_doc($this->dbaccess, $mtid);
1126 if ($mt->isAlive()) {
1127 $err.= $this->doc->attachTimer($mt, $this);
1132 if ($tmtid && (count($tmtid) > 0)) {
1133 foreach ($tmtid as $mtid) {
1134 $mt = new_doc($this->dbaccess, $mtid);
1135 if ($mt->isAlive()) {
1136 $err.= $this->doc->attachTimer($mt);
1153 $cmdid =
$cmd->getLatestId();
1156 if (
$cmd->wid > 0) {
1162 if (!
$wdoc)
$err = sprintf(_(
"cannot change state of document #%d to %s") ,
$cmd->wid, $newstate);
1165 $err =
$wdoc->ChangeState($newstate, sprintf(_(
"automaticaly by change state of %s\n%s") , $this->doc->title,
$comment));
1178 foreach ($this->cycle as $v) {
1179 if (($v[
"e1"] ==
$from) && ($v[
"e2"] ==
$to)) {
1180 $t = $this->transitions[$v[
"t"]];
1196 return Doc::Control($aclname,
$strict);
1210 if ($this->pdoc === null) {
1211 $pdoc =
createDoc($this->dbaccess, $this->fromid,
false);
1212 $pdoc->doctype =
"T";
1214 $err = $pdoc->Add();
1215 if (
$err !=
"")
return "WDoc::Control:" .
$err;
1216 $pdoc->setProfil($this->profid, $this->doc);
1218 $this->pdoc = & $pdoc;
1220 $err = $this->pdoc->docControl($aclname,
$strict);
1229 foreach ($this->stateactivity as $k => $v) {
1230 $this->
setValue($this->_Aid(
"_ACTIVITYLABEL", $k) , $v);
1233 foreach ($this->states as $k =>
$state) {
1249 return $this->doc->getRawValue($attrid, $def);
getHtmlAttrValue($attrid, $target="_self", $htmllink=2, $index=-1, $entities=true, $abstract=false)
getStateProfilAttribute($state)
changeAllocateUser($newstate)
& getAttribute($idAttr, &$oa=null, $useMask=true)
exec_query($sql, $lvl=0, $prepare=false)
refreshPhpPgDoc($dbaccess, $docid)
getDocFromUserId($dbaccess, $userid)
sendCard(Action &$action, $docid, $to, $cc, $subject, $zonebodycard="", $ulink=false, $comment="", $from="", $bcc="", $format="html", $sendercopy=true, $addfiles=array(), $userinfo=null, $savecopy=false)
getAction($state, $def="")
set(Doc &$doc, $force=false)
getColor($state, $def="")
changeState($newstate, $addcomment="", $force=false, $withcontrol=true, $wm1=true, $wm2=true, $wneed=true, $wm0=true, $wm3=true, &$msg= '')
removeArrayRow($idAttr, $index)
getRValue($RidAttr, $def="", $latest=true, $html=false)
getFamilyParameterValue($idp, $def="")
modify($nopost=false, $sfields="", $nopre=false)
foreach($argv as $arg) $cmd
getDocValue($docid, $attrid, $def=" ", $latest=false)
getTransitionTimers($transName)
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
docControl($aclname, $strict=false)
control($aclname, $strict=false)
setValue($attrid, $value, $index=-1, &$kvalue=null)
getMultipleRawValues($idAttr, $def="", $index=-1)
getTransition($from, $to)
getInstanceValue($attrid, $def=false)
revision(Action &$action)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
getTitle($id="-1", $def="", $latest=false)
deprecatedFunction($msg= '')
new_Doc($dbaccess, $id= '', $latest=false)
getStateMailTemplate($state)
getTransitionMailTemplates($transName)
getIdFromName($dbaccess, $name)
if($file) if($subject==""&&$file) if($subject=="") $err
getStateViewControl($state)
getFollowingStates($noVerifyDomain=false)
getRawValue($idAttr, $def="")
getActivity($state, $def="")
control($aclname, $strict=false)
createProfileAttribute($cid=0)