[Bug 39871] New: Cannot clear item statuses with batch item modification tool
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Bug ID: 39871 Summary: Cannot clear item statuses with batch item modification tool Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: emily.lamancusa@montgomerycountymd.gov QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl To replicate: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save If you view the background job report, it will say that the items could not be modified, and if you view the items you will see that the statuses were not cleared. The background job logs show database warnings saying that those columns cannot be set to null. More testing may be needed to see if this applies to other fields as well. I suspect it will apply to the lost field as well, but the lost status is currently hidden on the batch item modification screen on main for me - not sure if that is another bug or a configuration I wasn't aware of. -- 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=39871 --- Comment #1 from Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> --- Created attachment 183522 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183522&action=edit Bug 39871: Don't pass undef for non-nullable fields from batch mod tool To test: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save 5. View the background job report --> Note that it says the items could not be modified 6. Look at the items --> The statuses have not been cleared 7. Apply patch and restart_all 8. Repeat steps 2-5 --> The background job report says the modifications were successful 9. View the items --> The statuses have been cleared -- 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=39871 Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |emily.lamancusa@montgomeryc |ity.org |ountymd.gov Patch complexity|--- |Trivial patch -- 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=39871 David Flater <flaterdavid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183522|0 |1 is obsolete| | --- Comment #2 from David Flater <flaterdavid@gmail.com> --- Created attachment 183538 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183538&action=edit Bug 39871: Don't pass undef for non-nullable fields from batch mod tool To test: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save 5. View the background job report --> Note that it says the items could not be modified 6. Look at the items --> The statuses have not been cleared 7. Apply patch and restart_all 8. Repeat steps 2-5 --> The background job report says the modifications were successful 9. View the items --> The statuses have been cleared Signed-off-by: David Flater <flaterdavid@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 David Flater <flaterdavid@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |flaterdavid@gmail.com 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=39871 Owen Leonard <oleonard@myacpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183538|0 |1 is obsolete| | --- Comment #3 from Owen Leonard <oleonard@myacpl.org> --- Created attachment 183549 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183549&action=edit Bug 39871: Don't pass undef for non-nullable fields from batch mod tool To test: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save 5. View the background job report --> Note that it says the items could not be modified 6. Look at the items --> The statuses have not been cleared 7. Apply patch and restart_all 8. Repeat steps 2-5 --> The background job report says the modifications were successful 9. View the items --> The statuses have been cleared Signed-off-by: David Flater <flaterdavid@gmail.com> Signed-off-by: Owen Leonard <oleonard@myacpl.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | Status|Signed Off |BLOCKED --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Looking here -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #5 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Doing something wrong helps you find bugs :) batchMod works with a nested try/catch construction: First the worker calls Koha/BackgroundJob/BatchUpdateItem.pm doing try { my ($results) = Koha::Items->search( { itemnumber => \@record_ids } )->batch_update( etc } catch { warn $_; die "Something terrible has happened!" if ( $_ =~ /Rollback failed/ ); # Rollback failed And batch_update does this try { $schema->txn_do( sub { [etc] $item->set($new_values)->store( { skip_record_index => 1 } ); [etc] } catch { push @errors, { error => eval { $_->{error} } || "$_", }; warn $_ Note here that the catch does not die or raise an exception! I found the error in worker-output.log: DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'enumchron' cannot be null at /usr/share/koha/Koha/Object.pm line 174 This error was raised by doing something wrong but that does not matter here. The point is that the inner try block only warns in the catch. So the outer try block does not catch anything! The error is just silently ignored. I just got back: No items modified. Note that this error should have its own new report. Will open one. What did I do wrong btw? I tested my follow-up with withdrawn and enumchron. First I tested if enumchron was blanked with NULL. That was ok. Then I just altered the table items with enumchron NOT NULL and hoped to see that it would be empty string. Forgetting that I am asking DBIx if it is nullable, so DBIx had not changed and said Go ahead. Etc etc. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA Patch complexity|Trivial patch |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183549|0 |1 is obsolete| | --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 183591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183591&action=edit Bug 39871: Don't pass undef for non-nullable fields from batch mod tool To test: 1. Set not-for-loan, withdrawn, and damaged statuses on some items 2. Try to edit only those items with the Batch item modification tool 3. Check the checkboxes to clear the withdrawn, not-for-loan, and damaged statuses 4. Click Save 5. View the background job report --> Note that it says the items could not be modified 6. Look at the items --> The statuses have not been cleared 7. Apply patch and restart_all 8. Repeat steps 2-5 --> The background job report says the modifications were successful 9. View the items --> The statuses have been cleared Signed-off-by: David Flater <flaterdavid@gmail.com> Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #7 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 183592 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183592&action=edit Bug 39871: (QA follow-up) Do not hardcode nullable check Lets check DBIx's columns_info. Test plan: Try to blank an integer column and a string column. Verify results. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to Emily Lamancusa (emlam) from comment #0)
The background job logs show database warnings saying that those columns cannot be set to null.
Actually an issue on itself as confirmed above. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=40259 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |BLOCKED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #9 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Wait. This follow-up does not handle not-nullable dates correctly (if we have them in items) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183592|0 |1 is obsolete| | --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 183596 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183596&action=edit Bug 39871: (QA follow-up) Do not hardcode nullable check Lets check DBIx's columns_info. Test plan: Try to blank an integer column and a string column. Verify results. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |25.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #11 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed CC| |lucas@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|25.11.00 |25.11.00,25.05.02 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 --- Comment #12 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|25.11.00,25.05.02 |25.11.00,25.05.02,24.11.08 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to stable |Pushed to oldstable --- Comment #13 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 24.11.x for 24.11.08 Whould be great to have a release note, it is a quite complexe change to explain -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | Text to go in the| |This fixes a bug with the release notes| |Batch item modification | |tool. Previously, if | |library staff tried to | |clear the items' | |not-for-loan, withdrawn, or | |damaged status using the | |Batch item modification | |tool, the job would fail | |and items would not be | |modified. Now the tool can | |be used to clear those | |fields, just like any other | |non-mandatory field. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Cannot clear item statuses |Clearing item statuses with |with batch item |batch item modification |modification tool |tool does not work | |correctly Text to go in the|This fixes a bug with the |This fixes a bug with the release notes|Batch item modification |Batch item modification |tool. Previously, if |tool. Previously, if |library staff tried to |library staff tried to |clear the items' |clear the items' |not-for-loan, withdrawn, or |not-for-loan, withdrawn, |damaged status using the |lost, or damaged status |Batch item modification |using the Batch item |tool, the job would fail |modification tool, the |and items would not be |fields would not be cleared |modified. Now the tool can |correctly. Depending on the |be used to clear those |database settings, the job |fields, just like any other |might fail completely and |non-mandatory field. |the items wouldn't be | |modified at all, or else | |the status would be | |cleared, but the status | |date (such as withdrawn_on | |or itemlost_on) would not | |be cleared. Now the tool | |can be used to clear those | |fields, just like any other | |non-mandatory field. --- Comment #14 from Emily Lamancusa (emlam) <emily.lamancusa@montgomerycountymd.gov> --- As it turns out, this bug manifests differently on production servers if they have SQL strict mode turned off. Without strict mode, the batch edit completes successfully, but the withdrawn_on, itemlost_on, etc date is not cleared. It's probably not necessary to go back and change the release notes for 25.05.02 and 24.11.08 since no one else has reported that bug, but I'll change them for 25.11 at least. Mostly I wanted to make a note on the off chance that another library notices their withdrawn_on/itemlost_on/etc dates aren't getting cleared, otherwise they have no way of knowing this is the same bug. (Hopefully this will save someone else from spending a bunch of time trying to track down the bug like I just did!) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Katie Bliss <kebliss@dmpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kebliss@dmpl.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #15 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- I think the patches fix a real issue with the batchMod.pl tool and items. But I also think the fix is hiding a bug in `Koha::Item->store()`, which should be clearing those fields and isn't. The issue is with this check: ``` if ( exists $updated_columns{$field} && defined( $self->$field ) && !$self->$field ) { my $field_on = "${field}_on"; $self->$field_on(undef); } ``` Which implies that setting one of the 'special' fields to `undef` will never clear the corresponding `_on` field. It is important to fix this so other people using the method can rely on it safely. I will file a separate bug to talk about this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39871 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |Needs documenting CC| |wainuiwitikapark@catalyst.n | |et.nz --- Comment #16 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11.x as it wasn't backported to 24.05.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org