Bugzilla – Attachment 158668 Details for
Bug 35151
Convert ILLModuleCopyrightClearance system preference to additional contents
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35151: Convert ILLModuleCopyrightClearance system preference to additional contents
Bug-35151-Convert-ILLModuleCopyrightClearance-syst.patch (text/plain), 11.86 KB, created by
Owen Leonard
on 2023-11-08 17:25:37 UTC
(
hide
)
Description:
Bug 35151: Convert ILLModuleCopyrightClearance system preference to additional contents
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2023-11-08 17:25:37 UTC
Size:
11.86 KB
patch
obsolete
>From 670f659f49618eea79711f16439912f9042c51bd Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 26 Oct 2023 14:38:14 +0000 >Subject: [PATCH] Bug 35151: Convert ILLModuleCopyrightClearance system > preference to additional contents > >This patch moves the ILLModuleCopyrightClearance system preference into >HTML customizations, making it possible to have language- and >library-specific content. > >To test you should have some content in the ILLModuleCopyrightClearance >system preference before applying the patch. Apply the patch, run the >database update process, and rebuild the OPAC CSS. > >- In the staff client, go to Tools -> HTML customizations and verify > that the content from ILLModuleCopyrightClearance is now stored there. >- The HTML customization entry form should offer > ILLModuleCopyrightClearance as a choice under "Display location." >- Update and reinstall active translations (for instance fr-FR): > - perl misc/translator/translate update fr-FR > - perl misc/translator/translate install fr-FR >- Enable the translation if necessary under Administration -> System > preferences -> language. >- Enable the "opaclanguagesdisplay" preference if necessary. >- Edit the ILLModuleCopyrightClearance HTML customization and add unique > content to the "fr-FR" tab. > >- Enable the "ILLModule" and "ILLModuleUnmediated" system preferences if > necessary. You must have at least one ILL backend installed. >- Log into the OPAC and click the "Interlibrary loan requests" in the > sidebar menu on the user summary page. >- Click "Create new request." >- You should be taken to a page with your ILLModuleCopyrightClearance > content shown along with "Yes" and "No" buttons. > - Clicking "Yes" should take you to the form for creating a new > request. >- Switch to your updated translation and confirm that the content > appears correctly. >- Remove all "ILLModuleCopyrightClearance" html customizations. Test the > "Create new request" process in the OPAC again. > - There should be no confirmation step before arriving at the form for > creating a new ILL request. >- Go to Administration -> System preferences and search for > "ILLModuleCopyrightClearance." It should return no results. >--- > Koha/Illrequest.pm | 16 +++++++- > ...pyrightClearance-to-additional-contents.pl | 38 +++++++++++++++++++ > .../en/includes/html-customization-help.inc | 4 ++ > .../en/modules/tools/additional-contents.tt | 2 +- > .../bootstrap/en/modules/opac-illrequests.tt | 11 ++++-- > opac/opac-illrequests.pl | 6 ++- > 6 files changed, 70 insertions(+), 7 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug-35151-move-ILLModuleCopyrightClearance-to-additional-contents.pl > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index 831d6fa52d..1dfbb4d484 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -41,6 +41,7 @@ use Koha::Biblios; > use Koha::Items; > use Koha::ItemTypes; > use Koha::Libraries; >+use Koha::AdditionalContents; > > use C4::Circulation qw( CanBookBeIssued AddIssue ); > >@@ -932,9 +933,20 @@ sub backend_create { > my ( $self, $params ) = @_; > > # Establish whether we need to do a generic copyright clearance. >- if ($params->{opac}) { >+ if ( $params->{opac} ) { >+ >+ my $copyright_content = Koha::AdditionalContents->search_for_display( >+ { >+ category => 'html_customizations', >+ location => ['ILLModuleCopyrightClearance'], >+ lang => $params->{lang}, >+ library_id => $params->{branchcode}, >+ } >+ ); >+ > if ( ( !$params->{stage} || $params->{stage} eq 'init' ) >- && C4::Context->preference("ILLModuleCopyrightClearance") ) { >+ && $copyright_content->count ) >+ { > return { > error => 0, > status => '', >diff --git a/installer/data/mysql/atomicupdate/bug-35151-move-ILLModuleCopyrightClearance-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-35151-move-ILLModuleCopyrightClearance-to-additional-contents.pl >new file mode 100755 >index 0000000000..1f5e8fe1cc >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-35151-move-ILLModuleCopyrightClearance-to-additional-contents.pl >@@ -0,0 +1,38 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "35065", >+ description => "Move ILLModuleCopyrightClearance to additional contents", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Get any existing value from the ILLModuleCopyrightClearance system preference >+ my ($illmodulecopyrightclearance) = $dbh->selectrow_array( >+ q| >+ SELECT value FROM systempreferences WHERE variable='ILLModuleCopyrightClearance'; >+ | >+ ); >+ if ($illmodulecopyrightclearance) { >+ >+ # Insert any values found from system preference into additional_contents >+ $dbh->do( >+ "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'ILLModuleCopyrightClearance', 'ILLModuleCopyrightClearance', NULL, CAST(NOW() AS date) )" >+ ); >+ >+ my ($insert_id) = $dbh->selectrow_array( >+ "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'ILLModuleCopyrightClearance' AND location = 'ILLModuleCopyrightClearance' LIMIT 1", >+ {} >+ ); >+ >+ $dbh->do( >+ "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'ILLModuleCopyrightClearance default', ?, 'default' )", >+ undef, $insert_id, $illmodulecopyrightclearance >+ ); >+ >+ # Remove old system preference >+ $dbh->do("DELETE FROM systempreferences WHERE variable='ILLModuleCopyrightClearance'"); >+ say $out "Bug 35065 update done"; >+ } >+ } >+ } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >index d41cfcda87..9fc3fe5d62 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html-customization-help.inc >@@ -18,6 +18,10 @@ > Include this content in the popup message which is displayed in the OPAC when the CookieConsent system preference is enabled and the user clicks the "Your cookies" menu item in the header. > </div> > >+<div id="ILLModuleCopyrightClearance_notes" class="hint customization_note"> >+ Adding content to this region will enable the copyright clearance stage in request creation. The content will appear on the OPAC during the process of placing an ILL request. >+</div> >+ > <div id="opaccredits_notes" class="hint customization_note"> > Include this content in the footer of all pages in the OPAC. > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >index cf372332c3..9a686af8d0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt >@@ -524,7 +524,7 @@ > [% END %] > [% END %] > [% ELSE %] >- [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions' ] %] >+ [% SET opac_available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'OpacMaintenanceNotice', 'OPACResultsSidebar', 'OpacSuppressionMessage', 'SCOMainUserBlock', 'SelfCheckInMainUserBlock', 'SelfCheckHelpMessage', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'PatronSelfRegistrationAdditionalInstructions', 'ILLModuleCopyrightClearance' ] %] > <optgroup label="OPAC"> > [% FOREACH l IN opac_available_options.sort %] > [% IF l == location %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >index e5a96e3c35..cc7e2e83d8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt >@@ -6,6 +6,7 @@ > [% USE AdditionalContents %] > [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] > [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] >+[% SET ILLModuleCopyrightClearance = AdditionalContents.get( location => "ILLModuleCopyrightClearance", lang => lang, library => logged_in_user.branchcode || default_branch ) %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Your interlibrary loan requests › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -78,13 +79,17 @@ > [% INCLUDE messages %] > <div> > <p> >- [% Koha.Preference('ILLModuleCopyrightClearance') | $raw %] >+ [% IF ( ILLModuleCopyrightClearance ) %] >+ <div id="ILLModuleCopyrightClearance"> >+ [% PROCESS koha_news_block news => ILLModuleCopyrightClearance %] >+ </div> >+ [% END %] > </p> > [% USE link_url = url('/cgi-bin/koha/opac-illrequests.pl', whole.value.other) %] > <a href="[% link_url _ '&stage=copyrightclearance' | $raw %]" >- class="btn btn-sm btn-primary"><i class="fa fa-check" aria-hidden="true"></i> Yes</a> >+ class="btn btn-sm btn-primary"><i class="fa fa-fw fa-check" aria-hidden="true"></i> Yes</a> > <a href="/cgi-bin/koha/opac-illrequests.pl" >- class="btn btn-sm btn-danger"><i class="fa fa-times" aria-hidden="true"></i> No</a> >+ class="btn btn-sm btn-danger"><i class="fa fa-fw fa-times" aria-hidden="true"></i> No</a> > </div> > [% ELSE %] > [% INCLUDE messages %] >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 5173b8da6c..81a7251b34 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -146,8 +146,12 @@ if ( $op eq 'list' ) { > exit; > } > >+ my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } ); >+ > $params->{cardnumber} = $patron->cardnumber; >- $params->{opac} = 1; >+ $params->{branchcode} = $patron->branchcode; >+ $params->{opac} = 1; >+ $params->{lang} = C4::Languages::getlanguage($query); > my $backend_result = $request->backend_create($params); > > # After creation actions >-- >2.30.2
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 35151
:
158668
|
158741
|
159659
|
162590