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

PSP-8144, PSP-8119 Disposition File bug fixes #3906

Merged
merged 3 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions source/backend/api/Services/AcquisitionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ private void MatchProperties(PimsAcquisitionFile acquisitionFile, IEnumerable<Us
var pin = acquisitionProperty.Property.Pin.Value;
try
{
var foundProperty = _propertyRepository.GetByPin(pin);
var foundProperty = _propertyRepository.GetByPin(pin, true);
if (foundProperty.IsRetired.HasValue && foundProperty.IsRetired.Value)
{
throw new BusinessRuleViolationException("Retired property can not be selected.");
Expand Down Expand Up @@ -794,13 +794,13 @@ private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, b
isOtherInterest = false;
isPropertyOfInterest = false;
}
else if(property.IsOtherInterest || isOtherInterest)
else if (property.IsOtherInterest || isOtherInterest)
{
isOwned = false;
isOtherInterest = true;
isPropertyOfInterest = false;
}
else if(property.IsPropertyOfInterest || isPropertyOfInterest)
else if (property.IsPropertyOfInterest || isPropertyOfInterest)
{
isOwned = false;
isOtherInterest = false;
Expand Down
10 changes: 5 additions & 5 deletions source/backend/api/Services/DispositionFileService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private void ValidateFileBeforeUpdate(PimsDispositionFile incomingDispositionFil
// The following checks result in hard STOP errors
if (isFileClosing)
{
if (currentProperties.Any(p => p.Property.IsPropertyOfInterest))
if (currentProperties.Any(p => !p.Property.IsOwned))
{
throw new BusinessRuleViolationException("You have one or more properties attached to this Disposition file that is NOT in the \"Core Inventory\" (i.e. owned by BCTFA and/or HMK). To complete this file you must either, remove these non \"Non-Core Inventory\" properties, OR make sure the property is added to the PIMS inventory first.");
}
Expand Down Expand Up @@ -582,7 +582,7 @@ private void ValidateFileBeforeUpdate(PimsDispositionFile incomingDispositionFil
throw new UserOverrideException(UserOverrideCode.DispositionFileFinalStatus, "You are changing this file to a non-editable state. (Only system administrators can edit the file when set to Archived, Cancelled or Completed state). Do you wish to continue?");
}

if (isFileClosing && currentProperties.Any(p => p.Property.IsOwned) && !userOverrides.Contains(UserOverrideCode.DisposeOfProperties))
if (isFileClosing && !userOverrides.Contains(UserOverrideCode.DisposeOfProperties))
{
throw new UserOverrideException(UserOverrideCode.DisposeOfProperties, "You are completing this Disposition File with owned PIMS inventory properties. All properties will be removed from the PIMS inventory (any Other Interests will remain). Do you wish to proceed?");
}
Expand Down Expand Up @@ -710,7 +710,7 @@ private void MatchProperties(PimsDispositionFile dispositionFile, IEnumerable<Us

dispProperty.PropertyId = foundProperty.Internal_Id;
_propertyService.UpdateLocation(dispProperty.Property, ref foundProperty, overrideCodes);
dispProperty.Property = null;
dispProperty.Property = foundProperty;
}
catch (KeyNotFoundException)
{
Expand All @@ -730,15 +730,15 @@ private void MatchProperties(PimsDispositionFile dispositionFile, IEnumerable<Us
var pin = dispProperty.Property.Pin.Value;
try
{
var foundProperty = _propertyRepository.GetByPin(pin);
var foundProperty = _propertyRepository.GetByPin(pin, true);
if (foundProperty.IsRetired.HasValue && foundProperty.IsRetired.Value)
{
throw new BusinessRuleViolationException("Retired property can not be selected.");
}

dispProperty.PropertyId = foundProperty.Internal_Id;
_propertyService.UpdateLocation(dispProperty.Property, ref foundProperty, overrideCodes);
dispProperty.Property = null;
dispProperty.Property = foundProperty;
}
catch (KeyNotFoundException)
{
Expand Down
2 changes: 1 addition & 1 deletion source/backend/api/Services/LeaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void MatchProperties(PimsLease lease, IEnumerable<UserOverrideCode> user
var pin = leaseProperty.Property.Pin.Value;
try
{
var foundProperty = _propertyRepository.GetByPin(pin);
var foundProperty = _propertyRepository.GetByPin(pin, true);
if (foundProperty.IsRetired.HasValue && foundProperty.IsRetired.Value)
{
throw new BusinessRuleViolationException("Retired property can not be selected.");
Expand Down
Loading