Bugzilla – Attachment 76510 Details for
Bug 20271
Merge deleted biblio, biblioitems, biblio_metadata, and items tables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20271: (QA follow-up) Restore original GetItem functionality
Bug-20271-QA-follow-up-Restore-original-GetItem-fu.patch (text/plain), 3.00 KB, created by
Josef Moravec
on 2018-06-27 13:39:05 UTC
(
hide
)
Description:
Bug 20271: (QA follow-up) Restore original GetItem functionality
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-06-27 13:39:05 UTC
Size:
3.00 KB
patch
obsolete
>From d3a08b0d2048d06e948d5b51552a1decee04aa8f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 14 Jun 2018 11:41:53 +0100 >Subject: [PATCH] Bug 20271: (QA follow-up) Restore original GetItem > functionality > >The return value of GetItem had been changed (as it would now return >deleted items as well as current items). This patch restores the >original functionality (as we've not catered for all calls to GetItem >independantly), restores the original test as well as adding a further >test to catch the correct setting of deleted_on by DelItem > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > C4/Circulation.pm | 3 --- > C4/Items.pm | 3 +++ > t/db_dependent/Items.t | 6 ++++-- > 3 files changed, 7 insertions(+), 5 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ec2bd7d..8e1bdc4 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1806,9 +1806,6 @@ sub AddReturn { > unless ($item) { > return ( 0, { BadBarcode => $barcode } ); # no barcode means no item or borrower. bail out. > } >- if ($item->{deleted_on}) { >- return ( 0, { BadBarcode => $barcode } ); >- } > > my $itemnumber = $item->{ itemnumber }; > my $itemtype = $item->{itype}; # GetItem called effective_itemtype >diff --git a/C4/Items.pm b/C4/Items.pm >index f82191c..4df6bae 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -146,6 +146,8 @@ Return item information, for a given itemnumber or barcode. > The return value is a hashref mapping item column > names to values. If C<$serial> is true, include serial publication data. > >+This accessor will not return deleted items. >+ > =cut > > sub GetItem { >@@ -160,6 +162,7 @@ sub GetItem { > } > > return unless ( $item ); >+ return if ( $item->deleted_on ); > > my $data = $item->unblessed(); > $data->{itype} = $item->effective_itemtype(); # set the correct itype >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index c1d74c5..0e42d28 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -45,7 +45,7 @@ my $location = 'My Location'; > > subtest 'General Add, Get and Del tests' => sub { > >- plan tests => 16; >+ plan tests => 17; > > $schema->storage->txn_begin; > >@@ -80,8 +80,10 @@ subtest 'General Add, Get and Del tests' => sub { > > # Delete item. > DelItem({ biblionumber => $bibnum, itemnumber => $itemnumber }); >+ my $deletedItem = Koha::Items->find({ itemnumber => $itemnumber }); >+ isnt($deletedItem->deleted_on, undef, "Item marked deleted as expected."); > my $getdeleted = GetItem($itemnumber); >- isnt($getdeleted->{'deleted_on'}, undef, "Item deleted as expected."); >+ is($getdeleted->{'itemnumber'}, undef, "Item not returned by GetItem as expected."); > > ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, permanent_location => 'my permanent location', itype => $itemtype->{itemtype} } , $bibnum); > $getitem = GetItem($itemnumber); >-- >2.1.4
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 20271
:
72300
|
72799
|
72800
|
73091
|
73092
|
73093
|
73535
|
73536
|
73537
|
73538
|
73539
|
73540
|
73597
|
73759
|
73760
|
73761
|
73762
|
73763
|
73764
|
73765
|
74127
|
74128
|
74129
|
74130
|
74131
|
74132
|
74133
|
74134
|
74135
|
74136
|
74137
|
74138
|
74139
|
74140
|
74141
|
74142
|
74182
|
74183
|
74184
|
74185
|
74186
|
74187
|
74188
|
74189
|
74190
|
74223
|
74407
|
74408
|
74409
|
74410
|
74411
|
74412
|
74413
|
74414
|
74415
|
74416
|
75265
|
75347
|
75894
|
75897
|
75898
|
75899
|
75910
|
75977
|
75978
|
75979
|
75980
|
75981
|
75982
|
75983
|
75984
|
75985
|
75986
|
75987
|
75988
|
75989
|
75990
|
75991
|
75992
|
75993
|
76047
|
76048
|
76255
|
76256
|
76257
|
76258
|
76259
|
76260
|
76261
|
76262
|
76263
|
76264
|
76265
|
76266
|
76267
|
76268
|
76269
|
76270
|
76271
|
76272
|
76273
|
76274
|
76275
|
76276
|
76277
|
76493
|
76494
|
76495
|
76496
|
76497
|
76498
|
76499
|
76500
|
76501
|
76502
|
76503
|
76504
|
76505
|
76506
|
76507
|
76508
|
76509
|
76510
|
76511
|
76512
|
76513
|
76514