李彤
2023-03-16 cb4bae31a02af72fea30e1a57c1d498eabef5d01
force-app/main/default/classes/UpdateUserTextColBatch.cls
@@ -32,7 +32,7 @@
     * startには、queryを実行、ユーザーを検索
     */
    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'Select Id, Fiscal_Start_Date__c, Fiscal_Start_Date_from_May__c, Use_Start_Date__c from User';
        String query = 'Select Id, Fiscal_Start_Date__c, Fiscal_Start_Date_from_May__c, Use_Start_Date__c, Maternity_leave_StartDate__c, Maternity_leave_EndDate__c from User';  //20230303 lt DB202302421915 add  , Maternity_leave_StartDate__c, Maternity_leave_EndDate__c
        if (String.isBlank(testUserId) == false) {
            query += ' where Id =\'' + testUserId + '\'';
        }
@@ -48,7 +48,29 @@
                fromDate4 = usr.Use_Start_Date__c;
            }
            usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate));
            //20230303 lt DB202302421915 start
            // usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate));
            Date mlStartDate = usr.Maternity_leave_StartDate__c;
            Date mlEndDate = usr.Maternity_leave_EndDate__c;
            if(mlStartDate == null && mlEndDate == null){
                usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, toDate));
            }
            else if(mlStartDate != null && mlEndDate == null && mlStartDate > fromDate4){
                usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, mlStartDate));
            }
            else if(mlStartDate != null && mlEndDate == null && mlStartDate <= fromDate4){
                usr.Fiscal_Workdays__c = 0;
            }
            else if(mlStartDate != null && mlEndDate != null && mlStartDate > fromDate4){
                usr.Fiscal_Workdays__c = decimal.valueOf(getOlympusWorkDayCount(fromDate4, mlStartDate)) + decimal.valueOf(getOlympusWorkDayCount(mlEndDate, toDate));
            }
            else if(mlStartDate != null && mlEndDate != null && mlStartDate <= fromDate4){
                usr.Fiscal_Workdays__c = 0 + decimal.valueOf(getOlympusWorkDayCount(mlEndDate, toDate));
            }
            //20230303 lt DB202302421915 end
            /***** CHAN-AZABMC ****** 2018/06/01 ********
             **** 到本月的工作日(今年度)
             **** 到本周的工作日(今年度)