Bugzilla – Attachment 130056 Details for
Bug 24239
Let the ILL module set ad hoc hard due dates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24239: Let the ILL module set ad hoc hard due dates
Bug-24239-Let-the-ILL-module-set-ad-hoc-hard-due-d.patch (text/plain), 6.55 KB, created by
Lari Taskula
on 2022-02-01 23:59:44 UTC
(
hide
)
Description:
Bug 24239: Let the ILL module set ad hoc hard due dates
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2022-02-01 23:59:44 UTC
Size:
6.55 KB
patch
obsolete
>From c07f2d1210a80e269e4aace8b8261e9532ed438b Mon Sep 17 00:00:00 2001 >From: Magnus Enger <magnus@libriotech.no> >Date: Fri, 13 Dec 2019 13:17:55 +0100 >Subject: [PATCH] Bug 24239: Let the ILL module set ad hoc hard due dates > >The Swedish Libris ILL backend lets librarians store a specific due date >when an ILL loan is received. This is stored as a ILL request attribute. > >This patch adds a syspref that can take the name of the >illrequestattribute used to store the specific date. If the syspref is >set, and if an item is connected to an ILL request, the due date will be >taken from the illrequestattribute, instead of being calculated in the >regular way, based on patroncategory and itemtype. > >To test: >- Apply the patch and make sure the atomic database update is run >- Use the FreeForm backend to add one ILL request. Take note of the > illrequest_id of the request you created. We refer to this as > "x" below. >- Connect a biblio (with biblionumber y), that has an item with a > barcode, to the ILL request directly in the database: > UPADTE illrequests SET biblio_id = y WHERE illrequest_id = x; >- Add an attribute to the ILL request directly in the database: > INSERT INTO illrequestattributes SET illrequest_id = x, type = > 'illduedate', value = '2023-01-01'; >- Enter 'illduedate' as a value for the ILLUseExactDueDate syspref. >- Go to circulation and issue the barcode of the item to the > patron associated with the FreeForm ILL request. Verify that the > loan gets a due date of 2023-01-01. >- Ideally: return the item and issue it again through SIP2 and SCO, > and verify that the due date is still 2023-01-01. > (I don't think the REST API supports issuing yet?) >- Verify that there are no regressions, so that regular calculation > of due dates still work, if ILLUseExactDueDate is empty or not. >--- > C4/Circulation.pm | 23 +++++++++++++++++++ > .../bug24239-ad-hoc-due-date-for-ill.perl | 10 ++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/circulation.pref | 4 ++++ > 4 files changed, 38 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug24239-ad-hoc-due-date-for-ill.perl > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index d59fbf6380..9722ca4234 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1472,6 +1472,29 @@ sub AddIssue { > $datedue = CalcDateDue( $issuedate, $itype, $branchcode, $borrower ); > > } >+ >+ # Check if we need to use an exact due date set by the ILL module >+ if ( C4::Context->preference('ILLUseExactDueDate') ) { >+ # Check if there is an ILL connected with the biblio of the item we are issuing >+ my $biblionumber = $item_object->biblionumber; >+ my @illrequests = Koha::Illrequests->search({ biblio_id => $biblionumber }); >+ if ( @illrequests ) { >+ # There could be more than one ILL request connected with a >+ # given biblio, so we need to make sure we find the right one >+ foreach my $req ( @illrequests ) { >+ if ( $borrower->{ 'borrowernumber' } == $req->borrowernumber ) { >+ # We found the right request, now get the proper attribute >+ my $ill_date_string = $req->illrequestattributes->find({ type => C4::Context->preference('ILLUseExactDueDate') })->value; >+ warn $ill_date_string; >+ my $ill_dt = dt_from_string( $ill_date_string ); >+ $ill_dt->set_hour(23); >+ $ill_dt->set_minute(59); >+ $datedue = $ill_dt; >+ } >+ } >+ } >+ } >+ > $datedue->truncate( to => 'minute' ); > > my $patron = Koha::Patrons->find( $borrower ); >diff --git a/installer/data/mysql/atomicupdate/bug24239-ad-hoc-due-date-for-ill.perl b/installer/data/mysql/atomicupdate/bug24239-ad-hoc-due-date-for-ill.perl >new file mode 100644 >index 0000000000..cde66c0e30 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug24239-ad-hoc-due-date-for-ill.perl >@@ -0,0 +1,10 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do( q{ >+ INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('ILLUseExactDueDate',NULL,NULL,'Use this ILL request attribute to set a specific due date when a document on ILL loan is issued.','multiple') >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 24239 - Let the ILL module set ad hoc hard due dates)\n"; >+} >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index dd83a00fd8..7a95c898e8 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -260,6 +260,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ILLModuleUnmediated','0','','If enabled, try to immediately progress newly placed ILL requests.','YesNo'), > ('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple'), > ('ILLSendStaffNotices', NULL, NULL, 'Send these ILL notices to staff', 'multiple'), >+('ILLUseExactDueDate',NULL,NULL,'Use this ILL request attribute to set a specific due date when a document on ILL loan is issued.','multiple'), > ('ILS-DI','0','','Enables ILS-DI services at OPAC.','YesNo'), > ('ILS-DI:AuthorizedIPs','','Restricts usage of ILS-DI to some IPs','.','Free'), > ('ImageLimit','5','','Limit images stored in the database by the Patron Card image manager to this number.','Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index 43ccf3fd33..0fcbab7fbf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -940,6 +940,10 @@ Circulation: > 1: Enable > 0: Disable > - unmediated interlibrary loan requests. If enabled and the ILL backend supports it, the newly created requests are immediately requested by backend. >+ - >+ - Use the ILL request attribute >+ - pref: ILLUseExactDueDate >+ - to set an exact due date for an ILL loan, from the ILL module. Leave empty to calculate due dates the standard way. > - > - pref: CirculateILL > default: 0 >-- >2.25.1
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 24239
:
96246
|
106409
|
130056
|
130057
|
130414
|
130415
|
130416
|
133475
|
133476
|
133477
|
135244
|
135245
|
135246
|
135943
|
135944
|
135945
|
136458
|
136459
|
136460
|
136461
|
136462
|
136463