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

(-)a/Koha/Checkouts.pm (-3 / +14 lines)
Lines 28-33 use Koha::DateUtils qw( dt_from_string ); Link Here
28
28
29
use base qw(Koha::Objects);
29
use base qw(Koha::Objects);
30
30
31
31
=head1 NAME
32
=head1 NAME
32
33
33
Koha::Checkouts - Koha Checkout object set class
34
Koha::Checkouts - Koha Checkout object set class
Lines 66-72 sub calculate_dropbox_date { Link Here
66
67
67
my $automatic_checkins = Koha::Checkouts->automatic_checkin()
68
my $automatic_checkins = Koha::Checkouts->automatic_checkin()
68
69
69
Checks in every due issue which itemtype has automatic_checkin enabled
70
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.
70
71
71
=cut
72
=cut
72
73
Lines 81-90 sub automatic_checkin { Link Here
81
        { prefetch => 'item'}
82
        { prefetch => 'item'}
82
    );
83
    );
83
84
85
    my $autofill_next = C4::Context->preference('AutomaticCheckinAutoFill');
86
84
    while ( my $checkout = $due_checkouts->next ) {
87
    while ( my $checkout = $due_checkouts->next ) {
85
        if ( $checkout->item->itemtype->automatic_checkin ) {
88
        if ( $checkout->item->itemtype->automatic_checkin ) {
86
            C4::Circulation::AddReturn( $checkout->item->barcode,
89
            my ( undef, $messages) = C4::Circulation::AddReturn($checkout->item->barcode, $checkout->branchcode, undef, dt_from_string($checkout->date_due) );
87
                $checkout->branchcode, undef, dt_from_string($checkout->date_due) );
90
            if ( $autofill_next ){
91
                if ( $messages->{ResFound} ){
92
                    my $is_transfer = $checkout->branchcode ne $messages->{ResFound}->{branchcode};
93
                    C4::Reserves::ModReserveAffect($checkout->item->itemnumber, $checkout->borrowernumber, $is_transfer, $messages->{ResFound}->{reserve_id}, $checkout->{desk_id}, 0);
94
                    if( $is_transfer ){
95
                        C4::Items::ModItemTransfer($checkout->item->itemnumber,$checkout->branchcode, $messages->{ResFound}->{branchcode},"Reserve");
96
                    }
97
                }
98
            }
88
        }
99
        }
89
    }
100
    }
90
}
101
}
(-)a/installer/data/mysql/atomicupdate/bug_33887.pl (+16 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "33887",
5
    description => "Automatically fill the next hold with a automatic check in.",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        # Do you stuffs here
10
        $dbh->do(q{
11
                INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AutomaticCheckinAutoFill', '0', NULL,'Automatically fill the next hold with an automatic checkin cronjob.', 'YesNo') });
12
        # Print useful stuff here
13
        # sysprefs
14
        say $out "Added new system preference 'AutomaticCheckinAutoFill'";
15
    },
16
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 82-87 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
82
('AutoEmailNewUser','0',NULL,'Send an email to newly created patrons.','YesNo'),
82
('AutoEmailNewUser','0',NULL,'Send an email to newly created patrons.','YesNo'),
83
('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'),
83
('AutoShareWithMana','subscription','','defines datas automatically shared with mana','multiple'),
84
('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'),
84
('AutoLocation','0',NULL,'If ON, IP authentication is enabled, blocking access to the staff interface from unauthorized IP addresses','YesNo'),
85
('AutomaticCheckinAutoFill','0',NULL,'Automatically fill the next hold with an automatic check in.','YesNo'),
85
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
86
('AutomaticItemReturn','1',NULL,'If ON, Koha will automatically set up a transfer of this item to its homebranch','YesNo'),
86
('AutoLinkBiblios','0',NULL,'If enabled, link biblio to authorities on creation and edit','YesNo'),
87
('AutoLinkBiblios','0',NULL,'If enabled, link biblio to authorities on creation and edit','YesNo'),
87
('AutomaticConfirmTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'),
88
('AutomaticConfirmTransfer','0',NULL,'Defines whether transfers should be automatically confirmed at checkin if modal dismissed','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-1 / +7 lines)
Lines 976-981 Circulation: Link Here
976
                  homebranch: "item's home library"
976
                  homebranch: "item's home library"
977
                  holdingbranch: "item's holding library"
977
                  holdingbranch: "item's holding library"
978
            - "."
978
            - "."
979
        -
980
            - pref: AutomaticCheckinAutoFill
981
              choices:
982
                  1: "Allow"
983
                  0: "Don't allow"
984
            - allow holds to be automatically filled after being automatically checked in.
985
            - '<br><strong>NOTE:</strong> These system preferences require the <code>misc/cronjobs/automatic_checkin.pl</code> cronjob. Ask your system administrator to schedule it.<br>'
979
    Patron restrictions:
986
    Patron restrictions:
980
        -
987
        -
981
            - pref: PatronRestrictionTypes
988
            - pref: PatronRestrictionTypes
982
- 

Return to bug 33887