Salesforce: Reverse Engeneering Vana HCM EmployeeAbsenseRequest Page

There is a bug in our version of Vana HCM Request Time Off (EmployeeAbsenseRequest) page. Our users were complaining that they cannot recall their absence requests.
The flow is following:
1. They are clicking recall button;
2. Confirming on javascript popup;
3. Receiving Error:
Process failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

Because VanaHCM package passes record id instead of ProcessWorkItem Id.
VanaHCMAbsence

I have been investigating this for some time, and reverse engineered controller a little bit and there are here my results with fixed recall button (everything else I didn’t completely reverse engineered since I didn’t have reasons for that – it seemed to be working fine on package page, at least our users didn’t complain on the other aspects of this page).

There is listing of EmployeeAbsenseRequest.page here

<apex:page controller="EmployeeAbsenseRequestController" id="page1" action="{!initFull}">
     
    <apex:includeScript value="//code.jquery.com/jquery-1.9.1.js"/>
    <apex:includeScript value="//code.jquery.com/ui/1.10.3/jquery-ui.js"/>
    <apex:stylesheet value="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
    <apex:includeScript value="{!URLFOR($Resource.VanaHCM__ResourceBundle,'components/MultiDatesPicker/multiDatesPicker.js')}" />
    
    <style>
        .ui-autocomplete-input { margin: 0; padding: 0.47em 0 0.47em 0.47em; background: white; width:230px; }
        .ui-autocomplete {
            max-height: 350px; 
            overflow-y: auto;
            overflow-x: hidden;
         
        }
        .custom-combobox {
            position: relative;
            display: inline-block;
        }
        .custom-combobox-toggle {
            position: absolute;
            top: 0;
            bottom: 0;
            margin-left: 1px;
            padding: 0;
            /* support: IE7 */
            *height: 1.7em; 
            *top: 0.1em;
        }
        
        .hourInput{
            width : 40px;
        }
        
        
        table.ui-datepicker-calendar {border-collapse: separate;}
        .ui-datepicker-calendar td {border: 1px solid transparent;}
    
        /* begin: jQuery UI Datepicker emphasis on selected dates */
        .ui-datepicker .ui-datepicker-calendar .ui-state-highlight a {
            background: #1797c0 none;
            color: white;
        }
        
        
        /*excludeDay*/
        .disableDate span{
           border-color : green !important;
        }
        
        .halfDayDate a{
           border-color : green !important;
        }



        .absenceItem{
            padding: 14px;
            margin-bottom:14px;
            border-color: #dfe0e1;
            border-width: 1px;
            border-style: solid;
            border-radius: 5px;
            background-color: white;
            display: table;
            width:95%;
        }
        .absenceDetails{
            width:50%;
            display: table-cell;
            vertical-align: top;
        }
        .absenceList{
            margin: 0;
            padding: 0;
            display: table;
            width: 100%;
        }
        .absenceListRow{
            display: table-row;
        }
        .absenceListItemLabel{
            width: 33%;
            float: left;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-wrap: normal;
            color: #696e71;
            padding-top:2px;
            padding-bottom:2px;
            display: table-cell;
        }
        .absenceListItemValue{
            margin: 0;
            width: 66%;
            float: left;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            word-wrap: normal;
            color: #3c3d3e;
            padding-top:2px;
            padding-bottom:2px;
            display: table-cell;
        }
        .absenceBalances{
            display: table-cell;
            vertical-align: top;
            border-left-color: #dfe0e1;
            border-left-width: 1px;
            border-left-style: solid;
            width:50%;
            margin-left: 14px;
            padding-left: 14px;
        }
        .boldedLabel{
            font-weight: bold;
        }
        .buttons{
            padding-top: 7px;
            padding-bottom: 7px;
            margin-bottom:7px;
            border-radius: 5px;
            border: none !important;
            font-weight: 700;
            font-size: 14px;
            color: white;
            background-color: #007fcc;
            width: 240px;
            cursor: pointer;
        }
        .alignWithImage{
            margin-top:4px;
        }
    </style>
    
    <apex:form id="form1">
        <script>
            var absenceDateDataByDate = {};
            var currentWorkerStandardHours = {!IF(ISNULL(CurrentWorker.VanaHCM__Standard_Hours__c), 0, CurrentWorker.VanaHCM__Standard_Hours__c)};
            function onAbsenceTypeChanged(triggerE){   
                if(triggerE.value != null && triggerE.value != -1){
                    jsOnAbsenceTypeChanged(triggerE.value);
                }
            }
            /* @TODO replace, as replaced with recall
            function onAbsenceRequestDeleteClicked(selectedAbsenceRequestToDelete){
                var confirmMessage = 'Are you sure you want to delete the selected absence request?'
                if ((Modal.confirm && Modal.confirm(confirmMessage)) || (!Modal.confirm && window.confirm(confirmMessage))) {
                    jsDeleteAbsenceRequest(selectedAbsenceRequestToDelete);
                    return true;
                }else{ 
                  return false;
                }
            }
            */
            function onAbsenceRequestRecallClicked(selectedAbsenceRequest){
                var confirmMessage = '{!$Label.AbsenceRecallConfirm}'
                if ((Modal.confirm && Modal.confirm(confirmMessage)) || (!Modal.confirm && window.confirm(confirmMessage))) {
                    jsRecallAbsenceRequest(selectedAbsenceRequest);
                    return true;
                }else{ 
                  return false;
                }
            }
            
            function onSaveDataClicked(sourceObject){
                //Populate the data for absence Dates
                sourceObject.disabled=true;
                sourceObject.style.color = "grey";
                populateAbsenceDatesData();
                jsSaveData();
            }
            
            
            //'Mondays','Tuesdays','Wednesdays','Thursdays','Fridays','Saturdays','Sundays'
            function parseExcludedDays(excludedDaysString){
                var excludeDaysArray = new Array();
                if(excludedDaysString != null){
                    $.each(excludedDaysString.split(';'), function( index, value ) {
                        switch(value) {
                            case 'Mondays':
                                excludeDaysArray.push(1);
                                break;
                            case 'Tuesdays':
                                excludeDaysArray.push(2);
                                break;
                            case 'Wednesdays':
                                excludeDaysArray.push(3);
                                break;
                            case 'Thursdays':
                                excludeDaysArray.push(4);
                                break;
                            case 'Fridays':
                                excludeDaysArray.push(5);
                                break;
                            case 'Saturdays':
                                excludeDaysArray.push(6);
                                break;    
                            case 'Sundays':
                                excludeDaysArray.push(0);
                                break;    
                        }
                    });
                }
                return excludeDaysArray;
            }
            
            var holidays = {};
            
            <apex:repeat value="{!holidays}" var="h">
                holidays[{!h.dateString}] = {'isHalfDay' : {!h.isHalfDay}, 'holidayToolTip' : "{!JSENCODE(h.holidayToolTip)}"};
            </apex:repeat>
            
        </script>
        
        <apex:outputPanel id="jsStatePanel">
        <script>
            var useCalendartoPickAbsenceDates = {!useCalendartoPickAbsenceDates}; 
            var renderHours = {!renderHours};
            var makeHoursRequired = {!config.makeHoursRequired};
            var renderHalfDaysList = {!isAbsenceAllowHalfDays};
            var renderAbsenceDatesDataSection = renderHours || renderHalfDaysList;  
            var excludedDays = parseExcludedDays("{!selectedAbsenceType.VanaHCM__Exclude__c}");
        </script>
        </apex:outputPanel>
        
        <apex:actionFunction name="jsSaveData" action="{!SaveData}" status="loadingStatus" />
        <!--@TODO remove, replaced by recall 
        <apex:actionRegion >
            <apex:actionFunction name="jsDeleteAbsenceRequest" action="{!deleteAbsenceRequest}" rerender="pgMsg, absenceBalancePB, absenceRequestsPB" status="loadingStatus" >
                <apex:param name="selectedAbsenceRequestToDeletePM" value="" assignTo="{!selectedAbsenceRequestID}" />
            </apex:actionFunction>
        </apex:actionRegion>
         -->
        <apex:actionRegion >
            <apex:actionFunction name="jsRecallAbsenceRequest" action="{!recallAbsenceRequest}" rerender="pgMsg, absenceBalancePB, absenceRequestsPB" status="loadingStatus" >
                <apex:param name="selectedAbsenceRequestToRecallPM" value="" assignTo="{!selectedAbsenceRequestID}" />
            </apex:actionFunction>
        </apex:actionRegion>
        
        <apex:actionfunction action="{!onAbsenceTypeChanged}" name="jsOnAbsenceTypeChanged" rerender="secton1, mesagesSection, jsStatePanel, absenceRequestBTNOP" status="loadingStatus" immediate="true" oncomplete="initMDP();">
            <apex:param name="selectedAbsenseTypePM" value="" assignTo="{!selectedAbsenseTypeID}" />
        </apex:actionfunction>
        
        <apex:SectionHeader title="{!$Label.AbsenceRequestTimeOff}" />
        <apex:outputPanel id="mesagesSection">
            <apex:pageMessages id="pgMsg"/>
        </apex:outputPanel> 
        <apex:pageBlock id="block1">
            <apex:pageBlockButtons location="bottom" rendered="{!isAllOK}" >
                <apex:outputPanel id="absenceRequestBTNOP">
                    <apex:outputPanel rendered="{!absenceTypeSelected}">
                        <input type="button" class="btn" onclick="onSaveDataClicked(this);" value="{!$Label.AbsenceRequestAbsence}"/>


                    </apex:outputPanel>
                </apex:outputPanel>
                <apex:actionStatus id="loadingStatus" >
                        <apex:facet name="start"><img src="/img/loading.gif" alt="please wait"/></apex:facet>
                        <apex:facet name="stop"></apex:facet>
                </apex:actionStatus> 
            </apex:pageBlockButtons>
            
            <apex:pageBlockSection id="secton1" columns="2">
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="{!$Label.AbsenceAbsenceType}" />
                        
                        <apex:outputPanel >
                            <div class="requiredInput">
                                <div class="requiredBlock"></div>
                                <apex:selectList value="{!selectedAbsenseTypeID}" size="1" style="width:148px;" onchange="onAbsenceTypeChanged(this);"> 
                                    <apex:selectOptions value="{!AbsenseType}" />
                                </apex:selectList>                                     
                            </div>
                            <div style="display:none">
                                <apex:inputField value="{!absenceRequest.VanaHCM__Dump_Start_Date__c}" rendered="{!!absenceTypeSelected}" />
                            </div>
                        </apex:outputPanel>
                        
                    </apex:pageBlockSectionItem>
                     
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel value="{!$Label.common_label_worker}" />
                        <apex:outputLabel value="{!CurrentWorker.Name}"  />
                    </apex:pageBlockSectionItem> 
                    
                    
                    <apex:pageBlockSectionItem id="mdpPBS" rendered="{!IF(!absenceTypeSelected, false, useCalendartoPickAbsenceDates)}"> 
                            <apex:outputLabel value="{!$Label.AbsenceSelectDates}"/>
                            <apex:outputPanel >
                                <span id="absenceDateSelector"></span>
                                <apex:inputHidden id="selectedAbsenseDates" value="{!selectedAbsenseDates}"/>
                                <apex:inputHidden id="selectedAbsenseHalfDayStatus" value="{!selectedAbsenseHalfDayStatus}"/>
                                <apex:inputHidden id="selectedAbsenseHours" value="{!selectedAbsenseHours}"/>
                            </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:inputField value="{!absenceRequest.VanaHCM__Dump_Start_Date__c}" rendered="{!IF(!absenceTypeSelected, false, NOT(useCalendartoPickAbsenceDates))}" required="true"/>
                    
                    <apex:inputField value="{!absenceRequest.VanaHCM__Notes__c}"  style="width:250px;height:75px; position:absolute; {!IF(config.makeNotesRequired, 'border-left :3px solid #c00;','')}" required="{!config.makeNotesRequired}" rendered="{!absenceTypeSelected}" />
                    
                    <apex:inputField value="{!absenceRequest.VanaHCM__Dump_End_Date__c}" rendered="{!IF(!absenceTypeSelected, false, NOT(useCalendartoPickAbsenceDates))}" required="true"/>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, NOT(useCalendartoPickAbsenceDates))}"/>
                    
                    
                    
                    <apex:pageBlockSectionItem rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Reason__c)}">
                        <apex:outputLabel value="{!$Label.AbsenceAbsenceReason}" />
                        <apex:outputPanel >
                            <div class="requiredInput">
                                <div class="requiredBlock"></div> 
                                <apex:selectList value="{!selectedAbsenseReasonID}" size="1" style="width:148px;"> 
                                    <apex:selectOptions value="{!absenceReasonOptions}" />
                                </apex:selectList>
                            </div>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Reason__c)}"/>
                    
                    <apex:inputField value="{!absenceRequest.VanaHCM__Half_Days__c}" rendered="{!IF(!absenceTypeSelected, false, AND(!useCalendartoPickAbsenceDates, isAbsenceAllowHalfDays))}"/>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, AND(!useCalendartoPickAbsenceDates,isAbsenceAllowHalfDays))}"/>
                    
                    <apex:inputField value="{!absenceRequest.VanaHCM__Hours__c}" required="{!config.makeHoursRequired}" rendered="{!IF(!absenceTypeSelected, false, AND(!useCalendartoPickAbsenceDates, renderHours))}"/>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, AND(!useCalendartoPickAbsenceDates,renderHours))}"/>
                    

                    <apex:pageBlockSectionItem rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Department__c)}">
                        <apex:outputLabel value="{!$Label.common_label_department}" />
                        <apex:outputPanel >
                            <div class="requiredInput">
                            <div class="requiredBlock"></div>
                            <!-- @todo there is a issue with department selection, after error department is not dispalyed selected -->
                                <c:typeaheadrecordselector onChangeHandler="onDepartmentSelected" selectedRecord="{!absenceRequest.VanaHCM__Department__c}" renderLabel="false" loadJquery="false" dataSourceQuery="Select id, name from Department__c order by name" loadAutocompleteResources="false"/>
                            </div>
                            <apex:inputHidden value="{!selectedDepartmentID}" id="departmentHidden"/>
                            <script>
                                function onDepartmentSelected(selectedDepartment){
                                    document.getElementById('{!$Component.departmentHidden}').value = selectedDepartment; 
                                }
                            </script>
                        </apex:outputPanel>
                    </apex:pageBlockSectionItem>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Department__c)}"/>
                    
                    <apex:pageBlockSectionItem rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Department_Selection_Message__c)}">
                        <apex:outputLabel value="" /> 
                        <apex:outputLabel value="{!$Label.Absence_UI_department_related_message}" escape="false" /> 
                    </apex:pageBlockSectionItem>
                    <apex:outputLabel value="" rendered="{!IF(!absenceTypeSelected, false, selectedAbsenceType.VanaHCM__Show_Department_Selection_Message__c)}"/>
                    
            </apex:pageBlockSection>
        </apex:pageBlock>
            <apex:pageBlock id="absenceBalancePB" title="{!$Label.AbsenceAbsenceBalance}">
                <apex:repeat value="{!employee_absence_view_record}" var="r" rendered="{!IF(employee_absence_view_record.SIZE>0,true,false)}">
                    <div class="absenceItem">
                        <div class="absenceDetails">
                            <div class="absenceList">
                                <div class="absenceListRow">
                                    <div class="absenceListItemLabel boldedLabel">
                                        <apex:outputText value="{!$Label.AbsenceAbsenceType}"/>
                                    </div>
                                    <div class="absenceListItemValue boldedLabel">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Types__r.Name}"/>
                                    </div>
                                </div>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showEntitlementColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceEntitlement}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputField value="{!r.absenceEntitlement.VanaHCM__Entitlement__c}"/>
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAccrualRateColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceAccrualRate}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.entitlementRate}" />
                                        <apex:outputText value="({!r.absenceEntitlement.VanaHCM__Accrual__c})" rendered="{!NOT(ISNULL(r.absenceEntitlement.VanaHCM__Accrual__c))}"/>
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showCarryOverColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceCarryOver}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Carry_Forward__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceEntitlementColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceAbsenceAccrued}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Entitlement__c}" />
                                    </div>
                                </apex:outputPanel>
                            </div>
                        </div>
                        <div class="absenceBalances">
                            <div class="absenceList">
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceTakenCurrentColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceTakenCurrent}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Taken_Current__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceBalanceCurrentColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceBalanceCurrent}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Balance_Current__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceTakenInclPendingColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceTakenIncludingPending}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Taken__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceBalInclPendingColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceBalanceIncludingPending}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Available_New__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceTakenPayPeriodColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceTakenPayPeriodEnding}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Taken_Pay_Period__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceBalPayPeriodColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceBalancePayPeriodEnding}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Absence_Balance_Pay_Period__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showEntitlementBalanceColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceEntitlementBalance}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceEntitlement.VanaHCM__Entitlement_Balance__c}" />
                                    </div>
                                </apex:outputPanel>
                            </div>
                        </div>
                    </div>
                </apex:repeat>
                <apex:pageBlockSection columns="1" rendered="{!IF(employee_absence_view_record.SIZE>0,false,true)}">
                    <apex:outputLabel value="{!$Label.common_label_no_records_found}" />
                </apex:pageBlockSection>
            </apex:pageBlock>
            <apex:pageBlock title="Absence Requests" id="absenceRequestsPB">
                <apex:repeat value="{!absenceRequestForSelectedWorker}" var="r" rendered="{!IF(absenceRequestForSelectedWorker.SIZE>0,true,false)}">
                    <div class="absenceItem">
                        <div class="absenceDetails">
                            <div class="absenceList">
                                <div class="absenceListRow">
                                    <div class="absenceListItemLabel boldedLabel alignWithImage">
                                        <apex:outputText value="{!$Label.AbsenceAbsenceType}"/>
                                    </div>
                                    <div class="absenceListItemValue boldedLabel alignWithImage">
                                        <apex:outputText value="{!r.Absence_Type}"/>
                                        <apex:outputPanel rendered="{!AND(enableAbsenceDeletion, r.validForRecall)}"> 
                                            <a href="javascript:void(0)">
                                                <img src="{!URLFOR($Resource.Timesheet,'Image/del_2.gif')}" title="{!$Label.AbsenceRecallAbsenceRequest}" onclick="onAbsenceRequestRecallClicked('{!r.Id}')" />
                                            </a>
                                        </apex:outputPanel>  
                                    </div>
                                </div>
                                <apex:outputPanel styleClass="absenceListRow">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.common_label_start_date}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.Start_Date}"/>
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.common_label_end_date}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.End_Date}" />
                                    </div>
                                </apex:outputPanel>
                            </div>
                        </div>
                        <div class="absenceBalances">
                            <div class="absenceList">
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showTotalAbsenceRequestedColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceTotalAbsenceRequested}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.Total_Absence_Requested}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showTotalHoursRequestedColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceTotalHoursRequested}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceRequest.VanaHCM__Hours__c}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.AbsenceApprovalStatus}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.approvalStatus}" />
                                    </div>
                                </apex:outputPanel>
                                <apex:outputPanel styleClass="absenceListRow" rendered="{!config.showAbsenceDepartmentColumn}">
                                    <div class="absenceListItemLabel">
                                        <apex:outputText value="{!$Label.common_label_department}"/>
                                    </div>
                                    <div class="absenceListItemValue">
                                        <apex:outputText value="{!r.absenceRequest.VanaHCM__Department__r.name}" />
                                    </div>
                                </apex:outputPanel>
                            </div>
                        </div>
                    </div>
                </apex:repeat>
                <apex:pageBlockSection columns="1" rendered="{!IF(absenceRequestForSelectedWorker.SIZE>0,false,true)}">
                    <apex:outputLabel value="{!$Label.common_label_no_records_found}" />
                </apex:pageBlockSection>
            </apex:pageBlock>
        </apex:form>
<script>
function initMDP(){
    $('#absenceDateSelector').multiDatesPicker({
        onSelect: function ()
            {
               onAbsenceDateSelected();
            },
        beforeShowDay: function(date) {
            var day = date.getDay();
            
            var dateDay = date.getDate();
            var month = date.getMonth() + 1;
            var fullYear = date.getFullYear();
            var dateString = dateDay + '' + month + '' + fullYear; 
            
            //return [true];//@temp
            if(jQuery.inArray(day, excludedDays) == -1){
                if(holidays[dateString] != null){ //Check if it's holiday
                    if(holidays[dateString].isHalfDay){
                        return [true, 'halfDayDate', holidays[dateString].holidayToolTip];
                    }else{
                        return [false, 'disableDate', holidays[dateString].holidayToolTip];
                    }
                }else{
                    return [true, '', ''];
                }
            }else{
                return [false, 'excludeDay', '{!$Label.AbsenceDefinedAsExcluded}'];
            }
        }    
    
    });
    
    var dates = getCSVAsArrayByInputID('page1:form1:block1:secton1:mdpPBS:selectedAbsenseDates');
    var halfDays = getCSVAsArrayByInputID('page1:form1:block1:secton1:mdpPBS:selectedAbsenseHalfDayStatus');
    var hours = getCSVAsArrayByInputID('page1:form1:block1:secton1:mdpPBS:selectedAbsenseHours');
    absenceDateDataByDate = {};
    if(dates.length > 0){
        $.each(dates, function( index, value ) {
            var dateData = {};
            dateData['hours'] = hours[index];
            dateData['halfDay'] = halfDays[index] == 'true';
            absenceDateDataByDate[value] = dateData;
        });
    }
   
    
    var oldSelectedDates = [];
    $.each(absenceDateDataByDate, function( index, value ) {
      oldSelectedDates.push(index);
    });
    
    
    if(oldSelectedDates.length > 0){
        $('#absenceDateSelector').multiDatesPicker('addDates', oldSelectedDates);
        
        if(renderAbsenceDatesDataSection){
            //If hours are enabled and absence date mode is selected then render the multi lines input
            initAbsenceDateDataTable();
        }
    }
    
    
}

function onAbsenceDateSelected(){
     var oldSelectedDates = document.getElementById('page1:form1:block1:secton1:mdpPBS:selectedAbsenseDates').value;
     var dates = $("#absenceDateSelector").multiDatesPicker('getDates');
     var html = '';
     
     var absenceDateDataByDateTemp = {};
     $.each(dates, function( index, value ) {
       if(absenceDateDataByDate[value] != null){
        absenceDateDataByDateTemp[value] = absenceDateDataByDate[value];
       }else{
            var dateData = {};
            dateData['hours'] = currentWorkerStandardHours;
            dateData['halfDay'] = false;
            absenceDateDataByDateTemp[value] = dateData;
       }
     });
     absenceDateDataByDate = absenceDateDataByDateTemp;
     initAbsenceDateDataTable();
     
}

function onHourEnter(selectedDate, srcE){
    if(srcE.value == null || srcE.value == '' || srcE.value < 0 || isNaN(srcE.value)){
        srcE.value = currentWorkerStandardHours;
    }
    absenceDateDataByDate[selectedDate]['hours'] = srcE.value; 
}

function onHalfDayEnter(selectedDate, srcE){
    absenceDateDataByDate[selectedDate]['halfDay'] = srcE.checked;
}

function initAbsenceDateDataTable(){ 
    $('#newTRToPushAbsenceDatesDataTable').remove();
    
    if(!renderAbsenceDatesDataSection || $("#absenceDateSelector").multiDatesPicker('getDates').length == 0){
        return;
    }
    
    createAbsenceDateDataTable();
    
    $.each(absenceDateDataByDate, function( index, value ) {
      addRowToAbsenceDatesDataTable(index, value['hours'], value['halfDay']);
    });

    
}


function createAbsenceDateDataTable(){
    var html = '<tr id="newTRToPushAbsenceDatesDataTable">';

    html = html + '<th class="labelCol vfLabelColTextWrap " scope="row"><label>{!$Label.common_label_details}: </label></th>';
    html = html + '<td class="dataCol">';
    
    html = html + '<table class="list " id="absenceDatesTable" border="0" cellpadding="0" cellspacing="0" width="100%">';
    html = html + '<thead class="rich-table-thead">';
    html = html + '<tr class="headerRow ">';

    html = html + '<th class="headerRow" scope="col" colspan="1">';
    html = html + '<div>{!$Label.AbsenceAbsenceDate}</div>';
    html = html + '</th>';
        
    if(renderHours){
        html = html + '<th class="headerRow" scope="col" colspan="1">';
        html = html + '<div>{!$Label.common_label_hours}</div>';
        html = html + '</th>';
    }
    
    if(renderHalfDaysList){
        html = html + '<th class="headerRow" scope="col" colspan="1">';
        html = html + '<div>{!$Label.AbsenceHalfDay}</div>';
        html = html + '</th>';
    }
    
    html = html + '</tr>';
    html = html + '</thead>';
    html = html + '<tbody id="absenceDatesTBody">';

    
    html = html + '</tbody>';
    html = html + '</table>';
    
    
    html = html + '</td>';
    html = html + '<td class="dataCol" colspan="2"><label></label></td>';
    html = html + '</tr>';
    
    $(document.getElementById('page1:form1:block1')).find('.detailList').append(html);
    
}

function addRowToAbsenceDatesDataTable(selectedDate, selectedHours, selectedHalfDayStatus){

    /* may be dynamically add class to all rows
    var totalRows = $('#absenceDatesTBody tr').size(); 
    var rowClass = totalRows == 0 ? 'first' :
    
    first none last 
    even and odd
    */
    
    if(selectedDate == null || selectedDate == undefined){
        selectedDate = '';
    }
    if(selectedHours == null){
        selectedHours = 0;
    }  
    
    var html = html + '<tr class="dataRow " onmouseover="if (window.hiOn){hiOn(this);} " onmouseout="if (window.hiOff){hiOff(this);} " onblur="if (window.hiOff){hiOff(this);}" onfocus="if (window.hiOn){hiOn(this);}">';
        html = html + '<td class="dataCell"colspan="1">';
        html = html + '<label>';
        html = html + selectedDate;
        html = html + '</label>';
        html = html + '</td>';
    
    
    //First of all add date to first column;
    if(renderHours){
        html = html + '<td class="dataCell"colspan="1">';
        html = html + '<input class="hourInput" type="text" value="'+selectedHours+'" onchange="onHourEnter(\''+selectedDate+'\', this)"/>';
        html = html + '</td>';
    }
    if(renderHalfDaysList){
        html = html + '<td class="dataCell"colspan="1">';
        if(selectedHalfDayStatus){
            html = html + '<input class="halfDayInput" type="checkbox" checked="checked" onchange="onHalfDayEnter(\''+selectedDate+'\', this)"/>';
        }else{
            html = html + '<input class="halfDayInput" type="checkbox" onchange="onHalfDayEnter(\''+selectedDate+'\', this)"/>';
        }
        html = html + '</td>';
    }
    
    html = html + '</tr>';
    $('#absenceDatesTBody').append(html);
}

if(useCalendartoPickAbsenceDates){
    initMDP();
}

function populateAbsenceDatesData(){
    if(!useCalendartoPickAbsenceDates){
        return;
    }
    
    var selectedAbsenseDatesCSV = '';
    var selectedAbsenseHalfDayStatusCSV = '';
    var selectedAbsenseHoursCSV = '';
    $.each(absenceDateDataByDate, function( index, value ) {
        selectedAbsenseDatesCSV = selectedAbsenseDatesCSV + index + ',';
        selectedAbsenseHalfDayStatusCSV = selectedAbsenseHalfDayStatusCSV + value['halfDay'] + ',';
        selectedAbsenseHoursCSV = selectedAbsenseHoursCSV + (value['hours'] == null || value['hours'] == '' || isNaN(value['hours']) || value['hours'] < 0 ? currentWorkerStandardHours : value['hours']) + ',';
    });
        
    document.getElementById('page1:form1:block1:secton1:mdpPBS:selectedAbsenseDates').value = selectedAbsenseDatesCSV;
    if(renderHalfDaysList){
        document.getElementById('page1:form1:block1:secton1:mdpPBS:selectedAbsenseHalfDayStatus').value = selectedAbsenseHalfDayStatusCSV;
    }
    if(renderHours){
        document.getElementById('page1:form1:block1:secton1:mdpPBS:selectedAbsenseHours').value = selectedAbsenseHoursCSV;
    }
    
}
 
function getCSVAsArrayByInputID(inputID){
    return getCSVAsArray(document.getElementById(inputID).value);
}

function getCSVAsArray(scrValue){
    var result = [];
    var csvValues = scrValue
    
    if(csvValues != null && csvValues.length > 0 && csvValues.split(",").length > 1){
        result = csvValues.split(",");
        result.pop();
    }
    return result;
}


    </script>
</apex:page>

and controller

public class EmployeeAbsenseRequestController {

    public Boolean enableAbsenceDeletion { get; set; }

    public List<x> absenceRequestForSelectedWorker { get; set; }

    public List<w> employee_absence_view_record { get; set; }

    public String selectedDepartmentID { get; set; }

    public String selectedAbsenceRequestID { get; set; }

    public String absenceReasonOptions { get; set; }

    public String selectedAbsenseReasonID { get; set; }

    public String selectedAbsenseHours { get; set; }

    public String selectedAbsenseHalfDayStatus { get; set; }

    public String selectedAbsenseDates { get; set; }

    public VanaHCM__Absence_Request__c absenceRequest { get; set; }

    public String AbsenseType { get; set; }

    public String selectedAbsenseTypeID { get; set; }

    public Boolean absenceTypeSelected { get; set; }

    public Boolean isAllOK { get; set; }

    public PageReference onAbsenceTypeChanged() {
        return null;
    }


 

    public PageReference SaveData() {
        return null;
    }


    public VanaHCM__Absence_Types__c  selectedAbsenceType { get; set; }

    public Boolean isAbsenceAllowHalfDays { get; set; }

    public TConfig config { get; set; }

    public Boolean renderHours { get; set; }

    public Boolean useCalendartoPickAbsenceDates { get; set; }

    public List<Holiday> holidays { get; set; }

 

    public VanaHCM__Worker_Assignment_FA__c CurrentWorker { get; set; }

    public PageReference initFull() {
        return null;
    }
    
    public class Holiday{
        public String dateString {get;set;}
        public String isHalfDay {get;set;}
        public String holidayToolTip {get;set;}
    }
    public class TConfig{
        public Boolean makeHoursRequired {get;set;}
        public Boolean makeNotesRequired {get;set;}
        public Boolean showEntitlementColumn {get;set;}
        public Boolean showAccrualRateColumn {get;set;}
        public Boolean showCarryOverColumn {get;set;}
        public Boolean showAbsenceEntitlementColumn {get;set;}
public Boolean showAbsenceTakenCurrentColumn{get;set;}
public Boolean showAbsenceBalanceCurrentColumn{get;set;}
public Boolean showAbsenceTakenInclPendingColumn{get;set;}
public Boolean showAbsenceBalInclPendingColumn{get;set;}
public Boolean showAbsenceTakenPayPeriodColumn{get;set;}
public Boolean showAbsenceBalPayPeriodColumn{get;set;}
public Boolean showEntitlementBalanceColumn{get;set;}
        public Boolean showTotalAbsenceRequestedColumn{get;set;}
        public Boolean showAbsenceDepartmentColumn{get;set;}
        public Boolean showTotalHoursRequestedColumn{get;set;}
    
    }
    
    public class w{
        public VanaHCM__Employee_Absence_Entitlement__c absenceEntitlement {get;set;}
        public String entitlementRate {get;set;}
        public w(VanaHCM__Employee_Absence_Entitlement__c eae){
            absenceEntitlement = eae;
        }
    }
    
    public class x{
        public String Absence_Type{get{return absenceRequest.VanaHCM__Absence_Type_Request__r.Name;} set;}
        public Boolean validForRecall {get{return approvalStatus != 'Removed';} set;}
        public String Id{get{return absenceRequest.Id;} set;}
        public Date Start_Date{get{return absenceRequest.VanaHCM__Dump_Start_date__c;} set;}
        public Date End_Date{get{return absenceRequest.VanaHCM__Dump_End_Date__c;} set;}
        public Integer Total_Absence_Requested{get;set;}
        public VanaHCM__Absence_Request__c absenceRequest{get;set;}
        public String approvalStatus {get;set;}
        public x(VanaHCM__Absence_Request__c ar, String status){
            absenceRequest= ar;
            approvalStatus = status;
        }
    }
    
    public EmployeeAbsenseRequestController () {
        enableAbsenceDeletion = true;
        List<VanaHCM__Worker__c> wos = [ SELECT VanaHCM__Standard_Hours__c, VanaHCM__User__c, w.Name, w.Id, VanaHCM__Worker_ID__c, VanaHCM__Full_Name__c FROM VanaHCM__Worker__c w WHERE VanaHCM__User__c = :UserInfo.getUserId() LIMIT 1 ];
        employee_absence_view_record = new List<w>();
        absenceRequestForSelectedWorker = new List<x>();
        if ( wos.size() == 0  ) {
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.Error,'You don\'t have worker'));
            return;
        }
        VanaHCM__Worker__c wo = wos[0];
        User u = [ SELECT Id, State, Manager.Name, Country, ManagerId FROM User WHERE Id = :UserInfo.getUserId() ];
       
        //List<VanaHCM__Employee_Absence_Entitlement__c> eaes = [ SELECT VanaHCM__Carry_Forward__c, VanaHCM__Carry_Forward_Used__c, VanaHCM__Worker_Absence_Entitlement__c, VanaHCM__UserID__c, Name, VanaHCM__Manager_Absence_Entitlement__c, VanaHCM__Entitlement_Rate__c, VanaHCM__Employee_ID__c, VanaHCM__Accrual__c, VanaHCM__Absences_Start_Date__c, VanaHCM__Absence_Types__c, VanaHCM__Absence_Taken__c, VanaHCM__Absence_Entitlement__c, VanaHCM__Absence_Available__c, VanaHCM__Absence_Types__r.VanaHCM__Warn_Negative_balances__c, VanaHCM__Absence_Types__r.VanaHCM__Warn_Negative_Balance_New__c, VanaHCM__Absence_Taken_Current__c, VanaHCM__Absence_Taken_Pay_Period__c, VanaHCM__Record_Accrual__c, VanaHCM__Last_Carry_Over_Date__c FROM VanaHCM__Employee_Absence_Entitlement__c WHERE VanaHCM__Worker_Absence_Entitlement__c = :w.Id];
        List<VanaHCM__Employee_Absence_Entitlement__c> eaes = [ SELECT VanaHCM__Accrual__c, VanaHCM__Carry_Forward__c, Id, Name, VanaHCM__Absence_Taken__c, VanaHCM__Absence_Types__c, VanaHCM__Absence_Types__r.Name, VanaHCM__Absence_Entitlement__c, VanaHCM__Absence_Available_New__c, VanaHCM__Worker_Absence_Entitlement__r.VanaHCM__Full_Name__c, VanaHCM__Worker_Absence_Entitlement__r.Id, VanaHCM__Worker_Absence_Entitlement__c, VanaHCM__Absence_Taken_Current__c, VanaHCM__Absence_Balance_Current__c, VanaHCM__Absence_Taken_Pay_Period__c, VanaHCM__Absence_Balance_Pay_Period__c, VanaHCM__Entitlement_Rate__c, VanaHCM__Service_Time__c, VanaHCM__Service_Based__c, VanaHCM__Entitlement__c, VanaHCM__Entitlement_Balance__c FROM VanaHCM__Employee_Absence_Entitlement__c WHERE VanaHCM__UserID__c = :UserInfo.getUserId() ORDER BY Name ASC NULLS FIRST ];
        for ( VanaHCM__Employee_Absence_Entitlement__c e: eaes ) {
            employee_absence_view_record.add( new w(e) );  
        }
        if (eaes.size() > 0)
        List<VanaHCM__Absence_Types__c> ats = [SELECT (SELECT VanaHCM__Years_of_Service__c, VanaHCM__Entitlement__c, VanaHCM__Max_Absence_Entitlement__c, VanaHCM__Max_Absence_Balance__c, VanaHCM__Max_Hours__c FROM VanaHCM__Service_Based_Absence__r) FROM VanaHCM__Absence_Types__c v WHERE Id = :eaes[0].VanaHCM__Absence_Types__c ];
        /*for ( VanaHCM__Employee_Absence_Entitlement__c e: eaes ) {
            employee_absence_view_record.add( new w(e) );  
        }*/
        Map<Id, ProcessInstance> statusMap = new Map<Id, ProcessInstance>();
        for ( ProcessInstance pi: [SELECT TargetObjectId, Status FROM ProcessInstance] ) {
            statusMap.put( pi.TargetObjectId, pi );
        } 
        for ( VanaHCM__Absence_Request__c ar: [ SELECT VanaHCM__Hours__c, VanaHCM__Department__r.name, VanaHCM__Requested_By__r.VanaHCM__Full_Name__c, VanaHCM__Employee_Full_Name__c, VanaHCM__Start_date__c, a.Id, VanaHCM__End_date__c, VanaHCM__Dump_Start_Date__c, VanaHCM__Dump_End_Date__c, VanaHCM__Employee_ID__c, VanaHCM__Absence_Type_Request__c, VanaHCM__Absence_Type_Request__r.Name, VanaHCM__Actual_Absence__c, VanaHCM__Approved__c FROM VanaHCM__Absence_Request__c a WHERE VanaHCM__Requested_By__c = :wo.Id ORDER BY VanaHCM__Dump_Start_date__c DESC NULLS FIRST LIMIT 10000  ]) {
            if (statusMap.containsKey( ar.Id ) ) {
                absenceRequestForSelectedWorker.add( new x(ar, statusMap.get( ar.Id ).Status ) );  
                
            }
        }

        //;
        //[SELECT VanaHCM__Hours__c, VanaHCM__Start_date__c, a.Id, VanaHCM__End_date__c, VanaHCM__Dump_Start_Date__c, VanaHCM__Dump_End_Date__c, VanaHCM__Employee_ID__c, VanaHCM__Absence_Type_Request__c, Absence_Type_Request__r.Name, VanaHCM__Approved__c FROM Absence_Request__c a WHERE Requested_By__r.User__c = :u.Id];
        //[SELECT Id, VanaHCM__Allow_Half_Days__c, VanaHCM__Exclude__c, VanaHCM__Current_States__c, VanaHCM__Hours_Based__c, VanaHCM__Hide_Hours_Display__c, Name, VanaHCM__Show_Department__c, VanaHCM__Show_Department_Selection_Message__c, VanaHCM__Show_Reason__c, VanaHCM__Use_Calendar_to_Pick_Absence_Dates__c FROM Absence_Types__c WHERE (Current_States__c = 'Active' AND id = :tmpVar1];
        //[SELECT VanaHCM__Half_Day_Holiday__c, VanaHCM__State_Province__c, Name, Id, VanaHCM__Holiday_Date__c, VanaHCM__Description__c FROM Holiday_Calendar__c ]
        //[SELECT VanaHCM__Accrual__c, VanaHCM__Carry_Forward__c, Id, Name, VanaHCM__Absence_Taken__c, VanaHCM__Absence_Types__c, Absence_Types__r.Name, VanaHCM__Absence_Entitlement__c, VanaHCM__Absence_Available_New__c, VanaHCM__Worker_Absence_Entitlement__r.VanaHCM__Full_Name__c, Worker_Absence_Entitlement__r.Id, VanaHCM__Worker_Absence_Entitlement__c, VanaHCM__Absence_Taken_Current__c, VanaHCM__Absence_Balance_Current__c, VanaHCM__Absence_Taken_Pay_Period__c, VanaHCM__Absence_Balance_Pay_Period__c, VanaHCM__Entitlement_Rate__c, VanaHCM__Service_Time__c, VanaHCM__Service_Based__c, VanaHCM__Entitlement__c, VanaHCM__Entitlement_Balance__c FROM Employee_Absence_Entitlement__c WHERE UserID__c = :tmpVar1 ORDER BY Name ASC NULLS FIRST]
        //[SELECT (SELECT VanaHCM__Years_of_Service__c, VanaHCM__Entitlement__c, VanaHCM__Max_Absence_Entitlement__c, VanaHCM__Max_Absence_Balance__c, VanaHCM__Max_Hours__c FROM Service_Based_Absence__r) FROM Absence_Types__c v WHERE Id = :tmpVar1]
    }
    
    public void recallAbsenceRequest() {
        
            
        List<ProcessInstanceWorkitem> piwi = [SELECT Id, ProcessInstanceId, ProcessInstance.TargetObjectId FROM ProcessInstanceWorkitem WHERE ProcessInstance.TargetObjectId = :selectedAbsenceRequestID ];
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('approverComment');
        req.setAction('Removed');       
        req.setWorkitemId(piwi.get(0).Id);
        Approval.ProcessResult result =  Approval.process( req, false );
        
        Map<Id, ProcessInstance> statusMap = new Map<Id, ProcessInstance>();
        for ( ProcessInstance pi: [SELECT TargetObjectId, Status FROM ProcessInstance] ) {
            statusMap.put( pi.TargetObjectId, pi );
        } 
        absenceRequestForSelectedWorker = new List<x>();
                List<VanaHCM__Worker__c> wos = [ SELECT VanaHCM__Standard_Hours__c, VanaHCM__User__c, w.Name, w.Id, VanaHCM__Worker_ID__c, VanaHCM__Full_Name__c FROM VanaHCM__Worker__c w WHERE VanaHCM__User__c = :UserInfo.getUserId() LIMIT 1 ];
        employee_absence_view_record = new List<w>();
        absenceRequestForSelectedWorker = new List<x>();
        if ( wos.size() == 0  ) {
            ApexPages.addMessage( new ApexPages.Message(ApexPages.Severity.Error,'You don\'t have worker'));
            return;
        }
        VanaHCM__Worker__c wo = wos[0];
        
        for ( VanaHCM__Absence_Request__c ar: [ SELECT VanaHCM__Hours__c, VanaHCM__Department__r.name, VanaHCM__Requested_By__r.VanaHCM__Full_Name__c, VanaHCM__Employee_Full_Name__c, VanaHCM__Start_date__c, a.Id, VanaHCM__End_date__c, VanaHCM__Dump_Start_Date__c, VanaHCM__Dump_End_Date__c, VanaHCM__Employee_ID__c, VanaHCM__Absence_Type_Request__c, VanaHCM__Absence_Type_Request__r.Name, VanaHCM__Actual_Absence__c, VanaHCM__Approved__c FROM VanaHCM__Absence_Request__c a WHERE VanaHCM__Requested_By__c = :wo.Id ORDER BY VanaHCM__Dump_Start_date__c DESC NULLS FIRST LIMIT 10000  ]) {
            if (statusMap.containsKey( ar.Id ) ) {
                absenceRequestForSelectedWorker.add( new x(ar, statusMap.get( ar.Id ).Status ) );  
                
            }
        }
    }
}

If you would like to reproduce this in your own organization you would probably need also list of custom labels

    <labels>
        <fullName>AbsenceAbsenceAccrued</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAbsenceAccrued</shortDescription>
        <value>Absence Accrued</value>
    </labels>
    <labels>
        <fullName>AbsenceAbsenceBalance</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAbsenceBalance</shortDescription>
        <value>AbsenceAbsenceBalance</value>
    </labels>
    <labels>
        <fullName>AbsenceAbsenceDate</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAbsenceDate</shortDescription>
        <value>AbsenceAbsenceDate</value>
    </labels>
    <labels>
        <fullName>AbsenceAbsenceReason</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAbsenceReason</shortDescription>
        <value>Absence Reason</value>
    </labels>
    <labels>
        <fullName>AbsenceAbsenceType</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAbsenceType</shortDescription>
        <value>Absence Type</value>
    </labels>
    <labels>
        <fullName>AbsenceAccrualRate</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceAccrualRate</shortDescription>
        <value>AccrualRate</value>
    </labels>
    <labels>
        <fullName>AbsenceApprovalStatus</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceApprovalStatus</shortDescription>
        <value>AbsenceApprovalStatus</value>
    </labels>
    <labels>
        <fullName>AbsenceBalanceCurrent</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceBalanceCurrent</shortDescription>
        <value>AbsenceBalanceCurrent</value>
    </labels>
    <labels>
        <fullName>AbsenceBalanceIncludingPending</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceBalanceIncludingPending</shortDescription>
        <value>AbsenceBalanceIncludingPending</value>
    </labels>
    <labels>
        <fullName>AbsenceBalancePayPeriodEnding</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceBalancePayPeriodEnding</shortDescription>
        <value>AbsenceBalancePayPeriodEnding</value>
    </labels>
    <labels>
        <fullName>AbsenceCarryOver</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceCarryOver</shortDescription>
        <value>CarryOver</value>
    </labels>
    <labels>
        <fullName>AbsenceDefinedAsExcluded</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceDefinedAsExcluded</shortDescription>
        <value>AbsenceDefinedAsExcluded</value>
    </labels>
    <labels>
        <fullName>AbsenceEntitlement</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceEntitlement</shortDescription>
        <value>Entitlement</value>
    </labels>
    <labels>
        <fullName>AbsenceEntitlementBalance</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceEntitlementBalance</shortDescription>
        <value>AbsenceEntitlementBalance</value>
    </labels>
    <labels>
        <fullName>AbsenceHalfDay</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceHalfDay</shortDescription>
        <value>AbsenceHalfDay</value>
    </labels>
    <labels>
        <fullName>AbsenceRecallAbsenceRequest</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceRecallAbsenceRequest</shortDescription>
        <value>AbsenceRecallAbsenceRequest</value>
    </labels>
    <labels>
        <fullName>AbsenceRecallConfirm</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceRecallConfirm</shortDescription>
        <value>Are you sure you want to recall the selected absence request?</value>
    </labels>
    <labels>
        <fullName>AbsenceRequestAbsence</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceRequestAbsence</shortDescription>
        <value>Request Absence</value>
    </labels>
    <labels>
        <fullName>AbsenceRequestTimeOff</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceRequestTimeOff</shortDescription>
        <value>Request Time Off</value>
    </labels>
    <labels>
        <fullName>AbsenceSelectDates</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceSelectDates</shortDescription>
        <value>Select Dates</value>
    </labels>
    <labels>
        <fullName>AbsenceTakenCurrent</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceTakenCurrent</shortDescription>
        <value>AbsenceTakenCurrent</value>
    </labels>
    <labels>
        <fullName>AbsenceTakenIncludingPending</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceTakenIncludingPending</shortDescription>
        <value>AbsenceTakenIncludingPending</value>
    </labels>
    <labels>
        <fullName>AbsenceTakenPayPeriodEnding</fullName>
        <categories>Absence</categories>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceTakenPayPeriodEnding</shortDescription>
        <value>AbsenceTakenPayPeriodEnding</value>
    </labels>
    <labels>
        <fullName>AbsenceTotalAbsenceRequested</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceTotalAbsenceRequested</shortDescription>
        <value>AbsenceTotalAbsenceRequested</value>
    </labels>
    <labels>
        <fullName>AbsenceTotalHoursRequested</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>AbsenceTotalHoursRequested</shortDescription>
        <value>AbsenceTotalHoursRequested</value>
    </labels>
    <labels>
        <fullName>Absence_UI_department_related_message</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>Absence_UI_department_related_message</shortDescription>
        <value>Absence_UI_department_related_message</value>
    </labels>
    <labels>
        <fullName>common_label_department</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common label department</shortDescription>
        <value>department</value>
    </labels>
    <labels>
        <fullName>common_label_details</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common_label_details</shortDescription>
        <value>common_label_details</value>
    </labels>
    <labels>
        <fullName>common_label_end_date</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common_label_end_date</shortDescription>
        <value>common_label_end_date</value>
    </labels>
    <labels>
        <fullName>common_label_hours</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common_label_hours</shortDescription>
        <value>common_label_hours</value>
    </labels>
    <labels>
        <fullName>common_label_no_records_found</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common_label_no_records_found</shortDescription>
        <value>common_label_no_records_found</value>
    </labels>
    <labels>
        <fullName>common_label_start_date</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common_label_start_date</shortDescription>
        <value>common_label_start_date</value>
    </labels>
    <labels>
        <fullName>common_label_worker</fullName>
        <language>en_US</language>
        <protected>false</protected>
        <shortDescription>common label worker</shortDescription>
        <value>worker</value>
    </labels>

Unfortunately we didn’t deploy this code to production, however, it was very interesting to reverse engineer controller of managed package. Hope you enjoy this as well.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s