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

(-)a/C4/Items.pm (-2 / +23 lines)
Lines 33-38 use List::MoreUtils qw/any/; Link Here
33
use YAML qw/Load/;
33
use YAML qw/Load/;
34
use Data::Dumper; # used as part of logging item record changes, not just for
34
use Data::Dumper; # used as part of logging item record changes, not just for
35
                  # debugging; so please don't remove this
35
                  # debugging; so please don't remove this
36
use C4::Members qw/GetBorrowerCategorycode/;
36
37
37
use vars qw($VERSION @ISA @EXPORT);
38
use vars qw($VERSION @ISA @EXPORT);
38
39
Lines 1645-1650 sub GetHiddenItemnumbers { Link Here
1645
        return ();
1646
        return ();
1646
    }
1647
    }
1647
    my $dbh = C4::Context->dbh;
1648
    my $dbh = C4::Context->dbh;
1649
    my $borrowernumber = 0;
1650
    my $homebranch = q{};
1651
    my $categorycode = q{};
1652
    if (C4::Context->userenv) {
1653
        $borrowernumber = C4::Context->userenv->{'number'} || 0;
1654
        $homebranch = C4::Context->userenv->{'branch'} || q{};
1655
    }
1656
    if ($borrowernumber) {
1657
        $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber) || q{};
1658
    }
1659
    my @SingleBranchCodes = split /\|/,C4::Context->preference('PatronSingleBranch');
1660
    my @EveryBranchCodes = split /\|/,C4::Context->preference('PatronEveryBranch');
1648
1661
1649
    # For each item
1662
    # For each item
1650
    foreach my $item (@items) {
1663
    foreach my $item (@items) {
Lines 1664-1671 sub GetHiddenItemnumbers { Link Here
1664
            # If the results matches the values in the yaml file
1677
            # If the results matches the values in the yaml file
1665
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1678
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1666
1679
1667
                # We add the itemnumber to the list
1680
                my $override = 0;
1668
                push @resultitems, $item->{'itemnumber'};
1681
                if ( ($homebranch eq $item->{'homebranch'} &&
1682
                      (any { /^$categorycode$/ } @SingleBranchCodes ) ) ||
1683
                     (any { /^$categorycode$/ } @EveryBranchCodes ) ) {
1684
                    $override = 1;
1685
                }
1686
                if ($override==0) {
1687
                    # We add the itemnumber to the hidden list
1688
                    push @resultitems, $item->{'itemnumber'};
1689
                }
1669
1690
1670
                # If at least one rule matched for an item, no need to test the others
1691
                # If at least one rule matched for an item, no need to test the others
1671
                last;
1692
                last;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 288-293 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
288
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
288
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
289
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
289
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
290
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
290
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
291
('PatronEveryBranch','','Pipe delimited patron category codes which allow viewing hidden items for every branch','',''),
291
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
292
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
292
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
293
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
293
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
294
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 296-301 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
296
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
297
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
297
('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'),
298
('PatronSelfRegistrationExpireTemporaryAccountsDelay','0',NULL,'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.','Integer'),
298
('PatronSelfRegistrationVerifyByEmail','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.','YesNo'),
299
('PatronSelfRegistrationVerifyByEmail','0',NULL,'If enabled, any patron attempting to register themselves via the OPAC will be required to verify themselves via email to activate his or her account.','YesNo'),
300
('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''),
299
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
301
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
300
('Persona','0','','Use Mozilla Persona for login','YesNo'),
302
('Persona','0','','Use Mozilla Persona for login','YesNo'),
301
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
303
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+17 lines)
Lines 7636-7641 if ( CheckVersion($DBversion) ) { Link Here
7636
    SetVersion($DBversion);
7636
    SetVersion($DBversion);
7637
}
7637
}
7638
7638
7639
$DBversion = "3.13.00.XXX";
7640
if ( CheckVersion($DBversion) ) {
7641
    $dbh->do(
7642
        q{
7643
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronEveryBranch','',"Pipe delimited patron category codes which allow viewing hidden items for every branch",'','');
7644
}
7645
    );
7646
    $dbh->do(
7647
        q{
7648
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'','');
7649
}
7650
    );
7651
    print "Upgrade to $DBversion done (Bug filtering: Patron Category to override OPACHiddenItems)\n";
7652
    SetVersion($DBversion);
7653
}
7654
7655
7639
=head1 FUNCTIONS
7656
=head1 FUNCTIONS
7640
7657
7641
=head2 TableExists($table)
7658
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +8 lines)
Lines 497-502 OPAC: Link Here
497
              class: code
497
              class: code
498
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations
498
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations
499
        -
499
        -
500
            - pref: PatronSingleBranch
501
              class: short
502
            - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for their home branch only.
503
        -
504
            - pref: PatronEveryBranch
505
              class: short
506
            - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for every branch.
507
        -
500
            - pref: OpacAllowPublicListCreation
508
            - pref: OpacAllowPublicListCreation
501
              default: 1
509
              default: 1
502
              choices:
510
              choices:
503
- 

Return to bug 10589