Adding a system pref so you can stop users from reserving items that dont belong at their branch

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Chris Cormack 2007-11-13 21:07:45 -06:00 committed by Joshua Ferraro
parent f131e899fe
commit e30fb761ec
5 changed files with 28 additions and 4 deletions

View File

@ -75,8 +75,8 @@ my %tabsysprefs;
# Authorities
$tabsysprefs{authoritysep}="Authorities";
$tabsysprefs{AuthDisplayHierarchy}="Authorities";
$tabsysprefs{dontmerge}="Authorities";
$tabsysprefs{BiblioAddsAuthorities}="Authorities";
$tabsysprefs{dontmerge}="Authorities";
$tabsysprefs{BiblioAddsAuthorities}="Authorities";
# Catalogue
$tabsysprefs{advancedMARCEditor}="Catalogue";
$tabsysprefs{autoBarcode}="Catalogue";
@ -116,6 +116,7 @@ my %tabsysprefs;
$tabsysprefs{useDaysMode}="Circulation";
$tabsysprefs{ReservesNeedReturns}="Circulation";
$tabsysprefs{CircAutocompl}="Circulation";
$tabsysprefs{canreservefromotherbranches}="Circulation";
# Intranet
$tabsysprefs{TemplateEncoding}="Intranet";

View File

@ -114,3 +114,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('QueryFuzzy','1','If ON, enables fuzzy option for searches',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('QueryWeightFields','1','If ON, enables field weighting',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('yuipath','http://yui.yahooapis.com/2.3.1/build','Insert the path to YUI libraries',NULL,'free');
INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES ('canreservefromotherbranches','1','','With Independent branches on, can a user from one library reserve an item from another library','YesNo')"

View File

@ -661,6 +661,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
$DBversion = "3.00.00.028";
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
$dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type)
VALUES ('canreservefromotherbranches','1','','With Independent branches on, can a user from one library reserve an item from another library','YesNo')");
print "Upgrade to $DBversion done (adding new system preference for changing reserve/holds behaviour with independent branches)\n";
SetVersion ($DBversion);
}
=item DropAllForeignKeys($table)
Drop all foreign keys of the table $table

View File

@ -8,7 +8,7 @@
# and is automatically called by Auth.pm when needed.
sub kohaversion {
return "3.00.00.027";
return "3.00.00.028";
}
1;

View File

@ -317,13 +317,25 @@ foreach my $biblioitemnumber (@biblioitemnumbers) {
# If there is no loan, return and transfer, we show a checkbox.
$item->{notforloan} = $item->{notforloan} || 0;
# if independent branches is on we need to check if the person can reserve
# for branches they arent logged in to
if ( C4::Context->preference("IndependantBranches") ) {
if (! C4::Context->preference("canreservefromotherbranches")){
# cant reserve items so need to check if item homebranch and userenv branch match if not we cant reserve
my $userenv = C4::Context->userenv;
if ( ($userenv) && ( $userenv->{flags} != 1 ) ) {
$item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
}
}
}
# An item is available only if:
if (
not defined $reservedate # not reserved yet
and $issues->{'date_due'} eq '' # not currently on loan
and not $item->{itemlost} # not lost
and not $item->{notforloan} # not forbidden to loan
and not $item->{cantreserve}
and $transfertwhen eq '' # not currently on transfert
)
{