From 79f8f429b192c7d90e865e8669af3cbf772f87ba Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 10 Jun 2025 14:41:39 +0000 Subject: [PATCH] Bug 34561: Move IntranetReportsHomeHTML to HTML customizations This patch moves the IntranetReportsHomeHTML system preference into HTML customizations, making it possible to have language- and library-specific content. To test you should have some content in the IntranetReportsHomeHTML system preference before applying the patch. Apply the patch and run the database update process. - In the staff client, go to Tools -> HTML customizations and verify that the content from IntranetReportsHomeHTML is now stored there. - The HTML customization entry form should offer IntranetReportsHomeHTML 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. - Edit the IntranetReportsHomeHTML HTML customization and add unique content to the "fr-FR" tab. - Go to the reports home page. You should see the content you added to the IntranetReportsHomeHTML HTML customization. - Switch to your updated translation and confirm that the content you added for your translation shows up correctly. - Go to Administration -> System preferences and search for "IntranetReportsHomeHTML." It should return no results. Sponsored-by: Athens County Public Libraries --- ...fReportsHomeHTML-to-additional-contents.pl | 40 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 - .../en/includes/html-customization-help.inc | 2 + .../admin/preferences/staff_interface.pref | 6 --- .../prog/en/modules/reports/reports-home.tt | 23 +++++++++-- .../en/modules/tools/additional-contents.tt | 2 +- 6 files changed, 63 insertions(+), 11 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug-34561-move-StaffReportsHomeHTML-to-additional-contents.pl diff --git a/installer/data/mysql/atomicupdate/bug-34561-move-StaffReportsHomeHTML-to-additional-contents.pl b/installer/data/mysql/atomicupdate/bug-34561-move-StaffReportsHomeHTML-to-additional-contents.pl new file mode 100755 index 00000000000..b7fac7ceb49 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug-34561-move-StaffReportsHomeHTML-to-additional-contents.pl @@ -0,0 +1,40 @@ +use Modern::Perl; + +return { + bug_number => "34563", + description => "Move StaffReportsHomeHTML to HTML customizations", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Get any existing value from the IntranetReportsHomeHTML system preference + my ($staffreportshomehtml) = $dbh->selectrow_array( + q| + SELECT value FROM systempreferences WHERE variable='IntranetReportsHomeHTML'; + | + ); + if ($staffreportshomehtml) { + + $dbh->do( + "INSERT INTO additional_contents ( category, code, location, branchcode, published_on ) VALUES ('html_customizations', 'StaffReportsHomeHTML', 'StaffReportsHomeHTML', NULL, CAST(NOW() AS date) )" + ); + + my ($insert_id) = $dbh->selectrow_array( + "SELECT id FROM additional_contents WHERE category = 'html_customizations' AND code = 'StaffReportsHomeHTML' AND location = 'StaffReportsHomeHTML' LIMIT 1", + {} + ); + + $dbh->do( + "INSERT INTO additional_contents_localizations ( additional_content_id, title, content, lang ) VALUES ( ?, 'StaffReportsHomeHTML default', ?, 'default' )", + undef, $insert_id, $staffreportshomehtml + ); + + say $out "Added 'StaffReportsHomeHTML' HTML customization"; + } + + # Remove old system preference + $dbh->do("DELETE FROM systempreferences WHERE variable='IntranetReportsHomeHTML'"); + say $out "Removed system preference 'IntranetReportsHomeHTML'"; + + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 09b8afd6fd8..ae669913951 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -357,7 +357,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('IntranetNumbersPreferPhrase','0',NULL,'Control the use of phr operator in callnumber and standard number staff interface searches','YesNo'), ('intranetreadinghistory','1','','If ON, Checkout history is enabled for all patrons','YesNo'), ('IntranetReadingHistoryHolds', 1, '', 'If ON, Holds history is enabled for all patrons','YesNo'), -('IntranetReportsHomeHTML', '', NULL, 'Show the following HTML in a div on the bottom of the reports home page', 'Free'), ('IntranetSlipPrinterJS','','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','Free'), ('intranetstylesheet','','50','Enter a complete URL to use an alternate layout stylesheet in Intranet','free'), ('IntranetUserCSS','',NULL,'Add CSS to be included in the intranet in an embedded