Bugzilla – Attachment 99764 Details for
Bug 24759
OpacRenewalBranch code should be a Koha::Item method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24759: CleanUp OpacRenewalBranch values
Bug-24759-CleanUp-OpacRenewalBranch-values.patch (text/plain), 6.70 KB, created by
Nick Clemens (kidclamp)
on 2020-02-28 14:35:35 UTC
(
hide
)
Description:
Bug 24759: CleanUp OpacRenewalBranch values
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-02-28 14:35:35 UTC
Size:
6.70 KB
patch
obsolete
>From b3e9fd99de0861223b3d736cf04ba9c05a2415e2 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 28 Feb 2020 13:23:44 +0000 >Subject: [PATCH] Bug 24759: CleanUp OpacRenewalBranch values > >We had a unique behvaiour where the syspref was set to string 'NULL' >as opposed to undef, we need to clean that up > >To test: >1 - Set OpacRenewalBranch to 'NULL' in staff interface >2 - Renew via opac >3 - Check statistics to ensure branch is blank >--- > Koha/Item.pm | 7 ++----- > .../Bug_24759_cleanup_OpacRenewalBranch.perl | 16 ++++++++++++++++ > installer/data/mysql/sysprefs.sql | 2 +- > .../prog/en/modules/admin/preferences/opac.pref | 2 +- > t/db_dependent/Koha/Item.t | 10 +++------- > 5 files changed, 23 insertions(+), 14 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/Bug_24759_cleanup_OpacRenewalBranch.perl > >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 11866921ce..86361ee56b 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -504,7 +504,7 @@ sub renewalbranch { > my $branchcode; > if ( $interface eq 'opac' ){ > my $renewalbranch = C4::Context->preference('OpacRenewalBranch'); >- if( !defined $renewalbranch ){ >+ if( !defined $renewalbranch || $renewalbranch eq 'opacrenew' ){ > $branchcode = 'OPACRenew'; > } > elsif ( $renewalbranch eq 'itemhomebranch' ) { >@@ -516,11 +516,8 @@ sub renewalbranch { > elsif ( $renewalbranch eq 'checkoutbranch' ) { > $branchcode = $self->checkout->branchcode; > } >- elsif ( $renewalbranch eq 'NULL' ) { >- $branchcode = ''; >- } > else { >- $branchcode = 'OPACRenew'; >+ $branchcode = ""; > } > } else { > $branchcode = ( C4::Context->userenv && defined C4::Context->userenv->{branch} ) >diff --git a/installer/data/mysql/atomicupdate/Bug_24759_cleanup_OpacRenewalBranch.perl b/installer/data/mysql/atomicupdate/Bug_24759_cleanup_OpacRenewalBranch.perl >new file mode 100644 >index 0000000000..f447939027 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/Bug_24759_cleanup_OpacRenewalBranch.perl >@@ -0,0 +1,16 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ UPDATE systempreferences SET options = 'itemhomebranch|patronhomebranch|checkoutbranch|none' WHERE variable='OpacRenewalBranch' >+ }); >+ $dbh->do(q{ >+ UPDATE systempreferences SET value = "none" WHERE variable='OpacRenewalBranch' >+ AND value = 'NULL' >+ }); >+ $dbh->do(q{ >+ UPDATE systempreferences SET value = 'opacrenew' WHERE variable='OpacRenewalBranch' >+ AND value NOT IN ('checkoutbranch','itemhomebranch','opacrenew','patronhomebranch','none') >+ }); >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 24759 - cleanup OpacRenewalBranch)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index b565b7f0bf..5f0707b986 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -421,7 +421,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OpacPublic','1',NULL,'Turn on/off public OPAC','YesNo'), > ('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'), > ('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'), >-('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|null','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'), >+('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|none','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'), > ('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'), > ('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'), > ('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'), >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 9c9b2b7f00..f653396792 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 >@@ -618,7 +618,7 @@ OPAC: > itemhomebranch: "the item's home library" > patronhomebranch: "the patron's home library" > checkoutbranch: "the library the item was checked out from" >- null: "NULL" >+ none: "NULL" > opacrenew: "'OPACRenew'" > - as branchcode to store in the statistics table. > - >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 32364879b9..badca41b76 100644 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -355,17 +355,13 @@ subtest 'renewalbranch' => sub { > > C4::Context->interface( 'opac' ); > >- t::lib::Mocks::mock_preference('OpacRenewalBranch', ''); >- is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch blank, we get the OPACRenew"); >- is( $item->renewalbranch({branch=>'CHICKEN'}), 'OPACRenew', "If interface opac and OpacRenewalBranch blank, we get the OPACRenew even if branch passes"); >- > t::lib::Mocks::mock_preference('OpacRenewalBranch', undef); > is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew"); > is( $item->renewalbranch({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed"); > >- t::lib::Mocks::mock_preference('OpacRenewalBranch', 'NULL'); >- is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is string 'NULL', we get blank string"); >- is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is string 'NULL', we get blank string even if branch passed"); >+ t::lib::Mocks::mock_preference('OpacRenewalBranch', 'none'); >+ is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is none, we get blank string"); >+ is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed"); > > t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch'); > is( $item->renewalbranch, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout"); >-- >2.11.0
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 24759
:
99763
|
99764
|
99780
|
99953
|
100002
|
100003
|
101238
|
101239
|
101240
|
101241
|
101242
|
101243
|
101244
|
101245
|
101285
|
101286
|
101287
|
101288
|
101289
|
101290
|
101291