Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.WDoc.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Workflow Class Document
8  *
9  * @author Anakeen
10  * @version $Id: Class.WDoc.php,v 1.63 2009/01/08 17:47:07 eric Exp $
11  * @package FDL
12  */
13 /**
14  */
15 
16 include_once ('FDL/Class.Doc.php');
17 /**
18  * WorkFlow Class
19  */
20 class WDoc extends Doc
21 {
22  /**
23  * WDoc has its own special access depend on transition
24  * by default the three access are always set
25  *
26  * @var array
27  */
28  var $acls = array(
29  "view",
30  "edit",
31  "delete"
32  );
33 
34  var $usefor = 'SW';
35  var $defDoctype = 'W';
36  var $defClassname = 'WDoc';
37  var $attrPrefix = "WF"; // prefix attribute
38 
39  /**
40  * state's activities labels
41  * @var array
42  */
43  var $stateactivity = array(); // label of states
44  // --------------------------------------------------------------------
45  //---------------------- TRANSITION DEFINITION --------------------
46  var $transitions = array(); // set by childs classes
47  var $cycle = array(); // set by childs classes
48  var $autonext = array(); // set by childs classes
49  var $firstState = ""; // first state in workflow
50  var $viewnext = "list"; // view interface as select list may be (list|button)
51  var $nosave = array(); // states where it is not permitted to save and stay (force next state)
52 
53  /**
54  * @var array
55  */
56  public $states = null;
57  /**
58  * @var WDoc|null
59  */
60  private $pdoc = null;
61  /**
62  * document instance
63  * @var Doc
64  */
65  public $doc = null;
66  function __construct($dbaccess = '', $id = '', $res = '', $dbid = 0)
67  {
68  // first construct acl array
69  if (is_array($this->transitions)) {
70  foreach ($this->transitions as $k => $trans) {
71  $this->extendedAcls[$k] = array(
72  "name" => $k,
73  "description" => _($k)
74  );
75  $this->acls[] = $k;
76  }
77  }
78  if (isset($this->fromid)) $this->defProfFamId = $this->fromid; // it's a profil itself
79  // don't use Doc constructor because it could call this constructor => infinitive loop
81  }
82  /**
83  * affect document instance
84  * @param Doc $doc document to use for workflow
85  * @param bool $force set to true to force a doc reset
86  * @return void
87  */
88  function set(Doc & $doc, $force = false)
89  {
90  if ((!isset($this->doc)) || ($this->doc->id != $doc->id) || $force) {
91  $this->doc = & $doc;
92  if (($doc->doctype != 'C') && ($doc->state == "")) {
93  $doc->state = $this->getFirstState();
94  $this->changeProfil($doc->state);
95  $this->changeCv($doc->state);
96  }
97  }
98  }
99  function getFirstState()
100  {
101  return $this->firstState;
102  }
103  /**
104  * change profil according to state
105  * @param string $newstate new state of document
106  * @return string
107  */
108  function changeProfil($newstate)
109  {
110  $err = '';
111  if ($newstate != "") {
112  $profid = $this->getRawValue($this->_Aid("_ID", $newstate));
113  if (!is_numeric($profid)) $profid = getIdFromName($this->dbaccess, $profid);
114  if ($profid > 0) {
115  // change only if new profil
116  $err = $this->doc->setProfil($profid);
117  }
118  }
119  return $err;
120  }
121  /**
122  * change allocate user according to state
123  * @param string $newstate new state of document
124  * @return string
125  */
126  function changeAllocateUser($newstate)
127  {
128  $err = "";
129  if ($newstate != "") {
130  $auserref = trim($this->getRawValue($this->_Aid("_AFFECTREF", $newstate)));
131  if ($auserref) {
132  $uid = $this->getAllocatedUser($newstate);
133  $wuid = 0;
134  if ($uid) $wuid = $this->getDocValue($uid, "us_whatid");
135  if ($wuid > 0) {
136  $lock = (trim($this->getRawValue($this->_Aid("_AFFECTLOCK", $newstate))) == "yes");
137  $err = $this->doc->allocate($wuid, "", false, $lock);
138  if ($err == "") {
139  $automail = (trim($this->getRawValue($this->_Aid("_AFFECTMAIL", $newstate))) == "yes");
140  if ($automail) {
141  include_once ("FDL/mailcard.php");
142  $to = trim($this->getDocValue($uid, "us_mail"));
143  if (!$to) addWarningMsg(sprintf(_("%s has no email address") , $this->getTitle($uid)));
144  else {
145  $subject = sprintf(_("allocation for %s document") , $this->doc->title);
146  $commentaction = '';
147  $err = sendCard($action, $this->doc->id, $to, "", $subject, "", true, $commentaction, "", "", "htmlnotif");
148  if ($err != "") addWarningMsg($err);
149  }
150  }
151  }
152  }
153  } else $err = $this->doc->unallocate("", false);
154  }
155  return $err;
156  }
157 
158  private function getAllocatedUser($newstate)
159  {
160  $auserref = trim($this->getRawValue($this->_Aid("_AFFECTREF", $newstate)));
161  $type = trim($this->getRawValue($this->_Aid("_AFFECTTYPE", $newstate)));
162  if (!$auserref) return false;
163  $aid = strtok($auserref, " ");
164  $uid = false;
165  switch ($type) {
166  case 'F': // fixed address
167  // $wuid=$this->getDocValue($aid,"us_whatid");
168  $uid = $aid;
169  break;
170 
171  case 'PR': // docid parameter
172  $uid = $this->doc->getFamilyParameterValue($aid);
173  // if ($uid) $wuid=$this->getDocValue($uid,"us_whatid");
174  break;
175 
176  case 'WPR': // workflow docid parameter
177  $uid = $this->getFamilyParameterValue($aid);
178  // if ($uid) $wuid=$this->getDocValue($uid,"us_whatid");
179  break;
180 
181  case 'D': // user relations
182  $uid = $this->doc->getRValue($aid);
183  // if ($uid) $wuid=$this->getDocValue($docid,'us_whatid');
184  break;
185 
186  case 'WD': // user relations
187  $uid = $this->getRValue($aid);
188  // if ($uid) $wuid=$this->getDocValue($docid,'us_whatid');
189  break;
190  }
191  return $uid;
192  }
193  /**
194  * change cv according to state
195  * @param string $newstate new state of document
196  */
197  function changeCv($newstate)
198  {
199 
200  if ($newstate != "") {
201  $cvid = ($this->getRawValue($this->_Aid("_CVID", $newstate)));
202  if (!is_numeric($cvid)) $cvid = getIdFromName($this->dbaccess, $cvid);
203  if ($cvid > 0) {
204  // change only if set
205  $this->doc->cvid = $cvid;
206  } else {
207  $fdoc = $this->doc->getFamilyDocument();
208  $this->doc->cvid = $fdoc->ccvid;
209  }
210  }
211  }
212 
213  private function _Aid($fix, $state)
214  {
215  return strtolower($this->attrPrefix . $fix . str_replace(":", "_", $state));
216  }
217  /**
218  * get the profile id according to state
219  * @param string $state
220  * @return string
221  */
222  public function getStateProfil($state)
223  {
224  return $this->getRawValue($this->_Aid("_id", $state));
225  }
226  /**
227  * get the attribute id for profile id according to state
228  * @param string $state
229  * @return string
230  */
232  {
233  return $this->_Aid("_id", $state);
234  }
235  /**
236  * get the mask id according to state
237  * @param string $state
238  * @return string
239  */
240  public function getStateMask($state)
241  {
242  return $this->getRawValue($this->_Aid("_mskid", $state));
243  }
244  /**
245  * get the view control id according to state
246  * @param string $state
247  * @return string
248  */
249  public function getStateViewControl($state)
250  {
251  return $this->getRawValue($this->_Aid("_cvid", $state));
252  }
253  /**
254  * get the timers ids according to state
255  * @param string $state
256  * @return string
257  */
258  public function getStateTimers($state)
259  {
260  return $this->getRawValue($this->_Aid("_tmid", $state));
261  }
262  /**
263  * get the timers ids according to transition
264  * @param string $transName transition name
265  * @return array
266  */
267  public function getTransitionTimers($transName)
268  {
269  return array_merge($this->getMultipleRawValues($this->_Aid("_trans_pa_tmid", $transName)) , $this->getMultipleRawValues($this->_Aid("_trans_tmid", $transName)));
270  }
271  /**
272  * get the mail ids according to transition
273  * @param string $transName transition name
274  * @return array
275  */
276  public function getTransitionMailTemplates($transName)
277  {
278  return $this->getMultipleRawValues($this->_Aid("_trans_mtid", $transName));
279  }
280  /**
281  * get the mail templates ids according to state
282  * @param string $state
283  * @return array
284  */
285  public function getStateMailTemplate($state)
286  {
287  return $this->getMultipleRawValues($this->_Aid("_mtid", $state));
288  }
289  /**
290  * create of parameters attributes of workflow
291  * @param int $cid
292  * @return string error message
293  */
294  public function createProfileAttribute($cid = 0)
295  {
296  if (!$cid) {
297  if ($this->doctype == 'C') $cid = $this->id;
298  else $cid = $this->fromid;
299  }
300  $ordered = 1000;
301  if (($err = $this->setMasterLock(true)) !== '') {
302  return $err;
303  }
304  // delete old attributes before
305  $this->exec_query(sprintf("delete from docattr where docid=%d and options ~ 'autocreated=yes'", intval($cid)));
306  $this->getStates();
307  foreach ($this->states as $k => $state) {
308  // --------------------------
309  // frame
310  $aidframe = $this->_Aid("_FR", $state);
311  $oattr = new DocAttr($this->dbaccess, array(
312  $cid,
313  $aidframe
314  ));
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));
321  $oattr->link = "";
322  $oattr->phpfunc = "";
323  $oattr->options = "autocreated=yes";
324  $oattr->ordered = $ordered++;
325  if ($oattr->isAffected()) $oattr->Modify();
326  else $oattr->Add();
327  // --------------------------
328  // profil id
329  $aidprofilid = $this->_Aid("_ID", $state); //strtolower($this->attrPrefix."_ID".strtoupper($state));
330  $oattr = new DocAttr($this->dbaccess, array(
331  $cid,
332  $aidprofilid
333  ));
334  $oattr->docid = $cid;
335  $oattr->visibility = "W";
336  $oattr->type = 'docid("PROFIL")';
337  $oattr->id = $aidprofilid;
338  $oattr->labeltext = sprintf(_("%s profile") , _($state));
339  $oattr->link = "";
340  $oattr->frameid = $aidframe;
341  $oattr->options = "autocreated=yes";
342 
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();
347  else $oattr->Add();
348  // --------------------------
349  // mask id
350  $aid = $this->_Aid("_MSKID", $state);
351 
352  $oattr = new DocAttr($this->dbaccess, array(
353  $cid,
354  $aid
355  ));
356  $oattr->docid = $cid;
357  $oattr->visibility = "W";
358  $oattr->type = 'docid("MASK")';
359  $oattr->id = $aid;
360  $oattr->labeltext = sprintf(_("%s mask") , _($state));
361  $oattr->link = "";
362  $oattr->frameid = $aidframe;
363  $oattr->phpfile = "fdl.php";
364  $oattr->phpfunc = "lmask(D,CT,WF_FAMID):$aid,CT";
365  $oattr->elink = '';
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();
369  else $oattr->Add();
370  // --------------------------
371  // state color
372  $aid = $this->_Aid("_COLOR", $state);
373  $oattr = new DocAttr($this->dbaccess, array(
374  $cid,
375  $aid
376  ));
377  $oattr->docid = $cid;
378  $oattr->visibility = "W";
379  $oattr->type = "color";
380  $oattr->link = "";
381  $oattr->phpfile = "";
382  $oattr->id = $aid;
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();
389  else $oattr->Add();
390  // --------------------------
391  // CV link
392  $aid = $this->_Aid("_CVID", $state);
393  $oattr = new DocAttr($this->dbaccess, array(
394  $cid,
395  $aid
396  ));
397  $oattr->docid = $cid;
398  $oattr->visibility = "W";
399  $oattr->type = 'docid("CVDOC")';
400  $oattr->link = "";
401  $oattr->phpfile = "fdl.php";
402  $oattr->phpfunc = "lcvdoc(D,CT,WF_FAMID):$aid,CT";
403  $oattr->elink = '';
404  $oattr->options = 'autocreated=yes|creation={autoclose:"yes",cv_famid:wf_famid,ba_title:"' . str_replace(':', ' ', _($state)) . '"}';
405  $oattr->id = $aid;
406  $oattr->frameid = $aidframe;
407  $oattr->ordered = $ordered++;
408 
409  $oattr->labeltext = sprintf(_("%s cv") , _($state));
410  if ($oattr->isAffected()) $oattr->Modify();
411  else $oattr->Add();
412  // --------------------------
413  // Mail template link
414  $aid = $this->_Aid("_MTID", $state);
415  $oattr = new DocAttr($this->dbaccess, array(
416  $cid,
417  $aid
418  ));
419  $oattr->docid = $cid;
420  $oattr->visibility = "W";
421  $oattr->type = 'docid("MAILTEMPLATE")';
422  $oattr->link = "";
423  $oattr->phpfile = "fdl.php";
424  $oattr->phpfunc = "lmailtemplatedoc(D,CT,WF_FAMID):$aid,CT";
425  $oattr->id = $aid;
426  $oattr->frameid = $aidframe;
427  $oattr->options = "multiple=yes|autocreated=yes";
428 
429  $oattr->elink = '';
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();
434  else $oattr->Add();
435  // --------------------------
436  // Timer link
437  $aid = $this->_Aid("_TMID", $state);
438  $oattr = new DocAttr($this->dbaccess, array(
439  $cid,
440  $aid
441  ));
442  $oattr->docid = $cid;
443  $oattr->visibility = "W";
444  $oattr->type = 'docid("TIMER")';
445  $oattr->link = "";
446  $oattr->phpfile = "fdl.php";
447  $oattr->phpfunc = "ltimerdoc(D,CT,WF_FAMID):$aid,CT";
448  $oattr->id = $aid;
449  $oattr->elink = '';
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();
455  else $oattr->Add();
456  // --------------------------
457  // Ask link
458  $aid = $this->_Aid("_ASKID", $state);
459  $oattr = new DocAttr($this->dbaccess, array(
460  $cid,
461  $aid
462  ));
463  $oattr->docid = $cid;
464  $oattr->visibility = "W";
465  $oattr->type = 'docid("WASK")';
466  $oattr->link = "";
467  $oattr->phpfile = "";
468  $oattr->phpfunc = "";
469  $oattr->id = $aid;
470  $oattr->elink = '';
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();
476  else $oattr->Add();
477  // --------------------------
478  // Label action
479  $aid = $this->_Aid("_ACTIVITYLABEL", $k);
480  $oattr = new DocAttr($this->dbaccess, array(
481  $cid,
482  $aid
483  ));
484  $oattr->docid = $cid;
485 
486  if (!(empty($this->stateactivity[$k]))) {
487  $oattr->visibility = "S";
488  } else $oattr->visibility = "W";
489  $oattr->type = 'text';
490  $oattr->link = "";
491  $oattr->phpfile = "";
492  $oattr->phpfunc = "";
493  $oattr->id = $aid;
494  $oattr->options = "autocreated=yes";
495  $oattr->frameid = $aidframe;
496  $oattr->ordered = $ordered++;
497 
498  $oattr->labeltext = sprintf(_("%s activity") , _($k));
499  if ($oattr->isAffected()) $oattr->Modify();
500  else $oattr->Add();
501  // --------------------------
502  // Affected user link
503  $aid = $this->_Aid("_T_AFFECT", $state);
504  $afaid = $aid;
505  $oattr = new DocAttr($this->dbaccess, array(
506  $cid,
507  $aid
508  ));
509  $oattr->docid = $cid;
510  $oattr->visibility = "U";
511  $oattr->type = 'array';
512  $oattr->id = $aid;
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();
518  else $oattr->Add();
519 
520  $aid = $this->_Aid("_AFFECTTYPE", $state);
521  $aidtype = $aid;
522  $oattr = new DocAttr($this->dbaccess, array(
523  $cid,
524  $aid
525  ));
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");
531  $oattr->id = $aid;
532  $oattr->frameid = $afaid;
533  $oattr->ordered = $ordered++;
534  $oattr->labeltext = sprintf(_("%s affectation type") , _($state));
535  if ($oattr->isAffected()) $oattr->Modify();
536  else $oattr->Add();
537 
538  $aid = $this->_Aid("_AFFECTREF", $state);
539  $oattr = new DocAttr($this->dbaccess, array(
540  $cid,
541  $aid
542  ));
543  $oattr->docid = $cid;
544  $oattr->visibility = "W";
545  $oattr->type = 'text';
546  $oattr->link = "";
547  $oattr->options = "cwidth=160px|autocreated=yes";
548  $oattr->phpfile = "fdl.php";
549  $oattr->phpfunc = "tpluser(D,$aidtype,WF_FAMID,FROMID,$aid):$aid";
550  $oattr->id = $aid;
551  $oattr->frameid = $afaid;
552  $oattr->ordered = $ordered++;
553  $oattr->labeltext = sprintf(_("%s affected user") , _($state));
554  if ($oattr->isAffected()) $oattr->Modify();
555  else $oattr->Add();
556 
557  $aid = $this->_Aid("_AFFECTLOCK", $state);
558  $oattr = new DocAttr($this->dbaccess, array(
559  $cid,
560  $aid
561  ));
562  $oattr->docid = $cid;
563  $oattr->visibility = "W";
564  $oattr->type = 'enum';
565  $oattr->link = "";
566  $oattr->options = "eformat=bool|autocreated=yes|system=yes";
567  $oattr->phpfunc = "no|" . _("affect no lock") . ",yes|" . _("affect auto lock");
568  $oattr->id = $aid;
569  $oattr->frameid = $afaid;
570  $oattr->ordered = $ordered++;
571  $oattr->labeltext = sprintf(_("%s autolock") , _($state));
572  if ($oattr->isAffected()) $oattr->Modify();
573  else $oattr->Add();
574 
575  $aid = $this->_Aid("_AFFECTMAIL", $state);
576  $oattr = new DocAttr($this->dbaccess, array(
577  $cid,
578  $aid
579  ));
580  $oattr->docid = $cid;
581  $oattr->visibility = "W";
582  $oattr->type = 'enum';
583  $oattr->link = "";
584  $oattr->options = "eformat=bool|autocreated=yes|system=yes";
585  $oattr->phpfunc = "no|" . _("affect no mail") . ",yes|" . _("affect auto mail");
586  $oattr->id = $aid;
587  $oattr->frameid = $afaid;
588  $oattr->ordered = $ordered++;
589  $oattr->labeltext = sprintf(_("%s automail") , _($state));
590  if ($oattr->isAffected()) $oattr->Modify();
591  else $oattr->Add();
592  }
593 
594  foreach ($this->transitions as $k => $trans) {
595  // --------------------------
596  // frame
597  $aidframe = $this->_Aid("_TRANS_FR", $k);
598  $oattr = new DocAttr($this->dbaccess, array(
599  $cid,
600  $aidframe
601  ));
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));
608  $oattr->link = "";
609  $oattr->phpfunc = "";
610  $oattr->options = "autocreated=yes";
611  $oattr->ordered = $ordered++;
612  if ($oattr->isAffected()) $oattr->Modify();
613  else $oattr->Add();
614  // --------------------------
615  // Mail template link
616  $aid = $this->_Aid("_TRANS_MTID", $k);
617  $oattr = new DocAttr($this->dbaccess, array(
618  $cid,
619  $aid
620  ));
621  $oattr->docid = $cid;
622  $oattr->visibility = "W";
623  $oattr->type = 'docid("MAILTEMPLATE")';
624  $oattr->link = "";
625  $oattr->phpfile = "fdl.php";
626  $oattr->phpfunc = "lmailtemplatedoc(D,CT,WF_FAMID):$aid,CT";
627  $oattr->elink = "";
628  $oattr->id = $aid;
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}';
632 
633  $oattr->labeltext = sprintf(_("%s mail template") , _($k));
634  if ($oattr->isAffected()) $oattr->Modify();
635  else $oattr->Add();
636  // --------------------------
637  // Timer link
638  $aid = $this->_Aid("_TRANS_TMID", $k);
639  $oattr = new DocAttr($this->dbaccess, array(
640  $cid,
641  $aid
642  ));
643  $oattr->docid = $cid;
644  $oattr->visibility = "W";
645  $oattr->type = 'docid("TIMER")';
646  $oattr->link = "";
647  $oattr->phpfile = "fdl.php";
648  $oattr->phpfunc = "ltimerdoc(D,CT,WF_FAMID):$aid,CT";
649  $oattr->elink = "";
650  $oattr->options = 'autocreated=yes|creation={autoclose:"yes",tm_family:wf_famid,tm_workflow:fromid,tm_title:"' . str_replace(':', ' ', _($k)) . '"}';
651 
652  $oattr->id = $aid;
653  $oattr->frameid = $aidframe;
654  $oattr->ordered = $ordered++;
655  $oattr->labeltext = sprintf(_("%s timer") , _($k));
656  if ($oattr->isAffected()) $oattr->Modify();
657  else $oattr->Add();
658  // --------------------------
659  // Persistent Attach Timer link
660  $aid = $this->_Aid("_TRANS_PA_TMID", $k);
661  $oattr = new DocAttr($this->dbaccess, array(
662  $cid,
663  $aid
664  ));
665  $oattr->docid = $cid;
666  $oattr->visibility = "W";
667  $oattr->type = 'docid("TIMER")';
668  $oattr->link = "";
669  $oattr->phpfile = "fdl.php";
670  $oattr->phpfunc = "ltimerdoc(D,CT,WF_FAMID):$aid,CT";
671  $oattr->elink = "";
672  $oattr->options = 'multiple=yes|autocreated=yes|creation={autoclose:"yes",tm_family:wf_famid,tm_workflow:fromid,tm_title:"' . str_replace(':', ' ', _($k)) . '"}';
673 
674  $oattr->id = $aid;
675  $oattr->frameid = $aidframe;
676  $oattr->ordered = $ordered++;
677  $oattr->labeltext = sprintf(_("%s persistent timer") , _($k));
678  if ($oattr->isAffected()) $oattr->Modify();
679  else $oattr->Add();
680  // --------------------------
681  // Persistent UnAttach Timer link
682  $aid = $this->_Aid("_TRANS_PU_TMID", $k);
683  $oattr = new DocAttr($this->dbaccess, array(
684  $cid,
685  $aid
686  ));
687  $oattr->docid = $cid;
688  $oattr->visibility = "W";
689  $oattr->type = 'docid("TIMER")';
690  $oattr->link = "";
691  $oattr->phpfile = "fdl.php";
692  $oattr->phpfunc = "ltimerdoc(D,CT,WF_FAMID):$aid,CT";
693  $oattr->elink = "";
694  $oattr->id = $aid;
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();
700  else $oattr->Add();
701  }
702  if (($err = $this->setMasterLock(false)) !== '') {
703  return $err;
704  }
705  return refreshPhpPgDoc($this->dbaccess, $cid);
706  }
707  /**
708  * change state of a document
709  * the method {@link set()} must be call before
710  * @param string $newstate the next state
711  * @param string $addcomment comment to be set in history (describe why change state)
712  * @param bool $force is true when it is the second passage (without interactivity)
713  * @param bool $withcontrol set to false if you want to not verify control permission ot transition
714  * @param bool $wm1 set to false if you want to not apply m1 methods
715  * @param bool $wm2 set to false if you want to not apply m2 methods
716  * @param bool $wneed set to false to not test required attributes
717  * @param bool $wm0 set to false if you want to not apply m0 methods
718  * @param bool $wm3 set to false if you want to not apply m3 methods
719  * @param string $msg return message from m2 or m3 methods
720  * @return string error message, if no error empty string
721  */
722  function changeState($newstate, $addcomment = "", $force = false, $withcontrol = true, $wm1 = true, $wm2 = true, $wneed = true, $wm0 = true, $wm3 = true, &$msg = '')
723  {
724  $err = '';
725  // if ($this->doc->state == $newstate) return ""; // no change => no action
726  // search if possible change in concordance with transition array
727  $foundFrom = false;
728  $foundTo = false;
729  $tname = '';
730  $tr = array();
731  foreach ($this->cycle as $trans) {
732  if (($this->doc->state == $trans["e1"])) {
733  // from state OK
734  $foundFrom = true;
735  if ($newstate == $trans["e2"]) {
736  $foundTo = true;
737  $tr = $this->transitions[$trans["t"]];
738  $tname = $trans["t"];
739  }
740  }
741  }
742 
743  if ($this->userid != 1) { // admin can go to any states
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);
748  $lockUserAccount = getDocFromUserId($this->dbaccess, $lockUserId);
749  if (is_object($lockUserAccount) && $lockUserAccount->isAlive()) {
750  $lockUserTitle = $lockUserAccount->getTitle();
751  if ($lockUserId != $this->userid) {
752  /* The document is locked by another user */
753  if ($this->doc->locked < 0) {
754  /* Currently being edited by another user */
755  return sprintf(_("Could not perform transition because the document is being edited by '%s'") , $lockUserTitle);
756  } else {
757  /* Explicitly locked by another user */
758  return sprintf(_("Could not perform transition because the document is locked by '%s'") , $lockUserTitle);
759  }
760  }
761  }
762  }
763  }
764  // verify if privilege granted
765  if ($withcontrol) $err = $this->control($tname);
766  if ($err != "") return $err;
767  /* Set edition mask from view control if a view control is applied on the document */
768  $this->doc->setMask(Doc::USEMASKCVEDIT);
769 
770  if ($wm0 && (!empty($tr["m0"]))) {
771  // apply first method (condition for the change)
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)));
773 
774  $err = call_user_func(array(
775  $this,
776  $tr["m0"]
777  ) , $newstate, $this->doc->state, $addcomment);
778  if ($err != "") {
779  $this->doc->unlock(true);
780  return (sprintf(_("Error : %s") , $err));
781  }
782  }
783 
784  if ($wm1 && (!empty($tr["m1"]))) {
785  // apply first method (condition for the change)
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)));
787 
788  $err = call_user_func(array(
789  $this,
790  $tr["m1"]
791  ) , $newstate, $this->doc->state, $addcomment);
792 
793  if ($err == "->") {
794  if ($force) {
795  $err = ""; // it is the return of the report
796  SetHttpVar("redirect_app", ""); // override the redirect
797  SetHttpVar("redirect_act", "");
798  } else {
799  if ($addcomment != "") $this->doc->addHistoryEntry($addcomment); // add comment now because it will be lost
800  return ""; //it is not a real error, but don't change state (reported)
801 
802  }
803  }
804  if ($err != "") {
805  $this->doc->unlock(true);
806  return (sprintf(_("Error : %s") , $err));
807  }
808  }
809  // verify if completed doc
810  if ($wneed) {
811  $err = $this->doc->isCompleteNeeded();
812  if ($err != "") return $err;
813  }
814  // change the state
815  $oldstate = $this->doc->state == "" ? " " : $this->doc->state;
816  $this->doc->state = $newstate;
817  $this->changeProfil($newstate);
818  $this->changeCv($newstate);
819  $this->doc->disableEditControl();
820  $err = $this->doc->Modify(); // don't control edit permission
821  if ($err != "") return $err;
822 
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) {
827  $oa = $this->getAttribute($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 = "*****";
833  } else {
834  $displayValue = str_replace("\n", ", ", $this->getRawValue($arrayAttribute->id));
835  }
836  $revcomment.= sprintf("\n-%s : %s", $arrayAttribute->getLabel() , $displayValue);
837  }
838  } else {
839  $pv = $this->getRawValue($vpid);
840  if ($pv != "") {
841 
842  if ($oa->type == "password") {
843  $pv = "*****";
844  }
845 
846  if (is_array($pv)) {
847  $pv = implode(", ", $pv);
848  }
849  $revcomment.= sprintf("\n-%s : %s", $oa->getLabel() , $pv);
850  }
851  }
852  }
853  }
854  $incumbentName = getCurrentUser()->getIncumbentPrivilege($this, $tname);
855  if ($incumbentName) $revcomment = sprintf(_("(substitute of %s) : ") , $incumbentName) . $revcomment;
856  $err = $this->doc->revise($revcomment);
857  if ($err != "") {
858  $this->doc->disableEditControl(); // restore old states
859  $this->doc->state = $oldstate;
860  $this->changeProfil($oldstate);
861  $this->changeCv($oldstate);
862  $err2 = $this->doc->Modify(); // don't control edit permission
863  $this->doc->enableEditControl();
864 
865  return $err . $err2;
866  }
867  AddLogMsg(sprintf(_("%s new state %s") , $this->doc->title, _($newstate)));
868 
869  $this->doc->enableEditControl();
870  // post action
871  $msg2 = '';
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(
875  $this,
876  $tr["m2"]
877  ) , $newstate, $oldstate, $addcomment);
878 
879  if ($msg2 == "->") $msg2 = ""; //it is not a real error
880  if ($msg2) $this->doc->addHistoryEntry($msg2);
881  if ($msg2 != "") $msg2 = sprintf(_("Warning : %s") , $msg2);
882  }
883  $this->doc->addLog("state", array(
884  "id" => $this->id,
885  "initid" => $this->initid,
886  "revision" => $this->revision,
887  "title" => $this->title,
888  "state" => $this->state,
889  "message" => $msg2
890  ));
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);
895  $err.= $this->changeAllocateUser($newstate);
896  // post action
897  $msg3 = '';
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(
901  $this,
902  $tr["m3"]
903  ) , $newstate, $oldstate, $addcomment);
904 
905  if ($msg3 == "->") $msg3 = ""; //it is not a real error
906  if ($msg3) $this->doc->addHistoryEntry($msg3);
907  if ($msg3 != "") $msg3 = sprintf(_("Warning : %s") , $msg3);
908  }
909  $msg.= ($msg && $msg2 ? "\n" : '') . $msg2;
910  if ($msg && $msg3) $msg.= "\n";
911  $msg.= $msg3;
912  $this->doc->enableEditControl();
913  return $err;
914  }
915  /**
916  * return an array of next states availables from current state
917  * @param bool $noVerifyDomain set to true if want to get next states when document is locked into a domain
918  * @return array
919  */
920  function getFollowingStates($noVerifyDomain = false)
921  {
922  // search if following states in concordance with transition array
923  if ($this->doc->locked == - 1) return array(); // no next state for revised document
924  if (($this->doc->locked > 0) && ($this->doc->locked != $this->doc->userid)) return array(); // no next state if locked by another person
925  if ((!$noVerifyDomain) && ($this->doc->lockdomainid > 0)) return array(); // no next state if locked in a domain
926  $fstate = array();
927  if ($this->doc->state == "") {
928  $this->doc->state = $this->getFirstState();
929  }
930 
931  if ($this->userid == 1) {
932  return $this->getStates();
933  } // only admin can go to any states from anystates
934  foreach ($this->cycle as $tr) {
935  if ($this->doc->state == $tr["e1"]) {
936  // from state OK
937  if ($this->control($tr["t"]) == "") $fstate[] = $tr["e2"];
938  }
939  }
940  return $fstate;
941  }
942  /**
943  * return an array of all states availables for the workflow
944  * @return array
945  */
946  function getStates()
947  {
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"];
953  }
954  }
955  return $this->states;
956  }
957  /**
958  * get associated color of a state
959  * @param string $state the state
960  * @param string $def default value if not set
961  * @return string the color (#RGB)
962  */
963  function getColor($state, $def = "")
964  {
965  //$acolor=$this->attrPrefix."_COLOR".($state);
966  $acolor = $this->_Aid("_COLOR", $state);
967  return $this->getRawValue($acolor, $def);
968  }
969  /**
970  * get activity (localized language)
971  * @param string $state the state
972  * @param string $def default value if not set
973  * @return string the text of action
974  */
975  function getActivity($state, $def = "")
976  {
977  //$acolor=$this->attrPrefix."_ACTIVITYLABEL".($state);
978  $acolor = $this->_Aid("_ACTIVITYLABEL", $state);
979  $v = $this->getRawValue($acolor);
980  if ($v) return _($v);
981  return $def;
982  }
983  /**
984  * get action (localized language)
985  * @deprecated use getActivity instead
986  * @param string $state the state
987  * @param string $def default value if not set
988  * @return string the text of action
989  */
990  function getAction($state, $def = "")
991  {
993  return $this->getActivity($state, $def);
994  }
995  /**
996  * get askes for a document
997  * searcj all WASK document which current user can see for a specific state
998  * @param string $state the state
999  * @param bool $control set to false to not control ask access
1000  * @return string[] texts of action
1001  */
1002  function getDocumentWasks($state, $control = true)
1003  {
1004  $aask = $this->_Aid("_ASKID", $state);
1005  $vasks = $this->getMultipleRawValues($aask);
1006  if ($control) {
1007  $cask = array();
1008  foreach ($vasks as $askid) {
1009  /**
1010  * @var $ask \Dcp\Family\WASK
1011  */
1012  $ask = new_doc($this->dbaccess, $askid);
1013  $ask->set($this->doc);
1014  if ($ask->isAlive() && ($ask->control('answer') == "")) $cask[] = $ask->id;
1015  }
1016  return $cask;
1017  } else {
1018  return $vasks;
1019  }
1020  }
1021  /**
1022  * verify if askes are defined
1023  *
1024  * @return bool true if at least one ask is set in workflow
1025  */
1026  function hasWasks()
1027  {
1028  $states = $this->getStates();
1029  foreach ($states as $state) {
1030  $aask = $this->_Aid("_ASKID", $state);
1031  if ($this->getRawValue($aask)) return true;
1032  }
1033  return false;
1034  }
1035  /**
1036  * send associated mail of a state
1037  * @param string $state the state
1038  * @param string $comment reason of change state
1039  * @param string $tname transition name
1040  * @return string
1041  */
1042  function workflowSendMailTemplate($state, $comment = "", $tname = "")
1043  {
1044  $err = '';
1045  $tmtid = $this->getMultipleRawValues($this->_Aid("_TRANS_MTID", $tname));
1046 
1047  $tr = ($tname) ? $this->transitions[$tname] : null;
1048  if ($tmtid && (count($tmtid) > 0)) {
1049  foreach ($tmtid as $mtid) {
1050  $keys = array();
1051  /**
1052  * @var $mt \Dcp\Family\MAILTEMPLATE
1053  */
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) {
1059  $keys["V_" . strtoupper($vpid) ] = $this->getHtmlAttrValue($vpid);
1060  $keys[strtoupper($vpid) ] = $this->getRawValue($vpid);
1061  }
1062  }
1063  $err.= $mt->sendDocument($this->doc, $keys);
1064  }
1065  }
1066  }
1067 
1068  $tmtid = $this->getMultipleRawValues($this->_Aid("_MTID", $state));
1069  if ($tmtid && (count($tmtid) > 0)) {
1070  foreach ($tmtid as $mtid) {
1071  $keys = array();
1072  $mt = new_doc($this->dbaccess, $mtid);
1073  /**
1074  * @var \Dcp\Family\MAILTEMPLATE $mt
1075  */
1076  if ($mt->isAlive()) {
1077  $keys["WCOMMENT"] = nl2br($comment);
1078  if (isset($tr["ask"])) {
1079  foreach ($tr["ask"] as $vpid) {
1080  $keys["V_" . strtoupper($vpid) ] = $this->getHtmlAttrValue($vpid);
1081  $keys[strtoupper($vpid) ] = $this->getRawValue($vpid);
1082  }
1083  }
1084  $err.= $mt->sendDocument($this->doc, $keys);
1085  }
1086  }
1087  }
1088  return $err;
1089  }
1090  /**
1091  * attach timer to a document
1092  * @param string $state the state
1093  * @param string $tname transition name
1094  * @return string
1095  */
1096  function workflowAttachTimer($state, $tname = "")
1097  {
1098  $err = '';
1099  $mtid = $this->getRawValue($this->_Aid("_TRANS_TMID", $tname));
1100 
1101  $this->doc->unattachAllTimers($this);
1102 
1103  if ($mtid) {
1104  /**
1105  * @var \Dcp\Family\TIMER $mt
1106  */
1107  $mt = new_doc($this->dbaccess, $mtid);
1108  if ($mt->isAlive()) {
1109  $err = $this->doc->attachTimer($mt, $this);
1110  }
1111  }
1112  // unattach persistent
1113  $tmtid = $this->getMultipleRawValues($this->_Aid("_TRANS_PU_TMID", $tname));
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);
1119  }
1120  }
1121  }
1122 
1123  $mtid = $this->getRawValue($this->_Aid("_TMID", $state));
1124  if ($mtid) {
1125  $mt = new_doc($this->dbaccess, $mtid);
1126  if ($mt->isAlive()) {
1127  $err.= $this->doc->attachTimer($mt, $this);
1128  }
1129  }
1130  // attach persistent
1131  $tmtid = $this->getMultipleRawValues($this->_Aid("_TRANS_PA_TMID", $tname));
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);
1137  }
1138  }
1139  }
1140  return $err;
1141  }
1142  /**
1143  * to change state of a document from this workflow
1144  * @param $docid
1145  * @param $newstate
1146  * @param string $comment
1147  * @return string
1148  */
1149  function changeStateOfDocid($docid, $newstate, $comment = "")
1150  {
1151  $err = '';
1152  $cmd = new_Doc($this->dbaccess, $docid);
1153  $cmdid = $cmd->getLatestId(); // get the latest
1154  $cmd = new_Doc($this->dbaccess, $cmdid);
1155 
1156  if ($cmd->wid > 0) {
1157  /**
1158  * @var $wdoc Wdoc
1159  */
1160  $wdoc = new_Doc($this->dbaccess, $cmd->wid);
1161 
1162  if (!$wdoc) $err = sprintf(_("cannot change state of document #%d to %s") , $cmd->wid, $newstate);
1163  if ($err != "") return $err;
1164  $wdoc->Set($cmd);
1165  $err = $wdoc->ChangeState($newstate, sprintf(_("automaticaly by change state of %s\n%s") , $this->doc->title, $comment));
1166  if ($err != "") return $err;
1167  }
1168  return $err;
1169  }
1170  /**
1171  * get transition array for the transition between $to and $from states
1172  * @param string $to first state
1173  * @param string $from next state
1174  * @return array transition array (false if not found)
1175  */
1177  {
1178  foreach ($this->cycle as $v) {
1179  if (($v["e1"] == $from) && ($v["e2"] == $to)) {
1180  $t = $this->transitions[$v["t"]];
1181  $t["id"] = $v["t"];
1182  return $t;
1183  }
1184  }
1185  return false;
1186  }
1187  /**
1188  * explicit original doc control
1189  * @param $aclname
1190  * @param bool $strict
1191  * @see Doc::control()
1192  * @return string
1193  */
1194  function docControl($aclname, $strict = false)
1195  {
1196  return Doc::Control($aclname, $strict);
1197  }
1198  /**
1199  * Special control in case of dynamic controlled profil
1200  * @param string $aclname
1201  * @param bool $strict set to true to not use substitute informations
1202  * @return string error message
1203  */
1204  function control($aclname, $strict = false)
1205  {
1206  $err = Doc::control($aclname, $strict);
1207  if ($err == "") return $err; // normal case
1208  if ($this->getRawValue("DPDOC_FAMID") > 0) {
1209  // special control for dynamic users
1210  if ($this->pdoc === null) {
1211  $pdoc = createDoc($this->dbaccess, $this->fromid, false);
1212  $pdoc->doctype = "T"; // temporary
1213  // $pdoc->setValue("DPDOC_FAMID",$this->getRawValue("DPDOC_FAMID"));
1214  $err = $pdoc->Add();
1215  if ($err != "") return "WDoc::Control:" . $err; // can't create profil
1216  $pdoc->setProfil($this->profid, $this->doc);
1217 
1218  $this->pdoc = & $pdoc;
1219  }
1220  $err = $this->pdoc->docControl($aclname, $strict);
1221  }
1222  return $err;
1223  }
1224  /**
1225  * affect action label
1226  */
1227  function postStore()
1228  {
1229  foreach ($this->stateactivity as $k => $v) {
1230  $this->setValue($this->_Aid("_ACTIVITYLABEL", $k) , $v);
1231  }
1232  $this->getStates();
1233  foreach ($this->states as $k => $state) {
1234  $allo = trim($this->getRawValue($this->_Aid("_AFFECTREF", $state)));
1235  if (!$allo) $this->removeArrayRow($this->_Aid("_T_AFFECT", $state) , 0);
1236  }
1237 
1238  if ($this->isChanged()) $this->modify();
1239  }
1240  /**
1241  * get value of instanced document
1242  * @param string $attrid attribute identifier
1243  * @param bool $def default value if no value
1244  * @return string return the value, false if attribute not exist or document not set
1245  */
1246  function getInstanceValue($attrid, $def = false)
1247  {
1248  if ($this->doc) {
1249  return $this->doc->getRawValue($attrid, $def);
1250  }
1251  return $def;
1252  }
1253 }
$firstState
Definition: Class.WDoc.php:49
getHtmlAttrValue($attrid, $target="_self", $htmllink=2, $index=-1, $entities=true, $abstract=false)
Definition: Class.Doc.php:6489
$defDoctype
Definition: Class.WDoc.php:35
getStateProfilAttribute($state)
Definition: Class.WDoc.php:231
global $action
changeAllocateUser($newstate)
Definition: Class.WDoc.php:126
& getAttribute($idAttr, &$oa=null, $useMask=true)
Definition: Class.Doc.php:2152
exec_query($sql, $lvl=0, $prepare=false)
SetHttpVar($name, $def)
Definition: Lib.Http.php:150
$profid
Definition: Class.Doc.php:411
refreshPhpPgDoc($dbaccess, $docid)
Definition: Lib.Attr.php:18
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)
Definition: mailcard.php:156
addWarningMsg($msg)
Definition: Lib.Common.php:95
$transitions
Definition: Class.WDoc.php:46
getAction($state, $def="")
Definition: Class.WDoc.php:990
set(Doc &$doc, $force=false)
Definition: Class.WDoc.php:88
changeProfil($newstate)
Definition: Class.WDoc.php:108
getColor($state, $def="")
Definition: Class.WDoc.php:963
changeState($newstate, $addcomment="", $force=false, $withcontrol=true, $wm1=true, $wm2=true, $wneed=true, $wm0=true, $wm3=true, &$msg= '')
Definition: Class.WDoc.php:722
getFirstState()
Definition: Class.WDoc.php:99
removeArrayRow($idAttr, $index)
Definition: Class.Doc.php:3328
getRValue($RidAttr, $def="", $latest=true, $html=false)
Definition: Class.Doc.php:4333
$to
getFamilyParameterValue($idp, $def="")
Definition: Class.Doc.php:1538
$subject
$defClassname
Definition: Class.WDoc.php:36
modify($nopost=false, $sfields="", $nopre=false)
foreach($argv as $arg) $cmd
getDocValue($docid, $attrid, $def=" ", $latest=false)
Definition: Class.Doc.php:8870
getTransitionTimers($transName)
Definition: Class.WDoc.php:267
getStateProfil($state)
Definition: Class.WDoc.php:222
AddLogMsg($msg, $cut=80)
Definition: Lib.Common.php:77
$docid
Definition: cleanFamily.php:13
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
docControl($aclname, $strict=false)
control($aclname, $strict=false)
isChanged()
Definition: Class.Doc.php:853
hasWasks()
$fromid
Definition: Class.Doc.php:366
$force
setValue($attrid, $value, $index=-1, &$kvalue=null)
Definition: Class.Doc.php:3528
$autonext
Definition: Class.WDoc.php:48
getMultipleRawValues($idAttr, $def="", $index=-1)
Definition: Class.Doc.php:3240
const USEMASKCVEDIT
Definition: Class.Doc.php:61
getTransition($from, $to)
$state
Definition: Class.Doc.php:451
getInstanceValue($attrid, $def=false)
revision(Action &$action)
Definition: revision.php:22
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getStateMask($state)
Definition: Class.WDoc.php:240
$viewnext
Definition: Class.WDoc.php:50
__construct($dbaccess= '', $id= '', $res= '', $dbid=0)
Definition: Class.WDoc.php:66
getTitle($id="-1", $def="", $latest=false)
Definition: Class.Doc.php:8715
deprecatedFunction($msg= '')
Definition: Lib.Common.php:86
getCurrentUser()
Definition: Lib.Common.php:250
changeCv($newstate)
Definition: Class.WDoc.php:197
new_Doc($dbaccess, $id= '', $latest=false)
$attrPrefix
Definition: Class.WDoc.php:37
getStateMailTemplate($state)
Definition: Class.WDoc.php:285
setMasterLock($useLock)
$from
$stateactivity
Definition: Class.WDoc.php:43
getTransitionMailTemplates($transName)
Definition: Class.WDoc.php:276
getIdFromName($dbaccess, $name)
$comment
Definition: Class.Doc.php:441
if($file) if($subject==""&&$file) if($subject=="") $err
getStateViewControl($state)
Definition: Class.WDoc.php:249
getFollowingStates($noVerifyDomain=false)
Definition: Class.WDoc.php:920
getRawValue($idAttr, $def="")
Definition: Class.Doc.php:3117
postStore()
getActivity($state, $def="")
Definition: Class.WDoc.php:975
getStateTimers($state)
Definition: Class.WDoc.php:258
control($aclname, $strict=false)
Definition: Class.Doc.php:6593
getStates()
Definition: Class.WDoc.php:946
createProfileAttribute($cid=0)
Definition: Class.WDoc.php:294
← centre documentaire © anakeen