fix(OLMIS-8249): require positive adjustment quantities - #88
Merged
denys1204 merged 1 commit intoJul 17, 2026
Merged
Conversation
denys1204
requested review from
kszymankiewicz-sd,
lwojewnik and
mgrochalskisoldevelo
July 17, 2026 13:57
mgrochalskisoldevelo
requested changes
Jul 17, 2026
mgrochalskisoldevelo
left a comment
Contributor
There was a problem hiding this comment.
One small change request. Please remove the four OE-206 comments - this is a community core repo; references to an Eswatini-internal ticket may confuse every future reader, and the rationale already lives in the PR body.
Once this is done, the ticket is good to be merged.
Reject stock adjustments whose quantity is not greater than zero, both when adding a new reason and when submitting the modal. Previously an empty, zero, or non-numeric quantity could be saved, producing invalid adjustments. - inject alertService into the adjustments modal controller - validate newAdjustment on Add; reject if quantity is not > 0 - validate all adjustments on Update; reject if any is invalid - add hasInvalidAdjustments() / hasValidQuantity() helpers and expose vm.hasInvalidAdjustments - add "openlmisAdjustments.quantityGreaterThanZero" message Ported from OpenLMIS-Eswatini (OE-206) into core so the guard applies everywhere instead of only in the Eswatini overlay.
denys1204
force-pushed
the
OLMIS-8249-implement-changes-from-OE-206-to-Core
branch
from
July 17, 2026 14:50
76a5072 to
f2c91d7
Compare
|
mgrochalskisoldevelo
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds validation to the adjustments modal so that a stock adjustment cannot be added or saved with a non-positive quantity. Previously an empty, zero, negative, or non-numeric quantity could be entered and saved, producing invalid adjustments.
Ported from OpenLMIS-Eswatini (OE-206) into core so the guard applies everywhere, not only in the Eswatini overlay.
Changes
alertServiceintoAdjustmentsModalController.addAdjustment): reject the new reason if its quantity is not greater than 0 and showopenlmisAdjustments.quantityGreaterThanZero.save): reject submission if any adjustment has an invalid quantity and show the same message.hasInvalidAdjustments()/hasValidQuantity()and exposevm.hasInvalidAdjustments.> 0.openlmisAdjustments.quantityGreaterThanZeromessage key.Testing
adjustments-modal.controller.spec.jscovering the guard on Add and Save for zero, empty and negative quantities, plus positive-path controls.Files changed
src/openlmis-adjustments/adjustments-modal.controller.jssrc/openlmis-adjustments/adjustments-modal.controller.spec.jssrc/openlmis-adjustments/messages_en.jsonNotes
This PR intentionally contains only the adjustment-quantity validation. The other part of OE-206 (default-language fallback in
messageService) was evaluated but deliberately left out of core: moving it here changes a relied-upon contract (get()returning the raw key when no locale is set) and breaks 22 tests across other UI repositories. Details in the ticket.