https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41358

--- Comment #6 from Martin Renvoize (ashimema) 
<[email protected]> ---
I did some analysis of the what we pass into info whilst I was digging here:

We have 13 different forms in this field.. explained below.. I'd love to try
and bring that down a bit :S

  ---
  1. Empty String ("")

  Usage: When no additional info is needed beyond module/action/object
  logaction( "MEMBERS", "CREATE", $borrowernumber, "" )
  logaction( "SERIAL", "ADD", $subscriptionid, "" )
  Modules: MEMBERS (CREATE, DELETE), SERIAL (ADD, MODIFY, RENEW, DELETE)

  ---
  2. Simple String Literal

  Usage: Fixed descriptive text
  logaction( "AUTHORITIES", "ADD", $authid, "authority" )
  logaction( "CATALOGUING", "ADD", $biblionumber, "biblio" )
  logaction( "CATALOGUING", "ADD", $itemnumber, "item" )
  Modules: AUTHORITIES, CATALOGUING

  ---
  3. Simple ID/Number (Now deprecated for CIRCULATION/HOLDS)

  Usage: Just the item/hold ID (your bug fixes this!)
  logaction( "CIRCULATION", "RETURN", $borrowernumber, $item->itemnumber )
  Modules: CIRCULATION (RETURN only - ISSUE now uses JSON)

  ---
  4. Concatenated String with Context

  Usage: Pipe-separated values or descriptive messages
  logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $variable . ' | ' . $value )
  logaction( "REPORTS", "DELETE", $id, $report_name . " | " . $savedsql )
  logaction( 'AUTH', 'SUCCESS', $patron_id, "Valid password for $userid", $type
)
  logaction( 'RECALLS', 'CANCEL', $recall_id, "Recall cancelled", 'INTRANET' )
  Modules: SYSTEMPREFERENCE, REPORTS, AUTH, RECALLS
  Format: Usually "field1 | field2" or descriptive message

  ---
  5. BEFORE/AFTER Comparison

  Usage: Stores state before modification for comparison
  logaction( "AUTHORITIES", "MODIFY", $authid,
      "authority BEFORE=>" . $oldrecord->as_formatted )

  logaction( "CATALOGUING", "MODIFY", $biblionumber,
      "biblio $decoding_error BEFORE=>" . $record->as_formatted )
  Modules: AUTHORITIES, CATALOGUING
  Format: "BEFORE=>..."  (full MARC record dump)
  Purpose: Enables visual diff comparison in log viewer

  ---
  6. JSON Structure ✨ (Modern, Consistent)

  Usage: Structured data with overrides, changes, or complex info

  6a. Override/Confirmation Pattern (Your fixes!)

  logaction( "CIRCULATION", "ISSUE", $borrowernumber,
      to_json({
          issue         => $issue_id,
          branchcode    => $branchcode,
          itemnumber    => $itemnumber,
          confirmations => ['DEBT', 'AGE_RESTRICTION'],
          forced        => ['OFFLINE_CIRCULATION']
      }, { pretty => 1, canonical => 1 })
  )
  Modules: CIRCULATION (ISSUE, RENEWAL), HOLDS (CREATE)

  6b. Change Tracking Pattern

  logaction( "MEMBERS", "MODIFY", $borrowernumber,
      to_json($info, { utf8 => 1, pretty => 1, canonical => 1 })
  )
  Where $info contains:
  {
    "firstname": { "before": "John", "after": "Jane" },
    "surname": { "before": "Doe", "after": "Smith" }
  }
  Modules: MEMBERS (MODIFY, MODIFY_CARDNUMBER)

  6c. Attribute Changes

  logaction( "MEMBERS", "MODIFY", $borrowernumber,
      to_json({ "attribute.$code" => $change }, { pretty => 1, canonical => 1
})
  )
  Modules: MEMBERS (extended patron attributes)

  6d. ILL Status Changes

  logaction( 'ILL', 'STATUS_CHANGE', $request_id,
      to_json({
          log_origin    => 'core',
          status_before => $old_status,
          status_after  => $new_status
      })
  )
  Modules: ILL

  6e. Acquisition Baskets

  logaction( 'ACQUISITIONS', 'APPROVE_BASKET', $basketno,
      to_json( $basket->unblessed )
  )
  Modules: ACQUISITIONS

  ---
  7. Object Reference (Koha::Object)

  Usage: Pass entire object for before/after comparison
  logaction( 'HOLDS', 'MODIFY', $hold_id, $hold, undef, $original )
  logaction( "CATALOGUING", "MODIFY", $itemnumber, $self, undef, $original )
  Format: 4th parameter is new object, 6th parameter is original
  Modules: HOLDS, CATALOGUING (items), MEMBERS
  Display: Serialized to JSON by C4::Log internally

  ---
  8. Text Content (Full documents)

  Usage: Stores entire content for comparison
  logaction( 'NOTICES', 'MODIFY', $notice_id, $notice_content )
  logaction( 'NEWS', 'MODIFY', $news_id, $news_content )
  Modules: NOTICES, NEWS, REPORTS
  Display: Special comparison UI with diff viewer

  ---
  9. Descriptive Messages

  Usage: Human-readable action descriptions
  logaction( "FINES", "MODIFY", $borrowernumber,
      "Overdue forgiven: item $item" )

  logaction( "MEMBERS", "PATRON_MERGE", $patron_id,
      "$old_name ($old_cardnumber) has been merged into $new_name" )
  Modules: FINES, MEMBERS (PATRON_MERGE, CIRCMESSAGE actions)

  ---
  Summary Statistics

  From ~190 logaction calls analyzed:

  | Format              | Count | Modules                                      
 |
 
|---------------------|-------|------------------------------------------------|
  | JSON (structured)   | ~35%  | CIRCULATION, HOLDS, MEMBERS, ILL,
ACQUISITIONS |
  | Object Reference    | ~25%  | HOLDS, CATALOGUING, MEMBERS                  
 |
  | Empty String        | ~15%  | SERIAL, MEMBERS                              
 |
  | Concatenated String | ~10%  | SYSTEMPREFERENCE, REPORTS, AUTH              
 |
  | BEFORE/AFTER        | ~5%   | AUTHORITIES, CATALOGUING                     
 |
  | Simple Literal      | ~5%   | AUTHORITIES, CATALOGUING                     
 |
  | Descriptive Message | ~5%   | FINES, MEMBERS, RECALLS                      
 |

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to