Tech Blog

Bulk loans transfer from a user to another user

Sometimes there is a need to transfer loans among patrons, maintaining the same date and time of loans and due dates as much as possible : for example, if we have a duplicate record for a user and it is impossible to delete the old record because it has loans, it would be nice to avoid the manual return and reloan, especially if the loans are many.

Apparently there is no job or API available to do this, but I was inspired by this blog post

https://developers.exlibrisgroup.com/blog/Alma-Bulk-Loan-Transfer-Using-Analytics-and-Offline-Circ/

and I have written a python script to generate automatically and quickly the .dat file for offline circulation (https://knowledge.exlibrisgroup.com/Alma/Product_Documentation/010Alma_Online_Help_(English)/030Fulfillment/070Advanced_Tools/060Offline_Circulation)

python loantransfer.py user_from_id user_to_id

(this transfers loans from user_from_id to user_to_id)

python loantransfer.py user_id_from user_id_to -d 30

(this transfers loans using 30 days prior to due date as return/reloan datetime, to avoid an event error in the case of renewed loans)

The script has this behavior and features:

  • check if both users id exist in Alma
  • check if user_from has loans
  • create one or more .dat files depending on library and circulation desk of loans, so you can upload the files separately, after selecting previously the correct circulation desk in Alma
  • every .dat file performs items returns from user_from and loans to user_to; the date and the time of these operations are calculated on the initial loan date and time, adding one minute for return and two minutes for reloan
  • if loans are renewed an event error is possible when trying to upload them to offline circulation: since there is no possibility to obtain the last renewal date the script can set the return/reloan date to n days prior to due date
  • date and time in UTC format are automatically adjusted to the local time

The script loantransfer.py is available here:

References

Leave a Reply