Bug 36303 - Add after_circ_action hook action for checking in item that was not checked out
Summary: Add after_circ_action hook action for checking in item that was not checked out
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: David Gustafsson
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-12 18:18 UTC by David Gustafsson
Modified: 2024-09-27 18:29 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 36303: Add after_circ_action hook action for checking in item that was not checked out (4.29 KB, patch)
2024-03-12 18:20 UTC, David Gustafsson
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2024-03-12 18:18:25 UTC
This patch adds an after_circ_action hook action for the case when an item that is not checked out is checked in.
Comment 1 David Gustafsson 2024-03-12 18:20:47 UTC
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
Comment 2 Olivier Hubert 2024-09-27 18:29:43 UTC
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?