From e711c8e41847ab57ef84660047535ff44f747f97 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Aug 2017 18:38:58 -0300 Subject: [PATCH] Bug 19038: Remove the OPACShowBarcode syspref MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch removes the OPACShowBarcode syspref in favour of the new columns settings option introduced by bug 16759. On the upgrade step, it picks the value for OPACShowBarcode and uses it to populate the columns_settings table. To test: - Verify the upgrade process maintains the current behaviour Regards Sponsored-by: Dover Followed test plan and works as expected. Functionality of patch from bug 16759 appears intact too. Signed-off-by: Dilan Johnpullé Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- C4/UsageStats.pm | 1 - ..._19038_remove_opacshowbarcode_syspref.perl | 21 +++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 - .../en/modules/admin/preferences/opac.pref | 7 ------- .../bootstrap/en/modules/opac-detail.tt | 5 ++--- opac/opac-detail.pl | 1 - t/db_dependent/UsageStats.t | 1 - 7 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_19038_remove_opacshowbarcode_syspref.perl diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 96e79fadbc..7524e05268 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -243,7 +243,6 @@ sub BuildReport { OpacMaintenance OpacPublic OpacSeparateHoldings - OPACShowBarcode OPACShowCheckoutName OpacShowFiltersPulldownMobile OPACShowHoldQueueDetails diff --git a/installer/data/mysql/atomicupdate/bug_19038_remove_opacshowbarcode_syspref.perl b/installer/data/mysql/atomicupdate/bug_19038_remove_opacshowbarcode_syspref.perl new file mode 100644 index 0000000000..5b76096df7 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19038_remove_opacshowbarcode_syspref.perl @@ -0,0 +1,21 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + my $hide_barcode = C4::Context->preference('OPACShowBarcode') ? 0 : 1; + + $dbh->do(q{ + DELETE FROM systempreferences + WHERE + variable='OPACShowBarcode' + }); + + # Configure column visibility if it isn't + $dbh->do(q{ + INSERT IGNORE INTO columns_settings + (module,page,tablename,columnname,cannot_be_toggled,is_hidden) + VALUES + ('opac','biblio-detail','holdingst','item_barcode',0,?) + }, undef, $hide_barcode); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 19038: Remove OPACShowBarcode syspref)\n"; +} \ No newline at end of file diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7e8b81a955..4647789316 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -378,7 +378,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('opacSerialDefaultTab','subscriptions','holdings|serialcollection|subscriptions','Define the default tab for serials in OPAC.','Choice'), ('OPACSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the OPAC','Integer'), ('OPACShelfBrowser','1','','Enable/disable Shelf Browser on item details page. WARNING: this feature is very resource consuming on collections with large numbers of items.','YesNo'), -('OPACShowBarcode','0','','Show items barcode in holding tab','YesNo'), ('OPACShowCheckoutName','0','','Displays in the OPAC the name of patron who has checked out the material. WARNING: Most sites should leave this off. It is intended for corporate or special sites which need to track who has the item.','YesNo'), ('OPACShowHoldQueueDetails','none','none|priority|holds|holds_priority','Show holds details in OPAC','Choice'), ('OpacShowRecentComments','0',NULL,'If ON a link to recent comments will appear in the OPAC masthead','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 63923d7985..d76c27b8ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -166,13 +166,6 @@ OPAC: yes: Show no: "Don't show" - a link to recent comments in the OPAC masthead. - - - - pref: OPACShowBarcode - default: 0 - choices: - yes: Show - no: "Don't show" - - the item's barcode on the holdings tab. - - pref: GoogleIndicTransliteration default: 0 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 1a2e4b56cc..eb857ecffb 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1201,8 +1201,7 @@ [% IF ( itemdata_itemnotes ) %] Notes[% END %] Date due - [% IF ( OPACShowBarcode ) %] - Barcode[% END %] + Barcode [% IF holds_count.defined %] Item holds [% ELSIF show_priority %] @@ -1336,7 +1335,7 @@ [% INCLUDE 'item-status-schema-org.inc' item = ITEM_RESULT %][% INCLUDE 'item-status.inc' item = ITEM_RESULT %] [% IF ( itemdata_itemnotes ) %][% ITEM_RESULT.itemnotes %][% END %] [% ITEM_RESULT.datedue | $KohaDates as_due_date => 1 %] - [% IF ( OPACShowBarcode ) %][% ITEM_RESULT.barcode %][% END %] + [% ITEM_RESULT.barcode %] [% IF holds_count.defined || show_priority %] [% IF holds_count.defined %] [% ITEM_RESULT.holds_count %] [% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 4a7e79a5e6..e68d8132d8 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -462,7 +462,6 @@ if ($session->param('busc')) { $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); -$template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") ); # adding items linked via host biblios diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index 532bea91bf..f778255cca 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -496,7 +496,6 @@ sub mocking_systempreferences_to_a_set_value { OpacMaintenance OpacPublic OpacSeparateHoldings - OPACShowBarcode OPACShowCheckoutName OpacShowFiltersPulldownMobile OPACShowHoldQueueDetails -- 2.39.5