View | Details | Raw Unified | Return to bug 24759
Collapse All | Expand All

(-)a/Koha/Item.pm (-5 / +2 lines)
Lines 504-510 sub renewalbranch { Link Here
504
    my $branchcode;
504
    my $branchcode;
505
    if ( $interface eq 'opac' ){
505
    if ( $interface eq 'opac' ){
506
        my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
506
        my $renewalbranch = C4::Context->preference('OpacRenewalBranch');
507
        if( !defined $renewalbranch ){
507
        if( !defined $renewalbranch || $renewalbranch eq 'opacrenew' ){
508
            $branchcode = 'OPACRenew';
508
            $branchcode = 'OPACRenew';
509
        }
509
        }
510
        elsif ( $renewalbranch eq 'itemhomebranch' ) {
510
        elsif ( $renewalbranch eq 'itemhomebranch' ) {
Lines 516-526 sub renewalbranch { Link Here
516
        elsif ( $renewalbranch eq 'checkoutbranch' ) {
516
        elsif ( $renewalbranch eq 'checkoutbranch' ) {
517
            $branchcode = $self->checkout->branchcode;
517
            $branchcode = $self->checkout->branchcode;
518
        }
518
        }
519
        elsif ( $renewalbranch eq 'NULL' ) {
520
            $branchcode = '';
521
        }
522
        else {
519
        else {
523
            $branchcode = 'OPACRenew';
520
            $branchcode = "";
524
        }
521
        }
525
    } else {
522
    } else {
526
        $branchcode = ( C4::Context->userenv && defined C4::Context->userenv->{branch} )
523
        $branchcode = ( C4::Context->userenv && defined C4::Context->userenv->{branch} )
(-)a/installer/data/mysql/atomicupdate/Bug_24759_cleanup_OpacRenewalBranch.perl (+16 lines)
Line 0 Link Here
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
3
    $dbh->do(q{
4
        UPDATE systempreferences SET options = 'itemhomebranch|patronhomebranch|checkoutbranch|none' WHERE variable='OpacRenewalBranch'
5
    });
6
    $dbh->do(q{
7
        UPDATE systempreferences SET value = "none" WHERE variable='OpacRenewalBranch'
8
        AND value = 'NULL'
9
    });
10
    $dbh->do(q{
11
        UPDATE systempreferences SET value = 'opacrenew' WHERE variable='OpacRenewalBranch'
12
        AND value NOT IN ('checkoutbranch','itemhomebranch','opacrenew','patronhomebranch','none')
13
    });
14
    SetVersion( $DBversion );
15
    print "Upgrade to $DBversion done (Bug 24759 - cleanup OpacRenewalBranch)\n";
16
}
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 424-430 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
424
('OpacPublic','1',NULL,'Turn on/off public OPAC','YesNo'),
424
('OpacPublic','1',NULL,'Turn on/off public OPAC','YesNo'),
425
('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'),
425
('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'),
426
('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'),
426
('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'),
427
('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|null','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'),
427
('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|none','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'),
428
('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'),
428
('OpacResetPassword','0','','Shows the ''Forgot your password?'' link in the OPAC','YesNo'),
429
('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'),
429
('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'),
430
('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'),
430
('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +1 lines)
Lines 618-624 OPAC: Link Here
618
                  itemhomebranch: "the item's home library"
618
                  itemhomebranch: "the item's home library"
619
                  patronhomebranch: "the patron's home library"
619
                  patronhomebranch: "the patron's home library"
620
                  checkoutbranch: "the library the item was checked out from"
620
                  checkoutbranch: "the library the item was checked out from"
621
                  null: "NULL"
621
                  none: "NULL"
622
                  opacrenew: "'OPACRenew'"
622
                  opacrenew: "'OPACRenew'"
623
            - as branchcode to store in the statistics table.
623
            - as branchcode to store in the statistics table.
624
        -
624
        -
(-)a/t/db_dependent/Koha/Item.t (-8 / +3 lines)
Lines 355-371 subtest 'renewalbranch' => sub { Link Here
355
355
356
    C4::Context->interface( 'opac' );
356
    C4::Context->interface( 'opac' );
357
357
358
    t::lib::Mocks::mock_preference('OpacRenewalBranch', '');
359
    is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch blank, we get the OPACRenew");
360
    is( $item->renewalbranch({branch=>'CHICKEN'}), 'OPACRenew', "If interface opac and OpacRenewalBranch blank, we get the OPACRenew even if branch passes");
361
362
    t::lib::Mocks::mock_preference('OpacRenewalBranch', undef);
358
    t::lib::Mocks::mock_preference('OpacRenewalBranch', undef);
363
    is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew");
359
    is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew");
364
    is( $item->renewalbranch({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed");
360
    is( $item->renewalbranch({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed");
365
361
366
    t::lib::Mocks::mock_preference('OpacRenewalBranch', 'NULL');
362
    t::lib::Mocks::mock_preference('OpacRenewalBranch', 'none');
367
    is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is string 'NULL', we get blank string");
363
    is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is none, we get blank string");
368
    is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is string 'NULL', we get blank string even if branch passed");
364
    is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed");
369
365
370
    t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch');
366
    t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch');
371
    is( $item->renewalbranch, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout");
367
    is( $item->renewalbranch, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout");
372
- 

Return to bug 24759