<<

NAME

migrate_action_logs_to_json.pl - Migrate old circulation and holds log entries to JSON format

SYNOPSIS

migrate_action_logs_to_json.pl [ -c | --commit ] [ -v | --verbose ] [ --help ]

 Options:
   --help or -h       Brief usage message
   --commit or -c     Actually update the database (default is dry run)
   --verbose or -v    Print detailed information about each conversion
   --batch-size       Number of records to process per batch (default: 1000)

DESCRIPTION

This script migrates old action log entries from the legacy ID-only format to the new consistent JSON format. This is necessary after the fix for Bug 41358 which ensures all circulation and holds logs are stored in JSON format for consistent reporting.

The script will: 1. Find all CIRCULATION ISSUE log entries where info is just an itemnumber (not JSON) 2. Find all HOLDS CREATE log entries where info is just a hold_id (not JSON) 3. Convert them to JSON format with the appropriate structure:

   For CIRCULATION ISSUE:
   {
     "issue": <issue_id if available>,
     "branchcode": <branchcode if available>,
     "itemnumber": <itemnumber>,
     "confirmations": [],
     "forced": []
   }

   For HOLDS CREATE:
   {
     "hold": <hold_id>,
     "branchcode": <branchcode if available>,
     "biblionumber": <biblionumber if available>,
     "itemnumber": <itemnumber if available>,
     "confirmations": [],
     "forced": []
   }

By default, the script runs in dry-run mode. Use --commit to actually update the database.

WARNING

This script may take a long time to run on large databases with many action_logs entries. It's recommended to run it during off-peak hours.

AUTHOR

Koha Development Team

<<