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

(-)a/C4/Items.pm (-2 / +23 lines)
Lines 32-37 use C4::Log; Link Here
32
use List::MoreUtils qw/any/;
32
use List::MoreUtils qw/any/;
33
use Data::Dumper; # used as part of logging item record changes, not just for
33
use Data::Dumper; # used as part of logging item record changes, not just for
34
                  # debugging; so please don't remove this
34
                  # debugging; so please don't remove this
35
use C4::Members qw/GetBorrowerCategorycode/;
35
36
36
use vars qw($VERSION @ISA @EXPORT);
37
use vars qw($VERSION @ISA @EXPORT);
37
38
Lines 1639-1644 sub GetHiddenItemnumbers { Link Here
1639
        return ();
1640
        return ();
1640
    }
1641
    }
1641
    my $dbh = C4::Context->dbh;
1642
    my $dbh = C4::Context->dbh;
1643
    my $borrowernumber = 0;
1644
    my $homebranch = q{};
1645
    my $categorycode = q{};
1646
    if (C4::Context->userenv) {
1647
        $borrowernumber = C4::Context->userenv->{'number'} || 0;
1648
        $homebranch = C4::Context->userenv->{'branch'} || q{};
1649
    }
1650
    if ($borrowernumber) {
1651
        $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber) || q{};
1652
    }
1653
    my @SingleBranchCodes = split /\|/,C4::Context->preference('PatronSingleBranch');
1654
    my @EveryBranchCodes = split /\|/,C4::Context->preference('PatronEveryBranch');
1642
1655
1643
    # For each item
1656
    # For each item
1644
    foreach my $item (@items) {
1657
    foreach my $item (@items) {
Lines 1658-1665 sub GetHiddenItemnumbers { Link Here
1658
            # If the results matches the values in the yaml file
1671
            # If the results matches the values in the yaml file
1659
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1672
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1660
1673
1661
                # We add the itemnumber to the list
1674
                my $override = 0;
1662
                push @resultitems, $item->{'itemnumber'};
1675
                if ( ($homebranch eq $item->{'homebranch'} &&
1676
                      (any { /^$categorycode$/ } @SingleBranchCodes ) ) ||
1677
                     (any { /^$categorycode$/ } @EveryBranchCodes ) ) {
1678
                    $override = 1;
1679
                }
1680
                if ($override==0) {
1681
                    # We add the itemnumber to the hidden list
1682
                    push @resultitems, $item->{'itemnumber'};
1683
                }
1663
1684
1664
                # If at least one rule matched for an item, no need to test the others
1685
                # If at least one rule matched for an item, no need to test the others
1665
                last;
1686
                last;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 285-290 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
285
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
285
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
286
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
286
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
287
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
287
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
288
('PatronEveryBranch','','Pipe delimited patron category codes which allow viewing hidden items for every branch','',''),
288
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
289
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
289
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
290
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
290
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
291
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 293-298 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
293
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
294
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
294
('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'),
295
('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'),
295
('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'),
296
('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'),
297
('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''),
296
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
298
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
297
('Persona','0','','Use Mozilla Persona for login','YesNo'),
299
('Persona','0','','Use Mozilla Persona for login','YesNo'),
298
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
300
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
(-)a/installer/data/mysql/updatedatabase.pl (+16 lines)
Lines 7104-7109 if ( CheckVersion($DBversion) ) { Link Here
7104
    SetVersion($DBversion);
7104
    SetVersion($DBversion);
7105
}
7105
}
7106
7106
7107
$DBversion = "3.13.00.XXX";
7108
if ( CheckVersion($DBversion) ) {
7109
    $dbh->do(
7110
        q{
7111
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronEveryBranch','',"Pipe delimited patron category codes which allow viewing hidden items for every branch",'','');
7112
}
7113
    );
7114
    $dbh->do(
7115
        q{
7116
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",'','');
7117
}
7118
    );
7119
    print "Upgrade to $DBversion done (Bug filtering: Patron Category to override OPACHiddenItems)\n";
7120
    SetVersion($DBversion);
7121
}
7122
7107
=head1 FUNCTIONS
7123
=head1 FUNCTIONS
7108
7124
7109
=head2 TableExists($table)
7125
=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