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

(-)a/C4/Items.pm (-3 / +23 lines)
Lines 35-41 use DateTime::Format::MySQL; Link Here
35
use Data::Dumper; # used as part of logging item record changes, not just for
35
use Data::Dumper; # used as part of logging item record changes, not just for
36
                  # debugging; so please don't remove this
36
                  # debugging; so please don't remove this
37
use Koha::DateUtils qw/dt_from_string/;
37
use Koha::DateUtils qw/dt_from_string/;
38
38
use C4::Members qw/GetBorrowerCategorycode/;
39
use vars qw($VERSION @ISA @EXPORT);
39
use vars qw($VERSION @ISA @EXPORT);
40
40
41
BEGIN {
41
BEGIN {
Lines 1697-1702 sub GetHiddenItemnumbers { Link Here
1697
        return ();
1697
        return ();
1698
    }
1698
    }
1699
    my $dbh = C4::Context->dbh;
1699
    my $dbh = C4::Context->dbh;
1700
    my $borrowernumber = 0;
1701
    my $homebranch = q{};
1702
    my $categorycode = q{};
1703
    if (C4::Context->userenv) {
1704
        $borrowernumber = C4::Context->userenv->{'number'} || 0;
1705
        $homebranch = C4::Context->userenv->{'branch'} || q{};
1706
    }
1707
    if ($borrowernumber) {
1708
        $categorycode = C4::Members::GetBorrowerCategorycode($borrowernumber) || q{};
1709
    }
1710
    my @SingleBranchCodes = split /\|/,C4::Context->preference('PatronSingleBranch');
1711
    my @EveryBranchCodes = split /\|/,C4::Context->preference('PatronEveryBranch');
1700
1712
1701
    # For each item
1713
    # For each item
1702
    foreach my $item (@items) {
1714
    foreach my $item (@items) {
Lines 1716-1723 sub GetHiddenItemnumbers { Link Here
1716
            # If the results matches the values in the yaml file
1728
            # If the results matches the values in the yaml file
1717
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1729
            if (any { $val eq $_ } @{$hidingrules->{$field}}) {
1718
1730
1719
                # We add the itemnumber to the list
1731
                my $override = 0;
1720
                push @resultitems, $item->{'itemnumber'};
1732
                if ( ($homebranch eq $item->{'homebranch'} &&
1733
                      (any { /^$categorycode$/ } @SingleBranchCodes ) ) ||
1734
                     (any { /^$categorycode$/ } @EveryBranchCodes ) ) {
1735
                    $override = 1;
1736
                }
1737
                if ($override==0) {
1738
                    # We add the itemnumber to the hidden list
1739
                    push @resultitems, $item->{'itemnumber'};
1740
                }
1721
1741
1722
                # If at least one rule matched for an item, no need to test the others
1742
                # If at least one rule matched for an item, no need to test the others
1723
                last;
1743
                last;
(-)a/installer/data/mysql/sysprefs.sql (+2 lines)
Lines 305-310 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
305
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
305
('OverDriveLibraryID','','Library ID for OverDrive integration','','Integer'),
306
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
306
('OverdueNoticeBcc','','','Email address to bcc outgoing overdue notices sent by email','free'),
307
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
307
('OverduesBlockCirc','noblock','noblock|confirmation|block','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','Choice'),
308
('PatronEveryBranch','','Pipe delimited patron category codes which allow viewing hidden items for every branch','',''),
308
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
309
('patronimages','0',NULL,'Enable patron images for the Staff Client','YesNo'),
309
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
310
('PatronSelfRegistration','0',NULL,'If enabled, patrons will be able to register themselves via the OPAC.','YesNo'),
310
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
311
('PatronSelfRegistrationAdditionalInstructions','','','A free text field to display additional instructions to newly self registered patrons.','free'),
Lines 313-318 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
313
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
314
('PatronSelfRegistrationDefaultCategory','','','A patron registered via the OPAC will receive a borrower category code set in this system preference.','free'),
314
('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'),
315
('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'),
315
('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'),
316
('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'),
317
('PatronSingleBranch','',"Pipe delimited patron category codes which allow viewing hidden items for only the patron's home branch",'',''),
316
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
318
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
317
('Persona','0','','Use Mozilla Persona for login','YesNo'),
319
('Persona','0','','Use Mozilla Persona for login','YesNo'),
318
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
320
('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 8603-8608 if ( CheckVersion($DBversion) ) { Link Here
8603
    SetVersion($DBversion);
8603
    SetVersion($DBversion);
8604
}
8604
}
8605
8605
8606
$DBversion = "3.13.00.XXX";
8607
if ( CheckVersion($DBversion) ) {
8608
    $dbh->do(
8609
        q{
8610
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('PatronEveryBranch','',"Pipe delimited patron category codes which allow viewing hidden items for every branch",'','');
8611
}
8612
    );
8613
    $dbh->do(
8614
        q{
8615
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",'','');
8616
}
8617
    );
8618
    print "Upgrade to $DBversion done (Bug filtering: Patron Category to override OPACHiddenItems)\n";
8619
    SetVersion($DBversion);
8620
}
8621
8606
=head1 FUNCTIONS
8622
=head1 FUNCTIONS
8607
8623
8608
=head2 TableExists($table)
8624
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +8 lines)
Lines 529-534 OPAC: Link Here
529
              class: code
529
              class: code
530
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations
530
            - Allows to define custom rules for hiding specific items at opac. See docs/opac/OpacHiddenItems.txt for more informations
531
        -
531
        -
532
            - pref: PatronSingleBranch
533
              class: short
534
            - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for their home branch only.
535
        -
536
            - pref: PatronEveryBranch
537
              class: short
538
            - Patrons matching one of these pipe delimited patron category codes override OpacHiddenItems for every branch.
539
        -
532
            - pref: OpacAllowPublicListCreation
540
            - pref: OpacAllowPublicListCreation
533
              default: 1
541
              default: 1
534
              choices:
542
              choices:
535
- 

Return to bug 10589