| | |
| | | } |
| | | |
| | | @AuraEnabled |
| | | public static String postponeCheck(String endDate, Integer d) { |
| | | Date before5day = getWD_addday(date.parse(endDate), d); |
| | | if (Date.today() > before5day) { |
| | | return System.Label.EquipmentRentalPostponeOverDeadline; |
| | | } |
| | | return 'OK'; |
| | | } |
| | | |
| | | public static Date getWD_addday(Date d, Integer i) { |
| | | public static String postponeCheck(String endDate, Integer i) { |
| | | Date d=Date.valueOf(endDate); |
| | | // return 'OK1';S |
| | | Date selectDate; |
| | | if (d == Date.valueOf('4000-12-31')) { |
| | | return d; |
| | | } |
| | | if (i >= 0) { |
| | | selectDate=d; |
| | | } else if (i >= 0) { |
| | | List<OlympusCalendar__c> workday = [ |
| | | select Id, Date__c, IsWorkDay__c |
| | | from OlympusCalendar__c |
| | |
| | | and IsWorkDay__c = 1 |
| | | order by Date__c |
| | | limit :(i+1)]; |
| | | Date selectDate = workday[i].Date__c; |
| | | return selectDate; |
| | | selectDate = workday[i].Date__c; |
| | | return 'OK1'; |
| | | // if (Date.today() > selectDate) { |
| | | // return System.Label.EquipmentRentalPostponeOverDeadline; |
| | | // } |
| | | } else { |
| | | i = Math.abs(i); |
| | | List<OlympusCalendar__c> workday = [ |
| | |
| | | and IsWorkDay__c = 1 |
| | | order by Date__c desc |
| | | limit :(i+1)]; |
| | | Date selectDate = workday[i].Date__c; |
| | | return selectDate; |
| | | } |
| | | selectDate = workday[i].Date__c; |
| | | } |
| | | |
| | | if (Date.today() > selectDate) { |
| | | return System.Label.EquipmentRentalPostponeOverDeadline; |
| | | } |
| | | return 'OK'; |
| | | |
| | | // Date before5day = getWD_addday(date.parse(endDate), d); |
| | | // return 'OK2'; |
| | | // if (Date.today() > before5day) { |
| | | // return System.Label.EquipmentRentalPostponeOverDeadline; |
| | | // } |
| | | // return 'OK'; |
| | | } |
| | | |
| | | // public static Date getWD_addday(Date d, Integer i) { |
| | | |
| | | // } |
| | | |
| | | @AuraEnabled |
| | | public static String submitApprovalRequest(String recordId) { |
| | | try{ |
| | | Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest(); |
| | | req.setObjectId(recordId); |
| | | Approval.ProcessResult result = Approval.process(req); |
| | | if(result.getErrors()!=null&&result.getErrors().size()>0)return result.getErrors().get(0).getMessage(); |
| | | }catch(Exception e){ |
| | | System.debug(' submitApprovalRequest error: '+e.getMessage()); |
| | | return e.getMessage(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public class UpdateResult { |
| | | @AuraEnabled public String recordId {get;set;} |