This patch adds an after_circ_action hook action for the case when an item that is not checked out is checked in.
Created attachment 163097 [details] [review] Bug 36303: Add after_circ_action hook action for checking in item that was not checked out To test: 1) Run tests in t/db_dependent/Koha/Plugins/Circulation_hooks.t Sponsored-by: Gothenburg University Library
The fourth test fails on the current main branch: # Subtest: after_circ_action() hook tests 1..3 # Subtest: AddIssue 1..2 not ok 1 - AddIssue calls the after_circ_action hook # Failed test 'AddIssue calls the after_circ_action hook' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 80. # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'patron_barcode_transform called with parameter: D6ga8T7MA1bjQa7tEaRKLbwB' # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'after_circ_action called with action: checkout, ref: Koha::Checkout type: issue' # expected to find warning: (?^u:after_circ_action called with action: checkout, ref: Koha::Checkout type: issue) not ok 2 - AddIssue calls the after_circ_action hook (onsite_checkout case) # Failed test 'AddIssue calls the after_circ_action hook (onsite_checkout case)' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 84. # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'patron_barcode_transform called with parameter: D6ga8T7MA1bjQa7tEaRKLbwB' # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'after_circ_action called with action: checkout, ref: Koha::Checkout type: onsite_checkout' # expected to find warning: (?^u:after_circ_action called with action: checkout, ref: Koha::Checkout type: onsite_checkout) # Looks like you failed 2 tests of 2. not ok 1 - AddIssue # Failed test 'AddIssue' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 86. # Subtest: AddRenewal 1..1 not ok 1 - AddRenewal calls the after_circ_action hook # Failed test 'AddRenewal calls the after_circ_action hook' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 100. # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'patron_barcode_transform called with parameter: D6ga8T7MA1bjQa7tEaRKLbwB' # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'after_circ_action called with action: renewal, ref: Koha::Checkout' # expected to find warning: (?^u:after_circ_action called with action: renewal, ref: Koha::Checkout) # Looks like you failed 1 test of 1. not ok 2 - AddRenewal # Failed test 'AddRenewal' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 102. # Subtest: AddReturn 1..3 ok 1 - No hook called because no return happened not ok 2 - AddReturn calls the after_circ_action hook # Failed test 'AddReturn calls the after_circ_action hook' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 118. # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'patron_barcode_transform called with parameter: D6ga8T7MA1bjQa7tEaRKLbwB' # found warning: Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'after_circ_action called with action: checkin, ref: Koha::Old::Checkout' # expected to find warning: (?^u:after_circ_action called with action: checkin, ref: Koha::Old::Checkout) ok 3 - AddReturn calls the after_circ_action hook # Looks like you failed 1 test of 3. not ok 3 - AddReturn # Failed test 'AddReturn' # at t/db_dependent/Koha/Plugins/Circulation_hooks.t line 124. # Looks like you failed 3 tests of 3. not ok 4 - after_circ_action() hook tests Also, is there some quick code that I could add somewhere in order to manually confirm that the hook is working as intended?