[Bug 26648] New: Prevent internal server error if item attached to old checkout has been removed
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Bug ID: 26648 Summary: Prevent internal server error if item attached to old checkout has been removed Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@ptfs-europe.com QA Contact: testopia@bugs.koha-community.org Whilst playing with notices to see if we could calculate a running total of savings for a library user to add to their issueslip notice I found that if an item relating to an old checkout has been deleted, then the relation accessor can explode -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #1 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 111416 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=111416&action=edit Bug 26648: Prevent explosion on missin item The item accessor in Koha::Old::Checkouts could explode given a checkout where the item had been deleted. To test 1/ Edit the issueslip notice to output some item details from the borrowers old checkouts [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% END %] [% END %] 2/ Delete the item associated with an old checkout for a test patron 3/ Print the issueslip for the patron 4/ Note a server side error is triggered 5/ Apply the patch 6/ Print the slip again and note the price details for old checkouts are now displayed 7/ Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@ptfs-europe |ity.org |.com -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #2 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Dumping this example here so I don't loose it [% USE Price %] [% savings = 0 %] [% FOREACH checkout IN borrower.checkouts %] [% savings = checkout.item.price + savings %] [% END %] [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% savings = old_checkout.item.price + savings %] [% END %] [% END %] You have saved [% savings | $Price %] to date by using the library. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sally.healey@cheshireshared | |services.gov.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #3 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Created attachment 111435 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=111435&action=edit Bug 26648: Prevent explosion in notices on missing item The item accessor in Koha::Old::Checkouts could explode given a checkout where the item had been deleted. To test 1/ Edit the issueslip notice to output some item details from the borrowers old checkouts [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% END %] [% END %] 2/ Delete the item associated with an old checkout for a test patron 3/ Print the issueslip for the patron 4/ Note a server side error is triggered 5/ Apply the patch 6/ Print the slip again and note the price details for old checkouts are now displayed 7/ Signoff Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com --- Comment #4 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- YES! It works!! I changed the title of the commit to correct a typo and make it more specific. I hope that's ok. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #5 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- My complete slip for future reference [%- USE KohaDates -%] [%- USE Price -%] [% totalValue = 0 %] [% totalSavings = 0 %] <h3><<branches.branchname>></h3> Checked out by <<borrowers.firstname>> <<borrowers.surname>> <br /> (<<borrowers.cardnumber>>) <br /> <<today>><br /> <h4>Borrowed today</h4> [% FOREACH checkout IN checkouts %] [%~ SET item = checkout.item %] [%~ SET biblio = checkout.item.biblio %] [% totalValue = item.price + totalValue %] [% totalSavings = item.price + totalSavings %] <p>[% biblio.title %]<br /> Call number: [% item.itemcallnumber %]<br /> Due date: [% checkout.date_due | $KohaDates %]</p> [% END %] [% IF overdues.count %] <h4>Overdues</h4> [% FOREACH overdue IN overdues %] [%~ SET item = overdue.item %] [%~ SET biblio = overdue.item.biblio %] [% totalValue = item.price + totalValue %] [% totalSavings = item.price + totalSavings %] <p>[% biblio.title %]<br /> Call number: [% item.itemcallnumber %]<br /> Due date: [% overdue.date_due | $KohaDates %]</p> [% END %] [% END %] [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% totalSavings = old_checkout.item.price + totalSavings %] [% END %] [% END %] <p>You saved [% totalValue | $Price %] by using the library today!</p> <p>Since you've been a member of the library, you saved [% totalSavings | $Price %]!</p> <hr> <h4 style="text-align: center; font-style:italic;">News</h4> <news> <div class="newsitem"> <h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5> <p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.content>></p> <p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Published on <<opac_news.timestamp>></p> <hr /> </div> </news> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #6 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Oh yeah, we should remove the random price to use in production [%- USE KohaDates -%] [%- USE Price -%] [% totalValue = 0 %] [% totalSavings = 0 %] <h3><<branches.branchname>></h3> Checked out by <<borrowers.firstname>> <<borrowers.surname>> <br /> (<<borrowers.cardnumber>>) <br /> <<today>><br /> <h4>Borrowed today</h4> [% FOREACH checkout IN checkouts %] [%~ SET item = checkout.item %] [%~ SET biblio = checkout.item.biblio %] [% totalValue = item.price + totalValue %] [% totalSavings = item.price + totalSavings %] <p>[% biblio.title %]<br /> Call number: [% item.itemcallnumber %]<br /> Due date: [% checkout.date_due | $KohaDates %]</p> [% END %] [% IF overdues.count %] <h4>Overdues</h4> [% FOREACH overdue IN overdues %] [%~ SET item = overdue.item %] [%~ SET biblio = overdue.item.biblio %] [% totalValue = item.price + totalValue %] [% totalSavings = item.price + totalSavings %] <p>[% biblio.title %]<br /> Call number: [% item.itemcallnumber %]<br /> Due date: [% overdue.date_due | $KohaDates %]</p> [% END %] [% END %] [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% totalSavings = old_checkout.item.price + totalSavings %] [% END %] [% END %] <p>You saved [% totalValue | $Price %] by using the library today!</p> <p>Since you've been a member of the library, you saved [% totalSavings | $Price %]!</p> <hr> <h4 style="text-align: center; font-style:italic;">News</h4> <news> <div class="newsitem"> <h5 style="margin-bottom: 1px; margin-top: 1px"><b><<opac_news.title>></b></h5> <p style="margin-bottom: 1px; margin-top: 1px"><<opac_news.content>></p> <p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px">Published on <<opac_news.timestamp>></p> <hr /> </div> </news> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #111416|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Really glad it all works out :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #111435|0 |1 is obsolete| | --- Comment #8 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 111804 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=111804&action=edit Bug 26648: Prevent explosion in notices on missing item The item accessor in Koha::Old::Checkouts could explode given a checkout where the item had been deleted. To test 1/ Edit the issueslip notice to output some item details from the borrowers old checkouts [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% END %] [% END %] 2/ Delete the item associated with an old checkout for a test patron 3/ Print the issueslip for the patron 4/ Note a server side error is triggered 5/ Apply the patch 6/ Print the slip again and note the price details for old checkouts are now displayed 7/ Signoff Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #9 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Please provide a test for this change. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Cab Vinton <bibliwho@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bibliwho@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #10 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 141287 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141287&action=edit Bug 26648: Add tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |31051 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31051 [Bug 31051] Show patron's 'savings' on the OPAC -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #111804|0 |1 is obsolete| | --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 141333 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141333&action=edit Bug 26648: Prevent explosion in notices on missing item The item accessor in Koha::Old::Checkouts could explode given a checkout where the item had been deleted. To test 1/ Edit the issueslip notice to output some item details from the borrowers old checkouts [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% END %] [% END %] 2/ Delete the item associated with an old checkout for a test patron 3/ Print the issueslip for the patron 4/ Note a server side error is triggered 5/ Apply the patch 6/ Print the slip again and note the price details for old checkouts are now displayed 7/ Signoff Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #141287|0 |1 is obsolete| | --- Comment #12 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 141334 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141334&action=edit Bug 26648: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #13 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Tests added and passing.. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 PTFS Europe Sandboxes <sandboxes@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #141334|0 |1 is obsolete| | --- Comment #14 from PTFS Europe Sandboxes <sandboxes@ptfs-europe.com> --- Created attachment 141382 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=141382&action=edit Bug 26648: Add tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Cab Vinton <director@plaistowlibrary.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable Version(s)|22.11.00 |22.11.00, 22.05.08 released in| | CC| |lucas@bywatersolutions.com --- Comment #16 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 22.05.x for upcoming 22.05.08 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable CC| |arthur.suzuki@biblibre.com --- Comment #17 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- conflicts when trying to apply the tests (file t/db_dependent/Koha/Old/Checkout is missing on my branch). Won't backport unless asked for -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26648 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org