From 7ccf2fb8e1776ea59f4939f74b59189f70196aaa Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 2 Jan 2026 15:25:55 +0000 Subject: [PATCH] Bug 36063: Add local_holds_to_pull and adjust filters --- .../prog/en/modules/intranet-main.tt | 14 ++++++++--- mainpage.pl | 23 +++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt index 360ac1579c1..127a74516a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/intranet-main.tt @@ -284,10 +284,18 @@ [% END %] - [% IF holds_to_pull && CAN_user_circulate_circulate_remaining_permissions %] + [% IF CAN_user_circulate_circulate_remaining_permissions && holds_to_pull %]
- New holds to pull: - [% holds_to_pull | html %] + Holds to pull: + [% IF local_holds_to_pull %] + + [% Branches.GetLoggedInBranchname | html %]: [% local_holds_to_pull | html %] + + / + [% END %] + + All libraries: [% holds_to_pull | html %] +
[% END %] diff --git a/mainpage.pl b/mainpage.pl index 64aeb6b2e1a..9adabea65f1 100755 --- a/mainpage.pl +++ b/mainpage.pl @@ -24,7 +24,8 @@ use CGI qw ( -utf8 ); use C4::Output qw( output_html_with_http_headers ); use C4::Auth qw( get_template_and_user ); use C4::Koha; -use C4::Tags qw( get_count_by_tag_status ); +use C4::Tags qw( get_count_by_tag_status ); +use Koha::DateUtils qw( dt_from_string ); use Koha::AdditionalContents; use Koha::Patron::Modifications; use Koha::Patron::Discharge; @@ -134,7 +135,24 @@ unless ( $logged_in_user->has_permission( { parameters => 'manage_background_job $template->param( holds_with_cancellation_requests => Koha::Holds->waiting->filter_by_has_cancellation_requests->count ); -my $holds_to_pull = Koha::Holds->search( found => undef )->count; + +my $holds_to_pull_start_date = C4::Context->preference('HoldsToPullStartDate') || 2; +my $reserves_to_pull_from = dt_from_string()->subtract( days => $holds_to_pull_start_date ); + +my $holds_to_pull = Koha::Holds->search( + { + found => undef, + reservedate => { '>=' => $reserves_to_pull_from->ymd() } + } +)->count; + +my $local_holds_to_pull = Koha::Holds->search( + { + found => undef, + branchcode => C4::Context->userenv()->{'branch'}, + reservedate => { '>=' => $reserves_to_pull_from->ymd() } + } +)->count; if ( C4::Context->preference('CurbsidePickup') ) { $template->param( @@ -167,6 +185,7 @@ $template->param( pending_article_requests => $pending_article_requests, pending_problem_reports => $pending_problem_reports, holds_to_pull => $holds_to_pull, + local_holds_to_pull => $local_holds_to_pull, ); output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5