Bugzilla – Attachment 187911 Details for
Bug 40504
ILL requests should have ability to assign staff to manage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40504: Add 'managedby' to illrequests
Bug-40504-Add-managedby-to-illrequests.patch (text/plain), 10.76 KB, created by
Pedro Amorim
on 2025-10-15 13:32:42 UTC
(
hide
)
Description:
Bug 40504: Add 'managedby' to illrequests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-10-15 13:32:42 UTC
Size:
10.76 KB
patch
obsolete
>From 87bf2001ec8a7dce7f2526da07b4234d5ae865f6 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 15 Oct 2025 09:10:40 +0000 >Subject: [PATCH] Bug 40504: Add 'managedby' to illrequests > >This also includes a 'manager' accessor which returns the Koha::Patron >object >--- > Koha/ILL/Request.pm | 16 ++++++++++++++++ > Koha/Schema/Result/Illrequest.pm | 12 ++++++++++++ > admin/columns_settings.yml | 3 +++ > api/v1/swagger/definitions/ill_request.yaml | 9 +++++++++ > api/v1/swagger/paths/ill_requests.yaml | 1 + > ill/ill-requests.pl | 1 + > installer/data/mysql/kohastructure.sql | 3 +++ > .../prog/en/includes/ill-list-table.inc | 1 + > .../prog/en/modules/ill/ill-requests.tt | 16 ++++++++++++++++ > .../intranet-tmpl/prog/js/ill-list-table.js | 12 ++++++++++++ > 10 files changed, 74 insertions(+) > >diff --git a/Koha/ILL/Request.pm b/Koha/ILL/Request.pm >index 5e76fc5889e..de045632940 100644 >--- a/Koha/ILL/Request.pm >+++ b/Koha/ILL/Request.pm >@@ -1404,6 +1404,22 @@ sub get_type_disclaimer_date { > return $attr->value; > } > >+=head3 manager >+ >+ my $manager = $request->manager(); >+ >+Return the Koha::Patron object found by $self->managedby >+ >+=cut >+ >+sub manager { >+ my ($self) = @_; >+ >+ my $manager_rs = $self->_result->manager; >+ return unless $manager_rs; >+ return Koha::Patron->_new_from_dbic($manager_rs); >+} >+ > =head3 check_limits > > my $ok = $requests->check_limits( { >diff --git a/Koha/Schema/Result/Illrequest.pm b/Koha/Schema/Result/Illrequest.pm >index 8f6347ee04d..85ab63d439e 100644 >--- a/Koha/Schema/Result/Illrequest.pm >+++ b/Koha/Schema/Result/Illrequest.pm >@@ -469,6 +469,18 @@ __PACKAGE__->belongs_to( > }, > ); > >+__PACKAGE__->belongs_to( >+ "manager", >+ "Koha::Schema::Result::Borrower", >+ { borrowernumber => "managedby" }, >+ { >+ is_deferrable => 1, >+ join_type => "LEFT", >+ on_delete => "CASCADE", >+ on_update => "CASCADE", >+ }, >+); >+ > =head2 koha_object_class > > Missing POD for koha_object_class. >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index 368bd08b113..3ddecddab15 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -1153,6 +1153,9 @@ modules: > columnname: orderid > - > columnname: patron >+ - >+ columnname: managedby >+ is_hidden: 1 > - > columnname: biblio_id > - >diff --git a/api/v1/swagger/definitions/ill_request.yaml b/api/v1/swagger/definitions/ill_request.yaml >index 9c6459b915b..07bb3af1f11 100644 >--- a/api/v1/swagger/definitions/ill_request.yaml >+++ b/api/v1/swagger/definitions/ill_request.yaml >@@ -18,6 +18,10 @@ properties: > type: > - integer > - "null" >+ managedby: >+ type: >+ - integer >+ - "null" > description: Internal patron id > due_date: > type: >@@ -140,6 +144,11 @@ properties: > - object > - "null" > description: The linked patron object (x-koha-embed) >+ manager: >+ type: >+ - object >+ - "null" >+ description: The linked patron object (x-koha-embed) > _strings: > type: > - object >diff --git a/api/v1/swagger/paths/ill_requests.yaml b/api/v1/swagger/paths/ill_requests.yaml >index 7927a56629a..e31efd3ed92 100644 >--- a/api/v1/swagger/paths/ill_requests.yaml >+++ b/api/v1/swagger/paths/ill_requests.yaml >@@ -31,6 +31,7 @@ > - library > - id_prefix > - patron >+ - manager > collectionFormat: csv > produces: > - application/json >diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl >index d637503d755..5d74a75d17e 100755 >--- a/ill/ill-requests.pl >+++ b/ill/ill-requests.pl >@@ -305,6 +305,7 @@ if ($backends_available) { > ? $params->{status_alias} > : "-1"; > $request->status_alias($alias); >+ $request->managedby( $params->{managedby} ); > $request->store; > my $backend_result = { > error => 0, >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index fe7454cfe2f..1d4a5f24bf8 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -3759,6 +3759,7 @@ DROP TABLE IF EXISTS `illrequests`; > CREATE TABLE `illrequests` ( > `illrequest_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ILL request number', > `borrowernumber` int(11) DEFAULT NULL COMMENT 'Patron associated with request', >+ `managedby` int(11) DEFAULT NULL COMMENT 'Staff member manager of request', > `biblio_id` int(11) DEFAULT NULL COMMENT 'Potential bib linked to request', > `deleted_biblio_id` int(11) DEFAULT NULL COMMENT 'Deleted bib linked to request', > `due_date` datetime DEFAULT NULL COMMENT 'Custom date due specified by backend, leave NULL for default date_due calculation', >@@ -3780,6 +3781,7 @@ CREATE TABLE `illrequests` ( > `batch_id` int(11) DEFAULT NULL COMMENT 'Optional ID of batch that this request belongs to', > PRIMARY KEY (`illrequest_id`), > KEY `illrequests_bnfk` (`borrowernumber`), >+ KEY `illrequests_manfk` (`managedby`), > KEY `illrequests_bcfk_2` (`branchcode`), > KEY `illrequests_safk` (`status_alias`), > KEY `illrequests_bibfk` (`biblio_id`), >@@ -3787,6 +3789,7 @@ CREATE TABLE `illrequests` ( > CONSTRAINT `illrequests_bcfk_2` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT `illrequests_bibfk` FOREIGN KEY (`biblio_id`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, > CONSTRAINT `illrequests_bnfk` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `illrequests_manfk` FOREIGN KEY (`managedby`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE CASCADE, > CONSTRAINT `illrequests_ibfk` FOREIGN KEY (`batch_id`) REFERENCES `illbatches` (`ill_batch_id`) ON DELETE SET NULL ON UPDATE CASCADE, > CONSTRAINT `illrequests_safk` FOREIGN KEY (`status_alias`) REFERENCES `authorised_values` (`authorised_value`) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc >index bf314c26e10..15854e60d19 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-list-table.inc >@@ -19,6 +19,7 @@ > <th scope="col" data-datatype="related-object" data-related="extended_attributes" data-related-key="type" data-related-value="type" data-related-search-on="value">Request type</th> > <th scope="col">Order ID</th> > <th scope="col">Patron</th> >+ <th scope="col">Managed by</th> > <th scope="col">Bibliographic record ID</th> > <th scope="col">Library</th> > <th scope="col">Status</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index 6b82dae88df..d49f74248f5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -7,6 +7,7 @@ > [% USE TablesSettings %] > [% USE Price %] > [% PROCESS 'i18n.inc' %] >+[% PROCESS 'manageable-mixin.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title >@@ -391,6 +392,10 @@ > <label for="borrowernumber">Patron ID:</label> > <input name="borrowernumber" id="borrowernumber" type="text" value="[% request.borrowernumber | html %]" /> > </li> >+ [% PROCESS select_manager_form >+ manager => request.manager >+ required_permission => CAN_user_ill >+ %] > <li class="biblio_id"> > <label for="biblio_id" class="biblio_id">Bibliographic record ID:</label> > <input name="biblio_id" id="biblio_id" type="text" value="[% request.biblio_id | html %]" /> >@@ -642,6 +647,10 @@ > <a href="[% borrowerlink | url %]" title="View borrower details"> [% request.patron.firstname _ " " _ request.patron.surname _ " [" _ request.patron.cardnumber _ "]" | html %] </a> > </li> > [% END %] >+ [% PROCESS select_manager_show >+ manager => request.manager >+ display => "fieldset" >+ %] > [% IF request.biblio_id %] > <li class="biblio_id"> > <span class="label biblio_id">Bibliographic record ID:</span> >@@ -1117,6 +1126,13 @@ > [% INCLUDE 'js-patron-format.inc' %] > [% INCLUDE 'calendar.inc' %] > [% INCLUDE 'select2.inc' %] >+ [% IF op == 'edit_action' %] >+ [% INCLUDE 'select_manager.inc' >+ add_modal => 1 >+ manager => request.manager >+ filter => 'ill_users' >+ %] >+ [% END %] > [% IF metadata_enrichment_services %] > <script> > var ill_check_availability_syspref = '[% Koha.Preference('ILLCheckAvailability') | html %]'; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js >index 7c97255c61b..81a7a841d03 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js >@@ -294,6 +294,7 @@ $(document).ready(function () { > "library", > "id_prefix", > "patron", >+ "manager", > ], > order: [[0, "desc"]], > stateSave: true, // remember state on page reload >@@ -411,6 +412,17 @@ $(document).ready(function () { > : ""; > }, > }, >+ { >+ data: "manager.firstname:manager.surname:manager.cardnumber", >+ render: function (data, type, row, meta) { >+ return row.manager >+ ? $patron_to_html(row.manager, { >+ display_cardnumber: true, >+ url: true, >+ }) >+ : __("Nobody"); >+ }, >+ }, > { > data: "biblio_id", > orderable: true, >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40504
:
187906
|
187907
|
187908
|
187909
|
187910
|
187911
|
187912
|
187913
|
187914
|
187915
|
188365
|
188563
|
188565
|
188566
|
188567
|
188568
|
188569
|
188570
|
188571
|
188572
|
188573
|
188574
|
188624
|
188625
|
188935
|
188936