Description
Frédéric Demians
2020-11-10 15:59:12 UTC
Created attachment 113417 [details] [review] Bug 26992 - On serial collection page, impossible to delete issues and related items serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolte. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Created attachment 113582 [details] [review] Bug 26992 - On serial collection page, impossible to delete issues and related items serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolte. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Signed-off-by: Blou <blou@inlibro.com> This functionality crashes without this patch. Not sure how it got this far (probably not used much), but this should be fixed for 20.11 Created attachment 113599 [details] [review] Bug 26992: Fix serial issue and related items deletion on serial collection page serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Signed-off-by: Blou <blou@inlibro.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Why not using find? for my $itemnumber (@itemnumbers) { my $items = Koha::Items->search({ itemnumber => $itemnumber }); while ( my $item = $items->next ) { my $deleted_item = eval { $item->safe_delete }; vs for my $itemnumber (@itemnumbers) { my $item = Koha::Items->find( $itemnumber ); my $deleted_item = eval { $item->safe_delete }; or, even my $items = Koha::Items->search({ itemnumber => \@itemnumbers }); while ( my $item = $items->next ) { my $deleted_item = eval { $item->safe_delete }; > my $items = Koha::Items->search({ itemnumber => \@itemnumbers });
> while ( my $item = $items->next ) {
> my $deleted_item = eval { $item->safe_delete };
Yes, it's better.
Created attachment 113661 [details] [review] Bug 26992 - On serial collection page, impossible to delete issues and related items serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolte. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Sorry, I had to reverse to "Needs Signoff" Created attachment 113681 [details] [review] Bug 26992 - On serial collection page, impossible to delete issues and related items serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolte. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Signed-off-by: David Nind <david@davidnind.com> The commit title needs to tell what the commit does, not what the bug is (<https://wiki.koha-community.org/wiki/Commit_messages#Examples>). Also the formatting is not right, so something like Bug 26992: Fix broken issues deletion on serial collection page would be better. Then I'm also wondering why there needs to be eval here: > my $deleted_item = eval { $item->safe_delete }; > Then I'm also wondering why there needs to be eval here: > > my $deleted_item = eval { $item->safe_delete }; I copy-paste this from somewhere, I don't recall where... It seems from the Koha::Item module, and usage from other scripts, that the canonical form should be now: my $error = $item->safe_delete; if ($error eq 1) { # not deleted I will re-factorize the patch appropriately. Thanks. Created attachment 113694 [details] [review] Bug 26992 - Fix serial issue and related items deletion on serial collection page serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. To David Nind: very sorry for having to resubmit and clear your signoff. Thanks, one more thing: please use the "Bug XXX: syntax" instead of "Bug XXX -" Created attachment 113703 [details] [review] Bug 26992: Fix serial issue and related items deletion on serial collection page serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Thanks Joonas and Jonathan. (In reply to Frédéric Demians from comment #13) > To David Nind: very sorry for having to resubmit and clear your signoff. No problem! Sign off on the way. Created attachment 113753 [details] [review] Bug 26992: Fix serial issue and related items deletion on serial collection page serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Signed-off-by: David Nind <david@davidnind.com> Created attachment 113815 [details] [review] Bug 26992: Fix serial issue and related items deletion on serial collection page serial-collection.pl uses C4::Items::DelItemCheck() function which is obsolete. Test plan: 1. Create a subscription with items created when receiving. 2. Receive several issues, and create corresponding items. 3. On Serial collection page (serial-collection.pl), select several issues. 4. Click on button Delete selected issues 5. A confirmation page is displayed. Enable "Delete associated items?". Then click on "Yes, delete" button. You get this error: Undefined subroutine &C4::Items::DelItemCheck 6. Apply the patch an repeat steps 3-5. Check that issues and related items are deleted. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Pushed to master for 20.11, thanks to everybody involved! Pushed to 20.05.x for 20.05.07 Missing dependencies for 19.11.x, shouldn't affect it then. |