Data migration: importing of check-out entries from an old version of Koha

Restoration of an old version of a corrupted database to the latest version of Koha is a challenging task. Data migration from a running instance of an old version of Koha is comparatively easy. Porting of bibliographic records to MARC format, patron details and circulation details to CSV is possible. Then it can be imported into a new version of Koha.

This tutorial discusses the various stages in exporting of check-out (issue) details from the old version of Koha into latest version.


Background preparation

  • Export bibliographic details (MARC format), patron and circulation details.
  • Install a new version of Koha. Create branch code, Patron categories, Authorised values, circulation and fine rules same like the old version of Koha.
  • Import MARC file and patron details.

Exporting of checkout entries

Prepare a report of all books checked out

Koha > Report > Create from SQL Enter following SQL query.

SELECT issues.issuedate,borrowers.cardnumber,items.barcode 
FROM issues  
LEFT JOIN borrowers ON borrowers.borrowernumber=issues.borrowernumber   
LEFT JOIN items ON issues.itemnumber=items.itemnumber    
LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber 
ORDER BY issues.issuedate DESC

Run the report and export it as CSV format.

Create offline circulation file


Open the All Book Checkout Out report in LibreOffice or any other spreadsheet application.

Add a new column between issuedate and cardnumber columns. Put the line 'issue' in all rows. Koha recognises that these entries for checkout of books. 


Transfer checkout entries from CSV file to .koc file.

koc stands for (Koha Offline Circulation.Download a sample .koc file from here. Open the .koc file using a text editor (e.g. leafpad. mousepad). Copy the entire checkout entries from csv (except column names) to .koc file.


Save and close the .koc file.

Import .koc file into Koha

Make sure that all records, patron details imported into Koha before import .koc file. Circulation rules should be created.

Koha > Circulation > Offline circulation > Upload offline circulation file (.koc)



Choose the .koc file and upload.
The screen may show a timeout. The process will go on behind. Check the status after a few minutes.

Koha > Circulation > Offline circulation > Pending offline circulation actions

The check out entries successfully imported

Calculate the fine

Run the following commands to calculate the fines.

cd /etc/cron.daily/
sudo ./koha-common

Check the status of successful entries by visiting a patron account.

No comments:

Post a Comment