From 4d710d0f38c8a55b914142c98fc98b92a3ad416e 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 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 --- C4/UsageStats.pm | 1 - .../bug_19038_remove_opacshowbarcode_syspref.perl | 21 +++++++++++++++++++++ installer/data/mysql/sysprefs.sql | 1 - .../prog/en/modules/admin/preferences/opac.pref | 7 ------- .../opac-tmpl/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 d70ea3ec74..53a140a1bd 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -374,7 +374,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 7c822449d0..f771b55dc0 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: 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 choices: 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 6796552f4b..f27eaa87e1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1203,8 +1203,7 @@ [% IF ( itemdata_itemnotes ) %] Notes[% END %] Date due - [% IF ( OPACShowBarcode ) %] - Barcode[% END %] + Barcode [% IF holds_count.defined %] Item holds [% ELSIF show_priority %] @@ -1338,7 +1337,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 c400a487d9..4434af8ab1 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -461,7 +461,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 5f4dfadc02..752d42cce5 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.13.4