Skip to content

Commit 8c42e02

Browse files
Merge pull request #26 from wimvelzeboer/FixTyposAndStyling
Fix Typos and styling issues
2 parents 4c4ce5f + a7689f7 commit 8c42e02

23 files changed

+96
-80
lines changed

sfdx-source/apex-common-samplecode/main/classes/batchjobs/CreateInvoicesJob.cls

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Class implements the required interfaces for Scheduling and executing in Batch
2929
*
3030
* NOTE: The server and selector methods are reused, logic in this batch class is thus very light,
31-
* focusing on passing paramters in and handling errors and notfications
31+
* focusing on passing parameters in and handling errors and notifications
3232
*
3333
**/
3434
global with sharing class CreateInvoicesJob
@@ -45,15 +45,15 @@ global with sharing class CreateInvoicesJob
4545

4646
public Database.QueryLocator start(Database.BatchableContext context)
4747
{
48-
// Obtain appoprite query locator from the selector
48+
// Obtain appropriate query locator from the selector
4949
return new OpportunitiesSelector().queryLocatorReadyToInvoice();
5050
}
5151

5252
public void execute(Database.BatchableContext context, List<Opportunity> opps)
5353
{
5454
try
5555
{
56-
// Opportunites ready to be invoiced
56+
// Opportunities ready to be invoiced
5757
Set<Id> opportunitiesToInvoice = new Map<Id, SObject>(opps).keySet();
5858

5959
// Create invoices
@@ -71,7 +71,7 @@ global with sharing class CreateInvoicesJob
7171

7272
public void finish(Database.BatchableContext context)
7373
{
74-
// Simple notifiation of any errors received via email
74+
// Simple notification of any errors received via email
7575
if(jobErrors.size() > 0)
7676
{
7777
// Email address from user
@@ -83,16 +83,18 @@ global with sharing class CreateInvoicesJob
8383
for(JobError jobError : jobErrors)
8484
{
8585
List<String> failedOpps = new List<String>();
86-
for(Opportunity opp : jobError.records)
86+
for (Opportunity opp : jobError.records)
87+
{
8788
failedOpps.add(opp.Name);
88-
emailBody += String.format('<p>Error {0} occured during the processing of Opportunities {1}</p>',
89+
}
90+
emailBody += String.format('<p>Error {0} occurred during the processing of Opportunities {1}</p>',
8991
new List<String> { jobError.message, String.join(failedOpps, ',') });
9092
}
9193
// Send email
9294
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
9395
mail.setToAddresses(new String[] { usersEmail.get(UserInfo.getUserId()) });
9496
mail.setReplyTo(usersEmail.get(UserInfo.getUserId()));
95-
mail.setSenderDisplayName(userInfo.getUserName());
97+
mail.setSenderDisplayName(UserInfo.getUserName());
9698
mail.setSubject('Create Invoice Job Failures');
9799
mail.setHtmlBody(emailBody);
98100
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

sfdx-source/apex-common-samplecode/main/classes/controllers/OpportunityApplyDiscountController.cls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Controller shared by Apply Discount and Apply Discounts Custom Buttons (and related pages) on the Opportunity
2929
*
3030
* NOTE: The same service method is called regardless, logic in this controller is thus very light,
31-
* focusing on passing paramters in and handling errors and notfications
31+
* focusing on passing parameters in and handling errors and notifications
3232
**/
3333
public with sharing class OpportunityApplyDiscountController
3434
{
@@ -54,7 +54,7 @@ public with sharing class OpportunityApplyDiscountController
5454
{
5555
// Apply discount entered to the current Opportunity
5656
OpportunitiesService.applyDiscounts(
57-
new Set<ID> { standardController.getId() }, DiscountPercentage);
57+
new Set<Id> { standardController.getId() }, DiscountPercentage);
5858
}
5959
catch (Exception e)
6060
{
@@ -69,15 +69,15 @@ public with sharing class OpportunityApplyDiscountController
6969
try
7070
{
7171
// Selected Opportunity Id's
72-
Set<Id> selectedOpportuntyIds =
72+
Set<Id> selectedOpportunityIds =
7373
new Map<Id, SObject>(standardSetController.getSelected()).keySet();
7474

7575
// Apply discount entered to the selected Opportunities
7676
OpportunitiesService.applyDiscounts(
77-
selectedOpportuntyIds, DiscountPercentage);
77+
selectedOpportunityIds, DiscountPercentage);
7878

7979
// Confirm submission
80-
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, 'Opportunities updated.'));
80+
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Opportunities updated.'));
8181
}
8282
catch (Exception e)
8383
{

sfdx-source/apex-common-samplecode/main/classes/controllers/OpportunityConsoleController.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ public with sharing class OpportunityConsoleController
3030
public static void applyDiscount(Id opportunityId, Decimal discountPercent)
3131
{
3232
// Call service
33-
OpportunitiesService.applyDiscounts(new Set<ID> { opportunityId }, discountPercent);
33+
OpportunitiesService.applyDiscounts(new Set<Id> { opportunityId }, discountPercent);
3434
}
3535
}

sfdx-source/apex-common-samplecode/main/classes/controllers/OpportunityCreateInvoiceController.cls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* Controller shared by Create Invoice and Create Invoices Custom Buttons (and related pages) on the Opportunity
2929
*
3030
* NOTE: The same service method is called regardless, logic in this controller is thus very light,
31-
* focusing on passing paramters in and handling errors and notfications
31+
* focusing on passing parameters in and handling errors and notifications
3232
**/
3333
public with sharing class OpportunityCreateInvoiceController
3434
{
@@ -54,7 +54,7 @@ public with sharing class OpportunityCreateInvoiceController
5454
{
5555
// Create Invoice the Opportunity
5656
Set<Id> invoiceIds = OpportunitiesService.createInvoices(
57-
new Set<ID> { standardController.getId() }, DiscountPercentage);
57+
new Set<Id> { standardController.getId() }, DiscountPercentage);
5858

5959
// Redirect to Invoice
6060
return new PageReference('/'+new List<Id>(invoiceIds)[0]);
@@ -72,14 +72,14 @@ public with sharing class OpportunityCreateInvoiceController
7272
try
7373
{
7474
// Selected Opportunity Id's
75-
Set<Id> selectedOpportuntyIds =
75+
Set<Id> selectedOpportunityIds =
7676
new Map<Id, SObject>(standardSetController.getSelected()).keySet();
7777

7878
// Create invoices for selected Invoices, optionally applying discount before hand
79-
OpportunitiesService.createInvoices(selectedOpportuntyIds, DiscountPercentage);
79+
OpportunitiesService.createInvoices(selectedOpportunityIds, DiscountPercentage);
8080

8181
// Confirm
82-
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Info, 'Invoices created.'));
82+
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'Invoices created.'));
8383
}
8484
catch (Exception e)
8585
{

sfdx-source/apex-common-samplecode/main/classes/controllers/OpportunityInvoicingController.cls

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public with sharing class OpportunityInvoicingController
3535
{
3636
ApexPages.addMessage(
3737
new ApexPages.Message(
38-
ApexPages.Severity.Info, 'Click Start to scan Opportunities that are ready for invoicing and process them.'));
38+
ApexPages.Severity.INFO, 'Click Start to scan Opportunities that are ready for invoicing and process them.'));
3939
}
4040

4141
public PageReference startJob()
@@ -48,7 +48,7 @@ public with sharing class OpportunityInvoicingController
4848
// Confirm
4949
ApexPages.addMessage(
5050
new ApexPages.Message(
51-
ApexPages.Severity.Info, 'The job has been submitted, you will receive an email notificaiton of any issues.'));
51+
ApexPages.Severity.INFO, 'The job has been submitted, you will receive an email notificaiton of any issues.'));
5252
}
5353
catch (Exception e)
5454
{

sfdx-source/apex-common-samplecode/main/classes/controllers/QuickOpportunityWizardController.cls

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public with sharing class QuickOpportunityWizardController
4949

5050
// Recently used Opportunity lines
5151
List<OpportunityLineItem> lines =
52-
[select
52+
[SELECT
5353
Id,
5454
Description,
5555
ListPrice,
@@ -72,10 +72,10 @@ public with sharing class QuickOpportunityWizardController
7272
PricebookEntry.Pricebook2.IsActive,
7373
PricebookEntry.Pricebook2.IsStandard,
7474
PricebookEntry.Pricebook2.Name
75-
from OpportunityLineItem
76-
where Opportunity.Account.id = :account.Id
77-
order by SystemModstamp
78-
desc limit 10];
75+
FROM OpportunityLineItem
76+
WHERE Opportunity.Account.Id = :account.Id
77+
ORDER BY SystemModstamp
78+
DESC LIMIT 10];
7979

8080
// Clone these to be available for selection for the new opportunity
8181
for(OpportunityLineItem item : lines)

sfdx-source/apex-common-samplecode/main/classes/domains/AbstractChargeable.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public with sharing abstract class AbstractChargeable extends fflib_SObjectDomai
5050
{
5151
List<Integer> hoursWorked = calculateHoursWorked();
5252

53-
Schema.SobjectField costOfHoursWorkedField = getCostOfHoursWorkedField();
53+
Schema.SObjectField costOfHoursWorkedField = getCostOfHoursWorkedField();
5454

5555
Integer hoursWorkedRecordIdx = 0;
5656

sfdx-source/apex-common-samplecode/main/classes/domains/Opportunities.cls

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ public class Opportunities extends fflib_SObjectDomain
116116
{
117117
// Update last Opportunity activity on the related Accounts (via the Accounts domain class)
118118
fflib_ISObjectUnitOfWork uow = new fflib_SObjectUnitOfWork(new Schema.SObjectType[] { Account.SObjectType });
119-
120119

121120
IAccounts accounts = (IAccounts)Application.Domain.newInstance( accountIds );
122121

@@ -137,9 +136,9 @@ public class Opportunities extends fflib_SObjectDomain
137136
// Apply discount
138137
for(Opportunity opportunity : (List<Opportunity>) this.records)
139138
{
140-
// Appply to the Opporunity Amount?
141-
if(opportunity.OpportunityLineItems == null ||
142-
opportunity.OpportunityLineItems.size()==0)
139+
// Apply to the Opportunity Amount?
140+
if(opportunity.OpportunityLineItems == null
141+
|| opportunity.OpportunityLineItems.isEmpty())
143142
{
144143
// Adjust the Amount on the Opportunity if no lines
145144
opportunity.Amount = opportunity.Amount * factor;
@@ -153,8 +152,8 @@ public class Opportunities extends fflib_SObjectDomain
153152
}
154153

155154
// Apply discount to lines
156-
IOpportunityLineItems lineItems =
157-
(IOpportunityLineItems) Application.Domain.newInstance(linesToApplyDiscount);
155+
IOpportunityLineItems lineItems = (IOpportunityLineItems) Application.Domain.newInstance(linesToApplyDiscount);
156+
158157
lineItems.applyDiscount(this, discountPercentage, uow);
159158
}
160159

sfdx-source/apex-common-samplecode/main/classes/domains/OpportunityLineItems.cls

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public with sharing class OpportunityLineItems extends fflib_SObjectDomain
4141
{
4242
super(sObjectList);
4343
}
44-
44+
4545
public void applyDiscount(IOpportunities opps, Decimal discountPercentage, fflib_ISObjectUnitOfWork uow)
4646
{
4747
// Opportunties by Id
@@ -56,9 +56,13 @@ public with sharing class OpportunityLineItems extends fflib_SObjectDomain
5656
{
5757
// Skip products that have not been approved for discounting
5858
Opportunity opportunity = opportunitiesById.get(line.OpportunityId);
59-
if(opportunity.DiscountType__c == 'Approved Products')
60-
if(line.PricebookEntry.Product2.DiscountingApproved__c == false)
61-
continue;
59+
if (opportunity.DiscountType__c == 'Approved Products')
60+
{
61+
if (line.PricebookEntry.Product2.DiscountingApproved__c == false)
62+
{
63+
continue;
64+
}
65+
}
6266

6367
// Adjust UnitPrice
6468
line.UnitPrice = line.UnitPrice * factor;

sfdx-source/apex-common-samplecode/main/classes/restapis/OpportunitiesResource.cls

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2525
**/
2626

27-
@RestResource(urlMapping='/opportunities/*/applydiscount')
27+
@RestResource(UrlMapping='/opportunities/*/applydiscount')
2828
global with sharing class OpportunitiesResource
2929
{
3030
@HttpPost
@@ -33,15 +33,14 @@ global with sharing class OpportunitiesResource
3333
{
3434
// Take apart the URI to discover the Opportunity Id
3535
RestRequest req = RestContext.request;
36-
RestResponse res = RestContext.response;
37-
String[] uriParts = req.requestURI.split('/');
36+
String[] uriParts = req.requestURI.split('/');
3837

3938
// Determine service parameter values from REST context
40-
ID opportunityId = uriParts[2]; // get from URL path
39+
Id opportunityId = uriParts[2]; // get from URL path
4140
String discountParam = req.params.get('discount');
4241
Decimal discountPercent = discountParam!=null ? Decimal.valueOf(discountParam) : 0;
4342

4443
// Call Service Method
45-
OpportunitiesService.applyDiscounts(new Set<ID> { opportunityId }, discountPercent );
44+
OpportunitiesService.applyDiscounts(new Set<Id> { opportunityId }, discountPercent );
4645
}
4746
}

0 commit comments

Comments
 (0)