Bug 19926: Add the Koha::Object->unblessed_all_relateds method
[koha-ffzg.git] / Koha / IssuingRules.pm
index f3da6e2..e0fffd1 100644 (file)
@@ -100,6 +100,27 @@ sub get_opacitemholds_policy {
     return $issuing_rule ? $issuing_rule->opacitemholds : undef;
 }
 
+=head3 get_onshelfholds_policy
+
+    my $on_shelf_holds = Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron });
+
+=cut
+
+sub get_onshelfholds_policy {
+    my ( $class, $params ) = @_;
+    my $item = $params->{item};
+    my $itemtype = $item->effective_itemtype;
+    my $patron = $params->{patron};
+    my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule(
+        {
+            ( $patron ? ( categorycode => $patron->categorycode ) : () ),
+            itemtype   => $itemtype,
+            branchcode => $item->holdingbranch
+        }
+    );
+    return $issuing_rule ? $issuing_rule->onshelfholds : undef;
+}
+
 =head3 type
 
 =cut