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' ) {
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} )
--- /dev/null
+$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";
+}
('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'),
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.
-
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");