(bug #2893) Allow loan forcing if a syspref is set
If the syspref 'AllowNotForLoanOverride'(YESNO) is set to YES, the librarian is able to force a loan on an item set as "not for loan". If the item is not for loan and the syspref is set to YES, koha will ask to the librarian if he really want to check-out it, else do nothing. Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
parent
6be431d79e
commit
43e4976806
4 changed files with 31 additions and 17 deletions
|
@ -734,27 +734,32 @@ sub CanBookBeIssued {
|
|||
unless ( $item->{barcode} ) {
|
||||
$issuingimpossible{UNKNOWN_BARCODE} = 1;
|
||||
}
|
||||
|
||||
if ( $item->{'notforloan'}
|
||||
&& $item->{'notforloan'} > 0 )
|
||||
{
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
if(!C4::Context->preference("AllowNotForLoanOverride")){
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
}else{
|
||||
$needsconfirmation{NOT_FOR_LOAN_FORCING} = 1;
|
||||
}
|
||||
}
|
||||
elsif ( !$item->{'notforloan'} ){
|
||||
# we have to check itemtypes.notforloan also
|
||||
if (C4::Context->preference('item-level_itypes')){
|
||||
# this should probably be a subroutine
|
||||
my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?");
|
||||
$sth->execute($item->{'itemtype'});
|
||||
my $notforloan=$sth->fetchrow_hashref();
|
||||
$sth->finish();
|
||||
if ($notforloan->{'notforloan'} == 1){
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
}
|
||||
}
|
||||
elsif ($biblioitem->{'notforloan'} == 1){
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
}
|
||||
}
|
||||
elsif ( !$item->{'notforloan'} ){
|
||||
# we have to check itemtypes.notforloan also
|
||||
if (C4::Context->preference('item-level_itypes')){
|
||||
# this should probably be a subroutine
|
||||
my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?");
|
||||
$sth->execute($item->{'itemtype'});
|
||||
my $notforloan=$sth->fetchrow_hashref();
|
||||
$sth->finish();
|
||||
if ($notforloan->{'notforloan'} == 1){
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
}
|
||||
}
|
||||
elsif ($biblioitem->{'notforloan'} == 1){
|
||||
$issuingimpossible{NOT_FOR_LOAN} = 1;
|
||||
}
|
||||
}
|
||||
if ( $item->{'wthdrawn'} && $item->{'wthdrawn'} == 1 )
|
||||
{
|
||||
$issuingimpossible{WTHDRAWN} = 1;
|
||||
|
|
|
@ -239,3 +239,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
|
|||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesID','','See:http://librarything.com/forlibraries/','','free');
|
||||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesEnabled','0','Enable or Disable Library Thing for Libraries Features','','YesNo');
|
||||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesTabbedView','0','Put LibraryThingForLibraries Content in Tabs.','','YesNo');
|
||||
INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'AllowNotForLoanOverride', '0', '', 'If ON, Koha will allow the librarian to loan a not for loan item.', 'YesNo');
|
||||
|
|
|
@ -241,3 +241,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
|
|||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesID','','See:http://librarything.com/forlibraries/','','free');
|
||||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesEnabled','0','Enable or Disable Library Thing for Libraries Features','','YesNo');
|
||||
INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('LibraryThingForLibrariesTabbedView','0','Put LibraryThingForLibraries Content in Tabs.','','YesNo');
|
||||
INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'AllowNotForLoanOverride', '0', '', 'If ON, Koha will allow the librarian to loan a not for loan item.', 'YesNo');
|
||||
|
|
|
@ -2389,6 +2389,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
|||
SetVersion ($DBversion);
|
||||
}
|
||||
|
||||
$DBversion = "3.01.00.015";
|
||||
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
|
||||
$dbh->do("INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'AllowNotForLoanOverride', '0', '', 'If ON, Koha will allow the librarian to loan a not for loan item.', 'YesNo')");
|
||||
print "Upgrade to $DBversion done (added AllowNotForLoanOverride system preference)\n";
|
||||
SetVersion ($DBversion);
|
||||
}
|
||||
|
||||
=item DropAllForeignKeys($table)
|
||||
|
||||
Drop all foreign keys of the table $table
|
||||
|
|
Loading…
Reference in a new issue