Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSTMM-43: Fix Owner Organization Field On Credit Note Creation #205

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ang/fe-creditnote/directives/creditnote-create.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,22 @@
return
}

let currentOwnerOrganization = $scope.creditnotes.owner_organization ? $scope.creditnotes.owner_organization
: String($scope.companies[0]?.contact_id);
let contributionOwnerOrganization = null;

$scope.companies.forEach((company) => {
if (company.contact_id !== null &&
String(contribution['financeextras_contribution_owner.owner_organization']) === String(company.contact_id)
) {
contributionOwnerOrganization = String(company.contact_id);
}
});

$scope.contactId = contribution.contact_id
$scope.creditnotes.contact_id = contribution.contact_id
$scope.creditnotes.owner_organization = String(contribution['financeextras_contribution_owner.owner_organization'])
$scope.creditnotes.owner_organization = contributionOwnerOrganization ?
contributionOwnerOrganization : currentOwnerOrganization;
$scope.creditnotes.currency = contribution.currency
$scope.disableCurrency = true
$scope.currencySymbol = CurrencyCodes.getSymbol(contribution.currency);
Expand Down
Loading