Sidebar

Combodo

iTop Extensions

Approval Base

name:
Approval Base
description:
This module is just a base for writing approval extension
version:
3.1.2
release:
2016-10-01
itop-version-min:
2.0
state:
Stable
php-version-max:
PHP 8.0

Features

This extension does not do anything, it's just a basis for managing approvals.
Two Combodo extensions use it.

Revision History

Version Release Date Comments
1.0.0 2019-10-29 First version

Limitations

  • It's not possible to reuse the ActionEmailApprovalRequest from a different trigger, as $oApprovalScheme, $oApprover, approval_link and approval_url are expected to be provided in the $aContext parameter.
  • It's not possible to get the approvers with an OQL query
  • It's not possible to notify the approvers, outside of the initial notification and the manual reminder
  • It's not possible to define different from and reply_to using the classical fields of a Email Action, it can be customized by overwriting ApprovalScheme methods, but this is weird.

Usage

Notification

How does the Approval Notification part works?

main.approval-base.php
class ApprovalBasePlugin implements iApplicationUIExtension, iApplicationObjectExtension
   OnDBInsert() and OnDBUpdate()
      ApprovalBasePlugin::OnReachingState($oObject, $sReachingState)
         // Check if there is an approval process applicable on the current object 
         // when it is reaching a particular state,
         // Then if there isn't an ongoing ApprovalScheme on this object, created it
         // Then follow the scheme
         _ApprovalScheme_::StartNextStep()
            // If it's time to notify approvers, then for each approver, send an Approval Request
            ApprovalScheme::SendApprovalRequest($oApprover, $oObject, $aApproverData['passcode']);
datamodel.approver-base.xml
ApprovalScheme::SendApprovalRequest($oToPerson, $oObj, $sPassCode, ...)
   // Prepare the placeholders which will be used in the email message, such as ''approval_link''
   // which depends if the Person has an iTop account or not, and put them in $aContext
   // Put the ApprovalScheme, the Approver and the current Object in $aContext
   TriggerOnApprovalRequest::DoActivate($aContext)
      ActionEmailApprovalRequest::DoExecute($oTrigger, $aContext)
main.approval-base.php
ActionEmailApprovalRequest::DoExecute($oTrigger, $aContext)
   // Extract the objects from $aContext
   // Set ActionEmail fields, such as ''to'' with an OQL searching for the approver by its id
   // ''from'' and ''reply_to'' are computed by the ApprovalScheme
   // Ask the standard Email action to create the email and send it
   ActionEmail::DoExecute($oTrigger, $aContext)
extensions/approval_base.txt ยท Last modified: 2023/01/17 13:43 by 127.0.0.1
Back to top
Contact us