From f6ea91a8679741a0bda69a4903e98bc40dbb9832 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Tue, 15 Aug 2023 15:41:47 +0100
Subject: [PATCH] Bug 6419: Add StaffAcquisitionsHome block to additional
 contents

This patch adds a new `StaffAcquisitionsHome` block to the HTML
Customisations options. This allows for the addition of a block of
content in a page-section at the bottom of the acquisitions home page.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
---
 ..._6419_Add_customizable_areas_to_module_start_pages.sql | 2 +-
 installer/data/mysql/mandatory/sysprefs.sql               | 1 -
 .../intranet-tmpl/prog/en/modules/acqui/acqui-home.tt     | 8 ++++++--
 .../en/modules/admin/preferences/staff_interface.pref     | 6 ------
 .../prog/en/modules/tools/additional-contents.tt          | 2 +-
 5 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/installer/data/mysql/atomicupdate/bug_6419_Add_customizable_areas_to_module_start_pages.sql b/installer/data/mysql/atomicupdate/bug_6419_Add_customizable_areas_to_module_start_pages.sql
index 6c6e411a7e..6de6dd9802 100644
--- a/installer/data/mysql/atomicupdate/bug_6419_Add_customizable_areas_to_module_start_pages.sql
+++ b/installer/data/mysql/atomicupdate/bug_6419_Add_customizable_areas_to_module_start_pages.sql
@@ -2,7 +2,7 @@ $DBversion = 'XXX';  # will be replaced by the RM
 if( CheckVersion( $DBversion ) ) {
     # you can use $dbh here like:
 $dbh->do(q{
-INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('IntranetAcquisitionsHomeHTML', '', 'Show the following HTML in a div on the bottom of the acquisitions home page', NULL, 'Free'), ('IntranetAuthoritiesHomeHTML', '', 'Show the following HTML in a div on the bottom of the authorities home page', NULL, 'Free'), ('IntranetCatalogingHomeHTML', '', 'Show the following HTML in a div on the bottom of the cataloging home page', NULL, 'Free'), ('IntranetListsHomeHTML', '', 'Show the following HTML in a div on the bottom of the lists home page', NULL, 'Free'), ('IntranetPatronsHomeHTML', '', 'Show the following HTML in a div on the bottom of the patrons home page', NULL, 'Free'), ('IntranetPOSHomeHTML', '', 'Show the following HTML in a div on the bottom of the point of sale home page', NULL, 'Free'), ('IntranetSerialsHomeHTML', '', 'Show the following HTML in a div on the bottom of the serials home page', NULL, 'Free')});
+INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('IntranetAuthoritiesHomeHTML', '', 'Show the following HTML in a div on the bottom of the authorities home page', NULL, 'Free'), ('IntranetCatalogingHomeHTML', '', 'Show the following HTML in a div on the bottom of the cataloging home page', NULL, 'Free'), ('IntranetListsHomeHTML', '', 'Show the following HTML in a div on the bottom of the lists home page', NULL, 'Free'), ('IntranetPatronsHomeHTML', '', 'Show the following HTML in a div on the bottom of the patrons home page', NULL, 'Free'), ('IntranetPOSHomeHTML', '', 'Show the following HTML in a div on the bottom of the point of sale home page', NULL, 'Free'), ('IntranetSerialsHomeHTML', '', 'Show the following HTML in a div on the bottom of the serials home page', NULL, 'Free')});
 
     SetVersion( $DBversion );
     print "Upgrade to $DBversion done (Bug 6419 - Add customizable areas to intranet start pages)\n";
diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql
index c95655d08b..a66dfe4fc7 100644
--- a/installer/data/mysql/mandatory/sysprefs.sql
+++ b/installer/data/mysql/mandatory/sysprefs.sql
@@ -305,7 +305,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('IndependentBranchesPatronModifications','0', NULL, 'Show only modification request for the logged in branch','YesNo'),
 ('IndependentBranchesTransfers','0', NULL, 'Allow non-superlibrarians to transfer items between libraries','YesNo'),
 ('IntranetAddMastheadLibraryPulldown','0', NULL, 'Add a library select pulldown menu on the staff header search','YesNo'),
-('IntranetAcquisitionsHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the acquisitions home page', 'Free'),
 ('IntranetAuthoritiesHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the authorities home page', 'Free'),
 ('IntranetCatalogingHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the cataloging home page', 'Free'),
 ('IntranetCatalogSearchPulldown','0', NULL, 'Show a search field pulldown for \"Search the catalog\" boxes','YesNo'),
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt
index e59164d61f..a3a464cd7e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/acqui-home.tt
@@ -1,4 +1,5 @@
 [% USE raw %]
+[% USE AdditionalContents %]
 [% USE Asset %]
 [% USE Price %]
 [% USE Branches %]
@@ -202,9 +203,12 @@
 </div><!-- /.page-section -->
 [% END %]
 
-    <div class="row" id="intranet-acqui-home-html">
-        [% Koha.Preference('IntranetAcquisitionsHomeHTML') | $raw %]
+    [%- SET StaffAcquisitionsHome = AdditionalContents.get( location => "StaffAcquisitionsHome", lang => lang, library => logged_in_user.branchcode ) -%]
+    [%- FOREACH block IN StaffAcquisitionsHome.content -%]
+    <div class="page-section">
+        [%- block.content | $raw -%]
     </div>
+    [%- END -%]
 
 </main>
 </div> <!-- /.col-sm-10.col-sm-push-2 -->
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
index 8c0ccaeb17..6be4d1acc1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_interface.pref
@@ -107,12 +107,6 @@ Staff interface:
             - pref: SlipCSS
               class: url
             - on Issue and Hold Slips. (This should be a complete URL, starting with <code>http://</code>.)
-        -
-            - "Show the following HTML in its own div on the bottom of the home page of the acquisitions module:"
-            - pref: IntranetAcquisitionsHomeHTML
-              type: textarea
-              syntax: text/html
-              class: code
         -
             - "Show the following HTML in its own div on the bottom of the home page of the authorities module:"
             - pref: IntranetAuthoritiesHomeHTML
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 dbf97f69f0..383c9e1d0d 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
@@ -494,7 +494,7 @@
             [% END %]
         [% END %]
     [% ELSE %]
-        [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup' ] %]
+        [% SET available_options = [ 'OpacNavRight', 'opacheader', 'OpacCustomSearch', 'OpacMainUserBlock', 'opaccredits', 'OpacLoginInstructions', 'OpacNav', 'OpacNavBottom', 'OpacSuggestionInstructions', 'ArticleRequestsDisclaimerText', 'OpacMoreSearches', 'OpacMySummaryNote', 'OpacLibraryInfo', 'CatalogConcernHelp', 'CatalogConcernTemplate', 'CookieConsentBar', 'CookieConsentPopup', 'StaffAcquisitionsHome' ] %]
         [% FOREACH l IN available_options.sort %]
             [% IF l == location %]
                 <option value="[% l | html %]" selected="selected">[% l | html %]</option>
-- 
2.30.2