@@ -, +, @@ when an item is automatically checked in. --- Koha/Checkouts.pm | 17 ++++++++++++++--- installer/data/mysql/atomicupdate/skeleton.pl | 18 +++++------------- installer/data/mysql/mandatory/sysprefs.sql | 1 + .../modules/admin/preferences/circulation.pref | 7 +++++++ 4 files changed, 27 insertions(+), 16 deletions(-) --- a/Koha/Checkouts.pm +++ a/Koha/Checkouts.pm @@ -28,6 +28,7 @@ use Koha::DateUtils qw( dt_from_string ); use base qw(Koha::Objects); + =head1 NAME Koha::Checkouts - Koha Checkout object set class @@ -66,7 +67,7 @@ sub calculate_dropbox_date { my $automatic_checkins = Koha::Checkouts->automatic_checkin() -Checks in every due issue which itemtype has automatic_checkin enabled +Checks in every due issue which itemtype has automatic_checkin enabled. Also if the AutoCheckinAutoFill sys. pref. is enabled, the item is trapped for the next patron. =cut @@ -81,10 +82,20 @@ sub automatic_checkin { { prefetch => 'item'} ); + my $autofill_next = C4::Context->preference('AutoCheckinAutoFill'); + while ( my $checkout = $due_checkouts->next ) { if ( $checkout->item->itemtype->automatic_checkin ) { - C4::Circulation::AddReturn( $checkout->item->barcode, - $checkout->branchcode, undef, dt_from_string($checkout->date_due) ); + my ( undef, $messages) = C4::Circulation::AddReturn($checkout->item->barcode, $checkout->branchcode, undef, dt_from_string($checkout->date_due) ); + my $is_transfer = $checkout->branchcode ne $messages->{ResFound}->{branchcode}; + if ( $autofill_next ){ + if ( $messages->{ResFound} ){ + C4::Reserves::ModReserveAffect($checkout->item->itemnumber, $checkout->borrowernumber, $is_transfer, $messages->{ResFound}->{reserve_id}, $checkout->{desk_id}, 0); + if( $is_transfer ){ + C4::Items::ModItemTransfer($checkout->item->itemnumber,$checkout->branchcode, $messages->{ResFound}->{branchcode},"Reserve"); + } + } + } } } } --- a/installer/data/mysql/atomicupdate/skeleton.pl +++ a/installer/data/mysql/atomicupdate/skeleton.pl @@ -1,24 +1,16 @@ use Modern::Perl; return { - bug_number => "BUG_NUMBER", - description => "A single line description", + bug_number => "33887", + description => "Automatically fill the next hold with a automatic check in.", up => sub { my ($args) = @_; my ($dbh, $out) = @$args{qw(dbh out)}; # Do you stuffs here - $dbh->do(q{}); + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AutoCheckinAutoFill', '0', NULL,'Automatically fill the next hold with an automatic checkin cronjob.', 'YesNo'}); # Print useful stuff here - # tables - say $out "Added new table 'XXX'"; - say $out "Added column 'XXX.YYY'"; # sysprefs - say $out "Added new system preference 'XXX'"; - say $out "Updated system preference 'XXX'"; - say $out "Removed system preference 'XXX'"; - # permissions - say $out "Added new permission 'XXX'"; - # letters - say $out "Added new letter 'XXX' (TRANSPORT)"; + say $out "Added new system preference 'AutoCheckinAutoFill'"; }, }; --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -77,6 +77,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('AuthorityXSLTResultsDisplay','','','Enable XSL stylesheet control over authority results page display on intranet','Free'), ('AuthSuccessLog','0',NULL,'If enabled, log successful authentications','YesNo'), ('autoBarcode','OFF','incremental|annual|hbyymmincr|EAN13|OFF','Used to autogenerate a barcode: incremental will be of the form 1, 2, 3; annual of the form 2007-0001, 2007-0002; hbyymmincr of the form HB08010001 where HB=Home Branch','Choice'), +('AutoCheckinAutoFill','0',NULL,'Automatically fill the next hold with an automatic check in.','YesNo'), ('autoControlNumber','OFF','biblionumber|OFF','Used to autogenerate a Control Number: biblionumber will be as biblionumber, OFF will leave the field as it is;','Choice'), ('AutoCreateAuthorities','0',NULL,'Automatically create authorities that do not exist when cataloging records.','YesNo'), ('AutoCreditNumber', '', '', 'Automatically generate a number for account credits', 'Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -977,6 +977,12 @@ Circulation: homebranch: "item's home library" holdingbranch: "item's holding library" - "." + - + - pref: AutoCheckinAutoFill + choices: + 1: "Do" + 0: "Don't" + - allow holds to be automatically filled after being automatically checked in. Patron restrictions: - - pref: PatronRestrictionTypes @@ -1364,3 +1370,4 @@ Circulation: 1: Enable 0: Disable - "the curbside pickup module." + --