Bugzilla – Attachment 78119 Details for
Bug 20639
Allow setting a default/single backend for OPAC driven requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20639: Add ILLOpacbackends syspref
Bug-20639-Add-ILLOpacbackends-syspref.patch (text/plain), 5.07 KB, created by
Andrew Isherwood
on 2018-08-24 09:16:56 UTC
(
hide
)
Description:
Bug 20639: Add ILLOpacbackends syspref
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2018-08-24 09:16:56 UTC
Size:
5.07 KB
patch
obsolete
>From 0282f8dede10926635de593712e38b8b35cef91a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 24 Apr 2018 14:15:22 +0100 >Subject: [PATCH] Bug 20639: Add ILLOpacbackends syspref > >This adds the ILLOpacbackends syspref, allowing users to refine the ill >backends available to opac users for initiating ill requests > >Remove default assignment for backends > >We don't need a default assignment for the ILLOpacbackends assignment, >if the pref isn't set, it returns undef anyway. Also, having this >default assignment actually breaks the fetching of the preference >--- > Koha/Illrequest/Config.pm | 9 +++++++-- > .../atomicupdate/bug_20639-add_ILLOpacbackends_syspref.perl | 11 +++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > .../prog/en/modules/admin/preferences/circulation.pref | 5 +++++ > opac/opac-illrequests.pl | 3 ++- > 5 files changed, 26 insertions(+), 3 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_20639-add_ILLOpacbackends_syspref.perl > >diff --git a/Koha/Illrequest/Config.pm b/Koha/Illrequest/Config.pm >index 28e80ce0f6..6c0b9dc2b5 100644 >--- a/Koha/Illrequest/Config.pm >+++ b/Koha/Illrequest/Config.pm >@@ -104,16 +104,21 @@ sub backend_dir { > > =head3 available_backends > >-Return a list of available backends. >+ $backends = $config->available_backends; >+ $backends = $config->abailable_backends($reduced); >+ >+Return a list of available backends, if passed a | delimited list it >+will filter those backends down to only those present in the list. > > =cut > > sub available_backends { >- my ( $self ) = @_; >+ my ( $self, $reduce ) = @_; > my $backend_dir = $self->backend_dir; > my @backends = (); > @backends = glob "$backend_dir/*" if ( $backend_dir ); > @backends = map { basename($_) } @backends; >+ @backends = grep { $_ =~ /$reduce/ } @backends if $reduce; > return \@backends; > } > >diff --git a/installer/data/mysql/atomicupdate/bug_20639-add_ILLOpacbackends_syspref.perl b/installer/data/mysql/atomicupdate/bug_20639-add_ILLOpacbackends_syspref.perl >new file mode 100644 >index 0000000000..d74b368533 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_20639-add_ILLOpacbackends_syspref.perl >@@ -0,0 +1,11 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q| >+ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) >+ VALUES ('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','multiple'); >+ |); >+ >+ # Always end with this (adjust the bug info) >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 20639 - Add ILLOpacbackends syspref)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 0e39905434..ce8ea38feb 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -205,6 +205,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('IdRef','0','','Disable/enable the IdRef webservice from the OPAC detail page.','YesNo'), > ('ILLModule','0','If ON, enables the interlibrary loans module.','','YesNo'), > ('ILLModuleCopyrightClearance','','70|10','Enter text to enable the copyright clearance stage of request creation. Text will be displayed','Textarea'), >+('ILLOpacbackends',NULL,NULL,'ILL backends to enabled for OPAC initiated requests','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 217f48d3a4..d66cbb1717 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 >@@ -745,6 +745,11 @@ Circulation: > - pref: ILLModuleCopyrightClearance > type: textarea > class: long >+ - >+ - "ILL backends to enabled for OPAC initiated requests:" >+ - pref: ILLOpacbackends >+ class: multi >+ - (separated with |). > Fines Policy: > - > - Calculate fines based on days overdue >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 002b60f8f1..329dc24792 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -50,7 +50,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ > }); > > # Are we able to actually work? >-my $backends = Koha::Illrequest::Config->new->available_backends; >+my $reduced = C4::Context->preference('ILLOpacbackends'); >+my $backends = Koha::Illrequest::Config->new->available_backends($reduced); > my $backends_available = ( scalar @{$backends} > 0 ); > $template->param( backends_available => $backends_available ); > >-- >2.11.0
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 20639
:
74806
|
74811
|
75165
|
78119
|
79033
|
79474
|
79477
|
79478
|
84932
|
84933
|
84934