https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14962

--- Comment #690 from Jake Deery (kwenoch) <[email protected]> ---
Created attachment 211982
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211982&action=edit
Bug 14962: (QA follow-up) Make display item/display store() throw and harden
the batch jobs

Koha::Display::Item->store and Koha::Display->store returned undef when
they refused to store, and callers either ignored that or chained on it:

- Koha::Display::Item->store called $item->active_display before checking
  the item existed, so a bad itemnumber died. It also relied on the
  relationship accessors, which return a placeholder object for an unsaved
  row, so an unknown id was only caught later as an FK error. Look the
  display and item up by id and throw Koha::Exceptions::BadParameter, which
  the REST layer already renders as a 400.
- The 'already on an active display added later' check iterated a single
  ->next row, so it inspected an arbitrary item. Compare against the item's
  own active display item.
- Koha::Display->store silently returned for a missing required attribute.
- BatchAddDisplayItems chained ->display_item_id on the undef return, so one
  refused barcode died, rolled back the whole batch and left the report
  claiming the rolled-back rows were added. A refused barcode is now a failed
  item; an unexpected error rolls back, resets the counts and marks the job
  failed. Progress counts every barcode, cancellation is reported and a
  missing display fails the job. BatchDeleteDisplayItems gets the same
  treatment.
- The delete methods logged before deleting, so a failed delete left a log
  entry for something that did not happen.
- display_items compared undef dates with ne and diffed arbitrary keys.

The REST add() check from the previous follow-up is now redundant (and
unreachable for a missing item) so go back to a plain store().

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to