Skip to content

Commit

Permalink
Merge pull request #379 from navikt/KafkaEnhetFieds
Browse files Browse the repository at this point in the history
Added values for new fields in KafkaEnhet integration
  • Loading branch information
raac09 authored Jan 8, 2025
2 parents f1d83f1 + 3540843 commit b5630c6
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
3 changes: 3 additions & 0 deletions force-app/ereg-handler/classes/KafkaEnhet.cls
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ public with sharing class KafkaEnhet {
public String maalform;
public String overordnetEnhet;
public String hjemmeside;
public String epostadresse;
public String telefon;
public String mobil;

public class Organisasjonsform {
public String kode;
Expand Down
40 changes: 40 additions & 0 deletions force-app/ereg-handler/classes/KafkaEnhetHandler.cls
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer
acc.INT_Industry3__c = org.Naeringskode3 != null ? org.Naeringskode3.beskrivelse : null;
acc.INT_Sector__c = org.institusjonellSektorkode != null ? org.institusjonellSektorkode.beskrivelse : null;
acc.INT_SectorCode__c = org.institusjonellSektorkode != null ? org.institusjonellSektorkode.kode : null;
acc.INT_EmployerEmail__c = org.epostadresse;
acc.INT_EmployerMobilePhone__c = org.mobil;
acc.Phone = org.telefon;
acc.CRM_NumberOfEmployeesGrouped__c = getNumberOfEmployeesGroup(org.antallAnsatte, org.harRegistrertAntallAnsatte);

// Reset if employers are falsely set to deleted
acc.IsDeletedEmployer__c = false;
acc.EmployerDeletedDate__c = null;
Expand Down Expand Up @@ -239,4 +244,39 @@ public without sharing class KafkaEnhetHandler implements IKafkaMessageConsumer
CRM_ApplicationDomain.Domain.POAB // Domain domain
);
}


/**
* @description Method that returns a group value of employees based on the number of employees registered by a company
*
* @author Andre Colle <[email protected]>
* @since 2025-01-08 Created.
*
* @param numberOfEmployees Contains the number of employees registered by the employer
* @param hasRegisteredEmployees Contains boolean value that indicates if the employer har registered any employees
* @return Group of number of employees.
*/
private static String getNumberOfEmployeesGroup(Decimal numberOfEmployees, Boolean hasRegisteredEmployees) {
if (numberOfEmployees <= 4 && hasRegisteredEmployees == true) {
return '1-4';
} else if (numberOfEmployees >= 5 && numberOfEmployees <= 10) {
return '5-10';
} else if (numberOfEmployees >= 11 && numberOfEmployees <= 25) {
return '11-25';
} else if (numberOfEmployees >= 26 && numberOfEmployees <= 50) {
return '26-50';
} else if (numberOfEmployees >= 51 && numberOfEmployees <= 100) {
return '51-100';
} else if (numberOfEmployees >= 101 && numberOfEmployees <= 250) {
return '101-250';
} else if (numberOfEmployees >= 251 && numberOfEmployees <= 500) {
return '251-500';
} else if (numberOfEmployees >= 501 && numberOfEmployees <= 1000) {
return '501-1000';
} else if (numberOfEmployees >= 1001) {
return '1000+';
} else {
return null;
}
}
}
2 changes: 1 addition & 1 deletion sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": [
{
"package": "crm-platform-base",
"versionNumber": "0.245.0.LATEST"
"versionNumber": "0.249.0.LATEST"
},
{
"package": "crm-shared-flowComponents",
Expand Down

0 comments on commit b5630c6

Please sign in to comment.