Commit 913da0826917e32797424c10fb5db95594f49100

Authored by nbm
1 parent 7ed477c4

Allow for a workflow transition guard condition to be chosen.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3972 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/workflow/workflows.php
... ... @@ -15,6 +15,7 @@ require_once(KT_DIR . "/presentation/webpageTemplate.inc");
15 15 require_once(KT_LIB_DIR . '/permissions/permission.inc.php');
16 16 require_once(KT_LIB_DIR . '/groups/Group.inc');
17 17 require_once(KT_LIB_DIR . '/roles/Role.inc');
  18 +require_once(KT_LIB_DIR . '/search/savedsearch.inc.php');
18 19  
19 20 class KTWorkflowDispatcher extends KTStandardDispatcher {
20 21 var $bAutomaticTransaction = true;
... ... @@ -318,6 +319,7 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
318 319 'aPermissions' => KTPermission::getList(),
319 320 'aGroups' => Group::getList(),
320 321 'aRoles' => Role::getList(),
  322 + 'aConditions' => KTSavedSearch::getConditions(),
321 323 ));
322 324 return $oTemplate;
323 325 }
... ... @@ -335,6 +337,7 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
335 337 $iPermissionId = KTUtil::arrayGet($_REQUEST, 'fPermissionId', null);
336 338 $iGroupId = KTUtil::arrayGet($_REQUEST, 'fGroupId', null);
337 339 $iRoleId = KTUtil::arrayGet($_REQUEST, 'fRoleId', null);
  340 + $iConditionId = KTUtil::arrayGet($_REQUEST, 'fConditionId', null);
338 341 if ($iPermissionId) {
339 342 $this->oValidator->validatePermission($_REQUEST['fPermissionId']);
340 343 }
... ... @@ -344,6 +347,9 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
344 347 if ($iRoleId) {
345 348 $this->oValidator->validateRole($_REQUEST['fRoleId']);
346 349 }
  350 + if ($iConditionId) {
  351 + $this->oValidator->validateCondition($_REQUEST['fConditionId']);
  352 + }
347 353 $oTransition->updateFromArray(array(
348 354 'workflowid' => $oWorkflow->getId(),
349 355 'name' => $_REQUEST['fName'],
... ... @@ -352,6 +358,7 @@ class KTWorkflowDispatcher extends KTStandardDispatcher {
352 358 'guardpermissionid' => $iPermissionId,
353 359 'guardgroupid' => $iGroupId,
354 360 'guardroleid' => $iRoleId,
  361 + 'guardconditionid' => $iConditionId,
355 362 ));
356 363 $res = $oTransition->update();
357 364 $this->oValidator->notErrorFalse($res, array(
... ...
templates/ktcore/workflow/editTransition.smarty
... ... @@ -29,11 +29,20 @@ none=true}</td>
29 29 <td>{entity_select entities=$aGroups
30 30 selected=$oTransition->getGuardGroupId() name="fGroupId" none=true}</td>
31 31 </tr>
  32 +{if $aRoles}
32 33 <tr>
33 34 <th>Guard Role</th>
34 35 <td>{entity_select entities=$aRoles
35 36 selected=$oTransition->getGuardRoleId() name="fRoleId" none=true}</td>
36 37 </tr>
  38 +{/if}
  39 +{if $aConditions}
  40 +<tr>
  41 + <th>Guard Condition</th>
  42 + <td>{entity_select entities=$aConditions
  43 +selected=$oTransition->getGuardConditionId() name="fConditionId" none=true}</td>
  44 +</tr>
  45 +{/if}
37 46 </table>
38 47 <input type="submit" name="submit" value="Save" />
39 48 </form>
... ...