@@ -, +, @@ to the following: -1: 0 --- C4/Circulation.pm | 19 +++++++++++++++++++ installer/data/mysql/sysprefs.sql | 2 ++ installer/data/mysql/updatedatabase.pl | 7 +++++++ .../en/modules/admin/preferences/circulation.pref | 7 +++++++ 4 files changed, 35 insertions(+), 0 deletions(-) --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -1755,6 +1755,25 @@ sub AddReturn { my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not + my $yaml = C4::Context->preference('UpdateNotForLoanStatusOnCheckin'); + if ($yaml) { + $yaml = "$yaml\n\n"; # YAML is anal on ending \n. Surplus does not hurt + my $rules; + eval { $rules = YAML::Load($yaml); }; + if ($@) { + warn "Unable to parse UpdateNotForLoanStatusOnCheckin syspref : $@"; + } + else { + foreach my $key ( keys %$rules ) { + if ( $item->{notforloan} eq $key ) { + ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber ); + last; + } + } + } + } + + # check if the book is in a permanent collection.... # FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality. if ( $hbr ) { --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -396,7 +396,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('TrackClicks','0',NULL,'Track links clicked','Integer'), ('TransfersMaxDaysWarning','3',NULL,'Define the days before a transfer is suspected of having a problem','Integer'), ('TransferWhenCancelAllWaitingHolds','0',NULL,'Transfer items when cancelling all waiting holds','YesNo'), +('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free'), ('UNIMARCAuthorityField100','afrey50 ba0',NULL,'Define the contents of UNIMARC authority control field 100 position 08-35','Textarea'), +('UNIMARCAuthorityField100','afrey50 ba0',NULL,NULL,'Textarea'), ('UNIMARCAuthorsFacetsSeparator',', ',NULL,'UNIMARC authors facets separator','short'), ('UNIMARCField100Language','fre',NULL,'UNIMARC field 100 default language','short'), ('UniqueItemFields','barcode','','Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table','Free'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8012,6 +8012,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.00.XXX"; +if (CheckVersion($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free');"); + print "Upgrade to $DBversion done (Bug 11629 - Add ability to update not for loan status on checkin)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -351,6 +351,13 @@ Circulation: no: "Don't" - calculate and update overdue charges when an item is returned. -
NOTE If you are doing hourly loans then you should have this on. + - + - pref: UpdateNotForLoanStatusOnCheckin + type: textarea + class: code + - This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value + - "it will be updated to the right-hand value. E.g. '-1: 0' will cause an item that was set to 'Ordered' to now be available for loan." + - Each pair of values should be on a separate line. Holds Policy: - - pref: AllowHoldPolicyOverride --