Bug 41358

Summary: action logs info column should always store JSON
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: CirculationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: andrew, gmcharlt, kyle
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 9762    
Bug Blocks:    

Description Lucas Gass (lukeg) 2025-12-02 15:23:02 UTC
In C4/Circulation.pm:

            # Log the checkout
            if ( C4::Context->preference('IssueLog') ) {
                my $info = $item_object->itemnumber;
                if ( defined($confirmations) || defined($forced) ) {
                    $info = to_json(
                        {
                            issue         => $issue->issue_id,
                            branchcode    => $issue->branchcode,
                            itemnumber    => $item_object->itemnumber,
                            confirmations => $confirmations,
                            forced        => $forced
                        },   
                        { pretty => 1, canonical => 1 }
                    );   
                }    
                logaction(
                    "CIRCULATION", "ISSUE",
                    $patron->borrowernumber,
                    $info,
                );   
            }  


It appears there is a way, if $forced and $confirmations is undef, to store just the itemnumber. 

If we are going to store JSON it should always be JSON. Storing the itemnumber sometimes and a JSON object other times makes reporting really hard.
Comment 1 Lucas Gass (lukeg) 2025-12-02 15:30:47 UTC
Almost everywhere I see AddIssue called there is:

                confirmations => [ grep { /^[A-Z_]+$/ } keys %{$confirmation} ],
                forced        => [ keys %{$impossible} ]


I don't think this will ever be undef. An empty array is not undef. 

The only place I don't see something like this is offline_circ/process_koc.pl.