See bug 29823.
Created attachment 128364 [details] [review] Bug 29658: Fix crash on cancelling cancelled order Found this crash in our 20.11 logs: Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60. at /usr/share/perl/5.28/Carp.pm line 289 Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79 Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189 Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60 Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc. Test plan: Create a new basket and order. Open this same basket in two browser tabs. Cancel the order line (delete catalog record) in tab 1. Go to second tab, try again. Without this patch, it will crash. With this patch, an error message. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Hmm, this even opens up new possibilities like: Can't call method "edi_order" on an undefined value at /usr/share/koha/acqui/basket.pl line 381 Probably by trying to delete a deleted basket?
(In reply to Marcel de Rooy from comment #2) > Hmm, this even opens up new possibilities like: > > Can't call method "edi_order" on an undefined value at > /usr/share/koha/acqui/basket.pl line 381 > > Probably by trying to delete a deleted basket? Not sure about that. Cant exactly reproduce. Lets resolve that somewhere else..
Hi Marcel, I couldn't reproduce bug on master (devbox). When I follow test plan, I don't crash on cancelling order a second time. I checked data on aqorders table and saw that informations saved with the first cancel action are updated after the second cancel. I pass my turn on that patch, sorry :/
(In reply to Séverine Queune from comment #4) > Hi Marcel, > I couldn't reproduce bug on master (devbox). > When I follow test plan, I don't crash on cancelling order a second time. > I checked data on aqorders table and saw that informations saved with the > first cancel action are updated after the second cancel. > I pass my turn on that patch, sorry :/ To reproduce you need to add the order to a biblio with 0 items and click twice "Cancel order and delete catalog record".
I was able to reproduce using the tip from Joonas is comment #5 - in koha-testing-docker I added an order to the basket for record 5 (Perl best practices) as it has no items. However, the patch no longer applies 8-(.. git bz apply 29658 Bug 29658 - Crash on cancelling cancelled order 128364 - Bug 29658: Fix crash on cancelling cancelled order Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 29658: Fix crash on cancelling cancelled order Using index info to reconstruct a base tree... M acqui/cancelorder.pl M koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt Falling back to patching base and 3-way merge... Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/acqui/cancelorder.tt Auto-merging acqui/cancelorder.pl CONFLICT (content): Merge conflict in acqui/cancelorder.pl error: Failed to merge in the changes. Patch failed at 0001 Bug 29658: Fix crash on cancelling cancelled order
I’m not sure I understand what ‘cancelling a cancelled order’ actually means here. We are having a fiscal period close clean-up, and I too receive an internal server error when I try to delete a basket when all the orders on it have been cancelled and one or more (or all) of the biblios in the orders have been deleted. Is this the same thing as is being reported here, or should I raise a separate bug report? The error I see in our production Koha is simply ‘Internal server error’ but in our test Koha I see: ‘Cannot insert order: Mandatory parameter biblionumber is missing at /home/koha/kohaclone/acqui/basket.pl line 141’.
(In reply to Ray Delahunty from comment #7) > I’m not sure I understand what ‘cancelling a cancelled order’ actually means > here. We are having a fiscal period close clean-up, and I too receive an > internal server error when I try to delete a basket when all the orders on > it have been cancelled and one or more (or all) of the biblios in the orders > have been deleted. Is this the same thing as is being reported here, or > should I raise a separate bug report? The error I see in our production Koha > is simply ‘Internal server error’ but in our test Koha I see: ‘Cannot insert > order: Mandatory parameter biblionumber is missing at > /home/koha/kohaclone/acqui/basket.pl line 141’. I should still have a closer look to get this going again but at first sight I believe that we are talking about the same bug here.
Created attachment 139126 [details] [review] Bug 29658: Fix crash on cancelling cancelled order Found this crash in our 20.11 logs: Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60. at /usr/share/perl/5.28/Carp.pm line 289 Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79 Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189 Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60 Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc. Test plan: Create a new basket and order. Open this same basket in two browser tabs. Cancel the order line (delete catalog record) in tab 1. Go to second tab, try again. Without this patch, it will crash. With this patch, an error message. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
(In reply to Ray Delahunty from comment #7) > I’m not sure I understand what ‘cancelling a cancelled order’ actually means > here. We are having a fiscal period close clean-up, and I too receive an > internal server error when I try to delete a basket when all the orders on > it have been cancelled and one or more (or all) of the biblios in the orders > have been deleted. Is this the same thing as is being reported here, or > should I raise a separate bug report? The error I see in our production Koha > is simply ‘Internal server error’ but in our test Koha I see: ‘Cannot insert > order: Mandatory parameter biblionumber is missing at > /home/koha/kohaclone/acqui/basket.pl line 141’. Could you test the rebase please ?
I tested using a sandbox provisioned at 22.06 and have had no problems deleting baskets where the order has been cancelled and the biblio has been deleted. I tried routine workflow and also following the test plan. I did not receive any errors- the basket was just deleted without any fuss. When I run the same workflow in our 21.11 production system I receive the 'Internal server error' as before. I will ask that our support company apply the patch on our test server and will try again once that is done.
Created attachment 139930 [details] [review] Bug 29658: Fix crash on cancelling cancelled order Found this crash in our 20.11 logs: Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60. at /usr/share/perl/5.28/Carp.pm line 289 Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79 Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189 Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60 Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc. Test plan: Create a new basket and order. Open this same basket in two browser tabs. Cancel the order line (delete catalog record) in tab 1. Go to second tab, try again. Without this patch, it will crash. With this patch, an error message. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
(In reply to Joonas Kylmälä from comment #12) > Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Thx Joonas!
Created attachment 140472 [details] [review] Bug 29658: Fix crash on cancelling cancelled order Found this crash in our 20.11 logs: Cannot insert order: Mandatory parameter biblionumber is missing at /usr/share/koha/acqui/cancelorder.pl line 60. at /usr/share/perl/5.28/Carp.pm line 289 Carp::croak('Cannot insert order: Mandatory parameter biblionumber is missing') called at /usr/share/koha/Koha/Acquisition/Order.pm line 79 Koha::Acquisition::Order::store('Koha::Acquisition::Order=HASH(0x55f3760e2860)') called at /usr/share/koha/Koha/Acquisition/Order.pm line 189 Koha::Acquisition::Order::cancel('Koha::Acquisition::Order=HASH(0x55f3760e2860)', 'HASH(0x55f375a17ec0)') called at /usr/share/koha/acqui/cancelorder.pl line 60 Not sure how to reproduce this one as it happened. But might be related to repeated clicking, backspacing etc. Test plan: Create a new basket and order. Open this same basket in two browser tabs. Cancel the order line (delete catalog record) in tab 1. Go to second tab, try again. Without this patch, it will crash. With this patch, an error message. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Simple fix, no regressions. Passing QA
Pushed to master for 22.11. Nice work everyone, thanks!
(In reply to Martin Renvoize from comment #15) > Simple fix, no regressions. Passing QA Thanks. Even simple fixes can be long on the way ;)
Backported to 22.05.x for upcoming 22.05.07 release
applied to 21.11 for 21.11.14
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed. Nothing to document it seems, marking resolved.