Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This page contains information about a bug in mod-circulation introduced in CIRC-1566 (released in Nolana, R3 2022) and fixed in CIRC-1778 (release planned for Poppy, R2 2023).

Context

"Actual cost record" (ACR) is a back-end term used for automated lost item fees found on this page (Users → Actions → Lost items requiring actual cost):

...

Actual cost fees are enabled via Lost Item Fee Policy by selecting "Actual cost" in section "Charge amount for item":

When such a fee is created using a Lost Item Fee Policy which has setting "For lost items not charged a fee/fine, close the loan after..." enabled, the fee will be created with an additional property expirationDate. The value of this property is equal to the value of another property lossDate plus the period specified in the aforementioned setting.

...

Such ACR would expire soon after the item is lost, while according to Lost Item Fee Policy it should not have expired at allhad an expiration date in the first place.

How do I know if my library is affected?

Replace {TENANT_ID_HERE} with your tenant ID and run the following query:

Code Block
languagesql
SELECT COUNT(*) from {TENANT_ID_HERE}_mod_circulation_storage.actual_cost_record
WHERE jsonb->'expirationDate' IS NOT NULL
AND jsonb->'expirationDate' =  jsonb->'lossDate';

...

How do I fix affected ACRs?

Replace {TENANT_ID_HERE} with your tenant ID and run the following query:

Code Block
languagesql
UPDATE {TENANT_ID_HERE}_mod_circulation_storage.actual_cost_record
SET jsonb = jsonb_set(jsonb, '{status}', '"Open"') - 'expirationDate'
WHERE jsonb->>'status' = 'Expired'
AND jsonb->'expirationDate' IS NOT NULL
AND jsonb->'expirationDate' =  jsonb->'lossDate';

This query removes will remove expiration date from affected ACRs and changes change their status back from "Expired" to "Open" Expired to Open.

Workaround

If your library is affected OR is planning to start using actual cost fees, please enable setting "For lost items not charged a fee/fine, close the loan after..." in every Lost Item Fee Policy where actual cost is enabled. This will prevent creation of corrupt actual cost records until CIRC-1778 is released.