Secure tenant as a special case
Related information
Context
The diagram below illustrates the application of the loan policy in the Central and Secure tenants:
Problem and solution(s) proposed
Problem description and the solution
Secure tenant - there is an explicit manual checkout here; we need to copy the loan policy from the data tenant and apply it
https://github.com/folio-org/mod-circulation-bff/blob/master/src/main/java/org/folio/circulationbff/service/impl/CheckOutServiceImpl.java#L28 - just add this and verify:
if (settingsService.isEcsTlrFeatureEnabled() && tenantService.isCurrentTenantCentral()) { ---- > && ( tenantService.isCurrentTenantCentral() || isSecureTenant )
Data tenant - the required loan policy is right here, so it will be applied automatically
Central tenant - the problem here is that the synchronization of request/loan is done via DCB, and it is impossible to force the use of an explicit loan policy
option #1 - teach mod-dcb to store and transmit loan policy ID - long, complex, tedious, ugly
option #2 - checkout the central tenant yourself and force mod-dcb to agree with it - the risk is how mod-dcb will react to updating its transactions and statuses from outside (it may take a lot of effort to adapt)
option #3 - do nothing - then the CT will have incorrect loans; it's not nice, it's not transparent for the staff, it's hard to predict the consequences
option #4 - first apply the central tenant's loan policy "as is", then copy and update it on top; assume the central tenant's loan policy is very permissive; may be difficult to determine the specific loan to apply this logic to; relatively easy, ugly
option #5 - make a mechanism in mod-circulation via a DB table that allows forcing the use of a loan policy; logically adequate, relatively simple, nice
1) in mod-tlr when processing checkOut we clone the loan policy from the data tenant to the Central (and optionally) Secure tenants
2) if we have a case with 3 requests, then in the Central tenant leave a record in the new DB table "requestID - loanPolicyId"
3) in the Central tenant during checkout and determining the loan policy, look in the table by requestId, and if there is a record there, then apply the specified loan policy during checkout
Work decomposition for the option #5 (total errofts - 5-6 SPs):
mod-circulation-storage (a new table + CRUD API) - 2 SP
mod-tlr (populate the table) - 1-2 SP
mod-circulation (read the table and force loan policy) - 2 SP