@@ -24,25 +24,29 @@ class RequestabilityResolver {
2424 return elasticSearchResponse
2525 }
2626
27- static buildPhysRequestable ( item , numDeliveryLocations ) {
27+ static buildPhysRequestable ( item , numDeliveryLocations , requestableBasedOnHoldingLocation ) {
2828 let physRequestableCriteria
2929 let physRequestable
3030 const hasRecapCustomerCode = item . recapCustomerCode ?. [ 0 ]
3131 const itemIsInRecapMissingRecapCustomerCode = isInRecap ( item ) && ! hasRecapCustomerCode
32- // recap items missing codes should default to true for phys and edd
33- // requestable, unless it has a non-requestable holding location
32+ // The following cases are NOT mutually exclusive
3433 if ( itemIsInRecapMissingRecapCustomerCode ) {
34+ // recap items missing codes should default to true for phys and edd
35+ // requestable, unless it has a non-requestable holding location.
3536 physRequestable = true
3637 physRequestableCriteria = 'Missing customer code'
38+ } else if ( ! DeliveryLocationsResolver . requestableBasedOnHoldingLocation ( item ) ) {
39+ physRequestableCriteria = 'Unrequestable holding location'
40+ physRequestable = false
41+ } else if ( numDeliveryLocations === 0 ) {
42+ physRequestableCriteria = 'No delivery locations.'
43+ physRequestable = false
3744 }
45+ // This case is mutually exclusive with the prior 3
3846 if ( numDeliveryLocations > 0 ) {
3947 physRequestableCriteria = `${ numDeliveryLocations } delivery locations.`
4048 physRequestable = true
4149 }
42- if ( ! numDeliveryLocations ) {
43- physRequestableCriteria = 'No delivery locations.'
44- physRequestable = false
45- }
4650 // items without barcodes should not be requestable
4751 const hasBarcode = ( item . identifier || [ ] ) . some ( ( identifier ) => / ^ ( u r n | b f ) : [ b B ] a r c o d e : \w + / . test ( identifier ) )
4852 if ( isItemNyplOwned ( item ) && ! hasBarcode ) {
0 commit comments