Bugzilla – Attachment 124176 Details for
Bug 22690
Merging records with many items too slow (Elasticsearch)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22690: Remove uneeded return and add no_triggers
Bug-22690-Remove-uneeded-return-and-add-notriggers.patch (text/plain), 4.10 KB, created by
Jonathan Druart
on 2021-08-27 12:37:07 UTC
(
hide
)
Description:
Bug 22690: Remove uneeded return and add no_triggers
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-08-27 12:37:07 UTC
Size:
4.10 KB
patch
obsolete
>From b397b1ac505b0788e4a79ef76348af65cc471fd0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 27 Aug 2021 14:34:00 +0200 >Subject: [PATCH] Bug 22690: Remove uneeded return and add no_triggers > >* C4/Items.pm > - Koha::Biblios not used > >* Koha/Item.pm > - Koha::Item->orders must return an empty set if no order attached > - no_triggers should be passed to other update calls > >* Item.t > - No need to build a fund > - Add new test to test Koha::Item->orders when no order attached >--- > C4/Items.pm | 1 - > Koha/Item.pm | 11 +++-------- > t/db_dependent/Koha/Item.t | 15 +++++---------- > 3 files changed, 8 insertions(+), 19 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index cc9ec54b790..7f83736ace6 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -64,7 +64,6 @@ use Koha::AuthorisedValues; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Database; > >-use Koha::Biblios; > use Koha::Biblioitems; > use Koha::Items; > use Koha::ItemTypes; >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 3419305019f..60d80a5c3eb 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1185,7 +1185,6 @@ sub orders { > my ( $self ) = @_; > > my $orders = $self->_result->item_orders; >- return unless $orders; > return Koha::Acquisition::Orders->_new_from_dbic($orders); > } > >@@ -1245,13 +1244,10 @@ sub move_to_biblio { > } > > # Acquisition orders >- my $orders = $self->orders; >- if ($orders) { >- $orders->update({ biblionumber => $to_biblionumber }, { no_triggers => 1 }); >- } >+ $self->orders->update({ biblionumber => $to_biblionumber }, { no_triggers => 1 }); > > # Holds >- $self->holds->update({ biblionumber => $to_biblionumber }); >+ $self->holds->update({ biblionumber => $to_biblionumber }, { no_triggers => 1 }); > > # hold_fill_target (there's no Koha object available yet) > my $hold_fill_target = $self->_result->hold_fill_target; >@@ -1271,8 +1267,7 @@ sub move_to_biblio { > ); > > # tracked_links >- my $tracked_links = $self->tracked_links; >- $tracked_links->update({ biblionumber => $to_biblionumber }); >+ $self->tracked_links->update({ biblionumber => $to_biblionumber }, { no_triggers => 1 }); > > return $to_biblionumber; > } >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 9260ca52820..e9cc993cd75 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -834,18 +834,15 @@ subtest 'get_transfers' => sub { > }; > > subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > > my $biblio = $builder->build_sample_biblio(); > my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >- my $aq_budget = $builder->build({ >- source => 'Aqbudget', >- value => { >- budget_notes => 'test', >- }, >- }); >+ >+ my $orders = $item->orders; >+ is ($orders->count, 0, 'No order on this item yet'); > > my $order_note = 'Order for ' . $item->itemnumber; > >@@ -853,7 +850,6 @@ subtest 'Tests for relationship between item and item_orders via aqorders_item' > class => 'Koha::Acquisition::Orders', > value => { > biblionumber => $biblio->biblionumber, >- budget_id => $aq_budget->{budget_id}, > order_internalnote => $order_note, > }, > }); >@@ -861,7 +857,6 @@ subtest 'Tests for relationship between item and item_orders via aqorders_item' > class => 'Koha::Acquisition::Orders', > value => { > biblionumber => $biblio->biblionumber, >- budget_id => $aq_budget->{budget_id}, > }, > }); > my $aq_order_item1 = $builder->build({ >@@ -872,7 +867,7 @@ subtest 'Tests for relationship between item and item_orders via aqorders_item' > }, > }); > >- my $orders = $item->orders; >+ $orders = $item->orders; > is ($orders->count, 1, 'One order found by item with the relationship'); > is ($orders->next->order_internalnote, $order_note, 'Correct order found by item with the relationship'); > }; >-- >2.25.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 22690
:
90061
|
90115
|
90116
|
92828
|
94505
|
97696
|
98143
|
98210
|
98211
|
99376
|
99379
|
100316
|
104796
|
104797
|
104871
|
105445
|
106144
|
108777
|
109694
|
110991
|
110994
|
111196
|
111207
|
111236
|
111237
|
112100
|
112184
|
112567
|
112569
|
112754
|
113308
|
113309
|
113941
|
113942
|
113967
|
113968
|
118226
|
118227
|
118229
|
118231
|
118391
|
119433
|
119434
|
120820
|
120821
|
120852
|
120853
|
121389
|
121392
|
121474
|
121516
|
121517
|
121518
|
121519
|
121520
|
122846
|
122847
|
122848
|
122849
|
122850
|
122886
|
122887
|
122888
|
122889
|
122890
|
122936
|
122938
|
122939
|
123029
|
123030
|
123031
|
123032
|
123033
|
123034
|
123035
|
123036
|
123037
|
123038
|
123039
|
123040
|
123041
|
123042
|
123044
|
123062
|
123481
|
123482
|
123483
|
123484
|
123485
|
123486
|
123487
|
123488
|
123489
|
123490
|
123491
|
123492
|
123493
|
123494
|
123495
|
123496
|
123497
| 124176 |
124188
|
124257