/** * wangweipeng 2021/12/14 * 修改 用户装机日、备品签收单上传记录、签收单不合格、签收单不合格理由、备品中心确认 字段 * * 在批量延期的时候,从主单入口进行延期,但是没有延期主单,只延期的从单,那么会走主单的工作流,由于走工作流的话,会默认把当前数据给锁住, * 但是客户想在这种情况下修改上面的五个字段,所以做一个自定义页面,让客户可以修改 */ public without sharing class UpdateRentalApplySignatureController { public String uuid {get;set;}//参数id public Rental_Apply__c pageData{get;set;}//页面展示的数据 public Boolean HPReceivedSignNGFlag{get;set;} public Boolean HPReceivedSignNGReasonFlag{get;set;} public Boolean AssetManageConfirmFlag{get;set;} //构造器 public UpdateRentalApplySignatureController() { uuid = System.currentPageReference().getParameters().get('id'); pageData = new Rental_Apply__c(); HPReceivedSignNGFlag = true; HPReceivedSignNGReasonFlag = true; AssetManageConfirmFlag = true; } //初始化方法 public void init(){ if(String.isNotBlank(uuid)){ String racSql = makeRentalApplySoql(uuid); try{ List racList = Database.query(racSql); if(racList != null && racList.size() > 0){ pageData = racList[0]; } }catch(exception e){ //失败提示 ApexPages.addMessages(e); } } AccessControl(); } public PageReference save(){ Savepoint sp = Database.setSavepoint(); try{ update pageData; }catch(Exception ex){ ApexPages.addMessages(ex); Database.rollback(sp); } return null; } //获取account 表的所有数据 private String makeRentalApplySoql(String uuid){ String racSql = 'SELECT id,name,HP_received_sign_day__c,HP_received_sign_rich__c,HP_received_sign_NG__c,HP_received_sign_NG_Reason__c,AssetManageConfirm__c FROM Rental_Apply__c WHERE ID = \'' + uuid + '\''; return racSql; } /** * 权限控制,根据当前登录人,来获取是否可以操作此字段 * * System.debug('---------------'+dfr.isAccessible()+'----------'+dfr.isUpdateable()+'------------'+dfr.isUpdateable()); */ public void AccessControl(){ HPReceivedSignNGFlag = Rental_Apply__c.HP_received_sign_NG__c.getDescribe().isUpdateable(); HPReceivedSignNGReasonFlag = Rental_Apply__c.HP_received_sign_NG_Reason__c.getDescribe().isUpdateable(); AssetManageConfirmFlag = Rental_Apply__c.AssetManageConfirm__c.getDescribe().isUpdateable(); } }