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 1641-1646 sub GetHiddenItemnumbers { Link Here
1641
        return ();
1642
        return ();
1642
    }
1643
    }
1643
    my $dbh = C4::Context->dbh;
1644
    my $dbh = C4::Context->dbh;
1645
    my $borrowernumber = 0;
1646
    my $homebranch = q{};
1647
    my $categorycode = q{};
1648
    if (C4::Context->userenv) {
1649
        $borrowernumber = C4::Context->userenv->{'number'} || 0;
1650
        $homebranch = C4::Context->userenv->{'branch'} || q{};
1651
    }
1652
    if ($borrowernumber) {
1653
        $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber) || q{};
1654
    }
1655
    my @SingleBranchCodes = split /\|/,C4::Context->preference('PatronSingleBranch');
1656
    my @EveryBranchCodes = split /\|/,C4::Context->preference('PatronEveryBranch');
1644
1657
1645
    # For each item
1658
    # For each item
1646
    foreach my $item (@items) {
1659
    foreach my $item (@items) {
Lines 1660-1667 sub GetHiddenItemnumbers { Link Here
1660
            # If the results matches the values in the yaml file
1673
            # If the results matches the values in the yaml file
1661
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1674
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1662
1675
1663
                # We add the itemnumber to the list
1676
                my $override = 0;
1664
                push @resultitems, $item->{'itemnumber'};
1677
                if ( ($homebranch eq $item->{'homebranch'} &&
1678
                      (any { /^$categorycode$/ } @SingleBranchCodes ) ) ||
1679
                     (any { /^$categorycode$/ } @EveryBranchCodes ) ) {
1680
                    $override = 1;
1681
                }
1682
                if ($override==0) {
1683
                    # We add the itemnumber to the hidden list
1684
                    push @resultitems, $item->{'itemnumber'};
1685
                }
1665
1686
1666
                # If at least one rule matched for an item, no need to test the others
1687
                # If at least one rule matched for an item, no need to test the others
1667
                last;
1688
                last;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 286-291 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
286
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
286
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
287
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
287
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
288
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
288
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
289
('PatronEveryBranch','','Pipe delimited patron category codes which allow viewing hidden items for every branch','',''),
289
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
290
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
290
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
291
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
291
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
292
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 294-299 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
294
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
295
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
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'),
296
('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'),
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
('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'),
298
('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''),
297
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
299
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
298
('Persona','0','','Use Mozilla Persona for login','YesNo'),
300
('Persona','0','','Use Mozilla Persona for login','YesNo'),
299
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
301
('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 7155-7160 if ( CheckVersion($DBversion) ) { Link Here
7155
    SetVersion($DBversion);
7155
    SetVersion($DBversion);
7156
}
7156
}
7157
7157
7158
$DBversion = "3.13.00.XXX";
7159
if ( CheckVersion($DBversion) ) {
7160
    $dbh->do(
7161
        q{
7162
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronEveryBranch','',"Pipe delimited patron category codes which allow viewing hidden items for every branch",'','');
7163
}
7164
    );
7165
    $dbh->do(
7166
        q{
7167
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",'','');
7168
}
7169
    );
7170
    print "Upgrade to $DBversion done (Bug filtering: Patron Category to override OPACHiddenItems)\n";
7171
    SetVersion($DBversion);
7172
}
7173
7174
7158
=head1 FUNCTIONS
7175
=head1 FUNCTIONS
7159
7176
7160
=head2 TableExists($table)
7177
=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