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

(-)a/C4/Reserves.pm (+7 lines)
Lines 470-475 sub CanItemBeReserved{ Link Here
470
    # item->{itype} will come for biblioitems if necessery
470
    # item->{itype} will come for biblioitems if necessery
471
    my $item = GetItem($itemnumber);
471
    my $item = GetItem($itemnumber);
472
472
473
    if ((my $PreventHolds = C4::Context->preference('PreventItemHoldsFieldvalues'))) {
474
        foreach my $part (split(/\|/, $PreventHolds)) {
475
            my ($field, $val) = split(/=/, $part);
476
            return 0 if (defined $item->{$field} && $item->{$field} eq $val);
477
        }
478
    }
479
473
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
480
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
474
    return 0 if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') );
481
    return 0 if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') );
475
482
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 317-322 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
317
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
317
('PatronsPerPage','20','20','Number of Patrons Per Page displayed by default','Integer'),
318
('Persona','0','','Use Mozilla Persona for login','YesNo'),
318
('Persona','0','','Use Mozilla Persona for login','YesNo'),
319
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
319
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
320
('PreventItemHoldsFieldvalues', '', NULL, 'This is a pipe-delimited list of \"fieldname=value\", where fieldname is one of the fields from items -table in the database. If the field has the exact value, the item cannot be reserved. For example, \"ccode=PILA|location=OHE\" would prevent reserving the item if it\'s collection code is \'PILA\' or if it\'s location is \'OHE\'.', 'free')
320
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
321
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
321
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
322
('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'),
322
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
323
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
(-)a/installer/data/mysql/updatedatabase.pl (+7 lines)
Lines 8551-8556 if (CheckVersion($DBversion)) { Link Here
8551
    SetVersion($DBversion);
8551
    SetVersion($DBversion);
8552
}
8552
}
8553
8553
8554
$DBversion = "3.17.00.XXX";
8555
if (CheckVersion($DBversion)) {
8556
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('PreventItemHoldsFieldvalues', '', NULL, 'This is a pipe-delimited list of \"fieldname=value\", where fieldname is one of the fields from items -table in the database. If the field has the exact value, the item cannot be reserved. For example, \"ccode=PILA|location=OHE\" would prevent reserving the item if it''s collection code is ''PILA'' or if it''s location is ''OHE''.', 'free');");
8557
    print "Upgrade to $DBversion done (Bug 12354 - Prevent reserving items based on item field values)\n";
8558
    SetVersion($DBversion);
8559
}
8560
8554
=head1 FUNCTIONS
8561
=head1 FUNCTIONS
8555
8562
8556
=head2 TableExists($table)
8563
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (-1 / +5 lines)
Lines 386-391 OPAC: Link Here
386
                  no: "Don't allow"
386
                  no: "Don't allow"
387
            - patrons to access a list of the most checked out items on the OPAC. Note that this is somewhat experimental, and should be avoided if your collection has a large number of items.
387
            - patrons to access a list of the most checked out items on the OPAC. Note that this is somewhat experimental, and should be avoided if your collection has a large number of items.
388
        -
388
        -
389
            - Prevent reserving items with the following field values:
390
            - pref: PreventItemHoldsFieldvalues
391
            - . This is a pipe-delimited list of "fieldname=value", where fieldname is one of the fields from items -table in the database. If the field has the exact value, the item cannot be reserved.
392
            - For example, "ccode=PILA|location=OHE" would prevent reserving the item if it's collection code is 'PILA' or if it's location is 'OHE'.
393
        -
389
            - pref: suggestion
394
            - pref: suggestion
390
              choices:
395
              choices:
391
                  yes: Allow
396
                  yes: Allow
392
- 

Return to bug 12354