197: begin
198: finalAuthorityApproverCategory := null;
199: finalAuthoritySource := null;
200: includeAllJobLevelApprovers :=
201: ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.includeAllApproversAttribute) =
202: ame_util.booleanAttributeTrue;
203: /* Populate some of the package variables. */
204: managerFound := false;
205: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
201: ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.includeAllApproversAttribute) =
202: ame_util.booleanAttributeTrue;
203: /* Populate some of the package variables. */
204: managerFound := false;
205: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
206: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
207: tempApprover.orig_system := ame_util.perOrigSystem;
208: tempApprover.authority := ame_util.authorityApprover;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
205: topDogPersonId := to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.topSupPersonIdAttribute));
206: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
207: tempApprover.orig_system := ame_util.perOrigSystem;
208: tempApprover.authority := ame_util.authorityApprover;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
206: /* Set the fields in tempApprover that are constant for the entire handler cycle. */
207: tempApprover.orig_system := ame_util.perOrigSystem;
208: tempApprover.authority := ame_util.authorityApprover;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
207: tempApprover.orig_system := ame_util.perOrigSystem;
208: tempApprover.authority := ame_util.authorityApprover;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
208: tempApprover.authority := ame_util.authorityApprover;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
216: tempApprover.group_or_chain_order_number := 1;
209: tempApprover.action_type_id := ame_engine.getHandlerActionTypeId;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
216: tempApprover.group_or_chain_order_number := 1;
217: tempApprover.group_or_chain_id := 1;
210: tempApprover.item_class := ame_engine.getHandlerItemClassName;
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
216: tempApprover.group_or_chain_order_number := 1;
217: tempApprover.group_or_chain_id := 1;
218: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
211: tempApprover.item_id := ame_engine.getHandlerItemId;
212: tempApprover.item_class_order_number := ame_engine.getHandlerItemClassOrderNumber;
213: tempApprover.item_order_number := ame_engine.getHandlerItemOrderNumber;
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
216: tempApprover.group_or_chain_order_number := 1;
217: tempApprover.group_or_chain_id := 1;
218: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
219: /*
214: tempApprover.sub_list_order_number := ame_engine.getHandlerSublistOrderNum;
215: tempApprover.action_type_order_number := ame_engine.getHandlerActionTypeOrderNum;
216: tempApprover.group_or_chain_order_number := 1;
217: tempApprover.group_or_chain_id := 1;
218: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
219: /*
220: The engine only calls a handler if a rule requiring it exists, so we can assume that
221: the package variables that ame_engine.getHandlerRules initializes are nonempty.
222: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
217: tempApprover.group_or_chain_id := 1;
218: votingRegimeType := ame_engine.getActionTypeVotingRegime(actionTypeIdIn => tempApprover.action_type_id);
219: /*
220: The engine only calls a handler if a rule requiring it exists, so we can assume that
221: the package variables that ame_engine.getHandlerRules initializes are nonempty.
222: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
223: are harmless here.)
224: */
225: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
221: the package variables that ame_engine.getHandlerRules initializes are nonempty.
222: Fetch the rules and sort them in increasing parameter order. (Duplicate parameters
223: are harmless here.)
224: */
225: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
226: approverCategoriesOut => approverCategories,
227: parametersOut => parameters);
228: /* Check for COA 'firstAuthority' insertions */
229: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
225: ame_engine.getHandlerRules2(ruleIdsOut => ruleIds,
226: approverCategoriesOut => approverCategories,
227: parametersOut => parameters);
228: /* Check for COA 'firstAuthority' insertions */
229: ame_engine.getHandlerCOAFirstApprover(itemClassIn => tempApprover.item_class,
230: itemIdIn => tempApprover.item_id,
231: actionTypeIdIn => tempApprover.action_type_id,
232: groupOrChainIdIn => tempApprover.group_or_chain_id,
233: nameOut => COAInsertee.name,
237: sourceOut => COAInsertee.source);
238: if COAInsertee.name is null then
239: /* Fetch some of the required attributes. */
240: startingPointId :=
241: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.jobLevelStartingPointAttribute));
242: if(startingPointId is null) then
243: requestorId :=
244: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.transactionRequestorAttribute));
245: if (requestorId is null) then
240: startingPointId :=
241: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.jobLevelStartingPointAttribute));
242: if(startingPointId is null) then
243: requestorId :=
244: to_number(ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.transactionRequestorAttribute));
245: if (requestorId is null) then
246: raise nullFirstIdException;
247: end if;
248: tempApprover.orig_system_id := requestorId;
283: */
284: if(COAInsertee.name is null and
285: startingPointId is null )
286: then
287: if (ame_engine.getHeaderAttValue2(attributeNameIn => ame_util.allowAutoApprovalAttribute)
288: = ame_util.booleanAttributeTrue)
289: then
290: getCatSourceAndAuthority(personIdIn => requestorId,
291: jobLevelIn => tempJobLevel,
302: origSystemIn => ame_util.perOrigSystem,
303: origSystemIdIn => tempApprover.orig_system_id,
304: nameOut => tempApprover.name,
305: displayNameOut => tempApprover.display_name);
306: tempApprover.occurrence := ame_engine.getHandlerOccurrence(
307: nameIn => tempApprover.name,
308: itemClassIn => tempApprover.item_class,
309: itemIdIn => tempApprover.item_id,
310: actionTypeIdIn => tempApprover.action_type_id,
310: actionTypeIdIn => tempApprover.action_type_id,
311: groupOrChainIdIn => tempApprover.group_or_chain_id);
312: tempApprover.member_order_number := 1;
313: tempApprover.approval_status := ame_util.approvedStatus;
314: ame_engine.addApprover(approverIn => tempApprover);
315: return;
316: end if;
317: end if;
318: /* As self approval is not an option. And only requestorId is defined, the chain
390: origSystemIn => ame_util.perOrigSystem,
391: origSystemIdIn => tempApprover.orig_system_id,
392: nameOut => tempApprover.name,
393: displayNameOut => tempApprover.display_name);
394: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
395: itemClassIn => tempApprover.item_class,
396: itemIdIn => tempApprover.item_id,
397: actionTypeIdIn => tempApprover.action_type_id,
398: groupOrChainIdIn => tempApprover.group_or_chain_id);
395: itemClassIn => tempApprover.item_class,
396: itemIdIn => tempApprover.item_id,
397: actionTypeIdIn => tempApprover.action_type_id,
398: groupOrChainIdIn => tempApprover.group_or_chain_id);
399: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
400: ame_engine.addApprover(approverIn => tempApprover);
401: exit;
402: end if;
403: if(tempSupervisorJobLevel is null) then
396: itemIdIn => tempApprover.item_id,
397: actionTypeIdIn => tempApprover.action_type_id,
398: groupOrChainIdIn => tempApprover.group_or_chain_id);
399: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
400: ame_engine.addApprover(approverIn => tempApprover);
401: exit;
402: end if;
403: if(tempSupervisorJobLevel is null) then
404: if(tempSupervisorId is null) then
427: origSystemIn => ame_util.perOrigSystem,
428: origSystemIdIn => tempApprover.orig_system_id,
429: nameOut => tempApprover.name,
430: displayNameOut => tempApprover.display_name);
431: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
432: itemClassIn => tempApprover.item_class,
433: itemIdIn => tempApprover.item_id,
434: actionTypeIdIn => tempApprover.action_type_id,
435: groupOrChainIdIn => tempApprover.group_or_chain_id);
432: itemClassIn => tempApprover.item_class,
433: itemIdIn => tempApprover.item_id,
434: actionTypeIdIn => tempApprover.action_type_id,
435: groupOrChainIdIn => tempApprover.group_or_chain_id);
436: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
437: ame_engine.addApprover(approverIn => tempApprover);
438: exit;
439: end if;
440: /* The approver is not the last approver in the chain. Must check the approver
433: itemIdIn => tempApprover.item_id,
434: actionTypeIdIn => tempApprover.action_type_id,
435: groupOrChainIdIn => tempApprover.group_or_chain_id);
436: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
437: ame_engine.addApprover(approverIn => tempApprover);
438: exit;
439: end if;
440: /* The approver is not the last approver in the chain. Must check the approver
441: category with that of prev approver to see if category change has occurred or if
453: origSystemIn => ame_util.perOrigSystem,
454: origSystemIdIn => tempApprover.orig_system_id,
455: nameOut => tempApprover.name,
456: displayNameOut => tempApprover.display_name);
457: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
458: itemClassIn => tempApprover.item_class,
459: itemIdIn => tempApprover.item_id,
460: actionTypeIdIn => tempApprover.action_type_id,
461: groupOrChainIdIn => tempApprover.group_or_chain_id);
458: itemClassIn => tempApprover.item_class,
459: itemIdIn => tempApprover.item_id,
460: actionTypeIdIn => tempApprover.action_type_id,
461: groupOrChainIdIn => tempApprover.group_or_chain_id);
462: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
463: ame_engine.addApprover(approverIn => tempApprover);
464: elsif (prevApprover.approver_category is not null and
465: tempApprover.approver_category <> prevApprover.approver_category ) then
466: managerFound := true;
459: itemIdIn => tempApprover.item_id,
460: actionTypeIdIn => tempApprover.action_type_id,
461: groupOrChainIdIn => tempApprover.group_or_chain_id);
462: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
463: ame_engine.addApprover(approverIn => tempApprover);
464: elsif (prevApprover.approver_category is not null and
465: tempApprover.approver_category <> prevApprover.approver_category ) then
466: managerFound := true;
467: tempMemberOrderNumber := tempMemberOrderNumber + 1;
475: origSystemIn => ame_util.perOrigSystem,
476: origSystemIdIn => prevApprover.orig_system_id,
477: nameOut => prevApprover.name,
478: displayNameOut => prevApprover.display_name);
479: prevApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => prevApprover.name,
480: itemClassIn => prevApprover.item_class,
481: itemIdIn => prevApprover.item_id,
482: actionTypeIdIn => prevApprover.action_type_id,
483: groupOrChainIdIn => prevApprover.group_or_chain_id);
480: itemClassIn => prevApprover.item_class,
481: itemIdIn => prevApprover.item_id,
482: actionTypeIdIn => prevApprover.action_type_id,
483: groupOrChainIdIn => prevApprover.group_or_chain_id);
484: prevApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => prevApprover);
485: ame_engine.addApprover(approverIn => prevApprover);
486: end if;
487: /* Check to see if an insertion was done to the approver list. If yes, check for any
488: COA insertions. NOTE: The same check will have to be done as the last step in
481: itemIdIn => prevApprover.item_id,
482: actionTypeIdIn => prevApprover.action_type_id,
483: groupOrChainIdIn => prevApprover.group_or_chain_id);
484: prevApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => prevApprover);
485: ame_engine.addApprover(approverIn => prevApprover);
486: end if;
487: /* Check to see if an insertion was done to the approver list. If yes, check for any
488: COA insertions. NOTE: The same check will have to be done as the last step in
489: the handler again */
495: loop
496: /* Initialize COAInsertee approverRecord2 */
497: COAInsertee := ame_util.emptyApproverRecord2;
498: /* Check if there are any COAInsertions */
499: ame_engine.getHandlerCOAInsertion(nameIn => tempApprover.name,
500: itemClassIn => tempApprover.item_class,
501: itemIdIn => tempApprover.item_id,
502: actionTypeIdIn => tempApprover.action_type_id,
503: groupOrChainIdIn => tempApprover.group_or_chain_id,
534: tempApprover.member_order_number := tempMemberOrderNumber;
535: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
536: tempApprover.member_order_number := 1;
537: end if;
538: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
539: itemClassIn => tempApprover.item_class,
540: itemIdIn => tempApprover.item_id,
541: actionTypeIdIn => tempApprover.action_type_id,
542: groupOrChainIdIn => tempApprover.group_or_chain_id);
539: itemClassIn => tempApprover.item_class,
540: itemIdIn => tempApprover.item_id,
541: actionTypeIdIn => tempApprover.action_type_id,
542: groupOrChainIdIn => tempApprover.group_or_chain_id);
543: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
544: /* If approver has a status of ame_util.approve or ame_util.approveAndForwardStatus or
545: ame_util.nullStatus check to see if approver could have final authority */
546: if ((tempApprover.approval_status is null) or
547: (tempApprover.approval_status in
555: tempHasFinalAuthorityYN = ame_util.booleanTrue) then
556: finalAuthorityFound := true;
557: end if;
558: end if;
559: ame_engine.addApprover(approverIn => tempApprover);
560: end if;
561: coaInsAuthForward := true;
562: end loop;
563: if(finalAuthorityFound and
585: end if;
586: ame_util.copyApproverRecord2(approverRecord2In => tempApprover,
587: approverRecord2Out => prevApprover);
588: if firstAuthInsExists then
589: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
590: end if;
591: if coaInsAuthForward then
592: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
593: end if;
588: if firstAuthInsExists then
589: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.firstauthHandlerInsReason,null);
590: end if;
591: if coaInsAuthForward then
592: ame_engine.setDeviationReasonDate(ame_approver_deviation_pkg.forwarHandlerAuthInsReason,null);
593: end if;
594: end loop;
595: /* Check to make sure that final approver was inserted. */
596: if checkForInsertee then
601: loop
602: /* Initialize COAInsertee approverRecord2 */
603: COAInsertee := ame_util.emptyApproverRecord2;
604: /* Check if there are any COAInsertions */
605: ame_engine.getHandlerCOAInsertion(nameIn => tempApprover.name,
606: itemClassIn => tempApprover.item_class,
607: itemIdIn => tempApprover.item_id,
608: actionTypeIdIn => tempApprover.action_type_id,
609: groupOrChainIdIn => tempApprover.group_or_chain_id,
640: tempApprover.member_order_number := tempMemberOrderNumber;
641: else /* votingRegimeType in (ame_util.consensusVoting, ame_util.firstApproverVoting) */
642: tempApprover.member_order_number := 1;
643: end if;
644: tempApprover.occurrence := ame_engine.getHandlerOccurrence(nameIn => tempApprover.name,
645: itemClassIn => tempApprover.item_class,
646: itemIdIn => tempApprover.item_id,
647: actionTypeIdIn => tempApprover.action_type_id,
648: groupOrChainIdIn => tempApprover.group_or_chain_id);
645: itemClassIn => tempApprover.item_class,
646: itemIdIn => tempApprover.item_id,
647: actionTypeIdIn => tempApprover.action_type_id,
648: groupOrChainIdIn => tempApprover.group_or_chain_id);
649: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
650: ame_engine.addApprover(approverIn => tempApprover);
651: end if;
652: end loop;
653: end if;
646: itemIdIn => tempApprover.item_id,
647: actionTypeIdIn => tempApprover.action_type_id,
648: groupOrChainIdIn => tempApprover.group_or_chain_id);
649: tempApprover.approval_status := ame_engine.getHandlerApprovalStatus(approverIn => tempApprover);
650: ame_engine.addApprover(approverIn => tempApprover);
651: end if;
652: end loop;
653: end if;
654: exception