Bugzilla – Attachment 157597 Details for
Bug 33887
Automatic checkin should be able to optionally fill the next hold with the returned item
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33887: (QA follow-up) Perltidy and fix some formatting issues
Bug-33887-QA-follow-up-Perltidy-and-fix-some-forma.patch (text/plain), 8.74 KB, created by
Katrin Fischer
on 2023-10-21 09:07:59 UTC
(
hide
)
Description:
Bug 33887: (QA follow-up) Perltidy and fix some formatting issues
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-10-21 09:07:59 UTC
Size:
8.74 KB
patch
obsolete
>From 93bb89bcbbc17f27c8a0826d85720a252ec6b37c Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Sat, 21 Oct 2023 08:56:31 +0000 >Subject: [PATCH] Bug 33887: (QA follow-up) Perltidy and fix some formatting > issues > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > Koha/Checkouts.pm | 31 +++++++++++++------ > .../data/mysql/atomicupdate/bug_33887.pl | 14 ++++++--- > .../admin/preferences/circulation.pref | 2 +- > t/db_dependent/Koha/Checkouts.t | 22 +++++++------ > 4 files changed, 44 insertions(+), 25 deletions(-) > >diff --git a/Koha/Checkouts.pm b/Koha/Checkouts.pm >index 65cb7f0581..d083013026 100644 >--- a/Koha/Checkouts.pm >+++ b/Koha/Checkouts.pm >@@ -63,36 +63,46 @@ sub calculate_dropbox_date { > return $dropbox_date; > } > >+ > =head3 automatic_checkin > > my $automatic_checkins = Koha::Checkouts->automatic_checkin() > >-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. >+Checks in every due issue which itemtype has automatic_checkin enabled. Also if the AutoCheckinAutoFill system preference is enabled, the item is trapped for the next patron. > > =cut > > sub automatic_checkin { >- my ($self, $params) = @_; >+ my ( $self, $params ) = @_; > > my $current_date = dt_from_string; > >- my $dtf = Koha::Database->new->schema->storage->datetime_parser; >+ my $dtf = Koha::Database->new->schema->storage->datetime_parser; > my $due_checkouts = $self->search( > { date_due => { '<=' => $dtf->format_datetime($current_date) } }, >- { prefetch => 'item'} >+ { prefetch => 'item' } > ); > > my $autofill_next = C4::Context->preference('AutomaticCheckinAutoFill'); > > while ( my $checkout = $due_checkouts->next ) { > if ( $checkout->item->itemtype->automatic_checkin ) { >- my ( undef, $messages) = C4::Circulation::AddReturn($checkout->item->barcode, $checkout->branchcode, undef, dt_from_string($checkout->date_due) ); >- if ( $autofill_next ){ >- if ( $messages->{ResFound} ){ >+ my ( undef, $messages ) = C4::Circulation::AddReturn( >+ $checkout->item->barcode, $checkout->branchcode, undef, >+ dt_from_string( $checkout->date_due ) >+ ); >+ if ($autofill_next) { >+ if ( $messages->{ResFound} ) { > my $is_transfer = $checkout->branchcode ne $messages->{ResFound}->{branchcode}; >- 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"); >+ 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" >+ ); > } > } > } >@@ -100,6 +110,7 @@ sub automatic_checkin { > } > } > >+ > =head3 type > > =cut >diff --git a/installer/data/mysql/atomicupdate/bug_33887.pl b/installer/data/mysql/atomicupdate/bug_33887.pl >index 3ffd66537d..1a3f5f56ee 100755 >--- a/installer/data/mysql/atomicupdate/bug_33887.pl >+++ b/installer/data/mysql/atomicupdate/bug_33887.pl >@@ -1,14 +1,18 @@ > use Modern::Perl; > > return { >- bug_number => "33887", >+ bug_number => "33887", > description => "Automatically fill the next hold with a automatic check in.", >- up => sub { >+ up => sub { > my ($args) = @_; >- my ($dbh, $out) = @$args{qw(dbh out)}; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ > # Do you stuffs here >- $dbh->do(q{ >- INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AutomaticCheckinAutoFill', '0', NULL,'Automatically fill the next hold with an automatic checkin cronjob.', 'YesNo') }); >+ $dbh->do( >+ q{ >+ INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('AutomaticCheckinAutoFill', '0', NULL,'Automatically fill the next hold with an automatic checkin cronjob.', 'YesNo') } >+ ); >+ > # Print useful stuff here > # sysprefs > say $out "Added new system preference 'AutomaticCheckinAutoFill'"; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index d2079bf1ed..5cb207d3f0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -983,7 +983,7 @@ Circulation: > 1: "Allow" > 0: "Don't allow" > - holds to be automatically filled after being automatically checked in. >- - '<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/automatic_checkin.pl</code> cronjob. Ask your system administrator to schedule it.<br>' >+ - '<br><strong>NOTE:</strong> This system preference requires the <code>misc/cronjobs/automatic_checkin.pl</code> cronjob. Ask your system administrator to schedule it.' > Patron restrictions: > - > - pref: PatronRestrictionTypes >diff --git a/t/db_dependent/Koha/Checkouts.t b/t/db_dependent/Koha/Checkouts.t >index 1554b4d827..60c977acc7 100755 >--- a/t/db_dependent/Koha/Checkouts.t >+++ b/t/db_dependent/Koha/Checkouts.t >@@ -421,7 +421,8 @@ subtest 'automatic_checkin' => sub { > } > )->store; > >- my $patron_2 = $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $patron->branchcode} } ); >+ my $patron_2 = >+ $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $patron->branchcode } } ); > my $reserveid = AddReserve( > { > branchcode => $patron->branchcode, >@@ -431,12 +432,12 @@ subtest 'automatic_checkin' => sub { > } > ); > >- t::lib::Mocks::mock_preference('AutomaticCheckinAutoFill', '0'); >+ t::lib::Mocks::mock_preference( 'AutomaticCheckinAutoFill', '0' ); > > Koha::Checkouts->automatic_checkin; >- my $reserve = Koha::Holds->find( $reserveid ); >+ my $reserve = Koha::Holds->find($reserveid); > >- is( $reserve->found, undef, "Hold was not filled when AutomaticCheckinAutoFill disabled"); >+ is( $reserve->found, undef, "Hold was not filled when AutomaticCheckinAutoFill disabled" ); > > my $checkout_3_due_ac = Koha::Checkout->new( > { >@@ -446,12 +447,12 @@ subtest 'automatic_checkin' => sub { > date_due => $today > } > )->store; >- t::lib::Mocks::mock_preference('AutomaticCheckinAutoFill', '1'); >+ t::lib::Mocks::mock_preference( 'AutomaticCheckinAutoFill', '1' ); > > Koha::Checkouts->automatic_checkin; > $reserve->discard_changes; > >- is( $reserve->found, 'W', "Hold was filled when AutomaticCheckinAutoFill enabled"); >+ is( $reserve->found, 'W', "Hold was filled when AutomaticCheckinAutoFill enabled" ); > > my $checkout_2_odue_ac = Koha::Checkout->new( > { >@@ -461,7 +462,7 @@ subtest 'automatic_checkin' => sub { > date_due => $today > } > )->store; >- my $branch2 = $builder->build_object({ class=> "Koha::Libraries" }); >+ my $branch2 = $builder->build_object( { class => "Koha::Libraries" } ); > my $reserve2id = AddReserve( > { > branchcode => $branch2->branchcode, >@@ -472,8 +473,11 @@ subtest 'automatic_checkin' => sub { > ); > Koha::Checkouts->automatic_checkin; > >- my $reserve2 = Koha::Holds->find( $reserve2id ); >- is( $reserve2->found, 'T', "Hold was filled when AutomaticCheckinAutoFill enabled and transfer was initiated when branches didn't match"); >+ my $reserve2 = Koha::Holds->find($reserve2id); >+ is( >+ $reserve2->found, 'T', >+ "Hold was filled when AutomaticCheckinAutoFill enabled and transfer was initiated when branches didn't match" >+ ); > }; > > $schema->storage->txn_rollback; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33887
:
152279
|
152280
|
152385
|
152388
|
152391
|
152392
|
152494
|
154862
|
154863
|
154864
|
157594
|
157595
|
157596
| 157597