Bugzilla – Attachment 107285 Details for
Bug 25261
Multiple parts handling - confirmation alert
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25261: (QA follow-up) Simplify tests and conditions
Bug-25261-QA-follow-up-Simplify-tests-and-conditio.patch (text/plain), 4.30 KB, created by
Jonathan Druart
on 2020-07-24 08:34:36 UTC
(
hide
)
Description:
Bug 25261: (QA follow-up) Simplify tests and conditions
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-07-24 08:34:36 UTC
Size:
4.30 KB
patch
obsolete
>From bdd6d47750f9c8c34fd9ba32a4e71e4779f6ab84 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 24 Jul 2020 10:33:26 +0200 >Subject: [PATCH] Bug 25261: (QA follow-up) Simplify tests and conditions > >Use build_sample_item in tests >Simplify tests for the confirmation >--- > C4/Circulation.pm | 8 ++++---- > circ/returns.pl | 12 +++++------- > t/db_dependent/Circulation.t | 35 ++++------------------------------- > 3 files changed, 13 insertions(+), 42 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index bee5520c88..cff4ca8503 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -844,10 +844,10 @@ sub CanBookBeIssued { > } > > # Additional Materials Check >- if ( C4::Context->preference("CircConfirmItemParts") ) { >- if ( $item_object->materials ) { >- $needsconfirmation{additional_materials} = $item_object->materials; >- } >+ if ( C4::Context->preference("CircConfirmItemParts") >+ && $item_object->materials ) >+ { >+ $needsconfirmation{additional_materials} = $item_object->materials; > } > > # >diff --git a/circ/returns.pl b/circ/returns.pl >index 7c7db6b166..0a2288aac3 100755 >--- a/circ/returns.pl >+++ b/circ/returns.pl >@@ -296,17 +296,15 @@ if ($barcode) { > my $return_date = $dropboxmode ? $dropboxdate : $return_date_override_dt; > > # Block return if multi-part and confirm has not been received >- my $needs_confirm = 0; >- if ( C4::Context->preference("CircConfirmItemParts") ) { >- if ( $item->materials && !$query->param('multiple_confirm') ) { >- $needs_confirm = 1; >- } >- } >+ my $needs_confirm = >+ C4::Context->preference("CircConfirmItemParts") >+ && $item->materials >+ && !$query->param('multiple_confirm'); > > # do the return > ( $returned, $messages, $issue, $borrower ) = > AddReturn( $barcode, $userenv_branch, $exemptfine, $return_date ) >- unless $needs_confirm; >+ unless $needs_confirm; > > if ($returned) { > my $time_now = dt_from_string()->truncate( to => 'minute'); >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index e8c28ca7ad..78ad56953b 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -3986,8 +3986,6 @@ subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { > > t::lib::Mocks::mock_preference('CircConfirmItemParts', 1); > >- my $library = >- $builder->build_object( { class => 'Koha::Libraries' } )->store; > my $patron = $builder->build_object( > { > class => 'Koha::Patrons', >@@ -3995,40 +3993,15 @@ subtest 'CanBookBeIssued & CircConfirmItemParts' => sub { > } > )->store; > >- my $itemtype = $builder->build_object( >- { >- class => 'Koha::ItemTypes', >- value => { >- notforloan => 0, >- rentalcharge => 0, >- rentalcharge_daily => 0 >- } >- } >- ); >- >- my $biblioitem = $builder->build( { source => 'Biblioitem' } ); >- my $item = $builder->build_object( >+ my $item = $builder->build_sample_item( > { >- class => 'Koha::Items', >- value => { >- homebranch => $library->id, >- holdingbranch => $library->id, >- notforloan => 0, >- itemlost => 0, >- withdrawn => 0, >- itype => $itemtype->id, >- biblionumber => $biblioitem->{biblionumber}, >- biblioitemnumber => $biblioitem->{biblioitemnumber}, >- materials => 'includes DVD', >- } >+ materials => 'includes DVD', > } > )->store; > >- my ( $issuingimpossible, $needsconfirmation ); >- my $dt_from = dt_from_string(); >- my $dt_due = $dt_from->clone->add( days => 3 ); >+ my $dt_due = dt_from_string->add( days => 3 ); > >- ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); >+ my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef ); > is_deeply( $needsconfirmation, { additional_materials => 'includes DVD' }, 'Item needs confirmation of additional parts' ); > }; > >-- >2.20.1
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 25261
:
103856
|
103857
|
104011
|
104012
|
104013
|
104404
|
104405
|
104406
|
104407
|
104408
|
104409
|
104410
|
104411
|
104412
|
104413
|
104414
|
107217
|
107218
|
107219
|
107220
|
107221
|
107222
|
107228
|
107229
|
107230
|
107231
|
107232
|
107233
|
107234
|
107285
|
107331
|
107822
|
107823
|
108196
|
108197
|
108198
|
108199
|
108200
|
108201
|
108202
|
108203
|
108204
|
108205
|
108206
|
108207
|
108208
|
108230
|
108231
|
108232
|
108233
|
108234
|
108235
|
108236
|
108237
|
108238
|
108239
|
108240
|
108241
|
108242
|
109478
|
109479
|
109480
|
109481
|
109482
|
109483
|
109484
|
109485
|
109486
|
109487
|
109488
|
109489
|
109490
|
109491
|
109492
|
109493
|
109494
|
109495
|
109496
|
109497
|
109498
|
109499
|
109500
|
109501
|
109502
|
109503
|
109504
|
109508
|
110038
|
110039
|
110040
|
110041
|
110042
|
110043
|
110044
|
110045
|
110046
|
110047
|
110048
|
110049
|
110050
|
110051
|
110052
|
110133
|
110184
|
110258
|
110259
|
110268
|
110322
|
110323
|
110324
|
110325
|
110326
|
110327
|
110328
|
110329
|
110330
|
110331
|
110332
|
110333
|
110334
|
110335
|
110336
|
110337
|
110338
|
110339
|
110340
|
110341
|
110356
|
110357
|
110358
|
110359
|
110360
|
110361
|
110362
|
110363
|
110364
|
110365
|
110366
|
110367
|
110368
|
110369
|
110370
|
110371
|
110372
|
110373
|
110374
|
110375
|
110915
|
110916
|
110917
|
110918
|
110919
|
110920
|
110921
|
110922
|
110923
|
110924
|
110925
|
110926
|
110927
|
110928
|
110929
|
110930
|
110931
|
110932
|
110933
|
110934
|
111027