Bug 41358 - action logs info column should always store JSON
Summary: action logs info column should always store JSON
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 9762
Blocks:
  Show dependency treegraph
 
Reported: 2025-12-02 15:23 UTC by Lucas Gass (lukeg)
Modified: 2025-12-02 17:25 UTC (History)
3 users (show)

See Also:
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.