| | |
| | | User userTest; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | List<RecordType> rectHp = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | List<RecordType> rectHp = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院']; |
| | | if (rectHp.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | accountItem1 = new Account(Name = 'Testaccount001', RecordTypeId = rectCo[0].Id, AgentCode_Ext__c = '9999900'); |
| | | insert accountItem1; |
| | | accountItem2 = new Account(Name = 'Testaccount002', RecordTypeId = rectHp[0].Id, AgentCode_Ext__c = '9999999'); |
| | |
| | | } |
| | | System.runAs(userTest) { |
| | | String Id = UserInfo.getUserId(); |
| | | User thisUserInfo = [ |
| | | SELECT accountid, ContactId, Contact.AccountId, Work_Location__c |
| | | FROM User |
| | | WHERE id = :Id |
| | | ]; |
| | | User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id]; |
| | | String accountId = thisUserInfo.Contact.AccountId; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | String accountName; |
| | | Account[] accountInfo = [ |
| | | SELECT Name |
| | | FROM account |
| | | WHERE id = :accountId |
| | | LIMIT 1 |
| | | ]; |
| | | Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1]; |
| | | if (accountInfo.size() > 0) { |
| | | accountName = accountInfo[0].Name; |
| | | } |
| | |
| | | User MyUser_Test; |
| | | User thisUser = [SELECT Id FROM User WHERE Id = :UserInfo.getUserId()]; |
| | | System.runAs(thisUser) { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | RecordType hosCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院']; |
| | | olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | myAccount2 = new Account(Name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id); |
| | |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | String Id = UserInfo.getUserId(); |
| | | User thisUserInfo = [ |
| | | SELECT accountid, ContactId, Contact.AccountId, Work_Location__c |
| | | FROM User |
| | | WHERE id = :Id |
| | | ]; |
| | | User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id]; |
| | | String accountId = thisUserInfo.Contact.AccountId; |
| | | String userWorkLocation1 = thisUserInfo.Work_Location__c; |
| | | String accountName = myAccount2.Name; |
| | |
| | | @isTest |
| | | static void testProSale() { |
| | | StaticParameter.EscapeConsumableOrderDetail2Trigger = true; |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | RecordType hosCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | Account myAccount2 = new Account(name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id); |
| | |
| | | } |
| | | System.runAs(MyUser_Test) { |
| | | String Id = UserInfo.getUserId(); |
| | | User thisUserInfo = [ |
| | | SELECT accountid, ContactId, Contact.AccountId, Work_Location__c |
| | | FROM User |
| | | WHERE id = :Id |
| | | ]; |
| | | User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id]; |
| | | String accountId = thisUserInfo.Contact.AccountId; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | String accountName; |
| | | Account[] accountInfo = [ |
| | | SELECT Name |
| | | FROM account |
| | | WHERE id = :accountId |
| | | LIMIT 1 |
| | | ]; |
| | | Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1]; |
| | | if (accountInfo.size() > 0) { |
| | | accountName = accountInfo[0].Name; |
| | | } |
| | |
| | | |
| | | @isTest |
| | | static void testProdError() { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | RecordType hosCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | RecordType hosCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '病院']; |
| | | Account olympus = new Account(RecordTypeId = hosCo.Id, AgentCode_Ext__c = '9999900', Name = 'olympus'); |
| | | insert olympus; |
| | | Account myAccount2 = new Account(name = 'Testaccount002', Dealer_discount__c = 20, RecordTypeId = rectCo[0].Id); |
| | |
| | | //订单 |
| | | System.runAs(MyUser_Test) { |
| | | String Id = UserInfo.getUserId(); |
| | | User thisUserInfo = [ |
| | | SELECT accountid, ContactId, Contact.AccountId, Work_Location__c |
| | | FROM User |
| | | WHERE id = :Id |
| | | ]; |
| | | User thisUserInfo = [SELECT accountid, ContactId, Contact.AccountId, Work_Location__c FROM User WHERE id = :Id]; |
| | | String accountId = thisUserInfo.Contact.AccountId; |
| | | String userWorkLocation = thisUserInfo.Work_Location__c; |
| | | String accountName; |
| | | Account[] accountInfo = [ |
| | | SELECT Name |
| | | FROM account |
| | | WHERE id = :accountId |
| | | LIMIT 1 |
| | | ]; |
| | | Account[] accountInfo = [SELECT Name FROM account WHERE id = :accountId LIMIT 1]; |
| | | if (accountInfo.size() > 0) { |
| | | accountName = accountInfo[0].Name; |
| | | } |
| | |
| | | |
| | | @isTest |
| | | static void searchTest1() { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | |
| | | |
| | | @isTest |
| | | static void searchTest2() { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |
| | |
| | | |
| | | @isTest |
| | | static void searchTest3() { |
| | | List<RecordType> rectCo = [ |
| | | SELECT Id |
| | | FROM RecordType |
| | | WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店' |
| | | ]; |
| | | List<RecordType> rectCo = [SELECT Id FROM RecordType WHERE IsActive = TRUE AND SobjectType = 'Account' AND Name = '販売店']; |
| | | if (rectCo.size() == 0) { |
| | | return; |
| | | } |
| | | Profile prof = [ |
| | | SELECT Id |
| | | FROM Profile |
| | | WHERE Name = '901_经销商社区普通权限_2重验证(ET)' |
| | | ]; |
| | | Profile prof = [SELECT Id FROM Profile WHERE Name = '901_经销商社区普通权限_2重验证(ET)']; |
| | | Account myAccount2 = new Account( |
| | | name = 'Testaccount002', |
| | | Dealer_discount__c = 20, |