Bug 21468: Add 'checkout' action for _after_circ_actions
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 6 Jul 2020 08:44:11 +0000 (09:44 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 15:30:23 +0000 (17:30 +0200)
This patch adds a call to _after_circ_actions into AddIssue and passes
an appropriate payload for plugins to utilise after issuing items.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Circulation.pm

index 70a5bde..8bcd32d 100644 (file)
@@ -1509,6 +1509,23 @@ sub AddIssue {
                 }
             }
 
+            _after_circ_actions(
+                {
+                    action  => 'checkout',
+                    payload => {
+                        type              => ( $onsite_checkout ? 'onsite_checkout' : 'issue' ),
+                        library_id        => C4::Context->userenv->{'branch'},
+                        charge            => $charge,
+                        item_id           => $item_object->itemnumber,
+                        item_type         => $item_object->effective_itemtype,
+                        shelving_location => $item_object->location // q{},
+                        patron_id         => $borrower->{'borrowernumber'},
+                        collection_code   => $item_object->ccode // q{},
+                        date_due          => $datedue
+                    }
+                }
+            ) if C4::Context->config("enable_plugins");
+
             # Record the fact that this book was issued.
             &UpdateStats(
                 {